@wildo-ai/presets-components-3d 1.1.7 → 1.1.9

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.
Files changed (52) hide show
  1. package/dist/esm/focal-plane/focal-plane-settings.d.ts.map +1 -1
  2. package/dist/esm/focal-plane/focal-plane-settings.js.map +1 -1
  3. package/dist/esm/focal-plane/focal-plane-shell-container.d.ts.map +1 -1
  4. package/dist/esm/focal-plane/focal-plane-shell-container.js.map +1 -1
  5. package/dist/esm/focal-plane/focal-plane-stylesheet.d.ts.map +1 -1
  6. package/dist/esm/focal-plane/focal-plane-stylesheet.js.map +1 -1
  7. package/dist/esm/focal-plane/use-pane-depth.d.ts.map +1 -1
  8. package/dist/esm/focal-plane/use-pane-depth.js.map +1 -1
  9. package/dist/esm/focal-plane/use-shared-vanishing-point.d.ts.map +1 -1
  10. package/dist/esm/focal-plane/use-shared-vanishing-point.js.map +1 -1
  11. package/dist/esm/frame/frame-3d-style.d.ts.map +1 -1
  12. package/dist/esm/frame/frame-3d-style.js.map +1 -1
  13. package/dist/esm/frame/frame-appearance.d.ts.map +1 -1
  14. package/dist/esm/frame/frame-appearance.js.map +1 -1
  15. package/dist/esm/frame/frame-canvas.d.ts.map +1 -1
  16. package/dist/esm/frame/frame-canvas.js.map +1 -1
  17. package/dist/esm/frame/frame-canvas.lazy.d.ts.map +1 -1
  18. package/dist/esm/frame/frame-canvas.lazy.js.map +1 -1
  19. package/dist/esm/frame/frame-color.d.ts.map +1 -1
  20. package/dist/esm/frame/frame-color.js.map +1 -1
  21. package/dist/esm/frame/frame-driver.d.ts.map +1 -1
  22. package/dist/esm/frame/frame-driver.js.map +1 -1
  23. package/dist/esm/frame/frame-renderer.d.ts.map +1 -1
  24. package/dist/esm/frame/frame-renderer.js.map +1 -1
  25. package/dist/esm/frame/frame-shaders.d.ts.map +1 -1
  26. package/dist/esm/frame/frame-shaders.js.map +1 -1
  27. package/dist/esm/frame/use-frame-appearance.d.ts.map +1 -1
  28. package/dist/esm/frame/use-frame-appearance.js.map +1 -1
  29. package/dist/esm/index.d.ts.map +1 -1
  30. package/dist/esm/index.js.map +1 -1
  31. package/dist/esm/layout/header-first-shell-container.d.ts.map +1 -1
  32. package/dist/esm/layout/header-first-shell-container.js.map +1 -1
  33. package/dist/esm/layout/layout-3d-definition.d.ts.map +1 -1
  34. package/dist/esm/layout/layout-3d-definition.js.map +1 -1
  35. package/dist/esm/layout/layout-3d-transition-choreography.d.ts.map +1 -1
  36. package/dist/esm/layout/layout-3d-transition-choreography.js.map +1 -1
  37. package/dist/esm/layout/layout-3d-vocabulary.d.ts.map +1 -1
  38. package/dist/esm/layout/layout-3d-vocabulary.js.map +1 -1
  39. package/dist/esm/layout/shell-layout-placement.d.ts.map +1 -1
  40. package/dist/esm/layout/shell-layout-placement.js.map +1 -1
  41. package/dist/esm/layout-3d-main-container.d.ts.map +1 -1
  42. package/dist/esm/layout-3d-main-container.js.map +1 -1
  43. package/dist/esm/register-3d-layout.d.ts.map +1 -1
  44. package/dist/esm/register-3d-layout.js.map +1 -1
  45. package/dist/esm/shell-region-measurement.d.ts.map +1 -1
  46. package/dist/esm/shell-region-measurement.js.map +1 -1
  47. package/dist/esm/tokens/design-token-resolution.d.ts.map +1 -1
  48. package/dist/esm/tokens/design-token-resolution.js.map +1 -1
  49. package/dist/esm/tokens/use-design-token-resolution.d.ts.map +1 -1
  50. package/dist/esm/tokens/use-design-token-resolution.js.map +1 -1
  51. package/dist/tsconfig.build.tsbuildinfo +1 -1
  52. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"layout-3d-main-container.d.ts","sourceRoot":"","sources":["../../src/layout-3d-main-container.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAA6B,KAAK,0CAA0C,EAAE,MAAM,6BAA6B,CAAC;AAGzH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAA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CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACzI,OAAO,CACL,KAAC,eAAe,IACd,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAC3B,mBAAmB,EAAE,mBAAmB,EACxC,oBAAoB,EAAE,MAAM,CAAC,WAAW,CAAC,UAAU,EACnD,uBAAuB,EAAE,MAAM,CAAC,WAAW,CAAC,aAAa,EACzD,mBAAmB,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,EACjD,mBAAmB,EAAE,mBAAmB,EACxC,WAAW,EAAE,UAAU,CAAC,WAAW,GACnC,CACH,CAAC;AACJ,CAAC","sourcesContent":["import React, { useEffect } from 'react';\n\nimport { useNavigationState, useUI, type AppLayoutPreset_MainContainer_DefaultProps } from '@wildo-ai/saas-frontend-lib';\n\nimport { FrameCanvasDoor } from './frame/frame-canvas.lazy';\nimport type { Frame3DStyleOverrides } from './frame/frame-3d-style';\nimport { FocalPlaneSettingsContext, resolveFocalPlaneSettings, type FocalPlaneSettings } from './focal-plane/focal-plane-settings';\nimport { assertSupportedLayout3D, INHERIT_LAYOUT_3D, type Layout3DDefinition } from './layout/layout-3d-definition';\nimport { crossFadesAppearance } from './layout/layout-3d-transition-choreography';\nimport { Layout3DCamera } from './layout/layout-3d-vocabulary';\nimport { ShellLayoutPlacementKind } from './layout/shell-layout-placement';\nimport { useFrameAppearance } from './frame/use-frame-appearance';\n\n/**\n * The brand a 3D main container carries. `Symbol.for`, not `Symbol`: the component registry lives on\n * `globalThis` and survives a hot reload, while a reloaded module would mint a new `Symbol` and fail to\n * recognise the container it registered last time — and then capture it as \"the 2D shell\".\n */\nconst LAYOUT_3D_MAIN_CONTAINER_BRAND = Symbol.for('@wildo-ai/presets-components-3d/main-container');\n\ntype MainContainerComponent = React.ComponentType<AppLayoutPreset_MainContainer_DefaultProps>;\n\n/** @wildo_source:part:start presets.3d.register-layout facet:layer:frontend facet:family:layout-3d facet:audience:app-developer */\n/** What a 3D main container draws: the layout, and the application's frame-style overrides. */\nexport interface Layout3DOptions {\n /**\n * The layout: its disposal, its scene and its transitions. Defaults to {@link INHERIT_LAYOUT_3D}, the 2D disposal\n * with the frame under it. An application uses ONE layout for its whole life.\n */\n layout?: Layout3DDefinition;\n /** Frame-style overrides layered over the layout's built-in styles. */\n frameStyles?: Frame3DStyleOverrides;\n /**\n * Overrides of the focal plane's numbers (camera distance, layer depth, motion, dims, blurs, window opacity), for\n * {@link FOCAL_PLANE_LAYOUT_3D}; each is checked at registration. Omitted, the defaults.\n */\n focalPlane?: Partial<FocalPlaneSettings>;\n}\n/** @wildo_source:part:end presets.3d.register-layout */\n\n/** A 3D main container: the component, the 2D container it captured, and the layout it draws. */\nexport type Layout3DMainContainer = MainContainerComponent & {\n readonly [LAYOUT_3D_MAIN_CONTAINER_BRAND]: true;\n /**\n * The 2D main container captured at registration: rendered unchanged by an INHERIT placement, and kept by every\n * layout so a re-registration wraps IT rather than a 3D container.\n */\n readonly captured: MainContainerComponent;\n /** The layout this container draws. */\n readonly layout: Layout3DDefinition;\n /** The application's frame-style overrides, when it registered any. */\n readonly frameStyles: Frame3DStyleOverrides | undefined;\n};\n\n/** Whether a registered main container is a 3D one — and so carries the 2D container it wraps. */\nexport function isLayout3DMainContainer(component: unknown): component is Layout3DMainContainer {\n return typeof component === 'function' && (component as Partial<Layout3DMainContainer>)[LAYOUT_3D_MAIN_CONTAINER_BRAND] === true;\n}\n\nlet appearanceMismatchWarned = false;\n\n/**\n * How long a shell appearance other than the one the layout requires must persist before it is reported. The UI\n * context starts from the DEFAULT theme and resolves the application's own theme a moment later, so the first value\n * this container sees is routinely SEPARATED even in a CONTINUOUS application — measured on Wonder Todos, whose\n * shell renders `bg-transparent` while the first-render value read SEPARATED. Only a value that survives\n * bootstrap is the application's.\n */\nconst APPEARANCE_MISMATCH_REPORT_DELAY_MS = 5000;\n\n/**\n * Build the 3D main container: a captured 2D container, and a layout that either renders it (INHERIT) or arranges\n * the regions with a container of its own (COMPOSED).\n *\n * It renders exactly two children, at FIXED positions:\n *\n * - **index 0, the frame slot** ({@link FrameSlot}): the decorative canvas behind its lazy door (`FrameCanvasDoor`),\n * whose `LazyDoorErrorBoundary` contains any failure of it. The theme and the navigation state are read in the\n * slot, in the DOM tree, and passed to the canvas as props: a theme, mode, breakpoint or navigation change\n * re-renders index 0 and never touches index 1.\n * It is `position: fixed` with NO z-index, `aria-hidden` and `pointer-events: none`.\n * - **index 1, the placement**: the captured 2D container, unchanged, for an INHERIT layout; the layout's own\n * container, composed from the same shell building blocks, otherwise. Either way every region, provider,\n * context, portal and latch is the application's own.\n *\n * Why no wrapper, and no `isolate` (the #1821 text proposed `<div class=\"isolate\">` with the canvas at\n * `-z-10`): `isolate` would make the whole shell ONE stacking context, so anything positioned OUTSIDE it\n * with a lower z-index — the consent prompt (`z-50`) — would paint over the shell's own dialogs\n * (`--z-overlay`, 300). #1830 measured that exact reordering and chose `relative` for the 2D shell root\n * for that reason. Instead, a positioned element with no z-index paints at the z-index:0 level in TREE\n * order, which puts the canvas after the theme's background layer (`UIContext`'s `isolate` wrapper,\n * earlier in the tree) and before the shell root (`relative`, the next sibling) — frame above the theme\n * background, shell above the frame — while every z-index inside the shell keeps its global order.\n *\n * The precondition this places on the placement: its ROOT must be positioned (the 2D default and the\n * header-first container are `relative`, #1830), or its in-flow content paints at a lower level than the frame and\n * under it. The frame never takes a click either way — it handles no pointer events at all.\n *\n * Why fixed positions: a canvas failure empties only index 0. The placement never moves and keeps one component\n * type for the application's life, so it never remounts — a remount there would unmount every navigation zone and\n * lose its state.\n */\nexport function create3DMainContainer(captured: MainContainerComponent, options: Layout3DOptions = {}): Layout3DMainContainer {\n const layout = options.layout ?? INHERIT_LAYOUT_3D;\n const frameStyles = options.frameStyles;\n // Checked here, at registration, like the layout itself. Only the still-perspective camera reads them: settings a\n // layout would silently ignore are refused instead.\n if (options.focalPlane !== undefined && layout.scene.camera !== Layout3DCamera.STILL_PERSPECTIVE) {\n throw new Error(`register3DLayout(): 'focalPlane' tunes the focal-plane layout, and the layout '${layout.id}' is not seen through its still camera.`);\n }\n const focalPlane = resolveFocalPlaneSettings(options.focalPlane);\n // A camera, transition kind or rest pose the renderer does not implement is refused here, at registration.\n assertSupportedLayout3D(layout);\n const crossFadeAppearance = crossFadesAppearance(layout.transitions.appearance);\n // Chosen ONCE, outside the component: the element at index 1 keeps one type for the application's life, so it\n // never remounts.\n const Placement: MainContainerComponent = layout.placement.kind === ShellLayoutPlacementKind.INHERIT ? captured : layout.placement.container;\n function Layout3DMainContainer(props: AppLayoutPreset_MainContainer_DefaultProps): React.JSX.Element {\n const { shellAppearance } = useUI();\n const required = layout.constraints.requiredShellAppearance;\n\n useEffect(() => {\n // The frame is visible only where regions paint nothing. A layout states the shell appearance it is designed\n // for; any other is the application's choice to correct, so it is said once and nothing switches.\n if (required === null || shellAppearance === required || appearanceMismatchWarned) return undefined;\n const report = setTimeout(() => {\n // Checked again here: several containers (or a remount) may have armed a timer before the first fired.\n if (appearanceMismatchWarned) return;\n appearanceMismatchWarned = true;\n console.warn(\n `[presets-components-3d] the 3D layout '${layout.id}' is designed for a '${String(required)}' shell, and this theme's `\n + `shell appearance is '${String(shellAppearance)}': opaque regions will cover the frame drawn under them.`,\n );\n }, APPEARANCE_MISMATCH_REPORT_DELAY_MS);\n return () => clearTimeout(report);\n }, [shellAppearance, required]);\n\n return (\n <>\n {/* The flat frame belongs to the flat camera; a still-perspective placement stages its own depth. */}\n {layout.scene.camera === Layout3DCamera.FLAT_ORTHOGRAPHIC && <FrameSlot layout={layout} frameStyles={frameStyles} crossFadeAppearance={crossFadeAppearance} />}\n <FocalPlaneSettingsContext.Provider value={focalPlane}>\n <Placement {...props} />\n </FocalPlaneSettingsContext.Provider>\n </>\n );\n }\n\n return Object.assign(Layout3DMainContainer, {\n [LAYOUT_3D_MAIN_CONTAINER_BRAND]: true as const,\n captured,\n layout,\n frameStyles,\n });\n}\n\n/**\n * Index 0 of a 3D main container: reads what the frame follows — the theme (`useFrameAppearance`) and the navigation\n * state (#1826) — and hands it to the canvas. Its own component, so a navigation, which changes the navigation state\n * many times a second during some flows, re-renders this slot and never the placement beside it.\n *\n * The navigation signature is every structural zone's top entry (`getTopEntry`, so a tabbed zone reports its visible\n * tab), identified by its URL PATH:\n * - not by its id, which is minted again on every push or replace, so a route sync that re-lands the SAME place would\n * read as a navigation nobody made (the id stands in only for an entry without a URL);\n * - not by its query string, which carries VIEW state on the same content (`?section=`, `?dataMode=`, which the\n * engine updates in place as \"same id, same content\"): switching a board's section tab or a list's mode is not\n * going somewhere, and does not play.\n * The route sync hooks mirror router navigations into those stacks, so a sidebar link and a record opened beside a\n * list both change it; the overlay zone is not a place and does not. While no zone holds anything yet, the signature\n * is empty, which the frame never records (see `FrameDriver.setNavigation`).\n */\nfunction FrameSlot({\n layout,\n frameStyles,\n crossFadeAppearance,\n}: {\n layout: Layout3DDefinition;\n frameStyles: Frame3DStyleOverrides | undefined;\n crossFadeAppearance: boolean;\n}): React.JSX.Element {\n const appearance = useFrameAppearance(layout.scene.frameStyles, frameStyles);\n const navigation = useNavigationState();\n const zones = Object.keys(navigation.state.zones) as Array<keyof typeof navigation.state.zones>;\n const places = zones.map((zone) => {\n const top = navigation.getTopEntry(zone);\n return top ? (top.urlPath?.split(/[?#]/)[0] ?? top.id) : '';\n });\n const navigationSignature = places.some((place) => place !== '') ? zones.map((zone, index) => `${zone}:${places[index]}`).join('|') : '';\n return (\n <FrameCanvasDoor\n appearance={appearance}\n camera={layout.scene.camera}\n crossFadeAppearance={crossFadeAppearance}\n navigationTransition={layout.transitions.navigation}\n sidebarResizeTransition={layout.transitions.sidebarResize}\n zoneFocusTransition={layout.transitions.zoneFocus}\n navigationSignature={navigationSignature}\n focusedZone={navigation.focusedZone}\n />\n );\n}\n"]}
