@robertlinde/react-tour-kit 0.8.9 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/MIGRATION.md +205 -0
- package/README.md +401 -850
- package/dist/react-native-platform/hooks/use-tour-scroll-view.hook.d.ts +14 -0
- package/dist/react-native-platform/hooks/use-tour-scroll-view.hook.d.ts.map +1 -0
- package/dist/react-native-platform/hooks/use-tour-scroll-view.hook.js +21 -0
- package/dist/react-native-platform/hooks/use-tour-scroll-view.hook.js.map +1 -0
- package/dist/react-native-platform/hooks/use-tour-target.hook.d.ts +15 -0
- package/dist/react-native-platform/hooks/use-tour-target.hook.d.ts.map +1 -0
- package/dist/react-native-platform/hooks/use-tour-target.hook.js +28 -0
- package/dist/react-native-platform/hooks/use-tour-target.hook.js.map +1 -0
- package/dist/react-native-platform/host-store.d.ts +24 -0
- package/dist/react-native-platform/host-store.d.ts.map +1 -0
- package/dist/react-native-platform/host-store.js +63 -0
- package/dist/react-native-platform/host-store.js.map +1 -0
- package/dist/react-native-platform/insets.util.d.ts +11 -0
- package/dist/react-native-platform/insets.util.d.ts.map +1 -0
- package/dist/react-native-platform/insets.util.js +31 -0
- package/dist/react-native-platform/insets.util.js.map +1 -0
- package/dist/react-native-platform/layer/native-renderer.d.ts +7 -0
- package/dist/react-native-platform/layer/native-renderer.d.ts.map +1 -0
- package/dist/react-native-platform/layer/native-renderer.js +496 -0
- package/dist/react-native-platform/layer/native-renderer.js.map +1 -0
- package/dist/react-native-platform/layer/tour-host.d.ts +13 -0
- package/dist/react-native-platform/layer/tour-host.d.ts.map +1 -0
- package/dist/react-native-platform/layer/tour-host.js +70 -0
- package/dist/react-native-platform/layer/tour-host.js.map +1 -0
- package/dist/react-native-platform/measure.util.d.ts +20 -0
- package/dist/react-native-platform/measure.util.d.ts.map +1 -0
- package/dist/react-native-platform/measure.util.js +100 -0
- package/dist/react-native-platform/measure.util.js.map +1 -0
- package/dist/react-native-platform/native-context.d.ts +12 -0
- package/dist/react-native-platform/native-context.d.ts.map +1 -0
- package/dist/react-native-platform/native-context.js +4 -0
- package/dist/react-native-platform/native-context.js.map +1 -0
- package/dist/react-native-platform/native-environment.d.ts +14 -0
- package/dist/react-native-platform/native-environment.d.ts.map +1 -0
- package/dist/react-native-platform/native-environment.js +20 -0
- package/dist/react-native-platform/native-environment.js.map +1 -0
- package/dist/react-native-platform/native-platform.d.ts +19 -0
- package/dist/react-native-platform/native-platform.d.ts.map +1 -0
- package/dist/react-native-platform/native-platform.js +265 -0
- package/dist/react-native-platform/native-platform.js.map +1 -0
- package/dist/react-native-platform/reduced-motion.d.ts +4 -0
- package/dist/react-native-platform/reduced-motion.d.ts.map +1 -0
- package/dist/react-native-platform/reduced-motion.js +44 -0
- package/dist/react-native-platform/reduced-motion.js.map +1 -0
- package/dist/react-native-platform/registry.d.ts +18 -0
- package/dist/react-native-platform/registry.d.ts.map +1 -0
- package/dist/react-native-platform/registry.js +51 -0
- package/dist/react-native-platform/registry.js.map +1 -0
- package/dist/react-native-platform/tour-provider.d.ts +16 -3
- package/dist/react-native-platform/tour-provider.d.ts.map +1 -0
- package/dist/react-native-platform/tour-provider.js +92 -211
- package/dist/react-native-platform/tour-provider.js.map +1 -1
- package/dist/react-native.d.ts +14 -10
- package/dist/react-native.d.ts.map +1 -0
- package/dist/react-native.js +7 -7
- package/dist/react-native.js.map +1 -1
- package/dist/react-platform/dom/elements.util.d.ts +35 -0
- package/dist/react-platform/dom/elements.util.d.ts.map +1 -0
- package/dist/react-platform/dom/elements.util.js +155 -0
- package/dist/react-platform/dom/elements.util.js.map +1 -0
- package/dist/react-platform/dom/occluders.util.d.ts +13 -0
- package/dist/react-platform/dom/occluders.util.d.ts.map +1 -0
- package/dist/react-platform/dom/occluders.util.js +75 -0
- package/dist/react-platform/dom/occluders.util.js.map +1 -0
- package/dist/react-platform/dom/scroll-lock.util.d.ts +13 -0
- package/dist/react-platform/dom/scroll-lock.util.d.ts.map +1 -0
- package/dist/react-platform/dom/scroll-lock.util.js +219 -0
- package/dist/react-platform/dom/scroll-lock.util.js.map +1 -0
- package/dist/react-platform/dom/scroll.util.d.ts +44 -0
- package/dist/react-platform/dom/scroll.util.d.ts.map +1 -0
- package/dist/react-platform/dom/scroll.util.js +250 -0
- package/dist/react-platform/dom/scroll.util.js.map +1 -0
- package/dist/react-platform/dom/viewport.util.d.ts +16 -0
- package/dist/react-platform/dom/viewport.util.d.ts.map +1 -0
- package/dist/react-platform/dom/viewport.util.js +65 -0
- package/dist/react-platform/dom/viewport.util.js.map +1 -0
- package/dist/react-platform/dom/web-platform.d.ts +15 -0
- package/dist/react-platform/dom/web-platform.d.ts.map +1 -0
- package/dist/react-platform/dom/web-platform.js +169 -0
- package/dist/react-platform/dom/web-platform.js.map +1 -0
- package/dist/react-platform/layer/styles.d.ts +12 -0
- package/dist/react-platform/layer/styles.d.ts.map +1 -0
- package/dist/react-platform/layer/styles.js +285 -0
- package/dist/react-platform/layer/styles.js.map +1 -0
- package/dist/react-platform/layer/web-renderer.d.ts +4 -0
- package/dist/react-platform/layer/web-renderer.d.ts.map +1 -0
- package/dist/react-platform/layer/web-renderer.js +390 -0
- package/dist/react-platform/layer/web-renderer.js.map +1 -0
- package/dist/react-platform/tour-provider.d.ts +9 -3
- package/dist/react-platform/tour-provider.d.ts.map +1 -0
- package/dist/react-platform/tour-provider.js +28 -218
- package/dist/react-platform/tour-provider.js.map +1 -1
- package/dist/react.d.ts +10 -10
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +5 -7
- package/dist/react.js.map +1 -1
- package/dist/shared/engine/abort.util.d.ts +17 -0
- package/dist/shared/engine/abort.util.d.ts.map +1 -0
- package/dist/shared/engine/abort.util.js +72 -0
- package/dist/shared/engine/abort.util.js.map +1 -0
- package/dist/shared/engine/report.util.d.ts +12 -0
- package/dist/shared/engine/report.util.d.ts.map +1 -0
- package/dist/shared/engine/report.util.js +51 -0
- package/dist/shared/engine/report.util.js.map +1 -0
- package/dist/shared/engine/tour-adapter.type.d.ts +67 -0
- package/dist/shared/engine/tour-adapter.type.d.ts.map +1 -0
- package/dist/shared/engine/tour-adapter.type.js +2 -0
- package/dist/shared/engine/tour-adapter.type.js.map +1 -0
- package/dist/shared/engine/tour-engine.d.ts +101 -0
- package/dist/shared/engine/tour-engine.d.ts.map +1 -0
- package/dist/shared/engine/tour-engine.js +835 -0
- package/dist/shared/engine/tour-engine.js.map +1 -0
- package/dist/shared/geometry/box.util.d.ts +39 -0
- package/dist/shared/geometry/box.util.d.ts.map +1 -0
- package/dist/shared/geometry/box.util.js +146 -0
- package/dist/shared/geometry/box.util.js.map +1 -0
- package/dist/shared/geometry/compute-tooltip-layout.util.d.ts +60 -0
- package/dist/shared/geometry/compute-tooltip-layout.util.d.ts.map +1 -0
- package/dist/shared/geometry/compute-tooltip-layout.util.js +148 -0
- package/dist/shared/geometry/compute-tooltip-layout.util.js.map +1 -0
- package/dist/shared/geometry/geometry.type.d.ts +34 -0
- package/dist/shared/geometry/geometry.type.d.ts.map +1 -0
- package/dist/shared/geometry/geometry.type.js +2 -0
- package/dist/shared/geometry/geometry.type.js.map +1 -0
- package/dist/shared/geometry/reveal.util.d.ts +38 -0
- package/dist/shared/geometry/reveal.util.d.ts.map +1 -0
- package/dist/shared/geometry/reveal.util.js +135 -0
- package/dist/shared/geometry/reveal.util.js.map +1 -0
- package/dist/shared/geometry/target-visibility.util.d.ts +10 -0
- package/dist/shared/geometry/target-visibility.util.d.ts.map +1 -0
- package/dist/shared/geometry/target-visibility.util.js +29 -0
- package/dist/shared/geometry/target-visibility.util.js.map +1 -0
- package/dist/shared/platform/create-tour-adapter.d.ts +9 -0
- package/dist/shared/platform/create-tour-adapter.d.ts.map +1 -0
- package/dist/shared/platform/create-tour-adapter.js +145 -0
- package/dist/shared/platform/create-tour-adapter.js.map +1 -0
- package/dist/shared/platform/platform.type.d.ts +77 -0
- package/dist/shared/platform/platform.type.d.ts.map +1 -0
- package/dist/shared/platform/platform.type.js +2 -0
- package/dist/shared/platform/platform.type.js.map +1 -0
- package/dist/shared/platform/reveal-in-scroll-containers.d.ts +27 -0
- package/dist/shared/platform/reveal-in-scroll-containers.d.ts.map +1 -0
- package/dist/shared/platform/reveal-in-scroll-containers.js +49 -0
- package/dist/shared/platform/reveal-in-scroll-containers.js.map +1 -0
- package/dist/shared/react/tour-context.d.ts +7 -0
- package/dist/shared/react/tour-context.d.ts.map +1 -0
- package/dist/shared/react/tour-context.js +23 -0
- package/dist/shared/react/tour-context.js.map +1 -0
- package/dist/shared/react/tour-provider-core.d.ts +41 -0
- package/dist/shared/react/tour-provider-core.d.ts.map +1 -0
- package/dist/shared/react/tour-provider-core.js +24 -0
- package/dist/shared/react/tour-provider-core.js.map +1 -0
- package/dist/shared/react/tour-root.d.ts +14 -0
- package/dist/shared/react/tour-root.d.ts.map +1 -0
- package/dist/shared/react/tour-root.js +22 -0
- package/dist/shared/react/tour-root.js.map +1 -0
- package/dist/shared/react/use-isomorphic-layout-effect.hook.d.ts +4 -0
- package/dist/shared/react/use-isomorphic-layout-effect.hook.d.ts.map +1 -0
- package/dist/shared/react/use-isomorphic-layout-effect.hook.js +5 -0
- package/dist/shared/react/use-isomorphic-layout-effect.hook.js.map +1 -0
- package/dist/shared/react/use-tour-view.hook.d.ts +5 -0
- package/dist/shared/react/use-tour-view.hook.d.ts.map +1 -0
- package/dist/shared/react/use-tour-view.hook.js +14 -0
- package/dist/shared/react/use-tour-view.hook.js.map +1 -0
- package/dist/shared/react/use-tour.hook.d.ts +7 -0
- package/dist/shared/react/use-tour.hook.d.ts.map +1 -0
- package/dist/shared/react/use-tour.hook.js +10 -0
- package/dist/shared/react/use-tour.hook.js.map +1 -0
- package/dist/shared/renderer/default-tooltip.d.ts +5 -0
- package/dist/shared/renderer/default-tooltip.d.ts.map +1 -0
- package/dist/shared/renderer/default-tooltip.js +13 -0
- package/dist/shared/renderer/default-tooltip.js.map +1 -0
- package/dist/shared/renderer/motion.d.ts +29 -0
- package/dist/shared/renderer/motion.d.ts.map +1 -0
- package/dist/shared/renderer/motion.js +49 -0
- package/dist/shared/renderer/motion.js.map +1 -0
- package/dist/shared/renderer/renderer-context.d.ts +17 -0
- package/dist/shared/renderer/renderer-context.d.ts.map +1 -0
- package/dist/shared/renderer/renderer-context.js +16 -0
- package/dist/shared/renderer/renderer-context.js.map +1 -0
- package/dist/shared/renderer/renderer.type.d.ts +164 -0
- package/dist/shared/renderer/renderer.type.d.ts.map +1 -0
- package/dist/shared/renderer/renderer.type.js +2 -0
- package/dist/shared/renderer/renderer.type.js.map +1 -0
- package/dist/shared/renderer/tooltip-model.d.ts +32 -0
- package/dist/shared/renderer/tooltip-model.d.ts.map +1 -0
- package/dist/shared/renderer/tooltip-model.js +24 -0
- package/dist/shared/renderer/tooltip-model.js.map +1 -0
- package/dist/shared/renderer/tour-overlay.d.ts +24 -0
- package/dist/shared/renderer/tour-overlay.d.ts.map +1 -0
- package/dist/shared/renderer/tour-overlay.js +228 -0
- package/dist/shared/renderer/tour-overlay.js.map +1 -0
- package/dist/shared/types/tour-context.type.d.ts +21 -11
- package/dist/shared/types/tour-context.type.d.ts.map +1 -0
- package/dist/shared/types/tour-end-info.type.d.ts +19 -2
- package/dist/shared/types/tour-end-info.type.d.ts.map +1 -0
- package/dist/shared/types/tour-i18n.type.d.ts +8 -0
- package/dist/shared/types/tour-i18n.type.d.ts.map +1 -0
- package/dist/shared/types/tour-step.type.d.ts +35 -6
- package/dist/shared/types/tour-step.type.d.ts.map +1 -0
- package/dist/shared/types/tour-theme.type.d.ts +22 -2
- package/dist/shared/types/tour-theme.type.d.ts.map +1 -0
- package/dist/shared/types/tour-theme.type.js +1 -16
- package/dist/shared/types/tour-theme.type.js.map +1 -1
- package/dist/shared/types/tour-tooltip-props.type.d.ts +21 -17
- package/dist/shared/types/tour-tooltip-props.type.d.ts.map +1 -0
- package/dist/shared/utils/frame.util.d.ts +6 -0
- package/dist/shared/utils/frame.util.d.ts.map +1 -0
- package/dist/shared/utils/frame.util.js +20 -0
- package/dist/shared/utils/frame.util.js.map +1 -0
- package/dist/shared/utils/get-truncated-dots.util.d.ts +13 -7
- package/dist/shared/utils/get-truncated-dots.util.d.ts.map +1 -0
- package/dist/shared/utils/get-truncated-dots.util.js +30 -30
- package/dist/shared/utils/get-truncated-dots.util.js.map +1 -1
- package/dist/shared/utils/i18n.util.d.ts +7 -0
- package/dist/shared/utils/i18n.util.d.ts.map +1 -0
- package/dist/shared/utils/i18n.util.js +34 -0
- package/dist/shared/utils/i18n.util.js.map +1 -0
- package/dist/shared/utils/theme.util.d.ts +6 -0
- package/dist/shared/utils/theme.util.d.ts.map +1 -0
- package/dist/shared/utils/theme.util.js +31 -0
- package/dist/shared/utils/theme.util.js.map +1 -0
- package/package.json +72 -55
- package/src/react-native-platform/hooks/use-tour-scroll-view.hook.ts +24 -0
- package/src/react-native-platform/hooks/use-tour-target.hook.ts +30 -0
- package/src/react-native-platform/host-store.ts +92 -0
- package/src/react-native-platform/insets.util.ts +39 -0
- package/src/react-native-platform/layer/native-renderer.tsx +776 -0
- package/src/react-native-platform/layer/tour-host.tsx +105 -0
- package/src/react-native-platform/measure.util.ts +140 -0
- package/src/react-native-platform/native-context.ts +15 -0
- package/src/react-native-platform/native-environment.ts +33 -0
- package/src/react-native-platform/native-platform.ts +368 -0
- package/src/react-native-platform/reduced-motion.ts +47 -0
- package/src/react-native-platform/registry.ts +70 -0
- package/src/react-native-platform/tour-provider.tsx +148 -0
- package/src/react-native.ts +15 -0
- package/src/react-platform/dom/elements.util.ts +191 -0
- package/src/react-platform/dom/occluders.util.ts +88 -0
- package/src/react-platform/dom/scroll-lock.util.ts +261 -0
- package/src/react-platform/dom/scroll.util.ts +310 -0
- package/src/react-platform/dom/viewport.util.ts +74 -0
- package/src/react-platform/dom/web-platform.ts +208 -0
- package/src/react-platform/layer/styles.ts +286 -0
- package/src/react-platform/layer/web-renderer.tsx +594 -0
- package/src/react-platform/tour-provider.tsx +44 -0
- package/src/react.ts +13 -0
- package/src/shared/engine/abort.util.ts +84 -0
- package/src/shared/engine/report.util.ts +58 -0
- package/src/shared/engine/tour-adapter.type.ts +73 -0
- package/src/shared/engine/tour-engine.ts +1147 -0
- package/src/shared/geometry/box.util.ts +185 -0
- package/src/shared/geometry/compute-tooltip-layout.util.ts +238 -0
- package/src/shared/geometry/geometry.type.ts +38 -0
- package/src/shared/geometry/reveal.util.ts +190 -0
- package/src/shared/geometry/target-visibility.util.ts +44 -0
- package/src/shared/platform/create-tour-adapter.ts +169 -0
- package/src/shared/platform/platform.type.ts +81 -0
- package/src/shared/platform/reveal-in-scroll-containers.ts +78 -0
- package/src/shared/react/tour-context.ts +28 -0
- package/src/shared/react/tour-provider-core.ts +67 -0
- package/src/shared/react/tour-root.tsx +34 -0
- package/src/shared/react/use-isomorphic-layout-effect.hook.ts +7 -0
- package/src/shared/react/use-tour-view.hook.ts +17 -0
- package/src/shared/react/use-tour.hook.ts +11 -0
- package/src/shared/renderer/default-tooltip.tsx +52 -0
- package/src/shared/renderer/motion.ts +59 -0
- package/src/shared/renderer/renderer-context.ts +33 -0
- package/src/shared/renderer/renderer.type.ts +183 -0
- package/src/shared/renderer/tooltip-model.ts +44 -0
- package/src/shared/renderer/tour-overlay.tsx +453 -0
- package/src/shared/types/tour-context.type.ts +23 -0
- package/src/shared/types/tour-end-info.type.ts +32 -0
- package/src/shared/types/tour-i18n.type.ts +15 -0
- package/src/shared/types/tour-step.type.ts +40 -0
- package/src/shared/types/tour-theme.type.ts +28 -0
- package/src/shared/types/tour-tooltip-props.type.ts +27 -0
- package/src/shared/utils/frame.util.ts +21 -0
- package/src/shared/utils/get-truncated-dots.util.ts +46 -0
- package/src/shared/utils/i18n.util.ts +44 -0
- package/src/shared/utils/theme.util.ts +38 -0
- package/dist/react-native-platform/components/index.d.ts +0 -2
- package/dist/react-native-platform/components/index.js +0 -3
- package/dist/react-native-platform/components/index.js.map +0 -1
- package/dist/react-native-platform/components/tour-overlay.d.ts +0 -3
- package/dist/react-native-platform/components/tour-overlay.js +0 -26
- package/dist/react-native-platform/components/tour-overlay.js.map +0 -1
- package/dist/react-native-platform/components/tour-tooltip.d.ts +0 -3
- package/dist/react-native-platform/components/tour-tooltip.js +0 -167
- package/dist/react-native-platform/components/tour-tooltip.js.map +0 -1
- package/dist/react-native-platform/hooks/index.d.ts +0 -1
- package/dist/react-native-platform/hooks/index.js +0 -2
- package/dist/react-native-platform/hooks/index.js.map +0 -1
- package/dist/react-native-platform/hooks/use-tour-target.d.ts +0 -2
- package/dist/react-native-platform/hooks/use-tour-target.js +0 -13
- package/dist/react-native-platform/hooks/use-tour-target.js.map +0 -1
- package/dist/react-native-platform/index.d.ts +0 -7
- package/dist/react-native-platform/index.js +0 -7
- package/dist/react-native-platform/index.js.map +0 -1
- package/dist/react-native-platform/platform-adapter.d.ts +0 -2
- package/dist/react-native-platform/platform-adapter.js +0 -84
- package/dist/react-native-platform/platform-adapter.js.map +0 -1
- package/dist/react-native-platform/target-registry.d.ts +0 -10
- package/dist/react-native-platform/target-registry.js +0 -17
- package/dist/react-native-platform/target-registry.js.map +0 -1
- package/dist/react-native-platform/types/tour-provider.props.type.d.ts +0 -12
- package/dist/react-native-platform/types/tour-provider.props.type.js +0 -2
- package/dist/react-native-platform/types/tour-provider.props.type.js.map +0 -1
- package/dist/react-platform/components/index.d.ts +0 -2
- package/dist/react-platform/components/index.js +0 -3
- package/dist/react-platform/components/index.js.map +0 -1
- package/dist/react-platform/components/tour-overlay.d.ts +0 -3
- package/dist/react-platform/components/tour-overlay.js +0 -29
- package/dist/react-platform/components/tour-overlay.js.map +0 -1
- package/dist/react-platform/components/tour-tooltip.d.ts +0 -2
- package/dist/react-platform/components/tour-tooltip.js +0 -155
- package/dist/react-platform/components/tour-tooltip.js.map +0 -1
- package/dist/react-platform/index.d.ts +0 -6
- package/dist/react-platform/index.js +0 -6
- package/dist/react-platform/index.js.map +0 -1
- package/dist/react-platform/platform-adapter.d.ts +0 -2
- package/dist/react-platform/platform-adapter.js +0 -101
- package/dist/react-platform/platform-adapter.js.map +0 -1
- package/dist/react-platform/types/tour-provider.props.type.d.ts +0 -12
- package/dist/react-platform/types/tour-provider.props.type.js +0 -2
- package/dist/react-platform/types/tour-provider.props.type.js.map +0 -1
- package/dist/react-platform/utils/find-visible-element.util.d.ts +0 -1
- package/dist/react-platform/utils/find-visible-element.util.js +0 -11
- package/dist/react-platform/utils/find-visible-element.util.js.map +0 -1
- package/dist/react-platform/utils/index.d.ts +0 -1
- package/dist/react-platform/utils/index.js +0 -2
- package/dist/react-platform/utils/index.js.map +0 -1
- package/dist/shared/context/index.d.ts +0 -1
- package/dist/shared/context/index.js +0 -2
- package/dist/shared/context/index.js.map +0 -1
- package/dist/shared/context/tour-context.d.ts +0 -3
- package/dist/shared/context/tour-context.js +0 -14
- package/dist/shared/context/tour-context.js.map +0 -1
- package/dist/shared/hooks/index.d.ts +0 -1
- package/dist/shared/hooks/index.js +0 -2
- package/dist/shared/hooks/index.js.map +0 -1
- package/dist/shared/hooks/use-tour.hook.d.ts +0 -2
- package/dist/shared/hooks/use-tour.hook.js +0 -7
- package/dist/shared/hooks/use-tour.hook.js.map +0 -1
- package/dist/shared/index.d.ts +0 -7
- package/dist/shared/index.js +0 -6
- package/dist/shared/index.js.map +0 -1
- package/dist/shared/types/index.d.ts +0 -10
- package/dist/shared/types/index.js +0 -2
- package/dist/shared/types/index.js.map +0 -1
- package/dist/shared/types/platform-adapter.type.d.ts +0 -24
- package/dist/shared/types/platform-adapter.type.js +0 -2
- package/dist/shared/types/platform-adapter.type.js.map +0 -1
- package/dist/shared/types/rect.type.d.ts +0 -11
- package/dist/shared/types/rect.type.js +0 -2
- package/dist/shared/types/rect.type.js.map +0 -1
- package/dist/shared/types/tour-overlay-props.type.d.ts +0 -8
- package/dist/shared/types/tour-overlay-props.type.js +0 -2
- package/dist/shared/types/tour-overlay-props.type.js.map +0 -1
- package/dist/shared/utils/calculate-tooltip-position.util.d.ts +0 -14
- package/dist/shared/utils/calculate-tooltip-position.util.js +0 -49
- package/dist/shared/utils/calculate-tooltip-position.util.js.map +0 -1
- package/dist/shared/utils/index.d.ts +0 -3
- package/dist/shared/utils/index.js +0 -3
- package/dist/shared/utils/index.js.map +0 -1
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import type {TargetMeasurement} from '../../shared/engine/tour-adapter.type.js';
|
|
2
|
+
import type {ExternalValue, PlatformAdapter, ScrollContainer} from '../../shared/platform/platform.type.js';
|
|
3
|
+
import type {TourTarget} from '../../shared/types/tour-step.type.js';
|
|
4
|
+
import {hasLayout, isRendered, resolveTarget, toBox} from './elements.util.js';
|
|
5
|
+
import {clearOccluderCache, findOccluders, occludersOver} from './occluders.util.js';
|
|
6
|
+
import {pageOverflow} from './scroll-lock.util.js';
|
|
7
|
+
import {elementContainer, inspectAncestors, pageContainer} from './scroll.util.js';
|
|
8
|
+
import {readViewport} from './viewport.util.js';
|
|
9
|
+
|
|
10
|
+
export type WebPlatform = PlatformAdapter & {
|
|
11
|
+
/**
|
|
12
|
+
* Adds the element the tour is drawn into at the end of `<body>`. Its changes are ignored, it is
|
|
13
|
+
* skipped when looking for elements covering the target, and its pointer, focus and key events
|
|
14
|
+
* stay inside it. Returns the element to render into and the cleanup.
|
|
15
|
+
*/
|
|
16
|
+
readonly mountHost: () => {readonly container: HTMLElement; readonly unmount: () => void};
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Events that must not reach the app's listeners on `<body>`, `document` or `window`: "click
|
|
21
|
+
* outside" handlers of menus and popovers (which would close the menu a step highlights), focus
|
|
22
|
+
* traps of the app's own dialogs, and keyboard shortcuts. The page is inert while the tour is
|
|
23
|
+
* open, so nothing in it expects them.
|
|
24
|
+
*/
|
|
25
|
+
const isolatedEvents = [
|
|
26
|
+
'pointerdown',
|
|
27
|
+
'pointerup',
|
|
28
|
+
'mousedown',
|
|
29
|
+
'mouseup',
|
|
30
|
+
'touchstart',
|
|
31
|
+
'touchend',
|
|
32
|
+
'click',
|
|
33
|
+
'dblclick',
|
|
34
|
+
'auxclick',
|
|
35
|
+
'contextmenu',
|
|
36
|
+
'focusin',
|
|
37
|
+
'focusout',
|
|
38
|
+
'keydown',
|
|
39
|
+
'keyup',
|
|
40
|
+
] as const;
|
|
41
|
+
|
|
42
|
+
/** Where a target is reported in documents without layout (jsdom), so tours still run in tests: at the top of the screen. */
|
|
43
|
+
const placeholderRect = {x: 0, y: 0, width: 1, height: 1};
|
|
44
|
+
|
|
45
|
+
function measureElement(element: Element, host: Element | undefined): TargetMeasurement | undefined {
|
|
46
|
+
if (!element.isConnected || !isRendered(element)) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (!hasLayout()) {
|
|
51
|
+
return {rect: placeholderRect, clip: undefined, occluders: []};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const rect = toBox(element.getBoundingClientRect());
|
|
55
|
+
return {rect, clip: inspectAncestors(element).clip, occluders: occludersOver(rect, findOccluders(element, host))};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** `prefers-reduced-motion`, live. */
|
|
59
|
+
function reducedMotionQuery(): ExternalValue<boolean> {
|
|
60
|
+
const query =
|
|
61
|
+
typeof globalThis.matchMedia === 'function' ? globalThis.matchMedia('(prefers-reduced-motion: reduce)') : undefined;
|
|
62
|
+
return {
|
|
63
|
+
get: () => query?.matches ?? false,
|
|
64
|
+
subscribe(listener) {
|
|
65
|
+
query?.addEventListener('change', listener);
|
|
66
|
+
return () => {
|
|
67
|
+
query?.removeEventListener('change', listener);
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** The web's raw facts for the tour: measuring elements, layout events, scroll containers, the visible area. */
|
|
74
|
+
export function createWebPlatform(): WebPlatform {
|
|
75
|
+
let host: HTMLElement | undefined;
|
|
76
|
+
const isOwnNode = (node: Node): boolean => host?.contains(node) ?? false;
|
|
77
|
+
const measureTarget = (target: TourTarget): TargetMeasurement | undefined => {
|
|
78
|
+
const element = resolveTarget(target);
|
|
79
|
+
return element ? measureElement(element, host) : undefined;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
async measure(target): Promise<TargetMeasurement | undefined> {
|
|
84
|
+
return measureTarget(target);
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
subscribe(target, onChange): () => void {
|
|
88
|
+
// Size changes of the page and of the target (also elements that exist but have no size yet:
|
|
89
|
+
// expanding drawers, entrance transitions). Selector targets can be replaced by a new element.
|
|
90
|
+
const resize =
|
|
91
|
+
typeof ResizeObserver === 'function'
|
|
92
|
+
? new ResizeObserver(() => {
|
|
93
|
+
onChange();
|
|
94
|
+
})
|
|
95
|
+
: undefined;
|
|
96
|
+
resize?.observe(document.documentElement);
|
|
97
|
+
let observed: Element | undefined;
|
|
98
|
+
const follow = (): void => {
|
|
99
|
+
const next = target === undefined ? undefined : resolveTarget(target);
|
|
100
|
+
if (next !== observed) {
|
|
101
|
+
if (observed) {
|
|
102
|
+
resize?.unobserve(observed);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
observed = next;
|
|
106
|
+
if (next) {
|
|
107
|
+
resize?.observe(next);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const notify = (): void => {
|
|
113
|
+
follow();
|
|
114
|
+
onChange();
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
follow();
|
|
118
|
+
// Content inserted, removed or restyled anywhere (except the tour itself) can move the target.
|
|
119
|
+
const mutations = new MutationObserver((records) => {
|
|
120
|
+
if (records.some((record) => !isOwnNode(record.target))) {
|
|
121
|
+
notify();
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
mutations.observe(document.documentElement, {childList: true, subtree: true, attributes: true});
|
|
125
|
+
const visual = globalThis.visualViewport;
|
|
126
|
+
globalThis.addEventListener('scroll', notify, {capture: true, passive: true});
|
|
127
|
+
globalThis.addEventListener('resize', notify, {passive: true});
|
|
128
|
+
visual?.addEventListener('resize', notify, {passive: true});
|
|
129
|
+
visual?.addEventListener('scroll', notify, {passive: true});
|
|
130
|
+
document.addEventListener('transitionend', notify, true);
|
|
131
|
+
document.addEventListener('animationend', notify, true);
|
|
132
|
+
return () => {
|
|
133
|
+
resize?.disconnect();
|
|
134
|
+
mutations.disconnect();
|
|
135
|
+
globalThis.removeEventListener('scroll', notify, {capture: true});
|
|
136
|
+
globalThis.removeEventListener('resize', notify);
|
|
137
|
+
visual?.removeEventListener('resize', notify);
|
|
138
|
+
visual?.removeEventListener('scroll', notify);
|
|
139
|
+
document.removeEventListener('transitionend', notify, true);
|
|
140
|
+
document.removeEventListener('animationend', notify, true);
|
|
141
|
+
clearOccluderCache();
|
|
142
|
+
};
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
// Layout is always announced: by the ResizeObserver above (or, without one, by the other events).
|
|
146
|
+
isAwaitingLayout: () => false,
|
|
147
|
+
|
|
148
|
+
async scrollContainers(target): Promise<readonly ScrollContainer[]> {
|
|
149
|
+
const element = resolveTarget(target);
|
|
150
|
+
if (!element || !hasLayout()) {
|
|
151
|
+
return [];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const occluders = (): ReturnType<typeof findOccluders> => findOccluders(element, host);
|
|
155
|
+
const ancestors = inspectAncestors(element);
|
|
156
|
+
const containers = ancestors.scrollers.map((scroller) =>
|
|
157
|
+
elementContainer(scroller.element, scroller.axes, occluders),
|
|
158
|
+
);
|
|
159
|
+
// Inside a `position: fixed` element, scrolling the page does not move the target.
|
|
160
|
+
return ancestors.fixed ? containers : [...containers, pageContainer(occluders, pageOverflow())];
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
getViewport: readViewport,
|
|
164
|
+
|
|
165
|
+
reducedMotion: reducedMotionQuery(),
|
|
166
|
+
|
|
167
|
+
measuresWhileScrolling: true,
|
|
168
|
+
|
|
169
|
+
getPixelRatio: (): number => globalThis.devicePixelRatio || 1,
|
|
170
|
+
|
|
171
|
+
mountHost(): {readonly container: HTMLElement; readonly unmount: () => void} {
|
|
172
|
+
const element = document.createElement('div');
|
|
173
|
+
element.dataset.rtkHost = '';
|
|
174
|
+
// No box of its own: the page's layout (flex or grid `<body>`, `:last-child` rules) stays as it is.
|
|
175
|
+
element.style.display = 'contents';
|
|
176
|
+
// React listens for events on the element it renders into: keep that one inside, so the tour's
|
|
177
|
+
// own handlers run before the events are stopped here.
|
|
178
|
+
const container = document.createElement('div');
|
|
179
|
+
container.style.display = 'contents';
|
|
180
|
+
element.append(container);
|
|
181
|
+
const stop = (event: Event): void => {
|
|
182
|
+
event.stopPropagation();
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
for (const type of isolatedEvents) {
|
|
186
|
+
element.addEventListener(type, stop);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
document.body.append(element);
|
|
190
|
+
host = element;
|
|
191
|
+
return {
|
|
192
|
+
container,
|
|
193
|
+
unmount(): void {
|
|
194
|
+
for (const type of isolatedEvents) {
|
|
195
|
+
element.removeEventListener(type, stop);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
element.remove();
|
|
199
|
+
if (host === element) {
|
|
200
|
+
host = undefined;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
clearOccluderCache();
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Styles of the web tour layer. Everything is scoped to `rtk-` classes. Theme values arrive as
|
|
3
|
+
* CSS variables set on `.rtk-root`. All rules live in a cascade layer, so the app's own CSS wins
|
|
4
|
+
* over them without `!important` — except for the few properties marked `!important` here: what
|
|
5
|
+
* keeps the tour in place, clickable and readable, which global resets (Tailwind's preflight,
|
|
6
|
+
* normalize.css, Bootstrap, `dialog {…}` or `button {…}` rules) would otherwise change. Those
|
|
7
|
+
* still follow the CSS variables.
|
|
8
|
+
*/
|
|
9
|
+
export const tourCss = `
|
|
10
|
+
@layer react-tour-kit {
|
|
11
|
+
:where(.rtk-root) {
|
|
12
|
+
--rtk-primary: #2563eb;
|
|
13
|
+
--rtk-on-primary: #ffffff;
|
|
14
|
+
--rtk-bg: #ffffff;
|
|
15
|
+
--rtk-title: #111827;
|
|
16
|
+
--rtk-text: #4b5563;
|
|
17
|
+
--rtk-overlay: rgba(0, 0, 0, 0.5);
|
|
18
|
+
--rtk-radius: 12px;
|
|
19
|
+
--rtk-spotlight-radius: 8px;
|
|
20
|
+
--rtk-ease: cubic-bezier(0.2, 0, 0, 1);
|
|
21
|
+
--rtk-z-index: 2147483000;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.rtk-root {
|
|
25
|
+
position: fixed !important;
|
|
26
|
+
inset: 0 !important;
|
|
27
|
+
box-sizing: border-box !important;
|
|
28
|
+
width: 100% !important;
|
|
29
|
+
height: 100% !important;
|
|
30
|
+
max-width: none !important;
|
|
31
|
+
max-height: none !important;
|
|
32
|
+
margin: 0 !important;
|
|
33
|
+
padding: 0 !important;
|
|
34
|
+
border: 0 !important;
|
|
35
|
+
background: transparent !important;
|
|
36
|
+
color: var(--rtk-text);
|
|
37
|
+
overflow: visible !important;
|
|
38
|
+
outline: none;
|
|
39
|
+
transform: none !important;
|
|
40
|
+
filter: none !important;
|
|
41
|
+
/* The page may have disabled pointer events on <body> (modal libraries do while open). */
|
|
42
|
+
pointer-events: auto !important;
|
|
43
|
+
z-index: var(--rtk-z-index) !important;
|
|
44
|
+
opacity: 0 !important;
|
|
45
|
+
transition: opacity var(--rtk-fade-duration, 200ms) var(--rtk-ease);
|
|
46
|
+
}
|
|
47
|
+
.rtk-root::backdrop { background: transparent !important; backdrop-filter: none !important; }
|
|
48
|
+
.rtk-root[data-visible] { opacity: 1 !important; }
|
|
49
|
+
|
|
50
|
+
.rtk-backdrop { position: fixed !important; inset: 0 !important; touch-action: pinch-zoom; }
|
|
51
|
+
.rtk-backdrop[data-closable] { cursor: pointer; }
|
|
52
|
+
|
|
53
|
+
.rtk-spotlight {
|
|
54
|
+
/* Its geometry is set inline, which an \`!important\` rule here would override. */
|
|
55
|
+
position: fixed !important;
|
|
56
|
+
right: auto;
|
|
57
|
+
bottom: auto;
|
|
58
|
+
margin: 0 !important;
|
|
59
|
+
box-sizing: border-box !important;
|
|
60
|
+
padding: 0 !important;
|
|
61
|
+
border: 0 !important;
|
|
62
|
+
pointer-events: none !important;
|
|
63
|
+
border-radius: var(--rtk-spotlight-radius);
|
|
64
|
+
box-shadow: 0 0 0 2px var(--rtk-primary), 0 0 0 200vmax var(--rtk-overlay);
|
|
65
|
+
box-shadow: 0 0 0 2px var(--rtk-primary), 0 0 0 6px color-mix(in srgb, var(--rtk-primary) 30%, transparent), 0 0 0 200vmax var(--rtk-overlay);
|
|
66
|
+
}
|
|
67
|
+
.rtk-spotlight[data-collapsed] { box-shadow: 0 0 0 200vmax var(--rtk-overlay); }
|
|
68
|
+
|
|
69
|
+
.rtk-tooltip {
|
|
70
|
+
position: fixed !important;
|
|
71
|
+
top: 0 !important;
|
|
72
|
+
left: 0 !important;
|
|
73
|
+
margin: 0 !important;
|
|
74
|
+
box-sizing: border-box;
|
|
75
|
+
display: flow-root;
|
|
76
|
+
outline: none;
|
|
77
|
+
overflow: visible;
|
|
78
|
+
transform-origin: var(--rtk-origin, center);
|
|
79
|
+
}
|
|
80
|
+
.rtk-tooltip[data-overflowing] { overflow: auto; overscroll-behavior: contain; }
|
|
81
|
+
.rtk-tooltip[data-hidden] { visibility: hidden; }
|
|
82
|
+
.rtk-tooltip[data-entering] {
|
|
83
|
+
animation: rtk-enter var(--rtk-enter-duration, 200ms) var(--rtk-ease) var(--rtk-enter-delay, 0ms) both;
|
|
84
|
+
}
|
|
85
|
+
.rtk-measure {
|
|
86
|
+
position: fixed !important;
|
|
87
|
+
top: 0 !important;
|
|
88
|
+
left: 0 !important;
|
|
89
|
+
visibility: hidden !important;
|
|
90
|
+
pointer-events: none !important;
|
|
91
|
+
box-sizing: border-box;
|
|
92
|
+
display: flow-root;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.rtk-card {
|
|
96
|
+
position: relative;
|
|
97
|
+
box-sizing: border-box;
|
|
98
|
+
display: flex;
|
|
99
|
+
flex-direction: column;
|
|
100
|
+
width: 380px;
|
|
101
|
+
max-width: 100%;
|
|
102
|
+
max-height: var(--rtk-max-height, none);
|
|
103
|
+
border-radius: var(--rtk-radius);
|
|
104
|
+
background: var(--rtk-bg);
|
|
105
|
+
color: var(--rtk-text);
|
|
106
|
+
box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.35), 0 4px 12px -6px rgba(15, 23, 42, 0.2);
|
|
107
|
+
font-size: 14px;
|
|
108
|
+
line-height: 1.5;
|
|
109
|
+
text-align: start;
|
|
110
|
+
}
|
|
111
|
+
.rtk-arrow {
|
|
112
|
+
position: absolute;
|
|
113
|
+
width: 10px;
|
|
114
|
+
height: 10px;
|
|
115
|
+
background: var(--rtk-bg);
|
|
116
|
+
transform: rotate(45deg);
|
|
117
|
+
}
|
|
118
|
+
.rtk-arrow[data-side="bottom"] { top: -5px; left: calc(var(--rtk-arrow-offset) - 5px); }
|
|
119
|
+
.rtk-arrow[data-side="top"] { bottom: -5px; left: calc(var(--rtk-arrow-offset) - 5px); }
|
|
120
|
+
.rtk-arrow[data-side="right"] { left: -5px; top: calc(var(--rtk-arrow-offset) - 5px); }
|
|
121
|
+
.rtk-arrow[data-side="left"] { right: -5px; top: calc(var(--rtk-arrow-offset) - 5px); }
|
|
122
|
+
|
|
123
|
+
.rtk-header {
|
|
124
|
+
display: flex;
|
|
125
|
+
align-items: center;
|
|
126
|
+
justify-content: space-between;
|
|
127
|
+
gap: 12px;
|
|
128
|
+
padding: 12px 8px 0 16px;
|
|
129
|
+
}
|
|
130
|
+
.rtk-counter {
|
|
131
|
+
border-radius: 999px;
|
|
132
|
+
padding: 2px 10px;
|
|
133
|
+
background: var(--rtk-primary);
|
|
134
|
+
color: var(--rtk-on-primary);
|
|
135
|
+
font-size: 12px;
|
|
136
|
+
font-weight: 600;
|
|
137
|
+
line-height: 1.6;
|
|
138
|
+
font-variant-numeric: tabular-nums;
|
|
139
|
+
}
|
|
140
|
+
.rtk-close {
|
|
141
|
+
position: relative;
|
|
142
|
+
display: grid;
|
|
143
|
+
place-items: center;
|
|
144
|
+
box-sizing: border-box !important;
|
|
145
|
+
width: 32px !important;
|
|
146
|
+
height: 32px !important;
|
|
147
|
+
margin: 0 !important;
|
|
148
|
+
padding: 0 !important;
|
|
149
|
+
border: 0 !important;
|
|
150
|
+
border-radius: 8px;
|
|
151
|
+
background: transparent !important;
|
|
152
|
+
color: var(--rtk-text) !important;
|
|
153
|
+
cursor: pointer;
|
|
154
|
+
}
|
|
155
|
+
.rtk-close::before, .rtk-button--prev::before {
|
|
156
|
+
content: '';
|
|
157
|
+
position: absolute;
|
|
158
|
+
inset: 0;
|
|
159
|
+
border-radius: inherit;
|
|
160
|
+
background: currentColor;
|
|
161
|
+
opacity: 0;
|
|
162
|
+
transition: opacity 120ms;
|
|
163
|
+
}
|
|
164
|
+
.rtk-close:hover::before { opacity: 0.1; }
|
|
165
|
+
.rtk-body {
|
|
166
|
+
flex: 1 1 auto;
|
|
167
|
+
min-height: 0;
|
|
168
|
+
overflow: auto;
|
|
169
|
+
overscroll-behavior: contain;
|
|
170
|
+
padding: 8px 16px 16px;
|
|
171
|
+
}
|
|
172
|
+
.rtk-title { margin: 0 0 4px; color: var(--rtk-title); font-size: 17px; font-weight: 600; line-height: 1.35; }
|
|
173
|
+
.rtk-content { margin: 0; overflow-wrap: anywhere; }
|
|
174
|
+
.rtk-footer {
|
|
175
|
+
display: flex;
|
|
176
|
+
align-items: center;
|
|
177
|
+
justify-content: space-between;
|
|
178
|
+
gap: 8px;
|
|
179
|
+
padding: 0 16px 16px;
|
|
180
|
+
}
|
|
181
|
+
.rtk-button {
|
|
182
|
+
position: relative;
|
|
183
|
+
box-sizing: border-box !important;
|
|
184
|
+
min-height: 36px !important;
|
|
185
|
+
margin: 0 !important;
|
|
186
|
+
padding: 8px 14px !important;
|
|
187
|
+
border: 0 !important;
|
|
188
|
+
border-radius: 8px;
|
|
189
|
+
font-family: inherit;
|
|
190
|
+
font-size: 14px !important;
|
|
191
|
+
font-weight: 500 !important;
|
|
192
|
+
line-height: 1.4 !important;
|
|
193
|
+
cursor: pointer;
|
|
194
|
+
white-space: nowrap;
|
|
195
|
+
}
|
|
196
|
+
.rtk-button--prev { background: transparent !important; color: var(--rtk-text) !important; }
|
|
197
|
+
.rtk-button--prev::before { opacity: 0.08; }
|
|
198
|
+
.rtk-button--prev:hover:not(:disabled)::before { opacity: 0.14; }
|
|
199
|
+
.rtk-button--next { background: var(--rtk-primary) !important; color: var(--rtk-on-primary) !important; }
|
|
200
|
+
.rtk-button--next:hover { filter: brightness(1.08); }
|
|
201
|
+
.rtk-button:disabled { cursor: default; opacity: 0.4; }
|
|
202
|
+
.rtk-dots { display: flex; align-items: center; justify-content: center; min-width: 0; }
|
|
203
|
+
.rtk-dot, .rtk-ellipsis {
|
|
204
|
+
position: relative;
|
|
205
|
+
display: grid;
|
|
206
|
+
place-items: center;
|
|
207
|
+
box-sizing: border-box !important;
|
|
208
|
+
width: 24px !important;
|
|
209
|
+
height: 24px !important;
|
|
210
|
+
margin: 0 !important;
|
|
211
|
+
padding: 0 !important;
|
|
212
|
+
border: 0 !important;
|
|
213
|
+
background: transparent !important;
|
|
214
|
+
color: var(--rtk-text) !important;
|
|
215
|
+
}
|
|
216
|
+
.rtk-dot { cursor: pointer; border-radius: 50%; }
|
|
217
|
+
.rtk-dot::before {
|
|
218
|
+
content: '';
|
|
219
|
+
width: 8px;
|
|
220
|
+
height: 8px;
|
|
221
|
+
border-radius: 50%;
|
|
222
|
+
background: currentColor;
|
|
223
|
+
opacity: 0.3;
|
|
224
|
+
transition: opacity 150ms, transform 150ms;
|
|
225
|
+
}
|
|
226
|
+
.rtk-dot[aria-current="step"] { color: var(--rtk-primary) !important; }
|
|
227
|
+
.rtk-dot[aria-current="step"]::before { opacity: 1; transform: scale(1.15); }
|
|
228
|
+
.rtk-ellipsis::before { content: '…'; opacity: 0.5; font-size: 12px; letter-spacing: 1px; }
|
|
229
|
+
.rtk-close:focus-visible, .rtk-button:focus-visible, .rtk-dot:focus-visible {
|
|
230
|
+
outline: 2px solid var(--rtk-primary);
|
|
231
|
+
outline-offset: 2px;
|
|
232
|
+
}
|
|
233
|
+
.rtk-sr-only {
|
|
234
|
+
position: absolute;
|
|
235
|
+
width: 1px;
|
|
236
|
+
height: 1px;
|
|
237
|
+
margin: -1px;
|
|
238
|
+
padding: 0;
|
|
239
|
+
overflow: hidden;
|
|
240
|
+
clip-path: inset(50%);
|
|
241
|
+
white-space: nowrap;
|
|
242
|
+
border: 0;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/* Position uses the individual \`translate\` property (applied first), the entrance uses \`transform\`,
|
|
246
|
+
so scaling happens around the tooltip's own centre and never moves its position. Durations,
|
|
247
|
+
offsets and reduced motion come from the shared motion settings, as variables. */
|
|
248
|
+
@keyframes rtk-enter {
|
|
249
|
+
from {
|
|
250
|
+
opacity: 0;
|
|
251
|
+
transform: translate(var(--rtk-enter-x, 0), var(--rtk-enter-y, 0)) scale(var(--rtk-enter-scale, 1));
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
@media (forced-colors: active) {
|
|
256
|
+
.rtk-spotlight { outline: 3px solid Highlight; }
|
|
257
|
+
.rtk-card { border: 1px solid CanvasText; }
|
|
258
|
+
/* Without backgrounds, a border is what shows a button is one. */
|
|
259
|
+
.rtk-button { border: 1px solid ButtonText !important; }
|
|
260
|
+
.rtk-button:disabled { border-color: GrayText !important; }
|
|
261
|
+
.rtk-dot::before { background: CanvasText; }
|
|
262
|
+
.rtk-dot[aria-current="step"]::before { background: Highlight; }
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
`;
|
|
266
|
+
|
|
267
|
+
const injected = new WeakSet<Document>();
|
|
268
|
+
|
|
269
|
+
/** Adds the stylesheet to a document once. Constructable stylesheets are not subject to CSP `style-src` restrictions. */
|
|
270
|
+
export function injectTourStyles(document_: Document): void {
|
|
271
|
+
if (injected.has(document_)) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
injected.add(document_);
|
|
276
|
+
try {
|
|
277
|
+
const sheet = new CSSStyleSheet();
|
|
278
|
+
sheet.replaceSync(tourCss);
|
|
279
|
+
document_.adoptedStyleSheets = [...document_.adoptedStyleSheets, sheet];
|
|
280
|
+
} catch {
|
|
281
|
+
const style = document_.createElement('style');
|
|
282
|
+
style.dataset.rtk = '';
|
|
283
|
+
style.textContent = tourCss;
|
|
284
|
+
document_.head.append(style);
|
|
285
|
+
}
|
|
286
|
+
}
|