@flamingo-stack/openframe-frontend-core 0.0.731 → 0.0.733
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/dist/build/export-map.json +1 -1
- package/dist/{chunk-RAHRDJBP.cjs → chunk-3HPB4H4C.cjs} +4 -4
- package/dist/{chunk-2UNQJVYN.cjs → chunk-3KGICRH7.cjs} +1457 -1187
- package/dist/{chunk-A4HNF4MP.cjs → chunk-3UTPZW36.cjs} +89 -89
- package/dist/{chunk-GID62YEN.cjs → chunk-AAFW4STC.cjs} +3 -3
- package/dist/{chunk-XDBHGWFH.cjs → chunk-ATMBJBOI.cjs} +16 -16
- package/dist/{chunk-YDGBRI3Y.cjs → chunk-AV5533DH.cjs} +15 -15
- package/dist/{chunk-BFHLGEJK.cjs → chunk-BP6R5WDW.cjs} +63 -60
- package/dist/{chunk-CLILWI6O.cjs → chunk-CJVAA7KL.cjs} +32 -32
- package/dist/{chunk-YJFN2W7A.cjs → chunk-DUVOQHQI.cjs} +7 -7
- package/dist/{chunk-E3N24573.cjs → chunk-DUXLZPMJ.cjs} +9 -9
- package/dist/{chunk-TH4N726A.cjs → chunk-E26I4XH6.cjs} +17 -17
- package/dist/{chunk-Y4QRK3CB.cjs → chunk-EMG3T55N.cjs} +7 -7
- package/dist/{chunk-JK75ZZP3.cjs → chunk-EQORT7NK.cjs} +59 -59
- package/dist/chunk-FCGLSWKR.cjs +417 -0
- package/dist/{chunk-MANNIJ42.cjs → chunk-FICJS5OA.cjs} +6 -0
- package/dist/{chunk-QP6QS3YU.cjs → chunk-FNRMDDVN.cjs} +48 -50
- package/dist/{chunk-KLXHCNDC.cjs → chunk-FTTLBMHU.cjs} +3 -3
- package/dist/{chunk-JPZ4Y6X3.cjs → chunk-GB3CHAW7.cjs} +93 -93
- package/dist/{chunk-7DUXR4HL.cjs → chunk-GVTDVS5U.cjs} +3 -3
- package/dist/{chunk-ZV6473Z4.cjs → chunk-HSWHOCZ3.cjs} +20 -20
- package/dist/{chunk-53XZ6MJ5.cjs → chunk-IC4FT3A6.cjs} +28 -28
- package/dist/{chunk-6V4GEE55.cjs → chunk-J7JKPTGO.cjs} +12 -12
- package/dist/{chunk-FKKUQK4C.cjs → chunk-L4ZNR5V7.cjs} +43 -39
- package/dist/{chunk-NYY25425.cjs → chunk-MYBTNOS6.cjs} +2 -2
- package/dist/chunk-NTJE6SM6.cjs +28 -0
- package/dist/{chunk-RBOIGJYF.cjs → chunk-P3R23TOE.cjs} +35 -35
- package/dist/chunk-PX7FY655.cjs +114 -0
- package/dist/{chunk-YUXRIR45.cjs → chunk-SA7LDEVJ.cjs} +98 -50
- package/dist/{chunk-32ENYVFA.cjs → chunk-TIMCHP4X.cjs} +42 -42
- package/dist/{chunk-3SWLL4IM.cjs → chunk-U4T5NLZD.cjs} +8 -8
- package/dist/{chunk-HI7EFAFQ.cjs → chunk-XDWY6HAW.cjs} +28 -28
- package/dist/{chunk-25H2SZH7.cjs → chunk-XY632BCH.cjs} +4 -4
- package/dist/{chunk-HY2KTQSL.cjs → chunk-YIXKH2JO.cjs} +236 -236
- package/dist/{chunk-4YPV4OI4.cjs → chunk-ZBNA6TCW.cjs} +82 -82
- package/dist/{chunk-HLIJ3U2T.cjs → chunk-ZJNYWNCB.cjs} +23 -21
- package/dist/{chunk-HEOD765R.cjs → chunk-ZRYKDN2J.cjs} +32 -379
- package/dist/{cloud-tenants-SC4FNAC2.cjs → cloud-tenants-3GOGR3EN.cjs} +22 -22
- package/dist/components/agent-identity.d.ts +8 -0
- package/dist/components/agent-identity.d.ts.map +1 -1
- package/dist/components/agent-identity.js +13 -1
- package/dist/components/case-studies/index.cjs +35 -35
- package/dist/components/chat/embeddable-chat.d.ts +16 -0
- package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
- package/dist/components/chat/embeddable-chat.js +5 -2
- package/dist/components/chat/index.cjs +16 -16
- package/dist/components/chat/utils/icon-library.d.ts.map +1 -1
- package/dist/components/chat/utils/icon-library.js +6 -0
- package/dist/components/contact/index.cjs +23 -23
- package/dist/components/docs/index.cjs +26 -26
- package/dist/components/embeds/index.cjs +23 -23
- package/dist/components/faq/index.cjs +23 -23
- package/dist/components/features/index.cjs +22 -22
- package/dist/components/help-center-pages/index.cjs +138 -138
- package/dist/components/index.cjs +89 -82
- package/dist/components/meeting-scheduler/index.cjs +67 -67
- package/dist/components/navigation/index.cjs +25 -25
- package/dist/components/onboarding-guides/index.cjs +25 -25
- package/dist/components/product-demo/index.cjs +8 -8
- package/dist/components/product-demo/screens/remote-desktop-picture.d.ts.map +1 -1
- package/dist/components/product-demo/screens/remote-desktop-picture.js +2 -1
- package/dist/components/related-content/index.cjs +10 -10
- package/dist/components/tickets/index.cjs +26 -26
- package/dist/components/ui/device-wallpaper.d.ts +7 -0
- package/dist/components/ui/device-wallpaper.d.ts.map +1 -0
- package/dist/components/ui/device-wallpaper.js +5 -0
- package/dist/components/ui/feature-list.d.ts +9 -4
- package/dist/components/ui/feature-list.d.ts.map +1 -1
- package/dist/components/ui/feature-list.js +26 -35
- package/dist/components/ui/index.cjs +28 -22
- package/dist/components/ui/index.d.ts +3 -1
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +3 -1
- package/dist/components/ui/notification-stack.d.ts +33 -0
- package/dist/components/ui/notification-stack.d.ts.map +1 -0
- package/dist/components/ui/notification-stack.js +78 -0
- package/dist/components/ui/numbered-step.d.ts +29 -0
- package/dist/components/ui/numbered-step.d.ts.map +1 -0
- package/dist/components/ui/numbered-step.js +57 -0
- package/dist/components/ui/phone-frame.d.ts +14 -9
- package/dist/components/ui/phone-frame.d.ts.map +1 -1
- package/dist/components/ui/phone-frame.js +50 -6
- package/dist/components/ui/phone-glyphs/lock-camera-glyph.d.ts +5 -0
- package/dist/components/ui/phone-glyphs/lock-camera-glyph.d.ts.map +1 -0
- package/dist/components/ui/phone-glyphs/lock-camera-glyph.js +14 -0
- package/dist/components/ui/phone-glyphs/lock-flashlight-glyph.d.ts +5 -0
- package/dist/components/ui/phone-glyphs/lock-flashlight-glyph.d.ts.map +1 -0
- package/dist/components/ui/phone-glyphs/lock-flashlight-glyph.js +14 -0
- package/dist/components/ui/phone-glyphs/status-bar-glyphs.d.ts +5 -0
- package/dist/components/ui/phone-glyphs/status-bar-glyphs.d.ts.map +1 -0
- package/dist/components/ui/phone-glyphs/status-bar-glyphs.js +68 -0
- package/dist/components/ui/searchable-select.d.ts +29 -3
- package/dist/components/ui/searchable-select.d.ts.map +1 -1
- package/dist/components/ui/searchable-select.js +101 -45
- package/dist/components/ui/snap-carousel.d.ts +5 -8
- package/dist/components/ui/snap-carousel.d.ts.map +1 -1
- package/dist/components/ui/snap-carousel.js +2 -27
- package/dist/components/ui/tab-navigation.d.ts +8 -1
- package/dist/components/ui/tab-navigation.d.ts.map +1 -1
- package/dist/components/ui/tab-navigation.js +30 -20
- package/dist/{devices-7MHSJNXS.cjs → devices-POZXTP7X.cjs} +23 -23
- package/dist/{embeddable-chat-VPIG3F7E.cjs → embeddable-chat-I3Y5GCCR.cjs} +96 -93
- package/dist/hooks/index.cjs +9 -9
- package/dist/hooks/ui/use-autoplay.d.ts +50 -13
- package/dist/hooks/ui/use-autoplay.d.ts.map +1 -1
- package/dist/hooks/ui/use-autoplay.js +76 -13
- package/dist/hooks/ui/use-in-view.d.ts +8 -0
- package/dist/hooks/ui/use-in-view.d.ts.map +1 -1
- package/dist/hooks/ui/use-in-view.js +21 -36
- package/dist/hooks/use-agent-identities.d.ts +6 -0
- package/dist/hooks/use-agent-identities.d.ts.map +1 -1
- package/dist/hooks/use-scenario-player.d.ts +26 -9
- package/dist/hooks/use-scenario-player.d.ts.map +1 -1
- package/dist/hooks/use-scenario-player.js +12 -9
- package/dist/index.cjs +58 -51
- package/dist/{knowledge-4DREGSOZ.cjs → knowledge-AP34IMXN.cjs} +23 -23
- package/dist/{logs-BWXNT2KP.cjs → logs-CEVMIOPW.cjs} +30 -30
- package/dist/{policies-MGFUI23M.cjs → policies-AMBMRCGB.cjs} +26 -26
- package/dist/{remote-session-O6QGXV2N.cjs → remote-session-Z4YZFG5E.cjs} +10 -9
- package/dist/{software-update-7LF7XEYC.cjs → software-update-Z3MWMSHI.cjs} +26 -26
- package/dist/{tickets-board-KNXK747O.cjs → tickets-board-JOSYLOS7.cjs} +13 -13
- package/package.json +1 -1
- package/src/components/agent-identity.tsx +20 -1
- package/src/components/chat/embeddable-chat.tsx +29 -2
- package/src/components/chat/utils/icon-library.tsx +7 -0
- package/src/components/product-demo/screens/remote-desktop-picture.tsx +2 -1
- package/src/components/ui/device-wallpaper.ts +7 -0
- package/src/components/ui/feature-list.tsx +24 -30
- package/src/components/ui/index.ts +3 -1
- package/src/components/ui/notification-stack.tsx +133 -0
- package/src/components/ui/numbered-step.tsx +81 -0
- package/src/components/ui/phone-frame.tsx +83 -19
- package/src/components/ui/phone-glyphs/lock-camera-glyph.tsx +14 -0
- package/src/components/ui/phone-glyphs/lock-flashlight-glyph.tsx +14 -0
- package/src/components/ui/phone-glyphs/status-bar-glyphs.tsx +45 -0
- package/src/components/ui/searchable-select.tsx +124 -32
- package/src/components/ui/snap-carousel.tsx +6 -38
- package/src/components/ui/tab-navigation.tsx +49 -21
- package/src/hooks/ui/use-autoplay.ts +144 -27
- package/src/hooks/ui/use-in-view.ts +31 -38
- package/src/hooks/use-agent-identities.ts +6 -0
- package/src/hooks/use-scenario-player.ts +44 -20
- package/dist/chunk-2WXLQ5R5.cjs +0 -99
- package/dist/chunk-BE2WAMG5.cjs +0 -54
- package/dist/chunk-LCTDHLDL.cjs +0 -43
- package/dist/components/ui/playback-toggle.d.ts +0 -24
- package/dist/components/ui/playback-toggle.d.ts.map +0 -1
- package/dist/components/ui/playback-toggle.js +0 -32
- package/src/components/ui/playback-toggle.tsx +0 -53
package/dist/hooks/index.cjs
CHANGED
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
var
|
|
63
|
+
var _chunkBP6R5WDWcjs = require('../chunk-BP6R5WDW.cjs');
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
var
|
|
69
|
+
var _chunkAAFW4STCcjs = require('../chunk-AAFW4STC.cjs');
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
var _chunk24I6RFVUcjs = require('../chunk-24I6RFVU.cjs');
|
|
@@ -77,7 +77,7 @@ var _chunkA6P6DHEZcjs = require('../chunk-A6P6DHEZ.cjs');
|
|
|
77
77
|
require('../chunk-MZ4KBSH7.cjs');
|
|
78
78
|
|
|
79
79
|
|
|
80
|
-
var
|
|
80
|
+
var _chunkDUVOQHQIcjs = require('../chunk-DUVOQHQI.cjs');
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
|
|
@@ -88,8 +88,8 @@ var _chunkYJFN2W7Acjs = require('../chunk-YJFN2W7A.cjs');
|
|
|
88
88
|
|
|
89
89
|
|
|
90
90
|
|
|
91
|
-
var
|
|
92
|
-
require('../chunk-
|
|
91
|
+
var _chunkSA7LDEVJcjs = require('../chunk-SA7LDEVJ.cjs');
|
|
92
|
+
require('../chunk-NTJE6SM6.cjs');
|
|
93
93
|
require('../chunk-JKX2C3I2.cjs');
|
|
94
94
|
require('../chunk-7DNL734S.cjs');
|
|
95
95
|
require('../chunk-WWUSFOJ7.cjs');
|
|
@@ -105,7 +105,7 @@ var _chunkEAY6ZUEScjs = require('../chunk-EAY6ZUES.cjs');
|
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
|
|
108
|
-
var
|
|
108
|
+
var _chunkPX7FY655cjs = require('../chunk-PX7FY655.cjs');
|
|
109
109
|
|
|
110
110
|
|
|
111
111
|
|
|
@@ -118,7 +118,7 @@ var _chunkCW3ML76Ucjs = require('../chunk-CW3ML76U.cjs');
|
|
|
118
118
|
|
|
119
119
|
|
|
120
120
|
|
|
121
|
-
var
|
|
121
|
+
var _chunkGVTDVS5Ucjs = require('../chunk-GVTDVS5U.cjs');
|
|
122
122
|
|
|
123
123
|
|
|
124
124
|
|
|
@@ -128,7 +128,7 @@ var _chunk7DUXR4HLcjs = require('../chunk-7DUXR4HL.cjs');
|
|
|
128
128
|
|
|
129
129
|
|
|
130
130
|
|
|
131
|
-
var
|
|
131
|
+
var _chunkFICJS5OAcjs = require('../chunk-FICJS5OA.cjs');
|
|
132
132
|
|
|
133
133
|
|
|
134
134
|
|
|
@@ -243,4 +243,4 @@ require('../chunk-3ATAYP36.cjs');
|
|
|
243
243
|
|
|
244
244
|
|
|
245
245
|
|
|
246
|
-
exports.AGENT_IDENTITIES_API_PATH =
|
|
246
|
+
exports.AGENT_IDENTITIES_API_PATH = _chunkPX7FY655cjs.AGENT_IDENTITIES_API_PATH; exports.CONTENT_BREAKPOINTS = _chunkGVTDVS5Ucjs.CONTENT_BREAKPOINTS; exports.ContentAreaWidthContext = _chunkGVTDVS5Ucjs.ContentAreaWidthContext; exports.DRAG_AND_DROP_MEDIA_QUERY = _chunkAAFW4STCcjs.DRAG_AND_DROP_MEDIA_QUERY; exports.GraphQLIntrospector = _chunkBP6R5WDWcjs.GraphQLIntrospector; exports.NEAR_VIEWPORT_ROOT_MARGIN = _chunkCW3ML76Ucjs.NEAR_VIEWPORT_ROOT_MARGIN; exports.PREFERS_REDUCED_MOTION_QUERY = _chunkSA7LDEVJcjs.PREFERS_REDUCED_MOTION_QUERY; exports.ViewportBreakpoints = _chunkGVTDVS5Ucjs.ViewportBreakpoints; exports.batchFetchAuthenticatedImages = _chunkBP6R5WDWcjs.batchFetchAuthenticatedImages; exports.breakpoints = _chunkFICJS5OAcjs.breakpoints; exports.clearAuthedAssetCache = _chunkVOX4E6AXcjs.clearAuthedAssetCache; exports.clearAuthedImageCache = _chunkFICJS5OAcjs.clearAuthedImageCache; exports.clearVariablesParams = _chunkBP6R5WDWcjs.clearParams; exports.coerceValue = _chunkBP6R5WDWcjs.coerceValue; exports.completeFormRescue = _chunkBP6R5WDWcjs.completeFormRescue; exports.configureAuthenticatedImage = _chunkBP6R5WDWcjs.configureAuthenticatedImage; exports.configureBatchImageFetch = _chunkBP6R5WDWcjs.configureBatchImageFetch; exports.contentBreakpointFor = _chunkGVTDVS5Ucjs.contentBreakpointFor; exports.createSearchParams = _chunkBLH2SFOOcjs.createSearchParams; exports.extractVariablesFromQuery = _chunkBP6R5WDWcjs.extractVariablesFromQuery; exports.flattenQueryVariables = _chunkBP6R5WDWcjs.flattenQueryVariables; exports.getArrayParams = _chunkBP6R5WDWcjs.getArrayParams; exports.getNestedValue = _chunkBP6R5WDWcjs.getNestedValue; exports.getRequiredParams = _chunkBP6R5WDWcjs.getRequiredParams; exports.introspector = _chunkBP6R5WDWcjs.introspector; exports.isInputObjectType = _chunkBP6R5WDWcjs.isInputObjectType; exports.isScalarType = _chunkBP6R5WDWcjs.isScalarType; exports.mergeDefaults = _chunkBP6R5WDWcjs.mergeDefaults; exports.mergeVariables = _chunkBP6R5WDWcjs.mergeVariables; exports.resetDownloadsStore = _chunkBP6R5WDWcjs.resetDownloadsStore; exports.resolveActiveSection = _chunkBP6R5WDWcjs.resolveActiveSection; exports.setNestedValue = _chunkBP6R5WDWcjs.setNestedValue; exports.shouldIncludeInUrl = _chunkBLH2SFOOcjs.shouldIncludeInUrl; exports.toast = _chunkBP6R5WDWcjs.toast; exports.urlParamsToVariables = _chunkBP6R5WDWcjs.urlParamsToVariables; exports.useAccessCodeIntegration = _chunkBP6R5WDWcjs.useAccessCodeIntegration; exports.useActiveSection = _chunkBP6R5WDWcjs.useActiveSection; exports.useAgentIdentities = _chunkPX7FY655cjs.useAgentIdentities; exports.useApiParams = _chunkBP6R5WDWcjs.useApiParams; exports.useAuthedAssetSrc = _chunkVOX4E6AXcjs.useAuthedAssetSrc; exports.useAuthedImageSrc = _chunkFICJS5OAcjs.useAuthedImageSrc; exports.useAuthenticatedImage = _chunkBP6R5WDWcjs.useAuthenticatedImage; exports.useAutoLimitTags = _chunkA6P6DHEZcjs.useAutoLimitTags; exports.useAutoplay = _chunkSA7LDEVJcjs.useAutoplay; exports.useBatchImages = _chunkBP6R5WDWcjs.useBatchImages; exports.useClaudeMirrorSrc = _chunkBP6R5WDWcjs.useClaudeMirrorSrc; exports.useContactSubmission = _chunkBP6R5WDWcjs.useContactSubmission; exports.useContentBreakpoint = _chunkGVTDVS5Ucjs.useContentBreakpoint; exports.useContentLgUp = _chunkGVTDVS5Ucjs.useContentLgUp; exports.useContentMdUp = _chunkGVTDVS5Ucjs.useContentMdUp; exports.useCopyToClipboard = _chunkBP6R5WDWcjs.useCopyToClipboard; exports.useCursorPaginationState = _chunkBP6R5WDWcjs.useCursorPaginationState; exports.useDebounce = _chunkSA7LDEVJcjs.useDebounce; exports.useDeferredError = _chunkBP6R5WDWcjs.useDeferredError; exports.useDownloads = _chunkBP6R5WDWcjs.useDownloads; exports.useDragAndDropEnabled = _chunkAAFW4STCcjs.useDragAndDropEnabled; exports.useFocusTrap = _chunkBP6R5WDWcjs.useFocusTrap; exports.useFormRescue = _chunkBP6R5WDWcjs.useFormRescue; exports.useHeaderHeight = _chunk24I6RFVUcjs.useHeaderHeight; exports.useHorizontalScrollbar = _chunkAAFW4STCcjs.useHorizontalScrollbar; exports.useHumanitySignals = _chunkBP6R5WDWcjs.useHumanitySignals; exports.useImageEdgeColor = _chunkEAY6ZUEScjs.useImageEdgeColor; exports.useInView = _chunkSA7LDEVJcjs.useInView; exports.useIsTruncated = _chunkFICJS5OAcjs.useIsTruncated; exports.useIsomorphicLayoutEffect = _chunkVOX4E6AXcjs.useIsomorphicLayoutEffect; exports.useKeyboardCollisionPadding = _chunkA6P6DHEZcjs.useKeyboardCollisionPadding; exports.useLgUp = _chunkFICJS5OAcjs.useLgUp; exports.useLocalStorage = _chunkAAFW4STCcjs.useLocalStorage; exports.useLocationHash = _chunkBP6R5WDWcjs.useLocationHash; exports.useMarqueeEngine = _chunkSA7LDEVJcjs.useMarqueeEngine; exports.useMdUp = _chunkFICJS5OAcjs.useMdUp; exports.useMediaQuery = _chunkFICJS5OAcjs.useMediaQuery; exports.useMemoizedCallback = _chunkBP6R5WDWcjs.useMemoizedCallback; exports.useNatsClient = _chunkBP6R5WDWcjs.useNatsClient; exports.useNavMenus = _chunkBP6R5WDWcjs.useNavMenus; exports.useNearViewport = _chunkCW3ML76Ucjs.useNearViewport; exports.useNotificationPermission = _chunkBP6R5WDWcjs.useNotificationPermission; exports.useOgPlaceholderUrl = _chunkEAY6ZUEScjs.useOgPlaceholderUrl; exports.useOnboardingState = _chunkBP6R5WDWcjs.useOnboardingState; exports.usePlatformByValue = _chunkBP6R5WDWcjs.usePlatformByValue; exports.usePlatformConfig = _chunkBP6R5WDWcjs.usePlatformConfig; exports.usePrefersReducedMotion = _chunkSA7LDEVJcjs.usePrefersReducedMotion; exports.usePrefersReducedMotionState = _chunkSA7LDEVJcjs.usePrefersReducedMotionState; exports.usePreventScroll = _chunkBP6R5WDWcjs.usePreventScroll; exports.useQueryParams = _chunkBP6R5WDWcjs.useQueryParams; exports.useRescuedForm = _chunkBP6R5WDWcjs.useRescuedForm; exports.useResetOnPageHidden = _chunkSA7LDEVJcjs.useResetOnPageHidden; exports.useScenarioPlayer = _chunkBP6R5WDWcjs.useScenarioPlayer; exports.useScrollToHash = _chunkBP6R5WDWcjs.useScrollToHash; exports.useSearch = _chunkBP6R5WDWcjs.useSearch; exports.useSmUp = _chunkFICJS5OAcjs.useSmUp; exports.useStickyToolbar = _chunkBP6R5WDWcjs.useStickyToolbar; exports.useSuppressCloneFocus = _chunkSA7LDEVJcjs.useSuppressCloneFocus; exports.useTablePagination = _chunkBP6R5WDWcjs.useTablePagination; exports.useThrottle = _chunkBP6R5WDWcjs.useThrottle; exports.useToast = _chunkBP6R5WDWcjs.useToast; exports.useValidatePlatform = _chunkBP6R5WDWcjs.useValidatePlatform; exports.useVisitorDesktopDownload = _chunkBP6R5WDWcjs.useVisitorDesktopDownload; exports.useVisitorOs = _chunkDUVOQHQIcjs.useVisitorOs; exports.useWindowSize = _chunkBP6R5WDWcjs.useWindowSize; exports.validateSchema = _chunkBP6R5WDWcjs.validateSchema; exports.validateVariables = _chunkBP6R5WDWcjs.validateVariables; exports.variablesToUrlParams = _chunkBP6R5WDWcjs.variablesToUrlParams;
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
+
import type { FocusEvent, PointerEvent } from 'react';
|
|
2
|
+
/** The handlers that hold a moving thing still while a visitor is on it. Spread them on its outer element. */
|
|
3
|
+
export interface AutoplayHoldProps {
|
|
4
|
+
onPointerDown: (event: PointerEvent<HTMLElement>) => void;
|
|
5
|
+
onFocus: (event: FocusEvent<HTMLElement>) => void;
|
|
6
|
+
}
|
|
1
7
|
export interface UseAutoplayResult {
|
|
2
8
|
/** True while the thing may move by itself. */
|
|
3
9
|
playing: boolean;
|
|
4
|
-
/** The visitor
|
|
5
|
-
|
|
6
|
-
|
|
10
|
+
/** The visitor is holding it still: a finger or the mouse button is down on it, or the keyboard is inside it. */
|
|
11
|
+
held: boolean;
|
|
12
|
+
/** Spread on the element that moves: it is how a visitor stops it, with no control to find. */
|
|
13
|
+
holdProps: AutoplayHoldProps;
|
|
14
|
+
/**
|
|
15
|
+
* Lets go of every hold at once. Called when the visitor CHOOSES something on
|
|
16
|
+
* the thing itself (a tab, a step, an arrow): a choice is an instruction to
|
|
17
|
+
* play from there, and it must never depend on the browser reporting the end
|
|
18
|
+
* of the press or the focus that made it.
|
|
19
|
+
*/
|
|
20
|
+
release: () => void;
|
|
7
21
|
/** True once the system preference is known to be reduced motion. */
|
|
8
22
|
reducedMotion: boolean;
|
|
9
23
|
}
|
|
@@ -13,20 +27,43 @@ export interface UseAutoplayResult {
|
|
|
13
27
|
* else decides it.
|
|
14
28
|
*
|
|
15
29
|
* 1. it is on screen (`onScreen`, the caller's `useInView`);
|
|
16
|
-
* 2. the browser tab is visible
|
|
17
|
-
*
|
|
18
|
-
* 3. the visitor has not pressed pause (`setPaused`: the stop control
|
|
30
|
+
* 2. the browser tab is visible;
|
|
31
|
+
* 3. the visitor is not holding it (`holdProps`: the way to stop it that
|
|
19
32
|
* WCAG 2.2.2 asks of anything that moves for more than five seconds);
|
|
20
33
|
* 4. motion is allowed (never under reduced motion, and not before the
|
|
21
34
|
* preference is known).
|
|
22
35
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
36
|
+
* There is NO pause button. A visitor holds it by PRESSING on it (a finger or
|
|
37
|
+
* the mouse button down, as a story is held) or by having KEYBOARD focus inside
|
|
38
|
+
* it. Each ends by itself (the press is released, wherever that happens; focus
|
|
39
|
+
* moves on), so it can never be left stopped with no visible way to start it again.
|
|
40
|
+
*
|
|
41
|
+
* HOW it knows, which is what keeps it from sticking. Each hold has more than
|
|
42
|
+
* one way to end, and every one of them is checked:
|
|
43
|
+
* - a PRESS ends on its release, listened for on the WINDOW (a drag that
|
|
44
|
+
* leaves the element still ends it), by ANY of the events a release can
|
|
45
|
+
* arrive as (`RELEASE_EVENTS`: a native drag ends in `dragend`, not
|
|
46
|
+
* `pointerup`), and, as the net under those, by the first pointer movement
|
|
47
|
+
* that reports no button down;
|
|
48
|
+
* - the KEYBOARD holds it only when focus ARRIVED by keyboard (the browser
|
|
49
|
+
* drew a ring for it as it came in), and only until focus leaves the
|
|
50
|
+
* element or the visitor reaches for the pointer. "Is `:focus-visible`
|
|
51
|
+
* inside" alone is not the test: a browser turns the ring on for a control
|
|
52
|
+
* that was CLICKED as soon as any key is pressed, which held the demo for a
|
|
53
|
+
* visitor who clicked a tab and then scrolled with the space bar;
|
|
54
|
+
* - a CHOICE made on the thing itself (`release`, called by whoever handles
|
|
55
|
+
* the tab, the step or the arrow) lets go of everything: it plays from
|
|
56
|
+
* there whatever the browser did or did not report;
|
|
57
|
+
* - the tab is read from the document (`useSyncExternalStore`), never copied
|
|
58
|
+
* into state.
|
|
59
|
+
*
|
|
60
|
+
* What does NOT hold it, each tried and removed:
|
|
61
|
+
* - HOVER: a visitor watching a demo rests the mouse on it, so it stopped the
|
|
62
|
+
* moment it had their attention and read as stuck;
|
|
63
|
+
* - a WHEEL event or a passing touch: that is what scrolling the PAGE past
|
|
64
|
+
* the thing produces (the browser cancels a press the moment it becomes a scroll);
|
|
65
|
+
* - focus the browser shows no ring for: a browser re-reports focus when its
|
|
66
|
+
* window is re-activated, and a mouse click on a control is not the keyboard.
|
|
30
67
|
*/
|
|
31
68
|
export declare function useAutoplay(onScreen: boolean): UseAutoplayResult;
|
|
32
69
|
//# sourceMappingURL=use-autoplay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-autoplay.d.ts","sourceRoot":"","sources":["../../../src/hooks/ui/use-autoplay.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-autoplay.d.ts","sourceRoot":"","sources":["../../../src/hooks/ui/use-autoplay.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGtD,8GAA8G;AAC9G,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAC1D,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CACnD;AAED,MAAM,WAAW,iBAAiB;IAChC,+CAA+C;IAC/C,OAAO,EAAE,OAAO,CAAC;IACjB,iHAAiH;IACjH,IAAI,EAAE,OAAO,CAAC;IACd,+FAA+F;IAC/F,SAAS,EAAE,iBAAiB,CAAC;IAC7B;;;;;OAKG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,qEAAqE;IACrE,aAAa,EAAE,OAAO,CAAC;CACxB;AA0BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,iBAAiB,CA6EhE"}
|
|
@@ -1,24 +1,87 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { useCallback, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
3
3
|
import { usePrefersReducedMotionState } from "./use-prefers-reduced-motion.js";
|
|
4
|
+
function listen(target, events, onChange) {
|
|
5
|
+
const controller = new AbortController();
|
|
6
|
+
for (const event of events) target.addEventListener(event, onChange, { signal: controller.signal });
|
|
7
|
+
return () => controller.abort();
|
|
8
|
+
}
|
|
9
|
+
const subscribeToTab = (onChange) => {
|
|
10
|
+
const stopDocument = listen(document, ["visibilitychange"], onChange);
|
|
11
|
+
const stopWindow = listen(window, ["pageshow"], onChange);
|
|
12
|
+
return () => {
|
|
13
|
+
stopDocument();
|
|
14
|
+
stopWindow();
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
const tabIsHidden = () => document.visibilityState === "hidden";
|
|
18
|
+
const never = () => false;
|
|
19
|
+
const RELEASE_EVENTS = ["pointerup", "pointercancel", "mouseup", "touchend", "dragend", "blur"];
|
|
4
20
|
function useAutoplay(onScreen) {
|
|
5
21
|
const reducedState = usePrefersReducedMotionState();
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
22
|
+
const tabHidden = useSyncExternalStore(subscribeToTab, tabIsHidden, never);
|
|
23
|
+
const host = useRef(null);
|
|
24
|
+
const keyboardCameIn = useRef(false);
|
|
25
|
+
const subscribeToKeyboard = useCallback((onChange) => {
|
|
26
|
+
const usedPointer = () => {
|
|
27
|
+
keyboardCameIn.current = false;
|
|
28
|
+
onChange();
|
|
29
|
+
};
|
|
30
|
+
const stopFocus = listen(document, ["focusin", "focusout", "visibilitychange"], onChange);
|
|
31
|
+
const stopPointer = listen(document, ["pointerdown", "pointermove"], usedPointer);
|
|
32
|
+
const stopWindow = listen(window, ["focus", "blur"], onChange);
|
|
13
33
|
return () => {
|
|
14
|
-
|
|
15
|
-
|
|
34
|
+
stopFocus();
|
|
35
|
+
stopPointer();
|
|
36
|
+
stopWindow();
|
|
16
37
|
};
|
|
17
38
|
}, []);
|
|
39
|
+
const keyboardIsInside = useCallback(() => {
|
|
40
|
+
if (!keyboardCameIn.current) return false;
|
|
41
|
+
const inside = !!host.current?.isConnected && host.current.contains(document.activeElement);
|
|
42
|
+
if (!inside) keyboardCameIn.current = false;
|
|
43
|
+
return inside;
|
|
44
|
+
}, []);
|
|
45
|
+
const focused = useSyncExternalStore(subscribeToKeyboard, keyboardIsInside, never);
|
|
46
|
+
const [pressed, setPressed] = useState(false);
|
|
47
|
+
const holdProps = useMemo(
|
|
48
|
+
() => ({
|
|
49
|
+
onPointerDown: (event) => {
|
|
50
|
+
host.current = event.currentTarget;
|
|
51
|
+
setPressed(true);
|
|
52
|
+
const released = new AbortController();
|
|
53
|
+
const release2 = () => {
|
|
54
|
+
setPressed(false);
|
|
55
|
+
released.abort();
|
|
56
|
+
};
|
|
57
|
+
for (const type of RELEASE_EVENTS) window.addEventListener(type, release2, { signal: released.signal });
|
|
58
|
+
window.addEventListener(
|
|
59
|
+
"pointermove",
|
|
60
|
+
(move) => {
|
|
61
|
+
if (move.buttons === 0) release2();
|
|
62
|
+
},
|
|
63
|
+
{ signal: released.signal }
|
|
64
|
+
);
|
|
65
|
+
},
|
|
66
|
+
onFocus: (event) => {
|
|
67
|
+
host.current = event.currentTarget;
|
|
68
|
+
if (event.target.matches(":focus-visible")) keyboardCameIn.current = true;
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
[]
|
|
72
|
+
);
|
|
73
|
+
const [, setReleases] = useState(0);
|
|
74
|
+
const release = useCallback(() => {
|
|
75
|
+
keyboardCameIn.current = false;
|
|
76
|
+
setPressed(false);
|
|
77
|
+
setReleases((count) => count + 1);
|
|
78
|
+
}, []);
|
|
79
|
+
const held = pressed || focused;
|
|
18
80
|
return {
|
|
19
|
-
playing: onScreen && !
|
|
20
|
-
|
|
21
|
-
|
|
81
|
+
playing: onScreen && !held && !tabHidden && reducedState === false,
|
|
82
|
+
held,
|
|
83
|
+
holdProps,
|
|
84
|
+
release,
|
|
22
85
|
reducedMotion: reducedState === true
|
|
23
86
|
};
|
|
24
87
|
}
|
|
@@ -26,6 +26,14 @@ export interface UseInViewResult<T extends Element> {
|
|
|
26
26
|
* `useNearViewport` is the fire-once sibling (mount a heavy thing when it gets
|
|
27
27
|
* close, never unmount). This one is for things that should run only WHILE
|
|
28
28
|
* visible, like an auto-advancing carousel or a looping demo.
|
|
29
|
+
*
|
|
30
|
+
* The observer LIVES IN AN EFFECT keyed on the element, never in the ref
|
|
31
|
+
* callback. An observer made in the callback and torn down by a separate
|
|
32
|
+
* effect is torn down every time React re-runs effects without re-attaching
|
|
33
|
+
* refs (a Fast Refresh, an Activity that hides and shows): nothing observed any
|
|
34
|
+
* more, and `inView` froze at its last value, so a demo that happened to be off
|
|
35
|
+
* screen at that moment never played again. An effect that owns it makes it
|
|
36
|
+
* again whenever it is torn down.
|
|
29
37
|
*/
|
|
30
38
|
export declare function useInView<T extends Element = HTMLElement>({ threshold, rootMargin, initial, }?: UseInViewOptions): UseInViewResult<T>;
|
|
31
39
|
//# sourceMappingURL=use-in-view.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-in-view.d.ts","sourceRoot":"","sources":["../../../src/hooks/ui/use-in-view.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,OAAO;IAChD,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9B,mFAAmF;IACnF,MAAM,EAAE,OAAO,CAAC;CACjB;AAaD
|
|
1
|
+
{"version":3,"file":"use-in-view.d.ts","sourceRoot":"","sources":["../../../src/hooks/ui/use-in-view.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,OAAO;IAChD,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9B,mFAAmF;IACnF,MAAM,EAAE,OAAO,CAAC;CACjB;AAaD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,OAAO,GAAG,WAAW,EAAE,EACzD,SAAa,EACb,UAAkB,EAClB,OAAe,GAChB,GAAE,gBAAqB,GAAG,eAAe,CAAC,CAAC,CAAC,CAyB5C"}
|
|
@@ -1,46 +1,31 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
3
|
const STEPS = Array.from({ length: 21 }, (_, i) => i / 20);
|
|
4
4
|
function useInView({
|
|
5
5
|
threshold = 0,
|
|
6
6
|
rootMargin = "0px",
|
|
7
7
|
initial = false
|
|
8
8
|
} = {}) {
|
|
9
|
-
const [
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (!entry) return;
|
|
30
|
-
const ofElement = entry.intersectionRatio >= threshold;
|
|
31
|
-
const viewportHeight = entry.rootBounds?.height ?? 0;
|
|
32
|
-
const ofViewport = viewportHeight > 0 && (entry.intersectionRect?.height ?? 0) >= viewportHeight * threshold;
|
|
33
|
-
setInView(entry.isIntersecting && (ofElement || ofViewport));
|
|
34
|
-
},
|
|
35
|
-
{ threshold: STEPS, rootMargin }
|
|
36
|
-
);
|
|
37
|
-
observer.observe(node);
|
|
38
|
-
observerRef.current = observer;
|
|
39
|
-
},
|
|
40
|
-
[disconnect, threshold, rootMargin, initial]
|
|
41
|
-
);
|
|
42
|
-
useEffect(() => disconnect, [disconnect]);
|
|
43
|
-
return { ref, inView };
|
|
9
|
+
const [node, setNode] = useState(null);
|
|
10
|
+
const [seen, setSeen] = useState(null);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (!node || typeof IntersectionObserver === "undefined") return void 0;
|
|
13
|
+
const observer = new IntersectionObserver(
|
|
14
|
+
(entries) => {
|
|
15
|
+
const entry = entries[entries.length - 1];
|
|
16
|
+
if (!entry) return;
|
|
17
|
+
const ofElement = entry.intersectionRatio >= threshold;
|
|
18
|
+
const viewportHeight = entry.rootBounds?.height ?? 0;
|
|
19
|
+
const ofViewport = viewportHeight > 0 && (entry.intersectionRect?.height ?? 0) >= viewportHeight * threshold;
|
|
20
|
+
setSeen({ node, inView: entry.isIntersecting && (ofElement || ofViewport) });
|
|
21
|
+
},
|
|
22
|
+
{ threshold: STEPS, rootMargin }
|
|
23
|
+
);
|
|
24
|
+
observer.observe(node);
|
|
25
|
+
return () => observer.disconnect();
|
|
26
|
+
}, [node, threshold, rootMargin]);
|
|
27
|
+
const inView = !node ? false : seen?.node === node ? seen.inView : initial;
|
|
28
|
+
return { ref: setNode, inView };
|
|
44
29
|
}
|
|
45
30
|
export {
|
|
46
31
|
useInView
|
|
@@ -3,6 +3,12 @@ export interface AgentIdentityIcon {
|
|
|
3
3
|
name?: string | null;
|
|
4
4
|
url?: string | null;
|
|
5
5
|
props?: Record<string, unknown> | null;
|
|
6
|
+
/**
|
|
7
|
+
* The identity's accent, travelling with its icon: a hex colour (`#5efaf0`),
|
|
8
|
+
* as the server stores it. What is drawn in the agent's colour (its tab, the
|
|
9
|
+
* step it is on) reads it through `useAgentAccents`; unset, that is the platform's accent.
|
|
10
|
+
*/
|
|
11
|
+
accent?: string | null;
|
|
6
12
|
}
|
|
7
13
|
/** Each agent's identity icon, keyed by the agent's slug. */
|
|
8
14
|
export type AgentIdentityIcons = Readonly<Record<string, AgentIdentityIcon | null | undefined>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-agent-identities.d.ts","sourceRoot":"","sources":["../../src/hooks/use-agent-identities.ts"],"names":[],"mappings":"AAKA,yGAAyG;AACzG,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"use-agent-identities.d.ts","sourceRoot":"","sources":["../../src/hooks/use-agent-identities.ts"],"names":[],"mappings":"AAKA,yGAAyG;AACzG,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACvC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,6DAA6D;AAC7D,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC;AAEhG,gJAAgJ;AAChJ,eAAO,MAAM,yBAAyB,mBAAmB,CAAC;AAW1D;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,GAAE,MAAkC,EAC5C,OAAO,GAAE,OAAc,GACtB,kBAAkB,GAAG,SAAS,CAUhC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type AutoplayHoldProps } from './ui/use-autoplay';
|
|
1
2
|
export interface UseScenarioPlayerOptions {
|
|
2
3
|
/** How many scenarios (tabs) the stage cycles through. */
|
|
3
4
|
scenarioCount: number;
|
|
@@ -19,15 +20,30 @@ export interface UseScenarioPlayerOptions {
|
|
|
19
20
|
* never gets to play (it is never scrolled into view) still reads complete.
|
|
20
21
|
*/
|
|
21
22
|
startAtEnd?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Whether step 0 of every scenario is an EMPTY stage, to be left at once
|
|
25
|
+
* (default true: a stage that sits empty for a whole step after a tap reads
|
|
26
|
+
* as not responding). False when step 0 already shows something to read:
|
|
27
|
+
* every step then lasts a whole `stepMs`, however the scenario was started
|
|
28
|
+
* (a page load, the rotation and a chosen tab all pace it the same).
|
|
29
|
+
*/
|
|
30
|
+
emptyFirstStep?: boolean;
|
|
22
31
|
}
|
|
23
32
|
export interface UseScenarioPlayerResult {
|
|
24
33
|
/** Index of the scenario being shown. */
|
|
25
34
|
scenario: number;
|
|
26
35
|
/** Current step, 0..lastStep. */
|
|
27
36
|
step: number;
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
/**
|
|
38
|
+
* False until it has been playable once (it has not been on screen yet).
|
|
39
|
+
* A progress line reads 0 until then, so it starts from empty when the
|
|
40
|
+
* visitor first reaches it, never part-way through a step nobody saw begin.
|
|
41
|
+
*/
|
|
42
|
+
started: boolean;
|
|
43
|
+
/** The visitor is holding it still (pressing on it, or the keyboard is inside it). */
|
|
44
|
+
held: boolean;
|
|
45
|
+
/** Spread on the stage's outer element: how a visitor stops it (`useAutoplay`). */
|
|
46
|
+
holdProps: AutoplayHoldProps;
|
|
31
47
|
/** Jump to a step in the current scenario (a visitor's tap, a stepper button). */
|
|
32
48
|
setStep: (step: number) => void;
|
|
33
49
|
/** Switch scenario and restart it from step 0. */
|
|
@@ -45,14 +61,15 @@ export interface UseScenarioPlayerResult {
|
|
|
45
61
|
* line and the stage itself agree by construction.
|
|
46
62
|
*
|
|
47
63
|
* WHEN IT MOVES is `useAutoplay`'s rule: on screen (`enabled`), tab visible,
|
|
48
|
-
* not
|
|
64
|
+
* not held by the visitor, motion allowed. Under reduced motion it parks on the last step
|
|
49
65
|
* of the current scenario, and every scenario can still be read by choosing it.
|
|
50
66
|
*
|
|
51
|
-
* The moment it becomes playable
|
|
52
|
-
*
|
|
67
|
+
* The moment it becomes playable, and at the top of every scenario (the
|
|
68
|
+
* rotation moved on, or a tab was chosen), its first step follows within
|
|
69
|
+
* `START_MS`, not a whole step later; from there every step takes `stepMs`.
|
|
53
70
|
*
|
|
54
|
-
* A visitor's own choice (`go`, `setStep`) moves the clock there and
|
|
55
|
-
*
|
|
71
|
+
* A visitor's own choice (`go`, `setStep`) moves the clock there and lets go of
|
|
72
|
+
* any hold; the rotation carries on from that point.
|
|
56
73
|
*/
|
|
57
|
-
export declare function useScenarioPlayer({ scenarioCount, lastStep: lastStepOption, stepMs, holdMs, enabled, initialScenario, startAtEnd, }: UseScenarioPlayerOptions): UseScenarioPlayerResult;
|
|
74
|
+
export declare function useScenarioPlayer({ scenarioCount, lastStep: lastStepOption, stepMs, holdMs, enabled, initialScenario, startAtEnd, emptyFirstStep, }: UseScenarioPlayerOptions): UseScenarioPlayerResult;
|
|
58
75
|
//# sourceMappingURL=use-scenario-player.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-scenario-player.d.ts","sourceRoot":"","sources":["../../src/hooks/use-scenario-player.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-scenario-player.d.ts","sourceRoot":"","sources":["../../src/hooks/use-scenario-player.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,iBAAiB,EAAe,MAAM,mBAAmB,CAAC;AAUxE,MAAM,WAAW,wBAAwB;IACvC,0DAA0D;IAC1D,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,QAAQ,EAAE,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IAClD,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4BAA4B;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAuB;IACtC,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,sFAAsF;IACtF,IAAI,EAAE,OAAO,CAAC;IACd,mFAAmF;IACnF,SAAS,EAAE,iBAAiB,CAAC;IAC7B,kFAAkF;IAClF,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,kDAAkD;IAClD,EAAE,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,qEAAqE;IACrE,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,aAAa,EACb,QAAQ,EAAE,cAAc,EACxB,MAAM,EACN,MAAM,EACN,OAAc,EACd,eAAmB,EACnB,UAAkB,EAClB,cAAqB,GACtB,EAAE,wBAAwB,GAAG,uBAAuB,CAgEpD"}
|
|
@@ -9,15 +9,18 @@ function useScenarioPlayer({
|
|
|
9
9
|
holdMs,
|
|
10
10
|
enabled = true,
|
|
11
11
|
initialScenario = 0,
|
|
12
|
-
startAtEnd = false
|
|
12
|
+
startAtEnd = false,
|
|
13
|
+
emptyFirstStep = true
|
|
13
14
|
}) {
|
|
14
15
|
const auto = useAutoplay(enabled);
|
|
15
|
-
const { reducedMotion,
|
|
16
|
+
const { reducedMotion, held, holdProps, release } = auto;
|
|
16
17
|
const [scenario, setScenario] = useState(initialScenario);
|
|
17
18
|
const [rawStep, setRawStep] = useState(startAtEnd ? Number.MAX_SAFE_INTEGER : 0);
|
|
18
19
|
const lastStep = typeof lastStepOption === "function" ? lastStepOption(scenario) : lastStepOption;
|
|
19
20
|
const step = reducedMotion ? lastStep : Math.min(rawStep, lastStep);
|
|
20
21
|
const playing = auto.playing && scenarioCount > 0;
|
|
22
|
+
const [started, setStarted] = useState(false);
|
|
23
|
+
if (playing && !started) setStarted(true);
|
|
21
24
|
const starting = useRef(false);
|
|
22
25
|
const wasPlaying = useRef(false);
|
|
23
26
|
useEffect(() => {
|
|
@@ -25,7 +28,7 @@ function useScenarioPlayer({
|
|
|
25
28
|
wasPlaying.current = playing;
|
|
26
29
|
if (!playing) return void 0;
|
|
27
30
|
const atEnd = rawStep >= lastStep;
|
|
28
|
-
const quickStart = starting.current && !atEnd;
|
|
31
|
+
const quickStart = emptyFirstStep && (starting.current || rawStep === 0) && !atEnd;
|
|
29
32
|
starting.current = false;
|
|
30
33
|
const timer = setTimeout(
|
|
31
34
|
() => {
|
|
@@ -39,23 +42,23 @@ function useScenarioPlayer({
|
|
|
39
42
|
atEnd ? holdMs : quickStart ? Math.min(START_MS, stepMs) : stepMs
|
|
40
43
|
);
|
|
41
44
|
return () => clearTimeout(timer);
|
|
42
|
-
}, [playing, rawStep, lastStep, stepMs, holdMs, scenario, scenarioCount]);
|
|
45
|
+
}, [playing, rawStep, lastStep, stepMs, holdMs, scenario, scenarioCount, emptyFirstStep]);
|
|
43
46
|
const setStep = useCallback(
|
|
44
47
|
(next) => {
|
|
45
48
|
setRawStep(Math.max(0, Math.min(lastStep, next)));
|
|
46
|
-
|
|
49
|
+
release();
|
|
47
50
|
},
|
|
48
|
-
[lastStep,
|
|
51
|
+
[lastStep, release]
|
|
49
52
|
);
|
|
50
53
|
const go = useCallback(
|
|
51
54
|
(next) => {
|
|
52
55
|
setScenario(next);
|
|
53
56
|
setRawStep(0);
|
|
54
|
-
|
|
57
|
+
release();
|
|
55
58
|
},
|
|
56
|
-
[
|
|
59
|
+
[release]
|
|
57
60
|
);
|
|
58
|
-
return { scenario, step,
|
|
61
|
+
return { scenario, step, started: started || reducedMotion, held, holdProps, setStep, go, reducedMotion };
|
|
59
62
|
}
|
|
60
63
|
export {
|
|
61
64
|
useScenarioPlayer
|