@zyncat/ui 0.15.0 → 0.17.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 (290) hide show
  1. package/README.md +32 -202
  2. package/dist/alert.css +1 -1
  3. package/dist/alert.js +18 -10
  4. package/dist/alert.js.map +1 -1
  5. package/dist/avatar.css +3 -2
  6. package/dist/badge.css +1 -1
  7. package/dist/bloom-HV23M4AW.js +81 -0
  8. package/dist/bloom-HV23M4AW.js.map +1 -0
  9. package/dist/button.css +21 -24
  10. package/dist/button.js +3 -1
  11. package/dist/checkbox.css +1 -1
  12. package/dist/chunk-2YGHPQ66.js +16 -0
  13. package/dist/chunk-2YGHPQ66.js.map +1 -0
  14. package/dist/{chunk-K45CWVHS.js → chunk-3MLUH2QL.js} +4 -4
  15. package/dist/{chunk-K45CWVHS.js.map → chunk-3MLUH2QL.js.map} +1 -1
  16. package/dist/{chunk-FVPNICF4.js → chunk-4PQDVK23.js} +4 -4
  17. package/dist/{chunk-FVPNICF4.js.map → chunk-4PQDVK23.js.map} +1 -1
  18. package/dist/{chunk-FLQVOSFC.js → chunk-6IXLW7QA.js} +7 -7
  19. package/dist/{chunk-FLQVOSFC.js.map → chunk-6IXLW7QA.js.map} +1 -1
  20. package/dist/chunk-7NHY2CRA.js +132 -0
  21. package/dist/chunk-7NHY2CRA.js.map +1 -0
  22. package/dist/{chunk-BH4JFWXQ.js → chunk-7VTWJL72.js} +19 -16
  23. package/dist/chunk-7VTWJL72.js.map +1 -0
  24. package/dist/chunk-7ZSIUUC3.js +50 -0
  25. package/dist/chunk-7ZSIUUC3.js.map +1 -0
  26. package/dist/{chunk-6X3G4GIM.js → chunk-DH7DT6EO.js} +3 -3
  27. package/dist/{chunk-6X3G4GIM.js.map → chunk-DH7DT6EO.js.map} +1 -1
  28. package/dist/{chunk-QGVFFT2B.js → chunk-EOWWVFBF.js} +3 -3
  29. package/dist/{chunk-QGVFFT2B.js.map → chunk-EOWWVFBF.js.map} +1 -1
  30. package/dist/{chunk-RBSHRRNO.js → chunk-FLDIRXFU.js} +5 -5
  31. package/dist/{chunk-RBSHRRNO.js.map → chunk-FLDIRXFU.js.map} +1 -1
  32. package/dist/{chunk-5GBV45YD.js → chunk-GWCBTD63.js} +3 -3
  33. package/dist/{chunk-5GBV45YD.js.map → chunk-GWCBTD63.js.map} +1 -1
  34. package/dist/chunk-GZ6UMHCK.js +103 -0
  35. package/dist/chunk-GZ6UMHCK.js.map +1 -0
  36. package/dist/{chunk-FEXUS4SV.js → chunk-HWDIVGME.js} +11 -5
  37. package/dist/chunk-HWDIVGME.js.map +1 -0
  38. package/dist/chunk-KSAJ6DED.js +16 -0
  39. package/dist/chunk-KSAJ6DED.js.map +1 -0
  40. package/dist/{chunk-UYSXJ7MH.js → chunk-LH2UIEKN.js} +7 -17
  41. package/dist/chunk-LH2UIEKN.js.map +1 -0
  42. package/dist/{chunk-CAXQJSIE.js → chunk-M2A6PZ7J.js} +6 -6
  43. package/dist/{chunk-CAXQJSIE.js.map → chunk-M2A6PZ7J.js.map} +1 -1
  44. package/dist/chunk-NYQQH4R5.js +40 -0
  45. package/dist/chunk-NYQQH4R5.js.map +1 -0
  46. package/dist/{chunk-BTF6DAE3.js → chunk-ODRO3KS6.js} +4 -4
  47. package/dist/{chunk-BTF6DAE3.js.map → chunk-ODRO3KS6.js.map} +1 -1
  48. package/dist/{chunk-GJTHWB6O.js → chunk-QDAN43B6.js} +3 -3
  49. package/dist/{chunk-GJTHWB6O.js.map → chunk-QDAN43B6.js.map} +1 -1
  50. package/dist/{chunk-MDSRZ4QR.js → chunk-RY35IU3G.js} +3 -3
  51. package/dist/{chunk-MDSRZ4QR.js.map → chunk-RY35IU3G.js.map} +1 -1
  52. package/dist/{chunk-GOLSYGRA.js → chunk-TBLPZQSI.js} +84 -48
  53. package/dist/chunk-TBLPZQSI.js.map +1 -0
  54. package/dist/{chunk-5X3MJRIM.js → chunk-UKPX3RIP.js} +3 -3
  55. package/dist/{chunk-5X3MJRIM.js.map → chunk-UKPX3RIP.js.map} +1 -1
  56. package/dist/{chunk-CFRGQJ23.js → chunk-VZXML7EH.js} +4 -4
  57. package/dist/{chunk-CFRGQJ23.js.map → chunk-VZXML7EH.js.map} +1 -1
  58. package/dist/{chunk-PWQVSVXR.js → chunk-WC45VSST.js} +8 -8
  59. package/dist/{chunk-PWQVSVXR.js.map → chunk-WC45VSST.js.map} +1 -1
  60. package/dist/chunk-WQKWPI6V.js +196 -0
  61. package/dist/chunk-WQKWPI6V.js.map +1 -0
  62. package/dist/{chunk-N2GJEO5Z.js → chunk-ZHMOH62S.js} +4 -4
  63. package/dist/chunk-ZHMOH62S.js.map +1 -0
  64. package/dist/cli.js +259 -43
  65. package/dist/collapse.css +8 -5
  66. package/dist/confetti.css +3 -3
  67. package/dist/confetti.js +2 -2
  68. package/dist/date-field.js +16 -14
  69. package/dist/date-field.js.map +1 -1
  70. package/dist/date-picker.css +168 -43
  71. package/dist/date-range-field.js +38 -23
  72. package/dist/date-range-field.js.map +1 -1
  73. package/dist/datetime-field.js +17 -15
  74. package/dist/datetime-field.js.map +1 -1
  75. package/dist/dialog.css +4 -3
  76. package/dist/dialog.js +8 -8
  77. package/dist/digit-strip.css +1 -1
  78. package/dist/dropdown.css +1 -1
  79. package/dist/dropdown.js +8 -8
  80. package/dist/emoji-picker.js +14 -14
  81. package/dist/facebook-feed.css +1 -1
  82. package/dist/flow-field.css +4 -4
  83. package/dist/flow-field.js +3 -3
  84. package/dist/flow-field.js.map +1 -1
  85. package/dist/glide.js +3 -3
  86. package/dist/icon.css +1 -1
  87. package/dist/input.css +7 -4
  88. package/dist/instagram-feed.css +1 -1
  89. package/dist/instagram-feed.js +2 -2
  90. package/dist/lens.css +1 -2
  91. package/dist/lens.js +2 -2
  92. package/dist/mcp.js +1 -1
  93. package/dist/menu-surface.css +1 -1
  94. package/dist/modal.css +1 -1
  95. package/dist/modal.js +6 -6
  96. package/dist/morphing-text.css +2 -2
  97. package/dist/morphing-text.js +2 -2
  98. package/dist/motion-devtools.css +77 -2
  99. package/dist/motion-devtools.js +194 -37
  100. package/dist/motion-devtools.js.map +1 -1
  101. package/dist/motion-tokens.js +1 -1
  102. package/dist/multi-select.js +9 -9
  103. package/dist/number-field.js +3 -3
  104. package/dist/odometer.css +1 -1
  105. package/dist/odometer.js +2 -2
  106. package/dist/overlay.css +1 -1
  107. package/dist/pagination.css +1 -1
  108. package/dist/pagination.js +6 -4
  109. package/dist/pagination.js.map +1 -1
  110. package/dist/paint-CJQCM6ZO.js +260 -0
  111. package/dist/paint-CJQCM6ZO.js.map +1 -0
  112. package/dist/popover.css +1 -1
  113. package/dist/popover.js +6 -6
  114. package/dist/radio-group.css +6 -4
  115. package/dist/radio-group.js +6 -6
  116. package/dist/select.css +1 -1
  117. package/dist/select.js +9 -9
  118. package/dist/sheet.css +1 -1
  119. package/dist/sheet.js +7 -7
  120. package/dist/spinner.css +115 -0
  121. package/dist/spinner.js +4 -0
  122. package/dist/spinner.js.map +1 -0
  123. package/dist/status-badge.js +2 -2
  124. package/dist/styles.css +1 -1
  125. package/dist/support-rail.css +76 -238
  126. package/dist/support-rail.js +97 -105
  127. package/dist/support-rail.js.map +1 -1
  128. package/dist/table.css +2 -2
  129. package/dist/table.js +8 -6
  130. package/dist/table.js.map +1 -1
  131. package/dist/tabs.css +10 -14
  132. package/dist/tabs.js +6 -6
  133. package/dist/tag.css +1 -1
  134. package/dist/tag.js +6 -6
  135. package/dist/text-field.js +3 -3
  136. package/dist/textarea.css +1 -1
  137. package/dist/textarea.js +2 -2
  138. package/dist/theme-grid.js +11 -0
  139. package/dist/theme-grid.js.map +1 -0
  140. package/dist/theme-switcher.css +107 -0
  141. package/dist/theme-switcher.js +70 -0
  142. package/dist/theme-switcher.js.map +1 -0
  143. package/dist/theme-transition-LLC644ZR.js +346 -0
  144. package/dist/theme-transition-LLC644ZR.js.map +1 -0
  145. package/dist/theme-transition.css +48 -0
  146. package/dist/theme.js +57 -26
  147. package/dist/theme.js.map +1 -1
  148. package/dist/tide-DJZMDAFT.js +57 -0
  149. package/dist/tide-DJZMDAFT.js.map +1 -0
  150. package/dist/tiktok.css +2 -3
  151. package/dist/tiktok.js +2 -2
  152. package/dist/time-field.js +4 -4
  153. package/dist/toast.css +2 -14
  154. package/dist/toast.js +11 -9
  155. package/dist/toast.js.map +1 -1
  156. package/dist/toggle-tag.js +2 -2
  157. package/dist/toggle.css +1 -1
  158. package/dist/tooltip.css +1 -1
  159. package/dist/tooltip.js +5 -5
  160. package/dist/trigger.css +1 -1
  161. package/dist/types/components/composites/date-picker/month-jump.d.ts +11 -0
  162. package/dist/types/components/composites/theme-switcher/ThemeGrid.d.ts +20 -0
  163. package/dist/types/components/composites/theme-switcher/ThemeSwitcher.d.ts +24 -0
  164. package/dist/types/components/compound/support-rail/SupportRail.d.ts +10 -8
  165. package/dist/types/components/dev/MotionDevtools.d.ts +10 -5
  166. package/dist/types/components/expressive/theme-transition/bloom.d.ts +2 -0
  167. package/dist/types/components/expressive/theme-transition/paint.d.ts +2 -0
  168. package/dist/types/components/expressive/theme-transition/scene.d.ts +24 -0
  169. package/dist/types/components/expressive/theme-transition/theme-transition.d.ts +19 -0
  170. package/dist/types/components/expressive/theme-transition/tide.d.ts +2 -0
  171. package/dist/types/components/internal/icon/Icon.d.ts +1 -0
  172. package/dist/types/components/primitives/button/Button.d.ts +9 -12
  173. package/dist/types/components/primitives/button/button-style.d.ts +15 -0
  174. package/dist/types/components/primitives/spinner/Spinner.d.ts +27 -0
  175. package/dist/types/engine/animate.d.ts +1 -0
  176. package/dist/types/tokens/component-styles.generated.d.ts +35 -38
  177. package/dist/types/tokens/motion-tokens.d.ts +2 -2
  178. package/dist/types/tokens/theme-store.d.ts +47 -0
  179. package/dist/types/tokens/theme-sync.d.ts +7 -1
  180. package/dist/types/tokens/theme-tokens.generated.d.ts +121 -109
  181. package/dist/types/tokens/theme.d.ts +28 -5
  182. package/dist/typing-lines.css +1 -1
  183. package/dist/typing-lines.js +2 -2
  184. package/dist/weight-field.css +2 -2
  185. package/dist/youtube.css +1 -1
  186. package/dist/youtube.js +2 -2
  187. package/package.json +25 -31
  188. package/skills/zyncat-ui/references/components.md +5 -2
  189. package/src/components/composites/alert/Alert.tsx +7 -3
  190. package/src/components/composites/alert/alert.css +1 -1
  191. package/src/components/composites/date-picker/calendar-panel.tsx +10 -4
  192. package/src/components/composites/date-picker/date-picker.css +168 -43
  193. package/src/components/composites/date-picker/month-jump.tsx +192 -0
  194. package/src/components/composites/date-picker/range-panel.tsx +20 -5
  195. package/src/components/composites/dialog/dialog.css +4 -3
  196. package/src/components/composites/dropdown/dropdown.css +1 -1
  197. package/src/components/composites/emoji-picker/styles.css +1 -1
  198. package/src/components/composites/modal/modal.css +1 -1
  199. package/src/components/composites/pagination/pagination.css +1 -1
  200. package/src/components/composites/popover/popover.css +1 -1
  201. package/src/components/composites/select/select.css +1 -1
  202. package/src/components/composites/sheet/sheet.css +1 -1
  203. package/src/components/composites/table/table.css +2 -2
  204. package/src/components/composites/tabs/tabs.css +10 -14
  205. package/src/components/composites/theme-switcher/ThemeGrid.tsx +133 -0
  206. package/src/components/composites/theme-switcher/ThemeGrid.usage.md +20 -0
  207. package/src/components/composites/theme-switcher/ThemeSwitcher.tsx +75 -0
  208. package/src/components/composites/theme-switcher/ThemeSwitcher.usage.md +21 -0
  209. package/src/components/composites/theme-switcher/theme-switcher.css +107 -0
  210. package/src/components/composites/toast/Toast.tsx +2 -1
  211. package/src/components/composites/toast/toast.css +2 -14
  212. package/src/components/composites/tooltip/tooltip.css +1 -1
  213. package/src/components/compound/support-rail/SupportRail.tsx +116 -128
  214. package/src/components/compound/support-rail/SupportRail.usage.md +7 -6
  215. package/src/components/compound/support-rail/support-rail.css +76 -238
  216. package/src/components/dev/MotionDevtools.tsx +252 -42
  217. package/src/components/dev/MotionDevtools.usage.md +12 -4
  218. package/src/components/dev/motion-devtools.css +77 -2
  219. package/src/components/dev/slowmo-engine.ts +1 -1
  220. package/src/components/expressive/confetti/confetti.css +3 -3
  221. package/src/components/expressive/facebook-feed/facebook-feed.css +1 -1
  222. package/src/components/expressive/flow-field/FlowField.tsx +1 -1
  223. package/src/components/expressive/flow-field/flow-field.css +4 -4
  224. package/src/components/expressive/instagram-feed/instagram-feed.css +1 -1
  225. package/src/components/expressive/lens/lens.css +1 -2
  226. package/src/components/expressive/morphing-text/morphing-text.css +2 -2
  227. package/src/components/expressive/odometer/odometer.css +1 -1
  228. package/src/components/expressive/theme-transition/bloom.ts +88 -0
  229. package/src/components/expressive/theme-transition/paint.ts +296 -0
  230. package/src/components/expressive/theme-transition/scene.ts +38 -0
  231. package/src/components/expressive/theme-transition/theme-transition.css +48 -0
  232. package/src/components/expressive/theme-transition/theme-transition.ts +423 -0
  233. package/src/components/expressive/theme-transition/tide.ts +65 -0
  234. package/src/components/expressive/tiktok/tiktok.css +2 -3
  235. package/src/components/expressive/typing-lines/typing-lines.css +1 -1
  236. package/src/components/expressive/weight-field/weight-field.css +2 -2
  237. package/src/components/expressive/youtube/youtube.css +1 -1
  238. package/src/components/internal/glass/glass.css +1 -1
  239. package/src/components/internal/icon/Icon.tsx +2 -0
  240. package/src/components/internal/icon/icon.css +1 -1
  241. package/src/components/internal/menu/menu-surface.css +1 -1
  242. package/src/components/internal/overlay/overlay.css +1 -1
  243. package/src/components/internal/overlay/trigger.css +1 -1
  244. package/src/components/primitives/avatar/avatar.css +3 -2
  245. package/src/components/primitives/badge/badge.css +1 -1
  246. package/src/components/primitives/badge/digit-strip.css +1 -1
  247. package/src/components/primitives/button/Button.tsx +12 -26
  248. package/src/components/primitives/button/button-style.ts +28 -0
  249. package/src/components/primitives/button/button.css +21 -24
  250. package/src/components/primitives/checkbox/checkbox.css +1 -1
  251. package/src/components/primitives/collapse/collapse.css +8 -5
  252. package/src/components/primitives/input/input.css +7 -4
  253. package/src/components/primitives/radio-group/radio-group.css +6 -4
  254. package/src/components/primitives/spinner/Spinner.tsx +70 -0
  255. package/src/components/primitives/spinner/Spinner.usage.md +19 -0
  256. package/src/components/primitives/spinner/spinner.css +115 -0
  257. package/src/components/primitives/tag/tag.css +1 -1
  258. package/src/components/primitives/textarea/textarea.css +1 -1
  259. package/src/components/primitives/toggle/toggle.css +1 -1
  260. package/src/engine/animate.ts +10 -2
  261. package/src/mcp/server.ts +2 -1
  262. package/src/styles.css +3 -3
  263. package/src/tokens/base.css +5 -5
  264. package/src/tokens/color.css +8 -9
  265. package/src/tokens/component-styles.generated.ts +36 -38
  266. package/src/tokens/dark.css +8 -13
  267. package/src/tokens/decisions.css +5 -8
  268. package/src/tokens/elevation.css +18 -26
  269. package/src/tokens/glass.css +3 -2
  270. package/src/tokens/motion-defaults.generated.ts +1 -1
  271. package/src/tokens/motion-tokens.ts +3 -3
  272. package/src/tokens/motion.css +9 -9
  273. package/src/tokens/radius.css +3 -2
  274. package/src/tokens/reset.css +36 -0
  275. package/src/tokens/semantic.css +10 -18
  276. package/src/tokens/spacing.css +1 -1
  277. package/src/tokens/theme-store.ts +187 -0
  278. package/src/tokens/theme-sync.tsx +49 -2
  279. package/src/tokens/theme-tokens.generated.ts +124 -110
  280. package/src/tokens/theme.tsx +96 -24
  281. package/src/tokens/theme.usage.md +25 -24
  282. package/src/tokens/typography.css +4 -3
  283. package/tailwind.css +7 -13
  284. package/dist/chunk-6SUHSSOK.js +0 -25
  285. package/dist/chunk-6SUHSSOK.js.map +0 -1
  286. package/dist/chunk-BH4JFWXQ.js.map +0 -1
  287. package/dist/chunk-FEXUS4SV.js.map +0 -1
  288. package/dist/chunk-GOLSYGRA.js.map +0 -1
  289. package/dist/chunk-N2GJEO5Z.js.map +0 -1
  290. package/dist/chunk-UYSXJ7MH.js.map +0 -1
