feat(story-1.2): Vue 3 SPA scaffold, base component library, User entity, SpaController
Frontend: - Vue 3 + Vite + TypeScript strict in frontend/; builds to public/build/ - Vue Router (hash-history, requiresAuth guard → /login) and Pinia - Global SCSS design tokens with 6 full themes (Warm Craft, Playful Pop, Sage & Cream, Dusty Mauve, Ocean Dusk, Honey & Slate) - Base components: BaseButton (5 variants), BaseInput (floating label, error state), BaseBottomSheet (slide-up, focus trap, tap-outside dismiss), BaseCard, BaseChip, BaseToast (2.5s auto-dismiss, aria-live polite), BottomNav (4 tabs, hides at 960px) - Type stubs for all API shapes: User, Device, Image, StickerLayer, RenderedAsset, Token Backend: - SpaController catch-all serves public/build/index.html; excludes api/setup/token/login/register - User entity (email+password+roles+theme); UserRepository with PasswordUpgrader - SecurityController with /login, /logout, /register stubs; Twig login form - security.yaml: form_login firewall, remember_me, role_hierarchy, access_control - Migration: create user table Verified: npm run build succeeds, GET / → 302 /login (unauthenticated) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<RouterView />
|
||||
<BottomNav />
|
||||
<BaseToast />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import BottomNav from '@/components/BottomNav.vue'
|
||||
import BaseToast from '@/components/BaseToast.vue'
|
||||
</script>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 8.5 KiB |
@@ -0,0 +1,104 @@
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<Transition name="sheet">
|
||||
<div
|
||||
v-if="modelValue"
|
||||
class="sheet-overlay"
|
||||
role="dialog"
|
||||
:aria-label="label"
|
||||
aria-modal="true"
|
||||
@click.self="close"
|
||||
@keydown.esc="close"
|
||||
>
|
||||
<div
|
||||
ref="sheetRef"
|
||||
class="sheet"
|
||||
tabindex="-1"
|
||||
>
|
||||
<div class="sheet__handle" aria-hidden="true" />
|
||||
<slot />
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, nextTick } from 'vue'
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: boolean
|
||||
label: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: boolean]
|
||||
}>()
|
||||
|
||||
const sheetRef = ref<HTMLElement | null>(null)
|
||||
let triggerEl: HTMLElement | null = null
|
||||
|
||||
function close() {
|
||||
emit('update:modelValue', false)
|
||||
}
|
||||
|
||||
watch(() => props.modelValue, async (open) => {
|
||||
if (open) {
|
||||
triggerEl = document.activeElement as HTMLElement
|
||||
await nextTick()
|
||||
sheetRef.value?.focus()
|
||||
} else {
|
||||
triggerEl?.focus()
|
||||
triggerEl = null
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.sheet-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
z-index: 100;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.sheet {
|
||||
width: 100%;
|
||||
background: var(--color-surface);
|
||||
border-radius: var(--radius-lg) var(--radius-lg) 0 0;
|
||||
padding: var(--space-3) var(--space-4) var(--space-6);
|
||||
max-height: 90dvh;
|
||||
overflow-y: auto;
|
||||
outline: none;
|
||||
|
||||
&__handle {
|
||||
width: 36px;
|
||||
height: 4px;
|
||||
border-radius: var(--radius-full);
|
||||
background: var(--color-border);
|
||||
margin: 0 auto var(--space-4);
|
||||
}
|
||||
}
|
||||
|
||||
.sheet-enter-active {
|
||||
.sheet-overlay { transition: background var(--duration-base) var(--ease-out); }
|
||||
.sheet { transition: transform 250ms var(--ease-out); }
|
||||
}
|
||||
|
||||
.sheet-leave-active {
|
||||
.sheet { transition: transform 200ms ease-in; }
|
||||
transition: background 200ms ease-in;
|
||||
}
|
||||
|
||||
.sheet-enter-from {
|
||||
background: rgba(0, 0, 0, 0);
|
||||
.sheet { transform: translateY(100%); }
|
||||
}
|
||||
|
||||
.sheet-leave-to {
|
||||
background: rgba(0, 0, 0, 0);
|
||||
.sheet { transform: translateY(100%); }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,102 @@
|
||||
<template>
|
||||
<component
|
||||
:is="tag"
|
||||
:type="tag === 'button' ? type : undefined"
|
||||
:disabled="disabled || loading"
|
||||
:class="['btn', `btn--${variant}`, { 'btn--loading': loading }]"
|
||||
v-bind="$attrs"
|
||||
>
|
||||
<span v-if="loading" class="btn__spinner" aria-hidden="true" />
|
||||
<slot />
|
||||
</component>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
withDefaults(defineProps<{
|
||||
variant?: 'primary' | 'secondary' | 'ghost' | 'destructive' | 'icon-pill'
|
||||
tag?: 'button' | 'a' | 'router-link'
|
||||
type?: 'button' | 'submit' | 'reset'
|
||||
disabled?: boolean
|
||||
loading?: boolean
|
||||
}>(), {
|
||||
variant: 'primary',
|
||||
tag: 'button',
|
||||
type: 'button',
|
||||
disabled: false,
|
||||
loading: false,
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--space-2);
|
||||
min-height: var(--touch-min);
|
||||
padding: 0 var(--space-5);
|
||||
border-radius: var(--radius-full);
|
||||
font-family: var(--font-family);
|
||||
font-size: var(--text-base);
|
||||
font-weight: 600;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
transition: opacity var(--duration-fast) var(--ease-out),
|
||||
transform var(--duration-fast) var(--ease-out);
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
&:not(:disabled):active {
|
||||
transform: scale(0.96);
|
||||
}
|
||||
|
||||
&--primary {
|
||||
background: var(--color-primary);
|
||||
color: var(--color-primary-fg);
|
||||
}
|
||||
|
||||
&--secondary {
|
||||
background: var(--color-secondary);
|
||||
color: var(--color-secondary-fg);
|
||||
border: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
&--ghost {
|
||||
background: transparent;
|
||||
color: var(--color-text);
|
||||
border: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
&--destructive {
|
||||
background: var(--color-destructive);
|
||||
color: var(--color-destructive-fg);
|
||||
}
|
||||
|
||||
&--icon-pill {
|
||||
width: var(--touch-min);
|
||||
padding: 0;
|
||||
border-radius: var(--radius-full);
|
||||
background: var(--color-surface-2);
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
&__spinner {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border: 2px solid currentColor;
|
||||
border-top-color: transparent;
|
||||
border-radius: 50%;
|
||||
animation: spin 0.7s linear infinite;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,14 @@
|
||||
<template>
|
||||
<div class="card" v-bind="$attrs">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.card {
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-md);
|
||||
padding: var(--space-4);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,48 @@
|
||||
<template>
|
||||
<span :class="['chip', `chip--${variant}`]" v-bind="$attrs">
|
||||
<slot />
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
withDefaults(defineProps<{
|
||||
variant?: 'default' | 'primary' | 'success' | 'warning' | 'error'
|
||||
}>(), { variant: 'default' })
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--space-1);
|
||||
padding: var(--space-1) var(--space-3);
|
||||
border-radius: var(--radius-full);
|
||||
font-size: var(--text-sm);
|
||||
font-weight: 600;
|
||||
|
||||
&--default {
|
||||
background: var(--color-surface-2);
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
&--primary {
|
||||
background: var(--color-primary);
|
||||
color: var(--color-primary-fg);
|
||||
}
|
||||
|
||||
&--success {
|
||||
background: #d4edda;
|
||||
color: #155724;
|
||||
}
|
||||
|
||||
&--warning {
|
||||
background: #fff3cd;
|
||||
color: #856404;
|
||||
}
|
||||
|
||||
&--error {
|
||||
background: #f8d7da;
|
||||
color: #721c24;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<div :class="['input-wrap', { 'input-wrap--error': !!error, 'input-wrap--filled': !!modelValue }]">
|
||||
<input
|
||||
:id="inputId"
|
||||
v-bind="$attrs"
|
||||
:value="modelValue"
|
||||
:type="type"
|
||||
class="input-wrap__field"
|
||||
placeholder=" "
|
||||
@input="emit('update:modelValue', ($event.target as HTMLInputElement).value)"
|
||||
@blur="emit('blur', $event)"
|
||||
/>
|
||||
<label :for="inputId" class="input-wrap__label">{{ label }}</label>
|
||||
<p v-if="error" :id="`${inputId}-error`" class="input-wrap__error" role="alert">
|
||||
{{ error }}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
modelValue?: string
|
||||
label: string
|
||||
type?: string
|
||||
error?: string
|
||||
id?: string
|
||||
}>(), {
|
||||
modelValue: '',
|
||||
type: 'text',
|
||||
})
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: string]
|
||||
blur: [event: FocusEvent]
|
||||
}>()
|
||||
|
||||
const inputId = computed(() => props.id ?? `input-${Math.random().toString(36).slice(2)}`)
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.input-wrap {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
|
||||
&__field {
|
||||
width: 100%;
|
||||
min-height: var(--touch-min);
|
||||
padding: var(--space-4) var(--space-4) var(--space-2);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--color-surface);
|
||||
color: var(--color-text);
|
||||
font-family: var(--font-family);
|
||||
font-size: var(--text-base);
|
||||
transition: border-color var(--duration-fast);
|
||||
|
||||
&::placeholder {
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
|
||||
&:not(:placeholder-shown) ~ .input-wrap__label,
|
||||
&:focus ~ .input-wrap__label {
|
||||
transform: translateY(-10px) scale(0.78);
|
||||
color: var(--color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
&__label {
|
||||
position: absolute;
|
||||
left: var(--space-4);
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
color: var(--color-text-muted);
|
||||
font-size: var(--text-base);
|
||||
pointer-events: none;
|
||||
transform-origin: left center;
|
||||
transition: transform var(--duration-fast), color var(--duration-fast);
|
||||
}
|
||||
|
||||
&--error &__field {
|
||||
border-color: var(--color-destructive);
|
||||
}
|
||||
|
||||
&__error {
|
||||
margin-top: var(--space-1);
|
||||
padding-left: var(--space-4);
|
||||
font-size: var(--text-sm);
|
||||
color: var(--color-destructive);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<div class="toast-region" aria-live="polite" aria-atomic="false">
|
||||
<TransitionGroup name="toast" tag="ul" class="toast-list">
|
||||
<li
|
||||
v-for="toast in toastStore.toasts"
|
||||
:key="toast.id"
|
||||
:class="['toast', `toast--${toast.type}`]"
|
||||
role="status"
|
||||
>
|
||||
{{ toast.message }}
|
||||
<button class="toast__close" aria-label="Dismiss" @click="toastStore.dismiss(toast.id)">
|
||||
×
|
||||
</button>
|
||||
</li>
|
||||
</TransitionGroup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useToastStore } from '@/stores/toast'
|
||||
const toastStore = useToastStore()
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.toast-region {
|
||||
position: fixed;
|
||||
bottom: calc(var(--bottom-nav-height, 64px) + var(--space-4));
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
z-index: 200;
|
||||
width: min(calc(100vw - var(--space-8)), 420px);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.toast-list {
|
||||
list-style: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.toast {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: var(--space-3) var(--space-4);
|
||||
border-radius: var(--radius-md);
|
||||
font-size: var(--text-sm);
|
||||
font-weight: 600;
|
||||
pointer-events: auto;
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
||||
|
||||
&--info { background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); }
|
||||
&--success { background: #d4edda; color: #155724; }
|
||||
&--error { background: #f8d7da; color: #721c24; }
|
||||
|
||||
&__close {
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-size: var(--text-lg);
|
||||
line-height: 1;
|
||||
padding: 0 0 0 var(--space-3);
|
||||
color: inherit;
|
||||
min-height: var(--touch-min);
|
||||
min-width: var(--touch-min);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
|
||||
.toast-enter-active,
|
||||
.toast-leave-active {
|
||||
transition: all var(--duration-base) var(--ease-out);
|
||||
}
|
||||
|
||||
.toast-enter-from,
|
||||
.toast-leave-to {
|
||||
opacity: 0;
|
||||
transform: translateY(12px);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,101 @@
|
||||
<template>
|
||||
<nav class="bottom-nav" aria-label="Main navigation">
|
||||
<RouterLink
|
||||
v-for="tab in tabs"
|
||||
:key="tab.name"
|
||||
:to="tab.to"
|
||||
:class="['bottom-nav__tab', { 'bottom-nav__tab--active': isActive(tab.to) }]"
|
||||
:aria-label="tab.label"
|
||||
:aria-current="isActive(tab.to) ? 'page' : undefined"
|
||||
>
|
||||
<span class="bottom-nav__icon" aria-hidden="true" v-html="tab.icon" />
|
||||
<span class="bottom-nav__label">{{ tab.label }}</span>
|
||||
</RouterLink>
|
||||
</nav>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const tabs = [
|
||||
{
|
||||
name: 'home',
|
||||
label: 'Home',
|
||||
to: '/',
|
||||
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9,22 9,12 15,12 15,22"/></svg>',
|
||||
},
|
||||
{
|
||||
name: 'library',
|
||||
label: 'Library',
|
||||
to: '/library',
|
||||
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/></svg>',
|
||||
},
|
||||
{
|
||||
name: 'shared',
|
||||
label: 'Shared',
|
||||
to: '/shared',
|
||||
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"/><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"/></svg>',
|
||||
},
|
||||
{
|
||||
name: 'settings',
|
||||
label: 'Settings',
|
||||
to: '/settings',
|
||||
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>',
|
||||
},
|
||||
]
|
||||
|
||||
function isActive(path: string) {
|
||||
if (path === '/') return route.path === '/'
|
||||
return route.path.startsWith(path)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.bottom-nav {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 64px;
|
||||
background: var(--color-surface);
|
||||
border-top: 1px solid var(--color-border);
|
||||
display: flex;
|
||||
z-index: 50;
|
||||
|
||||
@media (min-width: 960px) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&__tab {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 2px;
|
||||
color: var(--color-text-muted);
|
||||
text-decoration: none;
|
||||
min-height: var(--touch-min);
|
||||
transition: color var(--duration-fast);
|
||||
|
||||
&--active {
|
||||
color: var(--color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
&__icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
&__label {
|
||||
font-size: var(--text-xs);
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,10 @@
|
||||
import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
import '@/styles/global.scss'
|
||||
import App from './App.vue'
|
||||
import router from '@/router'
|
||||
|
||||
const app = createApp(App)
|
||||
app.use(createPinia())
|
||||
app.use(router)
|
||||
app.mount('#app')
|
||||
@@ -0,0 +1,46 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: () => import('@/views/HomeView.vue'),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/library',
|
||||
name: 'library',
|
||||
component: () => import('@/views/LibraryView.vue'),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/shared',
|
||||
name: 'shared',
|
||||
component: () => import('@/views/SharedView.vue'),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/settings',
|
||||
name: 'settings',
|
||||
component: () => import('@/views/SettingsView.vue'),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/:pathMatch(.*)*',
|
||||
redirect: '/',
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
router.beforeEach((to) => {
|
||||
const auth = useAuthStore()
|
||||
if (to.meta.requiresAuth && !auth.isAuthenticated) {
|
||||
window.location.href = '/login'
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
export default router
|
||||
@@ -0,0 +1,18 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref, computed } from 'vue'
|
||||
import type { User } from '@/types'
|
||||
|
||||
export const useAuthStore = defineStore('auth', () => {
|
||||
// Bootstrapped from the SPA shell injected by SpaController
|
||||
const user = ref<User | null>(
|
||||
(window as unknown as Record<string, unknown>).__PF_USER__ as User | null ?? null
|
||||
)
|
||||
|
||||
const isAuthenticated = computed(() => user.value !== null)
|
||||
|
||||
function setUser(u: User | null) {
|
||||
user.value = u
|
||||
}
|
||||
|
||||
return { user, isAuthenticated, setUser }
|
||||
})
|
||||
@@ -0,0 +1,27 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
|
||||
export interface ToastMessage {
|
||||
id: number
|
||||
message: string
|
||||
type: 'info' | 'success' | 'error'
|
||||
}
|
||||
|
||||
let nextId = 0
|
||||
|
||||
export const useToastStore = defineStore('toast', () => {
|
||||
const toasts = ref<ToastMessage[]>([])
|
||||
|
||||
function show(message: string, type: ToastMessage['type'] = 'info') {
|
||||
const id = ++nextId
|
||||
toasts.value.push({ id, message, type })
|
||||
setTimeout(() => dismiss(id), 2500)
|
||||
}
|
||||
|
||||
function dismiss(id: number) {
|
||||
const idx = toasts.value.findIndex((t) => t.id === id)
|
||||
if (idx !== -1) toasts.value.splice(idx, 1)
|
||||
}
|
||||
|
||||
return { toasts, show, dismiss }
|
||||
})
|
||||
@@ -0,0 +1,187 @@
|
||||
// ─── Design tokens ───────────────────────────────────────────────────────────
|
||||
|
||||
:root {
|
||||
// Typography
|
||||
--font-family: 'Nunito Variable', 'Nunito', sans-serif;
|
||||
--text-xs: 11px;
|
||||
--text-sm: 13px;
|
||||
--text-base: 15px;
|
||||
--text-md: 17px;
|
||||
--text-lg: 20px;
|
||||
--text-xl: 24px;
|
||||
--text-2xl: 28px;
|
||||
|
||||
// Spacing
|
||||
--space-1: 4px;
|
||||
--space-2: 8px;
|
||||
--space-3: 12px;
|
||||
--space-4: 16px;
|
||||
--space-5: 20px;
|
||||
--space-6: 24px;
|
||||
--space-8: 32px;
|
||||
|
||||
// Radius
|
||||
--radius-sm: 6px;
|
||||
--radius-md: 12px;
|
||||
--radius-lg: 20px;
|
||||
--radius-full: 9999px;
|
||||
|
||||
// Motion
|
||||
--duration-fast: 150ms;
|
||||
--duration-base: 250ms;
|
||||
--ease-out: cubic-bezier(0, 0, 0.2, 1);
|
||||
|
||||
// Touch target minimum
|
||||
--touch-min: 44px;
|
||||
}
|
||||
|
||||
// ─── Themes ──────────────────────────────────────────────────────────────────
|
||||
|
||||
[data-theme="warm-craft"],
|
||||
:root {
|
||||
--color-bg: #fdf6ee;
|
||||
--color-surface: #fff9f2;
|
||||
--color-surface-2: #f5ead8;
|
||||
--color-border: #e8d9c4;
|
||||
--color-text: #3a2e22;
|
||||
--color-text-muted: #8a7060;
|
||||
--color-primary: #c97c3a;
|
||||
--color-primary-fg: #ffffff;
|
||||
--color-secondary: #e8d9c4;
|
||||
--color-secondary-fg:#3a2e22;
|
||||
--color-destructive: #c0392b;
|
||||
--color-destructive-fg: #ffffff;
|
||||
--color-focus-ring: #c97c3a;
|
||||
}
|
||||
|
||||
[data-theme="playful-pop"] {
|
||||
--color-bg: #fff0fb;
|
||||
--color-surface: #fff8fe;
|
||||
--color-surface-2: #ffe4f7;
|
||||
--color-border: #f0c8ea;
|
||||
--color-text: #2d0a28;
|
||||
--color-text-muted: #7a4272;
|
||||
--color-primary: #d63aab;
|
||||
--color-primary-fg: #ffffff;
|
||||
--color-secondary: #ffe4f7;
|
||||
--color-secondary-fg:#2d0a28;
|
||||
--color-destructive: #e03030;
|
||||
--color-destructive-fg: #ffffff;
|
||||
--color-focus-ring: #d63aab;
|
||||
}
|
||||
|
||||
[data-theme="sage-cream"] {
|
||||
--color-bg: #f6f8f3;
|
||||
--color-surface: #fafcf7;
|
||||
--color-surface-2: #e4ede0;
|
||||
--color-border: #ccd9c4;
|
||||
--color-text: #1e2b1a;
|
||||
--color-text-muted: #607050;
|
||||
--color-primary: #4e7c3a;
|
||||
--color-primary-fg: #ffffff;
|
||||
--color-secondary: #e4ede0;
|
||||
--color-secondary-fg:#1e2b1a;
|
||||
--color-destructive: #a83020;
|
||||
--color-destructive-fg: #ffffff;
|
||||
--color-focus-ring: #4e7c3a;
|
||||
}
|
||||
|
||||
[data-theme="dusty-mauve"] {
|
||||
--color-bg: #f6f0f4;
|
||||
--color-surface: #fdf8fb;
|
||||
--color-surface-2: #ead8e8;
|
||||
--color-border: #d8c4d4;
|
||||
--color-text: #2a1828;
|
||||
--color-text-muted: #7a5874;
|
||||
--color-primary: #8e4a84;
|
||||
--color-primary-fg: #ffffff;
|
||||
--color-secondary: #ead8e8;
|
||||
--color-secondary-fg:#2a1828;
|
||||
--color-destructive: #b83030;
|
||||
--color-destructive-fg: #ffffff;
|
||||
--color-focus-ring: #8e4a84;
|
||||
}
|
||||
|
||||
[data-theme="ocean-dusk"] {
|
||||
--color-bg: #eef3f8;
|
||||
--color-surface: #f4f8fc;
|
||||
--color-surface-2: #d4e4f0;
|
||||
--color-border: #b8d0e4;
|
||||
--color-text: #0e2030;
|
||||
--color-text-muted: #4a6880;
|
||||
--color-primary: #1a6ea8;
|
||||
--color-primary-fg: #ffffff;
|
||||
--color-secondary: #d4e4f0;
|
||||
--color-secondary-fg:#0e2030;
|
||||
--color-destructive: #b83020;
|
||||
--color-destructive-fg: #ffffff;
|
||||
--color-focus-ring: #1a6ea8;
|
||||
}
|
||||
|
||||
[data-theme="honey-slate"] {
|
||||
--color-bg: #f2f2ee;
|
||||
--color-surface: #f8f8f4;
|
||||
--color-surface-2: #e4e0d4;
|
||||
--color-border: #d0cc bc;
|
||||
--color-text: #1c1c18;
|
||||
--color-text-muted: #6c6858;
|
||||
--color-primary: #c49a20;
|
||||
--color-primary-fg: #1c1c18;
|
||||
--color-secondary: #e4e0d4;
|
||||
--color-secondary-fg:#1c1c18;
|
||||
--color-destructive: #b03020;
|
||||
--color-destructive-fg: #ffffff;
|
||||
--color-focus-ring: #c49a20;
|
||||
}
|
||||
|
||||
// ─── Reset & base ─────────────────────────────────────────────────────────────
|
||||
|
||||
*, *::before, *::after {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
html {
|
||||
font-family: var(--font-family);
|
||||
font-size: var(--text-base);
|
||||
color: var(--color-text);
|
||||
background: var(--color-bg);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
body {
|
||||
min-height: 100dvh;
|
||||
}
|
||||
|
||||
#app {
|
||||
min-height: 100dvh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
// ─── Focus visible ────────────────────────────────────────────────────────────
|
||||
|
||||
:focus-visible {
|
||||
outline: 2px solid var(--color-focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
// ─── Utility mixins ───────────────────────────────────────────────────────────
|
||||
|
||||
@mixin touch-target {
|
||||
min-height: var(--touch-min);
|
||||
min-width: var(--touch-min);
|
||||
}
|
||||
|
||||
@mixin sr-only {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
padding: 0;
|
||||
margin: -1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
white-space: nowrap;
|
||||
border-width: 0;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
export interface User {
|
||||
id: number
|
||||
email: string
|
||||
roles: string[]
|
||||
theme: string | null
|
||||
}
|
||||
|
||||
export interface Device {
|
||||
id: number
|
||||
mac: string
|
||||
name: string
|
||||
orientation: 'landscape' | 'portrait'
|
||||
rotationInterval: number
|
||||
uniquenessWindow: number
|
||||
linkedAt: string
|
||||
}
|
||||
|
||||
export interface Image {
|
||||
id: number
|
||||
source: 'uploaded' | 'shared'
|
||||
filename: string
|
||||
thumbnailUrl: string
|
||||
deletedAt: string | null
|
||||
approvedDeviceIds: number[]
|
||||
}
|
||||
|
||||
export interface StickerLayer {
|
||||
id: string
|
||||
type: string
|
||||
x: number
|
||||
y: number
|
||||
scale: number
|
||||
rotation: number
|
||||
}
|
||||
|
||||
export interface RenderedAsset {
|
||||
id: number
|
||||
imageId: number
|
||||
deviceModel: string
|
||||
orientation: 'landscape' | 'portrait'
|
||||
status: 'pending' | 'processing' | 'ready' | 'failed'
|
||||
}
|
||||
|
||||
export interface Token {
|
||||
uuid: string
|
||||
type: 'share_approve' | 'share_decline' | 'hard_delete_confirm'
|
||||
expiresAt: string
|
||||
usedAt: string | null
|
||||
}
|
||||
|
||||
export interface ApiError {
|
||||
message: string
|
||||
errors?: Record<string, string[]>
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<main class="view">
|
||||
<h1>Home</h1>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.view { padding: var(--space-4); }
|
||||
</style>
|
||||
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<main class="view">
|
||||
<h1>Library</h1>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.view { padding: var(--space-4); }
|
||||
</style>
|
||||
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<main class="view">
|
||||
<h1>Settings</h1>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.view { padding: var(--space-4); }
|
||||
</style>
|
||||
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<main class="view">
|
||||
<h1>Shared</h1>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.view { padding: var(--space-4); }
|
||||
</style>
|
||||
Reference in New Issue
Block a user