@zyncat/ui 0.17.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/README.md +6 -6
  2. package/dist/alert.js +6 -6
  3. package/dist/button.css +20 -10
  4. package/dist/button.js +2 -1
  5. package/dist/{chunk-5W5TKANX.js → chunk-2DNKZ57E.js} +3 -3
  6. package/dist/{chunk-5W5TKANX.js.map → chunk-2DNKZ57E.js.map} +1 -1
  7. package/dist/{chunk-ZHMOH62S.js → chunk-6H3IJ752.js} +22 -7
  8. package/dist/chunk-6H3IJ752.js.map +1 -0
  9. package/dist/{chunk-WC45VSST.js → chunk-AIAPXRCI.js} +19 -18
  10. package/dist/chunk-AIAPXRCI.js.map +1 -0
  11. package/dist/{chunk-3MLUH2QL.js → chunk-BRKGYLEQ.js} +12 -9
  12. package/dist/chunk-BRKGYLEQ.js.map +1 -0
  13. package/dist/{chunk-RY35IU3G.js → chunk-C3D32LE3.js} +6 -5
  14. package/dist/chunk-C3D32LE3.js.map +1 -0
  15. package/dist/{chunk-GZ6UMHCK.js → chunk-F2TB3TT6.js} +4 -4
  16. package/dist/{chunk-GZ6UMHCK.js.map → chunk-F2TB3TT6.js.map} +1 -1
  17. package/dist/{chunk-4PQDVK23.js → chunk-F64Z42PJ.js} +6 -6
  18. package/dist/{chunk-4PQDVK23.js.map → chunk-F64Z42PJ.js.map} +1 -1
  19. package/dist/{chunk-EOWWVFBF.js → chunk-HBWRKEW4.js} +3 -3
  20. package/dist/{chunk-EOWWVFBF.js.map → chunk-HBWRKEW4.js.map} +1 -1
  21. package/dist/{chunk-M2A6PZ7J.js → chunk-JINATP4N.js} +13 -13
  22. package/dist/chunk-JINATP4N.js.map +1 -0
  23. package/dist/{chunk-7VTWJL72.js → chunk-M2KGLH2G.js} +8 -8
  24. package/dist/{chunk-7VTWJL72.js.map → chunk-M2KGLH2G.js.map} +1 -1
  25. package/dist/{chunk-DH7DT6EO.js → chunk-N43NDSME.js} +3 -3
  26. package/dist/{chunk-DH7DT6EO.js.map → chunk-N43NDSME.js.map} +1 -1
  27. package/dist/{chunk-7ZSIUUC3.js → chunk-PXQBJMPJ.js} +4 -4
  28. package/dist/{chunk-7ZSIUUC3.js.map → chunk-PXQBJMPJ.js.map} +1 -1
  29. package/dist/{chunk-FLDIRXFU.js → chunk-RJENXXTI.js} +5 -5
  30. package/dist/{chunk-FLDIRXFU.js.map → chunk-RJENXXTI.js.map} +1 -1
  31. package/dist/chunk-RLNCRDAL.js +89 -0
  32. package/dist/chunk-RLNCRDAL.js.map +1 -0
  33. package/dist/{chunk-WZUTBJC4.js → chunk-TDHLZY6I.js} +23 -5
  34. package/dist/chunk-TDHLZY6I.js.map +1 -0
  35. package/dist/chunk-TP2AC5MQ.js +13 -0
  36. package/dist/chunk-TP2AC5MQ.js.map +1 -0
  37. package/dist/{chunk-WQKWPI6V.js → chunk-TRPAKUIB.js} +6 -6
  38. package/dist/{chunk-WQKWPI6V.js.map → chunk-TRPAKUIB.js.map} +1 -1
  39. package/dist/{chunk-GWCBTD63.js → chunk-V6QAAOA5.js} +3 -3
  40. package/dist/{chunk-GWCBTD63.js.map → chunk-V6QAAOA5.js.map} +1 -1
  41. package/dist/{chunk-6IXLW7QA.js → chunk-VJXP256V.js} +10 -10
  42. package/dist/chunk-VJXP256V.js.map +1 -0
  43. package/dist/{chunk-IUQAUBVM.js → chunk-VQFILXQN.js} +5 -5
  44. package/dist/chunk-VQFILXQN.js.map +1 -0
  45. package/dist/{chunk-HWDIVGME.js → chunk-XKDR22VE.js} +3 -3
  46. package/dist/{chunk-HWDIVGME.js.map → chunk-XKDR22VE.js.map} +1 -1
  47. package/dist/cli.js +3 -2
  48. package/dist/confetti.js +2 -2
  49. package/dist/date-field.js +15 -15
  50. package/dist/date-range-field.js +16 -16
  51. package/dist/datetime-field.js +15 -15
  52. package/dist/dialog.js +10 -10
  53. package/dist/dialog.js.map +1 -1
  54. package/dist/dropdown.js +14 -14
  55. package/dist/dropdown.js.map +1 -1
  56. package/dist/emoji-picker.js +37 -22
  57. package/dist/emoji-picker.js.map +1 -1
  58. package/dist/flow-field.js +2 -2
  59. package/dist/glide.js +3 -3
  60. package/dist/instagram-feed.js +2 -2
  61. package/dist/lens.js +2 -2
  62. package/dist/modal.js +10 -10
  63. package/dist/modal.js.map +1 -1
  64. package/dist/morphing-text.js +2 -2
  65. package/dist/motion-devtools.js +3 -3
  66. package/dist/motion-tokens.js +1 -1
  67. package/dist/multi-select.js +10 -10
  68. package/dist/odometer.js +2 -2
  69. package/dist/pagination.js +3 -3
  70. package/dist/popover.js +10 -10
  71. package/dist/radio-group.js +5 -5
  72. package/dist/select.js +10 -10
  73. package/dist/sheet.js +9 -9
  74. package/dist/status-badge.js +2 -2
  75. package/dist/support-rail.js +9 -9
  76. package/dist/table.js +5 -5
  77. package/dist/tabs.js +17 -11
  78. package/dist/tabs.js.map +1 -1
  79. package/dist/tag.js +6 -6
  80. package/dist/theme-grid.js +6 -6
  81. package/dist/theme-switcher.js +14 -14
  82. package/dist/{theme-transition-LLC644ZR.js → theme-transition-VGLPZDJI.js} +4 -4
  83. package/dist/{theme-transition-LLC644ZR.js.map → theme-transition-VGLPZDJI.js.map} +1 -1
  84. package/dist/theme.js +3 -3
  85. package/dist/theme.js.map +1 -1
  86. package/dist/tiktok.js +2 -2
  87. package/dist/toast.js +8 -8
  88. package/dist/tooltip.js +25 -22
  89. package/dist/tooltip.js.map +1 -1
  90. package/dist/types/components/internal/hooks/use-press-feedback.d.ts +7 -0
  91. package/dist/types/components/internal/overlay/layer.d.ts +7 -1
  92. package/dist/types/components/internal/utils/token-px.d.ts +1 -1
  93. package/dist/types/motion/motion-timing.d.ts +1 -1
  94. package/dist/types/tokens/motion-tokens.d.ts +5 -3
  95. package/dist/types/tokens/theme-tokens.generated.d.ts +6 -8
  96. package/dist/typing-lines.js +2 -2
  97. package/dist/typing-lines.js.map +1 -1
  98. package/dist/youtube.js +2 -2
  99. package/package.json +1 -1
  100. package/skills/zyncat-ui/SKILL.md +1 -1
  101. package/skills/zyncat-ui/references/components.md +1 -1
  102. package/skills/zyncat-ui/references/theming.md +31 -23
  103. package/src/components/composites/dialog/Dialog.tsx +2 -2
  104. package/src/components/composites/dropdown/Dropdown.tsx +5 -5
  105. package/src/components/composites/emoji-picker/react/category-bar.tsx +17 -5
  106. package/src/components/composites/emoji-picker/scaffold.ts +6 -5
  107. package/src/components/composites/modal/Modal.tsx +2 -2
  108. package/src/components/composites/popover/Popover.tsx +5 -5
  109. package/src/components/composites/select/core/menu.tsx +15 -10
  110. package/src/components/composites/sheet/Sheet.tsx +2 -2
  111. package/src/components/composites/tabs/Tabs.tsx +13 -7
  112. package/src/components/composites/tooltip/tooltip-host.tsx +19 -17
  113. package/src/components/expressive/typing-lines/TypingLines.tsx +0 -0
  114. package/src/components/internal/hooks/use-press-feedback.ts +52 -0
  115. package/src/components/internal/overlay/layer.tsx +35 -2
  116. package/src/components/internal/overlay/position.ts +2 -2
  117. package/src/components/internal/utils/token-px.ts +4 -4
  118. package/src/components/primitives/button/Button.tsx +18 -3
  119. package/src/components/primitives/button/button.css +20 -10
  120. package/src/motion/glide.tsx +9 -6
  121. package/src/motion/motion-timing.ts +5 -2
  122. package/src/styles.css +0 -1
  123. package/src/tokens/base.css +14 -0
  124. package/src/tokens/decisions.css +4 -4
  125. package/src/tokens/motion-tokens.ts +26 -7
  126. package/src/tokens/reset.css +168 -0
  127. package/src/tokens/semantic.css +3 -5
  128. package/src/tokens/theme-tokens.generated.ts +6 -8
  129. package/tailwind.css +1 -1
  130. package/dist/chunk-3MLUH2QL.js.map +0 -1
  131. package/dist/chunk-6IXLW7QA.js.map +0 -1
  132. package/dist/chunk-IUQAUBVM.js.map +0 -1
  133. package/dist/chunk-LH2UIEKN.js +0 -42
  134. package/dist/chunk-LH2UIEKN.js.map +0 -1
  135. package/dist/chunk-M2A6PZ7J.js.map +0 -1
  136. package/dist/chunk-RY35IU3G.js.map +0 -1
  137. package/dist/chunk-UE63OOVG.js +0 -13
  138. package/dist/chunk-UE63OOVG.js.map +0 -1
  139. package/dist/chunk-WC45VSST.js.map +0 -1
  140. package/dist/chunk-WZUTBJC4.js.map +0 -1
  141. package/dist/chunk-ZHMOH62S.js.map +0 -1
  142. package/src/tokens/fonts.css +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/composites/tooltip/tooltip-store.ts","../src/components/composites/tooltip/tooltip-host.tsx","../src/components/composites/tooltip/Tooltip.tsx"],"names":["useRef","jsxs","Fragment","jsx"],"mappings":";;;;;;;;;;;;;;;;;AAkBO,IAAM,UAAA,GAAa,GAAA;AACnB,IAAM,WAAA,GAAc,GAAA;AACpB,IAAM,cAAA,GAAiB,aAAA;AAC9B,IAAM,WAAA,GAAc,GAAA;AAEb,IAAM,KAAA,GAAQ,UAAA,CAAW,iBAAA,EAAmB,OAAO;AAAA,EACxD,OAAO,EAAC;AAAA,EACR,SAAA,EAAW,IAAA;AAAA,EACX,MAAA,sBAAY,GAAA,EAA2C;AAAA,EACvD,SAAA,EAAW,CAAA;AAAA,EACX,SAAA,sBAAe,GAAA,EAAgB;AAAA,EAC/B,GAAA,EAAK,MAA4B,KAAA,CAAM,KAAA,CAAM,MAAM,KAAA,CAAM,MAAA,GAAS,CAAC,CAAA,IAAK,IAAA;AAAA,EACxE,UAAU,CAAA,EAAe;AACvB,IAAA,KAAA,CAAM,SAAA,CAAU,IAAI,CAAC,CAAA;AACrB,IAAA,OAAO,MAAM,KAAA,CAAM,SAAA,CAAU,MAAA,CAAO,CAAC,CAAA;AAAA,EACvC,CAAA;AAAA,EACA,IAAA,GAAO;AACL,IAAA,MAAM,EAAA,GAAK,KAAA,CAAM,GAAA,EAAI,EAAG,QAAO,IAAK,IAAA;AACpC,IAAA,IAAI,EAAA,KAAO,MAAM,SAAA,EAAW;AAC1B,MAAA,KAAA,CAAM,SAAA,EAAW,gBAAgB,kBAAkB,CAAA;AACnD,MAAA,KAAA,CAAM,SAA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,GAAO;AACd,IAAA,YAAA,CAAa,UAAU,OAAO,CAAA;AAC9B,IAAA,OAAA,CAAQ,KAAK,CAAA;AAAA,EACf;AAEA,EAAA,MAAM,OAAA,GAAU,CAAC,CAAA,KAAoB;AACnC,IAAA,IAAI,CAAA,CAAE,WAAA,KAAgB,OAAA,EAAS,IAAA,CAAK,KAAK,CAAA;AAAA,EAC3C,CAAA;AACA,EAAA,MAAM,SAAA,GAAY,CAAC,CAAA,KAAkB;AACnC,IAAA,IAAK,EAAE,MAAA,CAAuB,OAAA,CAAQ,gBAAgB,CAAA,OAAQ,IAAI,CAAA;AAAA,EACpE,CAAA;AAEA,EAAA,uBACEC,IAAAA,CAACC,QAAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAAC,GAAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACE,GAAG,SAAA;AAAA,QACJ,GAAA,EAAK,OAAA;AAAA,QACL,SAAA,EAAW,EAAA,CAAG,mBAAA,EAAqB,SAAA,EAAW,SAAS,CAAA;AAAA,QACvD,cAAA,EAAgB,OAAA;AAAA,QAChB,cAAA,EAAgB,IAAA;AAAA,QAChB,aAAA,EAAe,IAAA;AAAA,QACf,OAAA,EAAS,SAAA;AAAA,QACT,MAAA,EAAQ,IAAA;AAAA,QAEP;AAAA;AAAA,KACH;AAAA,IACC,MAAA,oBAAUA,GAAAA,CAAC,WAAA,EAAA,EAAY;AAAA,GAAA,EAC1B,CAAA;AAEJ","file":"tooltip.js","sourcesContent":["'use client';\n\nimport { type ReactNode } from 'react';\n\nimport { sharedSlot } from '../../../shared-slot';\nimport { hostRegistry, useElectedHost } from '../../internal/hooks/use-host-election';\n\nexport type Placement = 'top' | 'bottom' | 'left' | 'right';\n\nexport interface ActivePayload {\n id: string;\n content: ReactNode;\n shortcut?: string | null;\n placement: Placement;\n anchor: () => HTMLElement | null;\n dismiss: () => void;\n}\n\nexport const OPEN_DELAY = 350;\nexport const CLOSE_GRACE = 140;\nexport const TOOLTIP_DOM_ID = 'pds-tooltip';\nconst WARM_WINDOW = 300;\n\nexport const store = sharedSlot('tooltip.store@1', () => ({\n stack: [] as ActivePayload[],\n described: null as HTMLElement | null,\n timers: new Map<string, ReturnType<typeof setTimeout>>(),\n warmUntil: 0,\n listeners: new Set<() => void>(),\n get: (): ActivePayload | null => store.stack[store.stack.length - 1] ?? null,\n subscribe(l: () => void) {\n store.listeners.add(l);\n return () => store.listeners.delete(l);\n },\n emit() {\n const el = store.get()?.anchor() ?? null;\n if (el !== store.described) {\n store.described?.removeAttribute('aria-describedby');\n store.described = el;\n el?.setAttribute('aria-describedby', TOOLTIP_DOM_ID);\n }\n store.listeners.forEach((l) => l());\n },\n isWarm: () => store.stack.length > 0 || performance.now() < store.warmUntil,\n open(payload: ActivePayload) {\n clearTimeout(store.timers.get(payload.id));\n const at = store.stack.findIndex((entry) => entry.id === payload.id);\n if (at < 0) store.stack.push(payload);\n else store.stack[at] = payload;\n store.emit();\n },\n close(id: string, grace = CLOSE_GRACE) {\n clearTimeout(store.timers.get(id));\n const drop = () => {\n store.timers.delete(id);\n const at = store.stack.findIndex((entry) => entry.id === id);\n if (at < 0) return;\n store.stack.splice(at, 1);\n if (!store.stack.length) store.warmUntil = performance.now() + WARM_WINDOW;\n store.emit();\n };\n if (grace > 0) store.timers.set(id, setTimeout(drop, grace));\n else drop();\n },\n dismiss() {\n for (const entry of store.stack.slice()) entry.dismiss();\n },\n}));\n\nconst hostReg = hostRegistry('tooltip.host@1');\n\nexport function useHostElection(): boolean {\n return useElectedHost(hostReg, 'tip-host');\n}\n","'use client';\n\nimport { Fragment, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { Motion } from '../../../motion/element';\nimport { Presence } from '../../../motion/presence';\nimport { popIn, popOut } from '../../../motion/presets';\nimport { UIMotion } from '../../../tokens/motion-tokens';\nimport { tokenPx } from '../../internal/utils/token-px';\nimport { store, TOOLTIP_DOM_ID, type ActivePayload, type Placement } from './tooltip-store';\n\nconst SM = UIMotion;\nconst TIP_LAYOUT = { size: 'morph' as const, timing: UIMotion.t.layout };\n\ninterface Size {\n w: number;\n h: number;\n}\ninterface TargetBox extends Size {\n x: number;\n y: number;\n placement: Placement;\n}\ninterface RenderedBox extends TargetBox {\n bodyW: number;\n}\n\nfunction targetBox(size: Size, t: DOMRect, want: Placement): TargetBox {\n const vw = window.innerWidth,\n vh = window.innerHeight,\n TIP_GAP = tokenPx('--space-2', 8) || 8,\n M = TIP_GAP;\n let p = want;\n if (p === 'top' && t.top - size.h - TIP_GAP < M) p = 'bottom';\n else if (p === 'bottom' && t.bottom + size.h + TIP_GAP > vh - M) p = 'top';\n else if (p === 'left' && t.left - size.w - TIP_GAP < M) p = 'right';\n else if (p === 'right' && t.right + size.w + TIP_GAP > vw - M) p = 'left';\n let x, y;\n if (p === 'top') {\n x = t.left + t.width / 2 - size.w / 2;\n y = t.top - size.h - TIP_GAP;\n } else if (p === 'bottom') {\n x = t.left + t.width / 2 - size.w / 2;\n y = t.bottom + TIP_GAP;\n } else if (p === 'left') {\n x = t.left - size.w - TIP_GAP;\n y = t.top + t.height / 2 - size.h / 2;\n } else {\n x = t.right + TIP_GAP;\n y = t.top + t.height / 2 - size.h / 2;\n }\n return {\n x: Math.round(Math.min(Math.max(x, M), vw - size.w - M)),\n y: Math.round(Math.min(Math.max(y, M), vh - size.h - M)),\n w: size.w,\n h: size.h,\n placement: p,\n };\n}\n\nconst surface = () => document.getElementById(TOOLTIP_DOM_ID);\n\nconst fromEdge = (p: Placement) => ({\n x: p === 'left' ? SM.dist.sm : p === 'right' ? -SM.dist.sm : 0,\n y: p === 'top' ? SM.dist.sm : p === 'bottom' ? -SM.dist.sm : 0,\n});\n\nfunction Body({ a, width }: { a: ActivePayload; width?: number }) {\n return (\n <span className=\"zc-tooltip__body\" style={width ? { width } : undefined}>\n {a.shortcut ? (\n <span className=\"zc-tooltip__row\">\n <span>{a.content}</span>\n <kbd className=\"zc-tooltip__shortcut\">{a.shortcut}</kbd>\n </span>\n ) : (\n a.content\n )}\n </span>\n );\n}\n\nfunction TipSurface({ a, box }: { a: ActivePayload; box: RenderedBox }) {\n const edge = fromEdge(box.placement);\n return (\n <Motion\n layout\n layoutTransition={TIP_LAYOUT}\n className=\"zc-tooltip\"\n id={TOOLTIP_DOM_ID}\n role=\"tooltip\"\n data-placement={box.placement}\n style={{ translate: `${box.x}px ${box.y}px`, width: box.w, height: box.h }}\n animate={[\n { x: [edge.x, 0], y: [edge.y, 0], timing: { ...SM.t.layout, fill: 'none' }, composite: 'add' },\n popIn(SM.scale.floating, SM.t.enter),\n ]}\n exit={[\n { x: [0, edge.x], y: [0, edge.y], timing: SM.t.exit, composite: 'add' },\n popOut(SM.scale.floating, SM.t.exit),\n ]}\n >\n <Motion as=\"span\" key={a.id} animate={{ opacity: [0, 1], timing: SM.t.enter }}>\n <Body a={a} width={box.bodyW} />\n </Motion>\n </Motion>\n );\n}\n\nexport function TooltipHost() {\n const active = useSyncExternalStore(store.subscribe, store.get);\n const measureRef = useRef<HTMLDivElement>(null);\n const drift = useRef({ x: 0, y: 0 });\n const anchored = useRef({ x: 0, y: 0 });\n const [shown, setShown] = useState<{ a: ActivePayload; box: RenderedBox } | null>(null);\n\n useLayoutEffect(() => {\n if (!active) {\n setShown(null);\n return undefined;\n }\n\n const place = () => {\n const anchor = active.anchor();\n const measure = measureRef.current;\n if (!anchor || !measure) return;\n const bubble = measure.getBoundingClientRect();\n const body = (measure.firstChild as HTMLElement).getBoundingClientRect();\n const from = anchor.getBoundingClientRect();\n if (!from.width && !from.height) return;\n if (!surface()) drift.current = { x: 0, y: 0 };\n anchored.current = { x: from.left, y: from.top };\n const to = targetBox({ w: Math.ceil(bubble.width), h: Math.ceil(bubble.height) }, from, active.placement);\n setShown({\n a: active,\n box: { ...to, x: to.x - drift.current.x, y: to.y - drift.current.y, bodyW: Math.ceil(body.width) },\n });\n };\n\n const track = () => {\n const el = surface();\n const anchor = active.anchor();\n if (!el || !anchor) return;\n const now = anchor.getBoundingClientRect();\n if (!now.width && !now.height) return;\n const at = {\n x: drift.current.x + now.left - anchored.current.x,\n y: drift.current.y + now.top - anchored.current.y,\n };\n drift.current = at;\n anchored.current = { x: now.left, y: now.top };\n el.style.transform = at.x || at.y ? `translate(${at.x}px, ${at.y}px)` : '';\n };\n\n const onKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape') store.dismiss();\n };\n\n place();\n document.addEventListener('keydown', onKey);\n window.addEventListener('scroll', track, true);\n window.addEventListener('resize', place);\n return () => {\n document.removeEventListener('keydown', onKey);\n window.removeEventListener('scroll', track, true);\n window.removeEventListener('resize', place);\n };\n }, [active]);\n\n const orphaned = !!shown && !shown.a.anchor();\n\n return createPortal(\n <Fragment>\n {active && (\n <div className=\"zc-tooltip zc-tooltip--measure\" ref={measureRef} aria-hidden=\"true\">\n <Body a={active} />\n </div>\n )}\n <Presence>{active && shown && !orphaned && <TipSurface key=\"tip\" a={shown.a} box={shown.box} />}</Presence>\n </Fragment>,\n document.body,\n );\n}\n","'use client';\n\nimport './tooltip.css';\n\nimport {\n Fragment,\n useEffect,\n useId,\n useRef,\n type FocusEvent,\n type HTMLAttributes,\n type PointerEvent,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\nimport type { DataAttributes } from '../../../dom-props';\nimport { usePresence } from '../../../motion/presence-context';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { cx } from '../../internal/utils/cx';\nimport { TooltipHost } from './tooltip-host';\nimport { CLOSE_GRACE, OPEN_DELAY, store, useHostElection, type Placement } from './tooltip-store';\n\nexport interface TooltipProps {\n /** The hint - a string or small node; never interactive content. */\n content: ReactNode;\n /** Optional keyboard hint, rendered as mono metadata (\"⌘↩\", \"S\"). */\n shortcut?: string | null;\n /** Preferred side; flips automatically when out of viewport room. */\n placement?: Placement;\n /** Controlled visibility - shows with no hover or focus, and stays until you clear it.\n * Omit to stay uncontrolled. One bubble shows at a time: the newest wins, and the ones\n * under it come back when it leaves. */\n open?: boolean;\n /** Initial state when uncontrolled. Default false. */\n defaultOpen?: boolean;\n /** Fires whenever hover, focus, or Escape asks for a new state. Pair with `open` for controlled use. */\n onOpenChange?: (open: boolean) => void;\n /** Suppress the tooltip entirely (trigger renders untouched). */\n disabled?: boolean;\n /** ms before a cold hover shows; warm hovers + focus are instant. Default 350. */\n openDelay?: number;\n /** ms the bubble lingers after leaving (bridges moving to a neighbour). Default 140. */\n closeDelay?: number;\n /** Stable id for this trigger's store entry - lets overlapping triggers race safely under\n * the one shared tooltip host. Not rendered to the DOM. Auto-generated when omitted. */\n id?: string;\n /** Exactly one element. */\n children: ReactElement;\n /** Standard <span> attributes forwarded to the anchor wrapper. */\n htmlProps?: HTMLAttributes<HTMLSpanElement> & DataAttributes;\n}\n\nexport function Tooltip({\n content,\n shortcut = null,\n placement = 'top',\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n disabled = false,\n openDelay = OPEN_DELAY,\n closeDelay = CLOSE_GRACE,\n id,\n children,\n htmlProps,\n}: TooltipProps) {\n const wrapRef = useRef<HTMLSpanElement | null>(null);\n const openTimer = useRef<ReturnType<typeof setTimeout> | 0>(0);\n const autoId = useId();\n const myId = id || 'tip-' + autoId;\n const isHost = useHostElection();\n const { isPresent } = usePresence();\n const [open, setOpen] = useControllable(controlledOpen, defaultOpen, onOpenChange);\n\n useEffect(() => {\n if (!open || disabled || !isPresent) return undefined;\n store.open({\n id: myId,\n content,\n shortcut,\n placement,\n anchor: () => (wrapRef.current?.firstElementChild as HTMLElement) ?? null,\n dismiss: () => setOpen(false),\n });\n return () => store.close(myId, closeDelay);\n }, [open, disabled, isPresent, content, shortcut, placement, closeDelay, myId, setOpen]);\n\n useEffect(() => {\n if (!isPresent) store.close(myId, 0);\n }, [isPresent, myId]);\n\n useEffect(\n () => () => {\n clearTimeout(openTimer.current);\n store.close(myId, 0);\n },\n [myId],\n );\n\n function show(immediate: boolean) {\n clearTimeout(openTimer.current);\n if (disabled || !wrapRef.current?.firstElementChild) return;\n if (immediate || store.isWarm()) setOpen(true);\n else openTimer.current = setTimeout(() => setOpen(true), openDelay);\n }\n function hide() {\n clearTimeout(openTimer.current);\n setOpen(false);\n }\n\n const onEnter = (e: PointerEvent) => {\n if (e.pointerType !== 'touch') show(false);\n };\n const onFocusIn = (e: FocusEvent) => {\n if ((e.target as HTMLElement).matches(':focus-visible')) show(true);\n };\n\n return (\n <Fragment>\n <span\n {...htmlProps}\n ref={wrapRef}\n className={cx('zc-tooltip-anchor', htmlProps?.className)}\n onPointerEnter={onEnter}\n onPointerLeave={hide}\n onPointerDown={hide}\n onFocus={onFocusIn}\n onBlur={hide}\n >\n {children}\n </span>\n {isHost && <TooltipHost />}\n </Fragment>\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/components/composites/tooltip/tooltip-store.ts","../src/components/composites/tooltip/tooltip-host.tsx","../src/components/composites/tooltip/Tooltip.tsx"],"names":["useRef","jsxs","Fragment","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBO,IAAM,UAAA,GAAa,GAAA;AACnB,IAAM,WAAA,GAAc,GAAA;AACpB,IAAM,cAAA,GAAiB,aAAA;AAC9B,IAAM,WAAA,GAAc,GAAA;AAEb,IAAM,KAAA,GAAQ,UAAA,CAAW,iBAAA,EAAmB,OAAO;AAAA,EACxD,OAAO,EAAC;AAAA,EACR,SAAA,EAAW,IAAA;AAAA,EACX,MAAA,sBAAY,GAAA,EAA2C;AAAA,EACvD,SAAA,EAAW,CAAA;AAAA,EACX,SAAA,sBAAe,GAAA,EAAgB;AAAA,EAC/B,GAAA,EAAK,MAA4B,KAAA,CAAM,KAAA,CAAM,MAAM,KAAA,CAAM,MAAA,GAAS,CAAC,CAAA,IAAK,IAAA;AAAA,EACxE,UAAU,CAAA,EAAe;AACvB,IAAA,KAAA,CAAM,SAAA,CAAU,IAAI,CAAC,CAAA;AACrB,IAAA,OAAO,MAAM,KAAA,CAAM,SAAA,CAAU,MAAA,CAAO,CAAC,CAAA;AAAA,EACv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AAA;AAAA,QACT,MAAA,EAAQ,IAAA;AAAA,QAEP;AAAA;AAAA,KACH;AAAA,IACC,MAAA,oBAAUA,GAAAA,CAAC,WAAA,EAAA,EAAY;AAAA,GAAA,EAC1B,CAAA;AAEJ","file":"tooltip.js","sourcesContent":["'use client';\n\nimport { type ReactNode } from 'react';\n\nimport { sharedSlot } from '../../../shared-slot';\nimport { hostRegistry, useElectedHost } from '../../internal/hooks/use-host-election';\n\nexport type Placement = 'top' | 'bottom' | 'left' | 'right';\n\nexport interface ActivePayload {\n id: string;\n content: ReactNode;\n shortcut?: string | null;\n placement: Placement;\n anchor: () => HTMLElement | null;\n dismiss: () => void;\n}\n\nexport const OPEN_DELAY = 350;\nexport const CLOSE_GRACE = 140;\nexport const TOOLTIP_DOM_ID = 'pds-tooltip';\nconst WARM_WINDOW = 300;\n\nexport const store = sharedSlot('tooltip.store@1', () => ({\n stack: [] as ActivePayload[],\n described: null as HTMLElement | null,\n timers: new Map<string, ReturnType<typeof setTimeout>>(),\n warmUntil: 0,\n listeners: new Set<() => void>(),\n get: (): ActivePayload | null => store.stack[store.stack.length - 1] ?? null,\n subscribe(l: () => void) {\n store.listeners.add(l);\n return () => store.listeners.delete(l);\n },\n emit() {\n const el = store.get()?.anchor() ?? null;\n if (el !== store.described) {\n store.described?.removeAttribute('aria-describedby');\n store.described = el;\n el?.setAttribute('aria-describedby', TOOLTIP_DOM_ID);\n }\n store.listeners.forEach((l) => l());\n },\n isWarm: () => store.stack.length > 0 || performance.now() < store.warmUntil,\n open(payload: ActivePayload) {\n clearTimeout(store.timers.get(payload.id));\n const at = store.stack.findIndex((entry) => entry.id === payload.id);\n if (at < 0) store.stack.push(payload);\n else store.stack[at] = payload;\n store.emit();\n },\n close(id: string, grace = CLOSE_GRACE) {\n clearTimeout(store.timers.get(id));\n const drop = () => {\n store.timers.delete(id);\n const at = store.stack.findIndex((entry) => entry.id === id);\n if (at < 0) return;\n store.stack.splice(at, 1);\n if (!store.stack.length) store.warmUntil = performance.now() + WARM_WINDOW;\n store.emit();\n };\n if (grace > 0) store.timers.set(id, setTimeout(drop, grace));\n else drop();\n },\n dismiss() {\n for (const entry of store.stack.slice()) entry.dismiss();\n },\n}));\n\nconst hostReg = hostRegistry('tooltip.host@1');\n\nexport function useHostElection(): boolean {\n return useElectedHost(hostReg, 'tip-host');\n}\n","'use client';\n\nimport { Fragment, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { Motion } from '../../../motion/element';\nimport { Presence } from '../../../motion/presence';\nimport { popIn, popOut } from '../../../motion/presets';\nimport { motionFor } from '../../../tokens/motion-tokens';\nimport { inheritedThemeAttrs } from '../../internal/overlay/layer';\nimport { tokenPx } from '../../internal/utils/token-px';\nimport { store, TOOLTIP_DOM_ID, type ActivePayload, type Placement } from './tooltip-store';\n\nconst tipLayout = (scope?: Element | null) => ({ size: 'morph' as const, timing: motionFor(scope).t.layout });\n\ninterface Size {\n w: number;\n h: number;\n}\ninterface TargetBox extends Size {\n x: number;\n y: number;\n placement: Placement;\n}\ninterface RenderedBox extends TargetBox {\n bodyW: number;\n}\n\nfunction targetBox(size: Size, t: DOMRect, want: Placement, scope?: Element | null): TargetBox {\n const vw = window.innerWidth,\n vh = window.innerHeight,\n TIP_GAP = tokenPx('--space-2', 8, scope) || 8,\n M = TIP_GAP;\n let p = want;\n if (p === 'top' && t.top - size.h - TIP_GAP < M) p = 'bottom';\n else if (p === 'bottom' && t.bottom + size.h + TIP_GAP > vh - M) p = 'top';\n else if (p === 'left' && t.left - size.w - TIP_GAP < M) p = 'right';\n else if (p === 'right' && t.right + size.w + TIP_GAP > vw - M) p = 'left';\n let x, y;\n if (p === 'top') {\n x = t.left + t.width / 2 - size.w / 2;\n y = t.top - size.h - TIP_GAP;\n } else if (p === 'bottom') {\n x = t.left + t.width / 2 - size.w / 2;\n y = t.bottom + TIP_GAP;\n } else if (p === 'left') {\n x = t.left - size.w - TIP_GAP;\n y = t.top + t.height / 2 - size.h / 2;\n } else {\n x = t.right + TIP_GAP;\n y = t.top + t.height / 2 - size.h / 2;\n }\n return {\n x: Math.round(Math.min(Math.max(x, M), vw - size.w - M)),\n y: Math.round(Math.min(Math.max(y, M), vh - size.h - M)),\n w: size.w,\n h: size.h,\n placement: p,\n };\n}\n\nconst surface = () => document.getElementById(TOOLTIP_DOM_ID);\n\nconst fromEdge = (p: Placement, scope?: Element | null) => {\n const { sm } = motionFor(scope).dist;\n return { x: p === 'left' ? sm : p === 'right' ? -sm : 0, y: p === 'top' ? sm : p === 'bottom' ? -sm : 0 };\n};\n\nfunction Body({ a, width }: { a: ActivePayload; width?: number }) {\n return (\n <span className=\"zc-tooltip__body\" style={width ? { width } : undefined}>\n {a.shortcut ? (\n <span className=\"zc-tooltip__row\">\n <span>{a.content}</span>\n <kbd className=\"zc-tooltip__shortcut\">{a.shortcut}</kbd>\n </span>\n ) : (\n a.content\n )}\n </span>\n );\n}\n\nfunction TipSurface({ a, box }: { a: ActivePayload; box: RenderedBox }) {\n const motion = motionFor(a.anchor());\n const edge = fromEdge(box.placement, a.anchor());\n return (\n <Motion\n layout\n layoutTransition={tipLayout(a.anchor())}\n className=\"zc-tooltip\"\n {...inheritedThemeAttrs(a.anchor())}\n id={TOOLTIP_DOM_ID}\n role=\"tooltip\"\n data-placement={box.placement}\n style={{ translate: `${box.x}px ${box.y}px`, width: box.w, height: box.h }}\n animate={[\n { x: [edge.x, 0], y: [edge.y, 0], timing: { ...motion.t.layout, fill: 'none' }, composite: 'add' },\n popIn(motion.scale.floating, motion.t.enter),\n ]}\n exit={[\n { x: [0, edge.x], y: [0, edge.y], timing: motion.t.exit, composite: 'add' },\n popOut(motion.scale.floating, motion.t.exit),\n ]}\n >\n <Motion as=\"span\" key={a.id} animate={{ opacity: [0, 1], timing: motion.t.enter }}>\n <Body a={a} width={box.bodyW} />\n </Motion>\n </Motion>\n );\n}\n\nexport function TooltipHost() {\n const active = useSyncExternalStore(store.subscribe, store.get);\n const measureRef = useRef<HTMLDivElement>(null);\n const drift = useRef({ x: 0, y: 0 });\n const anchored = useRef({ x: 0, y: 0 });\n const [shown, setShown] = useState<{ a: ActivePayload; box: RenderedBox } | null>(null);\n\n useLayoutEffect(() => {\n if (!active) {\n setShown(null);\n return undefined;\n }\n\n const place = () => {\n const anchor = active.anchor();\n const measure = measureRef.current;\n if (!anchor || !measure) return;\n const bubble = measure.getBoundingClientRect();\n const body = (measure.firstChild as HTMLElement).getBoundingClientRect();\n const from = anchor.getBoundingClientRect();\n if (!from.width && !from.height) return;\n if (!surface()) drift.current = { x: 0, y: 0 };\n anchored.current = { x: from.left, y: from.top };\n const to = targetBox({ w: Math.ceil(bubble.width), h: Math.ceil(bubble.height) }, from, active.placement, anchor);\n setShown({\n a: active,\n box: { ...to, x: to.x - drift.current.x, y: to.y - drift.current.y, bodyW: Math.ceil(body.width) },\n });\n };\n\n const track = () => {\n const el = surface();\n const anchor = active.anchor();\n if (!el || !anchor) return;\n const now = anchor.getBoundingClientRect();\n if (!now.width && !now.height) return;\n const at = {\n x: drift.current.x + now.left - anchored.current.x,\n y: drift.current.y + now.top - anchored.current.y,\n };\n drift.current = at;\n anchored.current = { x: now.left, y: now.top };\n el.style.transform = at.x || at.y ? `translate(${at.x}px, ${at.y}px)` : '';\n };\n\n const onKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape') store.dismiss();\n };\n\n place();\n document.addEventListener('keydown', onKey);\n window.addEventListener('scroll', track, true);\n window.addEventListener('resize', place);\n return () => {\n document.removeEventListener('keydown', onKey);\n window.removeEventListener('scroll', track, true);\n window.removeEventListener('resize', place);\n };\n }, [active]);\n\n const orphaned = !!shown && !shown.a.anchor();\n\n return createPortal(\n <Fragment>\n {active && (\n <div className=\"zc-tooltip zc-tooltip--measure\" ref={measureRef} aria-hidden=\"true\">\n <Body a={active} />\n </div>\n )}\n <Presence>{active && shown && !orphaned && <TipSurface key=\"tip\" a={shown.a} box={shown.box} />}</Presence>\n </Fragment>,\n document.body,\n );\n}\n","'use client';\n\nimport './tooltip.css';\n\nimport {\n Fragment,\n useEffect,\n useId,\n useRef,\n type FocusEvent,\n type HTMLAttributes,\n type PointerEvent,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\nimport type { DataAttributes } from '../../../dom-props';\nimport { usePresence } from '../../../motion/presence-context';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { cx } from '../../internal/utils/cx';\nimport { TooltipHost } from './tooltip-host';\nimport { CLOSE_GRACE, OPEN_DELAY, store, useHostElection, type Placement } from './tooltip-store';\n\nexport interface TooltipProps {\n /** The hint - a string or small node; never interactive content. */\n content: ReactNode;\n /** Optional keyboard hint, rendered as mono metadata (\"⌘↩\", \"S\"). */\n shortcut?: string | null;\n /** Preferred side; flips automatically when out of viewport room. */\n placement?: Placement;\n /** Controlled visibility - shows with no hover or focus, and stays until you clear it.\n * Omit to stay uncontrolled. One bubble shows at a time: the newest wins, and the ones\n * under it come back when it leaves. */\n open?: boolean;\n /** Initial state when uncontrolled. Default false. */\n defaultOpen?: boolean;\n /** Fires whenever hover, focus, or Escape asks for a new state. Pair with `open` for controlled use. */\n onOpenChange?: (open: boolean) => void;\n /** Suppress the tooltip entirely (trigger renders untouched). */\n disabled?: boolean;\n /** ms before a cold hover shows; warm hovers + focus are instant. Default 350. */\n openDelay?: number;\n /** ms the bubble lingers after leaving (bridges moving to a neighbour). Default 140. */\n closeDelay?: number;\n /** Stable id for this trigger's store entry - lets overlapping triggers race safely under\n * the one shared tooltip host. Not rendered to the DOM. Auto-generated when omitted. */\n id?: string;\n /** Exactly one element. */\n children: ReactElement;\n /** Standard <span> attributes forwarded to the anchor wrapper. */\n htmlProps?: HTMLAttributes<HTMLSpanElement> & DataAttributes;\n}\n\nexport function Tooltip({\n content,\n shortcut = null,\n placement = 'top',\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n disabled = false,\n openDelay = OPEN_DELAY,\n closeDelay = CLOSE_GRACE,\n id,\n children,\n htmlProps,\n}: TooltipProps) {\n const wrapRef = useRef<HTMLSpanElement | null>(null);\n const openTimer = useRef<ReturnType<typeof setTimeout> | 0>(0);\n const autoId = useId();\n const myId = id || 'tip-' + autoId;\n const isHost = useHostElection();\n const { isPresent } = usePresence();\n const [open, setOpen] = useControllable(controlledOpen, defaultOpen, onOpenChange);\n\n useEffect(() => {\n if (!open || disabled || !isPresent) return undefined;\n store.open({\n id: myId,\n content,\n shortcut,\n placement,\n anchor: () => (wrapRef.current?.firstElementChild as HTMLElement) ?? null,\n dismiss: () => setOpen(false),\n });\n return () => store.close(myId, closeDelay);\n }, [open, disabled, isPresent, content, shortcut, placement, closeDelay, myId, setOpen]);\n\n useEffect(() => {\n if (!isPresent) store.close(myId, 0);\n }, [isPresent, myId]);\n\n useEffect(\n () => () => {\n clearTimeout(openTimer.current);\n store.close(myId, 0);\n },\n [myId],\n );\n\n function show(immediate: boolean) {\n clearTimeout(openTimer.current);\n if (disabled || !wrapRef.current?.firstElementChild) return;\n if (immediate || store.isWarm()) setOpen(true);\n else openTimer.current = setTimeout(() => setOpen(true), openDelay);\n }\n function hide() {\n clearTimeout(openTimer.current);\n setOpen(false);\n }\n\n const onEnter = (e: PointerEvent) => {\n if (e.pointerType !== 'touch') show(false);\n };\n const onFocusIn = (e: FocusEvent) => {\n if ((e.target as HTMLElement).matches(':focus-visible')) show(true);\n };\n\n return (\n <Fragment>\n <span\n {...htmlProps}\n ref={wrapRef}\n className={cx('zc-tooltip-anchor', htmlProps?.className)}\n onPointerEnter={onEnter}\n onPointerLeave={hide}\n onPointerDown={hide}\n onFocus={onFocusIn}\n onBlur={hide}\n >\n {children}\n </span>\n {isHost && <TooltipHost />}\n </Fragment>\n );\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import { type PointerEvent } from 'react';
2
+ export interface PressFeedback {
3
+ pressed: boolean;
4
+ onPointerDown: (event: PointerEvent<HTMLElement>) => void;
5
+ onPointerLeave: () => void;
6
+ }
7
+ export declare function usePressFeedback(inert: boolean): PressFeedback;
@@ -30,8 +30,14 @@ declare function ovCloneTrigger(trigger: ReactElement | null, { open, onPress, o
30
30
  triggerRef: RefObject<HTMLElement>;
31
31
  activateOn?: ActivateOn;
32
32
  }): ReactElement | null;
33
- declare function OverlayPortal({ container, children }: {
33
+ export interface InheritedThemeAttrs {
34
+ 'data-theme'?: string;
35
+ 'data-polarity'?: string;
36
+ }
37
+ export declare function inheritedThemeAttrs(scope: Element | null | undefined): InheritedThemeAttrs;
38
+ declare function OverlayPortal({ container, scope, children, }: {
34
39
  container?: HTMLElement | null;
40
+ scope?: Element | null;
35
41
  children: ReactNode;
36
42
  }): import("react").ReactPortal;
37
43
  export { ovIsTop, ovInOverlayAbove, useOverlayEntry, useOutsidePress, ovCloneTrigger, OverlayPortal };
@@ -1 +1 @@
1
- export declare function tokenPx(token: string, fallback?: number): number;
1
+ export declare function tokenPx(token: string, fallback?: number, scope?: Element | null): number;
@@ -13,4 +13,4 @@ export interface MotionTimings {
13
13
  open: MotionTransition;
14
14
  close: MotionTransition;
15
15
  }
16
- export declare function resolveMotionTiming(animation: DisableableAnimation | undefined, defaults: MotionTimingDefaults): MotionTimings;
16
+ export declare function resolveMotionTiming(animation: DisableableAnimation | undefined, defaults: MotionTimingDefaults, scope?: Element | null): MotionTimings;
@@ -26,10 +26,12 @@ export interface MotionTokens {
26
26
  reduced: boolean;
27
27
  }
28
28
  export declare const UIMotion: MotionTokens;
29
+ export declare function motionFor(scope?: Element | null): MotionTokens;
29
30
  /**
30
- * Re-reads the motion tokens into `UIMotion` in place, so every held reference sees the new values. Runs on
31
- * a `data-theme` or `data-polarity` change, a `prefers-reduced-motion` flip and after `ZyncatTheme`
32
- * renders; call it yourself after injecting a stylesheet that retimes the `--duration-*` tokens.
31
+ * Re-reads the motion tokens into `UIMotion` in place and drops every scoped read, so every held
32
+ * reference sees the new values. Runs on a `data-theme` or `data-polarity` change, a
33
+ * `prefers-reduced-motion` flip and after `ZyncatTheme` renders; call it yourself after injecting a
34
+ * stylesheet that retimes the `--duration-*` tokens.
33
35
  */
34
36
  export declare function refreshMotionTokens(): MotionTokens;
35
37
  export default UIMotion;
@@ -27,8 +27,6 @@ export interface ColorBgTokens {
27
27
  }
28
28
  /** Ink, from strong to disabled, and the faces on a fill. */
29
29
  export interface ColorTextTokens {
30
- /** `--text-on-accent` - The ink on a hue fill - the ramp's lightest rung in either polarity. Default: `var(--gray-0)`. */
31
- onAccent?: string | number;
32
30
  /** `--text-strong`. Default: `var(--gray-950)`. Dark: `oklch(from var(--neutral) 0.975 0.003 h)`. */
33
31
  strong?: string | number;
34
32
  /** `--text-body`. Default: `var(--gray-800)`. Dark: `oklch(from var(--neutral) 0.91 0.005 h)`. */
@@ -74,9 +72,9 @@ export interface ColorTokens {
74
72
  }
75
73
  /** The body face and the code face - every type bundle follows. */
76
74
  export interface TypeFontTokens {
77
- /** `--font-body` - The body face - every --type-* bundle follows. Default: `'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif`. */
75
+ /** `--font-body` - The body face - every --type-* bundle follows. The package loads no webfont; point this at yours. Default: `system-ui, -apple-system, 'Segoe UI', sans-serif`. */
78
76
  body?: string | number;
79
- /** `--font-code` - The code face - --type-code follows. Default: `'Geist Mono', ui-monospace, 'SF Mono', 'Menlo', monospace`. */
77
+ /** `--font-code` - The code face - --type-code follows. The package loads no webfont; point this at yours. Default: `ui-monospace, 'SF Mono', 'Menlo', monospace`. */
80
78
  code?: string | number;
81
79
  }
82
80
  /** The faces. */
@@ -395,9 +393,9 @@ export interface TokenProperties {
395
393
  '--neutral'?: string | number;
396
394
  /** `--radius` - Roundness - every --radius-<step> is a fixed ratio of it, 0 squaring every corner. Default: `0.5rem`. */
397
395
  '--radius'?: string | number;
398
- /** `--font-body` - The body face - every --type-* bundle follows. Default: `'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif`. */
396
+ /** `--font-body` - The body face - every --type-* bundle follows. The package loads no webfont; point this at yours. Default: `system-ui, -apple-system, 'Segoe UI', sans-serif`. */
399
397
  '--font-body'?: string | number;
400
- /** `--font-code` - The code face - --type-code follows. Default: `'Geist Mono', ui-monospace, 'SF Mono', 'Menlo', monospace`. */
398
+ /** `--font-code` - The code face - --type-code follows. The package loads no webfont; point this at yours. Default: `ui-monospace, 'SF Mono', 'Menlo', monospace`. */
401
399
  '--font-code'?: string | number;
402
400
  /** `--gray-0` - The top of the ramp, not pure white: it carries --neutral like every rung below it. Default: `oklch(from var(--neutral) 0.995 0.002 h)`. Re-derived on every theme root. */
403
401
  '--gray-0'?: string | number;
@@ -669,8 +667,6 @@ export interface TokenProperties {
669
667
  '--glass-shadow'?: string | number;
670
668
  /** `--glass-shadow-hover`. Default: `0 2px 4px rgb(var(--shadow-rgb) / calc(0.06 * var(--shadow-strength))), 0 8px 18px rgb(var(--shadow-rgb) / calc(0.1 * var(--shadow-strength)))`. Re-derived on every theme root. */
671
669
  '--glass-shadow-hover'?: string | number;
672
- /** `--text-on-accent` - The ink on a hue fill - the ramp's lightest rung in either polarity. Default: `var(--gray-0)`. */
673
- '--text-on-accent'?: string | number;
674
670
  /** `--bg-app` - Canvas, cards and panels share the top of the ramp, separated by hairlines rather than tint. Default: `var(--gray-0)`. Dark: `oklch(from var(--neutral) 0.165 0.006 h)`. */
675
671
  '--bg-app'?: string | number;
676
672
  /** `--bg-surface`. Default: `var(--gray-0)`. Dark: `oklch(from var(--neutral) 0.165 0.006 h)`. */
@@ -723,6 +719,8 @@ export interface TokenProperties {
723
719
  '--accent-wash'?: string | number;
724
720
  /** `--text-accent`. Default: `var(--accent-active)`. Dark: `oklch(from var(--accent) calc(l + 0.14) calc(c - 0.012) h)`. Re-derived on every theme root. */
725
721
  '--text-accent'?: string | number;
722
+ /** `--text-on-accent` - The ink on a hue fill - the ramp's lightest rung in either polarity. Default: `var(--gray-0)`. Re-derived on every theme root. */
723
+ '--text-on-accent'?: string | number;
726
724
  /** `--neutral-wash` - Translucent washes of the ink, never opaque near-whites. Default: `color-mix(in oklab, var(--text-secondary) 6%, transparent)`. Re-derived on every theme root. */
727
725
  '--neutral-wash'?: string | number;
728
726
  /** `--neutral-wash-press`. Default: `color-mix(in oklab, var(--text-secondary) 10%, transparent)`. Re-derived on every theme root. */
@@ -1,6 +1,6 @@
1
- 'use client';import { loop } from './chunk-HWDIVGME.js';
1
+ 'use client';import { loop } from './chunk-XKDR22VE.js';
2
2
  import './chunk-VNVVG47J.js';
3
- import './chunk-ZHMOH62S.js';
3
+ import './chunk-6H3IJ752.js';
4
4
  import { cx } from './chunk-QGNC7LH5.js';
5
5
  import './typing-lines.css';
6
6
  import { useRef, useEffect } from 'react';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/expressive/typing-lines/TypingLines.tsx"],"names":[],"mappings":";;;;;;;;AAWA,IAAM,iBAAA,GAAoB,EAAA;AAC1B,IAAM,mBAAA,GAAsB,EAAA;AAC5B,IAAM,YAAA,GAAe,GAAA;AACrB,IAAM,cAAA,GAAiB,EAAA;AACvB,IAAM,OAAA,GAAU,IAAA;AAEhB,IAAM,UAAA,GAAa,uBAAA;AACnB,IAAM,cAAA,GAAiB,kCAAA;AAevB,IAAM,OAAA,GAAU,CAAC,IAAA,EAAc,IAAA,KAAsB,SAAS,MAAA,GAAU,IAAA,GAAO,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA,GAAI,EAAC,GAAK,CAAC,GAAG,IAAI,CAAA;AAE/G,SAAS,UAAA,CAAW,EAAA,EAAiB,KAAA,EAAiB,MAAA,EAAgB,QAAA,EAAoB;AACxF,EAAA,OAAO,QAAA,CAAS,KAAA,GAAQ,MAAA,IAAU,EAAA,CAAG,SAAA,EAAW;AAC9C,IAAA,EAAA,CAAG,WAAA,CAAY,GAAG,SAAS,CAAA;AAC3B,IAAA,IAAI,QAAA,CAAS,QAAQ,CAAA,IAAK,EAAA,CAAG,WAAW,EAAA,CAAG,WAAA,CAAY,GAAG,SAAS,CAAA;AACnE,IAAA,QAAA,CAAS,KAAA,EAAA;AAAA,EACX;AACA,EAAA,KAAA,IAAS,CAAA,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,GAAA,EAAK,OAAA,EAAS,SAAA,EAAW,EAAA,CAAG,iBAAA,EAAmB,SAAS,CAAA,EAAG,KAAA,EAAe,GAAG,SAAA,EACjF,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,GAAA,EAAK,QAAA,EAAU,SAAA,EAAU,wBAAA,EAAyB,CAAA;AAAA,wBACvD,MAAA,EAAA,EAAK,GAAA,EAAK,SAAS,SAAA,EAAU,uBAAA,EAAwB,eAAY,MAAA,EAAO,CAAA;AAAA,IACxE,KAAA,KAAU,MAAA,GAAS,IAAA,mBAClB,GAAA,CAAC,MAAA,EAAA,EAAK,GAAA,EAAK,QAAA,EAAU,SAAA,EAAW,CAAA,+CAAA,EAAkD,KAAK,CAAA,CAAA,EAAI,aAAA,EAAY,MAAA,EAAO;AAAA,GAAA,EAElH,CAAA;AAEJ","file":"typing-lines.js","sourcesContent":["'use client';\n\nimport './typing-lines.css';\n\nimport { useEffect, useRef, type HTMLAttributes } from 'react';\n\nimport type { DataAttributes } from '../../../dom-props';\nimport { loop } from '../../../engine';\nimport type { TypingLinesStyle } from '../../../tokens/component-styles.generated';\nimport { cx } from '../../internal/utils/cx';\n\nconst CHARACTER_TYPE_MS = 54;\nconst CHARACTER_DELETE_MS = 26;\nconst WORD_TYPE_MS = 210;\nconst WORD_DELETE_MS = 90;\nconst HOLD_MS = 2400;\nconst RESTART_LEAD_MS = 420;\nconst WORD_CLASS = 'zc-typing-lines__word';\nconst BLINKING_CLASS = 'zc-typing-lines__caret--blinking';\n\nexport type TypingUnit = 'character' | 'word';\nexport type TypingCaret = 'line' | 'block' | 'underscore' | 'none';\n\ntype Phase = 'typing' | 'holding' | 'deleting';\n\ninterface Progress {\n index: number;\n count: number;\n phase: Phase;\n elapsed: number;\n built: number;\n}\n\nconst unitsOf = (line: string, unit: TypingUnit) => (unit === 'word' ? (line ? line.split(' ') : []) : [...line]);\n\nfunction paintWords(el: HTMLElement, words: string[], target: number, progress: Progress) {\n while (progress.built > target && el.lastChild) {\n el.removeChild(el.lastChild);\n if (progress.built > 1 && el.lastChild) el.removeChild(el.lastChild);\n progress.built--;\n }\n for (let i = progress.built; i < target; i++) {\n if (i) el.appendChild(document.createTextNode(' '));\n const span = document.createElement('span');\n span.className = WORD_CLASS;\n span.textContent = words[i];\n el.appendChild(span);\n progress.built = i + 1;\n }\n}\n\nfunction paint(el: HTMLElement, line: string, unit: TypingUnit, count: number, progress: Progress) {\n if (unit === 'word') {\n paintWords(el, unitsOf(line, unit), count, progress);\n return;\n }\n el.textContent = [...line].slice(0, count).join('');\n progress.built = 0;\n}\n\nfunction advance(progress: Progress, dt: number, lines: string[], unit: TypingUnit) {\n const total = unitsOf(lines[progress.index] ?? '', unit).length;\n const typeRate = unit === 'word' ? WORD_TYPE_MS : CHARACTER_TYPE_MS;\n const deleteRate = unit === 'word' ? WORD_DELETE_MS : CHARACTER_DELETE_MS;\n progress.elapsed += dt;\n\n if (progress.phase === 'typing') {\n if (progress.elapsed > typeRate) {\n progress.elapsed = 0;\n progress.count++;\n if (progress.count >= total) {\n progress.count = total;\n progress.phase = 'holding';\n }\n }\n return;\n }\n if (progress.phase === 'holding') {\n if (progress.elapsed > HOLD_MS) {\n progress.elapsed = 0;\n progress.phase = 'deleting';\n }\n return;\n }\n if (progress.elapsed > deleteRate) {\n progress.elapsed = 0;\n progress.count--;\n if (progress.count <= 0) {\n progress.count = 0;\n progress.phase = 'typing';\n progress.elapsed = -RESTART_LEAD_MS;\n progress.index = lines.length ? (progress.index + 1) % lines.length : 0;\n }\n }\n}\n\nexport interface TypingLinesOwnProps {\n /** The lines to type, in order; the sequence restarts once the last one has been deleted. */\n lines: string[];\n /** Whether the line arrives one character or one whole word at a time. @default 'character' */\n unit?: TypingUnit;\n /** Caret shape. It holds solid while characters land and blinks only once the line is idle. @default 'line' */\n caret?: TypingCaret;\n /** Multiplies the typing rate; sampled live on every frame. @default 1 */\n speed?: number;\n /** Extra class(es) merged onto the root. */\n className?: string;\n /** Inline styles merged onto the root. */\n style?: TypingLinesStyle;\n}\n\nexport interface TypingLinesProps extends TypingLinesOwnProps {\n /** Standard <span> attributes (aria-*, data-*, title, ...) forwarded to the root. */\n htmlProps?: Omit<HTMLAttributes<HTMLSpanElement>, keyof TypingLinesOwnProps> & DataAttributes;\n}\n\nexport function TypingLines({\n lines,\n unit = 'character',\n caret = 'line',\n speed = 1,\n className = '',\n style,\n htmlProps,\n}: TypingLinesProps) {\n const rootRef = useRef<HTMLSpanElement>(null);\n const textRef = useRef<HTMLSpanElement>(null);\n const caretRef = useRef<HTMLSpanElement>(null);\n const labelRef = useRef<HTMLSpanElement>(null);\n const speedRef = useRef(speed);\n const key = lines.join('\u0000') + '\u0001' + unit;\n\n useEffect(() => {\n speedRef.current = speed;\n }, [speed]);\n\n useEffect(() => {\n const el = rootRef.current;\n const text = textRef.current;\n if (!el || !text) return;\n\n const progress: Progress = { index: 0, count: 0, phase: 'typing', elapsed: 0, built: 0 };\n text.textContent = '';\n\n const showLabel = () => {\n if (labelRef.current) labelRef.current.textContent = lines[progress.index] ?? '';\n };\n const settle = () => {\n const line = lines[0] ?? '';\n progress.index = 0;\n progress.count = unitsOf(line, unit).length;\n progress.phase = 'holding';\n paint(text, line, unit, progress.count, progress);\n caretRef.current?.classList.remove(BLINKING_CLASS);\n showLabel();\n };\n\n let painted = -1;\n showLabel();\n\n const playback = loop(\n (_k, dt) => {\n const before = progress.index;\n advance(progress, dt, lines, unit);\n if (progress.index !== before) {\n progress.built = 0;\n text.textContent = '';\n showLabel();\n }\n if (progress.count !== painted) {\n paint(text, lines[progress.index] ?? '', unit, progress.count, progress);\n painted = progress.count;\n }\n caretRef.current?.classList.toggle(BLINKING_CLASS, progress.phase === 'holding');\n },\n { el, speed: () => speedRef.current, snap: settle },\n );\n\n return () => playback.stop();\n }, [key, lines, unit]);\n\n return (\n <span ref={rootRef} className={cx('zc-typing-lines', className)} style={style} {...htmlProps}>\n <span ref={labelRef} className=\"zc-typing-lines__label\" />\n <span ref={textRef} className=\"zc-typing-lines__text\" aria-hidden=\"true\" />\n {caret === 'none' ? null : (\n <span ref={caretRef} className={`zc-typing-lines__caret zc-typing-lines__caret--${caret}`} aria-hidden=\"true\" />\n )}\n </span>\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/components/expressive/typing-lines/TypingLines.tsx"],"names":[],"mappings":";;;;;;;;AAWA,IAAM,iBAAA,GAAoB,EAAA;AAC1B,IAAM,mBAAA,GAAsB,EAAA;AAC5B,IAAM,YAAA,GAAe,GAAA;AACrB,IAAM,cAAA,GAAiB,EAAA;AACvB,IAAM,OAAA,GAAU,IAAA;AAEhB,IAAM,UAAA,GAAa,uBAAA;AACnB,IAAM,cAAA,GAAiB,kCAAA;AAevB,IAAM,OAAA,GAAU,CAAC,IAAA,EAAc,IAAA,KAAsB,SAAS,MAAA,GAAU,IAAA,GAAO,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA,GAAI,EAAC,GAAK,CAAC,GAAG,IAAI,CAAA;AAE/G,SAAS,UAAA,CAAW,EAAA,EAAiB,KAAA,EAAiB,MAAA,EAAgB,QAAA,EAAoB;AACxF,EAAA,OAAO,QAAA,CAAS,KAAA,GAAQ,MAAA,IAAU,EAAA,CAAG,SAAA,EAAW;AAC9C,IAAA,EAAA,CAAG,WAAA,CAAY,GAAG,SAAS,CAAA;AAC3B,IAAA,IAAI,QAAA,CAAS,QAAQ,CAAA,IAAK,EAAA,CAAG,WAAW,EAAA,CAAG,WAAA,CAAY,GAAG,SAAS,CAAA;AACnE,IAAA,QAAA,CAAS,KAAA,EAAA;AAAA,EACX;AACA,EAAA,KAAA,IAAS,CAAA,GAAI,QAAA,CAAS,KAAA,EAAO,CAAA,GAAI,QAAQ,CAAA,EAAA,EAAK;AAC5C,IAAA,IAAI,GAAG,EAAA,CAAG,WAAA,CAAY,QAAA,CAAS,cAAA,CAAe,GAAG,CAAC,CAAA;AAClD,IAAA,MAAM,IAAA,GAAO,QAAA,CAAS,aAAA,CAAc,M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AyB,CAAA;AAAA,wBACvD,MAAA,EAAA,EAAK,GAAA,EAAK,SAAS,SAAA,EAAU,uBAAA,EAAwB,eAAY,MAAA,EAAO,CAAA;AAAA,IACxE,KAAA,KAAU,MAAA,GAAS,IAAA,mBAClB,GAAA,CAAC,MAAA,EAAA,EAAK,GAAA,EAAK,QAAA,EAAU,SAAA,EAAW,CAAA,+CAAA,EAAkD,KAAK,CAAA,CAAA,EAAI,aAAA,EAAY,MAAA,EAAO;AAAA,GAAA,EAElH,CAAA;AAEJ","file":"typing-lines.js","sourcesContent":["'use client';\n\nimport './typing-lines.css';\n\nimport { useEffect, useRef, type HTMLAttributes } from 'react';\n\nimport type { DataAttributes } from '../../../dom-props';\nimport { loop } from '../../../engine';\nimport type { TypingLinesStyle } from '../../../tokens/component-styles.generated';\nimport { cx } from '../../internal/utils/cx';\n\nconst CHARACTER_TYPE_MS = 54;\nconst CHARACTER_DELETE_MS = 26;\nconst WORD_TYPE_MS = 210;\nconst WORD_DELETE_MS = 90;\nconst HOLD_MS = 2400;\nconst RESTART_LEAD_MS = 420;\nconst WORD_CLASS = 'zc-typing-lines__word';\nconst BLINKING_CLASS = 'zc-typing-lines__caret--blinking';\n\nexport type TypingUnit = 'character' | 'word';\nexport type TypingCaret = 'line' | 'block' | 'underscore' | 'none';\n\ntype Phase = 'typing' | 'holding' | 'deleting';\n\ninterface Progress {\n index: number;\n count: number;\n phase: Phase;\n elapsed: number;\n built: number;\n}\n\nconst unitsOf = (line: string, unit: TypingUnit) => (unit === 'word' ? (line ? line.split(' ') : []) : [...line]);\n\nfunction paintWords(el: HTMLElement, words: string[], target: number, progress: Progress) {\n while (progress.built > target && el.lastChild) {\n el.removeChild(el.lastChild);\n if (progress.built > 1 && el.lastChild) el.removeChild(el.lastChild);\n progress.built--;\n }\n for (let i = progress.built; i < target; i++) {\n if (i) el.appendChild(document.createTextNode(' '));\n const span = document.createElement('span');\n span.className = WORD_CLASS;\n span.textContent = words[i];\n el.appendChild(span);\n progress.built = i + 1;\n }\n}\n\nfunction paint(el: HTMLElement, line: string, unit: TypingUnit, count: number, progress: Progress) {\n if (unit === 'word') {\n paintWords(el, unitsOf(line, unit), count, progress);\n return;\n }\n el.textContent = [...line].slice(0, count).join('');\n progress.built = 0;\n}\n\nfunction advance(progress: Progress, dt: number, lines: string[], unit: TypingUnit) {\n const total = unitsOf(lines[progress.index] ?? '', unit).length;\n const typeRate = unit === 'word' ? WORD_TYPE_MS : CHARACTER_TYPE_MS;\n const deleteRate = unit === 'word' ? WORD_DELETE_MS : CHARACTER_DELETE_MS;\n progress.elapsed += dt;\n\n if (progress.phase === 'typing') {\n if (progress.elapsed > typeRate) {\n progress.elapsed = 0;\n progress.count++;\n if (progress.count >= total) {\n progress.count = total;\n progress.phase = 'holding';\n }\n }\n return;\n }\n if (progress.phase === 'holding') {\n if (progress.elapsed > HOLD_MS) {\n progress.elapsed = 0;\n progress.phase = 'deleting';\n }\n return;\n }\n if (progress.elapsed > deleteRate) {\n progress.elapsed = 0;\n progress.count--;\n if (progress.count <= 0) {\n progress.count = 0;\n progress.phase = 'typing';\n progress.elapsed = -RESTART_LEAD_MS;\n progress.index = lines.length ? (progress.index + 1) % lines.length : 0;\n }\n }\n}\n\nexport interface TypingLinesOwnProps {\n /** The lines to type, in order; the sequence restarts once the last one has been deleted. */\n lines: string[];\n /** Whether the line arrives one character or one whole word at a time. @default 'character' */\n unit?: TypingUnit;\n /** Caret shape. It holds solid while characters land and blinks only once the line is idle. @default 'line' */\n caret?: TypingCaret;\n /** Multiplies the typing rate; sampled live on every frame. @default 1 */\n speed?: number;\n /** Extra class(es) merged onto the root. */\n className?: string;\n /** Inline styles merged onto the root. */\n style?: TypingLinesStyle;\n}\n\nexport interface TypingLinesProps extends TypingLinesOwnProps {\n /** Standard <span> attributes (aria-*, data-*, title, ...) forwarded to the root. */\n htmlProps?: Omit<HTMLAttributes<HTMLSpanElement>, keyof TypingLinesOwnProps> & DataAttributes;\n}\n\nexport function TypingLines({\n lines,\n unit = 'character',\n caret = 'line',\n speed = 1,\n className = '',\n style,\n htmlProps,\n}: TypingLinesProps) {\n const rootRef = useRef<HTMLSpanElement>(null);\n const textRef = useRef<HTMLSpanElement>(null);\n const caretRef = useRef<HTMLSpanElement>(null);\n const labelRef = useRef<HTMLSpanElement>(null);\n const speedRef = useRef(speed);\n const key = lines.join('\\u0000') + '\\u0001' + unit;\n\n useEffect(() => {\n speedRef.current = speed;\n }, [speed]);\n\n useEffect(() => {\n const el = rootRef.current;\n const text = textRef.current;\n if (!el || !text) return;\n\n const progress: Progress = { index: 0, count: 0, phase: 'typing', elapsed: 0, built: 0 };\n text.textContent = '';\n\n const showLabel = () => {\n if (labelRef.current) labelRef.current.textContent = lines[progress.index] ?? '';\n };\n const settle = () => {\n const line = lines[0] ?? '';\n progress.index = 0;\n progress.count = unitsOf(line, unit).length;\n progress.phase = 'holding';\n paint(text, line, unit, progress.count, progress);\n caretRef.current?.classList.remove(BLINKING_CLASS);\n showLabel();\n };\n\n let painted = -1;\n showLabel();\n\n const playback = loop(\n (_k, dt) => {\n const before = progress.index;\n advance(progress, dt, lines, unit);\n if (progress.index !== before) {\n progress.built = 0;\n text.textContent = '';\n showLabel();\n }\n if (progress.count !== painted) {\n paint(text, lines[progress.index] ?? '', unit, progress.count, progress);\n painted = progress.count;\n }\n caretRef.current?.classList.toggle(BLINKING_CLASS, progress.phase === 'holding');\n },\n { el, speed: () => speedRef.current, snap: settle },\n );\n\n return () => playback.stop();\n }, [key, lines, unit]);\n\n return (\n <span ref={rootRef} className={cx('zc-typing-lines', className)} style={style} {...htmlProps}>\n <span ref={labelRef} className=\"zc-typing-lines__label\" />\n <span ref={textRef} className=\"zc-typing-lines__text\" aria-hidden=\"true\" />\n {caret === 'none' ? null : (\n <span ref={caretRef} className={`zc-typing-lines__caret zc-typing-lines__caret--${caret}`} aria-hidden=\"true\" />\n )}\n </span>\n );\n}\n"]}
package/dist/youtube.js CHANGED
@@ -1,7 +1,7 @@
1
- 'use client';import { startDrag } from './chunk-HWDIVGME.js';
1
+ 'use client';import { startDrag } from './chunk-XKDR22VE.js';
2
2
  import './chunk-VNVVG47J.js';
3
3
  import { useControllable } from './chunk-MMRIQNEN.js';
4
- import './chunk-ZHMOH62S.js';
4
+ import './chunk-6H3IJ752.js';
5
5
  import { cx } from './chunk-QGNC7LH5.js';
6
6
  import './youtube.css';
7
7
  import { useRef, useEffect } from 'react';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyncat/ui",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "description": "A React 19 design system: accessible, animated UI components built on a small, closed CSS design-token vocabulary. No Tailwind, no CSS-in-JS.",
5
5
  "keywords": [
6
6
  "react",
@@ -34,7 +34,7 @@ init over hand-wiring it.
34
34
  - `import '@zyncat/ui/styles.css'` once at the root - fonts + tokens; each component lazy-loads its
35
35
  own CSS. `import './zyncat.theme.css'` right after it - the eight decisions init wrote beside the
36
36
  entry; a retheme is editing a value there.
37
- - Theming that is data: `defineTheme` + `<ZyncatTheme theme={{ base, dark }} />` from
37
+ - Theming that is data: `defineTheme` + `<ZyncatTheme themes={{ default: { light, dark } }} />` from
38
38
  `@zyncat/ui/theme`, once at the root. Typed, server-rendered, no build config. See
39
39
  references/theming.md before writing one.
40
40
  - One subpath per component: `import { Button } from '@zyncat/ui/button'`. There is no barrel.
@@ -1,6 +1,6 @@
1
1
  # @zyncat/ui component index
2
2
 
3
- Generated from @zyncat/ui v0.17.0 by `pnpm sync skill` - do not edit by hand.
3
+ Generated from @zyncat/ui v0.19.0 by `pnpm sync skill` - do not edit by hand.
4
4
  If node_modules/@zyncat/ui/package.json shows a DIFFERENT version, this index is stale:
5
5
  trust the get_component MCP tool and re-run `npx zyncat-ui init` to refresh the skill.
6
6
 
@@ -27,25 +27,32 @@ own `-subtle`, `-text` and `-wash`; the `--radius-*` steps are fixed ratios of `
27
27
  `--radius: 0` squares every corner (`--radius-full` is a shape and stays put); the `--type-*` bundles
28
28
  follow the faces. Set a derived token only to break it away from its decision.
29
29
 
30
- Dark ships in the package. `data-theme="dark"` on `<html>` turns the page - the base layer paints
30
+ Palette and polarity are two attributes. `data-theme='<name>'` picks the palette, `data-polarity='light|dark'`
31
+ picks the side, and they are independent - a palette carries both sides.
32
+
33
+ Dark ships in the package. `data-polarity="dark"` on `<html>` turns the page - the base layer paints
31
34
  `body` in `--bg-app`, `--text-body` and `--type-body`, so there is no wrapper to add - and on any
32
- element it turns that subtree, where `data-theme="light"` makes a light island. The dark theme sets
33
- the neutral roles (`--bg-*`, `--text-*`, `--border-*`), the shadow ink, `--shadow-strength` (how much
34
- shadow the surfaces cast), `--sheen-strength` (how bright the white top-light highlights render) and
35
- `--glow-strength` (how much light a hovered hue fill casts on the canvas around it), drops the filled
36
- faces (`--accent-fill`, `--danger-fill`) a step, and re-derives the hue steps whose light values pin a
37
- lightness near white; the decisions cascade in, so the accent a project sets is the dark theme's
38
- accent too. Extend it in the same block -
39
- `[data-theme='dark'] { --accent: oklch(0.72 0.14 292); --shadow-strength: 2.5; }` - and whatever is
35
+ element it turns that subtree, where `data-polarity="light"` makes a light island. The dark polarity
36
+ sets the neutral roles (`--bg-*`, `--text-*`, `--border-*`), the shadow ink, `--shadow-strength` (how
37
+ much shadow the surfaces cast), `--sheen-strength` (how bright the white top-light highlights render)
38
+ and `--glow-strength` (how much light a hovered hue fill casts on the canvas around it), drops the
39
+ filled faces (`--accent-fill`, `--danger-fill`) a step, and re-derives the hue steps whose light
40
+ values pin a lightness near white; the decisions cascade in, so the accent a project sets is the dark
41
+ side's accent too. Extend it in the same block -
42
+ `[data-polarity='dark'] { --accent: oklch(0.72 0.14 292); --shadow-strength: 2.5; }` - and whatever is
40
43
  left out keeps the shipped dark value. The derived tokens are declared on every theme root (`:root`
41
- and any element with `data-theme`), so a subtree theme that repoints `--accent` re-derives all of
42
- them; the neutral roles cascade like any property, so a theme of your own that sets `--bg-app` and
43
- `--text-body` keeps them without restating the rest.
44
- Components read the tokens live, and the WAAPI engine reads the same values at `<body>` - again
45
- whenever `data-theme` changes or `prefers-reduced-motion` flips - so motion retimes with the CSS.
46
- Reduced motion is handled here - every `--duration-*` collapses to 1ms under
47
- `prefers-reduced-motion`, so derive your own delays from a duration token, and repoint durations on
48
- `:root` rather than a nested scope or the collapse cannot reach them.
44
+ and any element with `data-theme` or `data-polarity`), so a subtree that repoints `--accent`
45
+ re-derives all of them; the neutral roles cascade like any property, so a theme of your own that sets
46
+ `--bg-app` and `--text-body` keeps them without restating the rest. Overlays portal to `<body>` but
47
+ carry their trigger's palette and polarity onto their own panel, so a Dropdown, Select, Popover,
48
+ Tooltip, Dialog, Modal or Sheet opened from inside a themed island paints as the island does.
49
+ Components read the tokens live, and the WAAPI engine reads them off the element it is animating -
50
+ overlays off their trigger - so a subtree theme retimes motion as well as colour, and a page with no
51
+ subtree theme reads `<body>` as before. The read refreshes whenever `data-theme` or `data-polarity`
52
+ changes anywhere, `prefers-reduced-motion` flips or `ZyncatTheme` renders. Reduced motion is handled
53
+ here - every `--duration-*` collapses to 1ms under `prefers-reduced-motion` - so derive your own
54
+ delays from a duration token, and repoint durations on `:root` for the collapse to reach the whole
55
+ page.
49
56
 
50
57
  `@zyncat/ui/theme` is the same level with a type on it, for a theme that is data - several named
51
58
  themes, or values computed at build time. `defineTheme` takes one object shaped like a theme: four
@@ -62,19 +69,20 @@ on `defineTheme` drops those lines from `zyncat.theme.css`.
62
69
  ```tsx
63
70
  import { defineTheme, ZyncatTheme } from '@zyncat/ui/theme';
64
71
 
65
- const base = defineTheme({
72
+ const light = defineTheme({
66
73
  color: { accent: 'oklch(0.58 0.19 292)' },
67
74
  shape: { radius: '0.75rem' },
68
75
  components: { odometer: { accent: 'var(--warning)' } },
69
76
  });
70
77
  const dark = defineTheme({ color: { accent: 'oklch(0.72 0.14 292)' }, custom: { '--shadow-strength': 2.5 } });
71
78
 
72
- <ZyncatTheme theme={{ base, dark }} />;
79
+ <ZyncatTheme themes={{ default: { light, dark } }} />;
73
80
  ```
74
81
 
75
- `base` lands on `:root`; every other key is a `[data-theme='<key>']` block, so `dark` and `light`
76
- extend the shipped polarities rather than starting them. Durations you repoint keep their
77
- reduced-motion collapse automatically.
82
+ Every key is a palette carrying a `light` and a `dark` side, and `dark` is a delta - what `light`
83
+ sets and `dark` leaves out carries over. `default` lands on `:root`; every other key becomes
84
+ `[data-theme='<key>']`, so both extend the shipped polarities rather than starting them. Durations
85
+ you repoint keep their reduced-motion collapse automatically.
78
86
 
79
87
  The vocabulary a page reads is the roles, never the plumbing:
80
88
  `--bg-app/-surface/-surface-raised/-subtle/-muted/-inset/-overlay`,
@@ -147,7 +155,7 @@ the face), with `font-body`, `leading-<role>`, `tracking-caps`, `tracking-displa
147
155
  colour utility on `ring-<hue>`);
148
156
  `duration-fast` … `duration-slowest`, `ease-standard`, `ease-entrance`, `ease-exit`, `ease-spring`,
149
157
  `ease-glide`; `max-w-prose`, `max-w-floating`. Each utility reads the token itself, so a themed
150
- subtree and the dark theme reach it, and `dark:` follows `data-theme` rather than the OS. The names
158
+ subtree and the dark polarity reach it, and `dark:` follows `data-polarity` rather than the OS. The names
151
159
  Tailwind also ships - `rounded-md`, `shadow-md`, `tracking-tight` - read the zyncat token of the same
152
160
  name, so `--radius` in the theme file moves utilities and components together. Spacing stays
153
161
  Tailwind's own scale; both sit on the 4px grid. Reach for a role utility before an arbitrary value:
@@ -165,7 +165,7 @@ export function Dialog({
165
165
  const triggerRef = useRef<HTMLElement>(null);
166
166
  const close = () => setOpen(false);
167
167
 
168
- const timings = resolveMotionTiming(animation, OV_TAKEOVER_TIMING);
168
+ const timings = resolveMotionTiming(animation, OV_TAKEOVER_TIMING, container ?? triggerRef.current);
169
169
 
170
170
  return (
171
171
  <Fragment>
@@ -177,7 +177,7 @@ export function Dialog({
177
177
  triggerRef,
178
178
  activateOn,
179
179
  })}
180
- <OverlayPortal container={container}>
180
+ <OverlayPortal container={container} scope={triggerRef.current}>
181
181
  <Presence>
182
182
  {open && (
183
183
  <ModalShell
@@ -18,7 +18,7 @@ import { resolveMotionTiming } from '../../../motion/motion-timing';
18
18
  import { Presence } from '../../../motion/presence';
19
19
  import { popIn, popOut } from '../../../motion/presets';
20
20
  import type { DisableableAnimation } from '../../../motion/timing';
21
- import { UIMotion } from '../../../tokens/motion-tokens';
21
+ import { motionFor } from '../../../tokens/motion-tokens';
22
22
  import { useControllable } from '../../internal/hooks/use-controllable';
23
23
  import { ovCloneTrigger, OverlayPortal } from '../../internal/overlay/layer';
24
24
  import type { ActivateOn } from '../../internal/utils/activation';
@@ -107,7 +107,6 @@ export function Dropdown({
107
107
  const hoverDepth = useRef(-1);
108
108
  const autoId = useId();
109
109
  const menuId = id || 'dropdown-' + autoId;
110
- const timings = resolveMotionTiming(animation, DROPDOWN_TIMING);
111
110
  const levels = useMemo(() => resolveLevels(items, path), [items, path]);
112
111
 
113
112
  const refFor = (key: string): RefObject<HTMLElement> => {
@@ -115,6 +114,7 @@ export function Dropdown({
115
114
  return refs.current.get(key)!;
116
115
  };
117
116
  const triggerRef = refFor('trigger');
117
+ const timings = resolveMotionTiming(animation, DROPDOWN_TIMING, triggerRef.current);
118
118
 
119
119
  const dismiss = (refocus: boolean) => {
120
120
  setPath([]);
@@ -178,7 +178,7 @@ export function Dropdown({
178
178
  triggerRef,
179
179
  activateOn,
180
180
  })}
181
- <OverlayPortal>
181
+ <OverlayPortal scope={triggerRef.current}>
182
182
  <Presence>
183
183
  {open &&
184
184
  levels.map((level, depth) => (
@@ -186,8 +186,8 @@ export function Dropdown({
186
186
  key={level.key}
187
187
  chain={chain}
188
188
  depth={depth}
189
- animate={popIn(UIMotion.scale.floating, timings.open)}
190
- exit={popOut(UIMotion.scale.floating, timings.close)}
189
+ animate={popIn(motionFor(triggerRef.current).scale.floating, timings.open)}
190
+ exit={popOut(motionFor(triggerRef.current).scale.floating, timings.close)}
191
191
  />
192
192
  ))}
193
193
  </Presence>
@@ -4,12 +4,15 @@ import { useId, useRef } from 'react';
4
4
 
5
5
  import { Motion } from '../../../../motion/element';
6
6
  import { GlidePill, useGlide, type GlideApi } from '../../../../motion/glide';
7
- import { UIMotion as SM } from '../../../../tokens/motion-tokens';
7
+ import { motionFor } from '../../../../tokens/motion-tokens';
8
8
  import { activationProps, type ActivateOn } from '../../../internal/utils/activation';
9
9
  import { CATEGORY_ICON_ATTRS, CATEGORY_ICONS } from '../category-icons';
10
10
  import { useCategories, useIsActiveCategory, type EmojiPickerStore } from './useEmojiPicker';
11
11
 
12
- const railGlide = () => ({ timing: { duration: SM.dur.base, ease: SM.ease.standard } });
12
+ const railGlide = (scope?: Element | null) => {
13
+ const motion = motionFor(scope);
14
+ return { timing: { duration: motion.dur.base, ease: motion.ease.standard } };
15
+ };
13
16
 
14
17
  interface CategoryProps {
15
18
  store: EmojiPickerStore;
@@ -17,9 +20,10 @@ interface CategoryProps {
17
20
  railId: string;
18
21
  glide: GlideApi;
19
22
  activateOn?: ActivateOn;
23
+ scope: Element | null;
20
24
  }
21
25
 
22
- function Category({ store, categoryKey, railId, glide, activateOn }: CategoryProps) {
26
+ function Category({ store, categoryKey, railId, glide, activateOn, scope }: CategoryProps) {
23
27
  const isActive = useIsActiveCategory(store, categoryKey);
24
28
 
25
29
  return (
@@ -42,7 +46,7 @@ function Category({ store, categoryKey, railId, glide, activateOn }: CategoryPro
42
46
  <Motion
43
47
  as="span"
44
48
  layoutId={railId}
45
- layoutTransition={railGlide()}
49
+ layoutTransition={railGlide(scope)}
46
50
  className="zc-on-emoji-cat-rail"
47
51
  aria-hidden="true"
48
52
  />
@@ -70,7 +74,15 @@ export function CategoryBar({ store, activateOn }: { store: EmojiPickerStore; ac
70
74
  >
71
75
  <GlidePill className="zc-on-emoji-bar-marker" glide={glide} />
72
76
  {categories.map((key) => (
73
- <Category key={key} store={store} categoryKey={key} railId={railId} glide={glide} activateOn={activateOn} />
77
+ <Category
78
+ key={key}
79
+ store={store}
80
+ categoryKey={key}
81
+ railId={railId}
82
+ glide={glide}
83
+ activateOn={activateOn}
84
+ scope={barRef.current}
85
+ />
74
86
  ))}
75
87
  </div>
76
88
  );
@@ -1,5 +1,5 @@
1
1
  import { animate, flip, measure, set } from '../../../engine';
2
- import { UIMotion as SM } from '../../../tokens/motion-tokens';
2
+ import { motionFor } from '../../../tokens/motion-tokens';
3
3
  import type { EmojiData } from './data';
4
4
  import { el } from './dom';
5
5
  import type { GetEmojiUrl } from './types';
@@ -50,18 +50,19 @@ export function createScaffold(root: HTMLElement, emojiData: EmojiData, getEmoji
50
50
 
51
51
  let hadFocus = false;
52
52
  const positionMarker = (btn: HTMLButtonElement | null) => {
53
+ const motion = motionFor(scroll);
53
54
  if (!btn?.offsetHeight) {
54
- animate(marker, { opacity: [0], timing: SM.t.exit });
55
+ animate(marker, { opacity: [0], timing: motion.t.exit });
55
56
  hadFocus = false;
56
57
  return;
57
58
  }
58
59
  const from = hadFocus ? measure(marker) : null;
59
60
  const tile = offsetWithinScroll(btn);
60
61
  set(marker, { x: [tile.left], y: [tile.top], width: [btn.offsetWidth], height: [btn.offsetHeight] });
61
- animate(marker, { opacity: [MARKER_OPACITY], timing: { duration: SM.dur.fast, ease: SM.ease.standard } });
62
+ animate(marker, { opacity: [MARKER_OPACITY], timing: { duration: motion.dur.fast, ease: motion.ease.standard } });
62
63
  hadFocus = true;
63
- if (from && !SM.reduced)
64
- flip(marker, from, { size: 'none', timing: { duration: SM.dur.base, ease: SM.ease.standard } });
64
+ if (from && !motion.reduced)
65
+ flip(marker, from, { size: 'none', timing: { duration: motion.dur.base, ease: motion.ease.standard } });
65
66
  };
66
67
 
67
68
  const mountMarker = () => {
@@ -67,7 +67,7 @@ export function Modal({
67
67
  const autoId = useId();
68
68
  const panelId = id || 'modal-' + autoId;
69
69
  const close = () => setOpen(false);
70
- const timings = resolveMotionTiming(animation, OV_TAKEOVER_TIMING);
70
+ const timings = resolveMotionTiming(animation, OV_TAKEOVER_TIMING, container ?? triggerRef.current);
71
71
 
72
72
  return (
73
73
  <Fragment>
@@ -79,7 +79,7 @@ export function Modal({
79
79
  triggerRef,
80
80
  activateOn,
81
81
  })}
82
- <OverlayPortal container={container}>
82
+ <OverlayPortal container={container} scope={triggerRef.current}>
83
83
  <Presence>
84
84
  {open && (
85
85
  <ModalShell