1
+ {"version":3,"file":"layout-3d-main-container.js","sourceRoot":"","sources":["../../../src/layout-3d-main-container.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAmD,MAAM,6BAA6B,CAAC;AAEzH,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAA2B,MAAM,oCAAoC,CAAC;AACnI,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAA2B,MAAM,+BAA+B,CAAC;AACpH,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE;;;;GAIG;AACH,MAAM,8BAA8B,GAAG,MAAM,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;AAoCpG,kGAAkG;AAClG,MAAM,UAAU,uBAAuB,CAAC,SAAkB;IACxD,OAAO,OAAO,SAAS,KAAK,UAAU,IAAK,SAA4C,CAAC,8BAA8B,CAAC,KAAK,IAAI,CAAC;AACnI,CAAC;AAED,IAAI,wBAAwB,GAAG,KAAK,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,mCAAmC,GAAG,IAAI,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAgC,EAAE,UAA2B,EAAE;IACnG,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,iBAAiB,CAAC;IACnD,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACxC,kHAAkH;IAClH,oDAAoD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IAC9D,CAAC,CAAC,CAAC;IACH,MAAM,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACzI,OAAO,CACL,KAAC,eAAe,IACd,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAC3B,mBAAmB,EAAE,mBAAmB,EACxC,oBAAoB,EAAE,MAAM,CAAC,WAAW,CAAC,UAAU,EACnD,uBAAuB,EAAE,MAAM,CAAC,WAAW,CAAC,aAAa,EACzD,mBAAmB,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,EACjD,mBAAmB,EAAE,mBAAmB,EACxC,WAAW,EAAE,UAAU,CAAC,WAAW,GACnC,CACH,CAAC;AACJ,CAAC","sourcesContent":["import React, { useEffect } from 'react';\n\nimport { useNavigationState, useUI, type AppLayoutPreset_MainContainer_DefaultProps } from '@wildo-ai/saas-frontend-lib';\n\nimport { FrameCanvasDoor } from './frame/frame-canvas.lazy';\nimport type { Frame3DStyleOverrides } from './frame/frame-3d-style';\nimport { FocalPlaneSettingsContext, resolveFocalPlaneSettings, type FocalPlaneSettings } from './focal-plane/focal-plane-settings';\nimport { assertSupportedLayout3D, INHERIT_LAYOUT_3D, type Layout3DDefinition } from './layout/layout-3d-definition';\nimport { crossFadesAppearance } from './layout/layout-3d-transition-choreography';\nimport { Layout3DCamera } from './layout/layout-3d-vocabulary';\nimport { ShellLayoutPlacementKind } from './layout/shell-layout-placement';\nimport { useFrameAppearance } from './frame/use-frame-appearance';\n\n/**\n * The brand a 3D main container carries. `Symbol.for`, not `Symbol`: the component registry lives on\n * `globalThis` and survives a hot reload, while a reloaded module would mint a new `Symbol` and fail to\n * recognise the container it registered last time — and then capture it as \"the 2D shell\".\n */\nconst LAYOUT_3D_MAIN_CONTAINER_BRAND = Symbol.for('@wildo-ai/presets-components-3d/main-container');\n\ntype MainContainerComponent = React.ComponentType<AppLayoutPreset_MainContainer_DefaultProps>;\n\n/** @wildo_source:part:start presets.3d.register-layout facet:layer:frontend facet:family:layout-3d facet:audience:app-developer */\n/** What a 3D main container draws: the layout, and the application's frame-style overrides. */\nexport interface Layout3DOptions {\n /**\n * The layout: its disposal, its scene and its transitions. Defaults to {@link INHERIT_LAYOUT_3D}, the 2D disposal\n * with the frame under it. An application uses ONE layout for its whole life.\n */\n layout?: Layout3DDefinition;\n /** Frame-style overrides layered over the layout's built-in styles. */\n frameStyles?: Frame3DStyleOverrides;\n /**\n * Overrides of the focal plane's numbers (camera distance, layer depth, motion, dims, blurs, window opacity), for\n * {@link FOCAL_PLANE_LAYOUT_3D}; each is checked at registration. Omitted, the defaults.\n */\n focalPlane?: Partial<FocalPlaneSettings>;\n}\n/** @wildo_source:part:end presets.3d.register-layout */\n\n/** A 3D main container: the component, the 2D container it captured, and the layout it draws. */\nexport type Layout3DMainContainer = MainContainerComponent & {\n readonly [LAYOUT_3D_MAIN_CONTAINER_BRAND]: true;\n /**\n * The 2D main container captured at registration: rendered unchanged by an INHERIT placement, and kept by every\n * layout so a re-registration wraps IT rather than a 3D container.\n */\n readonly captured: MainContainerComponent;\n /** The layout this container draws. */\n readonly layout: Layout3DDefinition;\n /** The application's frame-style overrides, when it registered any. */\n readonly frameStyles: Frame3DStyleOverrides | undefined;\n};\n\n/** Whether a registered main container is a 3D one — and so carries the 2D container it wraps. */\nexport function isLayout3DMainContainer(component: unknown): component is Layout3DMainContainer {\n return typeof component === 'function' && (component as Partial<Layout3DMainContainer>)[LAYOUT_3D_MAIN_CONTAINER_BRAND] === true;\n}\n\nlet appearanceMismatchWarned = false;\n\n/**\n * How long a shell appearance other than the one the layout requires must persist before it is reported. The UI\n * context starts from the DEFAULT theme and resolves the application's own theme a moment later, so the first value\n * this container sees is routinely SEPARATED even in a CONTINUOUS application — measured on Wonder Todos, whose\n * shell renders `bg-transparent` while the first-render value read SEPARATED. Only a value that survives\n * bootstrap is the application's.\n */\nconst APPEARANCE_MISMATCH_REPORT_DELAY_MS = 5000;\n\n/**\n * Build the 3D main container: a captured 2D container, and a layout that either renders it (INHERIT) or arranges\n * the regions with a container of its own (COMPOSED).\n *\n * It renders exactly two children, at FIXED positions:\n *\n * - **index 0, the frame slot** ({@link FrameSlot}): the decorative canvas behind its lazy door (`FrameCanvasDoor`),\n * whose `LazyDoorErrorBoundary` contains any failure of it. The theme and the navigation state are read in the\n * slot, in the DOM tree, and passed to the canvas as props: a theme, mode, breakpoint or navigation change\n * re-renders index 0 and never touches index 1.\n * It is `position: fixed` with NO z-index, `aria-hidden` and `pointer-events: none`.\n * - **index 1, the placement**: the captured 2D container, unchanged, for an INHERIT layout; the layout's own\n * container, composed from the same shell building blocks, otherwise. Either way every region, provider,\n * context, portal and latch is the application's own.\n *\n * Why no wrapper, and no `isolate` (the #1821 text proposed `<div class=\"isolate\">` with the canvas at\n * `-z-10`): `isolate` would make the whole shell ONE stacking context, so anything positioned OUTSIDE it\n * with a lower z-index — the consent prompt (`z-50`) — would paint over the shell's own dialogs\n * (`--z-overlay`, 300). #1830 measured that exact reordering and chose `relative` for the 2D shell root\n * for that reason. Instead, a positioned element with no z-index paints at the z-index:0 level in TREE\n * order, which puts the canvas after the theme's background layer (`UIContext`'s `isolate` wrapper,\n * earlier in the tree) and before the shell root (`relative`, the next sibling) — frame above the theme\n * background, shell above the frame — while every z-index inside the shell keeps its global order.\n *\n * The precondition this places on the placement: its ROOT must be positioned (the 2D default and the\n * header-first container are `relative`, #1830), or its in-flow content paints at a lower level than the frame and\n * under it. The frame never takes a click either way — it handles no pointer events at all.\n *\n * Why fixed positions: a canvas failure empties only index 0. The placement never moves and keeps one component\n * type for the application's life, so it never remounts — a remount there would unmount every navigation zone and\n * lose its state.\n */\nexport function create3DMainContainer(captured: MainContainerComponent, options: Layout3DOptions = {}): Layout3DMainContainer {\n const layout = options.layout ?? INHERIT_LAYOUT_3D;\n const frameStyles = options.frameStyles;\n // Checked here, at registration, like the layout itself. Only the still-perspective camera reads them: settings a\n // layout would silently ignore are refused instead.\n if (options.focalPlane !== undefined && layout.scene.camera !== Layout3DCamera.STILL_PERSPECTIVE) {\n throw new Error(`register3DLayout(): 'focalPlane' tunes the focal-plane layout, and the layout '${layout.id}' is not seen through its still camera.`);\n }\n const focalPlane = resolveFocalPlaneSettings(options.focalPlane);\n // A camera, transition kind or rest pose the renderer does not implement is refused here, at registration.\n assertSupportedLayout3D(layout);\n const crossFadeAppearance = crossFadesAppearance(layout.transitions.appearance);\n // Chosen ONCE, outside the component: the element at index 1 keeps one type for the application's life, so it\n // never remounts.\n const Placement: MainContainerComponent = layout.placement.kind === ShellLayoutPlacementKind.INHERIT ? captured : layout.placement.container;\n function Layout3DMainContainer(props: AppLayoutPreset_MainContainer_DefaultProps): React.JSX.Element {\n const { shellAppearance } = useUI();\n const required = layout.constraints.requiredShellAppearance;\n\n useEffect(() => {\n // The frame is visible only where regions paint nothing. A layout states the shell appearance it is designed\n // for; any other is the application's choice to correct, so it is said once and nothing switches.\n if (required === null || shellAppearance === required || appearanceMismatchWarned) return undefined;\n const report = setTimeout(() => {\n // Checked again here: several containers (or a remount) may have armed a timer before the first fired.\n if (appearanceMismatchWarned) return;\n appearanceMismatchWarned = true;\n console.warn(\n `[presets-components-3d] the 3D layout '${layout.id}' is designed for a '${String(required)}' shell, and this theme's `\n + `shell appearance is '${String(shellAppearance)}': opaque regions will cover the frame drawn under them.`,\n );\n }, APPEARANCE_MISMATCH_REPORT_DELAY_MS);\n return () => clearTimeout(report);\n }, [shellAppearance, required]);\n\n return (\n <>\n {/* The flat frame belongs to the flat camera; a still-perspective placement stages its own depth. */}\n {layout.scene.camera === Layout3DCamera.FLAT_ORTHOGRAPHIC && <FrameSlot layout={layout} frameStyles={frameStyles} crossFadeAppearance={crossFadeAppearance} />}\n <FocalPlaneSettingsContext.Provider value={focalPlane}>\n <Placement {...props} />\n </FocalPlaneSettingsContext.Provider>\n </>\n );\n }\n\n return Object.assign(Layout3DMainContainer, {\n [LAYOUT_3D_MAIN_CONTAINER_BRAND]: true as const,\n captured,\n layout,\n frameStyles,\n });\n}\n\n/**\n * Index 0 of a 3D main container: reads what the frame follows — the theme (`useFrameAppearance`) and the navigation\n * state (#1826) — and hands it to the canvas. Its own component, so a navigation, which changes the navigation state\n * many times a second during some flows, re-renders this slot and never the placement beside it.\n *\n * The navigation signature is every structural zone's top entry (`getTopEntry`, so a tabbed zone reports its visible\n * tab), identified by its URL PATH:\n * - not by its id, which is minted again on every push or replace, so a route sync that re-lands the SAME place would\n * read as a navigation nobody made (the id stands in only for an entry without a URL);\n * - not by its query string, which carries VIEW state on the same content (`?section=`, `?dataMode=`, which the\n * engine updates in place as \"same id, same content\"): switching a board's section tab or a list's mode is not\n * going somewhere, and does not play.\n * The route sync hooks mirror router navigations into those stacks, so a sidebar link and a record opened beside a\n * list both change it; the overlay zone is not a place and does not. While no zone holds anything yet, the signature\n * is empty, which the frame never records (see `FrameDriver.setNavigation`).\n */\nfunction FrameSlot({\n layout,\n frameStyles,\n crossFadeAppearance,\n}: {\n layout: Layout3DDefinition;\n frameStyles: Frame3DStyleOverrides | undefined;\n crossFadeAppearance: boolean;\n}): React.JSX.Element {\n const appearance = useFrameAppearance(layout.scene.frameStyles, frameStyles);\n const navigation = useNavigationState();\n const zones = Object.keys(navigation.state.zones) as Array<keyof typeof navigation.state.zones>;\n const places = zones.map((zone) => {\n const top = navigation.getTopEntry(zone);\n return top ? (top.urlPath?.split(/[?#]/)[0] ?? top.id) : '';\n });\n const navigationSignature = places.some((place) => place !== '') ? zones.map((zone, index) => `${zone}:${places[index]}`).join('|') : '';\n return (\n <FrameCanvasDoor\n appearance={appearance}\n camera={layout.scene.camera}\n crossFadeAppearance={crossFadeAppearance}\n navigationTransition={layout.transitions.navigation}\n sidebarResizeTransition={layout.transitions.sidebarResize}\n zoneFocusTransition={layout.transitions.zoneFocus}\n navigationSignature={navigationSignature}\n focusedZone={navigation.focusedZone}\n />\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"register-3d-layout.d.ts","sourceRoot":"","sources":["../../src/register-3d-layout.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,KAAK,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAE3G,OAAO,EAAkD,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAIlH,mIAAmI;AACnI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,eAAoB,GAAG,6BAA6B,CAiC7F;AACD,wDAAwD"}
1
+ {"version":3,"file":"register-3d-layout.d.ts","sourceRoot":"","sources":["../../../src/register-3d-layout.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,KAAK,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAE3G,OAAO,EAAkD,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAIlH,mIAAmI;AACnI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,eAAoB,GAAG,6BAA6B,CAiC7F;AACD,wDAAwD"}
@@ -1 +1 @@
1
- {"version":3,"file":"register-3d-layout.js","sourceRoot":"","sources":["../../src/register-3d-layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC7F,OAAO,EAAE,wBAAwB,EAAsC,MAAM,6BAA6B,CAAC;AAE3G,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAwB,MAAM,4BAA4B,CAAC;AAClH,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,C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,sBAAsB,GAAG,wBAAwB,CAAC,WAAW,CAAC,qBAAqB,CAAC,0BAA0B,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,cAAc,IAAI,KAAK,CAAC;YAClK,OAAO,qBAAqB,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACvG,CAAC;KACF,CAAC;AACJ,CAAC;AACD,wDAAwD","sourcesContent":["import { CorePresetNames, FrontendComponentType } from '@wildo-ai/presets-components-models';\nimport { ComponentRegistryService, type FrontendComponentRegistration } from '@wildo-ai/saas-frontend-lib';\n\nimport { create3DMainContainer, isLayout3DMainContainer, type Layout3DOptions } from './layout-3d-main-container';\nimport { BUILT_IN_LAYOUTS_3D, INHERIT_LAYOUT_3D } from './layout/layout-3d-definition';\nimport { Layout3DId } from './layout/layout-3d-vocabulary';\n\n/** @wildo_source:part:start presets.3d.register-layout facet:layer:frontend facet:family:layout-3d facet:audience:app-developer */\n/**\n * Make an application's signed-in shell 3D: the shell's regions — unchanged HTML, with all their contexts —\n * arranged by a 3D layout, with a decorative WebGL frame drawn under them.\n *\n * There is no 2D/3D switch and no option to enable it. An application is 3D because it CALLS this, from\n * its engine module's `componentRegistrations` — the entries `registerFrontendComponentRegistrations`\n * runs AFTER the framework presets are registered, so the Default main container exists by then:\n *\n * ```ts\n * import { register3DLayout } from '@wildo-ai/presets-components-3d';\n *\n * export const engineComponentRegistrations: FrontendComponentRegistration[] = [register3DLayout()];\n * ```\n *\n * It registers under `Default` for `APP_LAYOUTS_MAIN_CONTAINER`, the only preset key the shell resolves,\n * after capturing the container registered there before it. An INHERIT layout renders that captured container,\n * unchanged; a layout with a disposal of its own renders its composed container instead, built from the same\n * shell building blocks — either way every region, context and behaviour is the application's own.\n *\n * - **Refuses** when nothing is registered yet: capturing `null` would render no shell at all, and the\n * cause — the registration running before the framework presets — is worth an error, not a blank app.\n * - **Idempotent**: a registration that finds a 3D container already there (a second call, or the\n * registry surviving a hot reload on `globalThis`) wraps the 2D container IT captured, never itself.\n * - **Keeps the registration's metadata**: the captured container's `isConfigurable` is carried over, so\n * nothing that reads the registry's metadata sees a difference.\n *\n * `options.layout` selects the layout (`INHERIT_LAYOUT_3D` by default); `options.frameStyles` layers an\n * application's frame styles over the layout's own (per theme id, or for all themes).\n *\n * - **One layout per application.** A registration that finds a 3D container of a DIFFERENT layout already\n * registered refuses: an application is not 3D in two ways, and a silent replacement would hide which one it\n * is. The same layout again is idempotent. (A layout changed in code during a hot reload needs a full page\n * reload, because the registry outlives the hot reload.)\n */\nexport function register3DLayout(options: Layout3DOptions = {}): FrontendComponentRegistration {\n let capturedIsConfigurable = false;\n return {\n componentRef: FrontendComponentType.APP_LAYOUTS_MAIN_CONTAINER,\n preset: CorePresetNames.DEFAULT,\n get isConfigurable(): boolean {\n return capturedIsConfigurable;\n },\n loadComponent: async () => {\n const current = ComponentRegistryService.resolve(FrontendComponentType.APP_LAYOUTS_MAIN_CONTAINER, CorePresetNames.DEFAULT);\n if (!current) {\n throw new Error(\n 'register3DLayout(): no Default APP_LAYOUTS_MAIN_CONTAINER is registered to capture. Call it from the engine module\\'s '\n + '`componentRegistrations`, which run after the framework presets — not from a module evaluated before them.',\n );\n }\n const layout = options.layout ?? INHERIT_LAYOUT_3D;\n // An application's own layout may not borrow a built-in id: the one-layout check compares ids, and a borrowed\n // one would make two different layouts look like the same.\n if ((Object.values(Layout3DId) as string[]).includes(layout.id) && BUILT_IN_LAYOUTS_3D[layout.id as Layout3DId] !== layout) {\n throw new Error(`register3DLayout(): the layout id '${layout.id}' belongs to a built-in layout; give the application's own layout an id of its own.`);\n }\n if (isLayout3DMainContainer(current) && current.layout.id !== layout.id) {\n throw new Error(\n `register3DLayout(): this application already registered the 3D layout '${current.layout.id}' and now asks for '${layout.id}'. `\n + 'An application uses one layout: remove the other registration — or, if you just changed the layout in code, '\n + 'reload the page (the component registry outlives a hot reload).',\n );\n }\n capturedIsConfigurable = ComponentRegistryService.getMetadata(FrontendComponentType.APP_LAYOUTS_MAIN_CONTAINER, CorePresetNames.DEFAULT)?.isConfigurable ?? false;\n return create3DMainContainer(isLayout3DMainContainer(current) ? current.captured : current, options);\n },\n };\n}\n/** @wildo_source:part:end presets.3d.register-layout */\n"]}
1
+ {"version":3,"file":"register-3d-layout.js","sourceRoot":"","sources":["../../../src/register-3d-layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC7F,OAAO,EAAE,wBAAwB,EAAsC,MAAM,6BAA6B,CAAC;AAE3G,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAwB,MAAM,4BAA4B,CAAC;AAClH,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,mIAAmI;AACnI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAA2B,EAAE;IAC5D,IAAI,sBAAsB,GAAG,KAAK,CAAC;IACnC,OAAO;QACL,YAAY,EAAE,qBAAqB,CAAC,0BAA0B;QAC9D,MAAM,EAAE,eAAe,CAAC,OAAO;QAC/B,IAAI,cAAc;YAChB,OAAO,sBAAsB,CAAC;QAChC,CAAC;QACD,aAAa,EAAE,KAAK,IAAI,EAAE;YACxB,MAAM,OAAO,GAAG,wBAAwB,CAAC,OAAO,CAAC,qBAAqB,CAAC,0BAA0B,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;YAC5H,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,MAAM,IAAI,KAAK,CACb,wHAAwH;sBACtH,4GAA4G,CAC/G,CAAC;YACJ,CAAC;YACD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,iBAAiB,CAAC;YACnD,8GAA8G;YAC9G,2DAA2D;YAC3D,IAAK,MAAM,CAAC,MAAM,CAAC,UAAU,CAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAgB,CAAC,KAAK,MAAM,EAAE,CAAC;gBAC3H,MAAM,IAAI,KAAK,CAAC,sCAAsC,MAAM,CAAC,EAAE,qFAAqF,CAAC,CAAC;YACxJ,CAAC;YACD,IAAI,uBAAuB,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,EAAE,CAAC;gBACxE,MAAM,IAAI,KAAK,CACb,0EAA0E,OAAO,CAAC,MAAM,CAAC,EAAE,uBAAuB,MAAM,CAAC,EAAE,KAAK;sBAC9H,8GAA8G;sBAC9G,iEAAiE,CACpE,CAAC;YACJ,CAAC;YACD,sBAAsB,GAAG,wBAAwB,CAAC,WAAW,CAAC,qBAAqB,CAAC,0BAA0B,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,cAAc,IAAI,KAAK,CAAC;YAClK,OAAO,qBAAqB,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACvG,CAAC;KACF,CAAC;AACJ,CAAC;AACD,wDAAwD","sourcesContent":["import { CorePresetNames, FrontendComponentType } from '@wildo-ai/presets-components-models';\nimport { ComponentRegistryService, type FrontendComponentRegistration } from '@wildo-ai/saas-frontend-lib';\n\nimport { create3DMainContainer, isLayout3DMainContainer, type Layout3DOptions } from './layout-3d-main-container';\nimport { BUILT_IN_LAYOUTS_3D, INHERIT_LAYOUT_3D } from './layout/layout-3d-definition';\nimport { Layout3DId } from './layout/layout-3d-vocabulary';\n\n/** @wildo_source:part:start presets.3d.register-layout facet:layer:frontend facet:family:layout-3d facet:audience:app-developer */\n/**\n * Make an application's signed-in shell 3D: the shell's regions — unchanged HTML, with all their contexts —\n * arranged by a 3D layout, with a decorative WebGL frame drawn under them.\n *\n * There is no 2D/3D switch and no option to enable it. An application is 3D because it CALLS this, from\n * its engine module's `componentRegistrations` — the entries `registerFrontendComponentRegistrations`\n * runs AFTER the framework presets are registered, so the Default main container exists by then:\n *\n * ```ts\n * import { register3DLayout } from '@wildo-ai/presets-components-3d';\n *\n * export const engineComponentRegistrations: FrontendComponentRegistration[] = [register3DLayout()];\n * ```\n *\n * It registers under `Default` for `APP_LAYOUTS_MAIN_CONTAINER`, the only preset key the shell resolves,\n * after capturing the container registered there before it. An INHERIT layout renders that captured container,\n * unchanged; a layout with a disposal of its own renders its composed container instead, built from the same\n * shell building blocks — either way every region, context and behaviour is the application's own.\n *\n * - **Refuses** when nothing is registered yet: capturing `null` would render no shell at all, and the\n * cause — the registration running before the framework presets — is worth an error, not a blank app.\n * - **Idempotent**: a registration that finds a 3D container already there (a second call, or the\n * registry surviving a hot reload on `globalThis`) wraps the 2D container IT captured, never itself.\n * - **Keeps the registration's metadata**: the captured container's `isConfigurable` is carried over, so\n * nothing that reads the registry's metadata sees a difference.\n *\n * `options.layout` selects the layout (`INHERIT_LAYOUT_3D` by default); `options.frameStyles` layers an\n * application's frame styles over the layout's own (per theme id, or for all themes).\n *\n * - **One layout per application.** A registration that finds a 3D container of a DIFFERENT layout already\n * registered refuses: an application is not 3D in two ways, and a silent replacement would hide which one it\n * is. The same layout again is idempotent. (A layout changed in code during a hot reload needs a full page\n * reload, because the registry outlives the hot reload.)\n */\nexport function register3DLayout(options: Layout3DOptions = {}): FrontendComponentRegistration {\n let capturedIsConfigurable = false;\n return {\n componentRef: FrontendComponentType.APP_LAYOUTS_MAIN_CONTAINER,\n preset: CorePresetNames.DEFAULT,\n get isConfigurable(): boolean {\n return capturedIsConfigurable;\n },\n loadComponent: async () => {\n const current = ComponentRegistryService.resolve(FrontendComponentType.APP_LAYOUTS_MAIN_CONTAINER, CorePresetNames.DEFAULT);\n if (!current) {\n throw new Error(\n 'register3DLayout(): no Default APP_LAYOUTS_MAIN_CONTAINER is registered to capture. Call it from the engine module\\'s '\n + '`componentRegistrations`, which run after the framework presets — not from a module evaluated before them.',\n );\n }\n const layout = options.layout ?? INHERIT_LAYOUT_3D;\n // An application's own layout may not borrow a built-in id: the one-layout check compares ids, and a borrowed\n // one would make two different layouts look like the same.\n if ((Object.values(Layout3DId) as string[]).includes(layout.id) && BUILT_IN_LAYOUTS_3D[layout.id as Layout3DId] !== layout) {\n throw new Error(`register3DLayout(): the layout id '${layout.id}' belongs to a built-in layout; give the application's own layout an id of its own.`);\n }\n if (isLayout3DMainContainer(current) && current.layout.id !== layout.id) {\n throw new Error(\n `register3DLayout(): this application already registered the 3D layout '${current.layout.id}' and now asks for '${layout.id}'. `\n + 'An application uses one layout: remove the other registration — or, if you just changed the layout in code, '\n + 'reload the page (the component registry outlives a hot reload).',\n );\n }\n capturedIsConfigurable = ComponentRegistryService.getMetadata(FrontendComponentType.APP_LAYOUTS_MAIN_CONTAINER, CorePresetNames.DEFAULT)?.isConfigurable ?? false;\n return create3DMainContainer(isLayout3DMainContainer(current) ? current.captured : current, options);\n },\n };\n}\n/** @wildo_source:part:end presets.3d.register-layout */\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"shell-region-measurement.d.ts","sourceRoot":"","sources":["../../src/shell-region-measurement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAEhF;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,WAAW,CAAC;IACpB,oHAAoH;IACpH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,KAAK,EAAE,OAAO,CAAC;IACf,yEAAyE;IACzE,OAAO,EAAE,WAAW,CAAC;CACt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;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,OAAmB,QAAQ;IACpE,OAAO,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAc,yBAAyB,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC;AACvH,CAAC;AAED,+HAA+H;AAC/H,MAAM,UAAU,sBAAsB,CAAC,OAAmB,QAAQ;IAChE,MAAM,QAAQ,GAA6B,EAAE,CAAC;IAC9C,KAAK,MAAM,OAAO,IAAI,0BAA0B,CAAC,IAAI,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;QAC7C,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC;YAAE,SAAS;QAClD,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAC9I,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAAsE,EACtE,QAA2C;IAE3C,OAAO;QACL,CAAC,EAAE,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,KAAK,GAAG,CAAC,GAAG,QAAQ,CAAC,KAAK,GAAG,CAAC;QACtD,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;KAC1D,CAAC;AACJ,CAAC","sourcesContent":["import { MaterialKind, ShellRegion } from '@wildo-ai/presets-components-models';\n\n/**\n * One painted region of the signed-in shell, measured in CSS pixels relative to the viewport.\n *\n * The 3D frame only FOLLOWS the HTML shell: every size, collapse and breakpoint decision stays the 2D\n * container's, and the frame reads the result off the DOM. So this is the frame's only input about the\n * layout, and it carries nothing a renderer could mistake for a decision.\n */\nexport interface MeasuredShellRegion {\n region: ShellRegion;\n /** The region's `data-placement` (a `HorizontalPlacement` / `VerticalPlacement` value), when it sits at an edge. */\n placement: string | null;\n left: number;\n top: number;\n width: number;\n height: number;\n /**\n * The region already renders a glass material: its element carries `data-material-kind=\"glass\"` (a region\n * preset renders through `Surface asChild`, which puts the material attributes on the region element itself).\n * The frame draws no slab under it — glass over a frosted slab would be two materials doing one job.\n */\n glass: boolean;\n /** The element measured, so a caller can observe it for size changes. */\n element: HTMLElement;\n}\n\nconst SHELL_REGION_VALUES: ReadonlySet<string> = new Set(Object.values(ShellRegion));\n\n/**\n * Every element marked as a shell region, whether or not it currently has a box — a region collapsed to\n * nothing is still one to observe, so it is redrawn the moment it reappears. Same filtering as\n * {@link measureShellRegions} otherwise.\n */\nexport function findShellRegionElements(root: ParentNode = document): HTMLElement[] {\n return [...root.querySelectorAll<HTMLElement>('[data-component-area]')].filter((element) => {\n const value = element.dataset.componentArea;\n return value !== undefined && SHELL_REGION_VALUES.has(value) && !element.hasAttribute('data-mobile-drawer');\n });\n}\n\n/**\n * Every shell region currently painted, found by the public `data-component-area` marker (#1818) and\n * never by a preset's markup — so a custom 2D region preset that keeps the marker is framed like the\n * built-in one.\n *\n * Skipped, deliberately:\n * - a value outside `ShellRegion`: `data-component-area` is the SHELL's contract, and anything else\n * carrying the attribute is not a region the frame should draw under;\n * - the sidebar's mobile DRAWER (`data-mobile-drawer`): it is an overlay that slides over the content,\n * not a region that tiles the shell, so a slab under it would sit under the page;\n * - an element with no box (a region rendered but collapsed to nothing, or hidden).\n */\nexport function measureShellRegions(root: ParentNode = document): MeasuredShellRegion[] {\n const measured: MeasuredShellRegion[] = [];\n for (const element of findShellRegionElements(root)) {\n const rect = element.getBoundingClientRect();\n if (rect.width <= 0 || rect.height <= 0) continue;\n measured.push({\n region: element.dataset.componentArea as ShellRegion,\n placement: element.dataset.placement ?? null,\n left: rect.left,\n top: rect.top,\n width: rect.width,\n height: rect.height,\n glass: element.dataset.materialKind === MaterialKind.GLASS,\n element,\n });\n }\n return measured;\n}\n\n/** One navigation zone the content area shows, measured like a region. */\nexport interface MeasuredNavigationZone {\n /** The zone's `data-content-area` value: the navigation's zone name (`primary`, `secondary`, `companion`). */\n zone: string;\n left: number;\n top: number;\n width: number;\n height: number;\n element: HTMLElement;\n}\n\n/**\n * Every navigation zone container inside the shell's CONTENT region, found by the navigation's own public marker\n * (`data-content-area`, one per zone container whatever the branch — single zone, resizable split or static split).\n * Only inside the content region: the marker is the navigation's, and the frame draws zone rims only within the\n * content slab. Whatever its box, so one that reappears is observed (as {@link findShellRegionElements}).\n */\nexport function findNavigationZoneElements(root: ParentNode = document): HTMLElement[] {\n return [...root.querySelectorAll<HTMLElement>(`[data-component-area=\"${ShellRegion.CONTENT}\"] [data-content-area]`)];\n}\n\n/** The navigation zones currently shown: a hidden zone (`display: none`, collapsed responsively) has no box and is skipped. */\nexport function measureNavigationZones(root: ParentNode = document): MeasuredNavigationZone[] {\n const measured: MeasuredNavigationZone[] = [];\n for (const element of findNavigationZoneElements(root)) {\n const rect = element.getBoundingClientRect();\n if (rect.width <= 0 || rect.height <= 0) continue;\n measured.push({ zone: element.dataset.contentArea ?? '', left: rect.left, top: rect.top, width: rect.width, height: rect.height, element });\n }\n return measured;\n}\n\n/**\n * The centre of a measured region in an orthographic camera matched 1:1 to CSS pixels, whose origin is\n * the viewport's centre and whose y axis points UP (three.js), while the DOM's points down.\n */\nexport function regionCentreInFrameUnits(\n region: Pick<MeasuredShellRegion, 'left' | 'top' | 'width' | 'height'>,\n viewport: { width: number; height: number },\n): { x: number; y: number } {\n return {\n x: region.left + region.width / 2 - viewport.width / 2,\n y: viewport.height / 2 - (region.top + region.height / 2),\n };\n}\n"]}
1
+ {"version":3,"file":"shell-region-measurement.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AAC,MAAM,GAAG,CAAC,CAAC;KAC1D,CAAC;AACJ,CAAC","sourcesContent":["import { MaterialKind, ShellRegion } from '@wildo-ai/presets-components-models';\n\n/**\n * One painted region of the signed-in shell, measured in CSS pixels relative to the viewport.\n *\n * The 3D frame only FOLLOWS the HTML shell: every size, collapse and breakpoint decision stays the 2D\n * container's, and the frame reads the result off the DOM. So this is the frame's only input about the\n * layout, and it carries nothing a renderer could mistake for a decision.\n */\nexport interface MeasuredShellRegion {\n region: ShellRegion;\n /** The region's `data-placement` (a `HorizontalPlacement` / `VerticalPlacement` value), when it sits at an edge. */\n placement: string | null;\n left: number;\n top: number;\n width: number;\n height: number;\n /**\n * The region already renders a glass material: its element carries `data-material-kind=\"glass\"` (a region\n * preset renders through `Surface asChild`, which puts the material attributes on the region element itself).\n * The frame draws no slab under it — glass over a frosted slab would be two materials doing one job.\n */\n glass: boolean;\n /** The element measured, so a caller can observe it for size changes. */\n element: HTMLElement;\n}\n\nconst SHELL_REGION_VALUES: ReadonlySet<string> = new Set(Object.values(ShellRegion));\n\n/**\n * Every element marked as a shell region, whether or not it currently has a box — a region collapsed to\n * nothing is still one to observe, so it is redrawn the moment it reappears. Same filtering as\n * {@link measureShellRegions} otherwise.\n */\nexport function findShellRegionElements(root: ParentNode = document): HTMLElement[] {\n return [...root.querySelectorAll<HTMLElement>('[data-component-area]')].filter((element) => {\n const value = element.dataset.componentArea;\n return value !== undefined && SHELL_REGION_VALUES.has(value) && !element.hasAttribute('data-mobile-drawer');\n });\n}\n\n/**\n * Every shell region currently painted, found by the public `data-component-area` marker (#1818) and\n * never by a preset's markup — so a custom 2D region preset that keeps the marker is framed like the\n * built-in one.\n *\n * Skipped, deliberately:\n * - a value outside `ShellRegion`: `data-component-area` is the SHELL's contract, and anything else\n * carrying the attribute is not a region the frame should draw under;\n * - the sidebar's mobile DRAWER (`data-mobile-drawer`): it is an overlay that slides over the content,\n * not a region that tiles the shell, so a slab under it would sit under the page;\n * - an element with no box (a region rendered but collapsed to nothing, or hidden).\n */\nexport function measureShellRegions(root: ParentNode = document): MeasuredShellRegion[] {\n const measured: MeasuredShellRegion[] = [];\n for (const element of findShellRegionElements(root)) {\n const rect = element.getBoundingClientRect();\n if (rect.width <= 0 || rect.height <= 0) continue;\n measured.push({\n region: element.dataset.componentArea as ShellRegion,\n placement: element.dataset.placement ?? null,\n left: rect.left,\n top: rect.top,\n width: rect.width,\n height: rect.height,\n glass: element.dataset.materialKind === MaterialKind.GLASS,\n element,\n });\n }\n return measured;\n}\n\n/** One navigation zone the content area shows, measured like a region. */\nexport interface MeasuredNavigationZone {\n /** The zone's `data-content-area` value: the navigation's zone name (`primary`, `secondary`, `companion`). */\n zone: string;\n left: number;\n top: number;\n width: number;\n height: number;\n element: HTMLElement;\n}\n\n/**\n * Every navigation zone container inside the shell's CONTENT region, found by the navigation's own public marker\n * (`data-content-area`, one per zone container whatever the branch — single zone, resizable split or static split).\n * Only inside the content region: the marker is the navigation's, and the frame draws zone rims only within the\n * content slab. Whatever its box, so one that reappears is observed (as {@link findShellRegionElements}).\n */\nexport function findNavigationZoneElements(root: ParentNode = document): HTMLElement[] {\n return [...root.querySelectorAll<HTMLElement>(`[data-component-area=\"${ShellRegion.CONTENT}\"] [data-content-area]`)];\n}\n\n/** The navigation zones currently shown: a hidden zone (`display: none`, collapsed responsively) has no box and is skipped. */\nexport function measureNavigationZones(root: ParentNode = document): MeasuredNavigationZone[] {\n const measured: MeasuredNavigationZone[] = [];\n for (const element of findNavigationZoneElements(root)) {\n const rect = element.getBoundingClientRect();\n if (rect.width <= 0 || rect.height <= 0) continue;\n measured.push({ zone: element.dataset.contentArea ?? '', left: rect.left, top: rect.top, width: rect.width, height: rect.height, element });\n }\n return measured;\n}\n\n/**\n * The centre of a measured region in an orthographic camera matched 1:1 to CSS pixels, whose origin is\n * the viewport's centre and whose y axis points UP (three.js), while the DOM's points down.\n */\nexport function regionCentreInFrameUnits(\n region: Pick<MeasuredShellRegion, 'left' | 'top' | 'width' | 'height'>,\n viewport: { width: number; height: number },\n): { x: number; y: number } {\n return {\n x: region.left + region.width / 2 - viewport.width / 2,\n y: viewport.height / 2 - (region.top + region.height / 2),\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"design-token-resolution.d.ts","sourceRoot":"","sources":["../../../src/tokens/design-token-resolution.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAExE;;;;;;GAMG;AACH,oBAAY,uBAAuB;IACjC,8FAA8F;IAC9F,KAAK,UAAU;IACf,2CAA2C;IAC3C,QAAQ,aAAa;IACrB,+DAA+D;IAC/D,MAAM,WAAW;IACjB,8CAA8C;IAC9C,IAAI,SAAS;IACb,mCAAmC;IACnC,MAAM,WAAW;CAClB;AAED;;;GAGG;AACH,oBAAY,2BAA2B;IACrC;;;OAGG;IACH,iBAAiB,sBAAsB;IACvC;;;OAGG;IACH,oBAAoB,yBAAyB;IAC7C,sGAAsG;IACtG,gBAAgB,qBAAqB;CACtC;AAED,8FAA8F;AAC9F,oBAAY,sBAAsB;IAChC,kDAAkD;IAClD,KAAK,UAAU;IACf,wGAAwG;IACxG,WAAW,gBAAgB;IAC3B;;;OAGG;IACH,aAAa,kBAAkB;CAChC;AAED;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAChC;IAAE,IAAI,EAAE,uBAAuB,CAAC,KAAK,CAAC;IAAC,SAAS,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,sBAAsB,CAAA;CAAE,GACpI;IAAE,IAAI,EAAE,uBAAuB,CAAC,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC3D;IAAE,IAAI,EAAE,uBAAuB,CAAC,MAAM,CAAC;IAAC,aAAa,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAClG;IAAE,IAAI,EAAE,uBAAuB,CAAC,IAAI,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,IAAI,EAAE,uBAAuB,CAAC,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5D;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAC7B;IAAE,KAAK,EAAE,iBAAiB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,wBAAwB,CAAA;CAAE,GAC/E;IAAE,KAAK,EAAE,iBAAiB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,2BAA2B,CAAA;CAAE,CAAC;AAEzF,MAAM,WAAW,4BAA4B;IAC3C,oFAAoF;IACpF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;CACtD;AAyDD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAC,EAC5D,OAAO,GAAE,4BAAiC,GACzC,GAAG,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAyG/C"}
1
+ {"version":3,"file":"design-token-resolution.d.ts","sourceRoot":"","sources":["../../../../src/tokens/design-token-resolution.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAExE;;;;;;GAMG;AACH,oBAAY,uBAAuB;IACjC,8FAA8F;IAC9F,KAAK,UAAU;IACf,2CAA2C;IAC3C,QAAQ,aAAa;IACrB,+DAA+D;IAC/D,MAAM,WAAW;IACjB,8CAA8C;IAC9C,IAAI,SAAS;IACb,mCAAmC;IACnC,MAAM,WAAW;CAClB;AAED;;;GAGG;AACH,oBAAY,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,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;CACtD;AAyDD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAC,EAC5D,OAAO,GAAE,4BAAiC,GACzC,GAAG,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAyG/C"}
@@ -1 +1 @@
1
- {"version":3,"file":"design-token-resolution.js","sourceRoot":"","sources":["../../../src/tokens/design-token-resolution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAoB,MAAM,QAAQ,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAExE;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,uBAWX;AAXD,WAAY,uBAAuB;IACjC,8FAA8F;IAC9F,0CAAe,CAAA;IACf,2CAA2C;IAC3C,gDAAqB,CAAA;IACrB,+DAA+D;IAC/D,4CAAiB,CAAA;IACjB,8CAA8C;IAC9C,wCAAa,CAAA;IACb,mCAAmC;IACnC,4CAAiB,CAAA;AACnB,CAAC,EAXW,uBAAuB,KAAvB,uBAAuB,QAWlC;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,2BAaX;AAbD,WAAY,2BAA2B;IACrC;;;OAGG;IACH,sEAAuC,CAAA;IACvC;;;OAGG;IACH,4EAA6C,CAAA;IAC7C,sGAAsG;IACtG,oEAAqC,CAAA;AACvC,CAAC,EAbW,2BAA2B,KAA3B,2BAA2B,QAatC;AAED,8FAA8F;AAC9F,MAAM,CAAN,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,kDAAkD;IAClD,yCAAe,CAAA;IACf,wGAAwG;IACxG,qDAA2B,CAAA;IAC3B;;;OAGG;IACH,yDAA+B,C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,CAAC;IACd,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,KAAK,MAAM,SAAS,IAAI,IAAI,EAAE,CAAC;QAC7B,IAAI,SAAS,KAAK,GAAG;YAAE,KAAK,IAAI,CAAC,CAAC;QAClC,IAAI,SAAS,KAAK,GAAG;YAAE,KAAK,IAAI,CAAC,CAAC;QAClC,IAAI,SAAS,KAAK,GAAG,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;YAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;YAAC,SAAS;QAAC,CAAC;QACtF,OAAO,IAAI,SAAS,CAAC;IACvB,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,oFAAoF;AACpF,SAAS,iBAAiB,CAAC,IAAY;IACrC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QACpC,IAAI,SAAS,KAAK,GAAG;YAAE,KAAK,IAAI,CAAC,CAAC;QAClC,IAAI,SAAS,KAAK,GAAG;YAAE,KAAK,IAAI,CAAC,CAAC;QAClC,IAAI,KAAK,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC;YAAE,OAAO,KAAK,CAAC;IAC3D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { converter, parse, type CuloriColor } from 'culori';\n\nimport { DesignSystemToken } from '@wildo-ai/presets-components-models';\n\n/**\n * What a design-token value resolved to, in the units a WebGL frame uses (#1819).\n *\n * Token values are authored as CSS strings — `oklch(...)`, `color-mix(...)`, `150ms`, `cubic-bezier(...)`,\n * `0.5rem` — because the DOM consumes them as CSS. The 3D frame draws with numbers, so each value is\n * resolved once, per theme and per light/dark mode, into one of these kinds.\n */\nexport enum ResolvedDesignTokenKind {\n /** A colour, in linear-light sRGB (what three.js expects of a material colour) plus alpha. */\n COLOR = 'color',\n /** A duration (`ms` / `s`), in seconds. */\n DURATION = 'duration',\n /** An easing, as the four control points of a cubic Bézier. */\n EASING = 'easing',\n /** A length (`px` / `rem`), in CSS pixels. */\n SIZE = 'size',\n /** A plain number (an opacity). */\n NUMBER = 'number',\n}\n\n/**\n * Why a value was NOT resolved. A value the frame cannot use is reported, never guessed: a wrong number in\n * a WebGL scene is invisible until someone notices the frame looks off.\n */\nexport enum UnresolvedDesignTokenReason {\n /**\n * The value depends on the viewport or the containing layout (`clamp()`, `calc()`, viewport units such as `vw`\n * and `dvh`, container units such as `cqi`, `%`), so it has no single number.\n */\n VIEWPORT_RELATIVE = 'viewport-relative',\n /**\n * A reference (`var()`, `color-mix()`) that neither the token graph nor the browser probe resolved — an\n * unknown custom property, a mixing space this resolver does not model, or a percentage CSS rejects.\n */\n REFERENCE_UNRESOLVED = 'reference-unresolved',\n /** Not one of the forms the frame reads: a shadow list, a list of palette names, a stepped easing. */\n UNSUPPORTED_FORM = 'unsupported-form',\n}\n\n/** Where a resolved colour came from. The provenance travels through references and mixes. */\nexport enum DesignTokenColorSource {\n /** The token's own value was a colour literal. */\n VALUE = 'value',\n /** Resolved through other tokens (`var(--token)`, `color-mix()` of tokens) with no browser involved. */\n TOKEN_GRAPH = 'token-graph',\n /**\n * At least one input came from the browser probe, which answers against the document's custom properties at\n * the moment of the call — see `useDesignTokenResolution` for why such a result is recomputed after a commit.\n */\n BROWSER_PROBE = 'browser-probe',\n}\n\n/**\n * A token value in the frame's units. The kind decides the unit: linear-light sRGB plus alpha for a colour,\n * seconds for a duration, cubic-Bézier control points for an easing, CSS pixels for a size.\n */\nexport type ResolvedDesignTokenValue =\n | { kind: ResolvedDesignTokenKind.COLOR; linearRgb: readonly [number, number, number]; alpha: number; source: DesignTokenColorSource }\n | { kind: ResolvedDesignTokenKind.DURATION; seconds: number }\n | { kind: ResolvedDesignTokenKind.EASING; controlPoints: readonly [number, number, number, number] }\n | { kind: ResolvedDesignTokenKind.SIZE; px: number }\n | { kind: ResolvedDesignTokenKind.NUMBER; value: number };\n\n/**\n * One token's outcome: its authored CSS `value`, and either what it `resolved` to or why it is `unresolved`.\n * There is no third state, so a consumer must handle both, and an unresolved token is never read as a default.\n */\nexport type DesignTokenResolution =\n | { token: DesignSystemToken; value: string; resolved: ResolvedDesignTokenValue }\n | { token: DesignSystemToken; value: string; unresolved: UnresolvedDesignTokenReason };\n\nexport interface DesignTokenResolutionOptions {\n /** The root font size a `rem` is measured against. The framework's own is 16 px. */\n rootFontSizePx?: number;\n /**\n * The browser's computed form of a colour reference the token graph cannot express: a `var()` naming a custom\n * property that is not a token (the browser also applies its fallback, when the property is undefined), or a\n * `color-mix()` this resolver does not model. `readComputedCssColorViaDom` from `@wildo-ai/saas-frontend-lib`\n * in a browser. Omitted in a test, where there is no browser to ask; such a reference is then unresolved.\n */\n readComputedColor?: (value: string) => string | null;\n}\n\n/** The hue interpolation methods of CSS Color 4 §13.5, as `color-mix()` spells them. */\nenum HueInterpolationMethod {\n SHORTER = 'shorter',\n LONGER = 'longer',\n INCREASING = 'increasing',\n DECREASING = 'decreasing',\n}\n\n/**\n * The CSS easing keywords, as cubic-Bézier control points. `linear` is the identity easing, which the\n * Bézier (0, 0, 1, 1) reproduces exactly.\n * spec-cite: CSS Easing Functions Level 1 §2.2 (the four keyword curves) and §2.1 (`linear` is the identity) — https://www.w3.org/TR/css-easing-1/\n */\nconst EASING_KEYWORDS: Readonly<Record<string, readonly [number, number, number, number]>> = {\n linear: [0, 0, 1, 1],\n ease: [0.25, 0.1, 0.25, 1],\n 'ease-in': [0.42, 0, 1, 1],\n 'ease-out': [0, 0, 0.58, 1],\n 'ease-in-out': [0.42, 0, 0.58, 1],\n};\n\n/**\n * The `color-mix()` interpolation spaces this resolver models: the culori mode, its channels, and which channel\n * is a hue (polar spaces). Anything else is reported unresolved rather than approximated.\n */\nconst COLOR_MIX_SPACES: Readonly<Record<string, { mode: string; channels: readonly string[]; hue?: string }>> = {\n oklab: { mode: 'oklab', channels: ['l', 'a', 'b'] },\n lab: { mode: 'lab', channels: ['l', 'a', 'b'] },\n srgb: { mode: 'rgb', channels: ['r', 'g', 'b'] },\n 'srgb-linear': { mode: 'lrgb', channels: ['r', 'g', 'b'] },\n oklch: { mode: 'oklch', channels: ['l', 'c', 'h'], hue: 'h' },\n lch: { mode: 'lch', channels: ['l', 'c', 'h'], hue: 'h' },\n};\n\n/**\n * Below this chroma, a hue produced by CONVERTING into a polar space is float residue of an achromatic colour —\n * a powerless component, which CSS treats as missing and carries forward from the other colour.\n */\nconst POWERLESS_CHROMA = 1e-4;\n\nconst NUMBER = /^-?(?:\\d+\\.?\\d*|\\.\\d+)$/;\nconst DURATION = /^(-?(?:\\d+\\.?\\d*|\\.\\d+))(ms|s)$/;\nconst SIZE = /^(-?(?:\\d+\\.?\\d*|\\.\\d+))(px|rem)$/;\nconst CUBIC_BEZIER = /^cubic-bezier\\(\\s*([^,]+),\\s*([^,]+),\\s*([^,]+),\\s*([^,)]+)\\)$/;\n/** `var(--name)` or `var(--name, fallback)`. */\nconst VAR_REFERENCE = /^var\\(\\s*--([a-z0-9-]+)\\s*(?:,\\s*(.+))?\\)$/i;\nconst COLOR_MIX = /^color-mix\\(\\s*in\\s+([a-z0-9-]+)(?:\\s+(shorter|longer|increasing|decreasing)\\s+hue)?\\s*,(.*)\\)$/i;\nconst VIEWPORT_RELATIVE = /\\b(?:clamp|calc|min|max)\\(|\\d(?:[dsl]?v(?:w|h|i|b|min|max)|cq(?:w|h|i|b|min|max)|%)(?![\\w-])/;\n/** A non-colour alias chain deeper than this is a cycle in the token graph (`a` → `b` → `a`), not a value. */\nconst MAX_REFERENCE_DEPTH = 12;\n\nconst toLinearRgb = converter('lrgb');\n\ntype ResolvedColor = { color: CuloriColor; source: DesignTokenColorSource };\n\n/**\n * Resolve every token's value into the frame's units, or say why not.\n *\n * `values` is the whole token set for ONE theme and ONE mode — what `useUI().getTokenValue` returns — and\n * must be the whole set, because a formula refers to other tokens: `border-strong` is\n * `color-mix(in oklab, var(--foreground) 45%, var(--background))`.\n *\n * References to other tokens are resolved THROUGH THE TOKEN GRAPH rather than by asking the browser: the\n * browser answers against whatever custom properties the document holds at the moment, which lags a light/dark\n * switch, while the graph is the mode's own values by construction. The browser probe is the fallback for a\n * reference the graph cannot express, and a result that used it says so (`BROWSER_PROBE`).\n */\nexport function resolveDesignTokens(\n values: Readonly<Partial<Record<DesignSystemToken, string>>>,\n options: DesignTokenResolutionOptions = {},\n): Map<DesignSystemToken, DesignTokenResolution> {\n const rootFontSizePx = options.rootFontSizePx ?? 16;\n const colorCache = new Map<string, ResolvedColor | null>();\n const probeCache = new Map<string, ResolvedColor | null>();\n const resolving = new Set<string>();\n\n const probe = (value: string): ResolvedColor | null => {\n if (probeCache.has(value)) return probeCache.get(value) ?? null;\n const computed = options.readComputedColor?.(value) ?? null;\n const parsed = computed ? parse(computed) : undefined;\n const result = parsed ? { color: parsed, source: DesignTokenColorSource.BROWSER_PROBE } : null;\n probeCache.set(value, result);\n return result;\n };\n\n const resolveColor = (raw: string): ResolvedColor | null => {\n const value = raw.trim();\n if (colorCache.has(value)) return colorCache.get(value) ?? null;\n // A value already being resolved refers to itself — typically `var(--x)` as the value of an unconfigured\n // token `x` (`getTokenValue` returns exactly that). The graph cannot answer it; the browser may. This is the\n // ONLY unbounded case: every other chain is finite, because the token set and each string are.\n if (resolving.has(value)) return isColorReference(value) ? probe(value) : null;\n resolving.add(value);\n let result: ResolvedColor | null = null;\n try {\n const direct = COLOR_MIX.test(value) || VAR_REFERENCE.test(value) ? undefined : parse(value);\n if (direct) {\n result = { color: direct, source: DesignTokenColorSource.VALUE };\n } else {\n const reference = VAR_REFERENCE.exec(value);\n const mix = COLOR_MIX.exec(value);\n if (reference) {\n const name = reference[1];\n if (isDesignSystemToken(name) && values[name] !== undefined) {\n // A token the graph holds: its own value decides, including a probe of THAT value when it needs one.\n // Asking the browser here as well would re-ask the same question, and for an alias to a non-colour\n // token (a duration) it would ask about something that is not a colour at all.\n const target = resolveColor(values[name] as string);\n result = target ? { color: target.color, source: graphSource(target.source) } : null;\n } else {\n // Not a token: only the document can say whether the property is defined, and CSS uses the fallback\n // ONLY when it is not. So the whole expression goes to the browser, which applies that rule itself;\n // resolving the fallback here would guess that the property is undefined.\n result = probe(value);\n }\n } else if (mix) {\n result = mixColors(mix[1].toLowerCase(), mix[2]?.toLowerCase() as HueInterpolationMethod | undefined, mix[3], resolveColor)\n // A mix this resolver does not model (another space) may still be one the browser computes.\n ?? probe(value);\n }\n }\n } finally {\n resolving.delete(value);\n }\n colorCache.set(value, result);\n return result;\n };\n\n const resolveOne = (token: DesignSystemToken, raw: string, depth: number): DesignTokenResolution => {\n const value = raw.trim();\n const resolved = (r: ResolvedDesignTokenValue): DesignTokenResolution => ({ token, value, resolved: r });\n const unresolved = (reason: UnresolvedDesignTokenReason): DesignTokenResolution => ({ token, value, unresolved: reason });\n\n if (NUMBER.test(value)) return resolved({ kind: ResolvedDesignTokenKind.NUMBER, value: Number(value) });\n const duration = DURATION.exec(value);\n if (duration) return resolved({ kind: ResolvedDesignTokenKind.DURATION, seconds: Number(duration[1]) / (duration[2] === 'ms' ? 1000 : 1) });\n const size = SIZE.exec(value);\n if (size) return resolved({ kind: ResolvedDesignTokenKind.SIZE, px: Number(size[1]) * (size[2] === 'rem' ? rootFontSizePx : 1) });\n if (Object.hasOwn(EASING_KEYWORDS, value)) return resolved({ kind: ResolvedDesignTokenKind.EASING, controlPoints: EASING_KEYWORDS[value] });\n const bezier = CUBIC_BEZIER.exec(value);\n if (bezier) {\n const points = bezier.slice(1, 5).map(Number) as [number, number, number, number];\n return points.every(Number.isFinite) ? resolved({ kind: ResolvedDesignTokenKind.EASING, controlPoints: points }) : unresolved(UnresolvedDesignTokenReason.UNSUPPORTED_FORM);\n }\n\n const color = resolveColor(value);\n if (color) {\n const linear = toLinearRgb(color.color);\n return resolved({\n kind: ResolvedDesignTokenKind.COLOR,\n linearRgb: [Number(linear.r ?? 0), Number(linear.g ?? 0), Number(linear.b ?? 0)],\n alpha: color.color.alpha ?? 1,\n source: color.source,\n });\n }\n // A reference to another token that is NOT a colour (a duration token aliasing another): the alias takes\n // the target's resolution, whatever its kind.\n const reference = VAR_REFERENCE.exec(value);\n if (reference && isDesignSystemToken(reference[1]) && values[reference[1]] !== undefined && reference[1] !== token && depth < MAX_REFERENCE_DEPTH) {\n const aliased = resolveOne(reference[1], values[reference[1]] as string, depth + 1);\n return 'resolved' in aliased ? resolved(aliased.resolved) : unresolved(aliased.unresolved);\n }\n if (isColorReference(value)) return unresolved(UnresolvedDesignTokenReason.REFERENCE_UNRESOLVED);\n // Only a SINGLE value can be viewport-relative. A list (a shadow, `0 1px 2px rgb(0 0 0 / 5%)`) is unsupported\n // whatever percentages its colours carry.\n if (isSingleComponent(value) && VIEWPORT_RELATIVE.test(value)) return unresolved(UnresolvedDesignTokenReason.VIEWPORT_RELATIVE);\n return unresolved(UnresolvedDesignTokenReason.UNSUPPORTED_FORM);\n };\n\n const resolutions = new Map<DesignSystemToken, DesignTokenResolution>();\n for (const token of Object.values(DesignSystemToken)) {\n const value = values[token];\n if (value !== undefined) resolutions.set(token, resolveOne(token, value, 0));\n }\n return resolutions;\n}\n\nfunction isColorReference(value: string): boolean {\n return /^var\\(/i.test(value) || /^color-mix\\(/i.test(value);\n}\n\n/** A reference resolved through the graph keeps BROWSER_PROBE if its target needed the browser. */\nfunction graphSource(inner: DesignTokenColorSource): DesignTokenColorSource {\n return inner === DesignTokenColorSource.BROWSER_PROBE ? DesignTokenColorSource.BROWSER_PROBE : DesignTokenColorSource.TOKEN_GRAPH;\n}\n\nfunction isDesignSystemToken(name: string): name is DesignSystemToken {\n return (Object.values(DesignSystemToken) as string[]).includes(name);\n}\n\n/**\n * `color-mix(in <space> [<method> hue], <colour> [<p>%], <colour> [<p>%])`, computed.\n *\n * - Percentages (CSS Color 5 §3.2): each must lie in 0–100%; an omitted one makes the pair sum to 100%; any\n * other total is normalised to 100%, a total under 100% becomes an alpha multiplier, and a total of 0% is\n * rejected (CSS makes the whole function invalid).\n * - A hue method (`in oklch longer hue`) is valid only for a polar space; on a rectangular one it is rejected.\n * - Interpolation (CSS Color 4 §13): a missing component — including a hue made powerless by converting an\n * achromatic colour into a polar space — is carried forward from the other colour; colours are premultiplied\n * by alpha, EXCEPT the hue of a polar space; the hue follows the requested method.\n * spec-cite: CSS Color Module Level 5 §3.2 (percentage normalization) and §3.3 (calculating the result) — https://www.w3.org/TR/css-color-5/\n * spec-cite: CSS Color Module Level 4 §13.3 (missing components), §13.4 (premultiplied alpha, hue not premultiplied), §13.5.1–13.5.4 (hue methods) — https://www.w3.org/TR/css-color-4/\n */\nfunction mixColors(\n space: string,\n requestedHueMethod: HueInterpolationMethod | undefined,\n argumentsText: string,\n resolveArgument: (value: string) => ResolvedColor | null,\n): ResolvedColor | null {\n const model = COLOR_MIX_SPACES[space];\n if (!model) return null;\n // A hue method names a hue to interpolate; a rectangular space has none, and CSS rejects the declaration.\n if (requestedHueMethod !== undefined && !model.hue) return null;\n const hueMethod = requestedHueMethod ?? HueInterpolationMethod.SHORTER;\n const parts = splitTopLevel(argumentsText);\n if (parts.length !== 2) return null;\n const parsed = parts.map((part) => {\n const match = /^(.*?)(?:\\s+(-?\\d+(?:\\.\\d+)?)%)?$/.exec(part.trim());\n return match ? { colorText: match[1].trim(), percentage: match[2] === undefined ? undefined : Number(match[2]) } : null;\n });\n if (parsed.some((p) => p === null)) return null;\n const [first, second] = parsed as [{ colorText: string; percentage?: number }, { colorText: string; percentage?: number }];\n if ([first.percentage, second.percentage].some((p) => p !== undefined && (p < 0 || p > 100))) return null;\n let p1 = first.percentage;\n let p2 = second.percentage;\n if (p1 === undefined && p2 === undefined) { p1 = 50; p2 = 50; } else if (p1 === undefined) { p1 = 100 - (p2 as number); } else if (p2 === undefined) { p2 = 100 - p1; }\n const sum = (p1 as number) + (p2 as number);\n if (sum === 0) return null;\n const alphaMultiplier = sum < 100 ? sum / 100 : 1;\n const progress = (p2 as number) / sum;\n\n const a = resolveArgument(first.colorText);\n const b = resolveArgument(second.colorText);\n if (!a || !b) return null;\n const mixed = interpolateCss(a.color, b.color, model, hueMethod, progress);\n mixed.alpha = (mixed.alpha ?? 1) * alphaMultiplier;\n const source = a.source === DesignTokenColorSource.BROWSER_PROBE || b.source === DesignTokenColorSource.BROWSER_PROBE\n ? DesignTokenColorSource.BROWSER_PROBE\n : DesignTokenColorSource.TOKEN_GRAPH;\n return { color: mixed, source };\n}\n\n/** CSS Color 4 §13 interpolation of two colours in one space, at progress `t` (0 = first, 1 = second). */\nfunction interpolateCss(\n first: CuloriColor,\n second: CuloriColor,\n model: { mode: string; channels: readonly string[]; hue?: string },\n hueMethod: HueInterpolationMethod,\n t: number,\n): CuloriColor {\n const toSpace = converter(model.mode);\n const read = (color: CuloriColor): Record<string, number | undefined> => {\n const converted = toSpace(color);\n const channels: Record<string, number | undefined> = {};\n for (const channel of model.channels) {\n const raw = converted[channel];\n channels[channel] = typeof raw === 'number' && Number.isFinite(raw) ? raw : undefined;\n }\n // A hue made powerless by conversion (an achromatic colour entering a polar space) is missing.\n if (model.hue && color.mode !== model.mode && (channels.c ?? 0) < POWERLESS_CHROMA) channels[model.hue] = undefined;\n // §13.5: both angles are brought into [0, 360) BEFORE the hue method adjusts them. `oklch(… 730)` is hue 10.\n if (model.hue && channels[model.hue] !== undefined) channels[model.hue] = (((channels[model.hue] as number) % 360) + 360) % 360;\n channels.alpha = typeof color.alpha === 'number' ? color.alpha : 1;\n return channels;\n };\n const c1 = read(first);\n const c2 = read(second);\n // §13.3: a component missing in ONE colour takes the other's value; missing in both stays missing (0).\n for (const channel of [...model.channels, 'alpha']) {\n if (c1[channel] === undefined && c2[channel] !== undefined) c1[channel] = c2[channel];\n if (c2[channel] === undefined && c1[channel] !== undefined) c2[channel] = c1[channel];\n }\n if (model.hue && c1[model.hue] !== undefined && c2[model.hue] !== undefined) {\n let h1 = c1[model.hue] as number;\n let h2 = c2[model.hue] as number;\n const delta = h2 - h1;\n // §13.5.1–13.5.4, verbatim adjustments.\n if (hueMethod === HueInterpolationMethod.SHORTER) { if (delta > 180) h1 += 360; else if (delta < -180) h2 += 360; }\n if (hueMethod === HueInterpolationMethod.LONGER) { if (delta > 0 && delta < 180) h1 += 360; else if (delta > -180 && delta <= 0) h2 += 360; }\n if (hueMethod === HueInterpolationMethod.INCREASING) { if (h2 < h1) h2 += 360; }\n if (hueMethod === HueInterpolationMethod.DECREASING) { if (h1 < h2) h1 += 360; }\n c1[model.hue] = h1;\n c2[model.hue] = h2;\n }\n const a1 = c1.alpha as number;\n const a2 = c2.alpha as number;\n const alpha = a1 + (a2 - a1) * t;\n const result: CuloriColor = { mode: model.mode, alpha };\n for (const channel of model.channels) {\n const v1 = c1[channel];\n const v2 = c2[channel];\n if (v1 === undefined || v2 === undefined) { result[channel] = channel === model.hue ? undefined : 0; continue; }\n if (channel === model.hue) {\n // §13.4: the hue is NOT premultiplied.\n result[channel] = (((v1 + (v2 - v1) * t) % 360) + 360) % 360;\n continue;\n }\n const premultiplied = v1 * a1 + (v2 * a2 - v1 * a1) * t;\n result[channel] = alpha === 0 ? premultiplied : premultiplied / alpha;\n }\n return result;\n}\n\n/** Split on commas that are not inside parentheses. */\nfunction splitTopLevel(text: string): string[] {\n const parts: string[] = [];\n let depth = 0;\n let current = '';\n for (const character of text) {\n if (character === '(') depth += 1;\n if (character === ')') depth -= 1;\n if (character === ',' && depth === 0) { parts.push(current); current = ''; continue; }\n current += character;\n }\n parts.push(current);\n return parts;\n}\n\n/** Whether a value is ONE component: no whitespace or comma outside parentheses. */\nfunction isSingleComponent(text: string): boolean {\n let depth = 0;\n for (const character of text.trim()) {\n if (character === '(') depth += 1;\n if (character === ')') depth -= 1;\n if (depth === 0 && /[\\s,]/.test(character)) return false;\n }\n return true;\n}\n"]}
1
+ {"version":3,"file":"design-token-resolution.js","sourceRoot":"","sources":["../../../../src/tokens/design-token-resolution.ts"],"names":[],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C,IAAI,CAAC,OAAO,CAAC,CAAC;IACpB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,oFAAoF;AACpF,SAAS,iBAAiB,CAAC,IAAY;IACrC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QACpC,IAAI,SAAS,KAAK,GAAG;YAAE,KAAK,IAAI,CAAC,CAAC;QAClC,IAAI,SAAS,KAAK,GAAG;YAAE,KAAK,IAAI,CAAC,CAAC;QAClC,IAAI,KAAK,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC;YAAE,OAAO,KAAK,CAAC;IAC3D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { converter, parse, type CuloriColor } from 'culori';\n\nimport { DesignSystemToken } from '@wildo-ai/presets-components-models';\n\n/**\n * What a design-token value resolved to, in the units a WebGL frame uses (#1819).\n *\n * Token values are authored as CSS strings — `oklch(...)`, `color-mix(...)`, `150ms`, `cubic-bezier(...)`,\n * `0.5rem` — because the DOM consumes them as CSS. The 3D frame draws with numbers, so each value is\n * resolved once, per theme and per light/dark mode, into one of these kinds.\n */\nexport enum ResolvedDesignTokenKind {\n /** A colour, in linear-light sRGB (what three.js expects of a material colour) plus alpha. */\n COLOR = 'color',\n /** A duration (`ms` / `s`), in seconds. */\n DURATION = 'duration',\n /** An easing, as the four control points of a cubic Bézier. */\n EASING = 'easing',\n /** A length (`px` / `rem`), in CSS pixels. */\n SIZE = 'size',\n /** A plain number (an opacity). */\n NUMBER = 'number',\n}\n\n/**\n * Why a value was NOT resolved. A value the frame cannot use is reported, never guessed: a wrong number in\n * a WebGL scene is invisible until someone notices the frame looks off.\n */\nexport enum UnresolvedDesignTokenReason {\n /**\n * The value depends on the viewport or the containing layout (`clamp()`, `calc()`, viewport units such as `vw`\n * and `dvh`, container units such as `cqi`, `%`), so it has no single number.\n */\n VIEWPORT_RELATIVE = 'viewport-relative',\n /**\n * A reference (`var()`, `color-mix()`) that neither the token graph nor the browser probe resolved — an\n * unknown custom property, a mixing space this resolver does not model, or a percentage CSS rejects.\n */\n REFERENCE_UNRESOLVED = 'reference-unresolved',\n /** Not one of the forms the frame reads: a shadow list, a list of palette names, a stepped easing. */\n UNSUPPORTED_FORM = 'unsupported-form',\n}\n\n/** Where a resolved colour came from. The provenance travels through references and mixes. */\nexport enum DesignTokenColorSource {\n /** The token's own value was a colour literal. */\n VALUE = 'value',\n /** Resolved through other tokens (`var(--token)`, `color-mix()` of tokens) with no browser involved. */\n TOKEN_GRAPH = 'token-graph',\n /**\n * At least one input came from the browser probe, which answers against the document's custom properties at\n * the moment of the call — see `useDesignTokenResolution` for why such a result is recomputed after a commit.\n */\n BROWSER_PROBE = 'browser-probe',\n}\n\n/**\n * A token value in the frame's units. The kind decides the unit: linear-light sRGB plus alpha for a colour,\n * seconds for a duration, cubic-Bézier control points for an easing, CSS pixels for a size.\n */\nexport type ResolvedDesignTokenValue =\n | { kind: ResolvedDesignTokenKind.COLOR; linearRgb: readonly [number, number, number]; alpha: number; source: DesignTokenColorSource }\n | { kind: ResolvedDesignTokenKind.DURATION; seconds: number }\n | { kind: ResolvedDesignTokenKind.EASING; controlPoints: readonly [number, number, number, number] }\n | { kind: ResolvedDesignTokenKind.SIZE; px: number }\n | { kind: ResolvedDesignTokenKind.NUMBER; value: number };\n\n/**\n * One token's outcome: its authored CSS `value`, and either what it `resolved` to or why it is `unresolved`.\n * There is no third state, so a consumer must handle both, and an unresolved token is never read as a default.\n */\nexport type DesignTokenResolution =\n | { token: DesignSystemToken; value: string; resolved: ResolvedDesignTokenValue }\n | { token: DesignSystemToken; value: string; unresolved: UnresolvedDesignTokenReason };\n\nexport interface DesignTokenResolutionOptions {\n /** The root font size a `rem` is measured against. The framework's own is 16 px. */\n rootFontSizePx?: number;\n /**\n * The browser's computed form of a colour reference the token graph cannot express: a `var()` naming a custom\n * property that is not a token (the browser also applies its fallback, when the property is undefined), or a\n * `color-mix()` this resolver does not model. `readComputedCssColorViaDom` from `@wildo-ai/saas-frontend-lib`\n * in a browser. Omitted in a test, where there is no browser to ask; such a reference is then unresolved.\n */\n readComputedColor?: (value: string) => string | null;\n}\n\n/** The hue interpolation methods of CSS Color 4 §13.5, as `color-mix()` spells them. */\nenum HueInterpolationMethod {\n SHORTER = 'shorter',\n LONGER = 'longer',\n INCREASING = 'increasing',\n DECREASING = 'decreasing',\n}\n\n/**\n * The CSS easing keywords, as cubic-Bézier control points. `linear` is the identity easing, which the\n * Bézier (0, 0, 1, 1) reproduces exactly.\n * spec-cite: CSS Easing Functions Level 1 §2.2 (the four keyword curves) and §2.1 (`linear` is the identity) — https://www.w3.org/TR/css-easing-1/\n */\nconst EASING_KEYWORDS: Readonly<Record<string, readonly [number, number, number, number]>> = {\n linear: [0, 0, 1, 1],\n ease: [0.25, 0.1, 0.25, 1],\n 'ease-in': [0.42, 0, 1, 1],\n 'ease-out': [0, 0, 0.58, 1],\n 'ease-in-out': [0.42, 0, 0.58, 1],\n};\n\n/**\n * The `color-mix()` interpolation spaces this resolver models: the culori mode, its channels, and which channel\n * is a hue (polar spaces). Anything else is reported unresolved rather than approximated.\n */\nconst COLOR_MIX_SPACES: Readonly<Record<string, { mode: string; channels: readonly string[]; hue?: string }>> = {\n oklab: { mode: 'oklab', channels: ['l', 'a', 'b'] },\n lab: { mode: 'lab', channels: ['l', 'a', 'b'] },\n srgb: { mode: 'rgb', channels: ['r', 'g', 'b'] },\n 'srgb-linear': { mode: 'lrgb', channels: ['r', 'g', 'b'] },\n oklch: { mode: 'oklch', channels: ['l', 'c', 'h'], hue: 'h' },\n lch: { mode: 'lch', channels: ['l', 'c', 'h'], hue: 'h' },\n};\n\n/**\n * Below this chroma, a hue produced by CONVERTING into a polar space is float residue of an achromatic colour —\n * a powerless component, which CSS treats as missing and carries forward from the other colour.\n */\nconst POWERLESS_CHROMA = 1e-4;\n\nconst NUMBER = /^-?(?:\\d+\\.?\\d*|\\.\\d+)$/;\nconst DURATION = /^(-?(?:\\d+\\.?\\d*|\\.\\d+))(ms|s)$/;\nconst SIZE = /^(-?(?:\\d+\\.?\\d*|\\.\\d+))(px|rem)$/;\nconst CUBIC_BEZIER = /^cubic-bezier\\(\\s*([^,]+),\\s*([^,]+),\\s*([^,]+),\\s*([^,)]+)\\)$/;\n/** `var(--name)` or `var(--name, fallback)`. */\nconst VAR_REFERENCE = /^var\\(\\s*--([a-z0-9-]+)\\s*(?:,\\s*(.+))?\\)$/i;\nconst COLOR_MIX = /^color-mix\\(\\s*in\\s+([a-z0-9-]+)(?:\\s+(shorter|longer|increasing|decreasing)\\s+hue)?\\s*,(.*)\\)$/i;\nconst VIEWPORT_RELATIVE = /\\b(?:clamp|calc|min|max)\\(|\\d(?:[dsl]?v(?:w|h|i|b|min|max)|cq(?:w|h|i|b|min|max)|%)(?![\\w-])/;\n/** A non-colour alias chain deeper than this is a cycle in the token graph (`a` → `b` → `a`), not a value. */\nconst MAX_REFERENCE_DEPTH = 12;\n\nconst toLinearRgb = converter('lrgb');\n\ntype ResolvedColor = { color: CuloriColor; source: DesignTokenColorSource };\n\n/**\n * Resolve every token's value into the frame's units, or say why not.\n *\n * `values` is the whole token set for ONE theme and ONE mode — what `useUI().getTokenValue` returns — and\n * must be the whole set, because a formula refers to other tokens: `border-strong` is\n * `color-mix(in oklab, var(--foreground) 45%, var(--background))`.\n *\n * References to other tokens are resolved THROUGH THE TOKEN GRAPH rather than by asking the browser: the\n * browser answers against whatever custom properties the document holds at the moment, which lags a light/dark\n * switch, while the graph is the mode's own values by construction. The browser probe is the fallback for a\n * reference the graph cannot express, and a result that used it says so (`BROWSER_PROBE`).\n */\nexport function resolveDesignTokens(\n values: Readonly<Partial<Record<DesignSystemToken, string>>>,\n options: DesignTokenResolutionOptions = {},\n): Map<DesignSystemToken, DesignTokenResolution> {\n const rootFontSizePx = options.rootFontSizePx ?? 16;\n const colorCache = new Map<string, ResolvedColor | null>();\n const probeCache = new Map<string, ResolvedColor | null>();\n const resolving = new Set<string>();\n\n const probe = (value: string): ResolvedColor | null => {\n if (probeCache.has(value)) return probeCache.get(value) ?? null;\n const computed = options.readComputedColor?.(value) ?? null;\n const parsed = computed ? parse(computed) : undefined;\n const result = parsed ? { color: parsed, source: DesignTokenColorSource.BROWSER_PROBE } : null;\n probeCache.set(value, result);\n return result;\n };\n\n const resolveColor = (raw: string): ResolvedColor | null => {\n const value = raw.trim();\n if (colorCache.has(value)) return colorCache.get(value) ?? null;\n // A value already being resolved refers to itself — typically `var(--x)` as the value of an unconfigured\n // token `x` (`getTokenValue` returns exactly that). The graph cannot answer it; the browser may. This is the\n // ONLY unbounded case: every other chain is finite, because the token set and each string are.\n if (resolving.has(value)) return isColorReference(value) ? probe(value) : null;\n resolving.add(value);\n let result: ResolvedColor | null = null;\n try {\n const direct = COLOR_MIX.test(value) || VAR_REFERENCE.test(value) ? undefined : parse(value);\n if (direct) {\n result = { color: direct, source: DesignTokenColorSource.VALUE };\n } else {\n const reference = VAR_REFERENCE.exec(value);\n const mix = COLOR_MIX.exec(value);\n if (reference) {\n const name = reference[1];\n if (isDesignSystemToken(name) && values[name] !== undefined) {\n // A token the graph holds: its own value decides, including a probe of THAT value when it needs one.\n // Asking the browser here as well would re-ask the same question, and for an alias to a non-colour\n // token (a duration) it would ask about something that is not a colour at all.\n const target = resolveColor(values[name] as string);\n result = target ? { color: target.color, source: graphSource(target.source) } : null;\n } else {\n // Not a token: only the document can say whether the property is defined, and CSS uses the fallback\n // ONLY when it is not. So the whole expression goes to the browser, which applies that rule itself;\n // resolving the fallback here would guess that the property is undefined.\n result = probe(value);\n }\n } else if (mix) {\n result = mixColors(mix[1].toLowerCase(), mix[2]?.toLowerCase() as HueInterpolationMethod | undefined, mix[3], resolveColor)\n // A mix this resolver does not model (another space) may still be one the browser computes.\n ?? probe(value);\n }\n }\n } finally {\n resolving.delete(value);\n }\n colorCache.set(value, result);\n return result;\n };\n\n const resolveOne = (token: DesignSystemToken, raw: string, depth: number): DesignTokenResolution => {\n const value = raw.trim();\n const resolved = (r: ResolvedDesignTokenValue): DesignTokenResolution => ({ token, value, resolved: r });\n const unresolved = (reason: UnresolvedDesignTokenReason): DesignTokenResolution => ({ token, value, unresolved: reason });\n\n if (NUMBER.test(value)) return resolved({ kind: ResolvedDesignTokenKind.NUMBER, value: Number(value) });\n const duration = DURATION.exec(value);\n if (duration) return resolved({ kind: ResolvedDesignTokenKind.DURATION, seconds: Number(duration[1]) / (duration[2] === 'ms' ? 1000 : 1) });\n const size = SIZE.exec(value);\n if (size) return resolved({ kind: ResolvedDesignTokenKind.SIZE, px: Number(size[1]) * (size[2] === 'rem' ? rootFontSizePx : 1) });\n if (Object.hasOwn(EASING_KEYWORDS, value)) return resolved({ kind: ResolvedDesignTokenKind.EASING, controlPoints: EASING_KEYWORDS[value] });\n const bezier = CUBIC_BEZIER.exec(value);\n if (bezier) {\n const points = bezier.slice(1, 5).map(Number) as [number, number, number, number];\n return points.every(Number.isFinite) ? resolved({ kind: ResolvedDesignTokenKind.EASING, controlPoints: points }) : unresolved(UnresolvedDesignTokenReason.UNSUPPORTED_FORM);\n }\n\n const color = resolveColor(value);\n if (color) {\n const linear = toLinearRgb(color.color);\n return resolved({\n kind: ResolvedDesignTokenKind.COLOR,\n linearRgb: [Number(linear.r ?? 0), Number(linear.g ?? 0), Number(linear.b ?? 0)],\n alpha: color.color.alpha ?? 1,\n source: color.source,\n });\n }\n // A reference to another token that is NOT a colour (a duration token aliasing another): the alias takes\n // the target's resolution, whatever its kind.\n const reference = VAR_REFERENCE.exec(value);\n if (reference && isDesignSystemToken(reference[1]) && values[reference[1]] !== undefined && reference[1] !== token && depth < MAX_REFERENCE_DEPTH) {\n const aliased = resolveOne(reference[1], values[reference[1]] as string, depth + 1);\n return 'resolved' in aliased ? resolved(aliased.resolved) : unresolved(aliased.unresolved);\n }\n if (isColorReference(value)) return unresolved(UnresolvedDesignTokenReason.REFERENCE_UNRESOLVED);\n // Only a SINGLE value can be viewport-relative. A list (a shadow, `0 1px 2px rgb(0 0 0 / 5%)`) is unsupported\n // whatever percentages its colours carry.\n if (isSingleComponent(value) && VIEWPORT_RELATIVE.test(value)) return unresolved(UnresolvedDesignTokenReason.VIEWPORT_RELATIVE);\n return unresolved(UnresolvedDesignTokenReason.UNSUPPORTED_FORM);\n };\n\n const resolutions = new Map<DesignSystemToken, DesignTokenResolution>();\n for (const token of Object.values(DesignSystemToken)) {\n const value = values[token];\n if (value !== undefined) resolutions.set(token, resolveOne(token, value, 0));\n }\n return resolutions;\n}\n\nfunction isColorReference(value: string): boolean {\n return /^var\\(/i.test(value) || /^color-mix\\(/i.test(value);\n}\n\n/** A reference resolved through the graph keeps BROWSER_PROBE if its target needed the browser. */\nfunction graphSource(inner: DesignTokenColorSource): DesignTokenColorSource {\n return inner === DesignTokenColorSource.BROWSER_PROBE ? DesignTokenColorSource.BROWSER_PROBE : DesignTokenColorSource.TOKEN_GRAPH;\n}\n\nfunction isDesignSystemToken(name: string): name is DesignSystemToken {\n return (Object.values(DesignSystemToken) as string[]).includes(name);\n}\n\n/**\n * `color-mix(in <space> [<method> hue], <colour> [<p>%], <colour> [<p>%])`, computed.\n *\n * - Percentages (CSS Color 5 §3.2): each must lie in 0–100%; an omitted one makes the pair sum to 100%; any\n * other total is normalised to 100%, a total under 100% becomes an alpha multiplier, and a total of 0% is\n * rejected (CSS makes the whole function invalid).\n * - A hue method (`in oklch longer hue`) is valid only for a polar space; on a rectangular one it is rejected.\n * - Interpolation (CSS Color 4 §13): a missing component — including a hue made powerless by converting an\n * achromatic colour into a polar space — is carried forward from the other colour; colours are premultiplied\n * by alpha, EXCEPT the hue of a polar space; the hue follows the requested method.\n * spec-cite: CSS Color Module Level 5 §3.2 (percentage normalization) and §3.3 (calculating the result) — https://www.w3.org/TR/css-color-5/\n * spec-cite: CSS Color Module Level 4 §13.3 (missing components), §13.4 (premultiplied alpha, hue not premultiplied), §13.5.1–13.5.4 (hue methods) — https://www.w3.org/TR/css-color-4/\n */\nfunction mixColors(\n space: string,\n requestedHueMethod: HueInterpolationMethod | undefined,\n argumentsText: string,\n resolveArgument: (value: string) => ResolvedColor | null,\n): ResolvedColor | null {\n const model = COLOR_MIX_SPACES[space];\n if (!model) return null;\n // A hue method names a hue to interpolate; a rectangular space has none, and CSS rejects the declaration.\n if (requestedHueMethod !== undefined && !model.hue) return null;\n const hueMethod = requestedHueMethod ?? HueInterpolationMethod.SHORTER;\n const parts = splitTopLevel(argumentsText);\n if (parts.length !== 2) return null;\n const parsed = parts.map((part) => {\n const match = /^(.*?)(?:\\s+(-?\\d+(?:\\.\\d+)?)%)?$/.exec(part.trim());\n return match ? { colorText: match[1].trim(), percentage: match[2] === undefined ? undefined : Number(match[2]) } : null;\n });\n if (parsed.some((p) => p === null)) return null;\n const [first, second] = parsed as [{ colorText: string; percentage?: number }, { colorText: string; percentage?: number }];\n if ([first.percentage, second.percentage].some((p) => p !== undefined && (p < 0 || p > 100))) return null;\n let p1 = first.percentage;\n let p2 = second.percentage;\n if (p1 === undefined && p2 === undefined) { p1 = 50; p2 = 50; } else if (p1 === undefined) { p1 = 100 - (p2 as number); } else if (p2 === undefined) { p2 = 100 - p1; }\n const sum = (p1 as number) + (p2 as number);\n if (sum === 0) return null;\n const alphaMultiplier = sum < 100 ? sum / 100 : 1;\n const progress = (p2 as number) / sum;\n\n const a = resolveArgument(first.colorText);\n const b = resolveArgument(second.colorText);\n if (!a || !b) return null;\n const mixed = interpolateCss(a.color, b.color, model, hueMethod, progress);\n mixed.alpha = (mixed.alpha ?? 1) * alphaMultiplier;\n const source = a.source === DesignTokenColorSource.BROWSER_PROBE || b.source === DesignTokenColorSource.BROWSER_PROBE\n ? DesignTokenColorSource.BROWSER_PROBE\n : DesignTokenColorSource.TOKEN_GRAPH;\n return { color: mixed, source };\n}\n\n/** CSS Color 4 §13 interpolation of two colours in one space, at progress `t` (0 = first, 1 = second). */\nfunction interpolateCss(\n first: CuloriColor,\n second: CuloriColor,\n model: { mode: string; channels: readonly string[]; hue?: string },\n hueMethod: HueInterpolationMethod,\n t: number,\n): CuloriColor {\n const toSpace = converter(model.mode);\n const read = (color: CuloriColor): Record<string, number | undefined> => {\n const converted = toSpace(color);\n const channels: Record<string, number | undefined> = {};\n for (const channel of model.channels) {\n const raw = converted[channel];\n channels[channel] = typeof raw === 'number' && Number.isFinite(raw) ? raw : undefined;\n }\n // A hue made powerless by conversion (an achromatic colour entering a polar space) is missing.\n if (model.hue && color.mode !== model.mode && (channels.c ?? 0) < POWERLESS_CHROMA) channels[model.hue] = undefined;\n // §13.5: both angles are brought into [0, 360) BEFORE the hue method adjusts them. `oklch(… 730)` is hue 10.\n if (model.hue && channels[model.hue] !== undefined) channels[model.hue] = (((channels[model.hue] as number) % 360) + 360) % 360;\n channels.alpha = typeof color.alpha === 'number' ? color.alpha : 1;\n return channels;\n };\n const c1 = read(first);\n const c2 = read(second);\n // §13.3: a component missing in ONE colour takes the other's value; missing in both stays missing (0).\n for (const channel of [...model.channels, 'alpha']) {\n if (c1[channel] === undefined && c2[channel] !== undefined) c1[channel] = c2[channel];\n if (c2[channel] === undefined && c1[channel] !== undefined) c2[channel] = c1[channel];\n }\n if (model.hue && c1[model.hue] !== undefined && c2[model.hue] !== undefined) {\n let h1 = c1[model.hue] as number;\n let h2 = c2[model.hue] as number;\n const delta = h2 - h1;\n // §13.5.1–13.5.4, verbatim adjustments.\n if (hueMethod === HueInterpolationMethod.SHORTER) { if (delta > 180) h1 += 360; else if (delta < -180) h2 += 360; }\n if (hueMethod === HueInterpolationMethod.LONGER) { if (delta > 0 && delta < 180) h1 += 360; else if (delta > -180 && delta <= 0) h2 += 360; }\n if (hueMethod === HueInterpolationMethod.INCREASING) { if (h2 < h1) h2 += 360; }\n if (hueMethod === HueInterpolationMethod.DECREASING) { if (h1 < h2) h1 += 360; }\n c1[model.hue] = h1;\n c2[model.hue] = h2;\n }\n const a1 = c1.alpha as number;\n const a2 = c2.alpha as number;\n const alpha = a1 + (a2 - a1) * t;\n const result: CuloriColor = { mode: model.mode, alpha };\n for (const channel of model.channels) {\n const v1 = c1[channel];\n const v2 = c2[channel];\n if (v1 === undefined || v2 === undefined) { result[channel] = channel === model.hue ? undefined : 0; continue; }\n if (channel === model.hue) {\n // §13.4: the hue is NOT premultiplied.\n result[channel] = (((v1 + (v2 - v1) * t) % 360) + 360) % 360;\n continue;\n }\n const premultiplied = v1 * a1 + (v2 * a2 - v1 * a1) * t;\n result[channel] = alpha === 0 ? premultiplied : premultiplied / alpha;\n }\n return result;\n}\n\n/** Split on commas that are not inside parentheses. */\nfunction splitTopLevel(text: string): string[] {\n const parts: string[] = [];\n let depth = 0;\n let current = '';\n for (const character of text) {\n if (character === '(') depth += 1;\n if (character === ')') depth -= 1;\n if (character === ',' && depth === 0) { parts.push(current); current = ''; continue; }\n current += character;\n }\n parts.push(current);\n return parts;\n}\n\n/** Whether a value is ONE component: no whitespace or comma outside parentheses. */\nfunction isSingleComponent(text: string): boolean {\n let depth = 0;\n for (const character of text.trim()) {\n if (character === '(') depth += 1;\n if (character === ')') depth -= 1;\n if (depth === 0 && /[\\s,]/.test(character)) return false;\n }\n return true;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use-design-token-resolution.d.ts","sourceRoot":"","sources":["../../../src/tokens/use-design-token-resolution.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAGxE,OAAO,EAAuB,KAAK,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAE5F;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,IAAI,WAAW,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CA0BhG"}
1
+ {"version":3,"file":"use-design-token-resolution.d.ts","sourceRoot":"","sources":["../../../../src/tokens/use-design-token-resolution.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAGxE,OAAO,EAAuB,KAAK,qBAAqB,E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E,SAAS,EAAE,CAAC;QACtG,wGAAwG;QACxG,iHAAiH;QACjH,8DAA8D;IAChE,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC,CAAC;IAE3D,0GAA0G;IAC1G,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,cAAc;YAAE,OAAO,SAAS,CAAC;QACtC,MAAM,KAAK,GAAG,qBAAqB,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;QAClF,OAAO,GAAG,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;IAE5C,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import { useEffect, useMemo, useState } from 'react';\n\nimport { DesignSystemToken } from '@wildo-ai/presets-components-models';\nimport { readComputedCssColorViaDom, useUI } from '@wildo-ai/saas-frontend-lib';\n\nimport { resolveDesignTokens, type DesignTokenResolution } from './design-token-resolution';\n\n/**\n * The active theme's tokens, resolved into the frame's units for the CURRENT light/dark mode (#1819).\n *\n * Recomputed exactly when a resolved value can change: `getTokenValue` changes identity with the design-system\n * configuration and with `isDark`, and the theme id covers a theme switch. So a formula is resolved once per\n * theme and mode — never per frame, which is the frame renderer's hot path.\n *\n * The WHOLE token set is resolved even when a caller wants a few tokens, because a formula refers to other\n * tokens (`border-strong` mixes `foreground` and `background`).\n *\n * **The browser probe answers against the DOCUMENT, which lags a render.** The theme provider writes the new\n * mode's custom properties in an effect, i.e. after the render in which this memo runs, so the probe reads the\n * PREVIOUS mode's properties — or none at all, for a custom token the new theme introduces. So whenever the\n * probe was CONSULTED, whatever it answered, the hook resolves once more on the next animation frame after the\n * commit. The provider is an ancestor, so its effects run after this component's in the same flush and have\n * written the document before that frame. A theme whose every value resolves through the graph (the default\n * theme does) never consults the probe and pays nothing.\n */\nexport function useDesignTokenResolution(): ReadonlyMap<DesignSystemToken, DesignTokenResolution> {\n const { getTokenValue, isDark, designTheme } = useUI();\n const [documentEpoch, setDocumentEpoch] = useState(0);\n\n const { resolutions, consultedProbe } = useMemo(() => {\n const values: Partial<Record<DesignSystemToken, string>> = {};\n for (const token of Object.values(DesignSystemToken)) values[token] = getTokenValue(token);\n let consulted = false;\n const readComputedColor = (value: string): string | null => {\n consulted = true;\n return readComputedCssColorViaDom(value);\n };\n return { resolutions: resolveDesignTokens(values, { readComputedColor }), consultedProbe: consulted };\n // `isDark` and the theme id are listed although `getTokenValue` already changes with them: they are the\n // inputs the result depends on, and naming them keeps that true if `getTokenValue` is ever memoised differently.\n // `documentEpoch` is the post-commit re-read described above.\n }, [getTokenValue, isDark, designTheme.id, documentEpoch]);\n\n // Keyed on the inputs, NOT on `resolutions`: the re-read produces a new map, and keying on it would loop.\n useEffect(() => {\n if (!consultedProbe) return undefined;\n const frame = requestAnimationFrame(() => setDocumentEpoch((epoch) => epoch + 1));\n return () => cancelAnimationFrame(frame);\n }, [getTokenValue, isDark, designTheme.id]);\n\n return resolutions;\n}\n"]}
1
+ {"version":3,"file":"use-design-token-resolution.js","sourceRoot":"","sources":["../../../../src/tokens/use-design-token-resolution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEhF,OAAO,EAAE,mBAAmB,EAA8B,MAAM,2BAA2B,CAAC;AAE5F;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,wBAAwB;IACtC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,KAAK,EAAE,CA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esignSystemToken } from '@wildo-ai/presets-components-models';\nimport { readComputedCssColorViaDom, useUI } from '@wildo-ai/saas-frontend-lib';\n\nimport { resolveDesignTokens, type DesignTokenResolution } from './design-token-resolution';\n\n/**\n * The active theme's tokens, resolved into the frame's units for the CURRENT light/dark mode (#1819).\n *\n * Recomputed exactly when a resolved value can change: `getTokenValue` changes identity with the design-system\n * configuration and with `isDark`, and the theme id covers a theme switch. So a formula is resolved once per\n * theme and mode — never per frame, which is the frame renderer's hot path.\n *\n * The WHOLE token set is resolved even when a caller wants a few tokens, because a formula refers to other\n * tokens (`border-strong` mixes `foreground` and `background`).\n *\n * **The browser probe answers against the DOCUMENT, which lags a render.** The theme provider writes the new\n * mode's custom properties in an effect, i.e. after the render in which this memo runs, so the probe reads the\n * PREVIOUS mode's properties — or none at all, for a custom token the new theme introduces. So whenever the\n * probe was CONSULTED, whatever it answered, the hook resolves once more on the next animation frame after the\n * commit. The provider is an ancestor, so its effects run after this component's in the same flush and have\n * written the document before that frame. A theme whose every value resolves through the graph (the default\n * theme does) never consults the probe and pays nothing.\n */\nexport function useDesignTokenResolution(): ReadonlyMap<DesignSystemToken, DesignTokenResolution> {\n const { getTokenValue, isDark, designTheme } = useUI();\n const [documentEpoch, setDocumentEpoch] = useState(0);\n\n const { resolutions, consultedProbe } = useMemo(() => {\n const values: Partial<Record<DesignSystemToken, string>> = {};\n for (const token of Object.values(DesignSystemToken)) values[token] = getTokenValue(token);\n let consulted = false;\n const readComputedColor = (value: string): string | null => {\n consulted = true;\n return readComputedCssColorViaDom(value);\n };\n return { resolutions: resolveDesignTokens(values, { readComputedColor }), consultedProbe: consulted };\n // `isDark` and the theme id are listed although `getTokenValue` already changes with them: they are the\n // inputs the result depends on, and naming them keeps that true if `getTokenValue` is ever memoised differently.\n // `documentEpoch` is the post-commit re-read described above.\n }, [getTokenValue, isDark, designTheme.id, documentEpoch]);\n\n // Keyed on the inputs, NOT on `resolutions`: the re-read produces a new map, and keying on it would loop.\n useEffect(() => {\n if (!consultedProbe) return undefined;\n const frame = requestAnimationFrame(() => setDocumentEpoch((epoch) => epoch + 1));\n return () => cancelAnimationFrame(frame);\n }, [getTokenValue, isDark, designTheme.id]);\n\n return resolutions;\n}\n"]}