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,103 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
attachMediaAnalyser,
|
|
4
|
+
bandRanges,
|
|
5
|
+
createBarMotionState,
|
|
6
|
+
resumeAudioContext,
|
|
7
|
+
stepBarMotion,
|
|
8
|
+
type BarMotionOptions,
|
|
9
|
+
} from '@aeon-ui/signal'
|
|
10
|
+
|
|
11
|
+
export type UseSignalVisualizerOptions = BarMotionOptions & {
|
|
12
|
+
enabled?: boolean
|
|
13
|
+
barCount?: number
|
|
14
|
+
/** When set, attaches analyser to this element while active. */
|
|
15
|
+
media?: HTMLAudioElement | null
|
|
16
|
+
/** Use a pre-attached analyser (e.g. from `createDemoSignal`). */
|
|
17
|
+
analyser?: AnalyserNode | null
|
|
18
|
+
active?: boolean
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* RAF loop: frequency bands → per-bar scale + brightness (Soundbase-style motion).
|
|
23
|
+
*/
|
|
24
|
+
export function useSignalVisualizer(options: UseSignalVisualizerOptions = {}) {
|
|
25
|
+
const {
|
|
26
|
+
enabled = true,
|
|
27
|
+
barCount = 7,
|
|
28
|
+
media = null,
|
|
29
|
+
analyser: analyserProp = null,
|
|
30
|
+
active: activeProp,
|
|
31
|
+
...motionOptions
|
|
32
|
+
} = options
|
|
33
|
+
|
|
34
|
+
const active = activeProp ?? (enabled && (!!analyserProp || !!media))
|
|
35
|
+
const [scales, setScales] = useState(() => createBarMotionState(barCount, motionOptions).scales)
|
|
36
|
+
const [brightness, setBrightness] = useState(
|
|
37
|
+
() => createBarMotionState(barCount, motionOptions).brightness,
|
|
38
|
+
)
|
|
39
|
+
const motionRef = useRef(createBarMotionState(barCount, motionOptions))
|
|
40
|
+
const rafRef = useRef<number | null>(null)
|
|
41
|
+
const dataRef = useRef<Uint8Array | null>(null)
|
|
42
|
+
const rangesRef = useRef<{ start: number; end: number }[]>([])
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
motionRef.current = createBarMotionState(barCount, motionOptions)
|
|
46
|
+
}, [barCount])
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (!active) {
|
|
50
|
+
motionRef.current = createBarMotionState(barCount, motionOptions)
|
|
51
|
+
setScales([...motionRef.current.scales])
|
|
52
|
+
setBrightness([...motionRef.current.brightness])
|
|
53
|
+
if (rafRef.current !== null) {
|
|
54
|
+
cancelAnimationFrame(rafRef.current)
|
|
55
|
+
rafRef.current = null
|
|
56
|
+
}
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
void resumeAudioContext()
|
|
61
|
+
|
|
62
|
+
let analyser = analyserProp
|
|
63
|
+
if (!analyser && media) {
|
|
64
|
+
analyser = attachMediaAnalyser(media, { crossOrigin: 'anonymous' })
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const bufferLength = analyser?.frequencyBinCount ?? 0
|
|
68
|
+
if (analyser && bufferLength > 0) {
|
|
69
|
+
dataRef.current = new Uint8Array(bufferLength)
|
|
70
|
+
rangesRef.current = bandRanges(bufferLength, barCount)
|
|
71
|
+
} else {
|
|
72
|
+
dataRef.current = null
|
|
73
|
+
rangesRef.current = []
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const tick = () => {
|
|
77
|
+
if (analyser && dataRef.current) {
|
|
78
|
+
analyser.getByteFrequencyData(dataRef.current as Uint8Array<ArrayBuffer>)
|
|
79
|
+
}
|
|
80
|
+
stepBarMotion(
|
|
81
|
+
motionRef.current,
|
|
82
|
+
analyser,
|
|
83
|
+
dataRef.current,
|
|
84
|
+
rangesRef.current,
|
|
85
|
+
motionOptions,
|
|
86
|
+
)
|
|
87
|
+
setScales([...motionRef.current.scales])
|
|
88
|
+
setBrightness([...motionRef.current.brightness])
|
|
89
|
+
rafRef.current = requestAnimationFrame(tick)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
rafRef.current = requestAnimationFrame(tick)
|
|
93
|
+
|
|
94
|
+
return () => {
|
|
95
|
+
if (rafRef.current !== null) {
|
|
96
|
+
cancelAnimationFrame(rafRef.current)
|
|
97
|
+
rafRef.current = null
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}, [active, media, analyserProp, barCount])
|
|
101
|
+
|
|
102
|
+
return { scales, brightness, active }
|
|
103
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aeon-ui/scene",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CSS 3D scene transforms and perspective helpers for Aeon Scene",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/GenericCPU/aeon-ui.git",
|
|
9
|
+
"directory": "packages/scene"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": { "access": "public" },
|
|
12
|
+
"files": ["dist", "README.md"],
|
|
13
|
+
"keywords": ["aeon-ui", "scene", "3d", "css", "transform"],
|
|
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",
|
|
26
|
+
"typecheck": "tsc --noEmit"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"tsup": "^8.4.0",
|
|
30
|
+
"typescript": "^5.8.3"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { SceneUnit } from './transform.js'
|
|
2
|
+
|
|
3
|
+
/** Width × height × depth of a box room (px). */
|
|
4
|
+
export type SceneRoomSize = {
|
|
5
|
+
width: number
|
|
6
|
+
height: number
|
|
7
|
+
depth: number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type SceneRoomCamera = {
|
|
11
|
+
/** Look-down angle on the whole room (degrees). */
|
|
12
|
+
pitch?: number
|
|
13
|
+
/** Turn the room (degrees). */
|
|
14
|
+
yaw?: number
|
|
15
|
+
/** Push room back from the viewer (px). */
|
|
16
|
+
offsetZ?: number
|
|
17
|
+
/** Vertical anchor of the room in the stage (0–100%). */
|
|
18
|
+
anchorY?: SceneUnit
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** CSS variables consumed by `.aeon-scene-room*` in scene-room.css */
|
|
22
|
+
export function sceneRoomVars(
|
|
23
|
+
size: SceneRoomSize,
|
|
24
|
+
camera: SceneRoomCamera = {},
|
|
25
|
+
): Record<string, string> {
|
|
26
|
+
const pitch = camera.pitch ?? 10
|
|
27
|
+
const yaw = camera.yaw ?? 0
|
|
28
|
+
const offsetZ = camera.offsetZ ?? -120
|
|
29
|
+
const anchorY = camera.anchorY ?? '46%'
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
'--aeon-room-w': `${size.width}px`,
|
|
33
|
+
'--aeon-room-h': `${size.height}px`,
|
|
34
|
+
'--aeon-room-d': `${size.depth}px`,
|
|
35
|
+
'--aeon-room-pitch': `${pitch}deg`,
|
|
36
|
+
'--aeon-room-yaw': `${yaw}deg`,
|
|
37
|
+
'--aeon-room-offset-z': `${offsetZ}px`,
|
|
38
|
+
'--aeon-room-anchor-y': typeof anchorY === 'number' ? `${anchorY}px` : anchorY,
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export type SceneUnit = number | `${number}%` | `${number}px` | `${number}rem` | `${number}vh` | `${number}vw`
|
|
2
|
+
|
|
3
|
+
/** Layer transform in CSS 3D (degrees for rotation). */
|
|
4
|
+
export type SceneTransform3d = {
|
|
5
|
+
x?: SceneUnit
|
|
6
|
+
y?: SceneUnit
|
|
7
|
+
z?: number
|
|
8
|
+
rotateX?: number
|
|
9
|
+
rotateY?: number
|
|
10
|
+
rotateZ?: number
|
|
11
|
+
scale?: number
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type ScenePerspective = {
|
|
15
|
+
distance?: number
|
|
16
|
+
origin?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function formatSceneUnit(value: SceneUnit | undefined, fallback: string): string {
|
|
20
|
+
if (value === undefined) return fallback
|
|
21
|
+
if (typeof value === 'number') return `${value}px`
|
|
22
|
+
return value
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Build `transform` + `transform-origin` for a scene layer. */
|
|
26
|
+
export function sceneTransformStyle(
|
|
27
|
+
transform: SceneTransform3d,
|
|
28
|
+
options?: { origin?: string; preserve3d?: boolean },
|
|
29
|
+
): Record<string, string> {
|
|
30
|
+
const x = formatSceneUnit(transform.x, '0')
|
|
31
|
+
const y = formatSceneUnit(transform.y, '0')
|
|
32
|
+
const z = transform.z ?? 0
|
|
33
|
+
const parts: string[] = [`translate3d(${x}, ${y}, ${z}px)`]
|
|
34
|
+
|
|
35
|
+
if (transform.rotateX) parts.push(`rotateX(${transform.rotateX}deg)`)
|
|
36
|
+
if (transform.rotateY) parts.push(`rotateY(${transform.rotateY}deg)`)
|
|
37
|
+
if (transform.rotateZ) parts.push(`rotateZ(${transform.rotateZ}deg)`)
|
|
38
|
+
if (transform.scale != null) parts.push(`scale(${transform.scale})`)
|
|
39
|
+
|
|
40
|
+
const style: Record<string, string> = { transform: parts.join(' ') }
|
|
41
|
+
if (options?.origin) style.transformOrigin = options.origin
|
|
42
|
+
if (options?.preserve3d !== false) style.transformStyle = 'preserve-3d'
|
|
43
|
+
return style
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Perspective on a stage root (apply to the element that wraps all layers). */
|
|
47
|
+
export function sceneStageStyle(perspective: ScenePerspective = {}): Record<string, string> {
|
|
48
|
+
return {
|
|
49
|
+
perspective: `${perspective.distance ?? 1100}px`,
|
|
50
|
+
perspectiveOrigin: perspective.origin ?? '50% 42%',
|
|
51
|
+
transformStyle: 'preserve-3d',
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Wall trapezoid clip — left or right alley wall. */
|
|
56
|
+
export function sceneWallClip(side: 'left' | 'right'): string {
|
|
57
|
+
return side === 'left'
|
|
58
|
+
? 'polygon(0 100%, 0 5%, 78% 0, 100% 100%)'
|
|
59
|
+
: 'polygon(100% 100%, 100% 5%, 22% 0, 0 100%)'
|
|
60
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# @aeon-ui/signal
|
|
2
|
+
|
|
3
|
+
Framework-agnostic audio analysis and bar motion smoothing for visualizers. Optional sibling to the control-plane packages — see [SCENE.md](../../SCENE.md).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { attachMediaAnalyser, bandRanges, stepBarMotion, createBarMotionState } from '@aeon-ui/signal'
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Pair with `@aeon-ui/react-scene` for React bindings, or drive canvas/SVG yourself from the motion state.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aeon-ui/signal",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Audio analyser tap and band motion math for Aeon Scene visualizers",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/GenericCPU/aeon-ui.git",
|
|
9
|
+
"directory": "packages/signal"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": { "access": "public" },
|
|
12
|
+
"files": ["dist", "README.md"],
|
|
13
|
+
"keywords": ["aeon-ui", "audio", "visualizer", "analyser", "web-audio"],
|
|
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",
|
|
26
|
+
"typecheck": "tsc --noEmit"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"tsup": "^8.4.0",
|
|
30
|
+
"typescript": "^5.8.3"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
export type AttachAnalyserOptions = {
|
|
2
|
+
fftSize?: number
|
|
3
|
+
smoothingTimeConstant?: number
|
|
4
|
+
/** Set on the element before `src` when using remote audio (CORS). */
|
|
5
|
+
crossOrigin?: '' | 'anonymous' | 'use-credentials'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
let sharedContext: AudioContext | null = null
|
|
9
|
+
const graphs = new WeakMap<HTMLAudioElement, AnalyserNode>()
|
|
10
|
+
const failed = new WeakSet<HTMLAudioElement>()
|
|
11
|
+
|
|
12
|
+
function getContext(): AudioContext {
|
|
13
|
+
if (!sharedContext) {
|
|
14
|
+
sharedContext = new AudioContext()
|
|
15
|
+
}
|
|
16
|
+
return sharedContext
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Tap an `<audio>` element for visualization without muting playback. */
|
|
20
|
+
export function attachMediaAnalyser(
|
|
21
|
+
audio: HTMLAudioElement,
|
|
22
|
+
options?: AttachAnalyserOptions,
|
|
23
|
+
): AnalyserNode | null {
|
|
24
|
+
if (failed.has(audio)) return null
|
|
25
|
+
|
|
26
|
+
const existing = graphs.get(audio)
|
|
27
|
+
if (existing) {
|
|
28
|
+
void sharedContext?.resume()
|
|
29
|
+
return existing
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (options?.crossOrigin !== undefined) {
|
|
33
|
+
audio.crossOrigin = options.crossOrigin
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
const ctx = getContext()
|
|
38
|
+
const source = ctx.createMediaElementSource(audio)
|
|
39
|
+
const analyser = ctx.createAnalyser()
|
|
40
|
+
analyser.fftSize = options?.fftSize ?? 256
|
|
41
|
+
analyser.smoothingTimeConstant = options?.smoothingTimeConstant ?? 0.65
|
|
42
|
+
|
|
43
|
+
source.connect(analyser)
|
|
44
|
+
source.connect(ctx.destination)
|
|
45
|
+
|
|
46
|
+
graphs.set(audio, analyser)
|
|
47
|
+
void ctx.resume()
|
|
48
|
+
return analyser
|
|
49
|
+
} catch {
|
|
50
|
+
failed.add(audio)
|
|
51
|
+
return null
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function getMediaAnalyser(audio: HTMLAudioElement | null | undefined): AnalyserNode | null {
|
|
56
|
+
if (!audio) return null
|
|
57
|
+
return graphs.get(audio) ?? null
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export async function resumeAudioContext(): Promise<void> {
|
|
61
|
+
if (sharedContext?.state === 'suspended') {
|
|
62
|
+
await sharedContext.resume()
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type DemoSignal = {
|
|
67
|
+
context: AudioContext
|
|
68
|
+
analyser: AnalyserNode
|
|
69
|
+
start: () => void
|
|
70
|
+
stop: () => void
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Low-volume oscillator for demos and playgrounds (no media file). */
|
|
74
|
+
export function createDemoSignal(options?: { frequency?: number; gain?: number }): DemoSignal {
|
|
75
|
+
const context = new AudioContext()
|
|
76
|
+
const oscillator = context.createOscillator()
|
|
77
|
+
oscillator.type = 'sawtooth'
|
|
78
|
+
oscillator.frequency.value = options?.frequency ?? 110
|
|
79
|
+
|
|
80
|
+
const gain = context.createGain()
|
|
81
|
+
gain.gain.value = options?.gain ?? 0.04
|
|
82
|
+
|
|
83
|
+
const analyser = context.createAnalyser()
|
|
84
|
+
analyser.fftSize = 256
|
|
85
|
+
analyser.smoothingTimeConstant = 0.65
|
|
86
|
+
|
|
87
|
+
oscillator.connect(gain)
|
|
88
|
+
gain.connect(analyser)
|
|
89
|
+
analyser.connect(context.destination)
|
|
90
|
+
|
|
91
|
+
let running = false
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
context,
|
|
95
|
+
analyser,
|
|
96
|
+
start() {
|
|
97
|
+
if (running) return
|
|
98
|
+
oscillator.start()
|
|
99
|
+
running = true
|
|
100
|
+
void context.resume()
|
|
101
|
+
},
|
|
102
|
+
stop() {
|
|
103
|
+
if (!running) return
|
|
104
|
+
try {
|
|
105
|
+
oscillator.stop()
|
|
106
|
+
} catch {
|
|
107
|
+
/* already stopped */
|
|
108
|
+
}
|
|
109
|
+
running = false
|
|
110
|
+
void context.close()
|
|
111
|
+
},
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type BandRange = { start: number; end: number }
|
|
2
|
+
|
|
3
|
+
/** Split FFT bins into `barCount` bands (low → high, skewed toward mids). */
|
|
4
|
+
export function bandRanges(bufferLength: number, barCount: number): BandRange[] {
|
|
5
|
+
const ranges: BandRange[] = []
|
|
6
|
+
const minBin = 1
|
|
7
|
+
const maxBin = bufferLength - 1
|
|
8
|
+
const span = maxBin - minBin
|
|
9
|
+
|
|
10
|
+
for (let i = 0; i < barCount; i++) {
|
|
11
|
+
const t0 = i / barCount
|
|
12
|
+
const t1 = (i + 1) / barCount
|
|
13
|
+
const start = Math.floor(minBin + span * t0 ** 1.45)
|
|
14
|
+
const end = Math.max(start + 1, Math.floor(minBin + span * t1 ** 1.45))
|
|
15
|
+
ranges.push({ start, end })
|
|
16
|
+
}
|
|
17
|
+
return ranges
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Average + peak blend for one frequency band (0–1). */
|
|
21
|
+
export function bandLevel(data: Uint8Array, start: number, end: number): number {
|
|
22
|
+
let sum = 0
|
|
23
|
+
let peak = 0
|
|
24
|
+
for (let j = start; j < end; j++) {
|
|
25
|
+
const v = data[j]!
|
|
26
|
+
sum += v
|
|
27
|
+
if (v > peak) peak = v
|
|
28
|
+
}
|
|
29
|
+
const avg = sum / Math.max(1, end - start) / 255
|
|
30
|
+
const pk = peak / 255
|
|
31
|
+
const blended = avg * 0.55 + pk * 0.45
|
|
32
|
+
return Math.min(1, blended ** 0.72 * 1.35)
|
|
33
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { bandLevel } from './bands.js'
|
|
2
|
+
|
|
3
|
+
export type BarMotionState = {
|
|
4
|
+
scales: number[]
|
|
5
|
+
brightness: number[]
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type BarMotionOptions = {
|
|
9
|
+
barCount?: number
|
|
10
|
+
idleScale?: number
|
|
11
|
+
minScale?: number
|
|
12
|
+
maxScale?: number
|
|
13
|
+
idleBrightness?: number
|
|
14
|
+
minBrightness?: number
|
|
15
|
+
maxBrightness?: number
|
|
16
|
+
attack?: number
|
|
17
|
+
decay?: number
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const DEFAULTS = {
|
|
21
|
+
idleScale: 1,
|
|
22
|
+
minScale: 0.75,
|
|
23
|
+
maxScale: 1.25,
|
|
24
|
+
idleBrightness: 1,
|
|
25
|
+
minBrightness: 0.5,
|
|
26
|
+
maxBrightness: 1.5,
|
|
27
|
+
attack: 0.42,
|
|
28
|
+
decay: 0.14,
|
|
29
|
+
} as const
|
|
30
|
+
|
|
31
|
+
export function createBarMotionState(barCount: number, options?: BarMotionOptions): BarMotionState {
|
|
32
|
+
const idleScale = options?.idleScale ?? DEFAULTS.idleScale
|
|
33
|
+
const idleBrightness = options?.idleBrightness ?? DEFAULTS.idleBrightness
|
|
34
|
+
return {
|
|
35
|
+
scales: Array.from({ length: barCount }, () => idleScale),
|
|
36
|
+
brightness: Array.from({ length: barCount }, () => idleBrightness),
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function mapLevel(avg: number, min: number, max: number) {
|
|
41
|
+
return min + avg * (max - min)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function smoothToward(current: number, target: number, attack: number, decay: number) {
|
|
45
|
+
const rate = target > current ? attack : decay
|
|
46
|
+
return current + (target - current) * rate
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Advance one animation frame from frequency data (or decay toward idle). */
|
|
50
|
+
export function stepBarMotion(
|
|
51
|
+
state: BarMotionState,
|
|
52
|
+
analyser: AnalyserNode | null,
|
|
53
|
+
data: Uint8Array | null,
|
|
54
|
+
ranges: { start: number; end: number }[],
|
|
55
|
+
options?: BarMotionOptions,
|
|
56
|
+
): void {
|
|
57
|
+
const idleScale = options?.idleScale ?? DEFAULTS.idleScale
|
|
58
|
+
const minScale = options?.minScale ?? DEFAULTS.minScale
|
|
59
|
+
const maxScale = options?.maxScale ?? DEFAULTS.maxScale
|
|
60
|
+
const idleBrightness = options?.idleBrightness ?? DEFAULTS.idleBrightness
|
|
61
|
+
const minBrightness = options?.minBrightness ?? DEFAULTS.minBrightness
|
|
62
|
+
const maxBrightness = options?.maxBrightness ?? DEFAULTS.maxBrightness
|
|
63
|
+
const attack = options?.attack ?? DEFAULTS.attack
|
|
64
|
+
const decay = options?.decay ?? DEFAULTS.decay
|
|
65
|
+
const barCount = state.scales.length
|
|
66
|
+
|
|
67
|
+
for (let i = 0; i < barCount; i++) {
|
|
68
|
+
if (analyser && data) {
|
|
69
|
+
const { start, end } = ranges[i] ?? { start: 0, end: 1 }
|
|
70
|
+
const level = bandLevel(data, start, end)
|
|
71
|
+
const scaleTarget = mapLevel(level, minScale, maxScale)
|
|
72
|
+
const brightTarget = mapLevel(level, minBrightness, maxBrightness)
|
|
73
|
+
state.scales[i] = smoothToward(state.scales[i]!, scaleTarget, attack, decay)
|
|
74
|
+
state.brightness[i] = smoothToward(state.brightness[i]!, brightTarget, attack, decay)
|
|
75
|
+
} else {
|
|
76
|
+
state.scales[i] = smoothToward(state.scales[i]!, idleScale, 0.12, 0.12)
|
|
77
|
+
state.brightness[i] = smoothToward(state.brightness[i]!, idleBrightness, 0.12, 0.12)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @aeon-ui/site
|
|
2
|
+
|
|
3
|
+
Small helpers for **link previews** (Open Graph + Twitter Card meta tags).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { absoluteUrl, openGraphHeadHtml } from '@aeon-ui/site'
|
|
7
|
+
|
|
8
|
+
const html = openGraphHeadHtml({
|
|
9
|
+
title: 'Aeon UI — Future-proof UI infrastructure',
|
|
10
|
+
description: 'Statechart-driven primitives and a styled layer your team controls.',
|
|
11
|
+
url: absoluteUrl('https://aeon-ui.com', '/'),
|
|
12
|
+
image: absoluteUrl('https://aeon-ui.com', '/og.png'),
|
|
13
|
+
siteName: 'Aeon UI',
|
|
14
|
+
})
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Use in a Vite `transformIndexHtml` hook or any static site generator. Pair with a **1200×630** `og.png` in `public/`.
|
|
18
|
+
|
|
19
|
+
Not required for component consumers — optional for docs and marketing apps in the monorepo.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aeon-ui/site",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Open Graph and document meta helpers for Aeon marketing sites",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/GenericCPU/aeon-ui.git",
|
|
9
|
+
"directory": "packages/site"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": { "access": "public" },
|
|
12
|
+
"files": ["dist", "README.md"],
|
|
13
|
+
"keywords": ["aeon-ui", "open-graph", "meta", "seo"],
|
|
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",
|
|
26
|
+
"typecheck": "tsc --noEmit"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"tsup": "^8.4.0",
|
|
30
|
+
"typescript": "^5.8.3"
|
|
31
|
+
}
|
|
32
|
+
}
|