@krizaka/ui 3.49.0 → 3.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/motion.d.ts +7 -1
- package/dist/motion.js +3 -2
- package/dist/motion.js.map +1 -1
- package/package.json +4 -4
- package/registry/elephant.json +1 -1
- package/registry/index.json +6 -6
- package/registry/map.json +1 -1
- package/registry/nav-bar.json +1 -1
- package/registry/rail-nav.json +1 -1
- package/registry/site-footer.json +1 -1
package/dist/motion.d.ts
CHANGED
|
@@ -6,13 +6,19 @@ import { ReactNode } from 'react';
|
|
|
6
6
|
declare const PAGE_TRANSITION_CLASS = "kz-page";
|
|
7
7
|
interface PageTransitionProps {
|
|
8
8
|
children: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* The page's identity — the router's pathname. Given, only a change of page animates (the old page exits, the new one
|
|
11
|
+
* enters); an update on the same page (a dialog opened through the address, a filter, a search parameter) does not
|
|
12
|
+
* cross-fade the whole page. Without it, every transition under the boundary animates (the former behaviour).
|
|
13
|
+
*/
|
|
14
|
+
routeKey?: string;
|
|
9
15
|
}
|
|
10
16
|
/**
|
|
11
17
|
* Wrap the page content (the root layout's `children`) once: a navigation then cross-fades and rises over the
|
|
12
18
|
* `--kz-motion-*` tokens, through the platform's View Transitions. Where the runtime has no `ViewTransition` it renders
|
|
13
19
|
* its children untouched; under `prefers-reduced-motion` motion.css makes the change instant. The DOM always updates.
|
|
14
20
|
*/
|
|
15
|
-
declare function PageTransition({ children }: PageTransitionProps): React.JSX.Element;
|
|
21
|
+
declare function PageTransition({ children, routeKey }: PageTransitionProps): React.JSX.Element;
|
|
16
22
|
|
|
17
23
|
/**
|
|
18
24
|
* Page transitions on the platform: `document.startViewTransition` with a cross-fade fallback and an instant change
|
package/dist/motion.js
CHANGED
|
@@ -14,9 +14,10 @@ function runtimeViewTransition() {
|
|
|
14
14
|
return RUNTIME_KEYS.map((key) => runtime[key]).find(Boolean);
|
|
15
15
|
}
|
|
16
16
|
var ViewTransition = runtimeViewTransition();
|
|
17
|
-
function PageTransition({ children }) {
|
|
17
|
+
function PageTransition({ children, routeKey }) {
|
|
18
18
|
if (!ViewTransition) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
19
|
-
return /* @__PURE__ */ jsx(ViewTransition, { default: PAGE_TRANSITION_CLASS, children });
|
|
19
|
+
if (routeKey === void 0) return /* @__PURE__ */ jsx(ViewTransition, { default: PAGE_TRANSITION_CLASS, children });
|
|
20
|
+
return /* @__PURE__ */ jsx(ViewTransition, { default: "none", enter: PAGE_TRANSITION_CLASS, exit: PAGE_TRANSITION_CLASS, children }, routeKey);
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
// src/motion/view-transition.ts
|
package/dist/motion.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/motion/PageTransition.tsx","../src/motion/view-transition.ts"],"sourcesContent":["import type { ComponentType, ReactNode } from \"react\";\nimport * as React from \"react\";\n\n/** The `view-transition-class` the page change carries (styled in motion.css, « PAGE TRANSITIONS »). */\nexport const PAGE_TRANSITION_CLASS = \"kz-page\";\n\ntype ViewTransitionComponent = ComponentType<{ children?: ReactNode; default?: string }>;\n\n/** Next.js ships React canary, where it is `ViewTransition`; earlier canaries called it `unstable_ViewTransition`. */\nconst RUNTIME_KEYS = [\"ViewTransition\", \"unstable_ViewTransition\"] as const;\n\n// Read through a variable key: a plain React build has neither export, and a static `React.ViewTransition` would make\n// the bundler warn about a missing export.\nfunction runtimeViewTransition(): ViewTransitionComponent | undefined {\n const runtime = React as unknown as Record<string, ViewTransitionComponent | undefined>;\n return RUNTIME_KEYS.map((key) => runtime[key]).find(Boolean);\n}\n\nconst ViewTransition = runtimeViewTransition();\n\nexport interface PageTransitionProps {\n children: ReactNode;\n}\n\n/**\n * Wrap the page content (the root layout's `children`) once: a navigation then cross-fades and rises over the\n * `--kz-motion-*` tokens, through the platform's View Transitions. Where the runtime has no `ViewTransition` it renders\n * its children untouched; under `prefers-reduced-motion` motion.css makes the change instant. The DOM always updates.\n */\nexport function PageTransition({ children }: PageTransitionProps) {\n if (!ViewTransition) return <>{children}</>;\n return <ViewTransition default={PAGE_TRANSITION_CLASS}>{children}</ViewTransition>;\n}\n","/**\n * Page transitions on the platform: `document.startViewTransition` with a cross-fade fallback and an instant change\n * under reduced motion. Pure functions over an injected document, so they are testable without a browser.\n *\n * The contract (docs/direction-2027.md): the DOM always updates; motion is only the way it gets there.\n */\n\nexport interface ViewTransitionLike {\n readonly finished: Promise<void>;\n}\n\nexport type StartViewTransition = (update: () => void) => ViewTransitionLike;\n\nexport interface ViewTransitionEnv {\n /** The document whose transition runs. Defaults to the global one when the call happens in a browser. */\n readonly doc?: {\n startViewTransition?: StartViewTransition;\n documentElement?: { animate?: (frames: Keyframe[], options: KeyframeAnimationOptions) => unknown };\n };\n /** `prefers-reduced-motion: reduce`. */\n readonly reduced?: boolean;\n}\n\nexport interface CrossFadeOptions {\n /** Milliseconds of the fallback cross-fade. */\n readonly duration?: number;\n readonly easing?: string;\n}\n\nconst IDENT = /^[A-Za-z_][A-Za-z0-9_-]*$/;\n\n/** True when the browser can run a native view transition. */\nexport function canViewTransition(doc: ViewTransitionEnv[\"doc\"]): boolean {\n return typeof doc?.startViewTransition === \"function\";\n}\n\n/**\n * Runs `update` inside a view transition when the platform has one and motion is allowed; otherwise it runs `update`\n * at once. Resolves when the transition has finished (or straight away when there is none). It never rejects: a\n * skipped or aborted transition still leaves the DOM in its new state.\n */\nexport function runViewTransition(update: () => void, env: ViewTransitionEnv = {}): Promise<void> {\n if (env.reduced || !canViewTransition(env.doc)) {\n update();\n return Promise.resolve();\n }\n const transition = env.doc!.startViewTransition!(update);\n return transition.finished.then(\n () => undefined,\n () => undefined,\n );\n}\n\n/**\n * The fallback for a browser without view transitions: the change is applied, then the root cross-fades from\n * transparent. Reduced motion means no fade at all. Returns the animation when one was started, otherwise `null`.\n */\nexport function crossFallback(update: () => void, env: ViewTransitionEnv = {}, options: CrossFadeOptions = {}): unknown {\n update();\n if (env.reduced || canViewTransition(env.doc)) return null;\n const root = env.doc?.documentElement;\n if (typeof root?.animate !== \"function\") return null;\n return root.animate([{ opacity: 0 }, { opacity: 1 }], {\n duration: options.duration ?? 200,\n easing: options.easing ?? \"ease-out\",\n });\n}\n\n/** One call for a change of page or step: a view transition where it exists, a cross-fade otherwise, instant under reduced motion. */\nexport function transitionPage(update: () => void, env: ViewTransitionEnv = {}, options: CrossFadeOptions = {}): Promise<void> {\n if (canViewTransition(env.doc) && !env.reduced) return runViewTransition(update, env);\n crossFallback(update, env, options);\n return Promise.resolve();\n}\n\n/**\n * The `view-transition-name` for a shared element: the element morphs between the two states wherever it lands. The\n * name must be one CSS identifier and unique on the page while the transition runs.\n */\nexport function sharedElementStyle(name: string): { viewTransitionName: string } {\n if (!IDENT.test(name)) throw new RangeError(`view-transition-name must be one identifier, got \"${name}\"`);\n return { viewTransitionName: name };\n}\n"],"mappings":";;;;;;;AACA,YAAY,WAAW;
|
|
1
|
+
{"version":3,"sources":["../src/motion/PageTransition.tsx","../src/motion/view-transition.ts"],"sourcesContent":["import type { ComponentType, ReactNode } from \"react\";\nimport * as React from \"react\";\n\n/** The `view-transition-class` the page change carries (styled in motion.css, « PAGE TRANSITIONS »). */\nexport const PAGE_TRANSITION_CLASS = \"kz-page\";\n\ntype ViewTransitionComponent = ComponentType<{ children?: ReactNode; default?: string; enter?: string; exit?: string }>;\n\n/** Next.js ships React canary, where it is `ViewTransition`; earlier canaries called it `unstable_ViewTransition`. */\nconst RUNTIME_KEYS = [\"ViewTransition\", \"unstable_ViewTransition\"] as const;\n\n// Read through a variable key: a plain React build has neither export, and a static `React.ViewTransition` would make\n// the bundler warn about a missing export.\nfunction runtimeViewTransition(): ViewTransitionComponent | undefined {\n const runtime = React as unknown as Record<string, ViewTransitionComponent | undefined>;\n return RUNTIME_KEYS.map((key) => runtime[key]).find(Boolean);\n}\n\nconst ViewTransition = runtimeViewTransition();\n\nexport interface PageTransitionProps {\n children: ReactNode;\n /**\n * The page's identity — the router's pathname. Given, only a change of page animates (the old page exits, the new one\n * enters); an update on the same page (a dialog opened through the address, a filter, a search parameter) does not\n * cross-fade the whole page. Without it, every transition under the boundary animates (the former behaviour).\n */\n routeKey?: string;\n}\n\n/**\n * Wrap the page content (the root layout's `children`) once: a navigation then cross-fades and rises over the\n * `--kz-motion-*` tokens, through the platform's View Transitions. Where the runtime has no `ViewTransition` it renders\n * its children untouched; under `prefers-reduced-motion` motion.css makes the change instant. The DOM always updates.\n */\nexport function PageTransition({ children, routeKey }: PageTransitionProps) {\n if (!ViewTransition) return <>{children}</>;\n if (routeKey === undefined) return <ViewTransition default={PAGE_TRANSITION_CLASS}>{children}</ViewTransition>;\n // A new key is a new boundary: React runs `exit` on the old one and `enter` on the new; updates inside run `default`.\n return (\n <ViewTransition key={routeKey} default=\"none\" enter={PAGE_TRANSITION_CLASS} exit={PAGE_TRANSITION_CLASS}>\n {children}\n </ViewTransition>\n );\n}\n","/**\n * Page transitions on the platform: `document.startViewTransition` with a cross-fade fallback and an instant change\n * under reduced motion. Pure functions over an injected document, so they are testable without a browser.\n *\n * The contract (docs/direction-2027.md): the DOM always updates; motion is only the way it gets there.\n */\n\nexport interface ViewTransitionLike {\n readonly finished: Promise<void>;\n}\n\nexport type StartViewTransition = (update: () => void) => ViewTransitionLike;\n\nexport interface ViewTransitionEnv {\n /** The document whose transition runs. Defaults to the global one when the call happens in a browser. */\n readonly doc?: {\n startViewTransition?: StartViewTransition;\n documentElement?: { animate?: (frames: Keyframe[], options: KeyframeAnimationOptions) => unknown };\n };\n /** `prefers-reduced-motion: reduce`. */\n readonly reduced?: boolean;\n}\n\nexport interface CrossFadeOptions {\n /** Milliseconds of the fallback cross-fade. */\n readonly duration?: number;\n readonly easing?: string;\n}\n\nconst IDENT = /^[A-Za-z_][A-Za-z0-9_-]*$/;\n\n/** True when the browser can run a native view transition. */\nexport function canViewTransition(doc: ViewTransitionEnv[\"doc\"]): boolean {\n return typeof doc?.startViewTransition === \"function\";\n}\n\n/**\n * Runs `update` inside a view transition when the platform has one and motion is allowed; otherwise it runs `update`\n * at once. Resolves when the transition has finished (or straight away when there is none). It never rejects: a\n * skipped or aborted transition still leaves the DOM in its new state.\n */\nexport function runViewTransition(update: () => void, env: ViewTransitionEnv = {}): Promise<void> {\n if (env.reduced || !canViewTransition(env.doc)) {\n update();\n return Promise.resolve();\n }\n const transition = env.doc!.startViewTransition!(update);\n return transition.finished.then(\n () => undefined,\n () => undefined,\n );\n}\n\n/**\n * The fallback for a browser without view transitions: the change is applied, then the root cross-fades from\n * transparent. Reduced motion means no fade at all. Returns the animation when one was started, otherwise `null`.\n */\nexport function crossFallback(update: () => void, env: ViewTransitionEnv = {}, options: CrossFadeOptions = {}): unknown {\n update();\n if (env.reduced || canViewTransition(env.doc)) return null;\n const root = env.doc?.documentElement;\n if (typeof root?.animate !== \"function\") return null;\n return root.animate([{ opacity: 0 }, { opacity: 1 }], {\n duration: options.duration ?? 200,\n easing: options.easing ?? \"ease-out\",\n });\n}\n\n/** One call for a change of page or step: a view transition where it exists, a cross-fade otherwise, instant under reduced motion. */\nexport function transitionPage(update: () => void, env: ViewTransitionEnv = {}, options: CrossFadeOptions = {}): Promise<void> {\n if (canViewTransition(env.doc) && !env.reduced) return runViewTransition(update, env);\n crossFallback(update, env, options);\n return Promise.resolve();\n}\n\n/**\n * The `view-transition-name` for a shared element: the element morphs between the two states wherever it lands. The\n * name must be one CSS identifier and unique on the page while the transition runs.\n */\nexport function sharedElementStyle(name: string): { viewTransitionName: string } {\n if (!IDENT.test(name)) throw new RangeError(`view-transition-name must be one identifier, got \"${name}\"`);\n return { viewTransitionName: name };\n}\n"],"mappings":";;;;;;;AACA,YAAY,WAAW;AAmCO;AAhCvB,IAAM,wBAAwB;AAKrC,IAAM,eAAe,CAAC,kBAAkB,yBAAyB;AAIjE,SAAS,wBAA6D;AACpE,QAAM,UAAU;AAChB,SAAO,aAAa,IAAI,CAAC,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AQ,KAAK,OAAO;AAClC,SAAO,QAAQ,QAAQ;AACzB;AAMO,SAAS,mBAAmB,MAA8C;AAC/E,MAAI,CAAC,MAAM,KAAK,IAAI,EAAG,OAAM,IAAI,WAAW,qDAAqD,IAAI,GAAG;AACxG,SAAO,EAAE,oBAAoB,KAAK;AACpC;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krizaka/ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.50.0",
|
|
4
4
|
"description": "The Krizaka front-end platform's components: the primitives (button, card, dialog, toast, menu, field, tabs, chip, switch, slider, command palette, theme, countdown…) on the semantic --kz-* tokens, the animated marks (Krizaka, Orazaka, Orochia, Yasakia, Yororis) and the motion signature — web and /native.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"krizaka",
|
|
@@ -769,7 +769,7 @@
|
|
|
769
769
|
],
|
|
770
770
|
"peerDependencies": {
|
|
771
771
|
"@krizaka/query": ">=0.2.1",
|
|
772
|
-
"@krizaka/tailwind": ">=3.
|
|
772
|
+
"@krizaka/tailwind": ">=3.50.0",
|
|
773
773
|
"@maplibre/maplibre-react-native": ">=11",
|
|
774
774
|
"@shopify/flash-list": ">=2",
|
|
775
775
|
"expo-camera": ">=16",
|
|
@@ -2599,9 +2599,9 @@
|
|
|
2599
2599
|
"radix-ui": "^1.7.0",
|
|
2600
2600
|
"sonner": "^2.0.8",
|
|
2601
2601
|
"tailwind-variants": "^3.3.1",
|
|
2602
|
-
"@krizaka/
|
|
2602
|
+
"@krizaka/intl": "^0.2.1",
|
|
2603
2603
|
"@krizaka/pacer": "^0.1.0",
|
|
2604
|
-
"@krizaka/
|
|
2604
|
+
"@krizaka/tokens": "^3.50.0"
|
|
2605
2605
|
},
|
|
2606
2606
|
"scripts": {
|
|
2607
2607
|
"build": "node -e \"const fs=require('node:fs');fs.rmSync('dist',{recursive:true,force:true});for(const f of fs.readdirSync('registry/examples',{recursive:true}))if(/\\.(js|d\\.ts)$/.test(f))fs.rmSync('registry/examples/'+f)\" && tsup && node -e \"require('node:fs').copyFileSync('src/motion.css','dist/motion.css');require('node:fs').copyFileSync('src/blocks.css','dist/blocks.css');require('node:fs').copyFileSync('src/story.css','dist/story.css')\" && node scripts/build-registry.mjs",
|
package/registry/elephant.json
CHANGED
package/registry/index.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krizaka/ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.50.0",
|
|
4
4
|
"templatePurposes": {
|
|
5
5
|
"convince": {
|
|
6
6
|
"title": "Convince",
|
|
@@ -2264,7 +2264,7 @@
|
|
|
2264
2264
|
"native": 0
|
|
2265
2265
|
},
|
|
2266
2266
|
"dependencies": [
|
|
2267
|
-
"@krizaka/tokens@^3.
|
|
2267
|
+
"@krizaka/tokens@^3.50.0"
|
|
2268
2268
|
],
|
|
2269
2269
|
"registryDependencies": []
|
|
2270
2270
|
},
|
|
@@ -3291,7 +3291,7 @@
|
|
|
3291
3291
|
"native": 2
|
|
3292
3292
|
},
|
|
3293
3293
|
"dependencies": [
|
|
3294
|
-
"@krizaka/tokens@^3.
|
|
3294
|
+
"@krizaka/tokens@^3.50.0",
|
|
3295
3295
|
"@protomaps/basemaps@5.7.2",
|
|
3296
3296
|
"tailwind-variants@^3.3.1"
|
|
3297
3297
|
],
|
|
@@ -3730,7 +3730,7 @@
|
|
|
3730
3730
|
"native": 0
|
|
3731
3731
|
},
|
|
3732
3732
|
"dependencies": [
|
|
3733
|
-
"@krizaka/tokens@^3.
|
|
3733
|
+
"@krizaka/tokens@^3.50.0",
|
|
3734
3734
|
"radix-ui@^1.7.0",
|
|
3735
3735
|
"tailwind-variants@^3.3.1"
|
|
3736
3736
|
],
|
|
@@ -4395,7 +4395,7 @@
|
|
|
4395
4395
|
"native": 0
|
|
4396
4396
|
},
|
|
4397
4397
|
"dependencies": [
|
|
4398
|
-
"@krizaka/tokens@^3.
|
|
4398
|
+
"@krizaka/tokens@^3.50.0",
|
|
4399
4399
|
"radix-ui@^1.7.0",
|
|
4400
4400
|
"tailwind-variants@^3.3.1"
|
|
4401
4401
|
],
|
|
@@ -4768,7 +4768,7 @@
|
|
|
4768
4768
|
"native": 0
|
|
4769
4769
|
},
|
|
4770
4770
|
"dependencies": [
|
|
4771
|
-
"@krizaka/tokens@^3.
|
|
4771
|
+
"@krizaka/tokens@^3.50.0",
|
|
4772
4772
|
"radix-ui@^1.7.0",
|
|
4773
4773
|
"tailwind-variants@^3.3.1"
|
|
4774
4774
|
],
|
package/registry/map.json
CHANGED
package/registry/nav-bar.json
CHANGED
package/registry/rail-nav.json
CHANGED