@omerdlw/base-framework 3.1.0 → 3.2.1
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/MIGRATION.md +75 -0
- package/README.md +33 -25
- package/dist/ambient/index.d.ts +1 -0
- package/dist/ambient/index.js +14 -0
- package/dist/ambient/server/index.d.ts +1 -0
- package/dist/ambient/server/index.js +238 -0
- package/dist/ambient/server/index.js.map +1 -0
- package/dist/ambient/worker/index.d.ts +1 -0
- package/dist/ambient/worker/index.js +143 -0
- package/dist/ambient/worker/index.js.map +1 -0
- package/dist/background/index.d.ts +1 -0
- package/dist/background/index.js +13 -0
- package/dist/chunk-26K6W4OQ.js +1435 -0
- package/dist/chunk-26K6W4OQ.js.map +1 -0
- package/dist/chunk-2BLGNT5I.js +850 -0
- package/dist/chunk-2BLGNT5I.js.map +1 -0
- package/dist/chunk-2LGI33JP.js +832 -0
- package/dist/chunk-2LGI33JP.js.map +1 -0
- package/dist/chunk-37OBXNEO.js +116 -0
- package/dist/chunk-37OBXNEO.js.map +1 -0
- package/dist/chunk-5GVH4BQV.js +577 -0
- package/dist/chunk-5GVH4BQV.js.map +1 -0
- package/dist/chunk-5H6FZW3N.js +535 -0
- package/dist/chunk-5H6FZW3N.js.map +1 -0
- package/dist/chunk-66MHDFNF.js +3488 -0
- package/dist/chunk-66MHDFNF.js.map +1 -0
- package/dist/chunk-7RSRDKYE.js +22 -0
- package/dist/chunk-7RSRDKYE.js.map +1 -0
- package/dist/chunk-AAT3QWHN.js +567 -0
- package/dist/chunk-AAT3QWHN.js.map +1 -0
- package/dist/chunk-BMFHS3GV.js +118 -0
- package/dist/chunk-BMFHS3GV.js.map +1 -0
- package/dist/chunk-CRKJAACG.js +81 -0
- package/dist/chunk-CRKJAACG.js.map +1 -0
- package/dist/chunk-CT4UILO2.js +537 -0
- package/dist/chunk-CT4UILO2.js.map +1 -0
- package/dist/chunk-ESD5EQ5H.js +178 -0
- package/dist/chunk-ESD5EQ5H.js.map +1 -0
- package/dist/chunk-GQKGOLHJ.js +1766 -0
- package/dist/chunk-GQKGOLHJ.js.map +1 -0
- package/dist/chunk-IR3DCLBM.js +17 -0
- package/dist/chunk-IR3DCLBM.js.map +1 -0
- package/dist/chunk-J3VTDBC6.js +14 -0
- package/dist/chunk-J3VTDBC6.js.map +1 -0
- package/dist/chunk-J4WUCHNR.js +825 -0
- package/dist/chunk-J4WUCHNR.js.map +1 -0
- package/dist/chunk-KMN6J5SL.js +493 -0
- package/dist/chunk-KMN6J5SL.js.map +1 -0
- package/dist/chunk-LA3CQ6NY.js +261 -0
- package/dist/chunk-LA3CQ6NY.js.map +1 -0
- package/dist/chunk-LTO77WSO.js +140 -0
- package/dist/chunk-LTO77WSO.js.map +1 -0
- package/dist/chunk-NTUQYA73.js +110 -0
- package/dist/chunk-NTUQYA73.js.map +1 -0
- package/dist/chunk-OEXWOZPS.js +139 -0
- package/dist/chunk-OEXWOZPS.js.map +1 -0
- package/dist/chunk-PUD4IB3L.js +15762 -0
- package/dist/chunk-PUD4IB3L.js.map +1 -0
- package/dist/chunk-RDYYP36I.js +27 -0
- package/dist/chunk-RDYYP36I.js.map +1 -0
- package/dist/chunk-RF2YGILF.js +656 -0
- package/dist/chunk-RF2YGILF.js.map +1 -0
- package/dist/chunk-WBBM67WL.js +460 -0
- package/dist/chunk-WBBM67WL.js.map +1 -0
- package/dist/chunk-WYVA6AN5.js +590 -0
- package/dist/chunk-WYVA6AN5.js.map +1 -0
- package/dist/chunk-Y2Q74PJP.js +537 -0
- package/dist/chunk-Y2Q74PJP.js.map +1 -0
- package/dist/chunk-ZE6OGGA7.js +2341 -0
- package/dist/chunk-ZE6OGGA7.js.map +1 -0
- package/dist/context-menu/index.d.ts +1 -0
- package/dist/context-menu/index.js +19 -0
- package/dist/controls/index.d.ts +1 -0
- package/dist/controls/index.js +10 -0
- package/dist/core/error/boundary.d.ts +27 -0
- package/dist/core/error/boundary.d.ts.map +1 -0
- package/dist/core/error/constants.d.ts +33 -0
- package/dist/core/error/constants.d.ts.map +1 -0
- package/dist/core/error/index.d.ts +9 -0
- package/dist/core/error/index.d.ts.map +1 -0
- package/dist/core/error/listener.d.ts +6 -0
- package/dist/core/error/listener.d.ts.map +1 -0
- package/dist/core/error/reporter.d.ts +49 -0
- package/dist/core/error/reporter.d.ts.map +1 -0
- package/dist/core/error/theme.d.ts +10 -0
- package/dist/core/error/theme.d.ts.map +1 -0
- package/dist/core/error/types.d.ts +128 -0
- package/dist/core/error/types.d.ts.map +1 -0
- package/dist/core/error/utils.d.ts +55 -0
- package/dist/core/error/utils.d.ts.map +1 -0
- package/dist/core/kernel/adapters.d.ts +9 -0
- package/dist/core/kernel/adapters.d.ts.map +1 -0
- package/dist/core/kernel/compose.d.ts +21 -0
- package/dist/core/kernel/compose.d.ts.map +1 -0
- package/dist/core/kernel/constants.d.ts +42 -0
- package/dist/core/kernel/constants.d.ts.map +1 -0
- package/dist/core/kernel/handlers.d.ts +7 -0
- package/dist/core/kernel/handlers.d.ts.map +1 -0
- package/dist/core/kernel/hooks.d.ts +13 -0
- package/dist/core/kernel/hooks.d.ts.map +1 -0
- package/dist/core/kernel/index.d.ts +15 -0
- package/dist/core/kernel/index.d.ts.map +1 -0
- package/dist/core/kernel/installed.d.ts +28 -0
- package/dist/core/kernel/installed.d.ts.map +1 -0
- package/dist/core/kernel/module.d.ts +57 -0
- package/dist/core/kernel/module.d.ts.map +1 -0
- package/dist/core/kernel/operations-records.d.ts +25 -0
- package/dist/core/kernel/operations-records.d.ts.map +1 -0
- package/dist/core/kernel/operations-resolve.d.ts +5 -0
- package/dist/core/kernel/operations-resolve.d.ts.map +1 -0
- package/dist/core/kernel/operations.d.ts +23 -0
- package/dist/core/kernel/operations.d.ts.map +1 -0
- package/dist/core/kernel/page-controller.d.ts +20 -0
- package/dist/core/kernel/page-controller.d.ts.map +1 -0
- package/dist/core/kernel/provider.d.ts +29 -0
- package/dist/core/kernel/provider.d.ts.map +1 -0
- package/dist/core/kernel/runtime.d.ts.map +1 -0
- package/dist/core/kernel/schema.d.ts +13 -0
- package/dist/core/kernel/schema.d.ts.map +1 -0
- package/dist/core/kernel/stabilize.d.ts +13 -0
- package/dist/core/kernel/stabilize.d.ts.map +1 -0
- package/dist/core/kernel/store-batch.d.ts +17 -0
- package/dist/core/kernel/store-batch.d.ts.map +1 -0
- package/dist/core/kernel/store-entries.d.ts +6 -0
- package/dist/core/kernel/store-entries.d.ts.map +1 -0
- package/dist/core/kernel/store-handles.d.ts +4 -0
- package/dist/core/kernel/store-handles.d.ts.map +1 -0
- package/dist/core/kernel/store-registration.d.ts +14 -0
- package/dist/core/kernel/store-registration.d.ts.map +1 -0
- package/dist/core/kernel/store-snapshots.d.ts +14 -0
- package/dist/core/kernel/store-snapshots.d.ts.map +1 -0
- package/dist/core/kernel/store-subscriptions.d.ts +16 -0
- package/dist/core/kernel/store-subscriptions.d.ts.map +1 -0
- package/dist/core/kernel/store.d.ts +8 -0
- package/dist/core/kernel/store.d.ts.map +1 -0
- package/dist/core/kernel/types-modules.d.ts +82 -0
- package/dist/core/kernel/types-modules.d.ts.map +1 -0
- package/dist/core/kernel/types-page.d.ts +67 -0
- package/dist/core/kernel/types-page.d.ts.map +1 -0
- package/dist/core/kernel/types-store.d.ts +71 -0
- package/dist/core/kernel/types-store.d.ts.map +1 -0
- package/dist/core/kernel/types.d.ts +169 -0
- package/dist/core/kernel/types.d.ts.map +1 -0
- package/dist/core/kernel/utils.d.ts +21 -0
- package/dist/core/kernel/utils.d.ts.map +1 -0
- package/dist/core/navigation/constants.d.ts +48 -0
- package/dist/core/navigation/constants.d.ts.map +1 -0
- package/dist/core/navigation/navigator-defaults.d.ts +4 -0
- package/dist/core/navigation/navigator-defaults.d.ts.map +1 -0
- package/dist/core/navigation/navigator-holds.d.ts +8 -0
- package/dist/core/navigation/navigator-holds.d.ts.map +1 -0
- package/dist/core/navigation/navigator-patience.d.ts +15 -0
- package/dist/core/navigation/navigator-patience.d.ts.map +1 -0
- package/dist/core/navigation/navigator-payload.d.ts +6 -0
- package/dist/core/navigation/navigator-payload.d.ts.map +1 -0
- package/dist/core/navigation/navigator-prefetch.d.ts +13 -0
- package/dist/core/navigation/navigator-prefetch.d.ts.map +1 -0
- package/dist/core/navigation/navigator.d.ts +7 -0
- package/dist/core/navigation/navigator.d.ts.map +1 -0
- package/dist/core/navigation/settings.d.ts +12 -0
- package/dist/core/navigation/settings.d.ts.map +1 -0
- package/dist/core/navigation/state.d.ts +26 -0
- package/dist/core/navigation/state.d.ts.map +1 -0
- package/dist/core/navigation/types.d.ts +194 -0
- package/dist/core/navigation/types.d.ts.map +1 -0
- package/dist/core/navigation/utils.d.ts +18 -0
- package/dist/core/navigation/utils.d.ts.map +1 -0
- package/dist/core/provider/index.d.ts +31 -0
- package/dist/core/provider/index.d.ts.map +1 -0
- package/dist/dock/index.d.ts +1 -0
- package/dist/dock/index.js +18 -0
- package/dist/error/index.d.ts +1 -9
- package/dist/error/index.js +8 -5
- package/dist/events/index.d.ts +1 -0
- package/dist/events/index.js +83 -0
- package/dist/events/index.js.map +1 -0
- package/dist/foundation/events/index.d.ts +67 -0
- package/dist/foundation/events/index.d.ts.map +1 -0
- package/dist/foundation/recipes/anatomy.d.ts +139 -0
- package/dist/foundation/recipes/anatomy.d.ts.map +1 -0
- package/dist/foundation/recipes/cn.d.ts +17 -0
- package/dist/foundation/recipes/cn.d.ts.map +1 -0
- package/dist/foundation/recipes/define.d.ts +134 -0
- package/dist/foundation/recipes/define.d.ts.map +1 -0
- package/dist/foundation/recipes/index.d.ts +11 -0
- package/dist/foundation/recipes/index.d.ts.map +1 -0
- package/dist/foundation/recipes/recipe.d.ts +97 -0
- package/dist/foundation/recipes/recipe.d.ts.map +1 -0
- package/dist/foundation/recipes/split.d.ts +10 -0
- package/dist/foundation/recipes/split.d.ts.map +1 -0
- package/dist/foundation/result/index.d.ts +98 -0
- package/dist/foundation/result/index.d.ts.map +1 -0
- package/dist/foundation/utils/dom.d.ts +19 -0
- package/dist/foundation/utils/dom.d.ts.map +1 -0
- package/dist/foundation/utils/index.d.ts +17 -0
- package/dist/foundation/utils/index.d.ts.map +1 -0
- package/dist/foundation/utils/number.d.ts +9 -0
- package/dist/foundation/utils/number.d.ts.map +1 -0
- package/dist/foundation/utils/object.d.ts +17 -0
- package/dist/foundation/utils/object.d.ts.map +1 -0
- package/dist/foundation/utils/report.d.ts +18 -0
- package/dist/foundation/utils/report.d.ts.map +1 -0
- package/dist/foundation/utils/scheduler.d.ts +52 -0
- package/dist/foundation/utils/scheduler.d.ts.map +1 -0
- package/dist/foundation/utils/store.d.ts +21 -0
- package/dist/foundation/utils/store.d.ts.map +1 -0
- package/dist/foundation/utils/string.d.ts +18 -0
- package/dist/foundation/utils/string.d.ts.map +1 -0
- package/dist/foundation/utils/tempo.d.ts +61 -0
- package/dist/foundation/utils/tempo.d.ts.map +1 -0
- package/dist/foundation/utils/timing.d.ts +13 -0
- package/dist/foundation/utils/timing.d.ts.map +1 -0
- package/dist/foundation/utils/transform.d.ts +17 -0
- package/dist/foundation/utils/transform.d.ts.map +1 -0
- package/dist/foundation/utils/user-message.d.ts +32 -0
- package/dist/foundation/utils/user-message.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +1 -11
- package/dist/hooks/index.js +3 -1
- package/dist/index.d.ts +8 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -20
- package/dist/kernel/index.d.ts +1 -15
- package/dist/kernel/index.js +5 -2
- package/dist/loading/index.d.ts +1 -0
- package/dist/loading/index.js +12 -0
- package/dist/media/index.d.ts +1 -0
- package/dist/media/index.js +9 -0
- package/dist/modal/index.d.ts +1 -0
- package/dist/modal/index.js +310 -0
- package/dist/modal/index.js.map +1 -0
- package/dist/modules/ambient/analyze-bounds.d.ts +12 -0
- package/dist/modules/ambient/analyze-bounds.d.ts.map +1 -0
- package/dist/modules/ambient/analyze-clusters.d.ts +14 -0
- package/dist/modules/ambient/analyze-clusters.d.ts.map +1 -0
- package/dist/modules/ambient/analyze-measures.d.ts +22 -0
- package/dist/modules/ambient/analyze-measures.d.ts.map +1 -0
- package/dist/modules/ambient/analyze-swatches.d.ts +16 -0
- package/dist/modules/ambient/analyze-swatches.d.ts.map +1 -0
- package/dist/modules/ambient/analyze.d.ts +14 -22
- package/dist/modules/ambient/analyze.d.ts.map +1 -1
- package/dist/modules/ambient/constants.d.ts +4 -1
- package/dist/modules/ambient/constants.d.ts.map +1 -1
- package/dist/modules/ambient/context.d.ts +6 -0
- package/dist/modules/ambient/context.d.ts.map +1 -1
- package/dist/modules/ambient/dom.d.ts +25 -2
- package/dist/modules/ambient/dom.d.ts.map +1 -1
- package/dist/modules/ambient/extractor.d.ts +10 -0
- package/dist/modules/ambient/extractor.d.ts.map +1 -1
- package/dist/modules/ambient/hooks.d.ts +12 -0
- package/dist/modules/ambient/hooks.d.ts.map +1 -1
- package/dist/modules/ambient/module.d.ts +12 -1
- package/dist/modules/ambient/module.d.ts.map +1 -1
- package/dist/modules/ambient/oklab.d.ts +24 -0
- package/dist/modules/ambient/oklab.d.ts.map +1 -1
- package/dist/modules/ambient/quantize.d.ts +4 -0
- package/dist/modules/ambient/quantize.d.ts.map +1 -1
- package/dist/modules/ambient/server/address.d.ts +8 -0
- package/dist/modules/ambient/server/address.d.ts.map +1 -1
- package/dist/modules/ambient/server/index.d.ts +24 -0
- package/dist/modules/ambient/server/index.d.ts.map +1 -1
- package/dist/modules/ambient/settings.d.ts +26 -0
- package/dist/modules/ambient/settings.d.ts.map +1 -1
- package/dist/modules/ambient/types.d.ts +100 -1
- package/dist/modules/ambient/types.d.ts.map +1 -1
- package/dist/modules/ambient/worker/index.d.ts +16 -0
- package/dist/modules/ambient/worker/index.d.ts.map +1 -1
- package/dist/modules/background/components/background-gradients.d.ts +8 -0
- package/dist/modules/background/components/background-gradients.d.ts.map +1 -0
- package/dist/modules/background/components/edge-gradient.d.ts +9 -0
- package/dist/modules/background/components/edge-gradient.d.ts.map +1 -0
- package/dist/modules/background/components/native-video.d.ts +4 -0
- package/dist/modules/background/components/native-video.d.ts.map +1 -0
- package/dist/modules/background/components/noise-overlay.d.ts +11 -0
- package/dist/modules/background/components/noise-overlay.d.ts.map +1 -0
- package/dist/modules/background/components/overlay.d.ts +6 -0
- package/dist/modules/background/components/overlay.d.ts.map +1 -0
- package/dist/modules/background/components/solid-overlay.d.ts +10 -0
- package/dist/modules/background/components/solid-overlay.d.ts.map +1 -0
- package/dist/modules/background/constants.d.ts +14 -1
- package/dist/modules/background/constants.d.ts.map +1 -1
- package/dist/modules/background/context.d.ts +7 -0
- package/dist/modules/background/context.d.ts.map +1 -1
- package/dist/modules/background/hooks/use-background-media-source.d.ts +4 -0
- package/dist/modules/background/hooks/use-background-media-source.d.ts.map +1 -0
- package/dist/modules/background/hooks/use-background-motion-model.d.ts +15 -0
- package/dist/modules/background/hooks/use-background-motion-model.d.ts.map +1 -0
- package/dist/modules/background/hooks/use-background-overlay-model.d.ts +929 -0
- package/dist/modules/background/hooks/use-background-overlay-model.d.ts.map +1 -0
- package/dist/modules/background/hooks/use-native-video-model.d.ts +22 -0
- package/dist/modules/background/hooks/use-native-video-model.d.ts.map +1 -0
- package/dist/modules/background/hooks.d.ts +20 -1
- package/dist/modules/background/hooks.d.ts.map +1 -1
- package/dist/modules/background/index.d.ts +6 -6
- package/dist/modules/background/index.d.ts.map +1 -1
- package/dist/modules/background/lib/theme.d.ts +4 -0
- package/dist/modules/background/lib/theme.d.ts.map +1 -0
- package/dist/modules/background/model/override.d.ts +14 -0
- package/dist/modules/background/model/override.d.ts.map +1 -0
- package/dist/modules/background/model/playback.d.ts +25 -0
- package/dist/modules/background/model/playback.d.ts.map +1 -0
- package/dist/modules/background/model/state.d.ts +31 -0
- package/dist/modules/background/model/state.d.ts.map +1 -0
- package/dist/modules/background/model/video-frame.d.ts +31 -0
- package/dist/modules/background/model/video-frame.d.ts.map +1 -0
- package/dist/modules/background/model/visual.d.ts +932 -0
- package/dist/modules/background/model/visual.d.ts.map +1 -0
- package/dist/modules/background/module.d.ts +11 -0
- package/dist/modules/background/module.d.ts.map +1 -1
- package/dist/modules/background/motion.d.ts.map +1 -1
- package/dist/modules/background/types.d.ts +66 -3
- package/dist/modules/background/types.d.ts.map +1 -1
- package/dist/modules/background/youtube/components/player.d.ts +7 -0
- package/dist/modules/background/youtube/components/player.d.ts.map +1 -0
- package/dist/modules/background/youtube/hooks/use-youtube-background-player-model.d.ts +27 -0
- package/dist/modules/background/youtube/hooks/use-youtube-background-player-model.d.ts.map +1 -0
- package/dist/modules/background/youtube/hooks/use-youtube-iframe-player.d.ts +20 -0
- package/dist/modules/background/youtube/hooks/use-youtube-iframe-player.d.ts.map +1 -0
- package/dist/modules/background/youtube/hooks/use-youtube-stream-sources.d.ts +8 -0
- package/dist/modules/background/youtube/hooks/use-youtube-stream-sources.d.ts.map +1 -0
- package/dist/modules/background/youtube/hooks/use-youtube-video-sync.d.ts +16 -0
- package/dist/modules/background/youtube/hooks/use-youtube-video-sync.d.ts.map +1 -0
- package/dist/modules/background/youtube/lib/audio.d.ts +17 -0
- package/dist/modules/background/youtube/lib/audio.d.ts.map +1 -0
- package/dist/modules/background/youtube/lib/iframe-engine.d.ts +29 -0
- package/dist/modules/background/youtube/lib/iframe-engine.d.ts.map +1 -0
- package/dist/modules/background/youtube/lib/iframe-proxy.d.ts +47 -0
- package/dist/modules/background/youtube/lib/iframe-proxy.d.ts.map +1 -0
- package/dist/modules/background/youtube/lib/iframe.d.ts +47 -0
- package/dist/modules/background/youtube/lib/iframe.d.ts.map +1 -0
- package/dist/modules/background/youtube/lib/parse.d.ts +36 -0
- package/dist/modules/background/youtube/lib/parse.d.ts.map +1 -0
- package/dist/modules/background/youtube/lib/timing.d.ts +11 -0
- package/dist/modules/background/youtube/lib/timing.d.ts.map +1 -0
- package/dist/modules/background/youtube/lib/video-events.d.ts +53 -0
- package/dist/modules/background/youtube/lib/video-events.d.ts.map +1 -0
- package/dist/modules/context-menu/constants.d.ts +30 -1
- package/dist/modules/context-menu/constants.d.ts.map +1 -1
- package/dist/modules/context-menu/context.d.ts +10 -2
- package/dist/modules/context-menu/context.d.ts.map +1 -1
- package/dist/modules/context-menu/dom.d.ts +13 -0
- package/dist/modules/context-menu/dom.d.ts.map +1 -1
- package/dist/modules/context-menu/hooks.d.ts +32 -5
- package/dist/modules/context-menu/hooks.d.ts.map +1 -1
- package/dist/modules/context-menu/items.d.ts +25 -0
- package/dist/modules/context-menu/items.d.ts.map +1 -1
- package/dist/modules/context-menu/module.d.ts +6 -0
- package/dist/modules/context-menu/module.d.ts.map +1 -1
- package/dist/modules/context-menu/motion.d.ts.map +1 -1
- package/dist/modules/context-menu/overlay.d.ts +30 -8
- package/dist/modules/context-menu/overlay.d.ts.map +1 -1
- package/dist/modules/context-menu/resolver.d.ts +8 -0
- package/dist/modules/context-menu/resolver.d.ts.map +1 -1
- package/dist/modules/context-menu/state.d.ts +9 -0
- package/dist/modules/context-menu/state.d.ts.map +1 -1
- package/dist/modules/context-menu/types.d.ts +85 -3
- package/dist/modules/context-menu/types.d.ts.map +1 -1
- package/dist/modules/controls/constants.d.ts +18 -1
- package/dist/modules/controls/constants.d.ts.map +1 -1
- package/dist/modules/controls/entries.d.ts +23 -1
- package/dist/modules/controls/entries.d.ts.map +1 -1
- package/dist/modules/controls/hooks.d.ts +11 -1
- package/dist/modules/controls/hooks.d.ts.map +1 -1
- package/dist/modules/controls/layout.d.ts +17 -0
- package/dist/modules/controls/layout.d.ts.map +1 -1
- package/dist/modules/controls/module.d.ts +7 -1
- package/dist/modules/controls/module.d.ts.map +1 -1
- package/dist/modules/controls/overlay.d.ts +11 -1
- package/dist/modules/controls/overlay.d.ts.map +1 -1
- package/dist/modules/controls/types.d.ts +51 -2
- package/dist/modules/controls/types.d.ts.map +1 -1
- package/dist/modules/dock/components/badge.d.ts +5 -0
- package/dist/modules/dock/components/badge.d.ts.map +1 -0
- package/dist/modules/dock/components/breadcrumbs-card.d.ts +6 -0
- package/dist/modules/dock/components/breadcrumbs-card.d.ts.map +1 -0
- package/dist/modules/dock/components/card-banner.d.ts +4 -0
- package/dist/modules/dock/components/card-banner.d.ts.map +1 -0
- package/dist/modules/dock/components/card-header.d.ts +4 -0
- package/dist/modules/dock/components/card-header.d.ts.map +1 -0
- package/dist/modules/dock/components/card-item.d.ts +3 -0
- package/dist/modules/dock/components/card-item.d.ts.map +1 -0
- package/dist/modules/dock/components/command-bar.d.ts +7 -0
- package/dist/modules/dock/components/command-bar.d.ts.map +1 -0
- package/dist/modules/dock/components/description.d.ts +4 -0
- package/dist/modules/dock/components/description.d.ts.map +1 -0
- package/dist/modules/dock/components/dock.d.ts +4 -0
- package/dist/modules/dock/components/dock.d.ts.map +1 -0
- package/dist/modules/dock/components/hud-view.d.ts +7 -0
- package/dist/modules/dock/components/hud-view.d.ts.map +1 -0
- package/dist/modules/dock/components/icon.d.ts +6 -0
- package/dist/modules/dock/components/icon.d.ts.map +1 -0
- package/dist/modules/dock/components/item-content.d.ts +4 -0
- package/dist/modules/dock/components/item-content.d.ts.map +1 -0
- package/dist/modules/dock/components/media-action.d.ts +4 -0
- package/dist/modules/dock/components/media-action.d.ts.map +1 -0
- package/dist/modules/dock/components/media-controls.d.ts +4 -0
- package/dist/modules/dock/components/media-controls.d.ts.map +1 -0
- package/dist/modules/dock/components/media-scrubber.d.ts +5 -0
- package/dist/modules/dock/components/media-scrubber.d.ts.map +1 -0
- package/dist/modules/dock/components/status-actions.d.ts +10 -0
- package/dist/modules/dock/components/status-actions.d.ts.map +1 -0
- package/dist/modules/dock/components/surface/action.d.ts +17 -0
- package/dist/modules/dock/components/surface/action.d.ts.map +1 -0
- package/dist/modules/dock/components/surface/controls.d.ts +12 -0
- package/dist/modules/dock/components/surface/controls.d.ts.map +1 -0
- package/dist/modules/dock/components/surface/extensions-bar.d.ts +5 -0
- package/dist/modules/dock/components/surface/extensions-bar.d.ts.map +1 -0
- package/dist/modules/dock/components/surface/header-button.d.ts +14 -0
- package/dist/modules/dock/components/surface/header-button.d.ts.map +1 -0
- package/dist/modules/dock/components/surface/item-content.d.ts +6 -0
- package/dist/modules/dock/components/surface/item-content.d.ts.map +1 -0
- package/dist/modules/dock/components/surface/shell.d.ts +3 -0
- package/dist/modules/dock/components/surface/shell.d.ts.map +1 -0
- package/dist/modules/dock/components/title.d.ts +4 -0
- package/dist/modules/dock/components/title.d.ts.map +1 -0
- package/dist/modules/dock/constants.d.ts +11 -2
- package/dist/modules/dock/constants.d.ts.map +1 -1
- package/dist/modules/dock/context.d.ts +8 -2
- package/dist/modules/dock/context.d.ts.map +1 -1
- package/dist/modules/dock/hooks/use-action-slot.d.ts +6 -0
- package/dist/modules/dock/hooks/use-action-slot.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-badge.d.ts +4 -0
- package/dist/modules/dock/hooks/use-badge.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-card-banner-model.d.ts +18 -0
- package/dist/modules/dock/hooks/use-card-banner-model.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-card-header-model.d.ts +7 -0
- package/dist/modules/dock/hooks/use-card-header-model.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-card-item-model.d.ts +1612 -0
- package/dist/modules/dock/hooks/use-card-item-model.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-command-bar-model.d.ts +12 -0
- package/dist/modules/dock/hooks/use-command-bar-model.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-dock-banner.d.ts +11 -0
- package/dist/modules/dock/hooks/use-dock-banner.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-dock-config.d.ts +19 -0
- package/dist/modules/dock/hooks/use-dock-config.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-dock-dimensions.d.ts +7 -0
- package/dist/modules/dock/hooks/use-dock-dimensions.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-dock-focus-trap.d.ts +7 -0
- package/dist/modules/dock/hooks/use-dock-focus-trap.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-dock-height-controller.d.ts +6 -0
- package/dist/modules/dock/hooks/use-dock-height-controller.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-dock-keyboard.d.ts +11 -0
- package/dist/modules/dock/hooks/use-dock-keyboard.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-dock-registration.d.ts +8 -0
- package/dist/modules/dock/hooks/use-dock-registration.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-dock-route-reset.d.ts +2 -0
- package/dist/modules/dock/hooks/use-dock-route-reset.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-dock-theme.d.ts +6 -0
- package/dist/modules/dock/hooks/use-dock-theme.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-dock-viewport.d.ts +6 -0
- package/dist/modules/dock/hooks/use-dock-viewport.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-element-height.d.ts +3 -0
- package/dist/modules/dock/hooks/use-element-height.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-hud-registry.d.ts +16 -0
- package/dist/modules/dock/hooks/use-hud-registry.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-hud-view-model.d.ts +9 -0
- package/dist/modules/dock/hooks/use-hud-view-model.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-media-controls-model.d.ts +27 -0
- package/dist/modules/dock/hooks/use-media-controls-model.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-media-scrubber-model.d.ts +27 -0
- package/dist/modules/dock/hooks/use-media-scrubber-model.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-standard-item-content-model.d.ts +12 -0
- package/dist/modules/dock/hooks/use-standard-item-content-model.d.ts.map +1 -0
- package/dist/modules/dock/hooks/use-surface-return.d.ts +8 -0
- package/dist/modules/dock/hooks/use-surface-return.d.ts.map +1 -0
- package/dist/modules/dock/hud.d.ts +8 -34
- package/dist/modules/dock/hud.d.ts.map +1 -1
- package/dist/modules/dock/index.d.ts +18 -12
- package/dist/modules/dock/index.d.ts.map +1 -1
- package/dist/modules/dock/lib/banner.d.ts +43 -0
- package/dist/modules/dock/lib/banner.d.ts.map +1 -0
- package/dist/modules/dock/lib/card-item.d.ts +46 -0
- package/dist/modules/dock/lib/card-item.d.ts.map +1 -0
- package/dist/modules/dock/lib/card.d.ts +20 -0
- package/dist/modules/dock/lib/card.d.ts.map +1 -0
- package/dist/modules/dock/lib/command-bar.d.ts +8 -0
- package/dist/modules/dock/lib/command-bar.d.ts.map +1 -0
- package/dist/modules/dock/lib/dom.d.ts +7 -0
- package/dist/modules/dock/lib/dom.d.ts.map +1 -0
- package/dist/modules/dock/lib/element-helpers.d.ts +8 -0
- package/dist/modules/dock/lib/element-helpers.d.ts.map +1 -0
- package/dist/modules/dock/lib/helpers.d.ts +19 -0
- package/dist/modules/dock/lib/helpers.d.ts.map +1 -0
- package/dist/modules/dock/lib/media.d.ts +35 -0
- package/dist/modules/dock/lib/media.d.ts.map +1 -0
- package/dist/modules/dock/lib/styles.d.ts +902 -0
- package/dist/modules/dock/lib/styles.d.ts.map +1 -0
- package/dist/modules/dock/model/hud-definition.d.ts +13 -0
- package/dist/modules/dock/model/hud-definition.d.ts.map +1 -0
- package/dist/modules/dock/model/hud.d.ts +10 -0
- package/dist/modules/dock/model/hud.d.ts.map +1 -0
- package/dist/modules/dock/model/layout.d.ts +28 -0
- package/dist/modules/dock/model/layout.d.ts.map +1 -0
- package/dist/modules/dock/model/page-entry.d.ts +11 -0
- package/dist/modules/dock/model/page-entry.d.ts.map +1 -0
- package/dist/modules/dock/model/page-surface.d.ts +4 -0
- package/dist/modules/dock/model/page-surface.d.ts.map +1 -0
- package/dist/modules/dock/model/paths.d.ts +15 -0
- package/dist/modules/dock/model/paths.d.ts.map +1 -0
- package/dist/modules/dock/model/state.d.ts +28 -0
- package/dist/modules/dock/model/state.d.ts.map +1 -0
- package/dist/modules/dock/model/surface-return.d.ts +14 -0
- package/dist/modules/dock/model/surface-return.d.ts.map +1 -0
- package/dist/modules/dock/module.d.ts +5 -7
- package/dist/modules/dock/module.d.ts.map +1 -1
- package/dist/modules/dock/motion.d.ts +716 -5
- package/dist/modules/dock/motion.d.ts.map +1 -1
- package/dist/modules/dock/provider.d.ts +2 -1
- package/dist/modules/dock/provider.d.ts.map +1 -1
- package/dist/modules/dock/routing/breadcrumbs.d.ts +6 -2
- package/dist/modules/dock/routing/breadcrumbs.d.ts.map +1 -1
- package/dist/modules/dock/routing/continuity.d.ts +46 -14
- package/dist/modules/dock/routing/continuity.d.ts.map +1 -1
- package/dist/modules/dock/routing/guards.d.ts +10 -1
- package/dist/modules/dock/routing/guards.d.ts.map +1 -1
- package/dist/modules/dock/routing/hooks/use-route-prefetch.d.ts +12 -0
- package/dist/modules/dock/routing/hooks/use-route-prefetch.d.ts.map +1 -0
- package/dist/modules/dock/routing/lib/restore.d.ts +7 -0
- package/dist/modules/dock/routing/lib/restore.d.ts.map +1 -0
- package/dist/modules/dock/routing/model/continuity.d.ts +21 -0
- package/dist/modules/dock/routing/model/continuity.d.ts.map +1 -0
- package/dist/modules/dock/routing/model/policy.d.ts +7 -0
- package/dist/modules/dock/routing/model/policy.d.ts.map +1 -0
- package/dist/modules/dock/routing/model/topology.d.ts +5 -0
- package/dist/modules/dock/routing/model/topology.d.ts.map +1 -0
- package/dist/modules/dock/routing/navigation.d.ts +10 -22
- package/dist/modules/dock/routing/navigation.d.ts.map +1 -1
- package/dist/modules/dock/runtime/commands.d.ts +10 -1
- package/dist/modules/dock/runtime/commands.d.ts.map +1 -1
- package/dist/modules/dock/runtime/display.d.ts +9 -42
- package/dist/modules/dock/runtime/display.d.ts.map +1 -1
- package/dist/modules/dock/runtime/dock.d.ts +11 -70
- package/dist/modules/dock/runtime/dock.d.ts.map +1 -1
- package/dist/modules/dock/runtime/hooks/use-dock-expansion.d.ts +10 -0
- package/dist/modules/dock/runtime/hooks/use-dock-expansion.d.ts.map +1 -0
- package/dist/modules/dock/runtime/hooks/use-dock-layout.d.ts +10 -0
- package/dist/modules/dock/runtime/hooks/use-dock-layout.d.ts.map +1 -0
- package/dist/modules/dock/runtime/hooks/use-dock-operation-state.d.ts +14 -0
- package/dist/modules/dock/runtime/hooks/use-dock-operation-state.d.ts.map +1 -0
- package/dist/modules/dock/runtime/hooks/use-dock-route-bridge.d.ts +7 -0
- package/dist/modules/dock/runtime/hooks/use-dock-route-bridge.d.ts.map +1 -0
- package/dist/modules/dock/runtime/hooks/use-dock.d.ts +30 -0
- package/dist/modules/dock/runtime/hooks/use-dock.d.ts.map +1 -0
- package/dist/modules/dock/runtime/model/attention.d.ts +25 -0
- package/dist/modules/dock/runtime/model/attention.d.ts.map +1 -0
- package/dist/modules/dock/runtime/model/cards.d.ts +64 -0
- package/dist/modules/dock/runtime/model/cards.d.ts.map +1 -0
- package/dist/modules/dock/runtime/model/items.d.ts +31 -0
- package/dist/modules/dock/runtime/model/items.d.ts.map +1 -0
- package/dist/modules/dock/runtime/model/layout.d.ts +10 -0
- package/dist/modules/dock/runtime/model/layout.d.ts.map +1 -0
- package/dist/modules/dock/runtime/pipeline.d.ts +1 -1
- package/dist/modules/dock/runtime/pipeline.d.ts.map +1 -1
- package/dist/modules/dock/runtime/provider-actions.d.ts +38 -0
- package/dist/modules/dock/runtime/provider-actions.d.ts.map +1 -0
- package/dist/modules/dock/status/action-options.d.ts +35 -0
- package/dist/modules/dock/status/action-options.d.ts.map +1 -0
- package/dist/modules/dock/status/events.d.ts +2 -2
- package/dist/modules/dock/status/events.d.ts.map +1 -1
- package/dist/modules/dock/status/hooks.d.ts +1 -1
- package/dist/modules/dock/status/hooks.d.ts.map +1 -1
- package/dist/modules/dock/status/model.d.ts +12 -32
- package/dist/modules/dock/status/model.d.ts.map +1 -1
- package/dist/modules/dock/status/state.d.ts +12 -0
- package/dist/modules/dock/status/state.d.ts.map +1 -0
- package/dist/modules/dock/surface/components/surface-extensions-provider.d.ts +5 -0
- package/dist/modules/dock/surface/components/surface-extensions-provider.d.ts.map +1 -0
- package/dist/modules/dock/surface/components/surface-flow-provider.d.ts +7 -0
- package/dist/modules/dock/surface/components/surface-flow-provider.d.ts.map +1 -0
- package/dist/modules/dock/surface/constants.d.ts +5 -0
- package/dist/modules/dock/surface/constants.d.ts.map +1 -0
- package/dist/modules/dock/surface/context.d.ts +14 -1
- package/dist/modules/dock/surface/context.d.ts.map +1 -1
- package/dist/modules/dock/surface/definition.d.ts +28 -2
- package/dist/modules/dock/surface/definition.d.ts.map +1 -1
- package/dist/modules/dock/surface/helpers.d.ts +2 -1
- package/dist/modules/dock/surface/helpers.d.ts.map +1 -1
- package/dist/modules/dock/surface/hooks/use-surface-controls-model.d.ts +15 -0
- package/dist/modules/dock/surface/hooks/use-surface-controls-model.d.ts.map +1 -0
- package/dist/modules/dock/surface/hooks/use-surface-extensions-bar-model.d.ts +7 -0
- package/dist/modules/dock/surface/hooks/use-surface-extensions-bar-model.d.ts.map +1 -0
- package/dist/modules/dock/surface/hooks/use-surface-extensions.d.ts +14 -0
- package/dist/modules/dock/surface/hooks/use-surface-extensions.d.ts.map +1 -0
- package/dist/modules/dock/surface/hooks/use-surface-flow.d.ts +20 -0
- package/dist/modules/dock/surface/hooks/use-surface-flow.d.ts.map +1 -0
- package/dist/modules/dock/surface/hooks/use-surface-header-button-model.d.ts +13 -0
- package/dist/modules/dock/surface/hooks/use-surface-header-button-model.d.ts.map +1 -0
- package/dist/modules/dock/surface/hooks/use-surface-shell-model.d.ts +28 -0
- package/dist/modules/dock/surface/hooks/use-surface-shell-model.d.ts.map +1 -0
- package/dist/modules/dock/surface/lib/drag.d.ts +9 -0
- package/dist/modules/dock/surface/lib/drag.d.ts.map +1 -0
- package/dist/modules/dock/surface/lib/target.d.ts +8 -0
- package/dist/modules/dock/surface/lib/target.d.ts.map +1 -0
- package/dist/modules/dock/surface/machine.d.ts +17 -62
- package/dist/modules/dock/surface/machine.d.ts.map +1 -1
- package/dist/modules/dock/surface/model/builder.d.ts +39 -0
- package/dist/modules/dock/surface/model/builder.d.ts.map +1 -0
- package/dist/modules/dock/surface/model/normalize.d.ts +13 -0
- package/dist/modules/dock/surface/model/normalize.d.ts.map +1 -0
- package/dist/modules/dock/surface/model/open.d.ts +26 -0
- package/dist/modules/dock/surface/model/open.d.ts.map +1 -0
- package/dist/modules/dock/surface/model/records.d.ts +45 -0
- package/dist/modules/dock/surface/model/records.d.ts.map +1 -0
- package/dist/modules/dock/surface/model/steps.d.ts +9 -0
- package/dist/modules/dock/surface/model/steps.d.ts.map +1 -0
- package/dist/modules/dock/surface/model/transition-state.d.ts +23 -0
- package/dist/modules/dock/surface/model/transition-state.d.ts.map +1 -0
- package/dist/modules/dock/surface/model/url.d.ts +14 -0
- package/dist/modules/dock/surface/model/url.d.ts.map +1 -0
- package/dist/modules/dock/surface/runtime/choreography.d.ts +22 -0
- package/dist/modules/dock/surface/runtime/choreography.d.ts.map +1 -0
- package/dist/modules/dock/surface/runtime/context.d.ts +29 -0
- package/dist/modules/dock/surface/runtime/context.d.ts.map +1 -0
- package/dist/modules/dock/surface/runtime/flows.d.ts +21 -0
- package/dist/modules/dock/surface/runtime/flows.d.ts.map +1 -0
- package/dist/modules/dock/surface/runtime/open.d.ts +6 -0
- package/dist/modules/dock/surface/runtime/open.d.ts.map +1 -0
- package/dist/modules/dock/surface/runtime/release.d.ts +9 -0
- package/dist/modules/dock/surface/runtime/release.d.ts.map +1 -0
- package/dist/modules/dock/surface/runtime/steps.d.ts +10 -0
- package/dist/modules/dock/surface/runtime/steps.d.ts.map +1 -0
- package/dist/modules/dock/surface/stack.d.ts +20 -11
- package/dist/modules/dock/surface/stack.d.ts.map +1 -1
- package/dist/modules/dock/surface/view-model.d.ts +5 -1
- package/dist/modules/dock/surface/view-model.d.ts.map +1 -1
- package/dist/modules/dock/types/card.d.ts +297 -0
- package/dist/modules/dock/types/card.d.ts.map +1 -0
- package/dist/modules/dock/types/hud.d.ts +142 -0
- package/dist/modules/dock/types/hud.d.ts.map +1 -0
- package/dist/modules/dock/types/index.d.ts +8 -0
- package/dist/modules/dock/types/index.d.ts.map +1 -0
- package/dist/modules/dock/types/media.d.ts +66 -0
- package/dist/modules/dock/types/media.d.ts.map +1 -0
- package/dist/modules/dock/types/routing.d.ts +336 -0
- package/dist/modules/dock/types/routing.d.ts.map +1 -0
- package/dist/modules/dock/types/surface-flow.d.ts +231 -0
- package/dist/modules/dock/types/surface-flow.d.ts.map +1 -0
- package/dist/modules/dock/types/surface.d.ts +194 -0
- package/dist/modules/dock/types/surface.d.ts.map +1 -0
- package/dist/modules/dock/types/theme.d.ts +201 -0
- package/dist/modules/dock/types/theme.d.ts.map +1 -0
- package/dist/modules/index.d.ts +4 -0
- package/dist/modules/index.d.ts.map +1 -1
- package/dist/modules/index.js +23 -18
- package/dist/modules/loading/constants.d.ts +18 -1
- package/dist/modules/loading/constants.d.ts.map +1 -1
- package/dist/modules/loading/context.d.ts +11 -1
- package/dist/modules/loading/context.d.ts.map +1 -1
- package/dist/modules/loading/hooks.d.ts +24 -1
- package/dist/modules/loading/hooks.d.ts.map +1 -1
- package/dist/modules/loading/module.d.ts +6 -0
- package/dist/modules/loading/module.d.ts.map +1 -1
- package/dist/modules/loading/overlay.d.ts +3 -0
- package/dist/modules/loading/overlay.d.ts.map +1 -1
- package/dist/modules/loading/state.d.ts +13 -0
- package/dist/modules/loading/state.d.ts.map +1 -1
- package/dist/modules/loading/types.d.ts +42 -2
- package/dist/modules/loading/types.d.ts.map +1 -1
- package/dist/modules/media/constants.d.ts +19 -0
- package/dist/modules/media/constants.d.ts.map +1 -1
- package/dist/modules/media/context.d.ts +11 -1
- package/dist/modules/media/context.d.ts.map +1 -1
- package/dist/modules/media/hooks.d.ts +17 -0
- package/dist/modules/media/hooks.d.ts.map +1 -1
- package/dist/modules/media/module.d.ts +4 -0
- package/dist/modules/media/module.d.ts.map +1 -1
- package/dist/modules/media/overlay.d.ts +7 -0
- package/dist/modules/media/overlay.d.ts.map +1 -1
- package/dist/modules/media/playback.d.ts +13 -0
- package/dist/modules/media/playback.d.ts.map +1 -1
- package/dist/modules/media/session.d.ts +20 -0
- package/dist/modules/media/session.d.ts.map +1 -1
- package/dist/modules/media/types.d.ts +49 -2
- package/dist/modules/media/types.d.ts.map +1 -1
- package/dist/modules/modal/components/close-button.d.ts +6 -0
- package/dist/modules/modal/components/close-button.d.ts.map +1 -0
- package/dist/modules/modal/components/modal-container.d.ts +7 -0
- package/dist/modules/modal/components/modal-container.d.ts.map +1 -0
- package/dist/modules/modal/components/modal-layer-switcher.d.ts +9 -0
- package/dist/modules/modal/components/modal-layer-switcher.d.ts.map +1 -0
- package/dist/modules/modal/components/modal-layer.d.ts +17 -0
- package/dist/modules/modal/components/modal-layer.d.ts.map +1 -0
- package/dist/modules/modal/components/overlay.d.ts +6 -0
- package/dist/modules/modal/components/overlay.d.ts.map +1 -0
- package/dist/modules/modal/components/resolve-header.d.ts +10 -0
- package/dist/modules/modal/components/resolve-header.d.ts.map +1 -0
- package/dist/modules/modal/components/slot-row.d.ts +12 -0
- package/dist/modules/modal/components/slot-row.d.ts.map +1 -0
- package/dist/modules/modal/constants.d.ts +16 -1
- package/dist/modules/modal/constants.d.ts.map +1 -1
- package/dist/modules/modal/context.d.ts +7 -1
- package/dist/modules/modal/context.d.ts.map +1 -1
- package/dist/modules/modal/hooks/use-mobile-viewport.d.ts +3 -0
- package/dist/modules/modal/hooks/use-mobile-viewport.d.ts.map +1 -0
- package/dist/modules/modal/hooks/use-modal-focus-trap.d.ts +12 -0
- package/dist/modules/modal/hooks/use-modal-focus-trap.d.ts.map +1 -0
- package/dist/modules/modal/hooks/use-modal-scroll-lock.d.ts +3 -0
- package/dist/modules/modal/hooks/use-modal-scroll-lock.d.ts.map +1 -0
- package/dist/modules/modal/hooks.d.ts +30 -4
- package/dist/modules/modal/hooks.d.ts.map +1 -1
- package/dist/modules/modal/index.d.ts +7 -6
- package/dist/modules/modal/index.d.ts.map +1 -1
- package/dist/modules/modal/lib/dom.d.ts +13 -0
- package/dist/modules/modal/lib/dom.d.ts.map +1 -0
- package/dist/modules/modal/lib/theme.d.ts +4 -0
- package/dist/modules/modal/lib/theme.d.ts.map +1 -0
- package/dist/modules/modal/model/entry.d.ts +18 -0
- package/dist/modules/modal/model/entry.d.ts.map +1 -0
- package/dist/modules/modal/model/header.d.ts +16 -0
- package/dist/modules/modal/model/header.d.ts.map +1 -0
- package/dist/modules/modal/model/identity.d.ts +13 -0
- package/dist/modules/modal/model/identity.d.ts.map +1 -0
- package/dist/modules/modal/model/layout.d.ts +37 -0
- package/dist/modules/modal/model/layout.d.ts.map +1 -0
- package/dist/modules/modal/model/state.d.ts +10 -0
- package/dist/modules/modal/model/state.d.ts.map +1 -0
- package/dist/modules/modal/module.d.ts +7 -0
- package/dist/modules/modal/module.d.ts.map +1 -1
- package/dist/modules/modal/motion.d.ts.map +1 -1
- package/dist/modules/modal/types.d.ts +73 -1
- package/dist/modules/modal/types.d.ts.map +1 -1
- package/dist/modules/navigation/context.d.ts +16 -4
- package/dist/modules/navigation/context.d.ts.map +1 -1
- package/dist/modules/navigation/hooks.d.ts +28 -1
- package/dist/modules/navigation/hooks.d.ts.map +1 -1
- package/dist/modules/navigation/index.d.ts +5 -5
- package/dist/modules/navigation/index.d.ts.map +1 -1
- package/dist/modules/navigation/listeners.d.ts +10 -1
- package/dist/modules/navigation/listeners.d.ts.map +1 -1
- package/dist/modules/navigation/module.d.ts +5 -2
- package/dist/modules/navigation/module.d.ts.map +1 -1
- package/dist/modules/notification/constants.d.ts +22 -2
- package/dist/modules/notification/constants.d.ts.map +1 -1
- package/dist/modules/notification/context.d.ts +12 -2
- package/dist/modules/notification/context.d.ts.map +1 -1
- package/dist/modules/notification/hooks.d.ts +32 -1
- package/dist/modules/notification/hooks.d.ts.map +1 -1
- package/dist/modules/notification/module.d.ts +3 -0
- package/dist/modules/notification/module.d.ts.map +1 -1
- package/dist/modules/notification/motion.d.ts.map +1 -1
- package/dist/modules/notification/overlay.d.ts.map +1 -1
- package/dist/modules/notification/state.d.ts +28 -0
- package/dist/modules/notification/state.d.ts.map +1 -1
- package/dist/modules/notification/types.d.ts +48 -2
- package/dist/modules/notification/types.d.ts.map +1 -1
- package/dist/navigation/index.d.ts +1 -0
- package/dist/navigation/index.js +189 -0
- package/dist/navigation/index.js.map +1 -0
- package/dist/notification/index.d.ts +1 -0
- package/dist/notification/index.js +11 -0
- package/dist/overlay-YC336DAS.js +13 -0
- package/dist/overlay-YC336DAS.js.map +1 -0
- package/dist/provider/index.d.ts +1 -0
- package/dist/provider/index.js +14 -0
- package/dist/react/context/index.d.ts +4 -0
- package/dist/react/context/index.d.ts.map +1 -0
- package/dist/react/hooks/index.d.ts +10 -0
- package/dist/react/hooks/index.d.ts.map +1 -0
- package/dist/react/hooks/types.d.ts +25 -0
- package/dist/react/hooks/types.d.ts.map +1 -0
- package/dist/react/hooks/use-click-outside.d.ts +6 -0
- package/dist/react/hooks/use-click-outside.d.ts.map +1 -0
- package/dist/react/hooks/use-controllable-state.d.ts +7 -0
- package/dist/react/hooks/use-controllable-state.d.ts.map +1 -0
- package/dist/react/hooks/use-fullscreen-state.d.ts +7 -0
- package/dist/react/hooks/use-fullscreen-state.d.ts.map +1 -0
- package/dist/react/hooks/use-global-event.d.ts +9 -0
- package/dist/react/hooks/use-global-event.d.ts.map +1 -0
- package/dist/react/hooks/use-hotkey.d.ts +10 -0
- package/dist/react/hooks/use-hotkey.d.ts.map +1 -0
- package/dist/react/hooks/use-required-context.d.ts +6 -0
- package/dist/react/hooks/use-required-context.d.ts.map +1 -0
- package/dist/react/hooks/use-scroll-lock.d.ts +9 -0
- package/dist/react/hooks/use-scroll-lock.d.ts.map +1 -0
- package/dist/react/hooks/use-store.d.ts +3 -0
- package/dist/react/hooks/use-store.d.ts.map +1 -0
- package/dist/react/theme/index.d.ts +82 -0
- package/dist/react/theme/index.d.ts.map +1 -0
- package/dist/react/ui/components/avatar.d.ts +6 -0
- package/dist/react/ui/components/avatar.d.ts.map +1 -0
- package/dist/react/ui/components/button.d.ts +6 -0
- package/dist/react/ui/components/button.d.ts.map +1 -0
- package/dist/react/ui/components/carousel.d.ts +6 -0
- package/dist/react/ui/components/carousel.d.ts.map +1 -0
- package/dist/react/ui/components/checkbox.d.ts +10 -0
- package/dist/react/ui/components/checkbox.d.ts.map +1 -0
- package/dist/react/ui/components/icon.d.ts +6 -0
- package/dist/react/ui/components/icon.d.ts.map +1 -0
- package/dist/react/ui/components/image.d.ts +6 -0
- package/dist/react/ui/components/image.d.ts.map +1 -0
- package/dist/react/ui/components/indicator.d.ts +45 -0
- package/dist/react/ui/components/indicator.d.ts.map +1 -0
- package/dist/react/ui/components/input.d.ts +10 -0
- package/dist/react/ui/components/input.d.ts.map +1 -0
- package/dist/react/ui/components/loader.d.ts +10 -0
- package/dist/react/ui/components/loader.d.ts.map +1 -0
- package/dist/react/ui/components/segmented.d.ts +6 -0
- package/dist/react/ui/components/segmented.d.ts.map +1 -0
- package/dist/react/ui/components/select-parts.d.ts +22 -0
- package/dist/react/ui/components/select-parts.d.ts.map +1 -0
- package/dist/react/ui/components/select.d.ts +6 -0
- package/dist/react/ui/components/select.d.ts.map +1 -0
- package/dist/react/ui/components/skeleton.d.ts +10 -0
- package/dist/react/ui/components/skeleton.d.ts.map +1 -0
- package/dist/react/ui/components/switch.d.ts +6 -0
- package/dist/react/ui/components/switch.d.ts.map +1 -0
- package/dist/react/ui/components/tooltip.d.ts +11 -0
- package/dist/react/ui/components/tooltip.d.ts.map +1 -0
- package/dist/react/ui/index.d.ts +19 -0
- package/dist/react/ui/index.d.ts.map +1 -0
- package/dist/react/ui/provider.d.ts +22 -0
- package/dist/react/ui/provider.d.ts.map +1 -0
- package/dist/react/ui/types-controls.d.ts +133 -0
- package/dist/react/ui/types-controls.d.ts.map +1 -0
- package/dist/react/ui/types.d.ts +192 -0
- package/dist/react/ui/types.d.ts.map +1 -0
- package/dist/react/ui/utils.d.ts +65 -0
- package/dist/react/ui/utils.d.ts.map +1 -0
- package/dist/recipes/index.d.ts +1 -0
- package/dist/recipes/index.js +233 -0
- package/dist/recipes/index.js.map +1 -0
- package/dist/result/index.d.ts +1 -0
- package/dist/result/index.js +98 -0
- package/dist/result/index.js.map +1 -0
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.js +6 -0
- package/dist/ui/index.d.ts +1 -19
- package/dist/ui/index.js +2158 -1860
- package/dist/ui/index.js.map +1 -1
- package/dist/utils/index.d.ts +1 -15
- package/dist/utils/index.js +194 -71
- package/dist/utils/index.js.map +1 -1
- package/docs/README.md +58 -61
- package/docs/architecture-and-rules.md +134 -58
- package/docs/core-engine.md +36 -52
- package/docs/custom-modules.md +43 -32
- package/docs/design.md +185 -0
- package/docs/getting-started.md +49 -57
- package/docs/modules/README.md +50 -61
- package/docs/modules/ambient.md +95 -87
- package/docs/modules/background.md +39 -36
- package/docs/modules/context-menu.md +19 -18
- package/docs/modules/controls.md +13 -13
- package/docs/modules/dock.md +74 -93
- package/docs/modules/error-boundary.md +2 -2
- package/docs/modules/kernel.md +38 -26
- package/docs/modules/loading.md +14 -14
- package/docs/modules/media.md +13 -13
- package/docs/modules/modal.md +14 -14
- package/docs/modules/navigation.md +87 -84
- package/docs/modules/notification.md +13 -13
- package/docs/modules/result.md +22 -22
- package/docs/proposals/navigation.md +32 -31
- package/docs/testing.md +34 -28
- package/docs/theming.md +67 -44
- package/package.json +100 -97
- package/templates/AGENTS.md +35 -25
- package/dist/atoms/button.d.ts +0 -11
- package/dist/atoms/button.d.ts.map +0 -1
- package/dist/atoms/icon.d.ts +0 -15
- package/dist/atoms/icon.d.ts.map +0 -1
- package/dist/atoms/index.d.ts +0 -5
- package/dist/atoms/index.d.ts.map +0 -1
- package/dist/atoms/index.js +0 -4
- package/dist/atoms/spinner.d.ts +0 -9
- package/dist/atoms/spinner.d.ts.map +0 -1
- package/dist/atoms/tooltip.d.ts +0 -18
- package/dist/atoms/tooltip.d.ts.map +0 -1
- package/dist/chunk-6UFMD6TK.js +0 -419
- package/dist/chunk-6UFMD6TK.js.map +0 -1
- package/dist/chunk-AA2TWJQI.js +0 -2186
- package/dist/chunk-AA2TWJQI.js.map +0 -1
- package/dist/chunk-ACLLDU3J.js +0 -888
- package/dist/chunk-ACLLDU3J.js.map +0 -1
- package/dist/chunk-DGCQWQLZ.js +0 -61
- package/dist/chunk-DGCQWQLZ.js.map +0 -1
- package/dist/chunk-E6ANX5YP.js +0 -1273
- package/dist/chunk-E6ANX5YP.js.map +0 -1
- package/dist/chunk-GDCVEINL.js +0 -408
- package/dist/chunk-GDCVEINL.js.map +0 -1
- package/dist/chunk-GN666KV5.js +0 -28
- package/dist/chunk-GN666KV5.js.map +0 -1
- package/dist/chunk-HCSDQEFB.js +0 -845
- package/dist/chunk-HCSDQEFB.js.map +0 -1
- package/dist/chunk-HMEWYAWU.js +0 -1889
- package/dist/chunk-HMEWYAWU.js.map +0 -1
- package/dist/chunk-I3IZUBBU.js +0 -97
- package/dist/chunk-I3IZUBBU.js.map +0 -1
- package/dist/chunk-JCZUCKI3.js +0 -27
- package/dist/chunk-JCZUCKI3.js.map +0 -1
- package/dist/chunk-MAGYFVKH.js +0 -67
- package/dist/chunk-MAGYFVKH.js.map +0 -1
- package/dist/chunk-NEBGCFE3.js +0 -521
- package/dist/chunk-NEBGCFE3.js.map +0 -1
- package/dist/chunk-NK2DQB3G.js +0 -306
- package/dist/chunk-NK2DQB3G.js.map +0 -1
- package/dist/chunk-QI3ALLIB.js +0 -38
- package/dist/chunk-QI3ALLIB.js.map +0 -1
- package/dist/chunk-QM2P6TIU.js +0 -353
- package/dist/chunk-QM2P6TIU.js.map +0 -1
- package/dist/chunk-RFP2DJAB.js +0 -658
- package/dist/chunk-RFP2DJAB.js.map +0 -1
- package/dist/chunk-SQ7XZMCN.js +0 -481
- package/dist/chunk-SQ7XZMCN.js.map +0 -1
- package/dist/chunk-TMTMQNEQ.js +0 -372
- package/dist/chunk-TMTMQNEQ.js.map +0 -1
- package/dist/chunk-VDNE3A7X.js +0 -9724
- package/dist/chunk-VDNE3A7X.js.map +0 -1
- package/dist/chunk-XATRMFGU.js +0 -139
- package/dist/chunk-XATRMFGU.js.map +0 -1
- package/dist/chunk-ZAP2YHZG.js +0 -454
- package/dist/chunk-ZAP2YHZG.js.map +0 -1
- package/dist/chunk-ZH5FUYPG.js +0 -349
- package/dist/chunk-ZH5FUYPG.js.map +0 -1
- package/dist/chunk-ZKM4RETZ.js +0 -51
- package/dist/chunk-ZKM4RETZ.js.map +0 -1
- package/dist/error/boundary.d.ts +0 -14
- package/dist/error/boundary.d.ts.map +0 -1
- package/dist/error/constants.d.ts +0 -18
- package/dist/error/constants.d.ts.map +0 -1
- package/dist/error/index.d.ts.map +0 -1
- package/dist/error/listener.d.ts +0 -2
- package/dist/error/listener.d.ts.map +0 -1
- package/dist/error/reporter.d.ts +0 -32
- package/dist/error/reporter.d.ts.map +0 -1
- package/dist/error/theme.d.ts +0 -3
- package/dist/error/theme.d.ts.map +0 -1
- package/dist/error/types.d.ts +0 -91
- package/dist/error/types.d.ts.map +0 -1
- package/dist/error/utils.d.ts +0 -21
- package/dist/error/utils.d.ts.map +0 -1
- package/dist/events.d.ts +0 -51
- package/dist/events.d.ts.map +0 -1
- package/dist/events.js +0 -82
- package/dist/events.js.map +0 -1
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/types.d.ts +0 -16
- package/dist/hooks/types.d.ts.map +0 -1
- package/dist/hooks/use-click-outside.d.ts +0 -3
- package/dist/hooks/use-click-outside.d.ts.map +0 -1
- package/dist/hooks/use-controllable-state.d.ts +0 -3
- package/dist/hooks/use-controllable-state.d.ts.map +0 -1
- package/dist/hooks/use-fullscreen-state.d.ts +0 -4
- package/dist/hooks/use-fullscreen-state.d.ts.map +0 -1
- package/dist/hooks/use-global-event.d.ts +0 -5
- package/dist/hooks/use-global-event.d.ts.map +0 -1
- package/dist/hooks/use-hotkey.d.ts +0 -4
- package/dist/hooks/use-hotkey.d.ts.map +0 -1
- package/dist/hooks/use-isomorphic-layout-effect.d.ts +0 -3
- package/dist/hooks/use-isomorphic-layout-effect.d.ts.map +0 -1
- package/dist/hooks/use-required-context.d.ts +0 -3
- package/dist/hooks/use-required-context.d.ts.map +0 -1
- package/dist/hooks/use-scroll-lock.d.ts +0 -3
- package/dist/hooks/use-scroll-lock.d.ts.map +0 -1
- package/dist/hooks/use-store.d.ts +0 -3
- package/dist/hooks/use-store.d.ts.map +0 -1
- package/dist/kernel/adapters.d.ts +0 -5
- package/dist/kernel/adapters.d.ts.map +0 -1
- package/dist/kernel/compose.d.ts +0 -15
- package/dist/kernel/compose.d.ts.map +0 -1
- package/dist/kernel/constants.d.ts +0 -12
- package/dist/kernel/constants.d.ts.map +0 -1
- package/dist/kernel/context-registry.d.ts +0 -3
- package/dist/kernel/context-registry.d.ts.map +0 -1
- package/dist/kernel/handlers.d.ts +0 -3
- package/dist/kernel/handlers.d.ts.map +0 -1
- package/dist/kernel/hooks.d.ts +0 -7
- package/dist/kernel/hooks.d.ts.map +0 -1
- package/dist/kernel/index.d.ts.map +0 -1
- package/dist/kernel/installed.d.ts +0 -21
- package/dist/kernel/installed.d.ts.map +0 -1
- package/dist/kernel/module.d.ts +0 -32
- package/dist/kernel/module.d.ts.map +0 -1
- package/dist/kernel/operations.d.ts +0 -21
- package/dist/kernel/operations.d.ts.map +0 -1
- package/dist/kernel/page-controller.d.ts +0 -8
- package/dist/kernel/page-controller.d.ts.map +0 -1
- package/dist/kernel/provider.d.ts +0 -18
- package/dist/kernel/provider.d.ts.map +0 -1
- package/dist/kernel/runtime.d.ts.map +0 -1
- package/dist/kernel/schema.d.ts +0 -11
- package/dist/kernel/schema.d.ts.map +0 -1
- package/dist/kernel/store.d.ts +0 -4
- package/dist/kernel/store.d.ts.map +0 -1
- package/dist/kernel/types.d.ts +0 -233
- package/dist/kernel/types.d.ts.map +0 -1
- package/dist/kernel/utils.d.ts +0 -18
- package/dist/kernel/utils.d.ts.map +0 -1
- package/dist/modules/ambient/index.js +0 -10
- package/dist/modules/ambient/server/index.js +0 -225
- package/dist/modules/ambient/server/index.js.map +0 -1
- package/dist/modules/ambient/worker/index.js +0 -122
- package/dist/modules/ambient/worker/index.js.map +0 -1
- package/dist/modules/background/index.js +0 -9
- package/dist/modules/background/overlay.d.ts +0 -135
- package/dist/modules/background/overlay.d.ts.map +0 -1
- package/dist/modules/background/playback.d.ts +0 -10
- package/dist/modules/background/playback.d.ts.map +0 -1
- package/dist/modules/background/state.d.ts +0 -9
- package/dist/modules/background/state.d.ts.map +0 -1
- package/dist/modules/background/visual.d.ts +0 -48
- package/dist/modules/background/visual.d.ts.map +0 -1
- package/dist/modules/background/youtube/iframe.d.ts +0 -52
- package/dist/modules/background/youtube/iframe.d.ts.map +0 -1
- package/dist/modules/background/youtube/parse.d.ts +0 -17
- package/dist/modules/background/youtube/parse.d.ts.map +0 -1
- package/dist/modules/background/youtube/player.d.ts +0 -28
- package/dist/modules/background/youtube/player.d.ts.map +0 -1
- package/dist/modules/context-menu/index.js +0 -14
- package/dist/modules/controls/index.js +0 -7
- package/dist/modules/dock/cards.d.ts +0 -1722
- package/dist/modules/dock/cards.d.ts.map +0 -1
- package/dist/modules/dock/dom.d.ts +0 -24
- package/dist/modules/dock/dom.d.ts.map +0 -1
- package/dist/modules/dock/helpers.d.ts +0 -25
- package/dist/modules/dock/helpers.d.ts.map +0 -1
- package/dist/modules/dock/hooks.d.ts +0 -42
- package/dist/modules/dock/hooks.d.ts.map +0 -1
- package/dist/modules/dock/index.js +0 -13
- package/dist/modules/dock/layout.d.ts +0 -26
- package/dist/modules/dock/layout.d.ts.map +0 -1
- package/dist/modules/dock/overlay.d.ts +0 -79
- package/dist/modules/dock/overlay.d.ts.map +0 -1
- package/dist/modules/dock/paths.d.ts +0 -10
- package/dist/modules/dock/paths.d.ts.map +0 -1
- package/dist/modules/dock/state.d.ts +0 -22
- package/dist/modules/dock/state.d.ts.map +0 -1
- package/dist/modules/dock/styles.d.ts +0 -900
- package/dist/modules/dock/styles.d.ts.map +0 -1
- package/dist/modules/dock/surface/hooks.d.ts +0 -110
- package/dist/modules/dock/surface/hooks.d.ts.map +0 -1
- package/dist/modules/dock/types.d.ts +0 -1274
- package/dist/modules/dock/types.d.ts.map +0 -1
- package/dist/modules/loading/index.js +0 -8
- package/dist/modules/media/index.js +0 -6
- package/dist/modules/modal/dom.d.ts +0 -4
- package/dist/modules/modal/dom.d.ts.map +0 -1
- package/dist/modules/modal/header.d.ts +0 -7
- package/dist/modules/modal/header.d.ts.map +0 -1
- package/dist/modules/modal/identity.d.ts +0 -7
- package/dist/modules/modal/identity.d.ts.map +0 -1
- package/dist/modules/modal/index.js +0 -11
- package/dist/modules/modal/layout.d.ts +0 -13
- package/dist/modules/modal/layout.d.ts.map +0 -1
- package/dist/modules/modal/overlay.d.ts +0 -4
- package/dist/modules/modal/overlay.d.ts.map +0 -1
- package/dist/modules/modal/state.d.ts +0 -4
- package/dist/modules/modal/state.d.ts.map +0 -1
- package/dist/modules/navigation/constants.d.ts +0 -33
- package/dist/modules/navigation/constants.d.ts.map +0 -1
- package/dist/modules/navigation/index.js +0 -80
- package/dist/modules/navigation/index.js.map +0 -1
- package/dist/modules/navigation/navigator.d.ts +0 -3
- package/dist/modules/navigation/navigator.d.ts.map +0 -1
- package/dist/modules/navigation/settings.d.ts +0 -5
- package/dist/modules/navigation/settings.d.ts.map +0 -1
- package/dist/modules/navigation/state.d.ts +0 -19
- package/dist/modules/navigation/state.d.ts.map +0 -1
- package/dist/modules/navigation/types.d.ts +0 -118
- package/dist/modules/navigation/types.d.ts.map +0 -1
- package/dist/modules/navigation/utils.d.ts +0 -8
- package/dist/modules/navigation/utils.d.ts.map +0 -1
- package/dist/modules/notification/index.js +0 -7
- package/dist/overlay-LTRZUZQD.js +0 -9
- package/dist/overlay-LTRZUZQD.js.map +0 -1
- package/dist/provider.d.ts +0 -23
- package/dist/provider.d.ts.map +0 -1
- package/dist/provider.js +0 -9
- package/dist/provider.js.map +0 -1
- package/dist/result.d.ts +0 -50
- package/dist/result.d.ts.map +0 -1
- package/dist/result.js +0 -102
- package/dist/result.js.map +0 -1
- package/dist/theme.d.ts +0 -46
- package/dist/theme.d.ts.map +0 -1
- package/dist/theme.js +0 -6
- package/dist/theme.js.map +0 -1
- package/dist/tokens/index.d.ts +0 -4
- package/dist/tokens/index.d.ts.map +0 -1
- package/dist/tokens/index.js +0 -297
- package/dist/tokens/index.js.map +0 -1
- package/dist/tokens/motion-config.d.ts +0 -35
- package/dist/tokens/motion-config.d.ts.map +0 -1
- package/dist/tokens/motion.d.ts +0 -164
- package/dist/tokens/motion.d.ts.map +0 -1
- package/dist/tokens/tokens.d.ts +0 -34
- package/dist/tokens/tokens.d.ts.map +0 -1
- package/dist/ui/carousel/carousel.d.ts +0 -24
- package/dist/ui/carousel/carousel.d.ts.map +0 -1
- package/dist/ui/carousel/track.d.ts +0 -11
- package/dist/ui/carousel/track.d.ts.map +0 -1
- package/dist/ui/carousel/use-drag-scroll.d.ts +0 -3
- package/dist/ui/carousel/use-drag-scroll.d.ts.map +0 -1
- package/dist/ui/cn.d.ts +0 -19
- package/dist/ui/cn.d.ts.map +0 -1
- package/dist/ui/components/avatar.d.ts +0 -14
- package/dist/ui/components/avatar.d.ts.map +0 -1
- package/dist/ui/components/button.d.ts +0 -9
- package/dist/ui/components/button.d.ts.map +0 -1
- package/dist/ui/components/checkbox.d.ts +0 -18
- package/dist/ui/components/checkbox.d.ts.map +0 -1
- package/dist/ui/components/icon.d.ts +0 -4
- package/dist/ui/components/icon.d.ts.map +0 -1
- package/dist/ui/components/image.d.ts +0 -13
- package/dist/ui/components/image.d.ts.map +0 -1
- package/dist/ui/components/indicator.d.ts +0 -37
- package/dist/ui/components/indicator.d.ts.map +0 -1
- package/dist/ui/components/input.d.ts +0 -15
- package/dist/ui/components/input.d.ts.map +0 -1
- package/dist/ui/components/loader.d.ts +0 -17
- package/dist/ui/components/loader.d.ts.map +0 -1
- package/dist/ui/components/segmented.d.ts +0 -21
- package/dist/ui/components/segmented.d.ts.map +0 -1
- package/dist/ui/components/select.d.ts +0 -34
- package/dist/ui/components/select.d.ts.map +0 -1
- package/dist/ui/components/skeleton.d.ts +0 -16
- package/dist/ui/components/skeleton.d.ts.map +0 -1
- package/dist/ui/components/switch.d.ts +0 -11
- package/dist/ui/components/switch.d.ts.map +0 -1
- package/dist/ui/components/tooltip.d.ts +0 -25
- package/dist/ui/components/tooltip.d.ts.map +0 -1
- package/dist/ui/defaults.d.ts +0 -250
- package/dist/ui/defaults.d.ts.map +0 -1
- package/dist/ui/define.d.ts +0 -112
- package/dist/ui/define.d.ts.map +0 -1
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/provider.d.ts +0 -11
- package/dist/ui/provider.d.ts.map +0 -1
- package/dist/ui/recipe.d.ts +0 -70
- package/dist/ui/recipe.d.ts.map +0 -1
- package/dist/ui/recipes.d.ts +0 -9
- package/dist/ui/recipes.d.ts.map +0 -1
- package/dist/ui/recipes.js +0 -648
- package/dist/ui/recipes.js.map +0 -1
- package/dist/ui/split.d.ts +0 -4
- package/dist/ui/split.d.ts.map +0 -1
- package/dist/ui/tones.d.ts +0 -23
- package/dist/ui/tones.d.ts.map +0 -1
- package/dist/utils/cn.d.ts +0 -3
- package/dist/utils/cn.d.ts.map +0 -1
- package/dist/utils/dom.d.ts +0 -5
- package/dist/utils/dom.d.ts.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/number.d.ts +0 -3
- package/dist/utils/number.d.ts.map +0 -1
- package/dist/utils/object.d.ts +0 -5
- package/dist/utils/object.d.ts.map +0 -1
- package/dist/utils/report.d.ts +0 -5
- package/dist/utils/report.d.ts.map +0 -1
- package/dist/utils/scheduler.d.ts +0 -34
- package/dist/utils/scheduler.d.ts.map +0 -1
- package/dist/utils/store.d.ts +0 -11
- package/dist/utils/store.d.ts.map +0 -1
- package/dist/utils/string.d.ts +0 -5
- package/dist/utils/string.d.ts.map +0 -1
- package/dist/utils/timing.d.ts +0 -7
- package/dist/utils/timing.d.ts.map +0 -1
- package/dist/utils/user-message.d.ts +0 -20
- package/dist/utils/user-message.d.ts.map +0 -1
- package/docs/ui.md +0 -183
- package/styles/effects.css +0 -219
- package/styles/index.css +0 -8
- package/styles/interaction.css +0 -273
- package/styles/palette.css +0 -81
- package/styles/time.css +0 -26
- package/styles/tokens.css +0 -114
- package/styles/utilities.css +0 -110
- package/templates/motion/background.ts +0 -15
- package/templates/motion/context-menu.ts +0 -65
- package/templates/motion/dock.ts +0 -421
- package/templates/motion/modal.ts +0 -82
- package/templates/motion/notification.ts +0 -26
- package/templates/motion/tokens.ts +0 -36
- /package/dist/{atoms → ambient}/index.js.map +0 -0
- /package/dist/{modules/ambient → background}/index.js.map +0 -0
- /package/dist/{modules/background → context-menu}/index.js.map +0 -0
- /package/dist/{modules/context-menu → controls}/index.js.map +0 -0
- /package/dist/{kernel → core/kernel}/runtime.d.ts +0 -0
- /package/dist/{modules/controls → dock}/index.js.map +0 -0
- /package/dist/{modules/dock → loading}/index.js.map +0 -0
- /package/dist/{modules/loading → media}/index.js.map +0 -0
- /package/dist/{modules/media → notification}/index.js.map +0 -0
- /package/dist/{modules/modal → provider}/index.js.map +0 -0
- /package/dist/{modules/notification → theme}/index.js.map +0 -0
|
@@ -0,0 +1,1766 @@
|
|
|
1
|
+
import { useOptionalBackgroundState } from './chunk-66MHDFNF.js';
|
|
2
|
+
import { defineModule } from './chunk-ZE6OGGA7.js';
|
|
3
|
+
import { useRequiredContext, useStore } from './chunk-Y2Q74PJP.js';
|
|
4
|
+
import { defineThemeSpec, useTheme } from './chunk-ESD5EQ5H.js';
|
|
5
|
+
import { createStore } from './chunk-5H6FZW3N.js';
|
|
6
|
+
import { getOrCreateGlobalContext } from './chunk-J3VTDBC6.js';
|
|
7
|
+
import { shallowEqual } from './chunk-BMFHS3GV.js';
|
|
8
|
+
import { c } from 'react/compiler-runtime';
|
|
9
|
+
import { useState, use, useEffect, useRef } from 'react';
|
|
10
|
+
import { jsx } from 'react/jsx-runtime';
|
|
11
|
+
|
|
12
|
+
var AmbientContext = getOrCreateGlobalContext("AmbientContext", null);
|
|
13
|
+
function createAmbientValue(initialPalette) {
|
|
14
|
+
const store = createStore({
|
|
15
|
+
isExtracting: false,
|
|
16
|
+
palette: initialPalette
|
|
17
|
+
}, {
|
|
18
|
+
freezeSnapshots: false
|
|
19
|
+
});
|
|
20
|
+
return {
|
|
21
|
+
actions: {
|
|
22
|
+
setIsExtracting: (next) => store.publish((state) => {
|
|
23
|
+
const isExtracting = typeof next === "function" ? next(state.isExtracting) : next;
|
|
24
|
+
return isExtracting === state.isExtracting ? state : {
|
|
25
|
+
...state,
|
|
26
|
+
isExtracting
|
|
27
|
+
};
|
|
28
|
+
}),
|
|
29
|
+
setPalette: (next) => store.publish((state) => {
|
|
30
|
+
const palette = typeof next === "function" ? next(state.palette) : next;
|
|
31
|
+
return palette === state.palette ? state : {
|
|
32
|
+
...state,
|
|
33
|
+
palette
|
|
34
|
+
};
|
|
35
|
+
})
|
|
36
|
+
},
|
|
37
|
+
store
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function AmbientProvider(t0) {
|
|
41
|
+
const $ = c(5);
|
|
42
|
+
const {
|
|
43
|
+
children,
|
|
44
|
+
initialPalette: t1
|
|
45
|
+
} = t0;
|
|
46
|
+
const initialPalette = t1 === void 0 ? null : t1;
|
|
47
|
+
let t2;
|
|
48
|
+
if ($[0] !== initialPalette) {
|
|
49
|
+
t2 = () => createAmbientValue(initialPalette);
|
|
50
|
+
$[0] = initialPalette;
|
|
51
|
+
$[1] = t2;
|
|
52
|
+
} else {
|
|
53
|
+
t2 = $[1];
|
|
54
|
+
}
|
|
55
|
+
const [value] = useState(t2);
|
|
56
|
+
let t3;
|
|
57
|
+
if ($[2] !== children || $[3] !== value) {
|
|
58
|
+
t3 = /* @__PURE__ */ jsx(AmbientContext, { value, children });
|
|
59
|
+
$[2] = children;
|
|
60
|
+
$[3] = value;
|
|
61
|
+
$[4] = t3;
|
|
62
|
+
} else {
|
|
63
|
+
t3 = $[4];
|
|
64
|
+
}
|
|
65
|
+
return t3;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// src/modules/ambient/constants.ts
|
|
69
|
+
var ambientTheme = defineThemeSpec("ambient");
|
|
70
|
+
|
|
71
|
+
// src/modules/ambient/settings.ts
|
|
72
|
+
var AMBIENT_TONES = Object.freeze([10, 15, 20, 30, 40, 50, 60, 70, 80, 90, 95]);
|
|
73
|
+
var AMBIENT_ROLES = Object.freeze(["dominant", "vibrant", "muted", "accent"]);
|
|
74
|
+
var AMBIENT_REGIONS = Object.freeze(["top", "bottom", "left", "right", "center"]);
|
|
75
|
+
var DEFAULT_ANALYSIS = Object.freeze({
|
|
76
|
+
centerWeight: 0.5,
|
|
77
|
+
clusters: 7,
|
|
78
|
+
letterbox: true,
|
|
79
|
+
minContrast: 4.5,
|
|
80
|
+
minHueDistance: 40,
|
|
81
|
+
sampleSize: 128,
|
|
82
|
+
shadowLightness: 0.16
|
|
83
|
+
});
|
|
84
|
+
var DEFAULT_CSS_VAR_NAMES = Object.freeze({
|
|
85
|
+
on: "--ambient-on-{role}",
|
|
86
|
+
region: "--ambient-{region}",
|
|
87
|
+
role: "--ambient-{role}",
|
|
88
|
+
shadow: "--ambient-shadow",
|
|
89
|
+
tone: "--ambient-{role}-{tone}"
|
|
90
|
+
});
|
|
91
|
+
var DEFAULT_PROXY = "/api/ambient/proxy?url=";
|
|
92
|
+
var DEFAULT_LINGER_MS = 3e3;
|
|
93
|
+
var createDefaults = () => ({
|
|
94
|
+
analysis: {
|
|
95
|
+
...DEFAULT_ANALYSIS
|
|
96
|
+
},
|
|
97
|
+
cacheLimit: 100,
|
|
98
|
+
cssVars: {
|
|
99
|
+
...DEFAULT_CSS_VAR_NAMES,
|
|
100
|
+
tones: AMBIENT_TONES
|
|
101
|
+
},
|
|
102
|
+
linger: DEFAULT_LINGER_MS,
|
|
103
|
+
proxy: DEFAULT_PROXY,
|
|
104
|
+
strategy: "auto",
|
|
105
|
+
worker: null
|
|
106
|
+
});
|
|
107
|
+
var SETTINGS_KEY = /* @__PURE__ */ Symbol.for("@omerdlw/base-framework/ambient/settings");
|
|
108
|
+
var scope = globalThis;
|
|
109
|
+
function getAmbientSettings() {
|
|
110
|
+
return scope[SETTINGS_KEY] ??= createDefaults();
|
|
111
|
+
}
|
|
112
|
+
function mergeAmbientSettings(base, input) {
|
|
113
|
+
return {
|
|
114
|
+
analysis: {
|
|
115
|
+
...base.analysis,
|
|
116
|
+
...input.analysis
|
|
117
|
+
},
|
|
118
|
+
cacheLimit: input.cacheLimit ?? base.cacheLimit,
|
|
119
|
+
cssVars: {
|
|
120
|
+
...base.cssVars,
|
|
121
|
+
...input.cssVars
|
|
122
|
+
},
|
|
123
|
+
linger: input.linger ?? base.linger,
|
|
124
|
+
proxy: input.proxy === void 0 ? base.proxy : input.proxy,
|
|
125
|
+
strategy: input.strategy ?? base.strategy,
|
|
126
|
+
worker: input.worker === void 0 ? base.worker : input.worker
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function configureAmbient(input) {
|
|
130
|
+
const previous = getAmbientSettings();
|
|
131
|
+
const next = mergeAmbientSettings(previous, input);
|
|
132
|
+
scope[SETTINGS_KEY] = next;
|
|
133
|
+
return () => {
|
|
134
|
+
if (scope[SETTINGS_KEY] === next) scope[SETTINGS_KEY] = previous;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function resolveAnalysis(overrides) {
|
|
138
|
+
return {
|
|
139
|
+
...getAmbientSettings().analysis,
|
|
140
|
+
...overrides
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function resolveProxyUrl(proxy, src) {
|
|
144
|
+
if (!proxy || !/^https?:\/\//i.test(src)) return null;
|
|
145
|
+
if (typeof proxy === "function") return proxy(src);
|
|
146
|
+
const encoded = encodeURIComponent(src);
|
|
147
|
+
return proxy.includes("{url}") ? proxy.replace("{url}", encoded) : `${proxy}${encoded}`;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// src/modules/ambient/dom.ts
|
|
151
|
+
function resolveCssVarNames(overrides) {
|
|
152
|
+
const base = getAmbientSettings().cssVars;
|
|
153
|
+
return overrides ? {
|
|
154
|
+
...base,
|
|
155
|
+
...overrides
|
|
156
|
+
} : base;
|
|
157
|
+
}
|
|
158
|
+
var fill = (template, values) => template.replace(/\{(\w+)\}/g, (match, key) => key in values ? String(values[key]) : match);
|
|
159
|
+
function resolveTargetElement(target) {
|
|
160
|
+
if (typeof document === "undefined") return null;
|
|
161
|
+
if (!target) return document.documentElement;
|
|
162
|
+
if (typeof target === "string") {
|
|
163
|
+
return document.querySelector(target);
|
|
164
|
+
}
|
|
165
|
+
return "current" in target ? target.current : target;
|
|
166
|
+
}
|
|
167
|
+
function normalizeColorMap(colors) {
|
|
168
|
+
const result = {};
|
|
169
|
+
for (const [key, value] of Object.entries(colors)) {
|
|
170
|
+
if (!value) continue;
|
|
171
|
+
result[key.startsWith("--") ? key : `--color-${key}`] = value;
|
|
172
|
+
}
|
|
173
|
+
return result;
|
|
174
|
+
}
|
|
175
|
+
var layersOf = /* @__PURE__ */ new WeakMap();
|
|
176
|
+
function paint(element, state, names) {
|
|
177
|
+
for (const name of names) {
|
|
178
|
+
let value;
|
|
179
|
+
for (let i = state.layers.length - 1; i >= 0 && value === void 0; i--) {
|
|
180
|
+
value = state.layers[i].vars[name];
|
|
181
|
+
}
|
|
182
|
+
if (value !== void 0) {
|
|
183
|
+
element.style.setProperty(name, value);
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
const base = state.base.get(name);
|
|
187
|
+
if (base?.value) element.style.setProperty(name, base.value, base.priority);
|
|
188
|
+
else element.style.removeProperty(name);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function removeLayer(element, state, layer) {
|
|
192
|
+
const index = state.layers.indexOf(layer);
|
|
193
|
+
if (index < 0) return;
|
|
194
|
+
if (layer.leaving) clearTimeout(layer.leaving);
|
|
195
|
+
state.layers.splice(index, 1);
|
|
196
|
+
paint(element, state, Object.keys(layer.vars));
|
|
197
|
+
if (state.layers.length === 0) layersOf.delete(element);
|
|
198
|
+
}
|
|
199
|
+
function acquireLayers(element) {
|
|
200
|
+
let state = layersOf.get(element);
|
|
201
|
+
if (!state) {
|
|
202
|
+
state = {
|
|
203
|
+
base: /* @__PURE__ */ new Map(),
|
|
204
|
+
layers: []
|
|
205
|
+
};
|
|
206
|
+
layersOf.set(element, state);
|
|
207
|
+
}
|
|
208
|
+
for (const layer of state.layers.filter((layer2) => layer2.leaving)) {
|
|
209
|
+
removeLayer(element, state, layer);
|
|
210
|
+
}
|
|
211
|
+
if (!layersOf.has(element)) layersOf.set(element, state);
|
|
212
|
+
return state;
|
|
213
|
+
}
|
|
214
|
+
function captureBaseValues(element, state, names) {
|
|
215
|
+
for (const name of names) {
|
|
216
|
+
if (state.base.has(name)) continue;
|
|
217
|
+
state.base.set(name, {
|
|
218
|
+
priority: element.style.getPropertyPriority(name),
|
|
219
|
+
value: element.style.getPropertyValue(name)
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function applyScopedCssVariables(element, varMap, {
|
|
224
|
+
linger = 0
|
|
225
|
+
} = {}) {
|
|
226
|
+
const vars = {};
|
|
227
|
+
for (const [name, value] of Object.entries(varMap)) {
|
|
228
|
+
if (name && value) vars[name] = value;
|
|
229
|
+
}
|
|
230
|
+
const state = acquireLayers(element);
|
|
231
|
+
captureBaseValues(element, state, Object.keys(vars));
|
|
232
|
+
const layer = {
|
|
233
|
+
leaving: null,
|
|
234
|
+
vars
|
|
235
|
+
};
|
|
236
|
+
state.layers.push(layer);
|
|
237
|
+
paint(element, state, Object.keys(vars));
|
|
238
|
+
let released = false;
|
|
239
|
+
return () => {
|
|
240
|
+
if (released) return;
|
|
241
|
+
released = true;
|
|
242
|
+
if (linger > 0 && element.isConnected) {
|
|
243
|
+
layer.leaving = setTimeout(() => removeLayer(element, state, layer), linger);
|
|
244
|
+
} else {
|
|
245
|
+
removeLayer(element, state, layer);
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
function paletteVarMap(palette, names = resolveCssVarNames()) {
|
|
250
|
+
const varMap = {};
|
|
251
|
+
if (!palette) return varMap;
|
|
252
|
+
if (names.shadow) varMap[names.shadow] = palette.shadow;
|
|
253
|
+
for (const role of AMBIENT_ROLES) {
|
|
254
|
+
const swatch = palette.roles[role];
|
|
255
|
+
if (names.role) varMap[fill(names.role, {
|
|
256
|
+
role
|
|
257
|
+
})] = swatch.color;
|
|
258
|
+
if (names.on) varMap[fill(names.on, {
|
|
259
|
+
role
|
|
260
|
+
})] = swatch.on;
|
|
261
|
+
if (names.tone && names.tones) {
|
|
262
|
+
for (const tone of names.tones) {
|
|
263
|
+
varMap[fill(names.tone, {
|
|
264
|
+
role,
|
|
265
|
+
tone
|
|
266
|
+
})] = swatch.ramp[tone];
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
if (names.region) {
|
|
271
|
+
for (const region of AMBIENT_REGIONS) {
|
|
272
|
+
varMap[fill(names.region, {
|
|
273
|
+
region
|
|
274
|
+
})] = palette.regions[region].color;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return varMap;
|
|
278
|
+
}
|
|
279
|
+
function resolveAmbientVarMap({
|
|
280
|
+
colors = null,
|
|
281
|
+
cssVars = null,
|
|
282
|
+
image = null,
|
|
283
|
+
palette = null
|
|
284
|
+
}) {
|
|
285
|
+
const varMap = image ? paletteVarMap(palette, resolveCssVarNames(cssVars)) : {};
|
|
286
|
+
if (colors) Object.assign(varMap, normalizeColorMap(colors));
|
|
287
|
+
return varMap;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// src/modules/ambient/oklab.ts
|
|
291
|
+
var DEG = Math.PI / 180;
|
|
292
|
+
var GAMUT_EPSILON = 1e-5;
|
|
293
|
+
var CHROMA_SEARCH_LIMIT = 0.4;
|
|
294
|
+
var CHROMA_SEARCH_STEPS = 18;
|
|
295
|
+
var ACHROMATIC_CHROMA = 1e-6;
|
|
296
|
+
var DISPLAY_ACHROMATIC_CHROMA = 5e-4;
|
|
297
|
+
var GAMUT_HEADROOM = 0.96;
|
|
298
|
+
var DEFAULT_TONE_CHROMA_CAP = 0.3;
|
|
299
|
+
var DEFAULT_MIN_CONTRAST = 4.5;
|
|
300
|
+
var ON_COLOR_STEPS = 12;
|
|
301
|
+
var ON_LIGHT_START = 0.985;
|
|
302
|
+
var ON_LIGHT_STEP = 25e-4;
|
|
303
|
+
var ON_DARK_START = 0.18;
|
|
304
|
+
var ON_DARK_STEP = 0.015;
|
|
305
|
+
var LINEAR_LUT = new Float32Array(256);
|
|
306
|
+
for (let i = 0; i < 256; i++) {
|
|
307
|
+
const v = i / 255;
|
|
308
|
+
LINEAR_LUT[i] = v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
|
|
309
|
+
}
|
|
310
|
+
function clamp(value, min, max) {
|
|
311
|
+
return Math.max(min, Math.min(max, value));
|
|
312
|
+
}
|
|
313
|
+
function smoothstep(edge0, edge1, value) {
|
|
314
|
+
const t = clamp((value - edge0) / (edge1 - edge0), 0, 1);
|
|
315
|
+
return t * t * (3 - 2 * t);
|
|
316
|
+
}
|
|
317
|
+
function srgbToOklab(r, g, b) {
|
|
318
|
+
const lr = LINEAR_LUT[r & 255];
|
|
319
|
+
const lg = LINEAR_LUT[g & 255];
|
|
320
|
+
const lb = LINEAR_LUT[b & 255];
|
|
321
|
+
const l = Math.cbrt(0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb);
|
|
322
|
+
const m = Math.cbrt(0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb);
|
|
323
|
+
const s = Math.cbrt(0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb);
|
|
324
|
+
return [0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s, 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s, 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s];
|
|
325
|
+
}
|
|
326
|
+
function oklchToLinearSrgb(l, c, h) {
|
|
327
|
+
const a = c * Math.cos(h * DEG);
|
|
328
|
+
const b = c * Math.sin(h * DEG);
|
|
329
|
+
const l_ = (l + 0.3963377774 * a + 0.2158037573 * b) ** 3;
|
|
330
|
+
const m_ = (l - 0.1055613458 * a - 0.0638541728 * b) ** 3;
|
|
331
|
+
const s_ = (l - 0.0894841775 * a - 1.291485548 * b) ** 3;
|
|
332
|
+
return [4.0767416621 * l_ - 3.3077115913 * m_ + 0.2309699292 * s_, -1.2684380046 * l_ + 2.6097574011 * m_ - 0.3413193965 * s_, -0.0041960863 * l_ - 0.7034186147 * m_ + 1.707614701 * s_];
|
|
333
|
+
}
|
|
334
|
+
function labToLch([l, a, b]) {
|
|
335
|
+
const c = Math.sqrt(a * a + b * b);
|
|
336
|
+
const h = c < ACHROMATIC_CHROMA ? 0 : (Math.atan2(b, a) / DEG + 360) % 360;
|
|
337
|
+
return {
|
|
338
|
+
c,
|
|
339
|
+
h,
|
|
340
|
+
l
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
var inGamut = (rgb) => rgb.every((v) => v >= -GAMUT_EPSILON && v <= 1 + GAMUT_EPSILON);
|
|
344
|
+
function maxChroma(l, h) {
|
|
345
|
+
if (l <= 0 || l >= 1) return 0;
|
|
346
|
+
let low = 0;
|
|
347
|
+
let high = CHROMA_SEARCH_LIMIT;
|
|
348
|
+
for (let step = 0; step < CHROMA_SEARCH_STEPS; step++) {
|
|
349
|
+
const middle = (low + high) / 2;
|
|
350
|
+
if (inGamut(oklchToLinearSrgb(l, middle, h))) low = middle;
|
|
351
|
+
else high = middle;
|
|
352
|
+
}
|
|
353
|
+
return low;
|
|
354
|
+
}
|
|
355
|
+
function hueDistance(a, b) {
|
|
356
|
+
const d = Math.abs(a - b) % 360;
|
|
357
|
+
return d > 180 ? 360 - d : d;
|
|
358
|
+
}
|
|
359
|
+
function luminance({
|
|
360
|
+
c,
|
|
361
|
+
h,
|
|
362
|
+
l
|
|
363
|
+
}) {
|
|
364
|
+
const [r, g, b] = oklchToLinearSrgb(l, c, h).map((v) => clamp(v, 0, 1));
|
|
365
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
366
|
+
}
|
|
367
|
+
function contrastRatio(a, b) {
|
|
368
|
+
const la = luminance(a);
|
|
369
|
+
const lb = luminance(b);
|
|
370
|
+
return (Math.max(la, lb) + 0.05) / (Math.min(la, lb) + 0.05);
|
|
371
|
+
}
|
|
372
|
+
var round = (value, digits) => {
|
|
373
|
+
const factor = 10 ** digits;
|
|
374
|
+
return Math.round(value * factor) / factor;
|
|
375
|
+
};
|
|
376
|
+
function formatOklch({
|
|
377
|
+
c,
|
|
378
|
+
h,
|
|
379
|
+
l
|
|
380
|
+
}) {
|
|
381
|
+
const chroma = c < DISPLAY_ACHROMATIC_CHROMA ? 0 : c;
|
|
382
|
+
return `oklch(${round(clamp(l, 0, 1), 3).toFixed(3)} ${round(chroma, 3).toFixed(3)} ${round(chroma === 0 ? 0 : h, 1).toFixed(1)})`;
|
|
383
|
+
}
|
|
384
|
+
function toneOf(h, l, rel, cap = DEFAULT_TONE_CHROMA_CAP) {
|
|
385
|
+
const room = maxChroma(l, h) * GAMUT_HEADROOM;
|
|
386
|
+
return {
|
|
387
|
+
c: Math.min(cap, clamp(rel, 0, 1) * room),
|
|
388
|
+
h,
|
|
389
|
+
l
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
function onColorFor(background, minContrast = DEFAULT_MIN_CONTRAST) {
|
|
393
|
+
const light = (l) => toneOf(background.h, l, 0.12, 0.012);
|
|
394
|
+
const dark = (l) => toneOf(background.h, l, 0.35, 0.03);
|
|
395
|
+
const towardLight = contrastRatio(light(ON_LIGHT_START), background);
|
|
396
|
+
const towardDark = contrastRatio(dark(ON_DARK_START), background);
|
|
397
|
+
const useLight = towardLight >= minContrast || towardLight >= towardDark;
|
|
398
|
+
for (let step = 0; step <= ON_COLOR_STEPS; step++) {
|
|
399
|
+
const candidate = useLight ? light(Math.min(1, ON_LIGHT_START + step * ON_LIGHT_STEP)) : dark(Math.max(0, ON_DARK_START - step * ON_DARK_STEP));
|
|
400
|
+
if (contrastRatio(candidate, background) >= minContrast) return candidate;
|
|
401
|
+
}
|
|
402
|
+
return useLight ? {
|
|
403
|
+
c: 0,
|
|
404
|
+
h: 0,
|
|
405
|
+
l: 1
|
|
406
|
+
} : {
|
|
407
|
+
c: 0,
|
|
408
|
+
h: 0,
|
|
409
|
+
l: 0
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// src/modules/ambient/analyze-bounds.ts
|
|
414
|
+
var ALPHA_THRESHOLD = 128;
|
|
415
|
+
var BAR_MEAN_LIGHTNESS = 0.12;
|
|
416
|
+
var BAR_MAX_LIGHTNESS = 0.2;
|
|
417
|
+
var MAX_BAR_SHARE = 0.22;
|
|
418
|
+
var lightnessAt = (data, index) => srgbToOklab(data[index], data[index + 1], data[index + 2])[0];
|
|
419
|
+
function findContentBounds({
|
|
420
|
+
data,
|
|
421
|
+
height,
|
|
422
|
+
width
|
|
423
|
+
}) {
|
|
424
|
+
const isBar = (count, at) => {
|
|
425
|
+
let sum = 0;
|
|
426
|
+
let max = 0;
|
|
427
|
+
let seen = 0;
|
|
428
|
+
for (let step = 0; step < count; step++) {
|
|
429
|
+
const index = at(step);
|
|
430
|
+
if (data[index + 3] < ALPHA_THRESHOLD) continue;
|
|
431
|
+
const l = lightnessAt(data, index);
|
|
432
|
+
sum += l;
|
|
433
|
+
if (l > max) max = l;
|
|
434
|
+
seen++;
|
|
435
|
+
}
|
|
436
|
+
return seen > 0 && sum / seen < BAR_MEAN_LIGHTNESS && max < BAR_MAX_LIGHTNESS;
|
|
437
|
+
};
|
|
438
|
+
const row = (y) => isBar(width, (x) => (y * width + x) * 4);
|
|
439
|
+
const maxRows = Math.floor(height * MAX_BAR_SHARE);
|
|
440
|
+
const maxColumns = Math.floor(width * MAX_BAR_SHARE);
|
|
441
|
+
let top = 0;
|
|
442
|
+
while (top < maxRows && row(top)) top++;
|
|
443
|
+
let bottom = height;
|
|
444
|
+
while (height - bottom < maxRows && bottom - 1 > top && row(bottom - 1)) bottom--;
|
|
445
|
+
const column = (x) => isBar(bottom - top, (step) => ((top + step) * width + x) * 4);
|
|
446
|
+
let left = 0;
|
|
447
|
+
while (left < maxColumns && column(left)) left++;
|
|
448
|
+
let right = width;
|
|
449
|
+
while (width - right < maxColumns && right - 1 > left && column(right - 1)) right--;
|
|
450
|
+
return {
|
|
451
|
+
bottom,
|
|
452
|
+
left,
|
|
453
|
+
right,
|
|
454
|
+
top
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// src/modules/ambient/analyze-measures.ts
|
|
459
|
+
var MIN_CHROMA = 0.022;
|
|
460
|
+
var MIN_PRESENCE = 0.03;
|
|
461
|
+
var MIN_POPULATION = 4e-3;
|
|
462
|
+
var REGION_BITS = {
|
|
463
|
+
top: 1,
|
|
464
|
+
bottom: 2,
|
|
465
|
+
left: 4,
|
|
466
|
+
right: 8,
|
|
467
|
+
center: 16
|
|
468
|
+
};
|
|
469
|
+
var reliability = (l) => smoothstep(0.1, 0.28, l) * (1 - smoothstep(0.9, 0.98, l));
|
|
470
|
+
var colorfulness = (c) => smoothstep(MIN_CHROMA, 0.06, c);
|
|
471
|
+
var isChromatic = (cluster) => cluster.c >= MIN_CHROMA && cluster.rely > 0;
|
|
472
|
+
function pickBest(items, score) {
|
|
473
|
+
let best = null;
|
|
474
|
+
let bestScore = 0;
|
|
475
|
+
for (const item of items) {
|
|
476
|
+
const value = score(item);
|
|
477
|
+
if (value > bestScore) {
|
|
478
|
+
bestScore = value;
|
|
479
|
+
best = item;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return best;
|
|
483
|
+
}
|
|
484
|
+
var round3 = (value) => Math.round(value * 1e3) / 1e3;
|
|
485
|
+
function skinLikeness({
|
|
486
|
+
c,
|
|
487
|
+
h,
|
|
488
|
+
l
|
|
489
|
+
}) {
|
|
490
|
+
return (1 - smoothstep(12, 26, hueDistance(h, 54))) * smoothstep(0.02, 0.035, c) * (1 - smoothstep(0.11, 0.15, c)) * smoothstep(0.26, 0.38, l) * (1 - smoothstep(0.88, 0.95, l));
|
|
491
|
+
}
|
|
492
|
+
var warmth = (h) => 1 - smoothstep(22, 50, hueDistance(h, 42));
|
|
493
|
+
var salience = (color) => 1 - 0.65 * skinLikeness(color);
|
|
494
|
+
|
|
495
|
+
// src/modules/ambient/quantize.ts
|
|
496
|
+
function seedCentroids(points, weights, centroids, k, distance) {
|
|
497
|
+
const n = weights.length;
|
|
498
|
+
let first = 0;
|
|
499
|
+
for (let i = 1; i < n; i++) if (weights[i] > weights[first]) first = i;
|
|
500
|
+
centroids.set(points.subarray(first * 3, first * 3 + 3), 0);
|
|
501
|
+
const nearest = new Float64Array(n).fill(Infinity);
|
|
502
|
+
let found = 1;
|
|
503
|
+
for (; found < k; found++) {
|
|
504
|
+
let best = -1;
|
|
505
|
+
let bestScore = 0;
|
|
506
|
+
for (let i = 0; i < n; i++) {
|
|
507
|
+
const d = distance(i, found - 1);
|
|
508
|
+
if (d < nearest[i]) nearest[i] = d;
|
|
509
|
+
const score = weights[i] * nearest[i];
|
|
510
|
+
if (score > bestScore) {
|
|
511
|
+
bestScore = score;
|
|
512
|
+
best = i;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
if (best < 0) break;
|
|
516
|
+
centroids.set(points.subarray(best * 3, best * 3 + 3), found * 3);
|
|
517
|
+
}
|
|
518
|
+
return found;
|
|
519
|
+
}
|
|
520
|
+
function assignPoints(assignment, found, distance, moved) {
|
|
521
|
+
for (let i = 0; i < assignment.length; i++) {
|
|
522
|
+
let best = 0;
|
|
523
|
+
let bestDistance = Infinity;
|
|
524
|
+
for (let j = 0; j < found; j++) {
|
|
525
|
+
const d = distance(i, j);
|
|
526
|
+
if (d < bestDistance) {
|
|
527
|
+
bestDistance = d;
|
|
528
|
+
best = j;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
if (assignment[i] !== best) {
|
|
532
|
+
assignment[i] = best;
|
|
533
|
+
moved = true;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
return moved;
|
|
537
|
+
}
|
|
538
|
+
function updateCentroids(points, weights, assignment, centroids, sums, found) {
|
|
539
|
+
sums.fill(0);
|
|
540
|
+
for (let i = 0; i < weights.length; i++) {
|
|
541
|
+
const j = assignment[i] * 4;
|
|
542
|
+
const w = weights[i];
|
|
543
|
+
sums[j] += points[i * 3] * w;
|
|
544
|
+
sums[j + 1] += points[i * 3 + 1] * w;
|
|
545
|
+
sums[j + 2] += points[i * 3 + 2] * w;
|
|
546
|
+
sums[j + 3] += w;
|
|
547
|
+
}
|
|
548
|
+
for (let j = 0; j < found; j++) {
|
|
549
|
+
const w = sums[j * 4 + 3];
|
|
550
|
+
if (w <= 0) continue;
|
|
551
|
+
centroids[j * 3] = sums[j * 4] / w;
|
|
552
|
+
centroids[j * 3 + 1] = sums[j * 4 + 1] / w;
|
|
553
|
+
centroids[j * 3 + 2] = sums[j * 4 + 2] / w;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
function kmeans(points, weights, requested, {
|
|
557
|
+
iterations = 16,
|
|
558
|
+
lightnessWeight = 0.45
|
|
559
|
+
} = {}) {
|
|
560
|
+
const n = weights.length;
|
|
561
|
+
const assignment = new Int32Array(n);
|
|
562
|
+
const k = Math.max(0, Math.min(requested, n));
|
|
563
|
+
const centroids = new Float64Array(k * 3);
|
|
564
|
+
if (k === 0) return {
|
|
565
|
+
assignment,
|
|
566
|
+
centroids,
|
|
567
|
+
k
|
|
568
|
+
};
|
|
569
|
+
const distance = (i, j) => {
|
|
570
|
+
const dl = points[i * 3] - centroids[j * 3];
|
|
571
|
+
const da = points[i * 3 + 1] - centroids[j * 3 + 1];
|
|
572
|
+
const db = points[i * 3 + 2] - centroids[j * 3 + 2];
|
|
573
|
+
return lightnessWeight * dl * dl + da * da + db * db;
|
|
574
|
+
};
|
|
575
|
+
const found = seedCentroids(points, weights, centroids, k, distance);
|
|
576
|
+
const sums = new Float64Array(found * 4);
|
|
577
|
+
for (let round2 = 0; round2 < iterations; round2++) {
|
|
578
|
+
const moved = assignPoints(assignment, found, distance, round2 === 0);
|
|
579
|
+
if (!moved) break;
|
|
580
|
+
updateCentroids(points, weights, assignment, centroids, sums, found);
|
|
581
|
+
}
|
|
582
|
+
return {
|
|
583
|
+
assignment,
|
|
584
|
+
centroids: centroids.slice(0, found * 3),
|
|
585
|
+
k: found
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// src/modules/ambient/analyze-clusters.ts
|
|
590
|
+
var COLOR_KEY_SPACE = 32768;
|
|
591
|
+
var BIN_STRIDE = 4;
|
|
592
|
+
var ALPHA_THRESHOLD2 = 128;
|
|
593
|
+
var CENTER_SIGMA = 0.35;
|
|
594
|
+
var MIN_COLOURED_LIGHTNESS = 0.06;
|
|
595
|
+
var MIN_CLUSTERS = 2;
|
|
596
|
+
var MAX_CLUSTERS = 16;
|
|
597
|
+
var MANY_CLUSTERS = 8;
|
|
598
|
+
var GREY_CLUSTERS_FEW = 2;
|
|
599
|
+
var GREY_CLUSTERS_MANY = 3;
|
|
600
|
+
var CHROMA_WEIGHT_GAIN = 5;
|
|
601
|
+
var CENTER_REGION_HALF = 0.25;
|
|
602
|
+
var LOW_EDGE = 1 / 3;
|
|
603
|
+
var HIGH_EDGE = 2 / 3;
|
|
604
|
+
function regionBitsAt(u, v) {
|
|
605
|
+
return (v < LOW_EDGE ? REGION_BITS.top : 0) | (v > HIGH_EDGE ? REGION_BITS.bottom : 0) | (u < LOW_EDGE ? REGION_BITS.left : 0) | (u > HIGH_EDGE ? REGION_BITS.right : 0) | (Math.abs(u - 0.5) < CENTER_REGION_HALF && Math.abs(v - 0.5) < CENTER_REGION_HALF ? REGION_BITS.center : 0);
|
|
606
|
+
}
|
|
607
|
+
function accumulateBins({
|
|
608
|
+
data,
|
|
609
|
+
width
|
|
610
|
+
}, bounds, centerWeight) {
|
|
611
|
+
const boxWidth = Math.max(1, bounds.right - bounds.left);
|
|
612
|
+
const boxHeight = Math.max(1, bounds.bottom - bounds.top);
|
|
613
|
+
const binOf = new Int32Array(COLOR_KEY_SPACE).fill(-1);
|
|
614
|
+
const binSums = [];
|
|
615
|
+
const pixelBins = new Int32Array(boxWidth * boxHeight).fill(-1);
|
|
616
|
+
const pixelRegions = new Uint8Array(boxWidth * boxHeight);
|
|
617
|
+
const sigma2 = 2 * CENTER_SIGMA * CENTER_SIGMA;
|
|
618
|
+
let total = 0;
|
|
619
|
+
let sumL = 0;
|
|
620
|
+
for (let y = bounds.top; y < bounds.bottom; y++) {
|
|
621
|
+
const v = (y - bounds.top + 0.5) / boxHeight;
|
|
622
|
+
for (let x = bounds.left; x < bounds.right; x++) {
|
|
623
|
+
const index = (y * width + x) * 4;
|
|
624
|
+
if (data[index + 3] < ALPHA_THRESHOLD2) continue;
|
|
625
|
+
const r = data[index];
|
|
626
|
+
const g = data[index + 1];
|
|
627
|
+
const b = data[index + 2];
|
|
628
|
+
const [l, a, bb] = srgbToOklab(r, g, b);
|
|
629
|
+
const u = (x - bounds.left + 0.5) / boxWidth;
|
|
630
|
+
const du = (u - 0.5) * 2;
|
|
631
|
+
const dv = (v - 0.5) * 2;
|
|
632
|
+
const weight = 1 - centerWeight + 2 * centerWeight * Math.exp(-(du * du + dv * dv) / sigma2);
|
|
633
|
+
const key = r >> 3 << 10 | g >> 3 << 5 | b >> 3;
|
|
634
|
+
let bin = binOf[key];
|
|
635
|
+
if (bin < 0) {
|
|
636
|
+
bin = binSums.length / BIN_STRIDE;
|
|
637
|
+
binOf[key] = bin;
|
|
638
|
+
binSums.push(0, 0, 0, 0);
|
|
639
|
+
}
|
|
640
|
+
binSums[bin * BIN_STRIDE] += l * weight;
|
|
641
|
+
binSums[bin * BIN_STRIDE + 1] += a * weight;
|
|
642
|
+
binSums[bin * BIN_STRIDE + 2] += bb * weight;
|
|
643
|
+
binSums[bin * BIN_STRIDE + 3] += weight;
|
|
644
|
+
total += weight;
|
|
645
|
+
sumL += l * weight;
|
|
646
|
+
const local = (y - bounds.top) * boxWidth + (x - bounds.left);
|
|
647
|
+
pixelBins[local] = bin;
|
|
648
|
+
pixelRegions[local] = regionBitsAt(u, v);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
return {
|
|
652
|
+
binSums,
|
|
653
|
+
boxHeight,
|
|
654
|
+
boxWidth,
|
|
655
|
+
pixelBins,
|
|
656
|
+
pixelRegions,
|
|
657
|
+
sumL,
|
|
658
|
+
total
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
function splitByColour(binSums) {
|
|
662
|
+
const groups = [[], []];
|
|
663
|
+
const bins = binSums.length / BIN_STRIDE;
|
|
664
|
+
for (let i = 0; i < bins; i++) {
|
|
665
|
+
const w = binSums[i * BIN_STRIDE + 3];
|
|
666
|
+
const a = binSums[i * BIN_STRIDE + 1] / w;
|
|
667
|
+
const b = binSums[i * BIN_STRIDE + 2] / w;
|
|
668
|
+
const coloured = Math.sqrt(a * a + b * b) >= MIN_CHROMA && binSums[i * BIN_STRIDE] / w >= MIN_COLOURED_LIGHTNESS;
|
|
669
|
+
groups[coloured ? 0 : 1].push(i);
|
|
670
|
+
}
|
|
671
|
+
return groups;
|
|
672
|
+
}
|
|
673
|
+
function allocateBudgets(groups, requestedClusters) {
|
|
674
|
+
const requested = clamp(Math.round(requestedClusters), MIN_CLUSTERS, MAX_CLUSTERS);
|
|
675
|
+
let greyClusters;
|
|
676
|
+
if (groups[0].length === 0) greyClusters = requested;
|
|
677
|
+
else if (groups[1].length === 0) greyClusters = 0;
|
|
678
|
+
else if (requested >= MANY_CLUSTERS) greyClusters = GREY_CLUSTERS_MANY;
|
|
679
|
+
else greyClusters = GREY_CLUSTERS_FEW;
|
|
680
|
+
return [requested - greyClusters, greyClusters];
|
|
681
|
+
}
|
|
682
|
+
function clusterBins(groups, budgets, {
|
|
683
|
+
binSums,
|
|
684
|
+
total
|
|
685
|
+
}, clusters) {
|
|
686
|
+
const clusterOfBin = new Int32Array(binSums.length / BIN_STRIDE).fill(-1);
|
|
687
|
+
groups.forEach((members, group) => {
|
|
688
|
+
if (members.length === 0 || budgets[group] <= 0) return;
|
|
689
|
+
const points = new Float64Array(members.length * 3);
|
|
690
|
+
const weights = new Float64Array(members.length);
|
|
691
|
+
members.forEach((bin, i) => {
|
|
692
|
+
const w = binSums[bin * BIN_STRIDE + 3];
|
|
693
|
+
const a = binSums[bin * BIN_STRIDE + 1] / w;
|
|
694
|
+
const b = binSums[bin * BIN_STRIDE + 2] / w;
|
|
695
|
+
points[i * 3] = binSums[bin * BIN_STRIDE] / w;
|
|
696
|
+
points[i * 3 + 1] = a;
|
|
697
|
+
points[i * 3 + 2] = b;
|
|
698
|
+
weights[i] = w * (1 + CHROMA_WEIGHT_GAIN * Math.sqrt(a * a + b * b));
|
|
699
|
+
});
|
|
700
|
+
const {
|
|
701
|
+
assignment,
|
|
702
|
+
k
|
|
703
|
+
} = kmeans(points, weights, budgets[group]);
|
|
704
|
+
const sums = new Float64Array(k * BIN_STRIDE);
|
|
705
|
+
members.forEach((bin, i) => {
|
|
706
|
+
for (let channel = 0; channel < BIN_STRIDE; channel++) {
|
|
707
|
+
sums[assignment[i] * BIN_STRIDE + channel] += binSums[bin * BIN_STRIDE + channel];
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
const index = new Int32Array(k).fill(-1);
|
|
711
|
+
for (let j = 0; j < k; j++) {
|
|
712
|
+
const pop = sums[j * BIN_STRIDE + 3];
|
|
713
|
+
if (pop <= 0) continue;
|
|
714
|
+
const lch = labToLch([sums[j * BIN_STRIDE] / pop, sums[j * BIN_STRIDE + 1] / pop, sums[j * BIN_STRIDE + 2] / pop]);
|
|
715
|
+
const room = maxChroma(lch.l, lch.h);
|
|
716
|
+
index[j] = clusters.length;
|
|
717
|
+
clusters.push({
|
|
718
|
+
...lch,
|
|
719
|
+
pop: pop / total,
|
|
720
|
+
rel: room > 0 ? clamp(lch.c / room, 0, 1) : 0,
|
|
721
|
+
rely: reliability(lch.l)
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
members.forEach((bin, i) => clusterOfBin[bin] = index[assignment[i]]);
|
|
725
|
+
});
|
|
726
|
+
return clusterOfBin;
|
|
727
|
+
}
|
|
728
|
+
function accumulateRegions(clusterCount, clusterOfBin, {
|
|
729
|
+
binSums,
|
|
730
|
+
pixelBins,
|
|
731
|
+
pixelRegions
|
|
732
|
+
}) {
|
|
733
|
+
const regionWeights = AMBIENT_REGIONS.map(() => new Float64Array(clusterCount));
|
|
734
|
+
const regionLab = AMBIENT_REGIONS.map(() => new Float64Array(clusterCount * 3));
|
|
735
|
+
for (let i = 0; i < pixelBins.length; i++) {
|
|
736
|
+
const bin = pixelBins[i];
|
|
737
|
+
if (bin < 0) continue;
|
|
738
|
+
const cluster = clusterOfBin[bin];
|
|
739
|
+
const bits = pixelRegions[i];
|
|
740
|
+
const w = binSums[bin * BIN_STRIDE + 3];
|
|
741
|
+
AMBIENT_REGIONS.forEach((region, r) => {
|
|
742
|
+
if (!(bits & REGION_BITS[region])) return;
|
|
743
|
+
regionWeights[r][cluster] += 1;
|
|
744
|
+
for (let channel = 0; channel < 3; channel++) {
|
|
745
|
+
regionLab[r][cluster * 3 + channel] += binSums[bin * BIN_STRIDE + channel] / w;
|
|
746
|
+
}
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
return {
|
|
750
|
+
regionLab,
|
|
751
|
+
regionWeights
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
function clusterAmbientPixels(pixels, options) {
|
|
755
|
+
const {
|
|
756
|
+
height,
|
|
757
|
+
width
|
|
758
|
+
} = pixels;
|
|
759
|
+
const bounds = options.letterbox ? findContentBounds(pixels) : {
|
|
760
|
+
bottom: height,
|
|
761
|
+
left: 0,
|
|
762
|
+
right: width,
|
|
763
|
+
top: 0
|
|
764
|
+
};
|
|
765
|
+
const accumulation = accumulateBins(pixels, bounds, options.centerWeight);
|
|
766
|
+
const {
|
|
767
|
+
binSums,
|
|
768
|
+
sumL,
|
|
769
|
+
total
|
|
770
|
+
} = accumulation;
|
|
771
|
+
const meanL = total > 0 ? sumL / total : 0.5;
|
|
772
|
+
const groups = splitByColour(binSums);
|
|
773
|
+
const budgets = allocateBudgets(groups, options.clusters);
|
|
774
|
+
const clusters = [];
|
|
775
|
+
const clusterOfBin = clusterBins(groups, budgets, accumulation, clusters);
|
|
776
|
+
const regions = accumulateRegions(clusters.length, clusterOfBin, accumulation);
|
|
777
|
+
return {
|
|
778
|
+
clusters,
|
|
779
|
+
meanL,
|
|
780
|
+
...regions
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
// src/modules/ambient/analyze-swatches.ts
|
|
785
|
+
var roleChroma = (source, {
|
|
786
|
+
cap,
|
|
787
|
+
gain
|
|
788
|
+
}) => Math.min(cap * (1 - 0.3 * warmth(source.h)), Math.max(source.c * gain, Math.min(0.05, source.c * 1.6)) * (1 - 0.3 * skinLikeness(source)));
|
|
789
|
+
var fitTone = (h, l, c) => ({
|
|
790
|
+
c: Math.max(0, Math.min(c, maxChroma(l, h) * GAMUT_HEADROOM)),
|
|
791
|
+
h,
|
|
792
|
+
l
|
|
793
|
+
});
|
|
794
|
+
function buildSwatch(tone, population, fromImage, minContrast) {
|
|
795
|
+
const room = maxChroma(tone.l, tone.h) * GAMUT_HEADROOM;
|
|
796
|
+
const rel = room > 0 ? tone.c / room : 0;
|
|
797
|
+
const ramp = {};
|
|
798
|
+
for (const step of AMBIENT_TONES) {
|
|
799
|
+
ramp[step] = formatOklch(toneOf(tone.h, step / 100, rel, Math.max(tone.c, 0.04)));
|
|
800
|
+
}
|
|
801
|
+
return {
|
|
802
|
+
c: round3(tone.c),
|
|
803
|
+
color: formatOklch(tone),
|
|
804
|
+
fromImage,
|
|
805
|
+
h: Math.round(tone.h * 10) / 10,
|
|
806
|
+
l: round3(tone.l),
|
|
807
|
+
on: formatOklch(onColorFor(tone, minContrast)),
|
|
808
|
+
population: round3(population),
|
|
809
|
+
ramp
|
|
810
|
+
};
|
|
811
|
+
}
|
|
812
|
+
function roleTone(source, spec, fallback, dilution = 1) {
|
|
813
|
+
if (!source) return fitTone(fallback.h, clamp(fallback.l, spec.min, spec.max), fallback.c);
|
|
814
|
+
return fitTone(source.h, clamp(source.l, spec.min, spec.max), roleChroma(source, spec) * dilution);
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
// src/modules/ambient/analyze.ts
|
|
818
|
+
var AMBIENT_ANALYSIS_VERSION = 2;
|
|
819
|
+
var FAMILY_HUE_RANGE = 20;
|
|
820
|
+
var MUTED_MAX_CHROMA = 0.09;
|
|
821
|
+
var MUTED_CHROMA_SPAN = 0.12;
|
|
822
|
+
var NEUTRAL_ACCENT_MIN_SHARE = 6e-3;
|
|
823
|
+
var NEUTRAL_ACCENT_MIN_CHROMA = 0.06;
|
|
824
|
+
var ACCENT_MIN_CHROMA = 0.035;
|
|
825
|
+
var FULL_DILUTION_PRESENCE = 0.25;
|
|
826
|
+
var MIN_DILUTION = 0.55;
|
|
827
|
+
var DILUTION_RANGE = 0.45;
|
|
828
|
+
var GREY_LIGHTNESS_RANGE = [0.3, 0.8];
|
|
829
|
+
var DOMINANT_SPEC = {
|
|
830
|
+
cap: 0.2,
|
|
831
|
+
gain: 1.15,
|
|
832
|
+
max: 0.74,
|
|
833
|
+
min: 0.42
|
|
834
|
+
};
|
|
835
|
+
var VIBRANT_SPEC = {
|
|
836
|
+
cap: 0.22,
|
|
837
|
+
gain: 1.35,
|
|
838
|
+
max: 0.84,
|
|
839
|
+
min: 0.62
|
|
840
|
+
};
|
|
841
|
+
var MUTED_SPEC = {
|
|
842
|
+
cap: 0.07,
|
|
843
|
+
gain: 1,
|
|
844
|
+
max: 0.66,
|
|
845
|
+
min: 0.38
|
|
846
|
+
};
|
|
847
|
+
var ACCENT_SPEC = {
|
|
848
|
+
cap: 0.22,
|
|
849
|
+
gain: 1.3,
|
|
850
|
+
max: 0.8,
|
|
851
|
+
min: 0.55
|
|
852
|
+
};
|
|
853
|
+
var REGION_SPEC = {
|
|
854
|
+
cap: 0.18,
|
|
855
|
+
gain: 1.15
|
|
856
|
+
};
|
|
857
|
+
var REGION_LIGHTNESS_RANGE = [0.42, 0.72];
|
|
858
|
+
var REGION_FALLBACK_LIGHTNESS_RANGE = [0.3, 0.7];
|
|
859
|
+
var SHADOW_MAX_SOURCE_LIGHTNESS = 0.5;
|
|
860
|
+
var SHADOW_MIN_SOURCE_CHROMA = 0.02;
|
|
861
|
+
var SHADOW_MIN_SOURCE_POPULATION = 0.02;
|
|
862
|
+
var SHADOW_LIGHTNESS_DRIFT = 0.02;
|
|
863
|
+
var SHADOW_MEAN_LIGHTNESS_PIVOT = 0.45;
|
|
864
|
+
var SHADOW_MEAN_LIGHTNESS_GAIN = 0.06;
|
|
865
|
+
var SHADOW_CHROMA_CAP = 0.1;
|
|
866
|
+
function createFamilyShare(chromatic) {
|
|
867
|
+
const family = /* @__PURE__ */ new Map();
|
|
868
|
+
for (const cluster of chromatic) {
|
|
869
|
+
let share = 0;
|
|
870
|
+
for (const other of chromatic) {
|
|
871
|
+
if (hueDistance(cluster.h, other.h) <= FAMILY_HUE_RANGE) {
|
|
872
|
+
share += other.pop;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
family.set(cluster, share);
|
|
876
|
+
}
|
|
877
|
+
return (cluster) => family.get(cluster) ?? cluster.pop;
|
|
878
|
+
}
|
|
879
|
+
function pickRoleClusters(chromatic, share, neutral, minHueDistance) {
|
|
880
|
+
const dominant = neutral ? null : pickBest(chromatic, (cluster) => share(cluster) * cluster.c * cluster.rely * salience(cluster));
|
|
881
|
+
const vivid = neutral ? null : pickBest(chromatic.filter((cluster) => share(cluster) >= MIN_POPULATION), (cluster) => cluster.c * cluster.c * Math.pow(share(cluster), 0.3) * cluster.rely * salience(cluster));
|
|
882
|
+
const isAccentCandidate = (cluster) => {
|
|
883
|
+
if (neutral) {
|
|
884
|
+
return share(cluster) >= NEUTRAL_ACCENT_MIN_SHARE && cluster.c >= NEUTRAL_ACCENT_MIN_CHROMA;
|
|
885
|
+
}
|
|
886
|
+
return share(cluster) >= MIN_POPULATION && cluster.c >= ACCENT_MIN_CHROMA && (!dominant || hueDistance(cluster.h, dominant.h) >= minHueDistance);
|
|
887
|
+
};
|
|
888
|
+
const accent = pickBest(chromatic.filter(isAccentCandidate), (cluster) => Math.pow(share(cluster), 0.6) * cluster.c * cluster.rely * salience(cluster));
|
|
889
|
+
const muted = neutral ? null : pickBest(chromatic.filter((cluster) => cluster.c <= MUTED_MAX_CHROMA), (cluster) => share(cluster) * cluster.rely * (1 - cluster.c / MUTED_CHROMA_SPAN));
|
|
890
|
+
return {
|
|
891
|
+
accent,
|
|
892
|
+
dominant,
|
|
893
|
+
muted,
|
|
894
|
+
vivid
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
function buildRoles(picks, {
|
|
898
|
+
dilution,
|
|
899
|
+
meanL,
|
|
900
|
+
minContrast,
|
|
901
|
+
neutral,
|
|
902
|
+
share
|
|
903
|
+
}) {
|
|
904
|
+
const {
|
|
905
|
+
accent,
|
|
906
|
+
dominant,
|
|
907
|
+
muted,
|
|
908
|
+
vivid
|
|
909
|
+
} = picks;
|
|
910
|
+
const grey = {
|
|
911
|
+
c: 0,
|
|
912
|
+
h: 0,
|
|
913
|
+
l: clamp(meanL, GREY_LIGHTNESS_RANGE[0], GREY_LIGHTNESS_RANGE[1])
|
|
914
|
+
};
|
|
915
|
+
const dominantHue = dominant?.h ?? vivid?.h ?? 0;
|
|
916
|
+
const accentSource = accent ?? vivid;
|
|
917
|
+
return {
|
|
918
|
+
dominant: buildSwatch(roleTone(dominant, DOMINANT_SPEC, grey), dominant ? share(dominant) : 0, true, minContrast),
|
|
919
|
+
vibrant: buildSwatch(roleTone(vivid, VIBRANT_SPEC, {
|
|
920
|
+
c: 0,
|
|
921
|
+
h: dominantHue,
|
|
922
|
+
l: 0.78
|
|
923
|
+
}, dilution), vivid ? share(vivid) : 0, true, minContrast),
|
|
924
|
+
muted: buildSwatch(roleTone(muted, MUTED_SPEC, {
|
|
925
|
+
c: dominant ? 0.035 : 0,
|
|
926
|
+
h: dominantHue,
|
|
927
|
+
l: clamp(meanL, 0.38, 0.66)
|
|
928
|
+
}), muted ? share(muted) : 0, Boolean(muted) || neutral, minContrast),
|
|
929
|
+
accent: buildSwatch(roleTone(accentSource, ACCENT_SPEC, {
|
|
930
|
+
c: 0,
|
|
931
|
+
h: dominantHue,
|
|
932
|
+
l: 0.72
|
|
933
|
+
}, dilution), accentSource ? share(accentSource) : 0, Boolean(accent), minContrast)
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
function buildShadow(dominant, {
|
|
937
|
+
clusters,
|
|
938
|
+
meanL,
|
|
939
|
+
neutral
|
|
940
|
+
}, baseLightness) {
|
|
941
|
+
const shadowPick = neutral ? null : pickBest(clusters.filter((cluster) => cluster.l <= SHADOW_MAX_SOURCE_LIGHTNESS && cluster.c >= SHADOW_MIN_SOURCE_CHROMA && cluster.pop >= SHADOW_MIN_SOURCE_POPULATION), (cluster) => cluster.pop * cluster.rel * smoothstep(0.05, 0.14, cluster.l));
|
|
942
|
+
const deepSource = shadowPick ?? dominant;
|
|
943
|
+
const lightness = clamp(baseLightness + (meanL - SHADOW_MEAN_LIGHTNESS_PIVOT) * SHADOW_MEAN_LIGHTNESS_GAIN, baseLightness - SHADOW_LIGHTNESS_DRIFT, baseLightness + SHADOW_LIGHTNESS_DRIFT);
|
|
944
|
+
if (!deepSource) return {
|
|
945
|
+
c: 0,
|
|
946
|
+
h: 0,
|
|
947
|
+
l: lightness
|
|
948
|
+
};
|
|
949
|
+
return toneOf(deepSource.h, lightness, clamp(0.3 + 0.7 * deepSource.rel, 0, 0.85), SHADOW_CHROMA_CAP);
|
|
950
|
+
}
|
|
951
|
+
function pickRegionColor(clusters, weights, lab, regionTotal) {
|
|
952
|
+
let strength = 0;
|
|
953
|
+
let pick = null;
|
|
954
|
+
let pickScore = 0;
|
|
955
|
+
for (let j = 0; j < clusters.length; j++) {
|
|
956
|
+
const count = weights[j];
|
|
957
|
+
if (count <= 0) continue;
|
|
958
|
+
const local = labToLch([lab[j * 3] / count, lab[j * 3 + 1] / count, lab[j * 3 + 2] / count]);
|
|
959
|
+
const rely = reliability(local.l);
|
|
960
|
+
if (local.c < MIN_CHROMA || rely <= 0) continue;
|
|
961
|
+
const part = count / regionTotal;
|
|
962
|
+
strength += part * colorfulness(local.c) * rely;
|
|
963
|
+
const score = part * local.c * rely * salience(local);
|
|
964
|
+
if (score > pickScore) {
|
|
965
|
+
pickScore = score;
|
|
966
|
+
pick = local;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
return {
|
|
970
|
+
pick,
|
|
971
|
+
strength
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
function buildRegion(weights, lab, {
|
|
975
|
+
clusters,
|
|
976
|
+
meanL,
|
|
977
|
+
neutral
|
|
978
|
+
}) {
|
|
979
|
+
let regionTotal = 0;
|
|
980
|
+
let regionL = 0;
|
|
981
|
+
clusters.forEach((cluster, j) => {
|
|
982
|
+
regionTotal += weights[j];
|
|
983
|
+
regionL += cluster.l * weights[j];
|
|
984
|
+
});
|
|
985
|
+
const {
|
|
986
|
+
pick,
|
|
987
|
+
strength
|
|
988
|
+
} = pickRegionColor(clusters, weights, lab, regionTotal);
|
|
989
|
+
const chosen = neutral || strength < MIN_PRESENCE ? null : pick;
|
|
990
|
+
const tone = chosen ? fitTone(chosen.h, clamp(chosen.l, REGION_LIGHTNESS_RANGE[0], REGION_LIGHTNESS_RANGE[1]), roleChroma(chosen, REGION_SPEC)) : {
|
|
991
|
+
c: 0,
|
|
992
|
+
h: 0,
|
|
993
|
+
l: clamp(regionTotal > 0 ? regionL / regionTotal : meanL, REGION_FALLBACK_LIGHTNESS_RANGE[0], REGION_FALLBACK_LIGHTNESS_RANGE[1])
|
|
994
|
+
};
|
|
995
|
+
return {
|
|
996
|
+
c: round3(tone.c),
|
|
997
|
+
color: formatOklch(tone),
|
|
998
|
+
h: Math.round(tone.h * 10) / 10,
|
|
999
|
+
l: round3(tone.l),
|
|
1000
|
+
strength: round3(chosen ? clamp(strength, 0, 1) : 0)
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
function buildRegions(context, regionWeights, regionLab) {
|
|
1004
|
+
const regions = {};
|
|
1005
|
+
AMBIENT_REGIONS.forEach((region, r) => {
|
|
1006
|
+
regions[region] = buildRegion(regionWeights[r], regionLab[r], context);
|
|
1007
|
+
});
|
|
1008
|
+
return regions;
|
|
1009
|
+
}
|
|
1010
|
+
function analyzeAmbientPixels(pixels, overrides = {}) {
|
|
1011
|
+
const options = {
|
|
1012
|
+
...DEFAULT_ANALYSIS,
|
|
1013
|
+
...overrides
|
|
1014
|
+
};
|
|
1015
|
+
const {
|
|
1016
|
+
clusters,
|
|
1017
|
+
meanL,
|
|
1018
|
+
regionLab,
|
|
1019
|
+
regionWeights
|
|
1020
|
+
} = clusterAmbientPixels(pixels, options);
|
|
1021
|
+
const chromatic = clusters.filter(isChromatic);
|
|
1022
|
+
const presence = chromatic.reduce((sum, cluster) => sum + cluster.pop * colorfulness(cluster.c) * cluster.rely, 0);
|
|
1023
|
+
const context = {
|
|
1024
|
+
clusters,
|
|
1025
|
+
dilution: MIN_DILUTION + DILUTION_RANGE * Math.min(1, presence / FULL_DILUTION_PRESENCE),
|
|
1026
|
+
meanL,
|
|
1027
|
+
minContrast: options.minContrast,
|
|
1028
|
+
neutral: presence < MIN_PRESENCE,
|
|
1029
|
+
share: createFamilyShare(chromatic)
|
|
1030
|
+
};
|
|
1031
|
+
const picks = pickRoleClusters(chromatic, context.share, context.neutral, options.minHueDistance);
|
|
1032
|
+
return {
|
|
1033
|
+
neutral: context.neutral,
|
|
1034
|
+
regions: buildRegions(context, regionWeights, regionLab),
|
|
1035
|
+
roles: buildRoles(picks, context),
|
|
1036
|
+
shadow: formatOklch(buildShadow(picks.dominant, context, options.shadowLightness))
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
1039
|
+
function fitSample(width, height, size) {
|
|
1040
|
+
const scale = Math.min(1, size / Math.max(width, height, 1));
|
|
1041
|
+
return {
|
|
1042
|
+
height: Math.max(1, Math.round(height * scale)),
|
|
1043
|
+
width: Math.max(1, Math.round(width * scale))
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
// src/modules/ambient/pipeline.ts
|
|
1048
|
+
async function fetchImageBlob(src, proxyUrl) {
|
|
1049
|
+
if (typeof fetch !== "function") return null;
|
|
1050
|
+
const read = async (url, init) => {
|
|
1051
|
+
const response = await fetch(url, {
|
|
1052
|
+
...init,
|
|
1053
|
+
mode: "cors"
|
|
1054
|
+
});
|
|
1055
|
+
if (!response.ok) return null;
|
|
1056
|
+
const blob = await response.blob();
|
|
1057
|
+
return blob.type.startsWith("text/") ? null : blob;
|
|
1058
|
+
};
|
|
1059
|
+
try {
|
|
1060
|
+
const blob = await read(src);
|
|
1061
|
+
if (blob) return blob;
|
|
1062
|
+
} catch {
|
|
1063
|
+
if (isCrossOrigin(src)) {
|
|
1064
|
+
try {
|
|
1065
|
+
const blob = await read(src, {
|
|
1066
|
+
cache: "reload"
|
|
1067
|
+
});
|
|
1068
|
+
if (blob) return blob;
|
|
1069
|
+
} catch {
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
if (proxyUrl) {
|
|
1074
|
+
try {
|
|
1075
|
+
return await read(proxyUrl);
|
|
1076
|
+
} catch {
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
return null;
|
|
1080
|
+
}
|
|
1081
|
+
function isCrossOrigin(url) {
|
|
1082
|
+
try {
|
|
1083
|
+
return new URL(url).origin !== globalThis.location?.origin;
|
|
1084
|
+
} catch {
|
|
1085
|
+
return false;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
function createContext2D(width, height) {
|
|
1089
|
+
if (typeof OffscreenCanvas === "function") {
|
|
1090
|
+
return new OffscreenCanvas(width, height).getContext("2d", {
|
|
1091
|
+
willReadFrequently: true
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
if (typeof document !== "undefined") {
|
|
1095
|
+
const canvas = document.createElement("canvas");
|
|
1096
|
+
canvas.width = width;
|
|
1097
|
+
canvas.height = height;
|
|
1098
|
+
return canvas.getContext("2d", {
|
|
1099
|
+
willReadFrequently: true
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
return null;
|
|
1103
|
+
}
|
|
1104
|
+
function readPixels(image, sourceWidth, sourceHeight, size) {
|
|
1105
|
+
const {
|
|
1106
|
+
height,
|
|
1107
|
+
width
|
|
1108
|
+
} = fitSample(sourceWidth, sourceHeight, size);
|
|
1109
|
+
const context = createContext2D(width, height);
|
|
1110
|
+
if (!context) return null;
|
|
1111
|
+
context.drawImage(image, 0, 0, width, height);
|
|
1112
|
+
return {
|
|
1113
|
+
data: context.getImageData(0, 0, width, height).data,
|
|
1114
|
+
height,
|
|
1115
|
+
width
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
async function decodeBlob(blob, size) {
|
|
1119
|
+
if (typeof createImageBitmap !== "function") return null;
|
|
1120
|
+
let bitmap;
|
|
1121
|
+
try {
|
|
1122
|
+
bitmap = await createImageBitmap(blob, {
|
|
1123
|
+
resizeQuality: "medium",
|
|
1124
|
+
resizeWidth: size
|
|
1125
|
+
});
|
|
1126
|
+
} catch {
|
|
1127
|
+
bitmap = await createImageBitmap(blob);
|
|
1128
|
+
}
|
|
1129
|
+
try {
|
|
1130
|
+
return readPixels(bitmap, bitmap.width, bitmap.height, size);
|
|
1131
|
+
} finally {
|
|
1132
|
+
bitmap.close();
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
var canDecodeHere = () => typeof createImageBitmap === "function" && (typeof OffscreenCanvas === "function" || typeof document !== "undefined");
|
|
1136
|
+
async function extractHere(request) {
|
|
1137
|
+
if (!canDecodeHere()) return {
|
|
1138
|
+
supported: false
|
|
1139
|
+
};
|
|
1140
|
+
const blob = await fetchImageBlob(request.src, request.proxyUrl);
|
|
1141
|
+
if (!blob) return {
|
|
1142
|
+
palette: null,
|
|
1143
|
+
supported: true
|
|
1144
|
+
};
|
|
1145
|
+
try {
|
|
1146
|
+
const pixels = await decodeBlob(blob, request.analysis.sampleSize);
|
|
1147
|
+
return {
|
|
1148
|
+
palette: pixels ? analyzeAmbientPixels(pixels, request.analysis) : null,
|
|
1149
|
+
supported: true
|
|
1150
|
+
};
|
|
1151
|
+
} catch {
|
|
1152
|
+
return {
|
|
1153
|
+
palette: null,
|
|
1154
|
+
supported: true
|
|
1155
|
+
};
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
// src/modules/ambient/worker/index.ts
|
|
1160
|
+
var AMBIENT_WORKER_REQUEST = "ambient:extract";
|
|
1161
|
+
var AMBIENT_WORKER_RESPONSE = "ambient:palette";
|
|
1162
|
+
|
|
1163
|
+
// src/modules/ambient/extractor.ts
|
|
1164
|
+
var WORKER_PATIENCE = 15e3;
|
|
1165
|
+
var paletteCache = /* @__PURE__ */ new Map();
|
|
1166
|
+
var inFlight = /* @__PURE__ */ new Map();
|
|
1167
|
+
function cachePalette(key, palette) {
|
|
1168
|
+
paletteCache.delete(key);
|
|
1169
|
+
const limit = Math.max(1, getAmbientSettings().cacheLimit);
|
|
1170
|
+
while (paletteCache.size >= limit) {
|
|
1171
|
+
const oldest = paletteCache.keys().next().value;
|
|
1172
|
+
if (oldest === void 0) break;
|
|
1173
|
+
paletteCache.delete(oldest);
|
|
1174
|
+
}
|
|
1175
|
+
paletteCache.set(key, palette);
|
|
1176
|
+
}
|
|
1177
|
+
function primeAmbientPalette(src, palette) {
|
|
1178
|
+
if (src && palette) cachePalette(src, {
|
|
1179
|
+
...palette,
|
|
1180
|
+
source: src
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1183
|
+
function getCachedAmbientPalette(src) {
|
|
1184
|
+
return paletteCache.get(src) ?? null;
|
|
1185
|
+
}
|
|
1186
|
+
var slot = null;
|
|
1187
|
+
var brokenFactories = /* @__PURE__ */ new WeakSet();
|
|
1188
|
+
function dropWorker(target) {
|
|
1189
|
+
if (slot === target) slot = null;
|
|
1190
|
+
target.worker.terminate();
|
|
1191
|
+
for (const resolve of target.pending.values()) resolve(null);
|
|
1192
|
+
target.pending.clear();
|
|
1193
|
+
}
|
|
1194
|
+
function workerSlot(factory) {
|
|
1195
|
+
if (slot?.factory === factory) return slot;
|
|
1196
|
+
if (slot) dropWorker(slot);
|
|
1197
|
+
if (brokenFactories.has(factory)) return null;
|
|
1198
|
+
let worker;
|
|
1199
|
+
try {
|
|
1200
|
+
worker = factory();
|
|
1201
|
+
} catch {
|
|
1202
|
+
brokenFactories.add(factory);
|
|
1203
|
+
return null;
|
|
1204
|
+
}
|
|
1205
|
+
const created = {
|
|
1206
|
+
factory,
|
|
1207
|
+
next: 1,
|
|
1208
|
+
pending: /* @__PURE__ */ new Map(),
|
|
1209
|
+
worker
|
|
1210
|
+
};
|
|
1211
|
+
worker.addEventListener("message", (event) => {
|
|
1212
|
+
const message = event.data;
|
|
1213
|
+
if (message?.type !== AMBIENT_WORKER_RESPONSE) return;
|
|
1214
|
+
created.pending.get(message.id)?.(message);
|
|
1215
|
+
created.pending.delete(message.id);
|
|
1216
|
+
});
|
|
1217
|
+
worker.addEventListener("error", () => {
|
|
1218
|
+
brokenFactories.add(factory);
|
|
1219
|
+
dropWorker(created);
|
|
1220
|
+
});
|
|
1221
|
+
slot = created;
|
|
1222
|
+
return created;
|
|
1223
|
+
}
|
|
1224
|
+
function extractInWorker(factory, request) {
|
|
1225
|
+
const target = workerSlot(factory);
|
|
1226
|
+
if (!target) return Promise.resolve(null);
|
|
1227
|
+
const id = target.next++;
|
|
1228
|
+
return new Promise((resolve) => {
|
|
1229
|
+
const timer = setTimeout(() => {
|
|
1230
|
+
target.pending.delete(id);
|
|
1231
|
+
resolve(null);
|
|
1232
|
+
}, WORKER_PATIENCE);
|
|
1233
|
+
target.pending.set(id, (result) => {
|
|
1234
|
+
clearTimeout(timer);
|
|
1235
|
+
resolve(result);
|
|
1236
|
+
});
|
|
1237
|
+
target.worker.postMessage({
|
|
1238
|
+
...request,
|
|
1239
|
+
id,
|
|
1240
|
+
type: AMBIENT_WORKER_REQUEST
|
|
1241
|
+
});
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
function loadImageElement(url) {
|
|
1245
|
+
return new Promise((resolve) => {
|
|
1246
|
+
const image = new Image();
|
|
1247
|
+
image.onload = () => resolve(image);
|
|
1248
|
+
image.onerror = () => resolve(null);
|
|
1249
|
+
image.src = url;
|
|
1250
|
+
});
|
|
1251
|
+
}
|
|
1252
|
+
async function extractOnMainThread(request) {
|
|
1253
|
+
const result = await extractHere(request);
|
|
1254
|
+
if (result.supported) return result.palette;
|
|
1255
|
+
const blob = await fetchImageBlob(request.src, request.proxyUrl);
|
|
1256
|
+
if (!blob || typeof URL.createObjectURL !== "function") return null;
|
|
1257
|
+
const objectUrl = URL.createObjectURL(blob);
|
|
1258
|
+
try {
|
|
1259
|
+
const image = await loadImageElement(objectUrl);
|
|
1260
|
+
const pixels = image && readPixels(image, image.naturalWidth, image.naturalHeight, request.analysis.sampleSize);
|
|
1261
|
+
return pixels ? analyzeAmbientPixels(pixels, request.analysis) : null;
|
|
1262
|
+
} catch {
|
|
1263
|
+
return null;
|
|
1264
|
+
} finally {
|
|
1265
|
+
URL.revokeObjectURL(objectUrl);
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
function absoluteUrl(src) {
|
|
1269
|
+
try {
|
|
1270
|
+
return new URL(src, globalThis.location?.href).href;
|
|
1271
|
+
} catch {
|
|
1272
|
+
return src;
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
var isCrossOrigin2 = (url) => {
|
|
1276
|
+
try {
|
|
1277
|
+
return new URL(url).origin !== globalThis.location?.origin;
|
|
1278
|
+
} catch {
|
|
1279
|
+
return false;
|
|
1280
|
+
}
|
|
1281
|
+
};
|
|
1282
|
+
function resolveAbsoluteProxyUrl(proxy, src) {
|
|
1283
|
+
const proxied = resolveProxyUrl(proxy, src);
|
|
1284
|
+
return proxied ? absoluteUrl(proxied) : null;
|
|
1285
|
+
}
|
|
1286
|
+
async function extractPalette(src, options) {
|
|
1287
|
+
const settings = getAmbientSettings();
|
|
1288
|
+
const strategy = options.strategy ?? settings.strategy;
|
|
1289
|
+
const absolute = absoluteUrl(src);
|
|
1290
|
+
const proxy = options.proxy === void 0 ? settings.proxy : options.proxy;
|
|
1291
|
+
const request = {
|
|
1292
|
+
analysis: resolveAnalysis(options.analysis),
|
|
1293
|
+
proxyUrl: isCrossOrigin2(absolute) ? resolveAbsoluteProxyUrl(proxy, absolute) : null,
|
|
1294
|
+
src: absolute
|
|
1295
|
+
};
|
|
1296
|
+
if (strategy !== "main" && settings.worker && typeof Worker === "function") {
|
|
1297
|
+
const result = await extractInWorker(settings.worker, request);
|
|
1298
|
+
if (result?.supported) return result.palette;
|
|
1299
|
+
}
|
|
1300
|
+
if (strategy === "worker") return null;
|
|
1301
|
+
return extractOnMainThread(request);
|
|
1302
|
+
}
|
|
1303
|
+
async function extractPaletteFromImage(imageSource, options = {}) {
|
|
1304
|
+
const src = typeof imageSource === "string" ? imageSource : imageSource?.src;
|
|
1305
|
+
if (!src || typeof window === "undefined") return null;
|
|
1306
|
+
const strategy = options.strategy ?? getAmbientSettings().strategy;
|
|
1307
|
+
if (strategy === "none") return getCachedAmbientPalette(src);
|
|
1308
|
+
const key = options.analysis ? `${src}#${JSON.stringify(options.analysis)}` : src;
|
|
1309
|
+
const cached = paletteCache.get(key);
|
|
1310
|
+
if (cached) return cached;
|
|
1311
|
+
let pending = inFlight.get(key);
|
|
1312
|
+
if (!pending) {
|
|
1313
|
+
pending = extractPalette(src, options).catch(() => null).then((palette) => {
|
|
1314
|
+
if (!palette) return null;
|
|
1315
|
+
const sourced = {
|
|
1316
|
+
...palette,
|
|
1317
|
+
source: src
|
|
1318
|
+
};
|
|
1319
|
+
cachePalette(key, sourced);
|
|
1320
|
+
return sourced;
|
|
1321
|
+
}).finally(() => inFlight.delete(key));
|
|
1322
|
+
inFlight.set(key, pending);
|
|
1323
|
+
}
|
|
1324
|
+
return pending;
|
|
1325
|
+
}
|
|
1326
|
+
function useStableObject(value) {
|
|
1327
|
+
const ref = useRef(value);
|
|
1328
|
+
if (!shallowEqual(ref.current, value)) {
|
|
1329
|
+
ref.current = value;
|
|
1330
|
+
}
|
|
1331
|
+
return ref.current;
|
|
1332
|
+
}
|
|
1333
|
+
function useAmbientColor(imageSource, t0) {
|
|
1334
|
+
const $ = c(13);
|
|
1335
|
+
const options = t0 === void 0 ? null : t0;
|
|
1336
|
+
const stableOptions = useStableObject(options);
|
|
1337
|
+
const initialPalette = useStableObject(options?.initialPalette ?? null);
|
|
1338
|
+
const srcKey = typeof imageSource === "string" ? imageSource : imageSource?.src;
|
|
1339
|
+
const seeded = srcKey && initialPalette?.source === srcKey ? initialPalette : null;
|
|
1340
|
+
const [result, setResult] = useState(null);
|
|
1341
|
+
const settled = result?.source === srcKey ? result : null;
|
|
1342
|
+
const isExtracting = Boolean(imageSource && !seeded && !settled);
|
|
1343
|
+
let t1;
|
|
1344
|
+
let t2;
|
|
1345
|
+
if ($[0] !== seeded || $[1] !== srcKey) {
|
|
1346
|
+
t1 = () => {
|
|
1347
|
+
if (seeded && srcKey) {
|
|
1348
|
+
primeAmbientPalette(srcKey, seeded);
|
|
1349
|
+
}
|
|
1350
|
+
};
|
|
1351
|
+
t2 = [seeded, srcKey];
|
|
1352
|
+
$[0] = seeded;
|
|
1353
|
+
$[1] = srcKey;
|
|
1354
|
+
$[2] = t1;
|
|
1355
|
+
$[3] = t2;
|
|
1356
|
+
} else {
|
|
1357
|
+
t1 = $[2];
|
|
1358
|
+
t2 = $[3];
|
|
1359
|
+
}
|
|
1360
|
+
useEffect(t1, t2);
|
|
1361
|
+
let t3;
|
|
1362
|
+
let t4;
|
|
1363
|
+
if ($[4] !== imageSource || $[5] !== seeded || $[6] !== srcKey || $[7] !== stableOptions) {
|
|
1364
|
+
t3 = () => {
|
|
1365
|
+
if (!imageSource || !srcKey || seeded) {
|
|
1366
|
+
return;
|
|
1367
|
+
}
|
|
1368
|
+
let active = true;
|
|
1369
|
+
extractPaletteFromImage(imageSource, stableOptions ?? {}).catch(_temp).then((palette) => {
|
|
1370
|
+
if (active) {
|
|
1371
|
+
setResult({
|
|
1372
|
+
palette,
|
|
1373
|
+
source: srcKey
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
});
|
|
1377
|
+
return () => {
|
|
1378
|
+
active = false;
|
|
1379
|
+
};
|
|
1380
|
+
};
|
|
1381
|
+
t4 = [imageSource, seeded, srcKey, stableOptions];
|
|
1382
|
+
$[4] = imageSource;
|
|
1383
|
+
$[5] = seeded;
|
|
1384
|
+
$[6] = srcKey;
|
|
1385
|
+
$[7] = stableOptions;
|
|
1386
|
+
$[8] = t3;
|
|
1387
|
+
$[9] = t4;
|
|
1388
|
+
} else {
|
|
1389
|
+
t3 = $[8];
|
|
1390
|
+
t4 = $[9];
|
|
1391
|
+
}
|
|
1392
|
+
useEffect(t3, t4);
|
|
1393
|
+
const palette_0 = imageSource ? seeded ?? settled?.palette ?? initialPalette : initialPalette;
|
|
1394
|
+
let t5;
|
|
1395
|
+
if ($[10] !== isExtracting || $[11] !== palette_0) {
|
|
1396
|
+
t5 = {
|
|
1397
|
+
isExtracting,
|
|
1398
|
+
palette: palette_0
|
|
1399
|
+
};
|
|
1400
|
+
$[10] = isExtracting;
|
|
1401
|
+
$[11] = palette_0;
|
|
1402
|
+
$[12] = t5;
|
|
1403
|
+
} else {
|
|
1404
|
+
t5 = $[12];
|
|
1405
|
+
}
|
|
1406
|
+
return t5;
|
|
1407
|
+
}
|
|
1408
|
+
function _temp() {
|
|
1409
|
+
return null;
|
|
1410
|
+
}
|
|
1411
|
+
function useScopedVariables(varMap, t0) {
|
|
1412
|
+
const $ = c(11);
|
|
1413
|
+
const {
|
|
1414
|
+
linger,
|
|
1415
|
+
scope: scope2,
|
|
1416
|
+
transition
|
|
1417
|
+
} = t0;
|
|
1418
|
+
const t1 = useTheme(ambientTheme);
|
|
1419
|
+
let t2;
|
|
1420
|
+
if ($[0] !== t1.slots.transition) {
|
|
1421
|
+
const transitionClasses = t1.slots.transition.split(/\s+/).filter(Boolean);
|
|
1422
|
+
t2 = transitionClasses.join(" ");
|
|
1423
|
+
$[0] = t1.slots.transition;
|
|
1424
|
+
$[1] = t2;
|
|
1425
|
+
} else {
|
|
1426
|
+
t2 = $[1];
|
|
1427
|
+
}
|
|
1428
|
+
const transitionKey = t2;
|
|
1429
|
+
let t3;
|
|
1430
|
+
if ($[2] !== varMap) {
|
|
1431
|
+
t3 = JSON.stringify(varMap);
|
|
1432
|
+
$[2] = varMap;
|
|
1433
|
+
$[3] = t3;
|
|
1434
|
+
} else {
|
|
1435
|
+
t3 = $[3];
|
|
1436
|
+
}
|
|
1437
|
+
const varKey = t3;
|
|
1438
|
+
let t4;
|
|
1439
|
+
let t5;
|
|
1440
|
+
if ($[4] !== linger || $[5] !== scope2 || $[6] !== transition || $[7] !== transitionKey || $[8] !== varKey) {
|
|
1441
|
+
t4 = () => {
|
|
1442
|
+
const vars = JSON.parse(varKey);
|
|
1443
|
+
if (Object.keys(vars).length === 0) {
|
|
1444
|
+
return;
|
|
1445
|
+
}
|
|
1446
|
+
const targetEl = resolveTargetElement(scope2);
|
|
1447
|
+
if (!targetEl) {
|
|
1448
|
+
return;
|
|
1449
|
+
}
|
|
1450
|
+
if (transition) {
|
|
1451
|
+
targetEl.classList.add(...transitionKey.split(" ").filter(Boolean));
|
|
1452
|
+
}
|
|
1453
|
+
const restoreVariables = applyScopedCssVariables(targetEl, vars, {
|
|
1454
|
+
linger: linger ?? (scope2 ? 0 : getAmbientSettings().linger)
|
|
1455
|
+
});
|
|
1456
|
+
return () => {
|
|
1457
|
+
restoreVariables();
|
|
1458
|
+
if (transition && scope2) {
|
|
1459
|
+
targetEl.classList.remove(...transitionKey.split(" ").filter(Boolean));
|
|
1460
|
+
}
|
|
1461
|
+
};
|
|
1462
|
+
};
|
|
1463
|
+
t5 = [linger, scope2, transition, transitionKey, varKey];
|
|
1464
|
+
$[4] = linger;
|
|
1465
|
+
$[5] = scope2;
|
|
1466
|
+
$[6] = transition;
|
|
1467
|
+
$[7] = transitionKey;
|
|
1468
|
+
$[8] = varKey;
|
|
1469
|
+
$[9] = t4;
|
|
1470
|
+
$[10] = t5;
|
|
1471
|
+
} else {
|
|
1472
|
+
t4 = $[9];
|
|
1473
|
+
t5 = $[10];
|
|
1474
|
+
}
|
|
1475
|
+
useEffect(t4, t5);
|
|
1476
|
+
}
|
|
1477
|
+
function useAmbientTheme(t0) {
|
|
1478
|
+
const $ = c(27);
|
|
1479
|
+
const config = t0 === void 0 ? null : t0;
|
|
1480
|
+
const ambientActions = use(AmbientContext)?.actions ?? null;
|
|
1481
|
+
let t1;
|
|
1482
|
+
if ($[0] !== config) {
|
|
1483
|
+
t1 = typeof config === "string" ? {
|
|
1484
|
+
image: config
|
|
1485
|
+
} : config || {};
|
|
1486
|
+
$[0] = config;
|
|
1487
|
+
$[1] = t1;
|
|
1488
|
+
} else {
|
|
1489
|
+
t1 = $[1];
|
|
1490
|
+
}
|
|
1491
|
+
const normalizedConfig = t1;
|
|
1492
|
+
const {
|
|
1493
|
+
colors: t2,
|
|
1494
|
+
cssVars: t3,
|
|
1495
|
+
image: t4,
|
|
1496
|
+
initialPalette: t5,
|
|
1497
|
+
linger,
|
|
1498
|
+
options: t6,
|
|
1499
|
+
scope: t7,
|
|
1500
|
+
transition: t8
|
|
1501
|
+
} = normalizedConfig;
|
|
1502
|
+
const colors = t2 === void 0 ? null : t2;
|
|
1503
|
+
const cssVars = t3 === void 0 ? null : t3;
|
|
1504
|
+
const image = t4 === void 0 ? null : t4;
|
|
1505
|
+
const initialPalette = t5 === void 0 ? null : t5;
|
|
1506
|
+
const options = t6 === void 0 ? null : t6;
|
|
1507
|
+
const scope2 = t7 === void 0 ? null : t7;
|
|
1508
|
+
const transition = t8 === void 0 ? true : t8;
|
|
1509
|
+
const stableInitialPalette = useStableObject(initialPalette);
|
|
1510
|
+
const stableOptions = useStableObject(options);
|
|
1511
|
+
const stableColors = useStableObject(colors);
|
|
1512
|
+
const stableCssVars = useStableObject(cssVars);
|
|
1513
|
+
let t9;
|
|
1514
|
+
if ($[2] !== stableOptions) {
|
|
1515
|
+
t9 = stableOptions || {};
|
|
1516
|
+
$[2] = stableOptions;
|
|
1517
|
+
$[3] = t9;
|
|
1518
|
+
} else {
|
|
1519
|
+
t9 = $[3];
|
|
1520
|
+
}
|
|
1521
|
+
let t10;
|
|
1522
|
+
if ($[4] !== stableInitialPalette) {
|
|
1523
|
+
t10 = stableInitialPalette ? {
|
|
1524
|
+
initialPalette: stableInitialPalette
|
|
1525
|
+
} : {};
|
|
1526
|
+
$[4] = stableInitialPalette;
|
|
1527
|
+
$[5] = t10;
|
|
1528
|
+
} else {
|
|
1529
|
+
t10 = $[5];
|
|
1530
|
+
}
|
|
1531
|
+
let t11;
|
|
1532
|
+
if ($[6] !== t10 || $[7] !== t9) {
|
|
1533
|
+
t11 = {
|
|
1534
|
+
...t9,
|
|
1535
|
+
...t10
|
|
1536
|
+
};
|
|
1537
|
+
$[6] = t10;
|
|
1538
|
+
$[7] = t9;
|
|
1539
|
+
$[8] = t11;
|
|
1540
|
+
} else {
|
|
1541
|
+
t11 = $[8];
|
|
1542
|
+
}
|
|
1543
|
+
const resolvedOptions = t11;
|
|
1544
|
+
const {
|
|
1545
|
+
palette: extractedPalette,
|
|
1546
|
+
isExtracting
|
|
1547
|
+
} = useAmbientColor(image, resolvedOptions);
|
|
1548
|
+
const hasActiveConfig = Boolean(image || stableColors);
|
|
1549
|
+
let t12;
|
|
1550
|
+
let t13;
|
|
1551
|
+
if ($[9] !== ambientActions || $[10] !== extractedPalette || $[11] !== hasActiveConfig || $[12] !== isExtracting) {
|
|
1552
|
+
t12 = () => {
|
|
1553
|
+
if (!hasActiveConfig || !ambientActions) {
|
|
1554
|
+
return;
|
|
1555
|
+
}
|
|
1556
|
+
ambientActions.setIsExtracting(isExtracting);
|
|
1557
|
+
ambientActions.setPalette((prev) => shallowEqual(prev, extractedPalette) ? prev : extractedPalette);
|
|
1558
|
+
};
|
|
1559
|
+
t13 = [ambientActions, extractedPalette, hasActiveConfig, isExtracting];
|
|
1560
|
+
$[9] = ambientActions;
|
|
1561
|
+
$[10] = extractedPalette;
|
|
1562
|
+
$[11] = hasActiveConfig;
|
|
1563
|
+
$[12] = isExtracting;
|
|
1564
|
+
$[13] = t12;
|
|
1565
|
+
$[14] = t13;
|
|
1566
|
+
} else {
|
|
1567
|
+
t12 = $[13];
|
|
1568
|
+
t13 = $[14];
|
|
1569
|
+
}
|
|
1570
|
+
useEffect(t12, t13);
|
|
1571
|
+
let t14;
|
|
1572
|
+
if ($[15] !== extractedPalette || $[16] !== image || $[17] !== stableColors || $[18] !== stableCssVars) {
|
|
1573
|
+
t14 = resolveAmbientVarMap({
|
|
1574
|
+
colors: stableColors,
|
|
1575
|
+
cssVars: stableCssVars,
|
|
1576
|
+
image,
|
|
1577
|
+
palette: extractedPalette
|
|
1578
|
+
});
|
|
1579
|
+
$[15] = extractedPalette;
|
|
1580
|
+
$[16] = image;
|
|
1581
|
+
$[17] = stableColors;
|
|
1582
|
+
$[18] = stableCssVars;
|
|
1583
|
+
$[19] = t14;
|
|
1584
|
+
} else {
|
|
1585
|
+
t14 = $[19];
|
|
1586
|
+
}
|
|
1587
|
+
const resolvedVarMap = t14;
|
|
1588
|
+
let t15;
|
|
1589
|
+
if ($[20] !== linger || $[21] !== scope2 || $[22] !== transition) {
|
|
1590
|
+
t15 = {
|
|
1591
|
+
linger,
|
|
1592
|
+
scope: scope2,
|
|
1593
|
+
transition
|
|
1594
|
+
};
|
|
1595
|
+
$[20] = linger;
|
|
1596
|
+
$[21] = scope2;
|
|
1597
|
+
$[22] = transition;
|
|
1598
|
+
$[23] = t15;
|
|
1599
|
+
} else {
|
|
1600
|
+
t15 = $[23];
|
|
1601
|
+
}
|
|
1602
|
+
useScopedVariables(resolvedVarMap, t15);
|
|
1603
|
+
let t16;
|
|
1604
|
+
if ($[24] !== extractedPalette || $[25] !== isExtracting) {
|
|
1605
|
+
t16 = {
|
|
1606
|
+
isExtracting,
|
|
1607
|
+
palette: extractedPalette
|
|
1608
|
+
};
|
|
1609
|
+
$[24] = extractedPalette;
|
|
1610
|
+
$[25] = isExtracting;
|
|
1611
|
+
$[26] = t16;
|
|
1612
|
+
} else {
|
|
1613
|
+
t16 = $[26];
|
|
1614
|
+
}
|
|
1615
|
+
return t16;
|
|
1616
|
+
}
|
|
1617
|
+
function useAmbient(configOrImage) {
|
|
1618
|
+
const $ = c(6);
|
|
1619
|
+
const {
|
|
1620
|
+
actions,
|
|
1621
|
+
store
|
|
1622
|
+
} = useRequiredContext(AmbientContext, "useAmbient", "AmbientProvider");
|
|
1623
|
+
const shared = useStore(store);
|
|
1624
|
+
const {
|
|
1625
|
+
isExtracting,
|
|
1626
|
+
palette
|
|
1627
|
+
} = useAmbientTheme(configOrImage ?? null);
|
|
1628
|
+
let t0;
|
|
1629
|
+
if ($[0] !== actions || $[1] !== configOrImage || $[2] !== isExtracting || $[3] !== palette || $[4] !== shared) {
|
|
1630
|
+
t0 = configOrImage ? {
|
|
1631
|
+
...shared,
|
|
1632
|
+
...actions,
|
|
1633
|
+
isExtracting,
|
|
1634
|
+
palette
|
|
1635
|
+
} : {
|
|
1636
|
+
...shared,
|
|
1637
|
+
...actions
|
|
1638
|
+
};
|
|
1639
|
+
$[0] = actions;
|
|
1640
|
+
$[1] = configOrImage;
|
|
1641
|
+
$[2] = isExtracting;
|
|
1642
|
+
$[3] = palette;
|
|
1643
|
+
$[4] = shared;
|
|
1644
|
+
$[5] = t0;
|
|
1645
|
+
} else {
|
|
1646
|
+
t0 = $[5];
|
|
1647
|
+
}
|
|
1648
|
+
return t0;
|
|
1649
|
+
}
|
|
1650
|
+
var firstString = (...values) => values.find((value) => typeof value === "string" && value) ?? null;
|
|
1651
|
+
function resolvePageAmbientTheme(slice, posterUrl) {
|
|
1652
|
+
const ambient = slice?.ambient;
|
|
1653
|
+
const banner = slice?.banner ?? null;
|
|
1654
|
+
const defaultImage = banner ?? posterUrl;
|
|
1655
|
+
if (ambient === false) return null;
|
|
1656
|
+
if (ambient === true || typeof ambient === "string") {
|
|
1657
|
+
return {
|
|
1658
|
+
image: typeof ambient === "string" ? ambient : defaultImage
|
|
1659
|
+
};
|
|
1660
|
+
}
|
|
1661
|
+
if (ambient && typeof ambient === "object") {
|
|
1662
|
+
return {
|
|
1663
|
+
image: ambient.image ?? defaultImage,
|
|
1664
|
+
...ambient
|
|
1665
|
+
};
|
|
1666
|
+
}
|
|
1667
|
+
if (banner && !posterUrl) return {
|
|
1668
|
+
image: banner
|
|
1669
|
+
};
|
|
1670
|
+
return null;
|
|
1671
|
+
}
|
|
1672
|
+
function selectPageAmbient(config) {
|
|
1673
|
+
return {
|
|
1674
|
+
ambient: config.ambient,
|
|
1675
|
+
banner: firstString(config.dock?.banner, config.dock?.bannerUrl)
|
|
1676
|
+
};
|
|
1677
|
+
}
|
|
1678
|
+
function useAmbientPage(slice, page) {
|
|
1679
|
+
const $ = c(5);
|
|
1680
|
+
const posterUrl = useOptionalBackgroundState(_temp2);
|
|
1681
|
+
let t0;
|
|
1682
|
+
if ($[0] !== posterUrl || $[1] !== slice) {
|
|
1683
|
+
t0 = resolvePageAmbientTheme(slice, posterUrl);
|
|
1684
|
+
$[0] = posterUrl;
|
|
1685
|
+
$[1] = slice;
|
|
1686
|
+
$[2] = t0;
|
|
1687
|
+
} else {
|
|
1688
|
+
t0 = $[2];
|
|
1689
|
+
}
|
|
1690
|
+
useAmbientTheme(t0);
|
|
1691
|
+
let t1;
|
|
1692
|
+
if ($[3] !== page) {
|
|
1693
|
+
t1 = {
|
|
1694
|
+
set: (ambient) => page.set({
|
|
1695
|
+
ambient
|
|
1696
|
+
})
|
|
1697
|
+
};
|
|
1698
|
+
$[3] = page;
|
|
1699
|
+
$[4] = t1;
|
|
1700
|
+
} else {
|
|
1701
|
+
t1 = $[4];
|
|
1702
|
+
}
|
|
1703
|
+
return t1;
|
|
1704
|
+
}
|
|
1705
|
+
function _temp2(background) {
|
|
1706
|
+
return background.posterUrl;
|
|
1707
|
+
}
|
|
1708
|
+
var ambientModule = defineModule({
|
|
1709
|
+
id: "ambient",
|
|
1710
|
+
context: AmbientContext,
|
|
1711
|
+
Provider: AmbientProvider,
|
|
1712
|
+
uses: ["background"],
|
|
1713
|
+
page: {
|
|
1714
|
+
select: selectPageAmbient,
|
|
1715
|
+
use: useAmbientPage
|
|
1716
|
+
}
|
|
1717
|
+
});
|
|
1718
|
+
function resolveValue(value, props) {
|
|
1719
|
+
return typeof value === "function" ? value(props) : value;
|
|
1720
|
+
}
|
|
1721
|
+
function defineAmbient(definition = {}) {
|
|
1722
|
+
const {
|
|
1723
|
+
defaultProps,
|
|
1724
|
+
id = "ambient-theme",
|
|
1725
|
+
...config
|
|
1726
|
+
} = definition;
|
|
1727
|
+
const create = (props = {}, {
|
|
1728
|
+
id: overrideId,
|
|
1729
|
+
...overrides
|
|
1730
|
+
} = {}) => {
|
|
1731
|
+
const mergedProps = {
|
|
1732
|
+
...defaultProps,
|
|
1733
|
+
...props
|
|
1734
|
+
};
|
|
1735
|
+
const merged = {
|
|
1736
|
+
...config,
|
|
1737
|
+
...overrides
|
|
1738
|
+
};
|
|
1739
|
+
return {
|
|
1740
|
+
...merged,
|
|
1741
|
+
colors: resolveValue(merged.colors ?? null, mergedProps) ?? null,
|
|
1742
|
+
id: overrideId ?? id,
|
|
1743
|
+
image: resolveValue(merged.image ?? null, mergedProps),
|
|
1744
|
+
initialPalette: merged.initialPalette ?? null,
|
|
1745
|
+
options: {
|
|
1746
|
+
...config.options,
|
|
1747
|
+
...overrides.options
|
|
1748
|
+
},
|
|
1749
|
+
props: mergedProps,
|
|
1750
|
+
scope: merged.scope ?? null,
|
|
1751
|
+
transition: merged.transition ?? true
|
|
1752
|
+
};
|
|
1753
|
+
};
|
|
1754
|
+
return Object.freeze({
|
|
1755
|
+
config: definition,
|
|
1756
|
+
create,
|
|
1757
|
+
id,
|
|
1758
|
+
use: function useDefinedAmbient(props, overrides) {
|
|
1759
|
+
return useAmbientTheme(create(props, overrides));
|
|
1760
|
+
}
|
|
1761
|
+
});
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
export { AMBIENT_ANALYSIS_VERSION, AMBIENT_REGIONS, AMBIENT_ROLES, AMBIENT_TONES, AmbientContext, AmbientProvider, DEFAULT_ANALYSIS, DEFAULT_CSS_VAR_NAMES, DEFAULT_LINGER_MS, ambientModule, ambientTheme, analyzeAmbientPixels, applyScopedCssVariables, configureAmbient, contrastRatio, defineAmbient, extractPaletteFromImage, findContentBounds, formatOklch, getAmbientSettings, getCachedAmbientPalette, maxChroma, normalizeColorMap, onColorFor, paletteVarMap, primeAmbientPalette, resolveAmbientVarMap, resolveCssVarNames, resolvePageAmbientTheme, resolveTargetElement, skinLikeness, srgbToOklab, toneOf, useAmbient, useAmbientColor, useAmbientTheme };
|
|
1765
|
+
//# sourceMappingURL=chunk-GQKGOLHJ.js.map
|
|
1766
|
+
//# sourceMappingURL=chunk-GQKGOLHJ.js.map
|