@@ -0,0 +1,88 @@
1
+ import { clamp, easeInOut, easeOut, sample, SAMPLE_MS, TAU, type BloomShape, type EffectFactory } from './scene';
2
+
3
+ const DURATION = { polarity: 1400, palette: 620 };
4
+ const MAX_RELIEF = 2;
5
+ const DEEPEST_CUT = 0.7;
6
+ const COVER_MARGIN = 1.02;
7
+ const SPIN = 0.35;
8
+ const HEX_SIDES = 6;
9
+ const STAR_LOBES = 8;
10
+ const STAR_CUT = 0.38;
11
+ const PETAL_LOBES = 5;
12
+ const PETAL_CUT = 0.26;
13
+ const CURVE_VERTICES = 120;
14
+ const BLOB_WAVES: readonly [lobes: number, depth: number, phase: number, drift: number][] = [
15
+ [2, 0.09, 0.6, 1.1],
16
+ [3, 0.07, 2.4, -0.8],
17
+ [5, 0.045, 4.1, 1.7],
18
+ ];
19
+
20
+ interface Outline {
21
+ vertices: number;
22
+ innermost: number;
23
+ radial(theta: number, progress: number): number;
24
+ turn(progress: number): number;
25
+ }
26
+
27
+ const lobed = (lobes: number, cut: number, vertices: number, spin: number): Outline => ({
28
+ vertices,
29
+ innermost: 1 - cut,
30
+ radial: (theta) => 1 - (cut * (1 - Math.cos(lobes * theta))) / 2,
31
+ turn: (progress) => spin * progress,
32
+ });
33
+
34
+ const OUTLINES: Record<Exclude<BloomShape, 'circle'>, (relief: number) => Outline> = {
35
+ hexagon: (relief) => ({
36
+ vertices: HEX_SIDES,
37
+ innermost: Math.cos(Math.PI / HEX_SIDES),
38
+ radial: () => 1,
39
+ turn: (progress) => Math.PI / HEX_SIDES + SPIN * relief * progress,
40
+ }),
41
+ star: (relief) => lobed(STAR_LOBES, clamp(STAR_CUT * relief, 0, DEEPEST_CUT), STAR_LOBES * 2, SPIN * relief),
42
+ petal: (relief) => lobed(PETAL_LOBES, clamp(PETAL_CUT * relief, 0, DEEPEST_CUT), CURVE_VERTICES, SPIN * relief),
43
+ blob: (relief) => {
44
+ const swell = Math.min(relief, DEEPEST_CUT / BLOB_WAVES.reduce((sum, [, depth]) => sum + depth, 0));
45
+ return {
46
+ vertices: CURVE_VERTICES,
47
+ innermost: 1 - BLOB_WAVES.reduce((sum, [, depth]) => sum + depth * swell, 0),
48
+ radial: (theta, progress) =>
49
+ BLOB_WAVES.reduce(
50
+ (r, [lobes, depth, phase, drift]) => r + depth * swell * Math.sin(lobes * theta + phase + drift * progress),
51
+ 1,
52
+ ),
53
+ turn: () => 0,
54
+ };
55
+ },
56
+ };
57
+
58
+ const polygonAt = (outline: Outline, reach: number, progress: number, ox: number, oy: number) => {
59
+ const turn = outline.turn(progress);
60
+ const points: string[] = [];
61
+ for (let i = 0; i < outline.vertices; i++) {
62
+ const theta = (i / outline.vertices) * TAU;
63
+ const r = reach * outline.radial(theta, progress);
64
+ const a = theta + turn;
65
+ points.push(`${(ox + Math.cos(a) * r).toFixed(1)}px ${(oy + Math.sin(a) * r).toFixed(1)}px`);
66
+ }
67
+ return `polygon(${points.join(', ')})`;
68
+ };
69
+
70
+ export const bloom: EffectFactory = (scene) => {
71
+ const { width: W, height: H, originX: ox, originY: oy, kind, shape } = scene;
72
+ const relief = clamp(scene.intensity, 0, MAX_RELIEF);
73
+ const farthest = Math.max(
74
+ Math.hypot(ox, oy),
75
+ Math.hypot(W - ox, oy),
76
+ Math.hypot(ox, H - oy),
77
+ Math.hypot(W - ox, H - oy),
78
+ );
79
+ const ease = kind === 'polarity' ? easeInOut : easeOut;
80
+ const outline = shape === 'circle' ? null : OUTLINES[shape](relief);
81
+ const reach = (farthest * COVER_MARGIN) / (outline?.innermost ?? 1);
82
+ const at = ` at ${ox.toFixed(1)}px ${oy.toFixed(1)}px)`;
83
+ const clipAt = (p: number) => {
84
+ const e = ease(p);
85
+ return outline ? polygonAt(outline, reach * e, e, ox, oy) : `circle(${(reach * e).toFixed(1)}px${at}`;
86
+ };
87
+ return { duration: DURATION[kind], clips: sample(DURATION[kind], SAMPLE_MS, clipAt) };
88
+ };
@@ -0,0 +1,296 @@
1
+ import { clamp, sample, TAU, type EffectFactory } from './scene';
2
+
3
+ const DURATION = { polarity: 2200, palette: 800 };
4
+ const PLANS = {
5
+ polarity: { rMax: 0.36, rMin: 0.11, bursts: [6, 7], L: 0.2, hold: 0.15, gap: 0.075, drops: [4, 8], over: 1.7 },
6
+ palette: { rMax: 0.5, rMin: 0.2, bursts: [4, 4], L: 0.34, hold: 0.14, gap: 0.08, drops: [2, 4], over: 1.1 },
7
+ };
8
+ const POP_SHARE = 0.14;
9
+ const COVERAGE = 0.84;
10
+ const MIN_CELL = 28;
11
+ const MAX_CELL = 48;
12
+ const CELLS_ACROSS = 20;
13
+ const MIN_INTENSITY = 0.4;
14
+ const MAX_INTENSITY = 1.8;
15
+ const HERO = { x: 0.3, y: 0.27, jitter: 0.05, swell: 0.1 };
16
+ const INSET = { x: 0.1, y: 0.12, bottom: 0.88 };
17
+ const POOL_INSET = { x: 0.09, right: 0.9, y: 0.12, bottom: 0.9 };
18
+ const NUDGE_INSET = { x: 0.08, right: 0.92, y: 0.1, bottom: 0.9 };
19
+ const CORNER = { x: 0.42, y: 0.58, jitter: 0.3 };
20
+ const ZONE_JITTER = 0.6;
21
+ const SECOND_PICK_CHANCE = 0.3;
22
+ const RUN_CURVE = 1.4;
23
+ const ROUNDING = 0.6;
24
+ const SPLAT_SAMPLE_MS = 32;
25
+
26
+ const f = (v: number) => Math.round(v * 10) / 10;
27
+
28
+ interface Drop {
29
+ a: number;
30
+ d: number;
31
+ r: number;
32
+ delay: number;
33
+ }
34
+
35
+ interface Splat {
36
+ x: number;
37
+ y: number;
38
+ R: number;
39
+ t0: number;
40
+ Rf: number;
41
+ geo: Float32Array;
42
+ geoR: Float32Array;
43
+ x0: number;
44
+ y0: number;
45
+ xr0: number;
46
+ yr0: number;
47
+ drops: Drop[];
48
+ }
49
+
50
+ interface Seed {
51
+ x: number;
52
+ y: number;
53
+ R: number;
54
+ t0: number;
55
+ }
56
+
57
+ interface Spot {
58
+ bl: boolean;
59
+ x: number;
60
+ y: number;
61
+ d: number;
62
+ }
63
+
64
+ const controlPoints = (Q: Float32Array, pn: number) => {
65
+ const g = new Float32Array(pn * 6);
66
+ for (let j = 0; j < pn; j++) {
67
+ const a = ((j - 1 + pn) % pn) * 2;
68
+ const b = j * 2;
69
+ const c = ((j + 1) % pn) * 2;
70
+ const d = ((j + 2) % pn) * 2;
71
+ const o = j * 6;
72
+ g[o] = Q[b] + (Q[c] - Q[a]) / 6;
73
+ g[o + 1] = Q[b + 1] + (Q[c + 1] - Q[a + 1]) / 6;
74
+ g[o + 2] = Q[c] - (Q[d] - Q[b]) / 6;
75
+ g[o + 3] = Q[c + 1] - (Q[d + 1] - Q[b + 1]) / 6;
76
+ g[o + 4] = Q[c];
77
+ g[o + 5] = Q[c + 1];
78
+ }
79
+ return g;
80
+ };
81
+
82
+ export const paint: EffectFactory = (scene) => {
83
+ const { width: W, height: H, kind } = scene;
84
+ const P = PLANS[kind];
85
+ const rnd = Math.random;
86
+ const intensity = clamp(scene.intensity, MIN_INTENSITY, MAX_INTENSITY);
87
+ const m = Math.min(W, H);
88
+ const rMax = m * P.rMax;
89
+ const rMin = m * P.rMin;
90
+ const cell = Math.max(MIN_CELL, Math.min(MAX_CELL, m / CELLS_ACROSS));
91
+ const cols = Math.ceil(W / cell);
92
+ const rows = Math.ceil(H / cell);
93
+ const n = cols * rows;
94
+ const cx = new Float32Array(n);
95
+ const cy = new Float32Array(n);
96
+ for (let i = 0; i < n; i++) {
97
+ cx[i] = ((i % cols) + 0.5) * cell;
98
+ cy[i] = (Math.floor(i / cols) + 0.5) * cell;
99
+ }
100
+ const seeds: Seed[] = [
101
+ {
102
+ x: W * (HERO.x + HERO.jitter * (rnd() - 0.5)),
103
+ y: H * (HERO.y + HERO.jitter * (rnd() - 0.5)),
104
+ R: rMax * (1 + HERO.swell * rnd()),
105
+ t0: 0,
106
+ },
107
+ ];
108
+ const bursts = P.bursts[0] + Math.floor(rnd() * (P.bursts[1] - P.bursts[0] + 1));
109
+ const L = P.L;
110
+ const edgeAt = (s: Seed, p: number) => {
111
+ if (p <= s.t0) return 0;
112
+ const e0 = s.t0 + POP_SHARE * L;
113
+ const ps = Math.max(0, Math.min(1, (p - e0) / Math.max(0.01, 1 - e0)));
114
+ return s.R * (0.1 + 0.9 * Math.min(1, (p - s.t0) / L)) * (1 + 0.35 * Math.pow(ps, RUN_CURVE));
115
+ };
116
+ const cz = W >= H ? (bursts > 4 ? 3 : 2) : 2;
117
+ const rz = bursts > 4 ? (W >= H ? 2 : 3) : 2;
118
+ const zw = W / cz;
119
+ const zh = H / rz;
120
+ const zx0 = Math.min(cz - 1, Math.floor(seeds[0].x / zw));
121
+ const zy0 = Math.min(rz - 1, Math.floor(seeds[0].y / zh));
122
+ const pool: Spot[] = [];
123
+ for (let r = 0; r < rz; r++) {
124
+ for (let c = 0; c < cz; c++) {
125
+ if (c === zx0 && r === zy0) continue;
126
+ const bl = c === 0 && r === rz - 1;
127
+ const jitter = bl ? CORNER.jitter : ZONE_JITTER;
128
+ pool.push({
129
+ bl,
130
+ x: clamp((c + (bl ? CORNER.x : 0.5) + jitter * (rnd() - 0.5)) * zw, W * POOL_INSET.x, W * POOL_INSET.right),
131
+ y: clamp((r + (bl ? CORNER.y : 0.5) + jitter * (rnd() - 0.5)) * zh, H * POOL_INSET.y, H * POOL_INSET.bottom),
132
+ d: Infinity,
133
+ });
134
+ }
135
+ }
136
+ while (seeds.length < bursts) {
137
+ const t0 = P.hold + (seeds.length - 1) * P.gap;
138
+ let pt: { x: number; y: number };
139
+ if (pool.length) {
140
+ for (const q of pool) {
141
+ q.d = Infinity;
142
+ for (const s of seeds) q.d = Math.min(q.d, Math.hypot(q.x - s.x, q.y - s.y));
143
+ }
144
+ pool.sort((a, b) => (b.bl ? 1e6 : b.d) - (a.bl ? 1e6 : a.d));
145
+ pt = pool.splice(!pool[0].bl && pool.length > 1 && rnd() < SECOND_PICK_CHANCE ? 1 : 0, 1)[0];
146
+ } else {
147
+ const cands: [number, number][] = [];
148
+ for (let i = 0; i < n; i += 2) {
149
+ if (cx[i] < W * INSET.x || cx[i] > W * (1 - INSET.x) || cy[i] < H * INSET.y || cy[i] > H * INSET.bottom)
150
+ continue;
151
+ let d = Infinity;
152
+ for (const s of seeds) d = Math.min(d, Math.hypot(cx[i] - s.x, cy[i] - s.y) - edgeAt(s, t0));
153
+ cands.push([d, i]);
154
+ }
155
+ cands.sort((a, b) => b[0] - a[0]);
156
+ const i = cands[Math.min(cands.length - 1, Math.floor(rnd() * rnd() * 4))][1];
157
+ pt = { x: cx[i] + (rnd() - 0.5) * cell * 2, y: cy[i] + (rnd() - 0.5) * cell * 2 };
158
+ }
159
+ let d = Infinity;
160
+ let nearest: Seed | null = null;
161
+ for (const s of seeds) {
162
+ const g = Math.hypot(pt.x - s.x, pt.y - s.y) - edgeAt(s, t0);
163
+ if (g < d) {
164
+ d = g;
165
+ nearest = s;
166
+ }
167
+ }
168
+ if (d < rMin && nearest) {
169
+ const dx = pt.x - nearest.x;
170
+ const dy = pt.y - nearest.y;
171
+ const len = Math.hypot(dx, dy) || 1;
172
+ const push = rMin - d;
173
+ pt.x = clamp(pt.x + (dx / len) * push, W * NUDGE_INSET.x, W * NUDGE_INSET.right);
174
+ pt.y = clamp(pt.y + (dy / len) * push, H * NUDGE_INSET.y, H * NUDGE_INSET.bottom);
175
+ d = rMin;
176
+ }
177
+ seeds.push({ x: pt.x, y: pt.y, R: clamp(d * (0.7 + 0.25 * rnd()), rMin, rMax * 0.85), t0 });
178
+ }
179
+ const own = seeds.map(() => 0);
180
+ for (let i = 0; i < n; i++) {
181
+ let k = 0;
182
+ let bd = Infinity;
183
+ seeds.forEach((s, j) => {
184
+ const d = Math.hypot(cx[i] - s.x, cy[i] - s.y) - s.R;
185
+ if (d < bd) {
186
+ bd = d;
187
+ k = j;
188
+ }
189
+ });
190
+ own[k] = Math.max(own[k], bd + seeds[k].R);
191
+ }
192
+ const splats: Splat[] = seeds.map((s, i) => {
193
+ const Rf = Math.max(s.R * 1.05, (own[i] / COVERAGE + cell * 0.7) * 1.02);
194
+ const rot = rnd() * TAU;
195
+ const pn = Math.max(20, Math.min(36, Math.round(s.R / 9)));
196
+ const harmonics = [
197
+ [2, 0.035 + 0.035 * rnd(), rnd() * TAU],
198
+ [3, 0.02 + 0.03 * rnd(), rnd() * TAU],
199
+ [5, 0.01 + 0.015 * rnd(), rnd() * TAU],
200
+ ];
201
+ const bumps = Array.from({ length: 3 + Math.floor(rnd() * 3) }, () => [
202
+ rnd() * TAU,
203
+ 0.14 + 0.12 * rnd(),
204
+ 0.14 + 0.28 * rnd(),
205
+ ]);
206
+ const pts = new Float32Array(pn * 2);
207
+ for (let j = 0; j < pn; j++) {
208
+ const th = (j / pn) * TAU;
209
+ let r = 1;
210
+ for (const [k, a, ph] of harmonics) r += a * Math.cos(k * th + ph);
211
+ for (const [bt, bw, bh] of bumps) {
212
+ let dt = th - bt;
213
+ dt = Math.atan2(Math.sin(dt), Math.cos(dt));
214
+ r += bh * Math.exp((-dt * dt) / (2 * bw * bw));
215
+ }
216
+ pts[2 * j] = r * Math.cos(th + rot);
217
+ pts[2 * j + 1] = r * Math.sin(th + rot);
218
+ }
219
+ const rp = new Float32Array(pn * 2);
220
+ for (let j = 0; j < pn; j++) {
221
+ const th = (j / pn) * TAU + rot;
222
+ rp[2 * j] = Math.cos(th);
223
+ rp[2 * j + 1] = Math.sin(th);
224
+ }
225
+ const size = clamp((s.R - rMin) / Math.max(1, rMax - rMin), 0, 1);
226
+ const K = Math.round((P.drops[0] + (P.drops[1] - P.drops[0]) * size) * Math.min(1.4, Math.max(0.6, intensity)));
227
+ const drops: Drop[] = Array.from({ length: K }, () => ({
228
+ a: rnd() * TAU,
229
+ d: 1.25 + 0.6 * rnd(),
230
+ r: 0.04 + 0.07 * rnd(),
231
+ delay: rnd() * 0.25,
232
+ }));
233
+ return {
234
+ ...s,
235
+ Rf,
236
+ geo: controlPoints(pts, pn),
237
+ geoR: controlPoints(rp, pn),
238
+ x0: pts[0],
239
+ y0: pts[1],
240
+ xr0: rp[0],
241
+ yr0: rp[1],
242
+ drops,
243
+ };
244
+ });
245
+ const over = P.over * intensity;
246
+
247
+ const shape = (p: number) => {
248
+ let d = '';
249
+ for (const s of splats) {
250
+ const uu = clamp((p - s.t0) / L, 0, 1);
251
+ let sc: number;
252
+ let v = 0;
253
+ let mix = 0;
254
+ if (uu < POP_SHARE) {
255
+ const q = uu / POP_SHARE;
256
+ sc = 0.1 * q * q * (3 - 2 * q);
257
+ } else {
258
+ v = (uu - POP_SHARE) / (1 - POP_SHARE);
259
+ const w = v - 1;
260
+ sc = 0.1 + 0.9 * (1 + (over + 1) * w * w * w + over * w * w);
261
+ const e0 = s.t0 + POP_SHARE * L;
262
+ const es = Math.pow(Math.min(1, (p - e0) / Math.max(0.01, 1 - e0)), RUN_CURVE);
263
+ sc += (s.Rf / s.R - 1) * es;
264
+ mix = ROUNDING * es;
265
+ }
266
+ const k = s.R * sc;
267
+ const { x, y, geo: g, geoR: gr } = s;
268
+ const mm = 1 - mix;
269
+ const X = (o: number) => f(x + (mm * g[o] + mix * gr[o]) * k);
270
+ const Y = (o: number) => f(y + (mm * g[o] + mix * gr[o]) * k);
271
+ let b = `M${f(x + (mm * s.x0 + mix * s.xr0) * k)} ${f(y + (mm * s.y0 + mix * s.yr0) * k)}`;
272
+ for (let o = 0; o < g.length; o += 6) b += `C${X(o)} ${Y(o + 1)} ${X(o + 2)} ${Y(o + 3)} ${X(o + 4)} ${Y(o + 5)}`;
273
+ d += b + 'Z';
274
+ for (const dr of s.drops) {
275
+ const w = clamp((v - dr.delay) / (1 - dr.delay), 0, 1);
276
+ const e = 1 - Math.pow(1 - w, 3);
277
+ const dist = s.R * (sc * 0.9 * (1 - e) + dr.d * e);
278
+ const rr = s.R * dr.r * Math.min(1, w * 4);
279
+ const rx = rr * (1 + 1.8 * (1 - e));
280
+ const ca = Math.cos(dr.a);
281
+ const sa = Math.sin(dr.a);
282
+ const px = x + ca * dist;
283
+ const py = y + sa * dist;
284
+ const x1 = f(px - ca * rx);
285
+ const y1 = f(py - sa * rx);
286
+ const x2 = f(px + ca * rx);
287
+ const y2 = f(py + sa * rx);
288
+ const deg = f((dr.a * 180) / Math.PI);
289
+ d += `M${x1} ${y1}A${f(rx)} ${f(rr)} ${deg} 1 1 ${x2} ${y2}A${f(rx)} ${f(rr)} ${deg} 1 1 ${x1} ${y1}Z`;
290
+ }
291
+ }
292
+ return `path("${d}")`;
293
+ };
294
+
295
+ return { duration: DURATION[kind], clips: sample(DURATION[kind], SPLAT_SAMPLE_MS, shape) };
296
+ };
@@ -0,0 +1,38 @@
1
+ export type ThemeChangeKind = 'polarity' | 'palette';
2
+ export type SweepDirection = 'down' | 'up' | 'right' | 'left';
3
+ export type BloomShape = 'circle' | 'hexagon' | 'star' | 'petal' | 'blob';
4
+
5
+ export interface Scene {
6
+ width: number;
7
+ height: number;
8
+ originX: number;
9
+ originY: number;
10
+ kind: ThemeChangeKind;
11
+ direction: SweepDirection;
12
+ intensity: number;
13
+ shape: BloomShape;
14
+ }
15
+
16
+ export interface Effect {
17
+ duration: number;
18
+ clips: readonly string[];
19
+ }
20
+
21
+ export type EffectFactory = (scene: Scene) => Effect;
22
+
23
+ export const TAU = Math.PI * 2;
24
+
25
+ export const clamp = (value: number, low: number, high: number) => Math.max(low, Math.min(high, value));
26
+
27
+ export const easeInOut = (p: number) => (p < 0.5 ? 2 * p * p : 1 - Math.pow(-2 * p + 2, 2) / 2);
28
+
29
+ export const easeOut = (p: number) => 1 - Math.pow(1 - p, 3);
30
+
31
+ export const SAMPLE_MS = 8;
32
+
33
+ export const sample = <T>(duration: number, step: number, at: (progress: number, elapsed: number) => T): T[] => {
34
+ const last = Math.ceil(duration / step);
35
+ const table: T[] = [];
36
+ for (let i = 0; i <= last; i++) table.push(at(i / last, (i / last) * duration));
37
+ return table;
38
+ };
@@ -0,0 +1,48 @@
1
+ @layer zyncat.reset, zyncat.tokens, zyncat.components;
2
+
3
+ @layer zyncat.components {
4
+ .zc-theme-transition {
5
+ /* The z-index the arriving page paints at, above every panel it covers. */
6
+ --theme-transition-layer: var(--layer-infinity);
7
+
8
+ position: fixed;
9
+ inset: 0;
10
+ z-index: var(--theme-transition-layer);
11
+ pointer-events: none;
12
+ }
13
+
14
+ .zc-theme-transition {
15
+ overflow: hidden;
16
+ isolation: isolate;
17
+ color: var(--text-body);
18
+ background: var(--bg-app);
19
+ transition: none;
20
+ will-change: clip-path;
21
+ }
22
+ .zc-theme-transition__inner {
23
+ box-sizing: border-box;
24
+ }
25
+ .zc-theme-transition *,
26
+ .zc-theme-transition *::before,
27
+ .zc-theme-transition *::after {
28
+ transition: none !important;
29
+ -webkit-backdrop-filter: none !important;
30
+ backdrop-filter: none !important;
31
+ }
32
+
33
+ .zc-theme-transition__probe {
34
+ position: fixed;
35
+ inset: 0 auto auto 0;
36
+ visibility: hidden;
37
+ pointer-events: none;
38
+ color: var(--bg-app);
39
+ background-color: var(--text-body);
40
+ border-color: var(--accent);
41
+ }
42
+
43
+ [data-theme-settling] *,
44
+ [data-theme-settling] *::before,
45
+ [data-theme-settling] *::after {
46
+ transition: none !important;
47
+ }
48
+ }