-
Tauri 2 + Vue 3 — Querya tokens (no shadcn)
+
Tauri 2 + Vue 3 — tokens + Fluid Motion
{{ backend }}
+
+ springs: {{ springsOn ? "on" : "off" }} · level: {{ motionLevel }}
+
@@ -80,6 +99,43 @@ function setTheme(mode: QueryaThemeMode) {
Dark
+
+
+
+
+
+
+
+
+
@@ -88,6 +144,7 @@ function setTheme(mode: QueryaThemeMode) {
min-height: 100%;
display: grid;
place-content: center;
+ justify-items: center;
gap: var(--q-space-2);
padding: var(--q-space-8);
text-align: center;
@@ -107,7 +164,7 @@ function setTheme(mode: QueryaThemeMode) {
}
.meta {
- margin: var(--q-space-3) 0 0;
+ margin: var(--q-space-1) 0 0;
font-size: var(--q-text-sm);
color: var(--q-muted-foreground);
font-variant-numeric: tabular-nums;
@@ -144,7 +201,7 @@ function setTheme(mode: QueryaThemeMode) {
.theme-row {
display: inline-flex;
gap: var(--q-space-2);
- margin-top: var(--q-space-6);
+ margin-top: var(--q-space-4);
padding: var(--q-space-1);
border-radius: var(--q-radius-lg);
background: var(--q-card);
@@ -172,4 +229,26 @@ function setTheme(mode: QueryaThemeMode) {
color: var(--q-primary-foreground);
background: var(--q-primary);
}
+
+.demo-toggle {
+ margin-top: var(--q-space-4);
+ background: var(--q-secondary);
+ color: var(--q-secondary-foreground);
+ border: 1px solid var(--q-border);
+}
+
+.demo-panel {
+ width: 12rem;
+ height: 0;
+ margin-top: var(--q-space-3);
+ border-radius: var(--q-radius-md);
+ background: var(--q-primary);
+ opacity: 0.35;
+ transition-property: height, opacity;
+}
+
+.demo-panel.open {
+ height: 3rem;
+ opacity: 1;
+}
diff --git a/apps/tauri/src/motion/index.ts b/apps/tauri/src/motion/index.ts
new file mode 100644
index 00000000..804dccb6
--- /dev/null
+++ b/apps/tauri/src/motion/index.ts
@@ -0,0 +1,10 @@
+export type { QueryaMotionLevel, SpringDescription } from "./types";
+export {
+ QueryaMotionEasing,
+ QueryaMotionMs,
+ QueryaSpring,
+ effectiveDurationMs,
+ effectiveEasing,
+ springsEnabled,
+} from "./tokens";
+export { provideQueryaMotion, useQueryaMotion } from "./useQueryaMotion";
diff --git a/apps/tauri/src/motion/tokens.ts b/apps/tauri/src/motion/tokens.ts
new file mode 100644
index 00000000..4949dc12
--- /dev/null
+++ b/apps/tauri/src/motion/tokens.ts
@@ -0,0 +1,59 @@
+import type { QueryaMotionLevel, SpringDescription } from "./types";
+
+/** Duration tokens — Flutter `QueryaMotion` (ms). */
+export const QueryaMotionMs = {
+ instant: 0,
+ fast: 120,
+ standard: 200,
+ slow: 320,
+ treeExpand: 200,
+ sidebarCubic: 160,
+} as const;
+
+export type QueryaMotionToken = keyof typeof QueryaMotionMs;
+
+/** CSS easing — Flutter curve counterparts. */
+export const QueryaMotionEasing = {
+ enter: "cubic-bezier(0.33, 1, 0.68, 1)",
+ exit: "cubic-bezier(0.32, 0, 0.67, 0)",
+ standard: "cubic-bezier(0.65, 0, 0.35, 1)",
+ emphasized: "cubic-bezier(0.2, 0, 0, 1)",
+ linear: "linear",
+} as const;
+
+/** Spring presets — Flutter `QueryaSpring`. */
+export const QueryaSpring: Record<"snappy" | "gentle" | "bouncy", SpringDescription> =
+ {
+ snappy: { mass: 1, stiffness: 400, damping: 40 },
+ gentle: { mass: 1, stiffness: 180, damping: 26.83 },
+ bouncy: { mass: 1, stiffness: 300, damping: 20 },
+ };
+
+export function effectiveDurationMs(
+ level: QueryaMotionLevel,
+ tokenMs: number,
+): number {
+ if (tokenMs <= 0) return 0;
+ switch (level) {
+ case "off":
+ return 0;
+ case "reduced": {
+ const halved = Math.floor(tokenMs / 2);
+ return halved <= 0 ? QueryaMotionMs.fast : halved;
+ }
+ case "full":
+ return tokenMs;
+ }
+}
+
+export function effectiveEasing(
+ level: QueryaMotionLevel,
+ easing: string = QueryaMotionEasing.standard,
+): string {
+ return level === "off" ? QueryaMotionEasing.linear : easing;
+}
+
+/** Springs only in Full (Flutter `QueryaSpring.springsEnabled`). */
+export function springsEnabled(level: QueryaMotionLevel): boolean {
+ return level === "full";
+}
diff --git a/apps/tauri/src/motion/types.ts b/apps/tauri/src/motion/types.ts
new file mode 100644
index 00000000..75d1aa00
--- /dev/null
+++ b/apps/tauri/src/motion/types.ts
@@ -0,0 +1,8 @@
+/** Matches Flutter `QueryaMotionLevel`. */
+export type QueryaMotionLevel = "full" | "reduced" | "off";
+
+export type SpringDescription = {
+ mass: number;
+ stiffness: number;
+ damping: number;
+};
diff --git a/apps/tauri/src/motion/useQueryaMotion.ts b/apps/tauri/src/motion/useQueryaMotion.ts
new file mode 100644
index 00000000..e4570fee
--- /dev/null
+++ b/apps/tauri/src/motion/useQueryaMotion.ts
@@ -0,0 +1,71 @@
+import { computed, inject, provide, ref, type InjectionKey, type Ref } from "vue";
+import {
+ effectiveDurationMs,
+ effectiveEasing,
+ QueryaMotionEasing,
+ QueryaMotionMs,
+ springsEnabled,
+ type QueryaMotionToken,
+} from "./tokens";
+import type { QueryaMotionLevel } from "./types";
+
+const STORAGE_KEY = "querya.motion";
+
+type MotionApi = {
+ level: Ref
;
+ setLevel: (level: QueryaMotionLevel) => void;
+ duration: (token?: QueryaMotionToken | number) => number;
+ easing: (name?: keyof typeof QueryaMotionEasing) => string;
+ springsOn: Ref;
+};
+
+const MotionKey: InjectionKey = Symbol("querya-motion");
+
+function readStoredLevel(): QueryaMotionLevel {
+ const raw = localStorage.getItem(STORAGE_KEY);
+ if (raw === "full" || raw === "reduced" || raw === "off") return raw;
+ return "full";
+}
+
+export function provideQueryaMotion(
+ initial: QueryaMotionLevel = readStoredLevel(),
+): MotionApi {
+ const level = ref(initial);
+
+ function applyDom(next: QueryaMotionLevel) {
+ document.documentElement.dataset.motion = next;
+ localStorage.setItem(STORAGE_KEY, next);
+ }
+
+ applyDom(level.value);
+
+ function setLevel(next: QueryaMotionLevel) {
+ level.value = next;
+ applyDom(next);
+ }
+
+ function duration(token: QueryaMotionToken | number = "standard"): number {
+ const ms = typeof token === "number" ? token : QueryaMotionMs[token];
+ return effectiveDurationMs(level.value, ms);
+ }
+
+ function easing(name: keyof typeof QueryaMotionEasing = "standard"): string {
+ return effectiveEasing(level.value, QueryaMotionEasing[name]);
+ }
+
+ const springsOn = computed(() => springsEnabled(level.value));
+
+ const api: MotionApi = { level, setLevel, duration, easing, springsOn };
+ provide(MotionKey, api);
+ return api;
+}
+
+export function useQueryaMotion(): MotionApi {
+ const api = inject(MotionKey);
+ if (!api) {
+ throw new Error(
+ "useQueryaMotion() requires provideQueryaMotion() in an ancestor",
+ );
+ }
+ return api;
+}
diff --git a/apps/tauri/src/styles/base.css b/apps/tauri/src/styles/base.css
index e0ee58fd..1613f722 100644
--- a/apps/tauri/src/styles/base.css
+++ b/apps/tauri/src/styles/base.css
@@ -1,4 +1,5 @@
@import "./tokens.css";
+@import "./motion.css";
*,
*::before,
diff --git a/apps/tauri/src/styles/motion.css b/apps/tauri/src/styles/motion.css
new file mode 100644
index 00000000..02eef56c
--- /dev/null
+++ b/apps/tauri/src/styles/motion.css
@@ -0,0 +1,32 @@
+/**
+ * Fluid Motion CSS hooks. `data-motion` on is set by provideQueryaMotion.
+ * Components should prefer the composable for JS; use these vars for CSS transitions.
+ */
+
+:root,
+:root[data-motion="full"] {
+ --q-motion-fast: 120ms;
+ --q-motion-standard: 200ms;
+ --q-motion-slow: 320ms;
+ --q-motion-sidebar: 160ms;
+ --q-motion-ease: cubic-bezier(0.65, 0, 0.35, 1);
+ --q-motion-ease-enter: cubic-bezier(0.33, 1, 0.68, 1);
+ --q-motion-ease-exit: cubic-bezier(0.32, 0, 0.67, 0);
+}
+
+:root[data-motion="reduced"] {
+ --q-motion-fast: 60ms;
+ --q-motion-standard: 100ms;
+ --q-motion-slow: 160ms;
+ --q-motion-sidebar: 80ms;
+}
+
+:root[data-motion="off"] {
+ --q-motion-fast: 0ms;
+ --q-motion-standard: 0ms;
+ --q-motion-slow: 0ms;
+ --q-motion-sidebar: 0ms;
+ --q-motion-ease: linear;
+ --q-motion-ease-enter: linear;
+ --q-motion-ease-exit: linear;
+}