@omerdlw/base-framework 3.0.1 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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-2223J34C.js +850 -0
- package/dist/chunk-2223J34C.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-4OQGXZIH.js +1435 -0
- package/dist/chunk-4OQGXZIH.js.map +1 -0
- package/dist/chunk-5H6FZW3N.js +535 -0
- package/dist/chunk-5H6FZW3N.js.map +1 -0
- package/dist/chunk-7RSRDKYE.js +22 -0
- package/dist/chunk-7RSRDKYE.js.map +1 -0
- package/dist/chunk-AYUEZPAN.js +15762 -0
- package/dist/chunk-AYUEZPAN.js.map +1 -0
- package/dist/chunk-BCFJSPTI.js +261 -0
- package/dist/chunk-BCFJSPTI.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-GCHQ5OC4.js +460 -0
- package/dist/chunk-GCHQ5OC4.js.map +1 -0
- package/dist/chunk-GT4COZI7.js +110 -0
- package/dist/chunk-GT4COZI7.js.map +1 -0
- package/dist/chunk-H6HRU3XN.js +567 -0
- package/dist/chunk-H6HRU3XN.js.map +1 -0
- package/dist/chunk-J3VTDBC6.js +14 -0
- package/dist/chunk-J3VTDBC6.js.map +1 -0
- package/dist/chunk-LTO77WSO.js +140 -0
- package/dist/chunk-LTO77WSO.js.map +1 -0
- package/dist/chunk-MCYHKFZL.js +17 -0
- package/dist/chunk-MCYHKFZL.js.map +1 -0
- package/dist/chunk-NHOJWICA.js +2367 -0
- package/dist/chunk-NHOJWICA.js.map +1 -0
- package/dist/chunk-QMFV53PP.js +1766 -0
- package/dist/chunk-QMFV53PP.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-RTCJ35UC.js +825 -0
- package/dist/chunk-RTCJ35UC.js.map +1 -0
- package/dist/chunk-TUUGWQY5.js +3488 -0
- package/dist/chunk-TUUGWQY5.js.map +1 -0
- package/dist/chunk-WXEOP6Z4.js +577 -0
- package/dist/chunk-WXEOP6Z4.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-ZFTQY7OF.js +139 -0
- package/dist/chunk-ZFTQY7OF.js.map +1 -0
- package/dist/chunk-ZSNP26VU.js +493 -0
- package/dist/chunk-ZSNP26VU.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 -10
- 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 +9 -49
- 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 +23 -12
- package/dist/modules/ambient/dom.d.ts.map +1 -1
- package/dist/modules/ambient/extractor.d.ts +6 -4
- 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/index.d.ts +2 -2
- package/dist/modules/ambient/index.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 +18 -13
- package/dist/modules/ambient/oklab.d.ts.map +1 -1
- package/dist/modules/ambient/pipeline.d.ts +0 -7
- package/dist/modules/ambient/pipeline.d.ts.map +1 -1
- package/dist/modules/ambient/quantize.d.ts +2 -9
- package/dist/modules/ambient/quantize.d.ts.map +1 -1
- package/dist/modules/ambient/server/address.d.ts +8 -3
- package/dist/modules/ambient/server/address.d.ts.map +1 -1
- package/dist/modules/ambient/server/index.d.ts +20 -23
- package/dist/modules/ambient/server/index.d.ts.map +1 -1
- package/dist/modules/ambient/settings.d.ts +23 -3
- package/dist/modules/ambient/settings.d.ts.map +1 -1
- package/dist/modules/ambient/types.d.ts +98 -36
- package/dist/modules/ambient/types.d.ts.map +1 -1
- package/dist/modules/ambient/worker/index.d.ts +16 -1
- 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 +7 -7
- 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 -10
- 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/index.d.ts +1 -1
- package/dist/modules/context-menu/index.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 -9
- 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 -11
- 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 -23
- 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 -48
- 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/index.d.ts +1 -1
- package/dist/modules/loading/index.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/index.d.ts +1 -1
- package/dist/modules/media/index.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 +8 -7
- 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 -10
- package/dist/modules/modal/types.d.ts.map +1 -1
- package/dist/modules/navigation/context.d.ts +16 -5
- package/dist/modules/navigation/context.d.ts.map +1 -1
- package/dist/modules/navigation/hooks.d.ts +22 -13
- 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 +6 -8
- 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 -5
- 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-QHSJBV3O.js +13 -0
- package/dist/overlay-QHSJBV3O.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 -0
- package/dist/ui/index.js +2268 -0
- package/dist/ui/index.js.map +1 -0
- 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 -57
- package/docs/architecture-and-rules.md +133 -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 +106 -88
- 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-3BUP64Q6.js +0 -105
- package/dist/chunk-3BUP64Q6.js.map +0 -1
- package/dist/chunk-4GMQKD6F.js +0 -353
- package/dist/chunk-4GMQKD6F.js.map +0 -1
- package/dist/chunk-66EYJBIP.js +0 -300
- package/dist/chunk-66EYJBIP.js.map +0 -1
- package/dist/chunk-7HQMXTNP.js +0 -419
- package/dist/chunk-7HQMXTNP.js.map +0 -1
- package/dist/chunk-7TAVYJ3A.js +0 -371
- package/dist/chunk-7TAVYJ3A.js.map +0 -1
- package/dist/chunk-AQ4BNXA2.js +0 -349
- package/dist/chunk-AQ4BNXA2.js.map +0 -1
- package/dist/chunk-CGHZSSFR.js +0 -2166
- package/dist/chunk-CGHZSSFR.js.map +0 -1
- package/dist/chunk-DGCQWQLZ.js +0 -61
- package/dist/chunk-DGCQWQLZ.js.map +0 -1
- package/dist/chunk-FIMPHODX.js +0 -67
- package/dist/chunk-FIMPHODX.js.map +0 -1
- package/dist/chunk-GF7TUX5I.js +0 -1889
- package/dist/chunk-GF7TUX5I.js.map +0 -1
- package/dist/chunk-HHWRTQKQ.js +0 -610
- package/dist/chunk-HHWRTQKQ.js.map +0 -1
- package/dist/chunk-HLL5EHXC.js +0 -485
- package/dist/chunk-HLL5EHXC.js.map +0 -1
- package/dist/chunk-I5GK7VOV.js +0 -28
- package/dist/chunk-I5GK7VOV.js.map +0 -1
- package/dist/chunk-JELG4JLT.js +0 -454
- package/dist/chunk-JELG4JLT.js.map +0 -1
- package/dist/chunk-K676GL7Z.js +0 -51
- package/dist/chunk-K676GL7Z.js.map +0 -1
- package/dist/chunk-QI3ALLIB.js +0 -38
- package/dist/chunk-QI3ALLIB.js.map +0 -1
- package/dist/chunk-R2YGFJDJ.js +0 -408
- package/dist/chunk-R2YGFJDJ.js.map +0 -1
- package/dist/chunk-RFZQWLC5.js +0 -27
- package/dist/chunk-RFZQWLC5.js.map +0 -1
- package/dist/chunk-RIOKLMYM.js +0 -145
- package/dist/chunk-RIOKLMYM.js.map +0 -1
- package/dist/chunk-RRAZKP3J.js +0 -888
- package/dist/chunk-RRAZKP3J.js.map +0 -1
- package/dist/chunk-SYAVGTOX.js +0 -521
- package/dist/chunk-SYAVGTOX.js.map +0 -1
- package/dist/chunk-TG6NMHXI.js +0 -1218
- package/dist/chunk-TG6NMHXI.js.map +0 -1
- package/dist/chunk-TV3WEF5G.js +0 -784
- package/dist/chunk-TV3WEF5G.js.map +0 -1
- package/dist/chunk-WVRMABDN.js +0 -9727
- package/dist/chunk-WVRMABDN.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-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 -221
- package/dist/modules/ambient/server/index.js.map +0 -1
- package/dist/modules/ambient/worker/index.js +0 -114
- 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 -1362
- 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 -37
- package/dist/modules/navigation/constants.d.ts.map +0 -1
- package/dist/modules/navigation/index.js +0 -81
- package/dist/modules/navigation/index.js.map +0 -1
- package/dist/modules/navigation/navigator.d.ts +0 -8
- package/dist/modules/navigation/navigator.d.ts.map +0 -1
- package/dist/modules/navigation/settings.d.ts +0 -10
- package/dist/modules/navigation/settings.d.ts.map +0 -1
- package/dist/modules/navigation/state.d.ts +0 -20
- package/dist/modules/navigation/state.d.ts.map +0 -1
- package/dist/modules/navigation/types.d.ts +0 -168
- package/dist/modules/navigation/types.d.ts.map +0 -1
- package/dist/modules/navigation/utils.d.ts +0 -11
- package/dist/modules/navigation/utils.d.ts.map +0 -1
- package/dist/modules/notification/index.js +0 -7
- package/dist/overlay-TZ6L52A5.js +0 -9
- package/dist/overlay-TZ6L52A5.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 -63
- 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 -296
- package/dist/tokens/index.js.map +0 -1
- package/dist/tokens/motion-config.d.ts +0 -44
- 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/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/templates/motion/background.ts +0 -17
- package/templates/motion/context-menu.ts +0 -63
- package/templates/motion/dock.ts +0 -395
- package/templates/motion/modal.ts +0 -79
- package/templates/motion/notification.ts +0 -27
- package/templates/motion/tokens.ts +0 -47
- /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
package/MIGRATION.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Migrating from 3.x to 3.2
|
|
2
|
+
|
|
3
|
+
3.2 reorganises the package into layers and tidies the public surface. Most of the change is where you import from and a few removed names. Runtime behaviour is the same apart from one bug fix (see [Fixed](#fixed)) and the components that are no longer `memo()`.
|
|
4
|
+
|
|
5
|
+
## The framework holds no design
|
|
6
|
+
|
|
7
|
+
Coming from 3.1.0, note that 3.2 also includes an unreleased step in which every visual decision moved to the app:
|
|
8
|
+
|
|
9
|
+
- `./styles.css`, the `styles/` folder, design tokens (`Z_INDEX`, motion presets), default recipes, tones, default motion, icon names and `templates/motion` are removed. Supply them from your app's `ui`.
|
|
10
|
+
- Atoms and `utils/cn` are removed. Use the vocabulary-free `cn` and the `./ui` components (`Button`, `Icon`, `Loader`, `Tooltip`). `Button` takes `href` to render a link.
|
|
11
|
+
- Components ship an anatomy of empty parts plus the states they set (`checked`, `active`, `visible`, `loading`). Without a `ui`, they render no classes.
|
|
12
|
+
- Component motion comes from `motion/react` variants in your `ui`. A missing key means no animation, and reduced motion uses your `still` variant.
|
|
13
|
+
- Modules take stacking from theme styles (the modal reads `styles.layer`). The dock loader is now a `surfaceLoader` slot.
|
|
14
|
+
- `defineMotion`, `retime`, `gpuTransform` and `cssTransition` live in the server-safe `./utils` entry.
|
|
15
|
+
|
|
16
|
+
The subpath table below maps the previous build's layout. In it, the `./design` paths correspond to 3.1.0's `./ui`.
|
|
17
|
+
|
|
18
|
+
## Requirements
|
|
19
|
+
|
|
20
|
+
- Node `>=22` (see `engines` in `package.json`).
|
|
21
|
+
- React and React DOM `>=19.2.0` (peer dependencies; 3.x accepted `>=19.0.0`). 3.2 uses `useEffectEvent`, which is stable only from React 19.2. If you are on React 19.0 or 19.1, upgrade `react` and `react-dom` first.
|
|
22
|
+
|
|
23
|
+
## Subpath changes
|
|
24
|
+
|
|
25
|
+
| 3.x | 3.2 |
|
|
26
|
+
| ---------------------------------------- | --------------------------------------------- |
|
|
27
|
+
| `.` | `.` |
|
|
28
|
+
| `./result` | `./result` |
|
|
29
|
+
| `./events` | `./events` |
|
|
30
|
+
| `./utils` | `./utils` |
|
|
31
|
+
| `./design/recipes` | **`./recipes`** |
|
|
32
|
+
| `./hooks` | `./hooks` |
|
|
33
|
+
| `./theme` | `./theme` |
|
|
34
|
+
| `./design` | **`./ui`** |
|
|
35
|
+
| `./kernel` | `./kernel` |
|
|
36
|
+
| `./error` | `./error` |
|
|
37
|
+
| `./provider` | `./provider` |
|
|
38
|
+
| `./modules` | `./modules` |
|
|
39
|
+
| `./dock` ... `./navigation` (10 modules) | unchanged |
|
|
40
|
+
| `./ambient/server`, `./ambient/worker` | unchanged |
|
|
41
|
+
| `./modules/*` | **removed** (use `./<module>` or `./modules`) |
|
|
42
|
+
|
|
43
|
+
Notes:
|
|
44
|
+
|
|
45
|
+
- `./ui` exports only the UI components and `UiProvider`. For convenience it also re-exports `./recipes`, which 3.x served from `./design`.
|
|
46
|
+
- `getOrCreateGlobalContext` is still re-exported from `./kernel`.
|
|
47
|
+
|
|
48
|
+
## Removed names
|
|
49
|
+
|
|
50
|
+
| Removed | Replacement |
|
|
51
|
+
| ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
52
|
+
| `useModuleTheme` (from `./theme` and `.`) | `useTheme`, same signature and behaviour |
|
|
53
|
+
| `useIsomorphicLayoutEffect` (from `./hooks` and `.`) | `useLayoutEffect` from `react`. React 19 no longer warns about `useLayoutEffect` during server rendering. |
|
|
54
|
+
|
|
55
|
+
## Fixed
|
|
56
|
+
|
|
57
|
+
- The YouTube background's companion audio volume now falls back to `1` when the video's volume is unset. In 3.x the fallback never applied, because `Number(video.volume) ?? 1` ignores `NaN`.
|
|
58
|
+
|
|
59
|
+
## Components that are no longer `memo()`
|
|
60
|
+
|
|
61
|
+
These public components were wrapped in `React.memo` in 3.x and are now plain function components:
|
|
62
|
+
|
|
63
|
+
- `DockCardBanner`, `DockCardHeader`, `DockDescription`, `DockIcon`, `DockTitle` (from `./dock`)
|
|
64
|
+
- `YouTubeBackgroundPlayer` (from `./background`)
|
|
65
|
+
|
|
66
|
+
Rendering is the same. What changes:
|
|
67
|
+
|
|
68
|
+
- Their type is a function component, not `MemoExoticComponent`. Code that names the type (`typeof DockTitle` with `.type`, `MemoExoticComponent<…>`) needs updating.
|
|
69
|
+
- They re-render with their parent. The published build compiles them with the React Compiler, which skips work when props are unchanged. If you bundle the source without the compiler and relied on the memo, wrap them yourself: `const MemoTitle = memo(DockTitle)`.
|
|
70
|
+
|
|
71
|
+
## React Compiler and bundle size
|
|
72
|
+
|
|
73
|
+
The published JavaScript is built with `babel-plugin-react-compiler`. Components and hooks memoize automatically, so the source no longer carries most hand-written `useMemo`/`useCallback`/`memo`. Behaviour does not depend on the compiler: identities that effects, subscriptions, context values and public hook returns rely on stay stable in uncompiled code too.
|
|
74
|
+
|
|
75
|
+
The compiled output is larger. Total gzipped JavaScript is about 35% above the previous build (about 273 KB vs 201 KB across all entries and chunks). The compiler accounts for most of that, about 25%. Bundlers still tree-shake per entry, so an app pays only for the entries it imports.
|
package/README.md
CHANGED
|
@@ -14,16 +14,18 @@
|
|
|
14
14
|
For in-depth architecture guides and module-by-module references, explore the [`docs/`](./docs) folder:
|
|
15
15
|
|
|
16
16
|
### General Architecture Guides
|
|
17
|
+
|
|
17
18
|
- 🚀 **[Getting Started & Installation](./docs/getting-started.md)** — Step-by-step setup, Tailwind CSS v4, root layout wiring
|
|
18
19
|
- 🏛️ **[System Architecture Map](./docs/README.md)** — Macro overview, task lookup table, conventions
|
|
19
20
|
- 📐 **[Architecture & 10 Rules](./docs/architecture-and-rules.md)** — Package layer hierarchy, boundaries, decision tree
|
|
20
21
|
- 🎨 **[Theming System Guide](./docs/theming.md)** — Visual customization: defineTheme, ThemeProvider, slot reference
|
|
21
22
|
- 🧩 **[Custom Module Authoring](./docs/custom-modules.md)** — Build custom declarative modules with defineModule & usePage
|
|
22
23
|
- ⚙️ **[Core Engine Deep Dive](./docs/core-engine.md)** — CoreProvider, theme engine, event bus, pure utils & stores
|
|
23
|
-
- 🧪 **[Testing Guide](./docs/testing.md)** —
|
|
24
|
+
- 🧪 **[Testing Guide](./docs/testing.md)** — 740-test suite, test harness, happy-dom, downstream testing
|
|
24
25
|
- 🤖 **[AI Agent Blueprint (`AGENTS.md`)](./templates/AGENTS.md)** — Drop-in rules for AI coding assistants
|
|
25
26
|
|
|
26
27
|
### Module & Component Reference
|
|
28
|
+
|
|
27
29
|
- ⚡ **[Microkernel Engine (`kernel`)](./docs/modules/kernel.md)** — `usePage()`, `defineModule()`, topological registry
|
|
28
30
|
- ⚓ **[Dock Module (`dock`)](./docs/modules/dock.md)** — Floating app chrome, cards, surfaces, flows, HUD, guards
|
|
29
31
|
- 🪟 **[Modal Module (`modal`)](./docs/modules/modal.md)** — Stackable dialogs, focus trap, smooth scroll lock
|
|
@@ -47,7 +49,7 @@ For in-depth architecture guides and module-by-module references, explore the [`
|
|
|
47
49
|
- 🎯 **Single Route Declaration (`usePage`):** Cleanly declare titles, navigation cards, modals, loading states, and background media in a single atomic hook call.
|
|
48
50
|
- 🔒 **Type-Safe Result Pattern (`Result<T, E>`):** Functional, bulletproof error handling with `ok()`, `err()`, and direct feedback bridging via `toast.fromResult()`.
|
|
49
51
|
- 🛡️ **Cross-Bundle Context Deduplication:** Guarantees stable React Context singletons across Next.js split chunks and monorepo boundaries.
|
|
50
|
-
- 🎨 **
|
|
52
|
+
- 🎨 **No design inside:** no CSS, tokens or motion values. Modules and components take every class, timing and icon from your app's theme and `defineUi`.
|
|
51
53
|
|
|
52
54
|
---
|
|
53
55
|
|
|
@@ -57,7 +59,9 @@ For in-depth architecture guides and module-by-module references, explore the [`
|
|
|
57
59
|
npm install @omerdlw/base-framework motion
|
|
58
60
|
```
|
|
59
61
|
|
|
60
|
-
Ensure peer dependencies are satisfied (`next >= 15.0.0`, `react >= 19.
|
|
62
|
+
Ensure peer dependencies are satisfied (`next >= 15.0.0`, `react >= 19.2.0`, `react-dom >= 19.2.0`, `motion >= 12.0.0`).
|
|
63
|
+
|
|
64
|
+
Requires Node `>=22`. Upgrading from 3.x? See [MIGRATION.md](./MIGRATION.md).
|
|
61
65
|
|
|
62
66
|
---
|
|
63
67
|
|
|
@@ -71,13 +75,13 @@ Create your client providers component (e.g. `src/app/providers.tsx`):
|
|
|
71
75
|
"use client";
|
|
72
76
|
|
|
73
77
|
import { CoreProvider } from "@omerdlw/base-framework/provider";
|
|
74
|
-
import { dockModule } from "@omerdlw/base-framework/
|
|
75
|
-
import { modalModule } from "@omerdlw/base-framework/
|
|
76
|
-
import { notificationModule } from "@omerdlw/base-framework/
|
|
77
|
-
import { ambientModule } from "@omerdlw/base-framework/
|
|
78
|
-
import { backgroundModule } from "@omerdlw/base-framework/
|
|
79
|
-
import { loadingModule } from "@omerdlw/base-framework/
|
|
80
|
-
import { navigationModule } from "@omerdlw/base-framework/
|
|
78
|
+
import { dockModule } from "@omerdlw/base-framework/dock";
|
|
79
|
+
import { modalModule } from "@omerdlw/base-framework/modal";
|
|
80
|
+
import { notificationModule } from "@omerdlw/base-framework/notification";
|
|
81
|
+
import { ambientModule } from "@omerdlw/base-framework/ambient";
|
|
82
|
+
import { backgroundModule } from "@omerdlw/base-framework/background";
|
|
83
|
+
import { loadingModule } from "@omerdlw/base-framework/loading";
|
|
84
|
+
import { navigationModule } from "@omerdlw/base-framework/navigation";
|
|
81
85
|
|
|
82
86
|
const modules = [
|
|
83
87
|
dockModule,
|
|
@@ -100,7 +104,11 @@ Wrap your root `app/layout.tsx`:
|
|
|
100
104
|
import { Providers } from "./providers";
|
|
101
105
|
import "./globals.css";
|
|
102
106
|
|
|
103
|
-
export default function RootLayout({
|
|
107
|
+
export default function RootLayout({
|
|
108
|
+
children,
|
|
109
|
+
}: {
|
|
110
|
+
children: React.ReactNode;
|
|
111
|
+
}) {
|
|
104
112
|
return (
|
|
105
113
|
<html lang="en">
|
|
106
114
|
<body>
|
|
@@ -161,20 +169,20 @@ export default function DashboardPage() {
|
|
|
161
169
|
|
|
162
170
|
## 📚 Subpath Export Directory
|
|
163
171
|
|
|
164
|
-
| Subpath
|
|
165
|
-
|
|
|
166
|
-
| `@omerdlw/base-framework`
|
|
167
|
-
| `@omerdlw/base-framework/kernel`
|
|
168
|
-
| `@omerdlw/base-framework/provider`
|
|
169
|
-
| `@omerdlw/base-framework/result`
|
|
170
|
-
| `@omerdlw/base-framework/events`
|
|
171
|
-
| `@omerdlw/base-framework/theme`
|
|
172
|
-
| `@omerdlw/base-framework/
|
|
173
|
-
| `@omerdlw/base-framework/
|
|
174
|
-
| `@omerdlw/base-framework/utils`
|
|
175
|
-
| `@omerdlw/base-framework/hooks`
|
|
176
|
-
| `@omerdlw/base-framework/error`
|
|
177
|
-
| `@omerdlw/base-framework
|
|
172
|
+
| Subpath | Purpose & Key Exports |
|
|
173
|
+
| :--------------------------------- | :--------------------------------------------------------------------------------------- |
|
|
174
|
+
| `@omerdlw/base-framework` | Root exports of all sub-systems |
|
|
175
|
+
| `@omerdlw/base-framework/kernel` | `usePage`, `defineModule`, `definePeer`, `ModuleHost`, `getOrCreateGlobalContext` |
|
|
176
|
+
| `@omerdlw/base-framework/provider` | `CoreProvider` composition pipeline |
|
|
177
|
+
| `@omerdlw/base-framework/result` | `ok()`, `err()`, `isResult()`, `type Result<T, E>` |
|
|
178
|
+
| `@omerdlw/base-framework/events` | Decoupled event bus (`globalEvents`, `EVENT_TYPES`) |
|
|
179
|
+
| `@omerdlw/base-framework/theme` | `ThemeProvider`, `useTheme`, `defineThemeSpec` |
|
|
180
|
+
| `@omerdlw/base-framework/ui` | Unstyled components the app gives a look (`Button`, `Icon`, `Select`, …) |
|
|
181
|
+
| `@omerdlw/base-framework/recipes` | Server-safe `defineUi`, recipes, `cn`, `createCn`, `ANATOMY` |
|
|
182
|
+
| `@omerdlw/base-framework/utils` | Pure utilities (`report`, `createStore`, `createScheduler`, `defineMotion`) |
|
|
183
|
+
| `@omerdlw/base-framework/hooks` | Essential hooks (`useClickOutside`, `useGlobalEvent`, `useStore`) |
|
|
184
|
+
| `@omerdlw/base-framework/error` | Error boundaries (`GlobalError`, `ModuleError`, `ComponentError`) and `getErrorReporter` |
|
|
185
|
+
| `@omerdlw/base-framework/<module>` | 10 standalone modules (`dock`, `modal`, `notification`, `navigation`, etc.) |
|
|
178
186
|
|
|
179
187
|
---
|
|
180
188
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../modules/ambient/index.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
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 } from '../chunk-QMFV53PP.js';
|
|
3
|
+
import '../chunk-TUUGWQY5.js';
|
|
4
|
+
import '../chunk-WXEOP6Z4.js';
|
|
5
|
+
import '../chunk-NHOJWICA.js';
|
|
6
|
+
import '../chunk-Y2Q74PJP.js';
|
|
7
|
+
import '../chunk-CT4UILO2.js';
|
|
8
|
+
import '../chunk-7RSRDKYE.js';
|
|
9
|
+
import '../chunk-ESD5EQ5H.js';
|
|
10
|
+
import '../chunk-5H6FZW3N.js';
|
|
11
|
+
import '../chunk-J3VTDBC6.js';
|
|
12
|
+
import '../chunk-BMFHS3GV.js';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../modules/ambient/server/index.js";
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { resolveAnalysis, analyzeAmbientPixels } from '../../chunk-2LGI33JP.js';
|
|
2
|
+
export { AMBIENT_ANALYSIS_VERSION, analyzeAmbientPixels, configureAmbient, contrastRatio, findContentBounds, fitSample, formatOklch, getAmbientSettings, maxChroma, onColorFor, srgbToOklab, toneOf } from '../../chunk-2LGI33JP.js';
|
|
3
|
+
|
|
4
|
+
// src/modules/ambient/server/address.ts
|
|
5
|
+
var PRIVATE_NAMES = /(^|\.)(localhost|local|internal|intranet|lan|home\.arpa|localdomain)$/;
|
|
6
|
+
function normalizeHost(hostname) {
|
|
7
|
+
return hostname.toLowerCase().replace(/\.+$/, "").replace(/^\[|\]$/g, "");
|
|
8
|
+
}
|
|
9
|
+
function parseIPv4(value) {
|
|
10
|
+
const parts = value.split(".");
|
|
11
|
+
if (parts.length !== 4) return null;
|
|
12
|
+
const bytes = parts.map((part) => /^\d{1,3}$/.test(part) ? Number(part) : NaN);
|
|
13
|
+
return bytes.every((byte) => byte >= 0 && byte <= 255) ? bytes : null;
|
|
14
|
+
}
|
|
15
|
+
function isPrivateIPv4([a, b, c]) {
|
|
16
|
+
return a === 0 || a === 10 || a === 127 || a === 100 && b >= 64 && b <= 127 || a === 169 && b === 254 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168 || a === 192 && b === 0 && c === 0 || a === 198 && (b === 18 || b === 19) || a >= 224;
|
|
17
|
+
}
|
|
18
|
+
function parseIPv6(value) {
|
|
19
|
+
let text = value.split("%")[0];
|
|
20
|
+
const tail = /^(.*:)(\d+\.\d+\.\d+\.\d+)$/.exec(text);
|
|
21
|
+
if (tail) {
|
|
22
|
+
const v4 = parseIPv4(tail[2]);
|
|
23
|
+
if (!v4) return null;
|
|
24
|
+
text = `${tail[1]}${(v4[0] << 8 | v4[1]).toString(16)}:${(v4[2] << 8 | v4[3]).toString(16)}`;
|
|
25
|
+
}
|
|
26
|
+
const halves = text.split("::");
|
|
27
|
+
if (halves.length > 2) return null;
|
|
28
|
+
const read = (part) => part ? part.split(":") : [];
|
|
29
|
+
const head = read(halves[0]);
|
|
30
|
+
const rest = halves.length === 2 ? read(halves[1]) : [];
|
|
31
|
+
const missing = 8 - head.length - rest.length;
|
|
32
|
+
if (halves.length === 1 ? missing !== 0 : missing < 1) return null;
|
|
33
|
+
const groups = [...head, ...Array(halves.length === 2 ? missing : 0).fill("0"), ...rest];
|
|
34
|
+
const words = groups.map((group) => /^[0-9a-f]{1,4}$/.test(group) ? parseInt(group, 16) : NaN);
|
|
35
|
+
return words.length === 8 && words.every((word) => word >= 0) ? words : null;
|
|
36
|
+
}
|
|
37
|
+
function isPrivateIPv6(words) {
|
|
38
|
+
const [w0, w1, w2, w3, w4, w5, w6, w7] = words;
|
|
39
|
+
const embedded = () => [w6 >> 8, w6 & 255, w7 >> 8, w7 & 255];
|
|
40
|
+
if (words.slice(0, 7).every((word) => word === 0)) return w7 <= 1;
|
|
41
|
+
if (w0 === 0 && w1 === 0 && w2 === 0 && w3 === 0 && w4 === 0 && (w5 === 65535 || w5 === 0)) {
|
|
42
|
+
return isPrivateIPv4(embedded());
|
|
43
|
+
}
|
|
44
|
+
if (w0 === 100 && w1 === 65435) return isPrivateIPv4(embedded());
|
|
45
|
+
if (w0 === 8194) return isPrivateIPv4([w1 >> 8, w1 & 255, w2 >> 8, w2 & 255]);
|
|
46
|
+
return (w0 & 65024) === 64512 || (w0 & 65472) === 65152 || (w0 & 65280) === 65280 || w0 === 8193 && w1 === 3512;
|
|
47
|
+
}
|
|
48
|
+
function isPrivateAddress(address) {
|
|
49
|
+
const host = normalizeHost(address);
|
|
50
|
+
const v4 = parseIPv4(host);
|
|
51
|
+
if (v4) return isPrivateIPv4(v4);
|
|
52
|
+
const v6 = parseIPv6(host);
|
|
53
|
+
return v6 ? isPrivateIPv6(v6) : false;
|
|
54
|
+
}
|
|
55
|
+
var isIpLiteral = (hostname) => {
|
|
56
|
+
const host = normalizeHost(hostname);
|
|
57
|
+
return parseIPv4(host) !== null || parseIPv6(host) !== null;
|
|
58
|
+
};
|
|
59
|
+
function isPrivateHostname(hostname) {
|
|
60
|
+
const host = normalizeHost(hostname);
|
|
61
|
+
if (!host) return true;
|
|
62
|
+
if (isIpLiteral(host)) return isPrivateAddress(host);
|
|
63
|
+
return PRIVATE_NAMES.test(host) || !host.includes(".");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// src/modules/ambient/server/index.ts
|
|
67
|
+
var MAX_BYTES = 12 * 1024 * 1024;
|
|
68
|
+
var TIMEOUT_MS = 8e3;
|
|
69
|
+
var CACHE_LIMIT = 500;
|
|
70
|
+
var MAX_REDIRECTS = 5;
|
|
71
|
+
var REDIRECT_STATUS_MIN = 300;
|
|
72
|
+
var REDIRECT_STATUS_MAX = 400;
|
|
73
|
+
function isPublicImageUrl(url) {
|
|
74
|
+
return (url.protocol === "https:" || url.protocol === "http:") && !url.username && !url.password && !isPrivateHostname(url.hostname);
|
|
75
|
+
}
|
|
76
|
+
async function lookupAll(hostname) {
|
|
77
|
+
const {
|
|
78
|
+
lookup
|
|
79
|
+
} = await import('dns/promises');
|
|
80
|
+
return (await lookup(hostname, {
|
|
81
|
+
all: true,
|
|
82
|
+
verbatim: true
|
|
83
|
+
})).map((entry) => entry.address);
|
|
84
|
+
}
|
|
85
|
+
async function reachesOnlyPublic(url, resolve) {
|
|
86
|
+
if (resolve === false) return true;
|
|
87
|
+
const host = normalizeHost(url.hostname);
|
|
88
|
+
try {
|
|
89
|
+
const addresses = isIpLiteral(host) ? [host] : await (resolve ?? lookupAll)(host);
|
|
90
|
+
return addresses.length > 0 && !addresses.some(isPrivateAddress);
|
|
91
|
+
} catch {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
var AmbientDecoderMissingError = class extends Error {
|
|
96
|
+
name = "AmbientDecoderMissingError";
|
|
97
|
+
};
|
|
98
|
+
var sharpModule = null;
|
|
99
|
+
var SHARP = "sharp";
|
|
100
|
+
function loadSharp() {
|
|
101
|
+
sharpModule ??= import(
|
|
102
|
+
/* webpackIgnore: true */
|
|
103
|
+
/* turbopackIgnore: true */
|
|
104
|
+
SHARP
|
|
105
|
+
).then((mod) => mod.default ?? mod).catch((error) => {
|
|
106
|
+
sharpModule = null;
|
|
107
|
+
throw new AmbientDecoderMissingError("ambient/server: `sharp` is not installed. Install it or pass `decode`.", {
|
|
108
|
+
cause: error
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
return sharpModule;
|
|
112
|
+
}
|
|
113
|
+
var sharpDecoder = async (bytes, size) => {
|
|
114
|
+
const sharp = await loadSharp();
|
|
115
|
+
const {
|
|
116
|
+
data,
|
|
117
|
+
info
|
|
118
|
+
} = await sharp(bytes, {
|
|
119
|
+
failOn: "none"
|
|
120
|
+
}).rotate().resize(size, size, {
|
|
121
|
+
fit: "inside",
|
|
122
|
+
withoutEnlargement: true
|
|
123
|
+
}).ensureAlpha().raw().toBuffer({
|
|
124
|
+
resolveWithObject: true
|
|
125
|
+
});
|
|
126
|
+
return {
|
|
127
|
+
data,
|
|
128
|
+
height: info.height,
|
|
129
|
+
width: info.width
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
async function readLimited(response, maxBytes) {
|
|
133
|
+
const declared = Number(response.headers.get("content-length"));
|
|
134
|
+
if (declared > maxBytes) throw new Error("ambient/server: image too large");
|
|
135
|
+
if (!response.body) return new Uint8Array(await response.arrayBuffer());
|
|
136
|
+
const reader = response.body.getReader();
|
|
137
|
+
const chunks = [];
|
|
138
|
+
let length = 0;
|
|
139
|
+
for (; ; ) {
|
|
140
|
+
const {
|
|
141
|
+
done,
|
|
142
|
+
value
|
|
143
|
+
} = await reader.read();
|
|
144
|
+
if (done) break;
|
|
145
|
+
length += value.byteLength;
|
|
146
|
+
if (length > maxBytes) {
|
|
147
|
+
await reader.cancel();
|
|
148
|
+
throw new Error("ambient/server: image too large");
|
|
149
|
+
}
|
|
150
|
+
chunks.push(value);
|
|
151
|
+
}
|
|
152
|
+
const bytes = new Uint8Array(length);
|
|
153
|
+
let offset = 0;
|
|
154
|
+
for (const chunk of chunks) {
|
|
155
|
+
bytes.set(chunk, offset);
|
|
156
|
+
offset += chunk.byteLength;
|
|
157
|
+
}
|
|
158
|
+
return bytes;
|
|
159
|
+
}
|
|
160
|
+
async function extractAmbientPaletteFromBytes(bytes, options = {}) {
|
|
161
|
+
const analysis = resolveAnalysis(options.analysis);
|
|
162
|
+
const pixels = await (options.decode ?? sharpDecoder)(bytes, analysis.sampleSize);
|
|
163
|
+
return analyzeAmbientPixels(pixels, analysis);
|
|
164
|
+
}
|
|
165
|
+
var cache = /* @__PURE__ */ new Map();
|
|
166
|
+
var inFlight = /* @__PURE__ */ new Map();
|
|
167
|
+
function remember(key, palette) {
|
|
168
|
+
cache.delete(key);
|
|
169
|
+
while (cache.size >= CACHE_LIMIT) {
|
|
170
|
+
const oldest = cache.keys().next().value;
|
|
171
|
+
if (oldest === void 0) break;
|
|
172
|
+
cache.delete(oldest);
|
|
173
|
+
}
|
|
174
|
+
cache.set(key, palette);
|
|
175
|
+
}
|
|
176
|
+
async function fetchAndExtract(url, options) {
|
|
177
|
+
const allow = options.allow ?? isPublicImageUrl;
|
|
178
|
+
const doFetch = options.fetch ?? fetch;
|
|
179
|
+
const signal = AbortSignal.timeout(options.timeoutMs ?? TIMEOUT_MS);
|
|
180
|
+
let current = url;
|
|
181
|
+
for (let hop = 0; hop <= MAX_REDIRECTS; hop++) {
|
|
182
|
+
if (!allow(current)) return null;
|
|
183
|
+
if (!await reachesOnlyPublic(current, options.resolve)) return null;
|
|
184
|
+
const response = await doFetch(current, {
|
|
185
|
+
...options.init,
|
|
186
|
+
redirect: "manual",
|
|
187
|
+
signal
|
|
188
|
+
});
|
|
189
|
+
if (response.status >= REDIRECT_STATUS_MIN && response.status < REDIRECT_STATUS_MAX) {
|
|
190
|
+
const location = response.headers.get("location");
|
|
191
|
+
await response.body?.cancel();
|
|
192
|
+
if (!location) return null;
|
|
193
|
+
current = new URL(location, current);
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
if (!response.ok) return null;
|
|
197
|
+
const type = response.headers.get("content-type") ?? "";
|
|
198
|
+
if (type && !type.toLowerCase().startsWith("image/")) return null;
|
|
199
|
+
const bytes = await readLimited(response, options.maxBytes ?? MAX_BYTES);
|
|
200
|
+
const palette = await extractAmbientPaletteFromBytes(bytes, options);
|
|
201
|
+
return {
|
|
202
|
+
...palette,
|
|
203
|
+
source: url.href
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
async function extractAmbientPalette(src, options = {}) {
|
|
209
|
+
let url;
|
|
210
|
+
try {
|
|
211
|
+
url = new URL(src);
|
|
212
|
+
} catch {
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
const useCache = options.cache !== false;
|
|
216
|
+
const key = options.analysis ? `${url.href}#${JSON.stringify(options.analysis)}` : url.href;
|
|
217
|
+
if (useCache) {
|
|
218
|
+
const hit = cache.get(key);
|
|
219
|
+
if (hit) return hit;
|
|
220
|
+
const pending = inFlight.get(key);
|
|
221
|
+
if (pending) return pending;
|
|
222
|
+
}
|
|
223
|
+
const task = fetchAndExtract(url, options).catch((error) => {
|
|
224
|
+
if (error instanceof AmbientDecoderMissingError) throw error;
|
|
225
|
+
return null;
|
|
226
|
+
});
|
|
227
|
+
if (!useCache) return task;
|
|
228
|
+
const shared = task.then((palette) => {
|
|
229
|
+
if (palette) remember(key, palette);
|
|
230
|
+
return palette;
|
|
231
|
+
}).finally(() => inFlight.delete(key));
|
|
232
|
+
inFlight.set(key, shared);
|
|
233
|
+
return shared;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export { AmbientDecoderMissingError, extractAmbientPalette, extractAmbientPaletteFromBytes, isPrivateAddress, isPrivateHostname, isPublicImageUrl, sharpDecoder };
|
|
237
|
+
//# sourceMappingURL=index.js.map
|
|
238
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/modules/ambient/server/address.ts","../../../src/modules/ambient/server/index.ts"],"names":["PRIVATE_NAMES","normalizeHost","hostname","toLowerCase","replace","parseIPv4","value","parts","split","length","bytes","map","part","test","Number","NaN","every","byte","isPrivateIPv4","a","b","c","parseIPv6","text","tail","exec","v4","toString","halves","read","head","rest","missing","groups","Array","fill","words","group","parseInt","word","isPrivateIPv6","w0","w1","w2","w3","w4","w5","w6","w7","embedded","slice","isPrivateAddress","address","host","v6","isIpLiteral","isPrivateHostname","includes","MAX_BYTES","TIMEOUT_MS","CACHE_LIMIT","MAX_REDIRECTS","REDIRECT_STATUS_MIN","REDIRECT_STATUS_MAX","isPublicImageUrl","url","protocol","username","password","lookupAll","lookup","all","verbatim","entry","reachesOnlyPublic","resolve","addresses","some","AmbientDecoderMissingError","Error","name","sharpModule","SHARP","loadSharp","then","mod","default","catch","error","cause","sharpDecoder","size","sharp","data","info","failOn","rotate","resize","fit","withoutEnlargement","ensureAlpha","raw","toBuffer","resolveWithObject","height","width","readLimited","response","maxBytes","declared","headers","get","body","Uint8Array","arrayBuffer","reader","getReader","chunks","done","byteLength","cancel","push","offset","chunk","set","extractAmbientPaletteFromBytes","options","analysis","resolveAnalysis","pixels","decode","sampleSize","analyzeAmbientPixels","cache","Map","inFlight","remember","key","palette","delete","oldest","keys","next","undefined","fetchAndExtract","allow","doFetch","fetch","signal","AbortSignal","timeout","timeoutMs","current","hop","init","redirect","status","location","URL","ok","type","startsWith","source","href","extractAmbientPalette","src","useCache","JSON","stringify","hit","pending","task","shared","finally"],"mappings":";;;;AAAA,IAAMA,aAAAA,GACJ,uEAAA;AAEK,SAASC,cAAcC,QAAAA,EAA0B;AACtD,EAAA,OAAOA,QAAAA,CACJC,aAAY,CACZC,OAAAA,CAAQ,QAAQ,EAAE,CAAA,CAClBA,OAAAA,CAAQ,UAAA,EAAY,EAAE,CAAA;AAC3B;AAEA,SAASC,UAAUC,KAAAA,EAAgC;AACjD,EAAA,MAAMC,KAAAA,GAAQD,KAAAA,CAAME,KAAAA,CAAM,GAAG,CAAA;AAC7B,EAAA,IAAID,KAAAA,CAAME,MAAAA,KAAW,CAAA,EAAG,OAAO,IAAA;AAC/B,EAAA,MAAMC,KAAAA,GAAQH,KAAAA,CAAMI,GAAAA,CAAKC,CAAAA,IAAAA,KACvB,WAAA,CAAYC,IAAAA,CAAKD,IAAI,CAAA,GAAIE,MAAAA,CAAOF,IAAI,CAAA,GAAIG,GAC1C,CAAA;AACA,EAAA,OAAOL,KAAAA,CAAMM,MAAOC,CAAAA,IAAAA,KAASA,IAAAA,IAAQ,KAAKA,IAAAA,IAAQ,GAAG,IAAIP,KAAAA,GAAQ,IAAA;AACnE;AAEA,SAASQ,aAAAA,CAAc,CAACC,CAAAA,EAAGC,CAAAA,EAAGC,CAAC,CAAA,EAAsB;AACnD,EAAA,OACEF,MAAM,CAAA,IACNA,CAAAA,KAAM,EAAA,IACNA,CAAAA,KAAM,OACLA,CAAAA,KAAM,GAAA,IAAOC,CAAAA,IAAK,EAAA,IAAMA,KAAK,GAAA,IAC7BD,CAAAA,KAAM,OAAOC,CAAAA,KA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B,GAAG,CAAA;AACzB,IAAA,IAAIgC,KAAK,OAAOA,GAAAA;AAChB,IAAA,MAAMC,OAAAA,GAAUnC,QAAAA,CAASxB,GAAAA,CAAI0B,GAAG,CAAA;AAChC,IAAA,IAAIiC,SAAS,OAAOA,OAAAA;AACtB,EAAA;AAEA,EAAA,MAAMC,OAAO3B,eAAAA,CAAgB/E,GAAAA,EAAK6D,OAAO,CAAA,CAAEvC,MAAOC,CAAAA,KAAAA,KAAmB;AACnE,IAAA,IAAIA,KAAAA,YAAiBV,4BAA4B,MAAMU,KAAAA;AACvD,IAAA,OAAO,IAAA;EACT,CAAC,CAAA;AACD,EAAA,IAAI,CAAC8E,UAAU,OAAOK,IAAAA;AAEtB,EAAA,MAAMC,MAAAA,GAASD,IAAAA,CACZvF,IAAAA,CAAMsD,CAAAA,OAAAA,KAAY;AACjB,IAAA,IAAIA,OAAAA,EAASF,QAAAA,CAASC,GAAAA,EAAKC,OAAO,CAAA;AAClC,IAAA,OAAOA,OAAAA;AACT,EAAA,CAAC,EACAmC,OAAAA,CAAQ,MAAMtC,QAAAA,CAASI,MAAAA,CAAOF,GAAG,CAAC,CAAA;AACrCF,EAAAA,QAAAA,CAASX,GAAAA,CAAIa,KAAKmC,MAAM,CAAA;AACxB,EAAA,OAAOA,MAAAA;AACT","file":"index.js","sourcesContent":["const PRIVATE_NAMES =\n /(^|\\.)(localhost|local|internal|intranet|lan|home\\.arpa|localdomain)$/;\n\nexport function normalizeHost(hostname: string): string {\n return hostname\n .toLowerCase()\n .replace(/\\.+$/, \"\")\n .replace(/^\\[|\\]$/g, \"\");\n}\n\nfunction parseIPv4(value: string): number[] | null {\n const parts = value.split(\".\");\n if (parts.length !== 4) return null;\n const bytes = parts.map((part) =>\n /^\\d{1,3}$/.test(part) ? Number(part) : NaN,\n );\n return bytes.every((byte) => byte >= 0 && byte <= 255) ? bytes : null;\n}\n\nfunction isPrivateIPv4([a, b, c]: number[]): boolean {\n return (\n a === 0 ||\n a === 10 ||\n a === 127 ||\n (a === 100 && b >= 64 && b <= 127) ||\n (a === 169 && b === 254) ||\n (a === 172 && b >= 16 && b <= 31) ||\n (a === 192 && b === 168) ||\n (a === 192 && b === 0 && c === 0) ||\n (a === 198 && (b === 18 || b === 19)) ||\n a >= 224\n );\n}\n\nfunction parseIPv6(value: string): number[] | null {\n let text = value.split(\"%\")[0];\n const tail = /^(.*:)(\\d+\\.\\d+\\.\\d+\\.\\d+)$/.exec(text);\n if (tail) {\n const v4 = parseIPv4(tail[2]);\n if (!v4) return null;\n text = `${tail[1]}${((v4[0] << 8) | v4[1]).toString(16)}:${((v4[2] << 8) | v4[3]).toString(16)}`;\n }\n const halves = text.split(\"::\");\n if (halves.length > 2) return null;\n const read = (part: string) => (part ? part.split(\":\") : []);\n const head = read(halves[0]);\n const rest = halves.length === 2 ? read(halves[1]) : [];\n const missing = 8 - head.length - rest.length;\n if (halves.length === 1 ? missing !== 0 : missing < 1) return null;\n const groups = [\n ...head,\n ...Array<string>(halves.length === 2 ? missing : 0).fill(\"0\"),\n ...rest,\n ];\n const words = groups.map((group) =>\n /^[0-9a-f]{1,4}$/.test(group) ? parseInt(group, 16) : NaN,\n );\n return words.length === 8 && words.every((word) => word >= 0) ? words : null;\n}\n\nfunction isPrivateIPv6(words: number[]): boolean {\n const [w0, w1, w2, w3, w4, w5, w6, w7] = words;\n const embedded = () => [w6 >> 8, w6 & 255, w7 >> 8, w7 & 255];\n if (words.slice(0, 7).every((word) => word === 0)) return w7 <= 1;\n if (\n w0 === 0 &&\n w1 === 0 &&\n w2 === 0 &&\n w3 === 0 &&\n w4 === 0 &&\n (w5 === 0xffff || w5 === 0)\n ) {\n return isPrivateIPv4(embedded());\n }\n if (w0 === 0x64 && w1 === 0xff9b) return isPrivateIPv4(embedded());\n if (w0 === 0x2002)\n return isPrivateIPv4([w1 >> 8, w1 & 255, w2 >> 8, w2 & 255]);\n return (\n (w0 & 0xfe00) === 0xfc00 ||\n (w0 & 0xffc0) === 0xfe80 ||\n (w0 & 0xff00) === 0xff00 ||\n (w0 === 0x2001 && w1 === 0xdb8)\n );\n}\n\n/**\n * Whether an IP address is loopback, private, link-local or otherwise not\n * publicly routable.\n */\nexport function isPrivateAddress(address: string): boolean {\n const host = normalizeHost(address);\n const v4 = parseIPv4(host);\n if (v4) return isPrivateIPv4(v4);\n const v6 = parseIPv6(host);\n return v6 ? isPrivateIPv6(v6) : false;\n}\n\nexport const isIpLiteral = (hostname: string) => {\n const host = normalizeHost(hostname);\n return parseIPv4(host) !== null || parseIPv6(host) !== null;\n};\n\n/**\n * Whether a hostname is an IP literal or local name that points at a private\n * network.\n */\nexport function isPrivateHostname(hostname: string): boolean {\n const host = normalizeHost(hostname);\n if (!host) return true;\n if (isIpLiteral(host)) return isPrivateAddress(host);\n return PRIVATE_NAMES.test(host) || !host.includes(\".\");\n}\n","import { analyzeAmbientPixels } from \"../analyze\";\nimport { resolveAnalysis } from \"../settings\";\nimport type {\n AmbientAnalysisOptions,\n AmbientPalette,\n AmbientPixels,\n} from \"../types\";\nimport {\n isIpLiteral,\n isPrivateAddress,\n isPrivateHostname,\n normalizeHost,\n} from \"./address\";\n\nexport {\n AMBIENT_ANALYSIS_VERSION,\n analyzeAmbientPixels,\n findContentBounds,\n fitSample,\n} from \"../analyze\";\nexport { isPrivateAddress, isPrivateHostname } from \"./address\";\nexport { configureAmbient, getAmbientSettings } from \"../settings\";\nexport {\n contrastRatio,\n formatOklch,\n maxChroma,\n onColorFor,\n srgbToOklab,\n toneOf,\n} from \"../oklab\";\nexport type * from \"../types\";\n\n/**\n * Turns image bytes into RGBA pixels no larger than `size`.\n */\nexport type AmbientDecoder = (\n bytes: Uint8Array,\n size: number,\n) => Promise<AmbientPixels>;\n\n/**\n * Options for server-side palette extraction: fetching, limits, SSRF checks and\n * caching.\n */\nexport interface AmbientServerOptions {\n analysis?: Partial<AmbientAnalysisOptions>;\n allow?: (url: URL) => boolean;\n cache?: boolean;\n decode?: AmbientDecoder;\n fetch?: typeof fetch;\n init?: RequestInit;\n maxBytes?: number;\n resolve?: ((hostname: string) => Promise<string[]>) | false;\n timeoutMs?: number;\n}\n\nconst MAX_BYTES = 12 * 1024 * 1024;\nconst TIMEOUT_MS = 8_000;\nconst CACHE_LIMIT = 500;\nconst MAX_REDIRECTS = 5;\nconst REDIRECT_STATUS_MIN = 300;\nconst REDIRECT_STATUS_MAX = 400;\n\n/**\n * Whether a URL is plain http(s) without credentials and not on a private\n * hostname.\n */\nexport function isPublicImageUrl(url: URL): boolean {\n return (\n (url.protocol === \"https:\" || url.protocol === \"http:\") &&\n !url.username &&\n !url.password &&\n !isPrivateHostname(url.hostname)\n );\n}\n\nasync function lookupAll(hostname: string): Promise<string[]> {\n const { lookup } = await import(\"node:dns/promises\");\n return (await lookup(hostname, { all: true, verbatim: true })).map(\n (entry) => entry.address,\n );\n}\n\nasync function reachesOnlyPublic(\n url: URL,\n resolve: AmbientServerOptions[\"resolve\"],\n): Promise<boolean> {\n if (resolve === false) return true;\n const host = normalizeHost(url.hostname);\n try {\n const addresses = isIpLiteral(host)\n ? [host]\n : await (resolve ?? lookupAll)(host);\n return addresses.length > 0 && !addresses.some(isPrivateAddress);\n } catch {\n return false;\n }\n}\n\ntype SharpLike = (\n input: Uint8Array,\n options?: Record<string, unknown>,\n) => SharpPipeline;\ninterface SharpPipeline {\n ensureAlpha(): SharpPipeline;\n raw(): SharpPipeline;\n resize(\n width: number,\n height: number,\n options: Record<string, unknown>,\n ): SharpPipeline;\n rotate(): SharpPipeline;\n toBuffer(options: { resolveWithObject: true }): Promise<{\n data: Uint8Array;\n info: { height: number; width: number };\n }>;\n}\n\n/**\n * Thrown when no decoder is passed and `sharp` is not installed.\n */\nexport class AmbientDecoderMissingError extends Error {\n override name = \"AmbientDecoderMissingError\";\n}\n\nlet sharpModule: Promise<SharpLike> | null = null;\nconst SHARP = \"sharp\";\n\nfunction loadSharp(): Promise<SharpLike> {\n sharpModule ??= import(\n /* webpackIgnore: true */ /* turbopackIgnore: true */ SHARP\n )\n .then((mod: { default?: SharpLike }) => (mod.default ?? mod) as SharpLike)\n .catch((error: unknown) => {\n sharpModule = null;\n throw new AmbientDecoderMissingError(\n \"ambient/server: `sharp` is not installed. Install it or pass `decode`.\",\n { cause: error },\n );\n });\n return sharpModule;\n}\n\n/**\n * Default decoder, backed by `sharp`.\n */\nexport const sharpDecoder: AmbientDecoder = async (bytes, size) => {\n const sharp = await loadSharp();\n const { data, info } = await sharp(bytes, { failOn: \"none\" })\n .rotate()\n .resize(size, size, { fit: \"inside\", withoutEnlargement: true })\n .ensureAlpha()\n .raw()\n .toBuffer({ resolveWithObject: true });\n return { data, height: info.height, width: info.width };\n};\n\nasync function readLimited(\n response: Response,\n maxBytes: number,\n): Promise<Uint8Array> {\n const declared = Number(response.headers.get(\"content-length\"));\n if (declared > maxBytes) throw new Error(\"ambient/server: image too large\");\n if (!response.body) return new Uint8Array(await response.arrayBuffer());\n\n const reader = response.body.getReader();\n const chunks: Uint8Array[] = [];\n let length = 0;\n for (;;) {\n const { done, value } = await reader.read();\n if (done) break;\n length += value.byteLength;\n if (length > maxBytes) {\n await reader.cancel();\n throw new Error(\"ambient/server: image too large\");\n }\n chunks.push(value);\n }\n const bytes = new Uint8Array(length);\n let offset = 0;\n for (const chunk of chunks) {\n bytes.set(chunk, offset);\n offset += chunk.byteLength;\n }\n return bytes;\n}\n\n/**\n * Extracts a palette from encoded image bytes.\n */\nexport async function extractAmbientPaletteFromBytes(\n bytes: Uint8Array,\n options: Pick<AmbientServerOptions, \"analysis\" | \"decode\"> = {},\n): Promise<AmbientPalette> {\n const analysis = resolveAnalysis(options.analysis);\n const pixels = await (options.decode ?? sharpDecoder)(\n bytes,\n analysis.sampleSize,\n );\n return analyzeAmbientPixels(pixels, analysis);\n}\n\nconst cache = new Map<string, AmbientPalette>();\nconst inFlight = new Map<string, Promise<AmbientPalette | null>>();\n\nfunction remember(key: string, palette: AmbientPalette): void {\n cache.delete(key);\n while (cache.size >= CACHE_LIMIT) {\n const oldest = cache.keys().next().value;\n if (oldest === undefined) break;\n cache.delete(oldest);\n }\n cache.set(key, palette);\n}\n\nasync function fetchAndExtract(\n url: URL,\n options: AmbientServerOptions,\n): Promise<AmbientPalette | null> {\n const allow = options.allow ?? isPublicImageUrl;\n const doFetch = options.fetch ?? fetch;\n const signal = AbortSignal.timeout(options.timeoutMs ?? TIMEOUT_MS);\n\n let current = url;\n for (let hop = 0; hop <= MAX_REDIRECTS; hop++) {\n if (!allow(current)) return null;\n if (!(await reachesOnlyPublic(current, options.resolve))) return null;\n const response = await doFetch(current, {\n ...options.init,\n redirect: \"manual\",\n signal,\n });\n if (\n response.status >= REDIRECT_STATUS_MIN &&\n response.status < REDIRECT_STATUS_MAX\n ) {\n const location = response.headers.get(\"location\");\n await response.body?.cancel();\n if (!location) return null;\n current = new URL(location, current);\n continue;\n }\n if (!response.ok) return null;\n const type = response.headers.get(\"content-type\") ?? \"\";\n if (type && !type.toLowerCase().startsWith(\"image/\")) return null;\n const bytes = await readLimited(response, options.maxBytes ?? MAX_BYTES);\n const palette = await extractAmbientPaletteFromBytes(bytes, options);\n return { ...palette, source: url.href };\n }\n return null;\n}\n\n/**\n * Downloads an image and extracts its palette, or returns null when the URL is\n * unsafe or the download fails. Results are cached.\n */\nexport async function extractAmbientPalette(\n src: string | URL,\n options: AmbientServerOptions = {},\n): Promise<AmbientPalette | null> {\n let url: URL;\n try {\n url = new URL(src);\n } catch {\n return null;\n }\n const useCache = options.cache !== false;\n const key = options.analysis\n ? `${url.href}#${JSON.stringify(options.analysis)}`\n : url.href;\n if (useCache) {\n const hit = cache.get(key);\n if (hit) return hit;\n const pending = inFlight.get(key);\n if (pending) return pending;\n }\n\n const task = fetchAndExtract(url, options).catch((error: unknown) => {\n if (error instanceof AmbientDecoderMissingError) throw error;\n return null;\n });\n if (!useCache) return task;\n\n const shared = task\n .then((palette) => {\n if (palette) remember(key, palette);\n return palette;\n })\n .finally(() => inFlight.delete(key));\n inFlight.set(key, shared);\n return shared;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../modules/ambient/worker/index.js";
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { analyzeAmbientPixels, fitSample } from '../../chunk-2LGI33JP.js';
|
|
2
|
+
|
|
3
|
+
// src/modules/ambient/pipeline.ts
|
|
4
|
+
async function fetchImageBlob(src, proxyUrl) {
|
|
5
|
+
if (typeof fetch !== "function") return null;
|
|
6
|
+
const read = async (url, init) => {
|
|
7
|
+
const response = await fetch(url, {
|
|
8
|
+
...init,
|
|
9
|
+
mode: "cors"
|
|
10
|
+
});
|
|
11
|
+
if (!response.ok) return null;
|
|
12
|
+
const blob = await response.blob();
|
|
13
|
+
return blob.type.startsWith("text/") ? null : blob;
|
|
14
|
+
};
|
|
15
|
+
try {
|
|
16
|
+
const blob = await read(src);
|
|
17
|
+
if (blob) return blob;
|
|
18
|
+
} catch {
|
|
19
|
+
if (isCrossOrigin(src)) {
|
|
20
|
+
try {
|
|
21
|
+
const blob = await read(src, {
|
|
22
|
+
cache: "reload"
|
|
23
|
+
});
|
|
24
|
+
if (blob) return blob;
|
|
25
|
+
} catch {
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (proxyUrl) {
|
|
30
|
+
try {
|
|
31
|
+
return await read(proxyUrl);
|
|
32
|
+
} catch {
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
function isCrossOrigin(url) {
|
|
38
|
+
try {
|
|
39
|
+
return new URL(url).origin !== globalThis.location?.origin;
|
|
40
|
+
} catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function createContext2D(width, height) {
|
|
45
|
+
if (typeof OffscreenCanvas === "function") {
|
|
46
|
+
return new OffscreenCanvas(width, height).getContext("2d", {
|
|
47
|
+
willReadFrequently: true
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (typeof document !== "undefined") {
|
|
51
|
+
const canvas = document.createElement("canvas");
|
|
52
|
+
canvas.width = width;
|
|
53
|
+
canvas.height = height;
|
|
54
|
+
return canvas.getContext("2d", {
|
|
55
|
+
willReadFrequently: true
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
function readPixels(image, sourceWidth, sourceHeight, size) {
|
|
61
|
+
const {
|
|
62
|
+
height,
|
|
63
|
+
width
|
|
64
|
+
} = fitSample(sourceWidth, sourceHeight, size);
|
|
65
|
+
const context = createContext2D(width, height);
|
|
66
|
+
if (!context) return null;
|
|
67
|
+
context.drawImage(image, 0, 0, width, height);
|
|
68
|
+
return {
|
|
69
|
+
data: context.getImageData(0, 0, width, height).data,
|
|
70
|
+
height,
|
|
71
|
+
width
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
async function decodeBlob(blob, size) {
|
|
75
|
+
if (typeof createImageBitmap !== "function") return null;
|
|
76
|
+
let bitmap;
|
|
77
|
+
try {
|
|
78
|
+
bitmap = await createImageBitmap(blob, {
|
|
79
|
+
resizeQuality: "medium",
|
|
80
|
+
resizeWidth: size
|
|
81
|
+
});
|
|
82
|
+
} catch {
|
|
83
|
+
bitmap = await createImageBitmap(blob);
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
return readPixels(bitmap, bitmap.width, bitmap.height, size);
|
|
87
|
+
} finally {
|
|
88
|
+
bitmap.close();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
var canDecodeHere = () => typeof createImageBitmap === "function" && (typeof OffscreenCanvas === "function" || typeof document !== "undefined");
|
|
92
|
+
async function extractHere(request) {
|
|
93
|
+
if (!canDecodeHere()) return {
|
|
94
|
+
supported: false
|
|
95
|
+
};
|
|
96
|
+
const blob = await fetchImageBlob(request.src, request.proxyUrl);
|
|
97
|
+
if (!blob) return {
|
|
98
|
+
palette: null,
|
|
99
|
+
supported: true
|
|
100
|
+
};
|
|
101
|
+
try {
|
|
102
|
+
const pixels = await decodeBlob(blob, request.analysis.sampleSize);
|
|
103
|
+
return {
|
|
104
|
+
palette: pixels ? analyzeAmbientPixels(pixels, request.analysis) : null,
|
|
105
|
+
supported: true
|
|
106
|
+
};
|
|
107
|
+
} catch {
|
|
108
|
+
return {
|
|
109
|
+
palette: null,
|
|
110
|
+
supported: true
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// src/modules/ambient/worker/index.ts
|
|
116
|
+
var AMBIENT_WORKER_REQUEST = "ambient:extract";
|
|
117
|
+
var AMBIENT_WORKER_RESPONSE = "ambient:palette";
|
|
118
|
+
function serveAmbientWorker(scope = globalThis) {
|
|
119
|
+
const onMessage = async (event) => {
|
|
120
|
+
const request = event.data;
|
|
121
|
+
if (request?.type !== AMBIENT_WORKER_REQUEST) return;
|
|
122
|
+
let result;
|
|
123
|
+
try {
|
|
124
|
+
result = await extractHere(request);
|
|
125
|
+
} catch {
|
|
126
|
+
result = {
|
|
127
|
+
palette: null,
|
|
128
|
+
supported: true
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
scope.postMessage({
|
|
132
|
+
...result,
|
|
133
|
+
id: request.id,
|
|
134
|
+
type: AMBIENT_WORKER_RESPONSE
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
scope.addEventListener("message", onMessage);
|
|
138
|
+
return () => scope.removeEventListener("message", onMessage);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export { AMBIENT_WORKER_REQUEST, AMBIENT_WORKER_RESPONSE, serveAmbientWorker };
|
|
142
|
+
//# sourceMappingURL=index.js.map
|
|
143
|
+
//# sourceMappingURL=index.js.map
|