aeon-ui-engine 1.0.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/.changeset/README.md +23 -0
- package/.changeset/combobox-and-changesets.md +9 -0
- package/.changeset/config.json +30 -0
- package/.changeset/framework-adapters.md +12 -0
- package/.changeset/scene-3d.md +6 -0
- package/.changeset/scene-plane.md +8 -0
- package/.changeset/site-og.md +5 -0
- package/.cursor/rules/aeon-ui.mdc +22 -0
- package/ACCESSIBILITY.md +32 -0
- package/AGENTS.md +226 -0
- package/COMPONENTS.md +36 -0
- package/FRAMEWORKS.md +57 -0
- package/INTEGRATION.md +89 -0
- package/LICENSE +21 -0
- package/PHILOSOPHY.md +71 -0
- package/PUBLISHING.md +85 -0
- package/README.md +154 -0
- package/SCENE.md +113 -0
- package/STATES.md +243 -0
- package/apps/demo/index.html +31 -0
- package/apps/demo/og.config.mjs +15 -0
- package/apps/demo/package.json +41 -0
- package/apps/demo/public/favicon.svg +16 -0
- package/apps/demo/public/og.png +0 -0
- package/apps/demo/public/og.svg +35 -0
- package/apps/demo/scripts/generate-og-png.mjs +60 -0
- package/apps/demo/src/App.tsx +31 -0
- package/apps/demo/src/aeonDiagrams.ts +100 -0
- package/apps/demo/src/app.css +16 -0
- package/apps/demo/src/components/ActionCluster.tsx +20 -0
- package/apps/demo/src/components/AsyncMachineDemo.tsx +97 -0
- package/apps/demo/src/components/ButtonLifecycleDemo.tsx +63 -0
- package/apps/demo/src/components/CodeExample.tsx +7 -0
- package/apps/demo/src/components/ComboboxDemo.tsx +30 -0
- package/apps/demo/src/components/DiagramsSection.tsx +38 -0
- package/apps/demo/src/components/FieldStateDemo.tsx +51 -0
- package/apps/demo/src/components/GridMesh.tsx +8 -0
- package/apps/demo/src/components/HeroInstall.tsx +10 -0
- package/apps/demo/src/components/LandingFaq.tsx +29 -0
- package/apps/demo/src/components/LandingFooter.tsx +22 -0
- package/apps/demo/src/components/LandingHeader.tsx +60 -0
- package/apps/demo/src/components/LandingHero.tsx +55 -0
- package/apps/demo/src/components/LayersSection.tsx +51 -0
- package/apps/demo/src/components/MermaidDiagram.tsx +84 -0
- package/apps/demo/src/components/PhilosophySection.tsx +33 -0
- package/apps/demo/src/components/PlaygroundBlock.tsx +23 -0
- package/apps/demo/src/components/PlaygroundSection.tsx +204 -0
- package/apps/demo/src/components/SceneSection.tsx +157 -0
- package/apps/demo/src/components/ScrollRegionDemo.tsx +74 -0
- package/apps/demo/src/components/ThemeSwitcher.tsx +76 -0
- package/apps/demo/src/demo-layout.css +264 -0
- package/apps/demo/src/landing.css +1094 -0
- package/apps/demo/src/main.tsx +14 -0
- package/apps/demo/src/nav.ts +9 -0
- package/apps/demo/src/site.ts +347 -0
- package/apps/demo/tsconfig.json +17 -0
- package/apps/demo/vite-plugins/og-meta.ts +30 -0
- package/apps/demo/vite.config.ts +69 -0
- package/docs/API_PATTERNS.md +234 -0
- package/docs/ARCHITECTURE.md +125 -0
- package/docs/COMPONENT_CHECKLIST.md +103 -0
- package/docs/FILE_MAP.md +122 -0
- package/docs/GLOSSARY.md +125 -0
- package/docs/INDEX.md +53 -0
- package/docs/LAYOUT_COORDINATES.md +178 -0
- package/docs/MACHINES.md +166 -0
- package/docs/MIGRATION_FROM_ARK.md +295 -0
- package/docs/VITE_CONSUMER.md +114 -0
- package/package.json +25 -0
- package/packages/core/README.md +69 -0
- package/packages/core/package.json +37 -0
- package/packages/core/src/anatomy.ts +144 -0
- package/packages/core/src/attrs.ts +47 -0
- package/packages/core/src/index.ts +8 -0
- package/packages/core/src/layout.ts +176 -0
- package/packages/core/src/machine.test.ts +18 -0
- package/packages/core/src/machine.ts +15 -0
- package/packages/core/src/philosophy.ts +10 -0
- package/packages/core/src/scroll.ts +72 -0
- package/packages/core/src/theme.test.ts +14 -0
- package/packages/core/src/theme.ts +53 -0
- package/packages/core/src/types.ts +25 -0
- package/packages/core/theme-transition.css +58 -0
- package/packages/core/tsconfig.json +8 -0
- package/packages/core/vitest.config.ts +8 -0
- package/packages/geometry/README.md +7 -0
- package/packages/geometry/package.json +35 -0
- package/packages/geometry/src/index.ts +3 -0
- package/packages/geometry/src/patterns.ts +55 -0
- package/packages/geometry/src/scene-attrs.ts +11 -0
- package/packages/geometry/src/svg.ts +60 -0
- package/packages/geometry/tsconfig.json +8 -0
- package/packages/panda/README.md +66 -0
- package/packages/panda/package.json +40 -0
- package/packages/panda/panda.config.ts +229 -0
- package/packages/panda/scripts/emit-theme-runtime.ts +37 -0
- package/packages/panda/src/recipes/accordion.ts +95 -0
- package/packages/panda/src/recipes/async.ts +76 -0
- package/packages/panda/src/recipes/badge.ts +44 -0
- package/packages/panda/src/recipes/button-group.ts +33 -0
- package/packages/panda/src/recipes/button.ts +91 -0
- package/packages/panda/src/recipes/checkbox.ts +41 -0
- package/packages/panda/src/recipes/combobox.ts +121 -0
- package/packages/panda/src/recipes/dialog.ts +96 -0
- package/packages/panda/src/recipes/field-shared.ts +29 -0
- package/packages/panda/src/recipes/field.ts +72 -0
- package/packages/panda/src/recipes/floating.ts +170 -0
- package/packages/panda/src/recipes/index.ts +14 -0
- package/packages/panda/src/recipes/scroll-region.ts +55 -0
- package/packages/panda/src/recipes/select.ts +111 -0
- package/packages/panda/src/recipes/switch.ts +51 -0
- package/packages/panda/src/recipes/tabs.ts +50 -0
- package/packages/panda/src/theme/catalog-types.ts +24 -0
- package/packages/panda/src/theme/catalog.ts +73 -0
- package/packages/panda/src/theme/chrome.css +75 -0
- package/packages/panda/src/theme/global-theme-css.ts +42 -0
- package/packages/panda/src/theme/index.ts +5 -0
- package/packages/panda/src/theme/palette.ts +65 -0
- package/packages/panda/src/theme/scrollbars.css +96 -0
- package/packages/panda/src/theme/semantic-tokens.ts +17 -0
- package/packages/panda/src/theme/themes.config.ts +516 -0
- package/packages/panda/src/theme/tokens.ts +51 -0
- package/packages/panda/styled-system/css/conditions.mjs +36 -0
- package/packages/panda/styled-system/css/css.d.ts +22 -0
- package/packages/panda/styled-system/css/css.mjs +45 -0
- package/packages/panda/styled-system/css/cva.d.ts +6 -0
- package/packages/panda/styled-system/css/cva.mjs +87 -0
- package/packages/panda/styled-system/css/cx.d.ts +5 -0
- package/packages/panda/styled-system/css/cx.mjs +15 -0
- package/packages/panda/styled-system/css/index.d.ts +5 -0
- package/packages/panda/styled-system/css/index.mjs +4 -0
- package/packages/panda/styled-system/css/sva.d.ts +4 -0
- package/packages/panda/styled-system/css/sva.mjs +41 -0
- package/packages/panda/styled-system/helpers.mjs +339 -0
- package/packages/panda/styled-system/jsx/aspect-ratio.d.ts +10 -0
- package/packages/panda/styled-system/jsx/aspect-ratio.mjs +14 -0
- package/packages/panda/styled-system/jsx/bleed.d.ts +10 -0
- package/packages/panda/styled-system/jsx/bleed.mjs +14 -0
- package/packages/panda/styled-system/jsx/box.d.ts +10 -0
- package/packages/panda/styled-system/jsx/box.mjs +14 -0
- package/packages/panda/styled-system/jsx/center.d.ts +10 -0
- package/packages/panda/styled-system/jsx/center.mjs +14 -0
- package/packages/panda/styled-system/jsx/circle.d.ts +10 -0
- package/packages/panda/styled-system/jsx/circle.mjs +14 -0
- package/packages/panda/styled-system/jsx/container.d.ts +10 -0
- package/packages/panda/styled-system/jsx/container.mjs +14 -0
- package/packages/panda/styled-system/jsx/cq.d.ts +10 -0
- package/packages/panda/styled-system/jsx/cq.mjs +14 -0
- package/packages/panda/styled-system/jsx/divider.d.ts +10 -0
- package/packages/panda/styled-system/jsx/divider.mjs +14 -0
- package/packages/panda/styled-system/jsx/factory-helper.mjs +22 -0
- package/packages/panda/styled-system/jsx/factory.d.ts +3 -0
- package/packages/panda/styled-system/jsx/factory.mjs +80 -0
- package/packages/panda/styled-system/jsx/flex.d.ts +10 -0
- package/packages/panda/styled-system/jsx/flex.mjs +14 -0
- package/packages/panda/styled-system/jsx/float.d.ts +10 -0
- package/packages/panda/styled-system/jsx/float.mjs +14 -0
- package/packages/panda/styled-system/jsx/grid-item.d.ts +10 -0
- package/packages/panda/styled-system/jsx/grid-item.mjs +14 -0
- package/packages/panda/styled-system/jsx/grid.d.ts +10 -0
- package/packages/panda/styled-system/jsx/grid.mjs +14 -0
- package/packages/panda/styled-system/jsx/hstack.d.ts +10 -0
- package/packages/panda/styled-system/jsx/hstack.mjs +14 -0
- package/packages/panda/styled-system/jsx/index.d.ts +24 -0
- package/packages/panda/styled-system/jsx/index.mjs +22 -0
- package/packages/panda/styled-system/jsx/is-valid-prop.d.ts +11 -0
- package/packages/panda/styled-system/jsx/is-valid-prop.mjs +17 -0
- package/packages/panda/styled-system/jsx/link-overlay.d.ts +10 -0
- package/packages/panda/styled-system/jsx/link-overlay.mjs +14 -0
- package/packages/panda/styled-system/jsx/spacer.d.ts +10 -0
- package/packages/panda/styled-system/jsx/spacer.mjs +14 -0
- package/packages/panda/styled-system/jsx/square.d.ts +10 -0
- package/packages/panda/styled-system/jsx/square.mjs +14 -0
- package/packages/panda/styled-system/jsx/stack.d.ts +10 -0
- package/packages/panda/styled-system/jsx/stack.mjs +14 -0
- package/packages/panda/styled-system/jsx/visually-hidden.d.ts +10 -0
- package/packages/panda/styled-system/jsx/visually-hidden.mjs +14 -0
- package/packages/panda/styled-system/jsx/vstack.d.ts +10 -0
- package/packages/panda/styled-system/jsx/vstack.mjs +14 -0
- package/packages/panda/styled-system/jsx/wrap.d.ts +10 -0
- package/packages/panda/styled-system/jsx/wrap.mjs +14 -0
- package/packages/panda/styled-system/patterns/aspect-ratio.d.ts +21 -0
- package/packages/panda/styled-system/patterns/aspect-ratio.mjs +38 -0
- package/packages/panda/styled-system/patterns/bleed.d.ts +22 -0
- package/packages/panda/styled-system/patterns/bleed.mjs +24 -0
- package/packages/panda/styled-system/patterns/box.d.ts +21 -0
- package/packages/panda/styled-system/patterns/box.mjs +15 -0
- package/packages/panda/styled-system/patterns/center.d.ts +21 -0
- package/packages/panda/styled-system/patterns/center.mjs +21 -0
- package/packages/panda/styled-system/patterns/circle.d.ts +21 -0
- package/packages/panda/styled-system/patterns/circle.mjs +25 -0
- package/packages/panda/styled-system/patterns/container.d.ts +21 -0
- package/packages/panda/styled-system/patterns/container.mjs +21 -0
- package/packages/panda/styled-system/patterns/cq.d.ts +22 -0
- package/packages/panda/styled-system/patterns/cq.mjs +21 -0
- package/packages/panda/styled-system/patterns/divider.d.ts +23 -0
- package/packages/panda/styled-system/patterns/divider.mjs +25 -0
- package/packages/panda/styled-system/patterns/flex.d.ts +27 -0
- package/packages/panda/styled-system/patterns/flex.mjs +26 -0
- package/packages/panda/styled-system/patterns/float.d.ts +24 -0
- package/packages/panda/styled-system/patterns/float.mjs +52 -0
- package/packages/panda/styled-system/patterns/grid-item.d.ts +26 -0
- package/packages/panda/styled-system/patterns/grid-item.mjs +25 -0
- package/packages/panda/styled-system/patterns/grid.d.ts +25 -0
- package/packages/panda/styled-system/patterns/grid.mjs +27 -0
- package/packages/panda/styled-system/patterns/hstack.d.ts +22 -0
- package/packages/panda/styled-system/patterns/hstack.mjs +24 -0
- package/packages/panda/styled-system/patterns/index.d.ts +21 -0
- package/packages/panda/styled-system/patterns/index.mjs +20 -0
- package/packages/panda/styled-system/patterns/link-overlay.d.ts +21 -0
- package/packages/panda/styled-system/patterns/link-overlay.mjs +24 -0
- package/packages/panda/styled-system/patterns/spacer.d.ts +21 -0
- package/packages/panda/styled-system/patterns/spacer.mjs +21 -0
- package/packages/panda/styled-system/patterns/square.d.ts +21 -0
- package/packages/panda/styled-system/patterns/square.mjs +24 -0
- package/packages/panda/styled-system/patterns/stack.d.ts +24 -0
- package/packages/panda/styled-system/patterns/stack.mjs +24 -0
- package/packages/panda/styled-system/patterns/visually-hidden.d.ts +21 -0
- package/packages/panda/styled-system/patterns/visually-hidden.mjs +18 -0
- package/packages/panda/styled-system/patterns/vstack.d.ts +22 -0
- package/packages/panda/styled-system/patterns/vstack.mjs +24 -0
- package/packages/panda/styled-system/patterns/wrap.d.ts +25 -0
- package/packages/panda/styled-system/patterns/wrap.mjs +25 -0
- package/packages/panda/styled-system/recipes/aeon-accordion.d.ts +32 -0
- package/packages/panda/styled-system/recipes/aeon-accordion.mjs +48 -0
- package/packages/panda/styled-system/recipes/aeon-async.d.ts +32 -0
- package/packages/panda/styled-system/recipes/aeon-async.mjs +56 -0
- package/packages/panda/styled-system/recipes/aeon-badge.d.ts +31 -0
- package/packages/panda/styled-system/recipes/aeon-badge.mjs +32 -0
- package/packages/panda/styled-system/recipes/aeon-button-group.d.ts +39 -0
- package/packages/panda/styled-system/recipes/aeon-button-group.mjs +37 -0
- package/packages/panda/styled-system/recipes/aeon-button.d.ts +39 -0
- package/packages/panda/styled-system/recipes/aeon-button.mjs +39 -0
- package/packages/panda/styled-system/recipes/aeon-checkbox.d.ts +28 -0
- package/packages/panda/styled-system/recipes/aeon-checkbox.mjs +48 -0
- package/packages/panda/styled-system/recipes/aeon-combobox.d.ts +32 -0
- package/packages/panda/styled-system/recipes/aeon-combobox.mjs +52 -0
- package/packages/panda/styled-system/recipes/aeon-dialog.d.ts +28 -0
- package/packages/panda/styled-system/recipes/aeon-dialog.mjs +60 -0
- package/packages/panda/styled-system/recipes/aeon-field.d.ts +32 -0
- package/packages/panda/styled-system/recipes/aeon-field.mjs +52 -0
- package/packages/panda/styled-system/recipes/aeon-menu.d.ts +28 -0
- package/packages/panda/styled-system/recipes/aeon-menu.mjs +52 -0
- package/packages/panda/styled-system/recipes/aeon-popover.d.ts +28 -0
- package/packages/panda/styled-system/recipes/aeon-popover.mjs +52 -0
- package/packages/panda/styled-system/recipes/aeon-scroll.d.ts +43 -0
- package/packages/panda/styled-system/recipes/aeon-scroll.mjs +63 -0
- package/packages/panda/styled-system/recipes/aeon-select.d.ts +32 -0
- package/packages/panda/styled-system/recipes/aeon-select.mjs +56 -0
- package/packages/panda/styled-system/recipes/aeon-switch.d.ts +28 -0
- package/packages/panda/styled-system/recipes/aeon-switch.mjs +48 -0
- package/packages/panda/styled-system/recipes/aeon-tabs.d.ts +28 -0
- package/packages/panda/styled-system/recipes/aeon-tabs.mjs +48 -0
- package/packages/panda/styled-system/recipes/aeon-toast.d.ts +28 -0
- package/packages/panda/styled-system/recipes/aeon-toast.mjs +48 -0
- package/packages/panda/styled-system/recipes/aeon-tooltip.d.ts +28 -0
- package/packages/panda/styled-system/recipes/aeon-tooltip.mjs +48 -0
- package/packages/panda/styled-system/recipes/create-recipe.mjs +82 -0
- package/packages/panda/styled-system/recipes/index.d.ts +18 -0
- package/packages/panda/styled-system/recipes/index.mjs +17 -0
- package/packages/panda/styled-system/styles.css +2157 -0
- package/packages/panda/styled-system/tokens/index.d.ts +9 -0
- package/packages/panda/styled-system/tokens/index.mjs +2156 -0
- package/packages/panda/styled-system/tokens/tokens.d.ts +60 -0
- package/packages/panda/styled-system/types/composition.d.ts +164 -0
- package/packages/panda/styled-system/types/conditions.d.ts +322 -0
- package/packages/panda/styled-system/types/csstype.d.ts +21298 -0
- package/packages/panda/styled-system/types/global.d.ts +20 -0
- package/packages/panda/styled-system/types/index.d.ts +8 -0
- package/packages/panda/styled-system/types/jsx.d.ts +52 -0
- package/packages/panda/styled-system/types/parts.d.ts +8 -0
- package/packages/panda/styled-system/types/pattern.d.ts +78 -0
- package/packages/panda/styled-system/types/prop-type.d.ts +240 -0
- package/packages/panda/styled-system/types/recipe.d.ts +181 -0
- package/packages/panda/styled-system/types/selectors.d.ts +59 -0
- package/packages/panda/styled-system/types/static-css.d.ts +56 -0
- package/packages/panda/styled-system/types/style-props.d.ts +7491 -0
- package/packages/panda/styled-system/types/system-types.d.ts +193 -0
- package/packages/panda/theme-runtime.css +842 -0
- package/packages/panda/tsconfig.json +8 -0
- package/packages/primitives/README.md +54 -0
- package/packages/primitives/package.json +41 -0
- package/packages/primitives/src/__tests__/floating-surface.test.ts +29 -0
- package/packages/primitives/src/index.ts +9 -0
- package/packages/primitives/src/machines/accordion.ts +56 -0
- package/packages/primitives/src/machines/async.ts +108 -0
- package/packages/primitives/src/machines/button.ts +66 -0
- package/packages/primitives/src/machines/dialog.ts +61 -0
- package/packages/primitives/src/machines/field.ts +85 -0
- package/packages/primitives/src/machines/popover.ts +52 -0
- package/packages/primitives/src/machines/tabs.ts +46 -0
- package/packages/primitives/src/machines/toast.ts +48 -0
- package/packages/primitives/src/machines/toggle.ts +61 -0
- package/packages/primitives/tsconfig.json +8 -0
- package/packages/primitives/vitest.config.ts +8 -0
- package/packages/react/README.md +65 -0
- package/packages/react/package.json +52 -0
- package/packages/react/src/accordion/index.tsx +179 -0
- package/packages/react/src/async/actions.tsx +22 -0
- package/packages/react/src/async/context.tsx +54 -0
- package/packages/react/src/async/index.tsx +21 -0
- package/packages/react/src/async/legacy-region.tsx +38 -0
- package/packages/react/src/async/readout.tsx +34 -0
- package/packages/react/src/async/root.tsx +39 -0
- package/packages/react/src/async/track.tsx +59 -0
- package/packages/react/src/avatar/avatar.test.tsx +27 -0
- package/packages/react/src/avatar/index.tsx +122 -0
- package/packages/react/src/button/index.tsx +70 -0
- package/packages/react/src/checkbox/index.tsx +180 -0
- package/packages/react/src/combobox/index.tsx +430 -0
- package/packages/react/src/dialog/dialog.test.tsx +50 -0
- package/packages/react/src/dialog/index.tsx +275 -0
- package/packages/react/src/field/index.tsx +172 -0
- package/packages/react/src/hooks/use-aeon-machine.ts +10 -0
- package/packages/react/src/hooks/use-anchor-position.ts +33 -0
- package/packages/react/src/hooks/use-focus-trap.ts +51 -0
- package/packages/react/src/hooks/use-layout-mode.ts +22 -0
- package/packages/react/src/hooks/use-outside-click.ts +19 -0
- package/packages/react/src/hooks/use-portalled.ts +16 -0
- package/packages/react/src/hooks/use-scroll-lock.ts +13 -0
- package/packages/react/src/index.ts +18 -0
- package/packages/react/src/menu/index.tsx +195 -0
- package/packages/react/src/popover/index.tsx +191 -0
- package/packages/react/src/scroll/index.tsx +98 -0
- package/packages/react/src/scroll/use-scroll-state.ts +30 -0
- package/packages/react/src/select/index.tsx +372 -0
- package/packages/react/src/select/select.test.tsx +60 -0
- package/packages/react/src/switch/index.tsx +215 -0
- package/packages/react/src/tabs/index.tsx +140 -0
- package/packages/react/src/toast/context.tsx +28 -0
- package/packages/react/src/toast/index.tsx +20 -0
- package/packages/react/src/toast/primitives.tsx +129 -0
- package/packages/react/src/toast/provider.tsx +111 -0
- package/packages/react/src/toast/toast-item.tsx +32 -0
- package/packages/react/src/tooltip/index.tsx +191 -0
- package/packages/react/src/utils/merge-props.ts +24 -0
- package/packages/react/tsconfig.json +8 -0
- package/packages/react/vitest.config.ts +9 -0
- package/packages/react/vitest.setup.ts +5 -0
- package/packages/react-scene/README.md +11 -0
- package/packages/react-scene/package.json +47 -0
- package/packages/react-scene/scene-3d.css +37 -0
- package/packages/react-scene/scene-room.css +95 -0
- package/packages/react-scene/src/index.ts +20 -0
- package/packages/react-scene/src/procedural-grid.tsx +35 -0
- package/packages/react-scene/src/scene-layer.tsx +38 -0
- package/packages/react-scene/src/scene-plane.tsx +69 -0
- package/packages/react-scene/src/scene-room.tsx +81 -0
- package/packages/react-scene/src/scene-root.tsx +49 -0
- package/packages/react-scene/src/scene-slot.tsx +41 -0
- package/packages/react-scene/src/scene-stage.tsx +37 -0
- package/packages/react-scene/src/scene-surface.tsx +20 -0
- package/packages/react-scene/src/signal-bars.tsx +57 -0
- package/packages/react-scene/src/use-signal-visualizer.ts +103 -0
- package/packages/react-scene/tsconfig.json +8 -0
- package/packages/scene/README.md +5 -0
- package/packages/scene/package.json +32 -0
- package/packages/scene/src/index.ts +2 -0
- package/packages/scene/src/room.ts +40 -0
- package/packages/scene/src/transform.ts +60 -0
- package/packages/scene/tsconfig.json +8 -0
- package/packages/signal/README.md +9 -0
- package/packages/signal/package.json +32 -0
- package/packages/signal/src/analyser.ts +113 -0
- package/packages/signal/src/bands.ts +33 -0
- package/packages/signal/src/index.ts +3 -0
- package/packages/signal/src/motion.ts +80 -0
- package/packages/signal/tsconfig.json +8 -0
- package/packages/site/README.md +19 -0
- package/packages/site/package.json +32 -0
- package/packages/site/src/index.ts +8 -0
- package/packages/site/src/open-graph.ts +90 -0
- package/packages/site/tsconfig.json +8 -0
- package/packages/solid/README.md +30 -0
- package/packages/solid/package.json +42 -0
- package/packages/solid/src/hooks/use-aeon-machine.ts +10 -0
- package/packages/solid/src/index.ts +2 -0
- package/packages/solid/src/switch/index.tsx +191 -0
- package/packages/solid/src/utils/merge-props.ts +3 -0
- package/packages/solid/tsconfig.json +10 -0
- package/packages/surface/README.md +10 -0
- package/packages/surface/package.json +33 -0
- package/packages/surface/src/index.ts +1 -0
- package/packages/surface/src/materials.ts +14 -0
- package/packages/surface/surface.css +113 -0
- package/packages/surface/tsconfig.json +8 -0
- package/packages/svelte/README.md +45 -0
- package/packages/svelte/package.json +49 -0
- package/packages/svelte/src/Switch.svelte +86 -0
- package/packages/svelte/src/SwitchControl.svelte +45 -0
- package/packages/svelte/src/SwitchHiddenInput.svelte +12 -0
- package/packages/svelte/src/SwitchLabel.svelte +9 -0
- package/packages/svelte/src/SwitchThumb.svelte +16 -0
- package/packages/svelte/src/hooks/use-aeon-machine.ts +23 -0
- package/packages/svelte/src/index.ts +2 -0
- package/packages/svelte/src/switch-context.ts +13 -0
- package/packages/svelte/tsconfig.json +8 -0
- package/packages/ui/README.md +63 -0
- package/packages/ui/package.json +45 -0
- package/packages/ui/src/accordion.tsx +27 -0
- package/packages/ui/src/async.tsx +43 -0
- package/packages/ui/src/badge.tsx +18 -0
- package/packages/ui/src/button.tsx +38 -0
- package/packages/ui/src/checkbox.tsx +24 -0
- package/packages/ui/src/cn.ts +1 -0
- package/packages/ui/src/combobox.tsx +29 -0
- package/packages/ui/src/dialog.tsx +32 -0
- package/packages/ui/src/field.tsx +33 -0
- package/packages/ui/src/index.ts +17 -0
- package/packages/ui/src/menu.tsx +25 -0
- package/packages/ui/src/popover.tsx +22 -0
- package/packages/ui/src/scroll.tsx +51 -0
- package/packages/ui/src/select.tsx +33 -0
- package/packages/ui/src/styles.css +2 -0
- package/packages/ui/src/switch.tsx +22 -0
- package/packages/ui/src/tabs.tsx +22 -0
- package/packages/ui/src/toast.tsx +36 -0
- package/packages/ui/src/tooltip.tsx +19 -0
- package/packages/ui/tsconfig.json +12 -0
- package/packages/vue/README.md +40 -0
- package/packages/vue/package.json +42 -0
- package/packages/vue/src/hooks/use-aeon-machine.ts +10 -0
- package/packages/vue/src/index.ts +2 -0
- package/packages/vue/src/switch/index.ts +208 -0
- package/packages/vue/src/utils/part-props.ts +8 -0
- package/packages/vue/tsconfig.json +8 -0
- package/pnpm-workspace.yaml +3 -0
- package/scripts/ensure-headless-built.mjs +25 -0
- package/tsconfig.base.json +21 -0
- package/vercel.json +12 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Scroll as Headless, useScrollContext } from '@aeon-ui/react'
|
|
2
|
+
import { aeonScroll } from '@aeon-ui/panda/styled-system/recipes'
|
|
3
|
+
import { createContext, useContext, type ComponentProps } from 'react'
|
|
4
|
+
import { cn } from './cn.js'
|
|
5
|
+
|
|
6
|
+
type Axis = 'y' | 'x' | 'both'
|
|
7
|
+
type MaxH = 'sm' | 'md' | 'lg'
|
|
8
|
+
|
|
9
|
+
type SlotClasses = ReturnType<typeof aeonScroll>
|
|
10
|
+
|
|
11
|
+
const ScrollStyleCtx = createContext<SlotClasses | null>(null)
|
|
12
|
+
|
|
13
|
+
function useScrollStyles(): SlotClasses {
|
|
14
|
+
const s = useContext(ScrollStyleCtx)
|
|
15
|
+
if (!s) throw new Error('Scroll parts must be used within <Scroll.Root>')
|
|
16
|
+
return s
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type RootProps = ComponentProps<typeof Headless.Root> & {
|
|
20
|
+
axis?: Axis
|
|
21
|
+
maxH?: MaxH
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const Scroll = {
|
|
25
|
+
Root: ({ className, axis = 'both', maxH = 'md', children, ...props }: RootProps) => {
|
|
26
|
+
const s = aeonScroll({ axis, maxH })
|
|
27
|
+
return (
|
|
28
|
+
<ScrollStyleCtx.Provider value={s}>
|
|
29
|
+
<Headless.Root className={cn(s.root, className)} {...props}>
|
|
30
|
+
{children}
|
|
31
|
+
</Headless.Root>
|
|
32
|
+
</ScrollStyleCtx.Provider>
|
|
33
|
+
)
|
|
34
|
+
},
|
|
35
|
+
Viewport: ({ className, ...props }: ComponentProps<typeof Headless.Viewport>) => {
|
|
36
|
+
const s = useScrollStyles()
|
|
37
|
+
return <Headless.Viewport className={cn(s.viewport, className)} {...props} />
|
|
38
|
+
},
|
|
39
|
+
Content: ({ className, ...props }: ComponentProps<typeof Headless.Content>) => {
|
|
40
|
+
const s = useScrollStyles()
|
|
41
|
+
return <Headless.Content className={cn(s.content, className)} {...props} />
|
|
42
|
+
},
|
|
43
|
+
StateReadout: ({ className }: { className?: string }) => {
|
|
44
|
+
const { stateAttr } = useScrollContext()
|
|
45
|
+
return (
|
|
46
|
+
<code className={className} data-aeon-part="state-readout">
|
|
47
|
+
{stateAttr}
|
|
48
|
+
</code>
|
|
49
|
+
)
|
|
50
|
+
},
|
|
51
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Select as Headless } from '@aeon-ui/react'
|
|
2
|
+
import { aeonSelect } from '@aeon-ui/panda/styled-system/recipes'
|
|
3
|
+
import type { ComponentProps } from 'react'
|
|
4
|
+
import { cn } from './cn.js'
|
|
5
|
+
|
|
6
|
+
const styles = () => aeonSelect()
|
|
7
|
+
|
|
8
|
+
export const Select = {
|
|
9
|
+
Root: ({ className, ...props }: ComponentProps<typeof Headless.Root>) => {
|
|
10
|
+
const s = styles()
|
|
11
|
+
return <Headless.Root className={cn(s.root, className)} {...props} />
|
|
12
|
+
},
|
|
13
|
+
Trigger: ({ className, ...props }: ComponentProps<typeof Headless.Trigger>) => {
|
|
14
|
+
const s = styles()
|
|
15
|
+
return <Headless.Trigger className={cn(s.trigger, className)} {...props} />
|
|
16
|
+
},
|
|
17
|
+
Content: ({ className, ...props }: ComponentProps<typeof Headless.Content>) => {
|
|
18
|
+
const s = styles()
|
|
19
|
+
return <Headless.Content className={cn(s.content, className)} {...props} />
|
|
20
|
+
},
|
|
21
|
+
ValueText: ({ className, ...props }: ComponentProps<typeof Headless.ValueText>) => {
|
|
22
|
+
const s = styles()
|
|
23
|
+
return <Headless.ValueText className={cn(s.value, className)} {...props} />
|
|
24
|
+
},
|
|
25
|
+
Positioner: ({ className, ...props }: ComponentProps<typeof Headless.Positioner>) => {
|
|
26
|
+
const s = styles()
|
|
27
|
+
return <Headless.Positioner className={className} {...props} />
|
|
28
|
+
},
|
|
29
|
+
Item: ({ className, ...props }: ComponentProps<typeof Headless.Item>) => {
|
|
30
|
+
const s = styles()
|
|
31
|
+
return <Headless.Item className={cn(s.item, className)} {...props} />
|
|
32
|
+
},
|
|
33
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Switch as Headless } from '@aeon-ui/react'
|
|
2
|
+
import { aeonSwitch } from '@aeon-ui/panda/styled-system/recipes'
|
|
3
|
+
import type { ComponentProps } from 'react'
|
|
4
|
+
import { cn } from './cn.js'
|
|
5
|
+
|
|
6
|
+
const switchStyles = aeonSwitch()
|
|
7
|
+
|
|
8
|
+
export const Switch = {
|
|
9
|
+
Root: ({ className, ...props }: ComponentProps<typeof Headless.Root>) => (
|
|
10
|
+
<Headless.Root className={cn(switchStyles.root, className)} {...props} />
|
|
11
|
+
),
|
|
12
|
+
Control: ({ className, ...props }: ComponentProps<typeof Headless.Control>) => (
|
|
13
|
+
<Headless.Control className={cn(switchStyles.control, className)} {...props} />
|
|
14
|
+
),
|
|
15
|
+
Thumb: ({ className, ...props }: ComponentProps<typeof Headless.Thumb>) => (
|
|
16
|
+
<Headless.Thumb className={cn(switchStyles.thumb, className)} {...props} />
|
|
17
|
+
),
|
|
18
|
+
Label: ({ className, ...props }: ComponentProps<typeof Headless.Label>) => (
|
|
19
|
+
<Headless.Label className={cn(switchStyles.label, className)} {...props} />
|
|
20
|
+
),
|
|
21
|
+
HiddenInput: Headless.HiddenInput,
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Tabs as Headless } from '@aeon-ui/react'
|
|
2
|
+
import { aeonTabs } from '@aeon-ui/panda/styled-system/recipes'
|
|
3
|
+
import type { ComponentProps } from 'react'
|
|
4
|
+
import { cn } from './cn.js'
|
|
5
|
+
|
|
6
|
+
const tabs = aeonTabs()
|
|
7
|
+
|
|
8
|
+
export const Tabs = {
|
|
9
|
+
Root: ({ className, ...props }: ComponentProps<typeof Headless.Root>) => (
|
|
10
|
+
<Headless.Root className={cn(tabs.root, className)} {...props} />
|
|
11
|
+
),
|
|
12
|
+
List: ({ className, ...props }: ComponentProps<typeof Headless.List>) => (
|
|
13
|
+
<Headless.List className={cn(tabs.list, className)} {...props} />
|
|
14
|
+
),
|
|
15
|
+
Trigger: ({ className, ...props }: ComponentProps<typeof Headless.Trigger>) => (
|
|
16
|
+
<Headless.Trigger className={cn(tabs.trigger, className)} {...props} />
|
|
17
|
+
),
|
|
18
|
+
Content: ({ className, ...props }: ComponentProps<typeof Headless.Content>) => (
|
|
19
|
+
<Headless.Content className={cn(tabs.content, className)} {...props} />
|
|
20
|
+
),
|
|
21
|
+
Indicator: Headless.Indicator,
|
|
22
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Toast as Headless, useToast } from '@aeon-ui/react'
|
|
2
|
+
import { aeonToast } from '@aeon-ui/panda/styled-system/recipes'
|
|
3
|
+
import type { ComponentProps } from 'react'
|
|
4
|
+
import { cn } from './cn.js'
|
|
5
|
+
|
|
6
|
+
const toast = aeonToast()
|
|
7
|
+
|
|
8
|
+
export const Toast = {
|
|
9
|
+
Provider: Headless.Provider,
|
|
10
|
+
Viewport: ({
|
|
11
|
+
className,
|
|
12
|
+
placement = 'bottom-end',
|
|
13
|
+
...props
|
|
14
|
+
}: ComponentProps<typeof Headless.Viewport>) => (
|
|
15
|
+
<Headless.Viewport
|
|
16
|
+
className={cn(toast.viewport, className)}
|
|
17
|
+
placement={placement}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
),
|
|
21
|
+
Root: ({ className, ...props }: ComponentProps<typeof Headless.Root>) => (
|
|
22
|
+
<Headless.Root className={cn(toast.root, className)} {...props} />
|
|
23
|
+
),
|
|
24
|
+
Title: ({ className, ...props }: ComponentProps<typeof Headless.Title>) => (
|
|
25
|
+
<Headless.Title className={cn(toast.title, className)} {...props} />
|
|
26
|
+
),
|
|
27
|
+
Description: ({ className, ...props }: ComponentProps<typeof Headless.Description>) => (
|
|
28
|
+
<Headless.Description className={cn(toast.description, className)} {...props} />
|
|
29
|
+
),
|
|
30
|
+
CloseTrigger: ({ className, ...props }: ComponentProps<typeof Headless.CloseTrigger>) => (
|
|
31
|
+
<Headless.CloseTrigger className={cn(toast.closeTrigger, className)} {...props} />
|
|
32
|
+
),
|
|
33
|
+
Show: Headless.Show,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { useToast }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Tooltip as Headless } from '@aeon-ui/react'
|
|
2
|
+
import { aeonTooltip } from '@aeon-ui/panda/styled-system/recipes'
|
|
3
|
+
import type { ComponentProps } from 'react'
|
|
4
|
+
import { cn } from './cn.js'
|
|
5
|
+
|
|
6
|
+
const tooltip = aeonTooltip()
|
|
7
|
+
|
|
8
|
+
export const Tooltip = {
|
|
9
|
+
Root: Headless.Root,
|
|
10
|
+
Trigger: ({ className, ...props }: ComponentProps<typeof Headless.Trigger>) => (
|
|
11
|
+
<Headless.Trigger className={cn(tooltip.trigger, className)} {...props} />
|
|
12
|
+
),
|
|
13
|
+
Positioner: ({ className, ...props }: ComponentProps<typeof Headless.Positioner>) => (
|
|
14
|
+
<Headless.Positioner className={cn(tooltip.positioner, className)} {...props} />
|
|
15
|
+
),
|
|
16
|
+
Content: ({ className, ...props }: ComponentProps<typeof Headless.Content>) => (
|
|
17
|
+
<Headless.Content className={cn(tooltip.content, className)} {...props} />
|
|
18
|
+
),
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "dist",
|
|
5
|
+
"rootDir": "src",
|
|
6
|
+
"paths": {
|
|
7
|
+
"@aeon-ui/panda/styled-system/css": ["../panda/styled-system/css/index.d.ts"],
|
|
8
|
+
"@aeon-ui/panda/styled-system/recipes": ["../panda/styled-system/recipes/index.d.ts"]
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"include": ["src"]
|
|
12
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @aeon-ui/vue
|
|
2
|
+
|
|
3
|
+
Headless **Vue 3** bindings for [Aeon UI](https://github.com/GenericCPU/aeon-ui). Behavior lives in `@aeon-ui/primitives` (XState); this package wires snapshots to Vue and applies `@aeon-ui/core` anatomy attributes.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @aeon-ui/vue @aeon-ui/core @aeon-ui/primitives xstate
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Peer: `vue` ^3.4.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```vue
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
import { Switch } from '@aeon-ui/vue'
|
|
18
|
+
import { ref } from 'vue'
|
|
19
|
+
|
|
20
|
+
const on = ref(true)
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<Switch.Root :checked="on" @update:checked="(v) => (on = v)">
|
|
25
|
+
<Switch.Control>
|
|
26
|
+
<Switch.Thumb />
|
|
27
|
+
</Switch.Control>
|
|
28
|
+
<Switch.Label>Notifications</Switch.Label>
|
|
29
|
+
</Switch.Root>
|
|
30
|
+
</template>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Use `checked` + `@update:checked` or `onCheckedChange` for controlled mode (see `SwitchRoot` props).
|
|
34
|
+
|
|
35
|
+
## v0.1 scope
|
|
36
|
+
|
|
37
|
+
- `useAeonMachine` — `@xstate/vue` wrapper
|
|
38
|
+
- `Switch` — full compound port (reference adapter)
|
|
39
|
+
|
|
40
|
+
More components follow the same pattern as React stabilizes. See [FRAMEWORKS.md](../../FRAMEWORKS.md).
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aeon-ui/vue",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Headless Vue 3 components backed by Aeon XState machines",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/GenericCPU/aeon-ui.git",
|
|
9
|
+
"directory": "packages/vue"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": { "access": "public" },
|
|
12
|
+
"files": ["dist", "src/**/*.svelte", "README.md"],
|
|
13
|
+
"keywords": ["aeon-ui", "vue", "headless", "xstate", "statechart"],
|
|
14
|
+
"type": "module",
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsup src/index.ts --format esm --dts --clean --external vue --external xstate --external @xstate/vue --external @aeon-ui/core --external @aeon-ui/primitives",
|
|
26
|
+
"typecheck": "tsc --noEmit"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@aeon-ui/core": "workspace:*",
|
|
30
|
+
"@aeon-ui/primitives": "workspace:*",
|
|
31
|
+
"@xstate/vue": "^5.0.0",
|
|
32
|
+
"xstate": "^5.19.2"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"vue": "^3.4.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"tsup": "^8.4.0",
|
|
39
|
+
"typescript": "^5.8.3",
|
|
40
|
+
"vue": "^3.5.13"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useMachine } from '@xstate/vue'
|
|
2
|
+
import type { AnyStateMachine } from 'xstate'
|
|
3
|
+
|
|
4
|
+
/** Bridge executable statecharts to Vue — UI = f(snapshot). */
|
|
5
|
+
export function useAeonMachine<M extends AnyStateMachine>(
|
|
6
|
+
machine: M,
|
|
7
|
+
options?: Parameters<typeof useMachine<M>>[1],
|
|
8
|
+
) {
|
|
9
|
+
return useMachine(machine, options)
|
|
10
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { partAttrs, switchAnatomy } from '@aeon-ui/core'
|
|
2
|
+
import { toggleMachine } from '@aeon-ui/primitives'
|
|
3
|
+
import {
|
|
4
|
+
defineComponent,
|
|
5
|
+
h,
|
|
6
|
+
inject,
|
|
7
|
+
provide,
|
|
8
|
+
watch,
|
|
9
|
+
type HTMLAttributes,
|
|
10
|
+
type InjectionKey,
|
|
11
|
+
type PropType,
|
|
12
|
+
} from 'vue'
|
|
13
|
+
import { useAeonMachine } from '../hooks/use-aeon-machine.js'
|
|
14
|
+
import { partProps } from '../utils/part-props.js'
|
|
15
|
+
|
|
16
|
+
interface SwitchContext {
|
|
17
|
+
checked: boolean
|
|
18
|
+
disabled: boolean
|
|
19
|
+
controlled: boolean
|
|
20
|
+
onCheckedChange?: (checked: boolean) => void
|
|
21
|
+
send: ReturnType<typeof useAeonMachine<typeof toggleMachine>>['send']
|
|
22
|
+
pressState: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const SwitchKey: InjectionKey<SwitchContext> = Symbol('aeon-switch')
|
|
26
|
+
|
|
27
|
+
export const SwitchRoot = defineComponent({
|
|
28
|
+
name: 'AeonSwitchRoot',
|
|
29
|
+
props: {
|
|
30
|
+
checked: { type: Boolean as PropType<boolean | undefined>, default: undefined },
|
|
31
|
+
defaultChecked: { type: Boolean, default: false },
|
|
32
|
+
disabled: { type: Boolean, default: false },
|
|
33
|
+
onCheckedChange: { type: Function as PropType<(checked: boolean) => void>, default: undefined },
|
|
34
|
+
},
|
|
35
|
+
setup(props, { slots, attrs }) {
|
|
36
|
+
const { snapshot, send } = useAeonMachine(toggleMachine, {
|
|
37
|
+
input: { checked: props.defaultChecked, disabled: props.disabled },
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const controlled = props.checked !== undefined
|
|
41
|
+
const resolvedChecked = () => props.checked ?? snapshot.value.context.checked
|
|
42
|
+
const pressState = () => (snapshot.value.matches({ interaction: 'pressed' }) ? 'pressed' : 'idle')
|
|
43
|
+
|
|
44
|
+
watch(
|
|
45
|
+
() => props.checked,
|
|
46
|
+
(v) => {
|
|
47
|
+
if (v !== undefined) send({ type: 'SET_CHECKED', checked: v })
|
|
48
|
+
},
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
watch(
|
|
52
|
+
() => resolvedChecked(),
|
|
53
|
+
(v) => {
|
|
54
|
+
if (!controlled) props.onCheckedChange?.(v)
|
|
55
|
+
},
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
const toggle = () => {
|
|
59
|
+
if (props.disabled) return
|
|
60
|
+
const next = !resolvedChecked()
|
|
61
|
+
if (controlled) props.onCheckedChange?.(next)
|
|
62
|
+
else send({ type: 'TOGGLE' })
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
provide(SwitchKey, {
|
|
66
|
+
get checked() {
|
|
67
|
+
return resolvedChecked()
|
|
68
|
+
},
|
|
69
|
+
get disabled() {
|
|
70
|
+
return props.disabled
|
|
71
|
+
},
|
|
72
|
+
get controlled() {
|
|
73
|
+
return controlled
|
|
74
|
+
},
|
|
75
|
+
onCheckedChange: props.onCheckedChange,
|
|
76
|
+
send,
|
|
77
|
+
get pressState() {
|
|
78
|
+
return pressState()
|
|
79
|
+
},
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
return () =>
|
|
83
|
+
h(
|
|
84
|
+
'label',
|
|
85
|
+
partProps(
|
|
86
|
+
partAttrs(switchAnatomy.scope, switchAnatomy.root, {
|
|
87
|
+
state: `${resolvedChecked() ? 'checked' : 'unchecked'} ${pressState()}`,
|
|
88
|
+
disabled: props.disabled,
|
|
89
|
+
}) as Record<string, unknown>,
|
|
90
|
+
{
|
|
91
|
+
...attrs,
|
|
92
|
+
onClick: (e: MouseEvent) => {
|
|
93
|
+
const target = e.target as HTMLElement
|
|
94
|
+
if (target.closest(`[data-aeon-part="${switchAnatomy.control}"]`)) return
|
|
95
|
+
toggle()
|
|
96
|
+
},
|
|
97
|
+
} as HTMLAttributes,
|
|
98
|
+
),
|
|
99
|
+
slots.default?.() ?? undefined,
|
|
100
|
+
)
|
|
101
|
+
},
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
function useSwitchCtx(): SwitchContext {
|
|
105
|
+
const ctx = inject(SwitchKey)
|
|
106
|
+
if (!ctx) throw new Error('Switch parts must be used within SwitchRoot')
|
|
107
|
+
return ctx
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export const SwitchControl = defineComponent({
|
|
111
|
+
name: 'AeonSwitchControl',
|
|
112
|
+
setup(_, { attrs }) {
|
|
113
|
+
const ctx = useSwitchCtx()
|
|
114
|
+
const toggle = () => {
|
|
115
|
+
if (ctx.disabled) return
|
|
116
|
+
const next = !ctx.checked
|
|
117
|
+
if (ctx.controlled) ctx.onCheckedChange?.(next)
|
|
118
|
+
else ctx.send({ type: 'TOGGLE' })
|
|
119
|
+
}
|
|
120
|
+
return () =>
|
|
121
|
+
h('span', {
|
|
122
|
+
role: 'switch',
|
|
123
|
+
'aria-checked': ctx.checked,
|
|
124
|
+
tabindex: ctx.disabled ? -1 : 0,
|
|
125
|
+
...partProps(
|
|
126
|
+
partAttrs(switchAnatomy.scope, switchAnatomy.control, {
|
|
127
|
+
state: `${ctx.checked ? 'checked' : 'unchecked'} ${ctx.pressState}`,
|
|
128
|
+
disabled: ctx.disabled,
|
|
129
|
+
}) as Record<string, unknown>,
|
|
130
|
+
attrs as HTMLAttributes,
|
|
131
|
+
),
|
|
132
|
+
onClick: (e: MouseEvent) => {
|
|
133
|
+
toggle()
|
|
134
|
+
e.stopPropagation()
|
|
135
|
+
},
|
|
136
|
+
onPointerdown: () => {
|
|
137
|
+
if (!ctx.disabled) ctx.send({ type: 'POINTER_DOWN' })
|
|
138
|
+
},
|
|
139
|
+
onPointerup: () => ctx.send({ type: 'POINTER_UP' }),
|
|
140
|
+
onPointerleave: () => ctx.send({ type: 'POINTER_LEAVE' }),
|
|
141
|
+
onKeydown: (e: KeyboardEvent) => {
|
|
142
|
+
if (e.key === ' ' || e.key === 'Enter') {
|
|
143
|
+
e.preventDefault()
|
|
144
|
+
toggle()
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
})
|
|
148
|
+
},
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
export const SwitchThumb = defineComponent({
|
|
152
|
+
name: 'AeonSwitchThumb',
|
|
153
|
+
setup(_, { attrs }) {
|
|
154
|
+
const ctx = useSwitchCtx()
|
|
155
|
+
return () =>
|
|
156
|
+
h(
|
|
157
|
+
'span',
|
|
158
|
+
partProps(
|
|
159
|
+
partAttrs(switchAnatomy.scope, switchAnatomy.thumb, {
|
|
160
|
+
state: `${ctx.checked ? 'checked' : 'unchecked'} ${ctx.pressState}`,
|
|
161
|
+
}) as Record<string, unknown>,
|
|
162
|
+
attrs as HTMLAttributes,
|
|
163
|
+
),
|
|
164
|
+
)
|
|
165
|
+
},
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
export const SwitchLabel = defineComponent({
|
|
169
|
+
name: 'AeonSwitchLabel',
|
|
170
|
+
setup(_, { slots, attrs }) {
|
|
171
|
+
return () =>
|
|
172
|
+
h(
|
|
173
|
+
'span',
|
|
174
|
+
partProps(
|
|
175
|
+
partAttrs(switchAnatomy.scope, switchAnatomy.label) as Record<string, unknown>,
|
|
176
|
+
attrs as HTMLAttributes,
|
|
177
|
+
),
|
|
178
|
+
slots.default?.(),
|
|
179
|
+
)
|
|
180
|
+
},
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
export const SwitchHiddenInput = defineComponent({
|
|
184
|
+
name: 'AeonSwitchHiddenInput',
|
|
185
|
+
setup(_, { attrs }) {
|
|
186
|
+
const ctx = useSwitchCtx()
|
|
187
|
+
return () =>
|
|
188
|
+
h('input', {
|
|
189
|
+
type: 'checkbox',
|
|
190
|
+
checked: ctx.checked,
|
|
191
|
+
readonly: true,
|
|
192
|
+
tabindex: -1,
|
|
193
|
+
'aria-hidden': true,
|
|
194
|
+
...partProps(
|
|
195
|
+
partAttrs(switchAnatomy.scope, switchAnatomy.hiddenInput) as Record<string, unknown>,
|
|
196
|
+
attrs as HTMLAttributes,
|
|
197
|
+
),
|
|
198
|
+
})
|
|
199
|
+
},
|
|
200
|
+
})
|
|
201
|
+
|
|
202
|
+
export const Switch = {
|
|
203
|
+
Root: SwitchRoot,
|
|
204
|
+
Control: SwitchControl,
|
|
205
|
+
Thumb: SwitchThumb,
|
|
206
|
+
Label: SwitchLabel,
|
|
207
|
+
HiddenInput: SwitchHiddenInput,
|
|
208
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Build @aeon-ui/core, primitives, and react when dist/ is missing.
|
|
4
|
+
* Consumers: add to prebuild — `node path/to/AeonUI/scripts/ensure-headless-built.mjs`
|
|
5
|
+
* Override repo root: AEON_UI_ROOT=/path/to/AeonUI
|
|
6
|
+
*/
|
|
7
|
+
import { execSync } from 'node:child_process'
|
|
8
|
+
import { existsSync } from 'node:fs'
|
|
9
|
+
import path from 'node:path'
|
|
10
|
+
import { fileURLToPath } from 'node:url'
|
|
11
|
+
|
|
12
|
+
const scriptDir = path.dirname(fileURLToPath(import.meta.url))
|
|
13
|
+
const aeonRoot = process.env.AEON_UI_ROOT
|
|
14
|
+
? path.resolve(process.env.AEON_UI_ROOT)
|
|
15
|
+
: path.resolve(scriptDir, '..')
|
|
16
|
+
|
|
17
|
+
const marker = path.join(aeonRoot, 'packages/react/dist/index.js')
|
|
18
|
+
|
|
19
|
+
if (existsSync(marker)) {
|
|
20
|
+
console.log('[aeon-ui] headless packages already built')
|
|
21
|
+
process.exit(0)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
console.log('[aeon-ui] building core, primitives, react…')
|
|
25
|
+
execSync('pnpm run build:headless', { cwd: aeonRoot, stdio: 'inherit' })
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"declaration": true,
|
|
11
|
+
"declarationMap": true,
|
|
12
|
+
"sourceMap": true,
|
|
13
|
+
"noUnusedLocals": true,
|
|
14
|
+
"noUnusedParameters": true,
|
|
15
|
+
"noFallthroughCasesInSwitch": true,
|
|
16
|
+
"isolatedModules": true,
|
|
17
|
+
"verbatimModuleSyntax": true,
|
|
18
|
+
"esModuleInterop": true,
|
|
19
|
+
"resolveJsonModule": true
|
|
20
|
+
}
|
|
21
|
+
}
|
package/vercel.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://openapi.vercel.sh/vercel.json",
|
|
3
|
+
"installCommand": "pnpm install",
|
|
4
|
+
"buildCommand": "pnpm --filter @aeon-ui/demo build",
|
|
5
|
+
"outputDirectory": "apps/demo/dist",
|
|
6
|
+
"framework": null,
|
|
7
|
+
"build": {
|
|
8
|
+
"env": {
|
|
9
|
+
"VITE_SITE_ORIGIN": "https://aeon-ui.com"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|