@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.
- package/README.md +32 -202
- package/dist/alert.css +1 -1
- package/dist/alert.js +18 -10
- package/dist/alert.js.map +1 -1
- package/dist/avatar.css +3 -2
- package/dist/badge.css +1 -1
- package/dist/bloom-HV23M4AW.js +81 -0
- package/dist/bloom-HV23M4AW.js.map +1 -0
- package/dist/button.css +21 -24
- package/dist/button.js +3 -1
- package/dist/checkbox.css +1 -1
- package/dist/chunk-2YGHPQ66.js +16 -0
- package/dist/chunk-2YGHPQ66.js.map +1 -0
- package/dist/{chunk-K45CWVHS.js → chunk-3MLUH2QL.js} +4 -4
- package/dist/{chunk-K45CWVHS.js.map → chunk-3MLUH2QL.js.map} +1 -1
- package/dist/{chunk-FVPNICF4.js → chunk-4PQDVK23.js} +4 -4
- package/dist/{chunk-FVPNICF4.js.map → chunk-4PQDVK23.js.map} +1 -1
- package/dist/{chunk-FLQVOSFC.js → chunk-6IXLW7QA.js} +7 -7
- package/dist/{chunk-FLQVOSFC.js.map → chunk-6IXLW7QA.js.map} +1 -1
- package/dist/chunk-7NHY2CRA.js +132 -0
- package/dist/chunk-7NHY2CRA.js.map +1 -0
- package/dist/{chunk-BH4JFWXQ.js → chunk-7VTWJL72.js} +19 -16
- package/dist/chunk-7VTWJL72.js.map +1 -0
- package/dist/chunk-7ZSIUUC3.js +50 -0
- package/dist/chunk-7ZSIUUC3.js.map +1 -0
- package/dist/{chunk-6X3G4GIM.js → chunk-DH7DT6EO.js} +3 -3
- package/dist/{chunk-6X3G4GIM.js.map → chunk-DH7DT6EO.js.map} +1 -1
- package/dist/{chunk-QGVFFT2B.js → chunk-EOWWVFBF.js} +3 -3
- package/dist/{chunk-QGVFFT2B.js.map → chunk-EOWWVFBF.js.map} +1 -1
- package/dist/{chunk-RBSHRRNO.js → chunk-FLDIRXFU.js} +5 -5
- package/dist/{chunk-RBSHRRNO.js.map → chunk-FLDIRXFU.js.map} +1 -1
- package/dist/{chunk-5GBV45YD.js → chunk-GWCBTD63.js} +3 -3
- package/dist/{chunk-5GBV45YD.js.map → chunk-GWCBTD63.js.map} +1 -1
- package/dist/chunk-GZ6UMHCK.js +103 -0
- package/dist/chunk-GZ6UMHCK.js.map +1 -0
- package/dist/{chunk-FEXUS4SV.js → chunk-HWDIVGME.js} +11 -5
- package/dist/chunk-HWDIVGME.js.map +1 -0
- package/dist/chunk-KSAJ6DED.js +16 -0
- package/dist/chunk-KSAJ6DED.js.map +1 -0
- package/dist/{chunk-UYSXJ7MH.js → chunk-LH2UIEKN.js} +7 -17
- package/dist/chunk-LH2UIEKN.js.map +1 -0
- package/dist/{chunk-CAXQJSIE.js → chunk-M2A6PZ7J.js} +6 -6
- package/dist/{chunk-CAXQJSIE.js.map → chunk-M2A6PZ7J.js.map} +1 -1
- package/dist/chunk-NYQQH4R5.js +40 -0
- package/dist/chunk-NYQQH4R5.js.map +1 -0
- package/dist/{chunk-BTF6DAE3.js → chunk-ODRO3KS6.js} +4 -4
- package/dist/{chunk-BTF6DAE3.js.map → chunk-ODRO3KS6.js.map} +1 -1
- package/dist/{chunk-GJTHWB6O.js → chunk-QDAN43B6.js} +3 -3
- package/dist/{chunk-GJTHWB6O.js.map → chunk-QDAN43B6.js.map} +1 -1
- package/dist/{chunk-MDSRZ4QR.js → chunk-RY35IU3G.js} +3 -3
- package/dist/{chunk-MDSRZ4QR.js.map → chunk-RY35IU3G.js.map} +1 -1
- package/dist/{chunk-GOLSYGRA.js → chunk-TBLPZQSI.js} +84 -48
- package/dist/chunk-TBLPZQSI.js.map +1 -0
- package/dist/{chunk-5X3MJRIM.js → chunk-UKPX3RIP.js} +3 -3
- package/dist/{chunk-5X3MJRIM.js.map → chunk-UKPX3RIP.js.map} +1 -1
- package/dist/{chunk-CFRGQJ23.js → chunk-VZXML7EH.js} +4 -4
- package/dist/{chunk-CFRGQJ23.js.map → chunk-VZXML7EH.js.map} +1 -1
- package/dist/{chunk-PWQVSVXR.js → chunk-WC45VSST.js} +8 -8
- package/dist/{chunk-PWQVSVXR.js.map → chunk-WC45VSST.js.map} +1 -1
- package/dist/chunk-WQKWPI6V.js +196 -0
- package/dist/chunk-WQKWPI6V.js.map +1 -0
- package/dist/{chunk-N2GJEO5Z.js → chunk-ZHMOH62S.js} +4 -4
- package/dist/chunk-ZHMOH62S.js.map +1 -0
- package/dist/cli.js +259 -43
- package/dist/collapse.css +8 -5
- package/dist/confetti.css +3 -3
- package/dist/confetti.js +2 -2
- package/dist/date-field.js +16 -14
- package/dist/date-field.js.map +1 -1
- package/dist/date-picker.css +168 -43
- package/dist/date-range-field.js +38 -23
- package/dist/date-range-field.js.map +1 -1
- package/dist/datetime-field.js +17 -15
- package/dist/datetime-field.js.map +1 -1
- package/dist/dialog.css +4 -3
- package/dist/dialog.js +8 -8
- package/dist/digit-strip.css +1 -1
- package/dist/dropdown.css +1 -1
- package/dist/dropdown.js +8 -8
- package/dist/emoji-picker.js +14 -14
- package/dist/facebook-feed.css +1 -1
- package/dist/flow-field.css +4 -4
- package/dist/flow-field.js +3 -3
- package/dist/flow-field.js.map +1 -1
- package/dist/glide.js +3 -3
- package/dist/icon.css +1 -1
- package/dist/input.css +7 -4
- package/dist/instagram-feed.css +1 -1
- package/dist/instagram-feed.js +2 -2
- package/dist/lens.css +1 -2
- package/dist/lens.js +2 -2
- package/dist/mcp.js +1 -1
- package/dist/menu-surface.css +1 -1
- package/dist/modal.css +1 -1
- package/dist/modal.js +6 -6
- package/dist/morphing-text.css +2 -2
- package/dist/morphing-text.js +2 -2
- package/dist/motion-devtools.css +77 -2
- package/dist/motion-devtools.js +194 -37
- package/dist/motion-devtools.js.map +1 -1
- package/dist/motion-tokens.js +1 -1
- package/dist/multi-select.js +9 -9
- package/dist/number-field.js +3 -3
- package/dist/odometer.css +1 -1
- package/dist/odometer.js +2 -2
- package/dist/overlay.css +1 -1
- package/dist/pagination.css +1 -1
- package/dist/pagination.js +6 -4
- package/dist/pagination.js.map +1 -1
- package/dist/paint-CJQCM6ZO.js +260 -0
- package/dist/paint-CJQCM6ZO.js.map +1 -0
- package/dist/popover.css +1 -1
- package/dist/popover.js +6 -6
- package/dist/radio-group.css +6 -4
- package/dist/radio-group.js +6 -6
- package/dist/select.css +1 -1
- package/dist/select.js +9 -9
- package/dist/sheet.css +1 -1
- package/dist/sheet.js +7 -7
- package/dist/spinner.css +115 -0
- package/dist/spinner.js +4 -0
- package/dist/spinner.js.map +1 -0
- package/dist/status-badge.js +2 -2
- package/dist/styles.css +1 -1
- package/dist/support-rail.css +76 -238
- package/dist/support-rail.js +97 -105
- package/dist/support-rail.js.map +1 -1
- package/dist/table.css +2 -2
- package/dist/table.js +8 -6
- package/dist/table.js.map +1 -1
- package/dist/tabs.css +10 -14
- package/dist/tabs.js +6 -6
- package/dist/tag.css +1 -1
- package/dist/tag.js +6 -6
- package/dist/text-field.js +3 -3
- package/dist/textarea.css +1 -1
- package/dist/textarea.js +2 -2
- package/dist/theme-grid.js +11 -0
- package/dist/theme-grid.js.map +1 -0
- package/dist/theme-switcher.css +107 -0
- package/dist/theme-switcher.js +70 -0
- package/dist/theme-switcher.js.map +1 -0
- package/dist/theme-transition-LLC644ZR.js +346 -0
- package/dist/theme-transition-LLC644ZR.js.map +1 -0
- package/dist/theme-transition.css +48 -0
- package/dist/theme.js +57 -26
- package/dist/theme.js.map +1 -1
- package/dist/tide-DJZMDAFT.js +57 -0
- package/dist/tide-DJZMDAFT.js.map +1 -0
- package/dist/tiktok.css +2 -3
- package/dist/tiktok.js +2 -2
- package/dist/time-field.js +4 -4
- package/dist/toast.css +2 -14
- package/dist/toast.js +11 -9
- package/dist/toast.js.map +1 -1
- package/dist/toggle-tag.js +2 -2
- package/dist/toggle.css +1 -1
- package/dist/tooltip.css +1 -1
- package/dist/tooltip.js +5 -5
- package/dist/trigger.css +1 -1
- package/dist/types/components/composites/date-picker/month-jump.d.ts +11 -0
- package/dist/types/components/composites/theme-switcher/ThemeGrid.d.ts +20 -0
- package/dist/types/components/composites/theme-switcher/ThemeSwitcher.d.ts +24 -0
- package/dist/types/components/compound/support-rail/SupportRail.d.ts +10 -8
- package/dist/types/components/dev/MotionDevtools.d.ts +10 -5
- package/dist/types/components/expressive/theme-transition/bloom.d.ts +2 -0
- package/dist/types/components/expressive/theme-transition/paint.d.ts +2 -0
- package/dist/types/components/expressive/theme-transition/scene.d.ts +24 -0
- package/dist/types/components/expressive/theme-transition/theme-transition.d.ts +19 -0
- package/dist/types/components/expressive/theme-transition/tide.d.ts +2 -0
- package/dist/types/components/internal/icon/Icon.d.ts +1 -0
- package/dist/types/components/primitives/button/Button.d.ts +9 -12
- package/dist/types/components/primitives/button/button-style.d.ts +15 -0
- package/dist/types/components/primitives/spinner/Spinner.d.ts +27 -0
- package/dist/types/engine/animate.d.ts +1 -0
- package/dist/types/tokens/component-styles.generated.d.ts +35 -38
- package/dist/types/tokens/motion-tokens.d.ts +2 -2
- package/dist/types/tokens/theme-store.d.ts +47 -0
- package/dist/types/tokens/theme-sync.d.ts +7 -1
- package/dist/types/tokens/theme-tokens.generated.d.ts +121 -109
- package/dist/types/tokens/theme.d.ts +28 -5
- package/dist/typing-lines.css +1 -1
- package/dist/typing-lines.js +2 -2
- package/dist/weight-field.css +2 -2
- package/dist/youtube.css +1 -1
- package/dist/youtube.js +2 -2
- package/package.json +25 -31
- package/skills/zyncat-ui/references/components.md +5 -2
- package/src/components/composites/alert/Alert.tsx +7 -3
- package/src/components/composites/alert/alert.css +1 -1
- package/src/components/composites/date-picker/calendar-panel.tsx +10 -4
- package/src/components/composites/date-picker/date-picker.css +168 -43
- package/src/components/composites/date-picker/month-jump.tsx +192 -0
- package/src/components/composites/date-picker/range-panel.tsx +20 -5
- package/src/components/composites/dialog/dialog.css +4 -3
- package/src/components/composites/dropdown/dropdown.css +1 -1
- package/src/components/composites/emoji-picker/styles.css +1 -1
- package/src/components/composites/modal/modal.css +1 -1
- package/src/components/composites/pagination/pagination.css +1 -1
- package/src/components/composites/popover/popover.css +1 -1
- package/src/components/composites/select/select.css +1 -1
- package/src/components/composites/sheet/sheet.css +1 -1
- package/src/components/composites/table/table.css +2 -2
- package/src/components/composites/tabs/tabs.css +10 -14
- package/src/components/composites/theme-switcher/ThemeGrid.tsx +133 -0
- package/src/components/composites/theme-switcher/ThemeGrid.usage.md +20 -0
- package/src/components/composites/theme-switcher/ThemeSwitcher.tsx +75 -0
- package/src/components/composites/theme-switcher/ThemeSwitcher.usage.md +21 -0
- package/src/components/composites/theme-switcher/theme-switcher.css +107 -0
- package/src/components/composites/toast/Toast.tsx +2 -1
- package/src/components/composites/toast/toast.css +2 -14
- package/src/components/composites/tooltip/tooltip.css +1 -1
- package/src/components/compound/support-rail/SupportRail.tsx +116 -128
- package/src/components/compound/support-rail/SupportRail.usage.md +7 -6
- package/src/components/compound/support-rail/support-rail.css +76 -238
- package/src/components/dev/MotionDevtools.tsx +252 -42
- package/src/components/dev/MotionDevtools.usage.md +12 -4
- package/src/components/dev/motion-devtools.css +77 -2
- package/src/components/dev/slowmo-engine.ts +1 -1
- package/src/components/expressive/confetti/confetti.css +3 -3
- package/src/components/expressive/facebook-feed/facebook-feed.css +1 -1
- package/src/components/expressive/flow-field/FlowField.tsx +1 -1
- package/src/components/expressive/flow-field/flow-field.css +4 -4
- package/src/components/expressive/instagram-feed/instagram-feed.css +1 -1
- package/src/components/expressive/lens/lens.css +1 -2
- package/src/components/expressive/morphing-text/morphing-text.css +2 -2
- package/src/components/expressive/odometer/odometer.css +1 -1
- package/src/components/expressive/theme-transition/bloom.ts +88 -0
- package/src/components/expressive/theme-transition/paint.ts +296 -0
- package/src/components/expressive/theme-transition/scene.ts +38 -0
- package/src/components/expressive/theme-transition/theme-transition.css +48 -0
- package/src/components/expressive/theme-transition/theme-transition.ts +423 -0
- package/src/components/expressive/theme-transition/tide.ts +65 -0
- package/src/components/expressive/tiktok/tiktok.css +2 -3
- package/src/components/expressive/typing-lines/typing-lines.css +1 -1
- package/src/components/expressive/weight-field/weight-field.css +2 -2
- package/src/components/expressive/youtube/youtube.css +1 -1
- package/src/components/internal/glass/glass.css +1 -1
- package/src/components/internal/icon/Icon.tsx +2 -0
- package/src/components/internal/icon/icon.css +1 -1
- package/src/components/internal/menu/menu-surface.css +1 -1
- package/src/components/internal/overlay/overlay.css +1 -1
- package/src/components/internal/overlay/trigger.css +1 -1
- package/src/components/primitives/avatar/avatar.css +3 -2
- package/src/components/primitives/badge/badge.css +1 -1
- package/src/components/primitives/badge/digit-strip.css +1 -1
- package/src/components/primitives/button/Button.tsx +12 -26
- package/src/components/primitives/button/button-style.ts +28 -0
- package/src/components/primitives/button/button.css +21 -24
- package/src/components/primitives/checkbox/checkbox.css +1 -1
- package/src/components/primitives/collapse/collapse.css +8 -5
- package/src/components/primitives/input/input.css +7 -4
- package/src/components/primitives/radio-group/radio-group.css +6 -4
- package/src/components/primitives/spinner/Spinner.tsx +70 -0
- package/src/components/primitives/spinner/Spinner.usage.md +19 -0
- package/src/components/primitives/spinner/spinner.css +115 -0
- package/src/components/primitives/tag/tag.css +1 -1
- package/src/components/primitives/textarea/textarea.css +1 -1
- package/src/components/primitives/toggle/toggle.css +1 -1
- package/src/engine/animate.ts +10 -2
- package/src/mcp/server.ts +2 -1
- package/src/styles.css +3 -3
- package/src/tokens/base.css +5 -5
- package/src/tokens/color.css +8 -9
- package/src/tokens/component-styles.generated.ts +36 -38
- package/src/tokens/dark.css +8 -13
- package/src/tokens/decisions.css +5 -8
- package/src/tokens/elevation.css +18 -26
- package/src/tokens/glass.css +3 -2
- package/src/tokens/motion-defaults.generated.ts +1 -1
- package/src/tokens/motion-tokens.ts +3 -3
- package/src/tokens/motion.css +9 -9
- package/src/tokens/radius.css +3 -2
- package/src/tokens/reset.css +36 -0
- package/src/tokens/semantic.css +10 -18
- package/src/tokens/spacing.css +1 -1
- package/src/tokens/theme-store.ts +187 -0
- package/src/tokens/theme-sync.tsx +49 -2
- package/src/tokens/theme-tokens.generated.ts +124 -110
- package/src/tokens/theme.tsx +96 -24
- package/src/tokens/theme.usage.md +25 -24
- package/src/tokens/typography.css +4 -3
- package/tailwind.css +7 -13
- package/dist/chunk-6SUHSSOK.js +0 -25
- package/dist/chunk-6SUHSSOK.js.map +0 -1
- package/dist/chunk-BH4JFWXQ.js.map +0 -1
- package/dist/chunk-FEXUS4SV.js.map +0 -1
- package/dist/chunk-GOLSYGRA.js.map +0 -1
- package/dist/chunk-N2GJEO5Z.js.map +0 -1
- package/dist/chunk-UYSXJ7MH.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,172 +1,73 @@
|
|
|
1
1
|
# Zyncat UI
|
|
2
2
|
|
|
3
|
-
A premium React design system
|
|
4
|
-
consistently. Restraint, calm motion, no Tailwind, no CSS-in-JS, no UI libraries.
|
|
3
|
+
A premium React 19 design system: modern CSS, a small closed token vocabulary, a WAAPI motion engine. No Tailwind dependency, no CSS-in-JS, no UI library, zero runtime dependencies. Ships compiled ESM + types, one component per subpath, each loading its own CSS.
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
link one base stylesheet - each component loads its own CSS automatically.
|
|
8
|
-
|
|
9
|
-
## What this is, and who it is for
|
|
10
|
-
|
|
11
|
-
Zyncat UI is built first for my own applications. Every component exists because a real
|
|
12
|
-
product needed it, and the API is the one that made that product simpler - not the one that
|
|
13
|
-
covers the widest set of hypothetical uses. That it also serves as a portfolio piece is a
|
|
14
|
-
side effect, not the goal.
|
|
15
|
-
|
|
16
|
-
That focus is the point. The token vocabulary stays small because one person has to hold it
|
|
17
|
-
in their head; the component set stays narrow because every component is a permanent
|
|
18
|
-
maintenance surface; the motion engine is small because the alternative was a dependency
|
|
19
|
-
with a hundred features I would not use. A design system built to please everyone ends up
|
|
20
|
-
with a settings panel instead of a point of view.
|
|
21
|
-
|
|
22
|
-
**On licensing and openness.** The code here is MIT-licensed and you are welcome to use it.
|
|
23
|
-
It is not, however, run as a community open-source project: there is no public roadmap, no
|
|
24
|
-
support commitment, no issue triage and no contribution process, and none of those are
|
|
25
|
-
planned right now. Development is driven by what my own applications need. Parts of it may
|
|
26
|
-
later move to an open-core or commercial arrangement - that decision has not been made. Use
|
|
27
|
-
it with those expectations, and pin a version.
|
|
5
|
+
Built first for my own applications: every component exists because a product needed it, and the API is the one that made that product simpler. MIT-licensed and yours to use, but not run as a community project - no public roadmap, support commitment, issue triage or contribution process - and parts may later move to an open-core or commercial arrangement. Pin a version.
|
|
28
6
|
|
|
29
7
|
## Install
|
|
30
8
|
|
|
31
|
-
One command, run inside your React project - installing the package is part of it, so there is no
|
|
32
|
-
separate `pnpm add` step:
|
|
33
|
-
|
|
34
9
|
```bash
|
|
35
10
|
pnpm dlx zyncat-ui init
|
|
36
|
-
#
|
|
11
|
+
# npx zyncat-ui init · yarn dlx zyncat-ui init · bunx zyncat-ui init
|
|
37
12
|
```
|
|
38
13
|
|
|
39
|
-
It installs `@zyncat/ui`
|
|
40
|
-
the base stylesheet at your app root, writes `zyncat.theme.css` beside it with the eight decisions the
|
|
41
|
-
whole system derives from, installs the agent skill into `.claude/skills/`, registers the bundled MCP
|
|
42
|
-
server in `.mcp.json`. Every step is idempotent and printed as it lands - re-run the command after
|
|
43
|
-
upgrading to refresh the skill.
|
|
44
|
-
Non-interactive shells get plain logs and no prompts; pass `--yes` to accept every default and
|
|
45
|
-
`--pm <pnpm|npm|yarn|bun>` to pin the package manager.
|
|
14
|
+
One command, inside your React project. It installs `@zyncat/ui` (and React 19 if missing), imports the base stylesheet at your app root, writes `zyncat.theme.css` beside it, installs the agent skill into `.claude/skills/` and registers the MCP server in `.mcp.json`. Every step is idempotent and printed as it lands. `--yes` accepts every default, `--pm <pnpm|npm|yarn|bun>` pins the package manager, and non-interactive shells get plain logs.
|
|
46
15
|
|
|
47
|
-
|
|
48
|
-
| --------------------- | ----- | -------------------------------------------------------------------- |
|
|
49
|
-
| `react` / `react-dom` | `^19` | components; `createRoot`/`createPortal` for imperative toast/tooltip |
|
|
16
|
+
After upgrading, `npx zyncat-ui update` offers any new theme decisions without touching your values, and `init` again refreshes the skill.
|
|
50
17
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
Icons are **bundled** (a small curated Phosphor set) - there is no icon peer to install.
|
|
18
|
+
Peers: `react` and `react-dom` `^19`. Animation and icons (a curated Phosphor set) are bundled.
|
|
54
19
|
|
|
55
20
|
## Use it
|
|
56
21
|
|
|
57
|
-
No bundler config and no `transpilePackages` - the package ships built ESM with the `'use client'`
|
|
58
|
-
directives intact, so Next.js App Router boundaries just work.
|
|
59
|
-
|
|
60
22
|
```tsx
|
|
23
|
+
import '@zyncat/ui/styles.css'; // once, at the app root - init adds it
|
|
24
|
+
|
|
61
25
|
import { Button } from '@zyncat/ui/button';
|
|
62
26
|
import { toast } from '@zyncat/ui/toast-store';
|
|
63
|
-
|
|
64
|
-
import '@zyncat/ui/styles.css'; // base layer - init adds this at the app root for you
|
|
65
27
|
```
|
|
66
28
|
|
|
67
|
-
`styles.css` is the
|
|
68
|
-
properties) and the shared `glass` utility. It is linked exactly once at the app root -
|
|
69
|
-
`init` inserts the import above your own stylesheets so yours keep winning the cascade.
|
|
29
|
+
`styles.css` is the base layer only: fonts, tokens, the shared `glass` utility. Each component imports its own stylesheet, so `@zyncat/ui/dialog` ships `dialog.css` and no one else's. No bundler config: the ESM keeps its `'use client'` directives, so Next.js App Router boundaries just work.
|
|
70
30
|
|
|
71
|
-
|
|
72
|
-
bundler code-splits and lazy-loads it with the component. Import `@zyncat/ui/dialog` and
|
|
73
|
-
only `dialog.css` ships (plus the `overlay`/`icon` styles it reuses, deduped) - not every
|
|
74
|
-
other component's CSS.
|
|
31
|
+
There is no barrel entry, deliberately. `import … from '@zyncat/ui'` does not resolve; subpaths make "one import, one component" structural instead of a tree-shaking promise.
|
|
75
32
|
|
|
76
33
|
## Theme it
|
|
77
34
|
|
|
78
|
-
Eight
|
|
79
|
-
hue, the radius, the two faces. `init` writes them into `zyncat.theme.css` beside your app entry, so
|
|
80
|
-
a retheme is editing a value there:
|
|
35
|
+
Eight decisions, everything else derives. `init` wrote them into `zyncat.theme.css`; a retheme is editing a value there:
|
|
81
36
|
|
|
82
37
|
```css
|
|
83
|
-
/* zyncat.theme.css */
|
|
84
38
|
:root {
|
|
85
39
|
--accent: oklch(0.58 0.19 292); /* hover, active, wash, ring and info follow */
|
|
86
40
|
--radius: 0.75rem; /* every corner step follows */
|
|
87
41
|
}
|
|
88
42
|
```
|
|
89
43
|
|
|
90
|
-
Dark ships. `data-theme="dark"` on `<html>` turns the page -
|
|
91
|
-
app surface - and on any element it turns that subtree, where `data-theme="light"` makes a light
|
|
92
|
-
island. The decisions cascade in, so the accent you set is the dark theme's accent too; extend it in
|
|
93
|
-
the same block:
|
|
44
|
+
Dark ships. `data-theme="dark"` on `<html>` turns the page, on any element it turns that subtree, and `data-theme="light"` inside makes a light island. Extend it in a `[data-theme='dark']` block of the same file.
|
|
94
45
|
|
|
95
|
-
|
|
96
|
-
[data-theme='dark'] {
|
|
97
|
-
--accent: oklch(0.72 0.14 292); /* a lighter accent for dark surfaces */
|
|
98
|
-
--shadow-strength: 2.5; /* the lighting model is three numbers: shadows, top-light highlights, cast light */
|
|
99
|
-
}
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
For a theme that is data - several named themes, values computed at build time - the same level
|
|
103
|
-
has a type on it:
|
|
46
|
+
For a theme that is data - several named themes, computed values - the same level has a type:
|
|
104
47
|
|
|
105
48
|
```tsx
|
|
106
49
|
import { defineTheme, ZyncatTheme } from '@zyncat/ui/theme';
|
|
107
50
|
|
|
108
|
-
const base = defineTheme({
|
|
109
|
-
|
|
110
|
-
shape: { radius: '0.75rem' },
|
|
111
|
-
components: { odometer: { accent: 'var(--warning)' } },
|
|
112
|
-
});
|
|
113
|
-
const dark = defineTheme({ color: { accent: 'oklch(0.72 0.14 292)' }, custom: { '--shadow-strength': 2.5 } });
|
|
51
|
+
const base = defineTheme({ color: { accent: 'oklch(0.58 0.19 292)' }, shape: { radius: '0.75rem' } });
|
|
52
|
+
const dark = defineTheme({ color: { accent: 'oklch(0.72 0.14 292)' } });
|
|
114
53
|
|
|
115
|
-
// once, at the app root
|
|
116
|
-
<ZyncatTheme theme={{ base, dark }} />;
|
|
54
|
+
<ZyncatTheme theme={{ base, dark }} />; // once, at the app root
|
|
117
55
|
```
|
|
118
56
|
|
|
119
|
-
|
|
120
|
-
`shape`, `motion` - each grouping what it holds (`color.bg.app`, `type.font.body`,
|
|
121
|
-
`motion.duration.base`), then the scoped knobs under `components` and any other token by its CSS
|
|
122
|
-
name under `custom`. Every level completes, hover shows the default, a typo is a compile error, and
|
|
123
|
-
values take any CSS. `base` lands on
|
|
124
|
-
`:root` and every other key becomes a `[data-theme='<key>']` block, so switching themes - globally
|
|
125
|
-
or for one subtree - is setting that attribute. The types are generated from the token stylesheets,
|
|
126
|
-
so upgrading the package surfaces new tokens rather than drifting from them.
|
|
57
|
+
`ZyncatTheme` renders a `<style>` element: server-rendered, no provider, no build step, about a kilobyte. `base` lands on `:root` and every other key is a `[data-theme='<key>']` block, so switching is one attribute. The types are generated from the token CSS, so a typo is a compile error and an upgrade surfaces new tokens.
|
|
127
58
|
|
|
128
|
-
`
|
|
129
|
-
flash, no client hook), needs no PostCSS plugin, bundler plugin or build step, and adds about
|
|
130
|
-
a kilobyte. Durations you repoint keep their `prefers-reduced-motion` collapse automatically.
|
|
59
|
+
Four override levels, lowest first: **0** your own unlayered CSS beats every shipped rule, since all of it sits in `@layer zyncat.components`; **1** the tokens above; **2** an expressive component's `--<component>-*` properties; **3** `className` and `style` per instance, `htmlProps` for an overlay's panel. Replicas answer to none of them. Reduced motion is handled at the token layer, so repoint durations on `:root`, not a nested scope. The [theming docs](https://ui.zyncat.app/theming) walk through each level.
|
|
131
60
|
|
|
132
|
-
### With Tailwind
|
|
61
|
+
### With Tailwind v4
|
|
133
62
|
|
|
134
|
-
|
|
135
|
-
`tailwindcss` in the stylesheet Tailwind compiles; the base stylesheet stays on its JS import:
|
|
63
|
+
`init` puts one line above `tailwindcss` in the stylesheet Tailwind compiles:
|
|
136
64
|
|
|
137
65
|
```css
|
|
138
66
|
@import '@zyncat/ui/tailwind.css';
|
|
139
67
|
@import 'tailwindcss';
|
|
140
68
|
```
|
|
141
69
|
|
|
142
|
-
Every role
|
|
143
|
-
it - `dark:` follows `data-theme`:
|
|
144
|
-
|
|
145
|
-
```tsx
|
|
146
|
-
<article className="bg-surface border border-subtle rounded-lg shadow-sm p-4 max-w-prose">
|
|
147
|
-
<h3 className="text-heading text-strong">Weekly digest</h3>
|
|
148
|
-
<p className="text-caption text-muted">Sent every Monday at 9:00.</p>
|
|
149
|
-
</article>
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
Surfaces `bg-*`, ink `text-*` (the body ink is `text-default`), hairlines `border-*`, the hues on
|
|
153
|
-
every colour utility with `/opacity`, the type roles as `text-<role>` with their leading and weight,
|
|
154
|
-
`rounded-*`, `shadow-*`, `outline-ring-<hue>`, `duration-*`, `ease-*`, `max-w-prose`. The names Tailwind
|
|
155
|
-
also ships, `rounded-md`, `shadow-md`, `tracking-tight`, read the zyncat token of the same name, so
|
|
156
|
-
`--radius` in your theme file moves your utilities and the components together. Spacing stays
|
|
157
|
-
Tailwind's own scale.
|
|
158
|
-
|
|
159
|
-
### One subpath per component
|
|
160
|
-
|
|
161
|
-
```tsx
|
|
162
|
-
import { Button } from '@zyncat/ui/button';
|
|
163
|
-
import { DateField } from '@zyncat/ui/date-field';
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
**There is no barrel entry, deliberately.** `import … from '@zyncat/ui'` does not resolve.
|
|
167
|
-
A barrel makes it possible for one import to pull in modules - and stylesheets - the app
|
|
168
|
-
never asked for, and no amount of tree-shaking makes that guarantee hold across every
|
|
169
|
-
bundler and every non-bundled setup. Subpaths make it structural instead.
|
|
70
|
+
Every role becomes a utility named after its token - `bg-surface`, `text-muted`, `border-subtle`, `text-caption`, `rounded-md`, `shadow-md`, `duration-fast` - reading the token itself, so themes and `dark:` (which follows `data-theme`) reach it. Spacing stays Tailwind's own scale.
|
|
170
71
|
|
|
171
72
|
## Components
|
|
172
73
|
|
|
@@ -182,106 +83,35 @@ bundler and every non-bundled setup. Subpaths make it structural instead.
|
|
|
182
83
|
| Replicas | FacebookFeed, InstagramFeed, TikTok, YouTube |
|
|
183
84
|
| Motion & dev | Glide / GlidePill, MotionDevtools |
|
|
184
85
|
|
|
185
|
-
Each is a named export from
|
|
186
|
-
inline in the types; each component also ships a usage doc (`*.usage.md` beside its source) with
|
|
187
|
-
a maintainer-written example.
|
|
188
|
-
|
|
189
|
-
The **Replicas** row is the exception to the token rule: those four reproduce a real platform
|
|
190
|
-
surface, so their metrics are pinned constants and your theme deliberately cannot move them.
|
|
191
|
-
Everything else answers to the token vocabulary.
|
|
86
|
+
Each is a named export from `@zyncat/ui/<kebab-name>`, with inline prop docs and a usage doc (`*.usage.md` beside its source). Replicas pin platform metrics as constants, so your theme cannot move them. Components take icons as any `ReactNode`; there is no `Icon` export.
|
|
192
87
|
|
|
193
88
|
## For AI coding agents
|
|
194
89
|
|
|
195
|
-
|
|
196
|
-
agent skill into `./.claude/skills/` (the component map, picker tables, recipes, theming guide -
|
|
197
|
-
the knowledge that should sit in the agent's context) and registers the bundled MCP server in
|
|
198
|
-
`./.mcp.json` (the live truth). Re-run it after upgrading the package so the skill matches the
|
|
199
|
-
installed version.
|
|
200
|
-
|
|
201
|
-
**The MCP server** is zero-dependency (stdio), also exposed as the `zyncat-ui-mcp` bin, and works
|
|
202
|
-
with any MCP client:
|
|
90
|
+
`init` installs the `zyncat-ui` skill (component map, picker tables, recipes, theming guide) and registers the zero-dependency MCP server, also exposed as the `zyncat-ui-mcp` bin:
|
|
203
91
|
|
|
204
92
|
```json
|
|
205
93
|
{ "mcpServers": { "zyncat-ui": { "command": "node", "args": ["./node_modules/@zyncat/ui/dist/mcp.js"] } } }
|
|
206
94
|
```
|
|
207
95
|
|
|
208
|
-
Three tools: `get_component` (batch
|
|
209
|
-
maintainer usage doc, live docs URL, complete prop types with the shared type chunks inlined;
|
|
210
|
-
an unknown name returns the whole catalog), `search_api` (ranked keyword search across usage
|
|
211
|
-
docs, prop types and tokens), `get_tokens` (the token vocabulary with real values plus the
|
|
212
|
-
theming levels). The server reads the installed package's usage docs, `dist/types/` declarations
|
|
213
|
-
and `src/tokens/*.css` at call time, so answers always match the installed version.
|
|
214
|
-
|
|
215
|
-
Without MCP, the same contract is readable directly:
|
|
216
|
-
|
|
217
|
-
- **Declaration files under `node_modules/@zyncat/ui/dist/types/`** - every component's props carry
|
|
218
|
-
inline TSDoc, and this is the machine-readable source of truth. Each subpath's `types` entry in
|
|
219
|
-
`package.json` points straight at its file: `./button` resolves to
|
|
220
|
-
`dist/types/components/primitives/button/Button.d.ts`, which fully describes `ButtonProps`.
|
|
221
|
-
- **Usage docs** - `node_modules/@zyncat/ui/src/**/*.usage.md`, one per component: purpose, when
|
|
222
|
-
to pick it, a verified example, the live docs URL.
|
|
223
|
-
- This README.
|
|
96
|
+
Three tools: `get_component` (batch: usage doc, docs URL, complete prop types), `search_api` (ranked search across usage docs, props and tokens), `get_tokens` (the vocabulary with live values and the theming levels). The server reads the installed package at call time, so answers match the installed version. Without MCP, the same contract is `dist/types/**/*.d.ts` and `src/**/*.usage.md` inside `node_modules/@zyncat/ui`.
|
|
224
97
|
|
|
225
98
|
## Copy-paste instead
|
|
226
99
|
|
|
227
|
-
The tarball
|
|
228
|
-
`node_modules/@zyncat/ui/src/components/<tier>/<name>/` into your project. Components aren't fully
|
|
229
|
-
self-contained - they share `src/tokens/`, the `motion-tokens` bridge, the internal `icon/`, and a
|
|
230
|
-
few `*-core` helpers - so copy those alongside. (A shadcn-style registry/CLI could automate this
|
|
231
|
-
later.)
|
|
232
|
-
|
|
233
|
-
## Icons
|
|
234
|
-
|
|
235
|
-
Components render their own glyphs from a small curated Phosphor set, **bundled in** - no icon peer
|
|
236
|
-
to install. Zyncat UI does **not** export an `Icon` component, so where a prop takes an icon
|
|
237
|
-
(`leadingIcon`, a `Tag`'s `icon`, ...) or a component composes icons as children (`Button`), pass
|
|
238
|
-
your own node - any `ReactNode` (e.g. an `@phosphor-icons/react` element, if you choose to use it).
|
|
239
|
-
|
|
240
|
-
## What's inside
|
|
241
|
-
|
|
242
|
-
```
|
|
243
|
-
src/ source (also shipped, for reading)
|
|
244
|
-
-- styles.css base layer: fonts + tokens + glass (link once)
|
|
245
|
-
-- tokens/ CSS custom properties + the TypeScript readers that mirror them
|
|
246
|
-
-- engine/ the WAAPI motion engine
|
|
247
|
-
-- motion/ the React motion layer: Presence, Motion, presets
|
|
248
|
-
-- components/ primitives/ composites/ compound/ expressive/ internal/ - each Tsx imports its own CSS
|
|
249
|
-
-- mcp/ the bundled MCP server
|
|
250
|
-
skills/ the agent skill `npx zyncat-ui init` installs into a consumer project
|
|
251
|
-
dist/ compiled ESM + .d.ts - what you import
|
|
252
|
-
```
|
|
100
|
+
The tarball ships `src/`, so a component can be lifted from `node_modules/@zyncat/ui/src/components/<tier>/<name>/`. Bring `src/tokens/`, the `motion-tokens` bridge, the internal `icon/` and the `*-core` helpers it shares.
|
|
253
101
|
|
|
254
102
|
## Notes
|
|
255
103
|
|
|
256
|
-
-
|
|
257
|
-
|
|
258
|
-
- **Four ways to override, and you never fork the source.** Load your stylesheet after
|
|
259
|
-
`@zyncat/ui/styles.css`, then take the lowest level that works. **0** - every shipped rule
|
|
260
|
-
sits in `@layer zyncat.components`, and unlayered CSS beats every layer at any specificity,
|
|
261
|
-
so `.zc-btn { border-radius: 0 }` just lands. **1** - repoint the tokens to retheme the system,
|
|
262
|
-
in TypeScript with `defineTheme` (below) or on `:root` in your own CSS; the motion engine
|
|
263
|
-
reads the same values, so animation retimes with them.
|
|
264
|
-
**2** - retune one expressive or compound component through its `--<component>-*` properties.
|
|
265
|
-
**3** - `className` and `style` per instance (`htmlProps` for an overlay's panel).
|
|
266
|
-
[`skills/zyncat-ui/references/theming.md`](./skills/zyncat-ui/references/theming.md) has the
|
|
267
|
-
full vocabulary, and `get_tokens` prints it with live values.
|
|
268
|
-
- **Reduced motion is handled at the token layer.** Every `--duration-*` collapses to 1ms under
|
|
269
|
-
`prefers-reduced-motion`, so components need no per-component media query - but that collapse
|
|
270
|
-
targets `:root`, so repoint durations there and not on a nested scope. The engine re-reads the
|
|
271
|
-
tokens when the theme attribute or the media query changes.
|
|
104
|
+
- Fonts: `src/tokens/fonts.css` pulls Geist and Geist Mono from Google Fonts. Self-host them to drop the network hop.
|
|
105
|
+
- Layout: `src/` (tokens, engine, motion, components, mcp; shipped for reading), `skills/` the agent skill, `dist/` what you import.
|
|
272
106
|
|
|
273
107
|
## Develop
|
|
274
108
|
|
|
275
109
|
```bash
|
|
276
110
|
pnpm install
|
|
277
|
-
pnpm build
|
|
278
|
-
pnpm
|
|
279
|
-
pnpm
|
|
280
|
-
pnpm
|
|
281
|
-
pnpm check:usage # every subpath has a usage doc, and its example props are real
|
|
282
|
-
pnpm check:authoring # docs/authoring + CLAUDE.md still match the code
|
|
283
|
-
pnpm verify # every gate above, in order
|
|
111
|
+
pnpm build # dist/ (ESM + .d.ts) and the CLI
|
|
112
|
+
pnpm verify # every check plus the build, in parallel lanes
|
|
113
|
+
pnpm check <name...> # css contracts authoring exports tsconfig skill theme history shim usage props format typecheck
|
|
114
|
+
pnpm sync <name...> # theme shim exports tsconfig props skill
|
|
284
115
|
```
|
|
285
116
|
|
|
286
|
-
Contributing
|
|
287
|
-
[`docs/authoring/`](docs/authoring/).
|
|
117
|
+
Contributing? Start at [`CLAUDE.md`](CLAUDE.md), then [`docs/authoring/`](docs/authoring/).
|
package/dist/alert.css
CHANGED
package/dist/alert.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use client';import { popOut } from './chunk-HDSFWZ7L.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Motion } from './chunk-
|
|
5
|
-
import './chunk-
|
|
6
|
-
import './chunk-
|
|
2
|
+
import { resolveMotionTiming } from './chunk-RY35IU3G.js';
|
|
3
|
+
import { Presence } from './chunk-DH7DT6EO.js';
|
|
4
|
+
import { Motion } from './chunk-FLDIRXFU.js';
|
|
5
|
+
import './chunk-GWCBTD63.js';
|
|
6
|
+
import './chunk-HWDIVGME.js';
|
|
7
7
|
import './chunk-VNVVG47J.js';
|
|
8
|
-
import { IconSlot } from './chunk-WCWV5IX6.js';
|
|
9
|
-
import { Icon } from './chunk-GOLSYGRA.js';
|
|
10
8
|
import { useControllable } from './chunk-MMRIQNEN.js';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
9
|
+
import { IconSlot } from './chunk-WCWV5IX6.js';
|
|
10
|
+
import { Icon } from './chunk-TBLPZQSI.js';
|
|
11
|
+
import { UIMotion } from './chunk-ZHMOH62S.js';
|
|
12
|
+
import { buttonClass } from './chunk-KSAJ6DED.js';
|
|
13
13
|
import './chunk-DMX2F6B4.js';
|
|
14
14
|
import { cx } from './chunk-QGNC7LH5.js';
|
|
15
15
|
import './alert.css';
|
|
@@ -65,7 +65,15 @@ function Alert({
|
|
|
65
65
|
/* @__PURE__ */ jsx("p", { className: "zc-alert__title", children: title }),
|
|
66
66
|
children != null && /* @__PURE__ */ jsx("p", { className: "zc-alert__desc", children })
|
|
67
67
|
] }),
|
|
68
|
-
action && /* @__PURE__ */ jsx(
|
|
68
|
+
action && /* @__PURE__ */ jsx(
|
|
69
|
+
"button",
|
|
70
|
+
{
|
|
71
|
+
type: "button",
|
|
72
|
+
className: buttonClass({ size: "sm", className: "zc-alert__action" }),
|
|
73
|
+
onClick: action.onClick,
|
|
74
|
+
children: action.label
|
|
75
|
+
}
|
|
76
|
+
),
|
|
69
77
|
dismissible && /* @__PURE__ */ jsx("button", { type: "button", className: "zc-alert__close", "aria-label": "Dismiss", onClick: dismiss, children: /* @__PURE__ */ jsx(Icon, { name: "close", size: "sm" }) })
|
|
70
78
|
] })
|
|
71
79
|
},
|
package/dist/alert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"s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'use client';\n\nimport './alert.css';\n\nimport type { CSSProperties, HTMLAttributes, ReactNode } from 'react';\n\nimport type { DataAttributes } from '../../../dom-props';\nimport { Motion } from '../../../motion/element';\nimport { resolveMotionTiming } from '../../../motion/motion-timing';\nimport { Presence } from '../../../motion/presence';\nimport { popOut } from '../../../motion/presets';\nimport type { DisableableAnimation } from '../../../motion/timing';\nimport { UIMotion } from '../../../tokens/motion-tokens';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { Icon, type IconName } from '../../internal/icon/Icon';\nimport { IconSlot } from '../../internal/icon/IconSlot';\nimport { cx } from '../../internal/utils/cx';\nimport { buttonClass } from '../../primitives/button/button-style';\n\nexport type AlertTone = 'info' | 'success' | 'warning' | 'danger';\n\nexport interface AlertAction {\n /** Sentence-case label, e.g. \"Update billing\". */\n label: string;\n onClick?: () => void;\n}\n\ninterface AlertOwnProps {\n /** Status of the message; info/success are polite, warning/danger assertive. Default 'info'. */\n tone?: AlertTone;\n /** The message - sentence case, ideally one line. */\n title: ReactNode;\n /** Optional description; stays neutral - tone marks the message, not the prose. */\n children?: ReactNode;\n /** One action max, rendered as the system secondary small button. */\n action?: AlertAction;\n /** Renders the always-visible close button. Uncontrolled unless `open` is given. */\n dismissible?: boolean;\n /** Fires on dismiss. With `open` set, the parent owns hiding the alert. */\n onDismiss?: () => void;\n /** Controlled visibility; omit for uncontrolled. The exit fades and scales down, then releases the slot. */\n open?: boolean;\n /** App-level strip: square corners, hairline below only. Paint modifier. */\n banner?: boolean;\n /** Override the tone glyph; pass null to render no glyph. */\n icon?: ReactNode | null;\n /** Extra class(es) merged onto the alert. */\n className?: string;\n /** Inline styles merged onto the alert. */\n style?: CSSProperties;\n /** Enter/exit timing - motion tokens only, or `null` to disable (enter and exit snap).\n * @default entrance height 'slow'/'entrance' + opacity 'base'/'entrance'; exit scale + opacity 'fast'/'exit' */\n animation?: DisableableAnimation;\n}\n\nexport interface AlertProps extends AlertOwnProps {\n /** Standard <div> attributes (aria-*, data-*, ...) forwarded to the alert. */\n htmlProps?: Omit<HTMLAttributes<HTMLDivElement>, keyof AlertOwnProps> & DataAttributes;\n}\n\nconst ALERT_HEIGHT_TIMING = {\n open: { duration: 'slow', ease: 'entrance' },\n close: { duration: 'slow', ease: 'entrance' },\n} as const;\nconst ALERT_OPACITY_TIMING = {\n open: { duration: 'base', ease: 'entrance' },\n close: { duration: 'fast', ease: 'exit' },\n} as const;\n\nconst TONE_GLYPH: Record<AlertTone, IconName> = {\n info: 'info',\n success: 'check-circle',\n warning: 'warning',\n danger: 'warning-circle',\n};\nconst TONE_ROLE: Record<AlertTone, string> = { info: 'status', success: 'status', warning: 'alert', danger: 'alert' };\n\nexport function Alert({\n tone = 'info',\n title,\n children = null,\n action = null,\n dismissible = false,\n onDismiss,\n open,\n banner = false,\n icon,\n className = '',\n style,\n htmlProps,\n animation,\n}: AlertProps) {\n const [isOpen, setOpen] = useControllable(open, true, onDismiss);\n const dismiss = () => setOpen(false);\n\n const h = resolveMotionTiming(animation, ALERT_HEIGHT_TIMING);\n const o = resolveMotionTiming(animation, ALERT_OPACITY_TIMING);\n\n const cls = cx('zc-alert', banner && 'zc-alert--banner', className);\n\n return (\n <Presence initial={false}>\n {isOpen && (\n <Motion\n key=\"alert-shell\"\n className=\"zc-alert-shell\"\n animate={[\n { height: [0, 'auto'], timing: h.open },\n { opacity: [0, 1], timing: o.open },\n ]}\n exit={[popOut(UIMotion.scale.floating, o.close)]}\n >\n <div className={cls} style={style} data-tone={tone} role={TONE_ROLE[tone] || 'status'} {...htmlProps}>\n {icon === null ? null : (\n <span className=\"zc-alert__icon\" aria-hidden=\"true\">\n {icon !== undefined ? (\n <IconSlot size=\"md\">{icon}</IconSlot>\n ) : (\n <Icon name={TONE_GLYPH[tone] || 'info'} size=\"md\" />\n )}\n </span>\n )}\n <div className=\"zc-alert__body\">\n <p className=\"zc-alert__title\">{title}</p>\n {children != null && <p className=\"zc-alert__desc\">{children}</p>}\n </div>\n {action && (\n <button\n type=\"button\"\n className={buttonClass({ size: 'sm', className: 'zc-alert__action' })}\n onClick={action.onClick}\n >\n {action.label}\n </button>\n )}\n {dismissible && (\n <button type=\"button\" className=\"zc-alert__close\" aria-label=\"Dismiss\" onClick={dismiss}>\n <Icon name=\"close\" size=\"sm\" />\n </button>\n )}\n </div>\n </Motion>\n )}\n </Presence>\n );\n}\n"]}
|
package/dist/avatar.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer zyncat.tokens, zyncat.components;
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
2
2
|
|
|
3
3
|
@layer zyncat.components {
|
|
4
4
|
.zc-avatar {
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
--avatar-edge: oklch(1 0 0 / calc(0.5 * var(--sheen-strength)));
|
|
9
9
|
--avatar-shade: oklch(0.225 0.012 264 / 0.05);
|
|
10
10
|
--avatar-sheen: oklch(1 0 0 / calc(0.35 * var(--sheen-strength)));
|
|
11
|
-
/* The identity palette is the component's own, so it flips with the color-scheme the polarity
|
|
11
|
+
/* The identity palette is the component's own, so it flips with the color-scheme the polarity
|
|
12
|
+
blocks set instead of living in dark.css. */
|
|
12
13
|
--avatar-1-bg: light-dark(oklch(0.945 0.04 250), oklch(0.31 0.055 250));
|
|
13
14
|
--avatar-1-fg: light-dark(oklch(0.45 0.08 250), oklch(0.87 0.07 250));
|
|
14
15
|
--avatar-2-bg: light-dark(oklch(0.945 0.04 292), oklch(0.31 0.055 292));
|
package/dist/badge.css
CHANGED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { clamp, sample, SAMPLE_MS, easeInOut, easeOut, TAU } from './chunk-2YGHPQ66.js';
|
|
2
|
+
|
|
3
|
+
// src/components/expressive/theme-transition/bloom.ts
|
|
4
|
+
var DURATION = { polarity: 1400, palette: 620 };
|
|
5
|
+
var MAX_RELIEF = 2;
|
|
6
|
+
var DEEPEST_CUT = 0.7;
|
|
7
|
+
var COVER_MARGIN = 1.02;
|
|
8
|
+
var SPIN = 0.35;
|
|
9
|
+
var HEX_SIDES = 6;
|
|
10
|
+
var STAR_LOBES = 8;
|
|
11
|
+
var STAR_CUT = 0.38;
|
|
12
|
+
var PETAL_LOBES = 5;
|
|
13
|
+
var PETAL_CUT = 0.26;
|
|
14
|
+
var CURVE_VERTICES = 120;
|
|
15
|
+
var BLOB_WAVES = [
|
|
16
|
+
[2, 0.09, 0.6, 1.1],
|
|
17
|
+
[3, 0.07, 2.4, -0.8],
|
|
18
|
+
[5, 0.045, 4.1, 1.7]
|
|
19
|
+
];
|
|
20
|
+
var lobed = (lobes, cut, vertices, spin) => ({
|
|
21
|
+
vertices,
|
|
22
|
+
innermost: 1 - cut,
|
|
23
|
+
radial: (theta) => 1 - cut * (1 - Math.cos(lobes * theta)) / 2,
|
|
24
|
+
turn: (progress) => spin * progress
|
|
25
|
+
});
|
|
26
|
+
var OUTLINES = {
|
|
27
|
+
hexagon: (relief) => ({
|
|
28
|
+
vertices: HEX_SIDES,
|
|
29
|
+
innermost: Math.cos(Math.PI / HEX_SIDES),
|
|
30
|
+
radial: () => 1,
|
|
31
|
+
turn: (progress) => Math.PI / HEX_SIDES + SPIN * relief * progress
|
|
32
|
+
}),
|
|
33
|
+
star: (relief) => lobed(STAR_LOBES, clamp(STAR_CUT * relief, 0, DEEPEST_CUT), STAR_LOBES * 2, SPIN * relief),
|
|
34
|
+
petal: (relief) => lobed(PETAL_LOBES, clamp(PETAL_CUT * relief, 0, DEEPEST_CUT), CURVE_VERTICES, SPIN * relief),
|
|
35
|
+
blob: (relief) => {
|
|
36
|
+
const swell = Math.min(relief, DEEPEST_CUT / BLOB_WAVES.reduce((sum, [, depth]) => sum + depth, 0));
|
|
37
|
+
return {
|
|
38
|
+
vertices: CURVE_VERTICES,
|
|
39
|
+
innermost: 1 - BLOB_WAVES.reduce((sum, [, depth]) => sum + depth * swell, 0),
|
|
40
|
+
radial: (theta, progress) => BLOB_WAVES.reduce(
|
|
41
|
+
(r, [lobes, depth, phase, drift]) => r + depth * swell * Math.sin(lobes * theta + phase + drift * progress),
|
|
42
|
+
1
|
|
43
|
+
),
|
|
44
|
+
turn: () => 0
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var polygonAt = (outline, reach, progress, ox, oy) => {
|
|
49
|
+
const turn = outline.turn(progress);
|
|
50
|
+
const points = [];
|
|
51
|
+
for (let i = 0; i < outline.vertices; i++) {
|
|
52
|
+
const theta = i / outline.vertices * TAU;
|
|
53
|
+
const r = reach * outline.radial(theta, progress);
|
|
54
|
+
const a = theta + turn;
|
|
55
|
+
points.push(`${(ox + Math.cos(a) * r).toFixed(1)}px ${(oy + Math.sin(a) * r).toFixed(1)}px`);
|
|
56
|
+
}
|
|
57
|
+
return `polygon(${points.join(", ")})`;
|
|
58
|
+
};
|
|
59
|
+
var bloom = (scene) => {
|
|
60
|
+
const { width: W, height: H, originX: ox, originY: oy, kind, shape } = scene;
|
|
61
|
+
const relief = clamp(scene.intensity, 0, MAX_RELIEF);
|
|
62
|
+
const farthest = Math.max(
|
|
63
|
+
Math.hypot(ox, oy),
|
|
64
|
+
Math.hypot(W - ox, oy),
|
|
65
|
+
Math.hypot(ox, H - oy),
|
|
66
|
+
Math.hypot(W - ox, H - oy)
|
|
67
|
+
);
|
|
68
|
+
const ease = kind === "polarity" ? easeInOut : easeOut;
|
|
69
|
+
const outline = shape === "circle" ? null : OUTLINES[shape](relief);
|
|
70
|
+
const reach = farthest * COVER_MARGIN / (outline?.innermost ?? 1);
|
|
71
|
+
const at = ` at ${ox.toFixed(1)}px ${oy.toFixed(1)}px)`;
|
|
72
|
+
const clipAt = (p) => {
|
|
73
|
+
const e = ease(p);
|
|
74
|
+
return outline ? polygonAt(outline, reach * e, e, ox, oy) : `circle(${(reach * e).toFixed(1)}px${at}`;
|
|
75
|
+
};
|
|
76
|
+
return { duration: DURATION[kind], clips: sample(DURATION[kind], SAMPLE_MS, clipAt) };
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export { bloom };
|
|
80
|
+
//# sourceMappingURL=bloom-HV23M4AW.js.map
|
|
81
|
+
//# sourceMappingURL=bloom-HV23M4AW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/expressive/theme-transition/bloom.ts"],"names":[],"mappings":";;;AAEA,IAAM,QAAA,GAAW,EAAE,QAAA,EAAU,IAAA,EAAM,SAAS,GAAA,EAAI;AAChD,IAAM,UAAA,GAAa,CAAA;AACnB,IAAM,WAAA,GAAc,GAAA;AACpB,IAAM,YAAA,GAAe,IAAA;AACrB,IAAM,IAAA,GAAO,IAAA;AACb,IAAM,SAAA,GAAY,CAAA;AAClB,IAAM,UAAA,GAAa,CAAA;AACnB,IAAM,QAAA,GAAW,IAAA;AACjB,IAAM,WAAA,GAAc,CAAA;AACpB,IAAM,SAAA,GAAY,IAAA;AAClB,IAAM,cAAA,GAAiB,GAAA;AACvB,IAAM,UAAA,GAAsF;AAAA,EAC1F,CAAC,CAAA,EAAG,IAAA,EAAM,GAAA,EAAK,GAAG,CAAA;AAAA,EAClB,CAAC,CAAA,EAAG,IAAA,EAAM,GAAA,EAAK,IAAI,CAAA;AAAA,EACnB,CAAC,CAAA,EAAG,KAAA,EAAO,GAAA,EAAK,GAAG;AACrB,CAAA;AASA,IAAM,KAAA,GAAQ,CAAC,KAAA,EAAe,GAAA,EAAa,UAAkB,IAAA,MAA2B;AAAA,EACtF,QAAA;AAAA,EACA,WAAW,CAAA,GAAI,GAAA;AAAA,EACf,MAAA,EAAQ,CAAC,KAAA,KAAU,CAAA,GAAK,GAAA,IAAO,IAAI,IAAA,CAAK,GAAA,CAAI,KAAA,GAAQ,KAAK,CAAA,CAAA,GAAM,CAAA;AAAA,EAC/D,IAAA,EAAM,CAAC,QAAA,KAAa,IAAA,GAAO;AAC7B,CAAA,CAAA;AAEA,IAAM,QAAA,GAA+E;AAAA,EACnF,OAAA,EAAS,CAAC,MAAA,MAAY;AAAA,IACpB,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cesContent":["import { clamp, easeInOut, easeOut, sample, SAMPLE_MS, TAU, type BloomShape, type EffectFactory } from './scene';\n\nconst DURATION = { polarity: 1400, palette: 620 };\nconst MAX_RELIEF = 2;\nconst DEEPEST_CUT = 0.7;\nconst COVER_MARGIN = 1.02;\nconst SPIN = 0.35;\nconst HEX_SIDES = 6;\nconst STAR_LOBES = 8;\nconst STAR_CUT = 0.38;\nconst PETAL_LOBES = 5;\nconst PETAL_CUT = 0.26;\nconst CURVE_VERTICES = 120;\nconst BLOB_WAVES: readonly [lobes: number, depth: number, phase: number, drift: number][] = [\n [2, 0.09, 0.6, 1.1],\n [3, 0.07, 2.4, -0.8],\n [5, 0.045, 4.1, 1.7],\n];\n\ninterface Outline {\n vertices: number;\n innermost: number;\n radial(theta: number, progress: number): number;\n turn(progress: number): number;\n}\n\nconst lobed = (lobes: number, cut: number, vertices: number, spin: number): Outline => ({\n vertices,\n innermost: 1 - cut,\n radial: (theta) => 1 - (cut * (1 - Math.cos(lobes * theta))) / 2,\n turn: (progress) => spin * progress,\n});\n\nconst OUTLINES: Record<Exclude<BloomShape, 'circle'>, (relief: number) => Outline> = {\n hexagon: (relief) => ({\n vertices: HEX_SIDES,\n innermost: Math.cos(Math.PI / HEX_SIDES),\n radial: () => 1,\n turn: (progress) => Math.PI / HEX_SIDES + SPIN * relief * progress,\n }),\n star: (relief) => lobed(STAR_LOBES, clamp(STAR_CUT * relief, 0, DEEPEST_CUT), STAR_LOBES * 2, SPIN * relief),\n petal: (relief) => lobed(PETAL_LOBES, clamp(PETAL_CUT * relief, 0, DEEPEST_CUT), CURVE_VERTICES, SPIN * relief),\n blob: (relief) => {\n const swell = Math.min(relief, DEEPEST_CUT / BLOB_WAVES.reduce((sum, [, depth]) => sum + depth, 0));\n return {\n vertices: CURVE_VERTICES,\n innermost: 1 - BLOB_WAVES.reduce((sum, [, depth]) => sum + depth * swell, 0),\n radial: (theta, progress) =>\n BLOB_WAVES.reduce(\n (r, [lobes, depth, phase, drift]) => r + depth * swell * Math.sin(lobes * theta + phase + drift * progress),\n 1,\n ),\n turn: () => 0,\n };\n },\n};\n\nconst polygonAt = (outline: Outline, reach: number, progress: number, ox: number, oy: number) => {\n const turn = outline.turn(progress);\n const points: string[] = [];\n for (let i = 0; i < outline.vertices; i++) {\n const theta = (i / outline.vertices) * TAU;\n const r = reach * outline.radial(theta, progress);\n const a = theta + turn;\n points.push(`${(ox + Math.cos(a) * r).toFixed(1)}px ${(oy + Math.sin(a) * r).toFixed(1)}px`);\n }\n return `polygon(${points.join(', ')})`;\n};\n\nexport const bloom: EffectFactory = (scene) => {\n const { width: W, height: H, originX: ox, originY: oy, kind, shape } = scene;\n const relief = clamp(scene.intensity, 0, MAX_RELIEF);\n const farthest = Math.max(\n Math.hypot(ox, oy),\n Math.hypot(W - ox, oy),\n Math.hypot(ox, H - oy),\n Math.hypot(W - ox, H - oy),\n );\n const ease = kind === 'polarity' ? easeInOut : easeOut;\n const outline = shape === 'circle' ? null : OUTLINES[shape](relief);\n const reach = (farthest * COVER_MARGIN) / (outline?.innermost ?? 1);\n const at = ` at ${ox.toFixed(1)}px ${oy.toFixed(1)}px)`;\n const clipAt = (p: number) => {\n const e = ease(p);\n return outline ? polygonAt(outline, reach * e, e, ox, oy) : `circle(${(reach * e).toFixed(1)}px${at}`;\n };\n return { duration: DURATION[kind], clips: sample(DURATION[kind], SAMPLE_MS, clipAt) };\n};\n"]}
|