@eifi1/ui-kit 0.45.0 → 0.46.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/README.md +26 -14
- package/dist/admin/admin-area-labels.d.ts +9 -0
- package/dist/admin/admin-area-labels.js +5 -1
- package/dist/admin/admin-area-labels.js.map +1 -1
- package/dist/admin/admin-overview.d.ts +16 -1
- package/dist/admin/admin-overview.js +12 -1
- package/dist/admin/admin-overview.js.map +1 -1
- package/dist/admin/mail-test-card.d.ts +3 -2
- package/dist/admin/mail-test-card.js +3 -1
- package/dist/admin/mail-test-card.js.map +1 -1
- package/dist/admin/user-roster.d.ts +6 -2
- package/dist/admin/user-roster.js +7 -3
- package/dist/admin/user-roster.js.map +1 -1
- package/dist/components/appearance-labels.d.ts +10 -0
- package/dist/components/appearance-labels.js +6 -1
- package/dist/components/appearance-labels.js.map +1 -1
- package/dist/components/data-table-column-settings.js +2 -2
- package/dist/components/data-table-column-settings.js.map +1 -1
- package/dist/components/data-table-head.js +2 -2
- package/dist/components/data-table-head.js.map +1 -1
- package/dist/components/data-table-row-actions.d.ts +35 -2
- package/dist/components/data-table-row-actions.js +98 -5
- package/dist/components/data-table-row-actions.js.map +1 -1
- package/dist/components/data-table-shared.js +9 -2
- package/dist/components/data-table-shared.js.map +1 -1
- package/dist/components/data-table.d.ts +58 -2
- package/dist/components/data-table.js +11 -4
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-format-setting.d.ts +29 -0
- package/dist/components/date-format-setting.js +36 -0
- package/dist/components/date-format-setting.js.map +1 -0
- package/dist/components/row-actions.d.ts +12 -5
- package/dist/components/row-actions.js +11 -4
- package/dist/components/row-actions.js.map +1 -1
- package/dist/components/swipeable-row.d.ts +8 -0
- package/dist/components/swipeable-row.js.map +1 -1
- package/dist/components/tabs.d.ts +3 -2
- package/dist/components/tabs.js +1 -1
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/translation-review-editor.js +1 -0
- package/dist/components/translation-review-editor.js.map +1 -1
- package/dist/components/translation-review-labels.d.ts +5 -0
- package/dist/components/translation-review-labels.js +2 -0
- package/dist/components/translation-review-labels.js.map +1 -1
- package/dist/components/translation-review.d.ts +18 -8
- package/dist/components/translation-review.js +67 -8
- package/dist/components/translation-review.js.map +1 -1
- package/dist/components/write-lock-labels.js +2 -1
- package/dist/components/write-lock-labels.js.map +1 -1
- package/dist/components/write-lock.d.ts +33 -3
- package/dist/components/write-lock.js +9 -0
- package/dist/components/write-lock.js.map +1 -1
- package/dist/data-table.d.ts +2 -1
- package/dist/data-table.js +2 -0
- package/dist/data-table.js.map +1 -1
- package/dist/eslint/index.js +1 -1
- package/dist/feedback/feedback-row-detail.d.ts +4 -2
- package/dist/feedback/feedback-row-detail.js +17 -26
- package/dist/feedback/feedback-row-detail.js.map +1 -1
- package/dist/feedback/feedback-swipe.d.ts +18 -0
- package/dist/feedback/feedback-swipe.js +10 -1
- package/dist/feedback/feedback-swipe.js.map +1 -1
- package/dist/i18n/german.js +41 -5
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +12 -1
- package/dist/i18n/kit-labels.js +8 -2
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/locales/en.js +40 -6
- package/dist/i18n/locales/en.js.map +2 -2
- package/dist/i18n/locales/es.js +41 -5
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.js +41 -5
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.js +41 -5
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.js +41 -5
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.js +41 -5
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.js +3 -1
- package/dist/i18n/review.js.map +1 -1
- package/dist/index.d.ts +17 -4
- package/dist/index.js +38 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/date-format.d.ts +81 -0
- package/dist/lib/date-format.js +56 -0
- package/dist/lib/date-format.js.map +1 -0
- package/dist/lib/format.d.ts +3 -0
- package/dist/lib/format.js +5 -4
- package/dist/lib/format.js.map +1 -1
- package/dist/notifications/device-zone-report.d.ts +34 -0
- package/dist/notifications/device-zone-report.js +31 -0
- package/dist/notifications/device-zone-report.js.map +1 -0
- package/dist/notifications/feedback-notification-types-labels.d.ts +7 -1
- package/dist/notifications/feedback-notification-types-labels.js +4 -1
- package/dist/notifications/feedback-notification-types-labels.js.map +1 -1
- package/dist/notifications/feedback-notification-types.d.ts +24 -5
- package/dist/notifications/feedback-notification-types.js +7 -2
- package/dist/notifications/feedback-notification-types.js.map +1 -1
- package/dist/notifications/notification-bell.d.ts +33 -0
- package/dist/notifications/notification-bell.js +74 -0
- package/dist/notifications/notification-bell.js.map +1 -0
- package/dist/notifications/notification-inbox.d.ts +86 -0
- package/dist/notifications/notification-inbox.js +206 -0
- package/dist/notifications/notification-inbox.js.map +1 -0
- package/dist/notifications/notification-types-setting.d.ts +6 -4
- package/dist/notifications/notification-types-setting.js +103 -45
- package/dist/notifications/notification-types-setting.js.map +1 -1
- package/dist/notifications/notification-types.d.ts +19 -7
- package/dist/notifications/notifications-labels.d.ts +44 -8
- package/dist/notifications/notifications-labels.js +18 -1
- package/dist/notifications/notifications-labels.js.map +1 -1
- package/dist/notifications/push-devices-setting.d.ts +20 -3
- package/dist/notifications/push-devices-setting.js +93 -33
- package/dist/notifications/push-devices-setting.js.map +1 -1
- package/dist/notifications/push-worker.d.ts +108 -0
- package/dist/notifications/push-worker.js +62 -0
- package/dist/notifications/push-worker.js.map +1 -0
- package/dist/notifications/quiet-hours-setting.d.ts +29 -17
- package/dist/notifications/quiet-hours-setting.js +9 -41
- package/dist/notifications/quiet-hours-setting.js.map +1 -1
- package/dist/notifications/time-zone-select.d.ts +8 -4
- package/dist/notifications/time-zone-select.js +2 -7
- package/dist/notifications/time-zone-select.js.map +1 -1
- package/dist/notifications/use-push-device.d.ts +4 -17
- package/dist/notifications/use-push-device.js +7 -15
- package/dist/notifications/use-push-device.js.map +1 -1
- package/dist/offline/local-first.d.ts +42 -0
- package/dist/offline/local-first.js +53 -0
- package/dist/offline/local-first.js.map +1 -0
- package/dist/offline/query-persistence.d.ts +26 -1
- package/dist/offline/query-persistence.js +27 -23
- package/dist/offline/query-persistence.js.map +1 -1
- package/dist/offline/service-worker-updates.d.ts +46 -0
- package/dist/offline/service-worker-updates.js +39 -0
- package/dist/offline/service-worker-updates.js.map +1 -0
- package/dist/offline.d.ts +5 -2
- package/dist/offline.js +12 -2
- package/dist/offline.js.map +1 -1
- package/dist/push-worker.d.ts +2 -0
- package/dist/push-worker.js +14 -0
- package/dist/push-worker.js.map +1 -0
- package/dist/shell/account-menu-text-size.d.ts +33 -0
- package/dist/shell/account-menu-text-size.js +51 -0
- package/dist/shell/account-menu-text-size.js.map +1 -0
- package/dist/shell/top-bar-actions.d.ts +6 -2
- package/dist/shell/top-bar-actions.js +1 -0
- package/dist/shell/top-bar-actions.js.map +1 -1
- package/dist/shell.d.ts +2 -0
- package/dist/shell.js +2 -0
- package/dist/shell.js.map +1 -1
- package/dist/sync/db.d.ts +93 -0
- package/dist/sync/db.js +33 -0
- package/dist/sync/db.js.map +1 -0
- package/dist/sync/engine.d.ts +126 -0
- package/dist/sync/engine.js +474 -0
- package/dist/sync/engine.js.map +1 -0
- package/dist/sync/hooks.d.ts +35 -0
- package/dist/sync/hooks.js +67 -0
- package/dist/sync/hooks.js.map +1 -0
- package/dist/sync/testing.d.ts +28 -0
- package/dist/sync/testing.js +41 -0
- package/dist/sync/testing.js.map +1 -0
- package/dist/sync/wire.d.ts +50 -0
- package/dist/sync/wire.js +2 -0
- package/dist/sync/wire.js.map +1 -0
- package/dist/sync.d.ts +7 -0
- package/dist/sync.js +25 -0
- package/dist/sync.js.map +1 -0
- package/dist/tour/tour-labels.js +1 -0
- package/dist/tour/tour-labels.js.map +1 -1
- package/dist/tour/tour.d.ts +30 -0
- package/dist/tour/tour.js +50 -6
- package/dist/tour/tour.js.map +1 -1
- package/package.json +19 -1
- package/src/admin/admin-area-labels.ts +13 -0
- package/src/admin/admin-overview.tsx +37 -2
- package/src/admin/mail-test-card.tsx +7 -3
- package/src/admin/user-roster.tsx +12 -3
- package/src/components/appearance-labels.ts +16 -0
- package/src/components/data-table-column-settings.tsx +2 -2
- package/src/components/data-table-head.tsx +2 -2
- package/src/components/data-table-row-actions.tsx +145 -5
- package/src/components/data-table-shared.tsx +21 -2
- package/src/components/data-table.tsx +68 -6
- package/src/components/date-format-setting.tsx +64 -0
- package/src/components/row-actions.tsx +33 -9
- package/src/components/swipeable-row.tsx +8 -0
- package/src/components/tabs.tsx +4 -3
- package/src/components/translation-review-editor.tsx +2 -0
- package/src/components/translation-review-labels.ts +7 -0
- package/src/components/translation-review.tsx +105 -15
- package/src/components/write-lock-labels.ts +1 -0
- package/src/components/write-lock.tsx +36 -3
- package/src/data-table.ts +4 -0
- package/src/feedback/feedback-row-detail.tsx +18 -23
- package/src/feedback/feedback-swipe.tsx +28 -1
- package/src/i18n/german.ts +44 -4
- package/src/i18n/kit-labels.tsx +18 -1
- package/src/i18n/locales/en.ts +1 -0
- package/src/i18n/locales/es.ts +44 -4
- package/src/i18n/locales/fr.ts +44 -4
- package/src/i18n/locales/hu.ts +44 -4
- package/src/i18n/locales/it.ts +44 -4
- package/src/i18n/locales/zh.ts +44 -2
- package/src/i18n/review.ts +3 -1
- package/src/index.ts +50 -1
- package/src/lib/date-format.ts +151 -0
- package/src/lib/format.ts +10 -4
- package/src/notifications/device-zone-report.ts +67 -0
- package/src/notifications/feedback-notification-types-labels.ts +10 -1
- package/src/notifications/feedback-notification-types.ts +30 -5
- package/src/notifications/notification-bell.tsx +116 -0
- package/src/notifications/notification-inbox.tsx +314 -0
- package/src/notifications/notification-types-setting.tsx +151 -55
- package/src/notifications/notification-types.ts +20 -8
- package/src/notifications/notifications-labels.ts +72 -12
- package/src/notifications/push-devices-setting.tsx +123 -34
- package/src/notifications/push-worker.ts +160 -0
- package/src/notifications/quiet-hours-setting.tsx +41 -58
- package/src/notifications/time-zone-select.tsx +9 -10
- package/src/notifications/use-push-device.ts +20 -33
- package/src/offline/local-first.ts +100 -0
- package/src/offline/query-persistence.ts +57 -24
- package/src/offline/service-worker-updates.ts +81 -0
- package/src/offline.ts +7 -1
- package/src/push-worker.ts +25 -0
- package/src/shell/account-menu-text-size.tsx +77 -0
- package/src/shell/top-bar-actions.tsx +6 -1
- package/src/shell.ts +3 -0
- package/src/sync/db.ts +125 -0
- package/src/sync/engine.ts +701 -0
- package/src/sync/hooks.ts +98 -0
- package/src/sync/testing.ts +73 -0
- package/src/sync/wire.ts +61 -0
- package/src/sync.ts +29 -0
- package/src/tour/tour-labels.ts +1 -0
- package/src/tour/tour.tsx +100 -7
package/dist/tour/tour.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/tour/tour.tsx"],"sourcesContent":["import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport type { CSSProperties, ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { cn } from \"../lib/cn\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { Button } from \"../components/button\";\nimport { useFocusTrap } from \"../hooks/use-focus-trap\";\nimport { sameRect } from \"../hooks/use-anchored-rect\";\nimport { dirOf, horizontalStep } from \"../lib/direction\";\nimport type { Direction } from \"../lib/direction\";\nimport { DEFAULT_TOUR_LABELS } from \"./tour-labels\";\nimport type { TourInfo } from \"./tour-info\";\nimport { completeStored, rememberAccount, rememberMigrate, type UseTourProgressOptions } from \"./use-tour-progress\";\n\n/**\n * `start`/`end` follow the reading direction (`end` is the right side in LTR and the\n * left side in RTL) and are what a translated app wants. `left`/`right` stay physical\n * for the steps that genuinely mean a screen side.\n */\nexport type TourPlacement = \"top\" | \"right\" | \"bottom\" | \"left\" | \"start\" | \"end\" | \"center\";\n\nexport interface TourStep {\n /** CSS selector for the element to spotlight. Omit for a centered step\n * (welcome/finish). If the target isn't found/visible, the step centers. */\n target?: string;\n title: string;\n body: ReactNode;\n /** Extra footer content, e.g. a \"load sample data\" shortcut. */\n action?: ReactNode;\n /** Spotlight padding around the target, px (default 8). */\n padding?: number;\n /** Where the card sits relative to the target. Omit for auto placement\n * (below → above → centered). \"center\" ignores the target and centers on\n * screen. \"start\"/\"end\" are the logical sides and flip in RTL; \"left\"/\"right\"\n * are physical. An explicit side flips to the opposite side if it would\n * overflow, then clamps into the viewport. */\n placement?: TourPlacement;\n /** Advance only when the user clicks the spotlighted target itself (not the\n * card's Next button). Requires `target`: the real control's own handler runs\n * first, then the tour steps forward on a microtask. The spotlight hole stays\n * click-through to the target; the rest of the page does not. */\n awaitClick?: boolean;\n /** Runs before the step is shown — e.g. navigate to a route, open a panel.\n * May be async; the step waits for it, then locates the target. */\n beforeStep?: () => void | Promise<void>;\n}\n\nexport interface TourLabels {\n next: string;\n back: string;\n skip: string;\n done: string;\n /** Shown in place of the Next button on an `awaitClick` step. */\n awaitClickHint: string;\n /** Step counter, e.g. (2, 7) => \"2 / 7\". */\n step: (current: number, total: number) => string;\n}\n\n// Defined in ./tour-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_TOUR_LABELS };\n\ninterface StartOptions {\n /** Stable id of the tour, surfaced as `activeId` so the app can mirror it to\n * the URL (deep-link / evaluation tracking) and record completion. Defaults to\n * `tour.id`. */\n id?: string;\n /** The tour being started, as the app lists it (docs/tours-harmonization.md §9.6.1).\n * When its last step is finished, the provider records the completion in its\n * `progress` and hands this to `onComplete`. */\n tour?: TourInfo;\n /** Start at this step index instead of 0 (clamped) — for URL/deep-link resume. */\n startIndex?: number;\n /** Fires synchronously when the tour starts (e.g. enable a mock interceptor). */\n onStart?: () => void;\n /** After the last step: runs after the provider's progress write and `onComplete`. */\n onFinish?: () => void;\n onSkip?: () => void;\n}\n\n/** What `TourProvider`'s `onComplete` learns besides the tour (§9.1, §9.6). */\nexport interface TourCompletion {\n /**\n * `true` when the completion counts anew (the first time, or the first time after the\n * tour's update, §8): the moment for the app's points toast. `false` for a replay, and\n * when the stored text is in an old shape no `migrate` reads: nothing is overwritten\n * then, and the error goes to `console.error` (keksdose B-1). `undefined` when the provider has no `progress` or the start carried no `tour`, so\n * nothing was recorded.\n */\n awarded: boolean | undefined;\n}\n\ninterface TourContextValue {\n active: boolean;\n /** Id of the running tour (from {@link StartOptions.id}), else null. */\n activeId: string | null;\n /** Start a tour with the given steps. */\n start: (steps: TourStep[], opts?: StartOptions) => void;\n /** End the current tour (no callbacks fire). */\n stop: () => void;\n /** Advance one step; past the last step it finishes the tour (fires onFinish). */\n next: () => void;\n /** Go back one step (no-op on the first). */\n prev: () => void;\n /** Jump to a step by index, clamped to range — e.g. for URL/deep-link resume. */\n goToStep: (index: number) => void;\n /** Current step (0-based; 0 while inactive). */\n index: number;\n /** Total steps (0 while inactive). */\n total: number;\n}\n\nconst TourContext = createContext<TourContextValue | null>(null);\n\nexport function useTour(): TourContextValue {\n const ctx = useContext(TourContext);\n if (!ctx) throw new Error(\"useTour must be used within <TourProvider>\");\n return ctx;\n}\n\n/**\n * The tour engine if it is there, `null` if it is not — for a control that is a\n * DECORATION rather than a participant.\n *\n * {@link useTour}'s throw is correct and stays: a component that runs a tour cannot do\n * its job without the provider, and failing loudly is how that gets fixed. But the\n * throw's blast radius is whatever error boundary is above it, and for a launcher in\n * the app shell that is the whole app.\n *\n * Keksdose feedback dev#524 is what that costs: an `@hb/ui` module was edited while a\n * dev server was running, vite re-evaluated it, and the module's freshly created\n * context object was no longer the one the mounted provider was providing. React's\n * `useContext` then answers `null` for a provider that is, structurally, right there —\n * and the top bar's tour menu took the entire shell down with it. **Build-time module\n * graphs cannot produce that**, so it is a development-only failure; a menu that\n * disappears for a second is the proportionate response to it either way.\n *\n * Only for controls that can honestly render nothing. If a component would show a\n * broken half of itself without the tour, it wants {@link useTour}.\n */\nexport function useTourOptional(): TourContextValue | null {\n return useContext(TourContext);\n}\n\n/** The kit's dev switch (as number-input's): a development build, never under vitest. */\nfunction devWarnings(): boolean {\n return Boolean(import.meta.env?.DEV) && !import.meta.env?.VITEST;\n}\n\n/**\n * Provides the guided-tour engine: a dimmed spotlight overlay + step card driven\n * by a list of {@link TourStep}s. Domain-free — the app supplies the steps (copy,\n * selectors, per-step navigation, placement) and the translated {@link TourLabels}.\n * Mount once inside the router; start a tour from anywhere via {@link useTour},\n * which also exposes step control (`next`/`prev`/`goToStep`) and the current\n * `index`/`total` for URL mirroring, `awaitClick` and deep-link resume.\n *\n * **Completion in one place** (docs/tours-harmonization.md §9.6): give the provider the\n * app's `progress` (the same `{storageKey, migrate}` as `useTourProgress`) and start each\n * tour with `start(steps, {tour})`. When the last step is finished the provider writes the\n * completion ONCE, through the store every `useTourProgress` reader of the key shares\n * (never a second copy), then calls `onComplete(tour, {awarded})`, then the start's own\n * `onFinish`. A skip or `stop()` records nothing and calls neither. The app removes its\n * own `complete()` from `onFinish`, or that second write answers `false`.\n *\n * Both props are optional: without `progress` or a `tour` on the start, `onComplete`\n * still fires, with `awarded: undefined` (and `tour` as given, possibly `undefined`). A\n * new `storageKey` (an account switch on a shared PC) is followed on the next\n * completion, without a remount.\n */\nexport function TourProvider({\n children,\n labels,\n progress,\n onComplete,\n}: {\n children: ReactNode;\n labels?: LabelOverride<TourLabels>;\n /** The app's tour progress: the same options its `useTourProgress` readers use. */\n progress?: UseTourProgressOptions;\n /** A tour's last step was finished; see {@link TourCompletion}. */\n onComplete?: (tour: TourInfo | undefined, completion: TourCompletion) => void;\n}) {\n // `labels` over the provider's `tour` over English. Resolved once here and handed\n // down: the step card is portalled, but context crosses portals anyway — this is\n // simply the one place that already owned the merge.\n const merged = useKitLabels(\"tour\", DEFAULT_TOUR_LABELS, labels);\n const [steps, setSteps] = useState<TourStep[] | null>(null);\n const [index, setIndex] = useState(0);\n const [activeId, setActiveId] = useState<string | null>(null);\n const optsRef = useRef<StartOptions>({});\n // The latest props, read at the finish: a new `storageKey` or callback needs no remount.\n const progressRef = useRef(progress);\n const onCompleteRef = useRef(onComplete);\n useLayoutEffect(() => {\n progressRef.current = progress;\n onCompleteRef.current = onComplete;\n });\n // The provider's migrate becomes the key's, for readers that pass none (keksdose B-2).\n const storageKey = progress?.storageKey;\n const migrate = progress?.migrate;\n // 0.45: and its `account` (§10.3), so a finish on an account key is sent as readers' are.\n const account = progress?.account;\n useLayoutEffect(() => {\n if (storageKey !== undefined) rememberMigrate(storageKey, migrate);\n if (storageKey !== undefined) rememberAccount(storageKey, account);\n }, [storageKey, migrate, account]);\n const warnedNoTourRef = useRef(false);\n // Live mirrors so the step-control callbacks can stay stable (identity-safe for\n // consumers) while still reading the current steps/index. Synced in a layout\n // effect — after the commit, before paint and before any passive effect or event\n // can call them — rather than written during render.\n const stepsRef = useRef<TourStep[] | null>(null);\n const indexRef = useRef(0);\n useLayoutEffect(() => {\n stepsRef.current = steps;\n indexRef.current = index;\n }, [steps, index]);\n const active = !!steps && steps.length > 0;\n const total = steps?.length ?? 0;\n\n const start = useCallback((s: TourStep[], opts?: StartOptions) => {\n optsRef.current = opts ?? {};\n optsRef.current.onStart?.();\n setIndex(Math.min(Math.max(0, opts?.startIndex ?? 0), Math.max(0, s.length - 1)));\n setActiveId(opts?.id ?? opts?.tour?.id ?? null);\n setSteps(s);\n }, []);\n const stop = useCallback(() => {\n setSteps(null);\n setActiveId(null);\n }, []);\n const finish = useCallback(() => {\n // Once per tour: a second \"Done\" before the overlay unmounts records nothing more.\n if (!stepsRef.current) return;\n stepsRef.current = null;\n const { tour, onFinish } = optsRef.current;\n const store = progressRef.current;\n // Exactly one write per completion (§9.6.2), so `awarded` is what `complete(tour)` answered.\n let awarded: boolean | undefined;\n if (store && tour) {\n try {\n awarded = completeStored(store.storageKey, store.migrate, tour);\n } catch (error) {\n // A stored text no migrate reads is left as it is (keksdose B-1); the tour still ends.\n console.error(error);\n awarded = false;\n }\n } else if (store && !tour && devWarnings() && !warnedNoTourRef.current) {\n warnedNoTourRef.current = true;\n console.warn(\n \"[ui-kit] TourProvider has `progress`, but a finished tour's start carried no `tour`: \" +\n \"nothing was recorded and `awarded` is undefined. Start it with `start(steps, { tour })`.\",\n );\n }\n onCompleteRef.current?.(tour, { awarded });\n onFinish?.();\n setSteps(null);\n setActiveId(null);\n }, []);\n const skip = useCallback(() => {\n optsRef.current.onSkip?.();\n setSteps(null);\n setActiveId(null);\n }, []);\n\n const goToStep = useCallback((i: number) => {\n const len = stepsRef.current?.length ?? 0;\n if (len === 0) return;\n setIndex(Math.min(Math.max(0, i), len - 1));\n }, []);\n const next = useCallback(() => {\n const len = stepsRef.current?.length ?? 0;\n if (len === 0) return;\n if (indexRef.current >= len - 1) finish();\n else setIndex(indexRef.current + 1);\n }, [finish]);\n const prev = useCallback(() => {\n if (indexRef.current > 0) setIndex(indexRef.current - 1);\n }, []);\n\n return (\n <TourContext.Provider value={{ active, activeId, start, stop, next, prev, goToStep, index, total }}>\n {children}\n {active && (\n <TourOverlay\n steps={steps!}\n index={index}\n labels={merged}\n onNext={next}\n onPrev={prev}\n onSkip={skip}\n />\n )}\n </TourContext.Provider>\n );\n}\n\ninterface Rect {\n top: number;\n left: number;\n width: number;\n height: number;\n}\n\nfunction isVisible(el: Element): boolean {\n // A non-zero box already rules out display:none on the element or any ancestor\n // (an unrendered element measures 0x0). We deliberately do NOT test\n // offsetParent: it is null for position:fixed elements even when fully visible,\n // which made the mobile bottom-nav bar (fixed) un-highlightable on mobile\n // (feedback #313). visibility:hidden keeps a box, so check it explicitly.\n const r = el.getBoundingClientRect();\n if (r.width <= 0 || r.height <= 0) return false;\n const style = getComputedStyle(el);\n return style.visibility !== \"hidden\" && style.display !== \"none\";\n}\n\n// The first VISIBLE element matching the selector, not merely the first in DOM\n// order. This lets a step target the same control across layouts with one\n// combined selector — e.g. the desktop sidebar link AND the mobile bottom-bar\n// link — where the off-layout copy is present but `display:none` (feedback\n// #313). Returns null while none is visible so the finder keeps retrying.\nfunction queryVisibleTarget(selector: string): Element | null {\n const els = document.querySelectorAll(selector);\n for (const el of els) {\n if (isVisible(el)) return el;\n }\n return null;\n}\n\nfunction rectOf(el: Element): Rect {\n const r = el.getBoundingClientRect();\n return { top: r.top, left: r.left, width: r.width, height: r.height };\n}\n\n/**\n * What the finder established for ONE step: where its target is (`null` = no target,\n * or not on the page), and the reading direction the card takes from it.\n *\n * It carries the step it was found for, and the overlay only believes it for that\n * step — which is the whole fix for keksdose's tours audit 2026-10-02, §1.0 A (\"stale\n * spotlight on the step after a spotlighted one\", 15 steps in 16 tours, desktop and\n * phone, mouse and keyboard). When step N spotlit a target and step N+1 had none (or\n * its anchor was missing), N+1 kept N's hole and parked its card beside it, so a\n * centred \"You're all set\" read as pointing at the Import & Export link; Back→Next kept\n * it for as long as anyone watched.\n *\n * The overlay used to hold `rect` and `ready` as separate states and reset them\n * DURING RENDER when the step changed. React 19 does not keep a render-phase update\n * while an earlier, lower-priority update to the same hook is still queued — it only\n * writes the result to the base state \"unless the queue is empty\" — and the follow\n * interval below queues exactly such an update every 250 ms (eagerly bailed out because\n * the rect had not moved, but left in the queue for rebasing). So the click's render\n * showed the reset, and the very next render (the finder saying \"ready\") re-based on\n * the old rect. A deep link was fine because nothing had queued anything yet.\n *\n * Keying the result to its step does not depend on any of that ordering: a rect found\n * for another step is not this step's rect, whatever the queue does with it, and a\n * missing anchor reads as \"no target\" instead of as the last thing that was lit.\n */\ninterface Located {\n index: number;\n step: TourStep;\n rect: Rect | null;\n dir: Direction;\n}\n\nfunction TourOverlay({\n steps,\n index,\n labels,\n onNext,\n onPrev,\n onSkip,\n}: {\n steps: TourStep[];\n index: number;\n labels: TourLabels;\n onNext: () => void;\n onPrev: () => void;\n onSkip: () => void;\n}) {\n const step = steps[index];\n const isFirst = index === 0;\n const isLast = index === steps.length - 1;\n // A new step starts unlocated: whatever was found for another step (see `Located`)\n // is ignored, so the overlay renders nothing until the effect below has located THIS\n // step, and never the previous step's spotlight.\n const [located, setLocated] = useState<Located | null>(null);\n const current = located !== null && located.index === index && located.step === step ? located : null;\n const ready = current !== null;\n const rect = current?.rect ?? null;\n // The overlay is portalled to <body>, out of whatever `dir` subtree the app set, so it\n // takes the direction of the element it spotlights (the document's for a centered\n // step). Arrow keys and start/end placement read it.\n const dir: Direction = current?.dir ?? \"ltr\";\n const rootRef = useRef<HTMLDivElement>(null);\n\n // Run beforeStep, then locate the target (retrying across route/render lag).\n useEffect(() => {\n let cancelled = false;\n let raf = 0;\n // `null` = untargeted, or the finder gave up → the card centres, with no hole.\n const settle = (el: Element | null) =>\n setLocated({ index, step, rect: el ? rectOf(el) : null, dir: dirOf(el) });\n void (async () => {\n await step.beforeStep?.();\n if (cancelled) return;\n if (!step.target) {\n settle(null);\n return;\n }\n let tries = 0;\n const find = () => {\n if (cancelled) return;\n const el = queryVisibleTarget(step.target!);\n if (el) {\n el.scrollIntoView({ block: \"center\", behavior: \"smooth\" });\n settle(el);\n return;\n }\n if (tries++ < 45) raf = requestAnimationFrame(find);\n else settle(null); // give up → render centered\n };\n find();\n })();\n return () => {\n cancelled = true;\n cancelAnimationFrame(raf);\n };\n }, [index, step]);\n\n // Follow the target as the page scrolls / reflows — only once THIS step is located,\n // and only into this step's result.\n useEffect(() => {\n if (!step.target) return;\n const update = () => {\n const el = queryVisibleTarget(step.target!);\n if (el) {\n const next = rectOf(el);\n setLocated((prev) =>\n prev && prev.index === index && prev.step === step && !sameRect(prev.rect, next)\n ? { ...prev, rect: next }\n : prev,\n );\n }\n };\n window.addEventListener(\"scroll\", update, true);\n window.addEventListener(\"resize\", update);\n const id = window.setInterval(update, 250);\n return () => {\n window.removeEventListener(\"scroll\", update, true);\n window.removeEventListener(\"resize\", update);\n clearInterval(id);\n };\n }, [index, step]);\n\n // awaitClick: advance when the *real* target is clicked. The spotlight hole is\n // click-through (see the shields in the render below) so the element's own\n // handler runs first; we step forward on the next macrotask.\n //\n // Re-armed when the target turns up after the finder gave up (the follow effect\n // lights it late): the card swaps Next for the \"click the highlighted element\" hint\n // as soon as there is a rect, so the click must work from that moment too.\n const spotted = rect !== null;\n useEffect(() => {\n if (!ready || !spotted || !step.awaitClick || !step.target) return;\n const el = queryVisibleTarget(step.target);\n if (!el) return;\n const onClick = () => window.setTimeout(() => onNext(), 0);\n el.addEventListener(\"click\", onClick, { once: true });\n return () => el.removeEventListener(\"click\", onClick);\n }, [ready, spotted, index, step, onNext]);\n\n // Keyboard: Esc skips, Enter and the reading-direction arrow advance (→ in LTR,\n // ← in RTL), the other arrow goes back. On awaitClick steps Enter is ignored (it\n // would fire the target's click AND advance) — the forward arrow stays as an escape\n // hatch.\n //\n // Enter on a focused control belongs to that control. This used to advance from\n // anywhere, so Enter on a focused Skip or Back ran the button's own click AND stepped\n // forward: Back moved nowhere, Skip skipped and then called `next` on a dead tour.\n // The same goes for arrows in a text field a step's `action` might contain.\n useEffect(() => {\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") {\n onSkip();\n return;\n }\n if (e.key === \"Enter\") {\n if (step.awaitClick || ownsKey(e.target, \"Enter\")) return;\n e.preventDefault();\n onNext();\n return;\n }\n if (ownsKey(e.target, e.key)) return;\n // The overlay root carries `dir`; before it paints, the document's answers.\n const delta = horizontalStep(e.key, rootRef.current);\n if (delta === 1) {\n e.preventDefault();\n onNext();\n } else if (delta === -1) {\n if (!isFirst) onPrev();\n }\n };\n document.addEventListener(\"keydown\", onKey);\n return () => document.removeEventListener(\"keydown\", onKey);\n }, [isFirst, step, onNext, onPrev, onSkip]);\n\n if (!ready) return null;\n\n const pad = step.padding ?? 8;\n const spot: Rect | null = rect\n ? { top: rect.top - pad, left: rect.left - pad, width: rect.width + pad * 2, height: rect.height + pad * 2 }\n : null;\n\n // `aria-modal` promises the page behind is out of reach, and the card's focus trap\n // keeps that promise for the keyboard. The pointer used to get no such treatment: the\n // root is `pointer-events-none` so that the spotlight hole can stay live for\n // `awaitClick`, and the scrim is a box-shadow, which takes no clicks — so every\n // control on the dimmed page stayed clickable. Four shields now tile the viewport\n // around the hole: the page is blocked, the card and the spotlighted target are not.\n // Keeping `aria-modal` (rather than dropping it) is the coherent half: the tour\n // really is modal — focus is trapped and Esc/Skip is the way out.\n return createPortal(\n <div\n ref={rootRef}\n className=\"pointer-events-none fixed inset-0 z-[60]\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={step.title}\n dir={dir}\n >\n {spot && <SpotlightShields spot={spot} />}\n {spot ? (\n <div\n className=\"pointer-events-none fixed rounded-lg transition-all duration-200 ease-out\"\n style={{\n top: spot.top,\n left: spot.left,\n width: spot.width,\n height: spot.height,\n // A two-tone frame, not a single translucent ring.\n //\n // The old treatment was `ring-2 ring-white/80` over a 55% scrim, and it\n // \"was barely visible\" on the app's blue-tinted surfaces. Two reasons,\n // and a single ring can't fix either: at 55% the surround stays bright\n // enough that the un-dimmed hole barely reads AS a hole, and a 80%-white\n // ring sitting on the edge of a light card is white-on-near-white.\n //\n // So: an opaque white band immediately around the target, a dark keyline\n // outside it, then the scrim. Whatever the target's own colour is, one of\n // the two bands is always in contrast with it and the other is always in\n // contrast with the dimmed surround — there is no background that can\n // swallow both. The blurred layer between them softens the step so the\n // frame reads as lighting rather than as a pasted-on rectangle.\n boxShadow: [\n \"0 0 0 3px rgba(255,255,255,0.98)\",\n \"0 0 0 5px rgba(15,23,42,0.92)\",\n \"0 0 18px 6px rgba(15,23,42,0.45)\",\n \"0 0 0 9999px rgba(15,23,42,0.70)\",\n ].join(\", \"),\n }}\n />\n ) : (\n <div className=\"pointer-events-auto fixed inset-0 bg-black/70\" />\n )}\n <TourCard\n step={step}\n index={index}\n total={steps.length}\n labels={labels}\n isFirst={isFirst}\n isLast={isLast}\n rect={spot}\n dir={dir}\n onBack={onPrev}\n onNext={onNext}\n onSkip={onSkip}\n />\n </div>,\n document.body,\n );\n}\n\n/** Does the focused element handle `key` itself? Enter on a button or link, and any\n * editing key in a text field or select, is the control's — not the tour's. */\nfunction ownsKey(target: EventTarget | null, key: string): boolean {\n if (!(target instanceof HTMLElement)) return false;\n if (target.isContentEditable) return true;\n const tag = target.tagName;\n if (tag === \"TEXTAREA\" || tag === \"SELECT\") return true;\n if (tag === \"INPUT\") {\n const type = (target as HTMLInputElement).type;\n // Enter on a checkbox does nothing natively, but ←/→ on a radio moves it.\n return key !== \"Enter\" || type !== \"checkbox\";\n }\n if (key !== \"Enter\") return false;\n return (\n tag === \"BUTTON\" ||\n (tag === \"A\" && target.hasAttribute(\"href\")) ||\n target.getAttribute(\"role\") === \"button\" ||\n target.getAttribute(\"role\") === \"link\"\n );\n}\n\n/**\n * Transparent pointer blockers tiling the viewport around the spotlight hole: one\n * full-width band above and below, one on each side at the hole's own height. The hole\n * itself stays uncovered, so the target keeps its clicks.\n */\nfunction SpotlightShields({ spot }: { spot: Rect }) {\n const shield = \"pointer-events-auto fixed\";\n const bottom = spot.top + spot.height;\n return (\n <>\n <div data-tour-shield=\"\" className={shield} style={{ top: 0, left: 0, right: 0, height: Math.max(0, spot.top) }} />\n <div data-tour-shield=\"\" className={shield} style={{ top: bottom, left: 0, right: 0, bottom: 0 }} />\n <div\n data-tour-shield=\"\"\n className={shield}\n style={{ top: spot.top, left: 0, width: Math.max(0, spot.left), height: spot.height }}\n />\n <div\n data-tour-shield=\"\"\n className={shield}\n style={{ top: spot.top, left: spot.left + spot.width, right: 0, height: spot.height }}\n />\n </>\n );\n}\n\n/**\n * Card position (viewport px) for the given placement relative to the padded\n * spotlight `rect`. Omitted placement keeps the original auto behavior\n * (below → above → vertically centered); an explicit side flips to its opposite\n * if it would overflow, then clamps into the viewport. \"center\" (or no rect)\n * centers on screen.\n */\nfunction placeCard(\n rect: Rect | null,\n cw: number,\n ch: number,\n vw: number,\n vh: number,\n m: number,\n placement?: TourPlacement,\n dir: Direction = \"ltr\",\n): { top: number; left: number } {\n // The logical sides resolve to a physical one here, and only here.\n if (placement === \"start\") placement = dir === \"rtl\" ? \"right\" : \"left\";\n else if (placement === \"end\") placement = dir === \"rtl\" ? \"left\" : \"right\";\n if (!rect || placement === \"center\") {\n return { top: Math.max(m, (vh - ch) / 2), left: Math.max(m, (vw - cw) / 2) };\n }\n const clampX = (x: number) => Math.min(Math.max(m, x), Math.max(m, vw - cw - m));\n const clampY = (y: number) => Math.min(Math.max(m, y), Math.max(m, vh - ch - m));\n const centerX = clampX(rect.left + rect.width / 2 - cw / 2);\n const centerY = clampY(rect.top + rect.height / 2 - ch / 2);\n const belowTop = rect.top + rect.height + m;\n const aboveTop = rect.top - ch - m;\n const rightLeft = rect.left + rect.width + m;\n const leftLeft = rect.left - cw - m;\n const fitsBelow = belowTop + ch <= vh;\n const fitsAbove = aboveTop >= 0;\n const fitsRight = rightLeft + cw <= vw;\n const fitsLeft = leftLeft >= 0;\n\n switch (placement) {\n case \"top\":\n return { top: fitsAbove ? aboveTop : fitsBelow ? belowTop : clampY(aboveTop), left: centerX };\n case \"bottom\":\n return { top: fitsBelow ? belowTop : fitsAbove ? aboveTop : clampY(belowTop), left: centerX };\n case \"right\":\n return { top: centerY, left: fitsRight ? rightLeft : fitsLeft ? leftLeft : clampX(rightLeft) };\n case \"left\":\n return { top: centerY, left: fitsLeft ? leftLeft : fitsRight ? rightLeft : clampX(leftLeft) };\n default:\n if (fitsBelow) return { top: belowTop, left: centerX };\n if (fitsAbove) return { top: aboveTop, left: centerX };\n return { top: Math.max(m, (vh - ch) / 2), left: centerX };\n }\n}\n\nfunction TourCard({\n step,\n index,\n total,\n labels,\n isFirst,\n isLast,\n rect,\n dir,\n onBack,\n onNext,\n onSkip,\n}: {\n step: TourStep;\n index: number;\n total: number;\n labels: TourLabels;\n isFirst: boolean;\n isLast: boolean;\n rect: Rect | null;\n dir: Direction;\n onBack: () => void;\n onNext: () => void;\n onSkip: () => void;\n}) {\n const ref = useRef<HTMLDivElement>(null);\n const [style, setStyle] = useState<CSSProperties>({ opacity: 0 });\n\n /**\n * The card holds the focus, because the card is what the tour IS.\n *\n * The overlay above declares `role=\"dialog\" aria-modal=\"true\"` — it always has — and\n * then left focus wherever the page had put it. For a tour that is the most pointed\n * version of the audit's *\"Only Modal manages focus\"*: the whole component exists to\n * say \"look here\", and for a keyboard user \"here\" is the focus ring. They were told\n * the page was hidden, given no way to reach the Next button without Tabbing through\n * it, and left on a control the screen reader would no longer describe.\n *\n * It re-engages on every step, without any bookkeeping here, because `TourOverlay`\n * returns null while it re-locates the next target: the card genuinely unmounts and\n * remounts between steps. That is what keeps focus honest when the BUTTONS change —\n * \"Back\" does not exist on the first step, so stepping back onto it destroys the\n * control the press came from, and focus would otherwise fall to `<body>`, outside\n * this trap's own listener, where Tab walks straight into the page the overlay claims\n * to have hidden.\n *\n * **The cost, written down:** on an `awaitClick` step the user is asked to click the\n * spotlighted element, and they can no longer Tab to it. ArrowRight still advances\n * (the key handler in `TourOverlay` is on the document and does not care where focus\n * is), which is the escape hatch that step already documents for the case where the\n * target cannot be found. Containment is worth that: an `awaitClick` step is a\n * minority of steps, while focus stranded behind `aria-modal` is every step.\n */\n useFocusTrap(ref, { active: true });\n\n useLayoutEffect(() => {\n const card = ref.current;\n if (!card) return;\n setStyle(\n placeCard(rect, card.offsetWidth, card.offsetHeight, window.innerWidth, window.innerHeight, 12, step.placement, dir),\n );\n }, [rect, index, step.placement, dir]);\n\n return (\n <div\n ref={ref}\n // Focusable but not tabbable: the trap above focuses the card itself rather than\n // its first button, so a screen reader reads the step's title and body before it\n // reads \"Next\" — and without this the container cannot take focus at all and the\n // trap silently does nothing.\n tabIndex={-1}\n style={style}\n className=\"pointer-events-auto fixed z-[61] w-80 max-w-[calc(100vw-1.5rem)] rounded-lg border border-subtle bg-surface p-4 shadow-xl outline-none transition-all duration-200 ease-out\"\n >\n <div className=\"text-sm font-semibold text-primary\">{step.title}</div>\n <div className=\"mt-1 text-sm leading-relaxed text-secondary\">{step.body}</div>\n {step.action && <div className=\"mt-3\">{step.action}</div>}\n <div className=\"mt-4 space-y-2\">\n <div className=\"flex items-center justify-between gap-2\">\n <button\n type=\"button\"\n onClick={onSkip}\n className=\"text-xs text-placeholder hover:text-secondary\"\n >\n {labels.skip}\n </button>\n <div className=\"flex items-center gap-2\">\n <span className=\"whitespace-nowrap text-xs tabular-nums text-placeholder\">\n {labels.step(index + 1, total)}\n </span>\n {!isFirst && (\n <Button variant=\"secondary\" onClick={onBack} className=\"px-2.5 py-1 text-xs\">\n {labels.back}\n </Button>\n )}\n {/* On an awaitClick step the Next button is replaced by a hint on its\n own row below, so it doesn't cram the counter + buttons and wrap.\n Only when the target was actually FOUND, though — `rect` is null\n when the finder gave up, and the click listener early-returns on\n the same absence. Keyed on `step.target` alone this hid the only\n way forward on any step whose anchor happens not to be rendered\n for this user (a guest sees no \"add account\" button), leaving the\n undocumented ArrowRight key as the sole escape. */}\n {!(step.awaitClick && step.target && rect) && (\n <Button variant=\"brand\" onClick={onNext} className={cn(\"px-2.5 py-1 text-xs\")}>\n {isLast ? labels.done : labels.next}\n </Button>\n )}\n </div>\n </div>\n {step.awaitClick && step.target && rect && (\n <div className=\"text-center text-xs italic text-placeholder\">\n {labels.awaitClickHint}\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";AAiSI,SA6UA,UA1UI,KAHJ;AAjSJ;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AACnB,SAAS,oBAAwC;AACjD,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AACzB,SAAS,OAAO,sBAAsB;AAEtC,SAAS,2BAA2B;AAEpC,SAAS,gBAAgB,iBAAiB,uBAAoD;AAmG9F,MAAM,cAAc,cAAuC,IAAI;AAExD,SAAS,UAA4B;AAC1C,QAAM,MAAM,WAAW,WAAW;AAClC,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,4CAA4C;AACtE,SAAO;AACT;AAsBO,SAAS,kBAA2C;AACzD,SAAO,WAAW,WAAW;AAC/B;AAGA,SAAS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AAAA,YACA,qBAAC,SAAI,WAAU,2BACb;AAAA,kCAAC,UAAK,WAAU,2DACb,iBAAO,KAAK,QAAQ,GAAG,KAAK,GAC/B;AAAA,cACC,CAAC,WACA,oBAAC,UAAO,SAAQ,aAAY,SAAS,QAAQ,WAAU,uBACpD,iBAAO,MACV;AAAA,cAUD,EAAE,KAAK,cAAc,KAAK,UAAU,SACnC,oBAAC,UAAO,SAAQ,SAAQ,SAAS,QAAQ,WAAW,GAAG,qBAAqB,GACzE,mBAAS,OAAO,OAAO,OAAO,MACjC;AAAA,eAEJ;AAAA,aACF;AAAA,UACC,KAAK,cAAc,KAAK,UAAU,QACjC,oBAAC,SAAI,WAAU,+CACZ,iBAAO,gBACV;AAAA,WAEJ;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/tour/tour.tsx"],"sourcesContent":["import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport type { CSSProperties, ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { cn } from \"../lib/cn\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { Button } from \"../components/button\";\nimport { useFocusTrap } from \"../hooks/use-focus-trap\";\nimport { sameRect } from \"../hooks/use-anchored-rect\";\nimport { dirOf, horizontalStep } from \"../lib/direction\";\nimport type { Direction } from \"../lib/direction\";\nimport { DEFAULT_TOUR_LABELS } from \"./tour-labels\";\nimport type { TourInfo } from \"./tour-info\";\nimport { completeStored, rememberAccount, rememberMigrate, type UseTourProgressOptions } from \"./use-tour-progress\";\n\n/**\n * `start`/`end` follow the reading direction (`end` is the right side in LTR and the\n * left side in RTL) and are what a translated app wants. `left`/`right` stay physical\n * for the steps that genuinely mean a screen side.\n */\nexport type TourPlacement = \"top\" | \"right\" | \"bottom\" | \"left\" | \"start\" | \"end\" | \"center\";\n\nexport interface TourStep {\n /** CSS selector for the element to spotlight. Omit for a centered step\n * (welcome/finish). If the target isn't found/visible, the step centers. */\n target?: string;\n title: string;\n body: ReactNode;\n /** Extra footer content, e.g. a \"load sample data\" shortcut. */\n action?: ReactNode;\n /** Spotlight padding around the target, px (default 8). */\n padding?: number;\n /** Where the card sits relative to the target. Omit for auto placement\n * (below → above → centered). \"center\" ignores the target and centers on\n * screen. \"start\"/\"end\" are the logical sides and flip in RTL; \"left\"/\"right\"\n * are physical. An explicit side flips to the opposite side if it would\n * overflow, then clamps into the viewport. */\n placement?: TourPlacement;\n /** Advance only when the user clicks the spotlighted target itself (not the\n * card's Next button). Requires `target`: the real control's own handler runs\n * first, then the tour steps forward on a microtask. The spotlight hole stays\n * click-through to the target; the rest of the page does not. */\n awaitClick?: boolean;\n /**\n * The spotlighted control is for USING, not only for looking at (0.46, keksdose live\n * #436): the layers it opens sit above the scrim and work. A plain step's overlay is\n * `z-[60]`, over every kit layer, so a field whose number pad (`NumberPadSheet`), a\n * select's menu or a popover opens at `z-50` opened UNDER the shields, where nothing\n * could be tapped. Here the overlay drops to `z-[45]`: still over the top bar and the\n * page (`z-40` and below, still dimmed and shielded), under every `z-50` layer the\n * target opens — so an app's own layer wants `z-50` or more to clear it. Keys pressed\n * in the target or in such a layer are theirs (Escape closes the pad, arrows walk a\n * list); from the card the tour's keys work as on any step. The overlay is not\n * `aria-modal` then, and carries `data-tour-interactive`.\n *\n * The card is in the same layer as the scrim, so an open pad or sheet may cover it\n * until it closes. Requires `target`. A `HoverMenu` (`z-40`, the top bar's menus) stays\n * under the scrim: point an `awaitClick` step at its trigger instead.\n */\n interactive?: boolean;\n /**\n * Advance once a value was ENTERED in the spotlighted control (0.46, keksdose live\n * #436) — `awaitClick` for a field. Implies `interactive`. Counted when focus leaves\n * the target (the number pad's Done, a Tab, a tap elsewhere), or Enter is pressed in\n * it, and one of its fields (`input`, `textarea`, `select`: the target itself or\n * inside it) then holds another value than when the step began; a native `change`\n * (a select, a checkbox) counts at once. The card swaps Next for `awaitInputHint`,\n * as for `awaitClick`. A picker whose value is not a field's (the kit's `Select`\n * button) has nothing to compare: call `useTour().next()` from its `onChange`.\n */\n awaitInput?: boolean;\n /** Runs before the step is shown — e.g. navigate to a route, open a panel.\n * May be async; the step waits for it, then locates the target. */\n beforeStep?: () => void | Promise<void>;\n}\n\nexport interface TourLabels {\n next: string;\n back: string;\n skip: string;\n done: string;\n /** Shown in place of the Next button on an `awaitClick` step. */\n awaitClickHint: string;\n /** Shown in place of the Next button on an `awaitInput` step (0.46). */\n awaitInputHint: string;\n /** Step counter, e.g. (2, 7) => \"2 / 7\". */\n step: (current: number, total: number) => string;\n}\n\n// Defined in ./tour-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_TOUR_LABELS };\n\ninterface StartOptions {\n /** Stable id of the tour, surfaced as `activeId` so the app can mirror it to\n * the URL (deep-link / evaluation tracking) and record completion. Defaults to\n * `tour.id`. */\n id?: string;\n /** The tour being started, as the app lists it (docs/tours-harmonization.md §9.6.1).\n * When its last step is finished, the provider records the completion in its\n * `progress` and hands this to `onComplete`. */\n tour?: TourInfo;\n /** Start at this step index instead of 0 (clamped) — for URL/deep-link resume. */\n startIndex?: number;\n /** Fires synchronously when the tour starts (e.g. enable a mock interceptor). */\n onStart?: () => void;\n /** After the last step: runs after the provider's progress write and `onComplete`. */\n onFinish?: () => void;\n onSkip?: () => void;\n}\n\n/** What `TourProvider`'s `onComplete` learns besides the tour (§9.1, §9.6). */\nexport interface TourCompletion {\n /**\n * `true` when the completion counts anew (the first time, or the first time after the\n * tour's update, §8): the moment for the app's points toast. `false` for a replay, and\n * when the stored text is in an old shape no `migrate` reads: nothing is overwritten\n * then, and the error goes to `console.error` (keksdose B-1). `undefined` when the provider has no `progress` or the start carried no `tour`, so\n * nothing was recorded.\n */\n awarded: boolean | undefined;\n}\n\ninterface TourContextValue {\n active: boolean;\n /** Id of the running tour (from {@link StartOptions.id}), else null. */\n activeId: string | null;\n /** Start a tour with the given steps. */\n start: (steps: TourStep[], opts?: StartOptions) => void;\n /** End the current tour (no callbacks fire). */\n stop: () => void;\n /** Advance one step; past the last step it finishes the tour (fires onFinish). */\n next: () => void;\n /** Go back one step (no-op on the first). */\n prev: () => void;\n /** Jump to a step by index, clamped to range — e.g. for URL/deep-link resume. */\n goToStep: (index: number) => void;\n /** Current step (0-based; 0 while inactive). */\n index: number;\n /** Total steps (0 while inactive). */\n total: number;\n}\n\nconst TourContext = createContext<TourContextValue | null>(null);\n\nexport function useTour(): TourContextValue {\n const ctx = useContext(TourContext);\n if (!ctx) throw new Error(\"useTour must be used within <TourProvider>\");\n return ctx;\n}\n\n/**\n * The tour engine if it is there, `null` if it is not — for a control that is a\n * DECORATION rather than a participant.\n *\n * {@link useTour}'s throw is correct and stays: a component that runs a tour cannot do\n * its job without the provider, and failing loudly is how that gets fixed. But the\n * throw's blast radius is whatever error boundary is above it, and for a launcher in\n * the app shell that is the whole app.\n *\n * Keksdose feedback dev#524 is what that costs: an `@hb/ui` module was edited while a\n * dev server was running, vite re-evaluated it, and the module's freshly created\n * context object was no longer the one the mounted provider was providing. React's\n * `useContext` then answers `null` for a provider that is, structurally, right there —\n * and the top bar's tour menu took the entire shell down with it. **Build-time module\n * graphs cannot produce that**, so it is a development-only failure; a menu that\n * disappears for a second is the proportionate response to it either way.\n *\n * Only for controls that can honestly render nothing. If a component would show a\n * broken half of itself without the tour, it wants {@link useTour}.\n */\nexport function useTourOptional(): TourContextValue | null {\n return useContext(TourContext);\n}\n\n/** The kit's dev switch (as number-input's): a development build, never under vitest. */\nfunction devWarnings(): boolean {\n return Boolean(import.meta.env?.DEV) && !import.meta.env?.VITEST;\n}\n\n/**\n * Provides the guided-tour engine: a dimmed spotlight overlay + step card driven\n * by a list of {@link TourStep}s. Domain-free — the app supplies the steps (copy,\n * selectors, per-step navigation, placement) and the translated {@link TourLabels}.\n * Mount once inside the router; start a tour from anywhere via {@link useTour},\n * which also exposes step control (`next`/`prev`/`goToStep`) and the current\n * `index`/`total` for URL mirroring, `awaitClick` and deep-link resume.\n *\n * **Completion in one place** (docs/tours-harmonization.md §9.6): give the provider the\n * app's `progress` (the same `{storageKey, migrate}` as `useTourProgress`) and start each\n * tour with `start(steps, {tour})`. When the last step is finished the provider writes the\n * completion ONCE, through the store every `useTourProgress` reader of the key shares\n * (never a second copy), then calls `onComplete(tour, {awarded})`, then the start's own\n * `onFinish`. A skip or `stop()` records nothing and calls neither. The app removes its\n * own `complete()` from `onFinish`, or that second write answers `false`.\n *\n * Both props are optional: without `progress` or a `tour` on the start, `onComplete`\n * still fires, with `awarded: undefined` (and `tour` as given, possibly `undefined`). A\n * new `storageKey` (an account switch on a shared PC) is followed on the next\n * completion, without a remount.\n */\nexport function TourProvider({\n children,\n labels,\n progress,\n onComplete,\n}: {\n children: ReactNode;\n labels?: LabelOverride<TourLabels>;\n /** The app's tour progress: the same options its `useTourProgress` readers use. */\n progress?: UseTourProgressOptions;\n /** A tour's last step was finished; see {@link TourCompletion}. */\n onComplete?: (tour: TourInfo | undefined, completion: TourCompletion) => void;\n}) {\n // `labels` over the provider's `tour` over English. Resolved once here and handed\n // down: the step card is portalled, but context crosses portals anyway — this is\n // simply the one place that already owned the merge.\n const merged = useKitLabels(\"tour\", DEFAULT_TOUR_LABELS, labels);\n const [steps, setSteps] = useState<TourStep[] | null>(null);\n const [index, setIndex] = useState(0);\n const [activeId, setActiveId] = useState<string | null>(null);\n const optsRef = useRef<StartOptions>({});\n // The latest props, read at the finish: a new `storageKey` or callback needs no remount.\n const progressRef = useRef(progress);\n const onCompleteRef = useRef(onComplete);\n useLayoutEffect(() => {\n progressRef.current = progress;\n onCompleteRef.current = onComplete;\n });\n // The provider's migrate becomes the key's, for readers that pass none (keksdose B-2).\n const storageKey = progress?.storageKey;\n const migrate = progress?.migrate;\n // 0.45: and its `account` (§10.3), so a finish on an account key is sent as readers' are.\n const account = progress?.account;\n useLayoutEffect(() => {\n if (storageKey !== undefined) rememberMigrate(storageKey, migrate);\n if (storageKey !== undefined) rememberAccount(storageKey, account);\n }, [storageKey, migrate, account]);\n const warnedNoTourRef = useRef(false);\n // Live mirrors so the step-control callbacks can stay stable (identity-safe for\n // consumers) while still reading the current steps/index. Synced in a layout\n // effect — after the commit, before paint and before any passive effect or event\n // can call them — rather than written during render.\n const stepsRef = useRef<TourStep[] | null>(null);\n const indexRef = useRef(0);\n useLayoutEffect(() => {\n stepsRef.current = steps;\n indexRef.current = index;\n }, [steps, index]);\n const active = !!steps && steps.length > 0;\n const total = steps?.length ?? 0;\n\n const start = useCallback((s: TourStep[], opts?: StartOptions) => {\n optsRef.current = opts ?? {};\n optsRef.current.onStart?.();\n setIndex(Math.min(Math.max(0, opts?.startIndex ?? 0), Math.max(0, s.length - 1)));\n setActiveId(opts?.id ?? opts?.tour?.id ?? null);\n setSteps(s);\n }, []);\n const stop = useCallback(() => {\n setSteps(null);\n setActiveId(null);\n }, []);\n const finish = useCallback(() => {\n // Once per tour: a second \"Done\" before the overlay unmounts records nothing more.\n if (!stepsRef.current) return;\n stepsRef.current = null;\n const { tour, onFinish } = optsRef.current;\n const store = progressRef.current;\n // Exactly one write per completion (§9.6.2), so `awarded` is what `complete(tour)` answered.\n let awarded: boolean | undefined;\n if (store && tour) {\n try {\n awarded = completeStored(store.storageKey, store.migrate, tour);\n } catch (error) {\n // A stored text no migrate reads is left as it is (keksdose B-1); the tour still ends.\n console.error(error);\n awarded = false;\n }\n } else if (store && !tour && devWarnings() && !warnedNoTourRef.current) {\n warnedNoTourRef.current = true;\n console.warn(\n \"[ui-kit] TourProvider has `progress`, but a finished tour's start carried no `tour`: \" +\n \"nothing was recorded and `awarded` is undefined. Start it with `start(steps, { tour })`.\",\n );\n }\n onCompleteRef.current?.(tour, { awarded });\n onFinish?.();\n setSteps(null);\n setActiveId(null);\n }, []);\n const skip = useCallback(() => {\n optsRef.current.onSkip?.();\n setSteps(null);\n setActiveId(null);\n }, []);\n\n const goToStep = useCallback((i: number) => {\n const len = stepsRef.current?.length ?? 0;\n if (len === 0) return;\n setIndex(Math.min(Math.max(0, i), len - 1));\n }, []);\n const next = useCallback(() => {\n const len = stepsRef.current?.length ?? 0;\n if (len === 0) return;\n if (indexRef.current >= len - 1) finish();\n else setIndex(indexRef.current + 1);\n }, [finish]);\n const prev = useCallback(() => {\n if (indexRef.current > 0) setIndex(indexRef.current - 1);\n }, []);\n\n return (\n <TourContext.Provider value={{ active, activeId, start, stop, next, prev, goToStep, index, total }}>\n {children}\n {active && (\n <TourOverlay\n steps={steps!}\n index={index}\n labels={merged}\n onNext={next}\n onPrev={prev}\n onSkip={skip}\n />\n )}\n </TourContext.Provider>\n );\n}\n\ninterface Rect {\n top: number;\n left: number;\n width: number;\n height: number;\n}\n\nfunction isVisible(el: Element): boolean {\n // A non-zero box already rules out display:none on the element or any ancestor\n // (an unrendered element measures 0x0). We deliberately do NOT test\n // offsetParent: it is null for position:fixed elements even when fully visible,\n // which made the mobile bottom-nav bar (fixed) un-highlightable on mobile\n // (feedback #313). visibility:hidden keeps a box, so check it explicitly.\n const r = el.getBoundingClientRect();\n if (r.width <= 0 || r.height <= 0) return false;\n const style = getComputedStyle(el);\n return style.visibility !== \"hidden\" && style.display !== \"none\";\n}\n\n// The first VISIBLE element matching the selector, not merely the first in DOM\n// order. This lets a step target the same control across layouts with one\n// combined selector — e.g. the desktop sidebar link AND the mobile bottom-bar\n// link — where the off-layout copy is present but `display:none` (feedback\n// #313). Returns null while none is visible so the finder keeps retrying.\nfunction queryVisibleTarget(selector: string): Element | null {\n const els = document.querySelectorAll(selector);\n for (const el of els) {\n if (isVisible(el)) return el;\n }\n return null;\n}\n\nfunction rectOf(el: Element): Rect {\n const r = el.getBoundingClientRect();\n return { top: r.top, left: r.left, width: r.width, height: r.height };\n}\n\n/**\n * What the finder established for ONE step: where its target is (`null` = no target,\n * or not on the page), and the reading direction the card takes from it.\n *\n * It carries the step it was found for, and the overlay only believes it for that\n * step — which is the whole fix for keksdose's tours audit 2026-10-02, §1.0 A (\"stale\n * spotlight on the step after a spotlighted one\", 15 steps in 16 tours, desktop and\n * phone, mouse and keyboard). When step N spotlit a target and step N+1 had none (or\n * its anchor was missing), N+1 kept N's hole and parked its card beside it, so a\n * centred \"You're all set\" read as pointing at the Import & Export link; Back→Next kept\n * it for as long as anyone watched.\n *\n * The overlay used to hold `rect` and `ready` as separate states and reset them\n * DURING RENDER when the step changed. React 19 does not keep a render-phase update\n * while an earlier, lower-priority update to the same hook is still queued — it only\n * writes the result to the base state \"unless the queue is empty\" — and the follow\n * interval below queues exactly such an update every 250 ms (eagerly bailed out because\n * the rect had not moved, but left in the queue for rebasing). So the click's render\n * showed the reset, and the very next render (the finder saying \"ready\") re-based on\n * the old rect. A deep link was fine because nothing had queued anything yet.\n *\n * Keying the result to its step does not depend on any of that ordering: a rect found\n * for another step is not this step's rect, whatever the queue does with it, and a\n * missing anchor reads as \"no target\" instead of as the last thing that was lit.\n */\ninterface Located {\n index: number;\n step: TourStep;\n rect: Rect | null;\n dir: Direction;\n}\n\nfunction TourOverlay({\n steps,\n index,\n labels,\n onNext,\n onPrev,\n onSkip,\n}: {\n steps: TourStep[];\n index: number;\n labels: TourLabels;\n onNext: () => void;\n onPrev: () => void;\n onSkip: () => void;\n}) {\n const step = steps[index];\n const isFirst = index === 0;\n const isLast = index === steps.length - 1;\n // A new step starts unlocated: whatever was found for another step (see `Located`)\n // is ignored, so the overlay renders nothing until the effect below has located THIS\n // step, and never the previous step's spotlight.\n const [located, setLocated] = useState<Located | null>(null);\n const current = located !== null && located.index === index && located.step === step ? located : null;\n const ready = current !== null;\n const rect = current?.rect ?? null;\n // The overlay is portalled to <body>, out of whatever `dir` subtree the app set, so it\n // takes the direction of the element it spotlights (the document's for a centered\n // step). Arrow keys and start/end placement read it.\n const dir: Direction = current?.dir ?? \"ltr\";\n const rootRef = useRef<HTMLDivElement>(null);\n\n // Run beforeStep, then locate the target (retrying across route/render lag).\n useEffect(() => {\n let cancelled = false;\n let raf = 0;\n // `null` = untargeted, or the finder gave up → the card centres, with no hole.\n const settle = (el: Element | null) =>\n setLocated({ index, step, rect: el ? rectOf(el) : null, dir: dirOf(el) });\n void (async () => {\n await step.beforeStep?.();\n if (cancelled) return;\n if (!step.target) {\n settle(null);\n return;\n }\n let tries = 0;\n const find = () => {\n if (cancelled) return;\n const el = queryVisibleTarget(step.target!);\n if (el) {\n el.scrollIntoView({ block: \"center\", behavior: \"smooth\" });\n settle(el);\n return;\n }\n if (tries++ < 45) raf = requestAnimationFrame(find);\n else settle(null); // give up → render centered\n };\n find();\n })();\n return () => {\n cancelled = true;\n cancelAnimationFrame(raf);\n };\n }, [index, step]);\n\n // Follow the target as the page scrolls / reflows — only once THIS step is located,\n // and only into this step's result.\n useEffect(() => {\n if (!step.target) return;\n const update = () => {\n const el = queryVisibleTarget(step.target!);\n if (el) {\n const next = rectOf(el);\n setLocated((prev) =>\n prev && prev.index === index && prev.step === step && !sameRect(prev.rect, next)\n ? { ...prev, rect: next }\n : prev,\n );\n }\n };\n window.addEventListener(\"scroll\", update, true);\n window.addEventListener(\"resize\", update);\n const id = window.setInterval(update, 250);\n return () => {\n window.removeEventListener(\"scroll\", update, true);\n window.removeEventListener(\"resize\", update);\n clearInterval(id);\n };\n }, [index, step]);\n\n // awaitClick: advance when the *real* target is clicked. The spotlight hole is\n // click-through (see the shields in the render below) so the element's own\n // handler runs first; we step forward on the next macrotask.\n //\n // Re-armed when the target turns up after the finder gave up (the follow effect\n // lights it late): the card swaps Next for the \"click the highlighted element\" hint\n // as soon as there is a rect, so the click must work from that moment too.\n const spotted = rect !== null;\n useEffect(() => {\n if (!ready || !spotted || !step.awaitClick || !step.target) return;\n const el = queryVisibleTarget(step.target);\n if (!el) return;\n const onClick = () => window.setTimeout(() => onNext(), 0);\n el.addEventListener(\"click\", onClick, { once: true });\n return () => el.removeEventListener(\"click\", onClick);\n }, [ready, spotted, index, step, onNext]);\n\n // An interactive step (see `TourStep.interactive`): only while the target is lit — a\n // step whose target is missing centres its card over a full scrim, modal as ever.\n const interactive = spotted && !!step.target && !!(step.interactive || step.awaitInput);\n\n // awaitInput: advance once the target's fields hold another value than when the step\n // was armed, checked when focus leaves the target or Enter is pressed in it — on the\n // next macrotask, after the field's own blur/Enter commit has rendered. A value the\n // number pad typed fires no native `change`, so comparing is what catches it.\n useEffect(() => {\n if (!ready || !spotted || !step.awaitInput || !step.target) return;\n const el = queryVisibleTarget(step.target) as HTMLElement | null;\n if (!el) return;\n const read = () => fieldValues(el);\n const before = read();\n let timer = 0;\n let done = false;\n const check = () => {\n window.clearTimeout(timer);\n timer = window.setTimeout(() => {\n if (done || read() === before) return;\n done = true;\n onNext();\n }, 0);\n };\n const onFocusOut = (e: FocusEvent) => {\n if (e.relatedTarget instanceof Node && el.contains(e.relatedTarget)) return;\n check();\n };\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === \"Enter\") check();\n };\n el.addEventListener(\"focusout\", onFocusOut);\n el.addEventListener(\"keydown\", onKeyDown);\n el.addEventListener(\"change\", check);\n return () => {\n window.clearTimeout(timer);\n el.removeEventListener(\"focusout\", onFocusOut);\n el.removeEventListener(\"keydown\", onKeyDown);\n el.removeEventListener(\"change\", check);\n };\n }, [ready, spotted, index, step, onNext]);\n\n // Keyboard: Esc skips, Enter and the reading-direction arrow advance (→ in LTR,\n // ← in RTL), the other arrow goes back. On awaitClick steps Enter is ignored (it\n // would fire the target's click AND advance) — the forward arrow stays as an escape\n // hatch.\n //\n // Enter on a focused control belongs to that control. This used to advance from\n // anywhere, so Enter on a focused Skip or Back ran the button's own click AND stepped\n // forward: Back moved nowhere, Skip skipped and then called `next` on a dead tour.\n // The same goes for arrows in a text field a step's `action` might contain.\n useEffect(() => {\n const onKey = (e: KeyboardEvent) => {\n // On an interactive step a key pressed in the target, or in a layer it opened (the\n // number pad's Escape, a menu's arrows), is the page's. The card's and the bare\n // page's (focus on <body>) stay the tour's.\n if (interactive && e.target instanceof Node && e.target !== document.body && !rootRef.current?.contains(e.target)) {\n return;\n }\n if (e.key === \"Escape\") {\n onSkip();\n return;\n }\n if (e.key === \"Enter\") {\n if (step.awaitClick || step.awaitInput || ownsKey(e.target, \"Enter\")) return;\n e.preventDefault();\n onNext();\n return;\n }\n if (ownsKey(e.target, e.key)) return;\n // The overlay root carries `dir`; before it paints, the document's answers.\n const delta = horizontalStep(e.key, rootRef.current);\n if (delta === 1) {\n e.preventDefault();\n onNext();\n } else if (delta === -1) {\n if (!isFirst) onPrev();\n }\n };\n document.addEventListener(\"keydown\", onKey);\n return () => document.removeEventListener(\"keydown\", onKey);\n }, [isFirst, step, interactive, onNext, onPrev, onSkip]);\n\n if (!ready) return null;\n\n const pad = step.padding ?? 8;\n const spot: Rect | null = rect\n ? { top: rect.top - pad, left: rect.left - pad, width: rect.width + pad * 2, height: rect.height + pad * 2 }\n : null;\n\n // `aria-modal` promises the page behind is out of reach, and the card's focus trap\n // keeps that promise for the keyboard. The pointer used to get no such treatment: the\n // root is `pointer-events-none` so that the spotlight hole can stay live for\n // `awaitClick`, and the scrim is a box-shadow, which takes no clicks — so every\n // control on the dimmed page stayed clickable. Four shields now tile the viewport\n // around the hole: the page is blocked, the card and the spotlighted target are not.\n // Keeping `aria-modal` (rather than dropping it) is the coherent half: the tour\n // really is modal — focus is trapped and Esc/Skip is the way out.\n return createPortal(\n <div\n ref={rootRef}\n // z-[45] on an interactive step: over the top bar (z-40), under the z-50 layers the\n // target opens. See `TourStep.interactive`.\n className={cn(\"pointer-events-none fixed inset-0\", interactive ? \"z-[45]\" : \"z-[60]\")}\n role=\"dialog\"\n aria-modal={interactive ? undefined : \"true\"}\n data-tour-interactive={interactive ? \"\" : undefined}\n aria-label={step.title}\n dir={dir}\n >\n {spot && <SpotlightShields spot={spot} />}\n {spot ? (\n <div\n className=\"pointer-events-none fixed rounded-lg transition-all duration-200 ease-out\"\n style={{\n top: spot.top,\n left: spot.left,\n width: spot.width,\n height: spot.height,\n // A two-tone frame, not a single translucent ring.\n //\n // The old treatment was `ring-2 ring-white/80` over a 55% scrim, and it\n // \"was barely visible\" on the app's blue-tinted surfaces. Two reasons,\n // and a single ring can't fix either: at 55% the surround stays bright\n // enough that the un-dimmed hole barely reads AS a hole, and a 80%-white\n // ring sitting on the edge of a light card is white-on-near-white.\n //\n // So: an opaque white band immediately around the target, a dark keyline\n // outside it, then the scrim. Whatever the target's own colour is, one of\n // the two bands is always in contrast with it and the other is always in\n // contrast with the dimmed surround — there is no background that can\n // swallow both. The blurred layer between them softens the step so the\n // frame reads as lighting rather than as a pasted-on rectangle.\n boxShadow: [\n \"0 0 0 3px rgba(255,255,255,0.98)\",\n \"0 0 0 5px rgba(15,23,42,0.92)\",\n \"0 0 18px 6px rgba(15,23,42,0.45)\",\n \"0 0 0 9999px rgba(15,23,42,0.70)\",\n ].join(\", \"),\n }}\n />\n ) : (\n <div className=\"pointer-events-auto fixed inset-0 bg-black/70\" />\n )}\n <TourCard\n step={step}\n index={index}\n total={steps.length}\n labels={labels}\n isFirst={isFirst}\n isLast={isLast}\n rect={spot}\n dir={dir}\n onBack={onPrev}\n onNext={onNext}\n onSkip={onSkip}\n />\n </div>,\n document.body,\n );\n}\n\n/** The values of the fields at or inside `el`, as one string to compare (`awaitInput`). */\nfunction fieldValues(el: Element): string {\n const fields = el.matches(\"input,textarea,select\") ? [el] : Array.from(el.querySelectorAll(\"input,textarea,select\"));\n return fields\n .map((f) =>\n f instanceof HTMLInputElement && (f.type === \"checkbox\" || f.type === \"radio\")\n ? String(f.checked)\n : (f as HTMLInputElement).value,\n )\n .join(\"\\u0000\");\n}\n\n/** Does the focused element handle `key` itself? Enter on a button or link, and any\n * editing key in a text field or select, is the control's — not the tour's. */\nfunction ownsKey(target: EventTarget | null, key: string): boolean {\n if (!(target instanceof HTMLElement)) return false;\n if (target.isContentEditable) return true;\n const tag = target.tagName;\n if (tag === \"TEXTAREA\" || tag === \"SELECT\") return true;\n if (tag === \"INPUT\") {\n const type = (target as HTMLInputElement).type;\n // Enter on a checkbox does nothing natively, but ←/→ on a radio moves it.\n return key !== \"Enter\" || type !== \"checkbox\";\n }\n if (key !== \"Enter\") return false;\n return (\n tag === \"BUTTON\" ||\n (tag === \"A\" && target.hasAttribute(\"href\")) ||\n target.getAttribute(\"role\") === \"button\" ||\n target.getAttribute(\"role\") === \"link\"\n );\n}\n\n/**\n * Transparent pointer blockers tiling the viewport around the spotlight hole: one\n * full-width band above and below, one on each side at the hole's own height. The hole\n * itself stays uncovered, so the target keeps its clicks.\n */\nfunction SpotlightShields({ spot }: { spot: Rect }) {\n const shield = \"pointer-events-auto fixed\";\n const bottom = spot.top + spot.height;\n return (\n <>\n <div data-tour-shield=\"\" className={shield} style={{ top: 0, left: 0, right: 0, height: Math.max(0, spot.top) }} />\n <div data-tour-shield=\"\" className={shield} style={{ top: bottom, left: 0, right: 0, bottom: 0 }} />\n <div\n data-tour-shield=\"\"\n className={shield}\n style={{ top: spot.top, left: 0, width: Math.max(0, spot.left), height: spot.height }}\n />\n <div\n data-tour-shield=\"\"\n className={shield}\n style={{ top: spot.top, left: spot.left + spot.width, right: 0, height: spot.height }}\n />\n </>\n );\n}\n\n/**\n * Card position (viewport px) for the given placement relative to the padded\n * spotlight `rect`. Omitted placement keeps the original auto behavior\n * (below → above → vertically centered); an explicit side flips to its opposite\n * if it would overflow, then clamps into the viewport. \"center\" (or no rect)\n * centers on screen.\n */\nfunction placeCard(\n rect: Rect | null,\n cw: number,\n ch: number,\n vw: number,\n vh: number,\n m: number,\n placement?: TourPlacement,\n dir: Direction = \"ltr\",\n): { top: number; left: number } {\n // The logical sides resolve to a physical one here, and only here.\n if (placement === \"start\") placement = dir === \"rtl\" ? \"right\" : \"left\";\n else if (placement === \"end\") placement = dir === \"rtl\" ? \"left\" : \"right\";\n if (!rect || placement === \"center\") {\n return { top: Math.max(m, (vh - ch) / 2), left: Math.max(m, (vw - cw) / 2) };\n }\n const clampX = (x: number) => Math.min(Math.max(m, x), Math.max(m, vw - cw - m));\n const clampY = (y: number) => Math.min(Math.max(m, y), Math.max(m, vh - ch - m));\n const centerX = clampX(rect.left + rect.width / 2 - cw / 2);\n const centerY = clampY(rect.top + rect.height / 2 - ch / 2);\n const belowTop = rect.top + rect.height + m;\n const aboveTop = rect.top - ch - m;\n const rightLeft = rect.left + rect.width + m;\n const leftLeft = rect.left - cw - m;\n const fitsBelow = belowTop + ch <= vh;\n const fitsAbove = aboveTop >= 0;\n const fitsRight = rightLeft + cw <= vw;\n const fitsLeft = leftLeft >= 0;\n\n switch (placement) {\n case \"top\":\n return { top: fitsAbove ? aboveTop : fitsBelow ? belowTop : clampY(aboveTop), left: centerX };\n case \"bottom\":\n return { top: fitsBelow ? belowTop : fitsAbove ? aboveTop : clampY(belowTop), left: centerX };\n case \"right\":\n return { top: centerY, left: fitsRight ? rightLeft : fitsLeft ? leftLeft : clampX(rightLeft) };\n case \"left\":\n return { top: centerY, left: fitsLeft ? leftLeft : fitsRight ? rightLeft : clampX(leftLeft) };\n default:\n if (fitsBelow) return { top: belowTop, left: centerX };\n if (fitsAbove) return { top: aboveTop, left: centerX };\n return { top: Math.max(m, (vh - ch) / 2), left: centerX };\n }\n}\n\nfunction TourCard({\n step,\n index,\n total,\n labels,\n isFirst,\n isLast,\n rect,\n dir,\n onBack,\n onNext,\n onSkip,\n}: {\n step: TourStep;\n index: number;\n total: number;\n labels: TourLabels;\n isFirst: boolean;\n isLast: boolean;\n rect: Rect | null;\n dir: Direction;\n onBack: () => void;\n onNext: () => void;\n onSkip: () => void;\n}) {\n const ref = useRef<HTMLDivElement>(null);\n const [style, setStyle] = useState<CSSProperties>({ opacity: 0 });\n\n /**\n * The card holds the focus, because the card is what the tour IS.\n *\n * The overlay above declares `role=\"dialog\" aria-modal=\"true\"` — it always has — and\n * then left focus wherever the page had put it. For a tour that is the most pointed\n * version of the audit's *\"Only Modal manages focus\"*: the whole component exists to\n * say \"look here\", and for a keyboard user \"here\" is the focus ring. They were told\n * the page was hidden, given no way to reach the Next button without Tabbing through\n * it, and left on a control the screen reader would no longer describe.\n *\n * It re-engages on every step, without any bookkeeping here, because `TourOverlay`\n * returns null while it re-locates the next target: the card genuinely unmounts and\n * remounts between steps. That is what keeps focus honest when the BUTTONS change —\n * \"Back\" does not exist on the first step, so stepping back onto it destroys the\n * control the press came from, and focus would otherwise fall to `<body>`, outside\n * this trap's own listener, where Tab walks straight into the page the overlay claims\n * to have hidden.\n *\n * **The cost, written down:** on an `awaitClick` step the user is asked to click the\n * spotlighted element, and they can no longer Tab to it. ArrowRight still advances\n * (the key handler in `TourOverlay` is on the document and does not care where focus\n * is), which is the escape hatch that step already documents for the case where the\n * target cannot be found. Containment is worth that: an `awaitClick` step is a\n * minority of steps, while focus stranded behind `aria-modal` is every step.\n */\n useFocusTrap(ref, { active: true });\n\n useLayoutEffect(() => {\n const card = ref.current;\n if (!card) return;\n setStyle(\n placeCard(rect, card.offsetWidth, card.offsetHeight, window.innerWidth, window.innerHeight, 12, step.placement, dir),\n );\n }, [rect, index, step.placement, dir]);\n\n return (\n <div\n ref={ref}\n // Focusable but not tabbable: the trap above focuses the card itself rather than\n // its first button, so a screen reader reads the step's title and body before it\n // reads \"Next\" — and without this the container cannot take focus at all and the\n // trap silently does nothing.\n tabIndex={-1}\n style={style}\n className=\"pointer-events-auto fixed z-[61] w-80 max-w-[calc(100vw-1.5rem)] rounded-lg border border-subtle bg-surface p-4 shadow-xl outline-none transition-all duration-200 ease-out\"\n >\n <div className=\"text-sm font-semibold text-primary\">{step.title}</div>\n <div className=\"mt-1 text-sm leading-relaxed text-secondary\">{step.body}</div>\n {step.action && <div className=\"mt-3\">{step.action}</div>}\n <div className=\"mt-4 space-y-2\">\n <div className=\"flex items-center justify-between gap-2\">\n <button\n type=\"button\"\n onClick={onSkip}\n className=\"text-xs text-placeholder hover:text-secondary\"\n >\n {labels.skip}\n </button>\n <div className=\"flex items-center gap-2\">\n <span className=\"whitespace-nowrap text-xs tabular-nums text-placeholder\">\n {labels.step(index + 1, total)}\n </span>\n {!isFirst && (\n <Button variant=\"secondary\" onClick={onBack} className=\"px-2.5 py-1 text-xs\">\n {labels.back}\n </Button>\n )}\n {/* On an awaitClick step the Next button is replaced by a hint on its\n own row below, so it doesn't cram the counter + buttons and wrap.\n Only when the target was actually FOUND, though — `rect` is null\n when the finder gave up, and the click listener early-returns on\n the same absence. Keyed on `step.target` alone this hid the only\n way forward on any step whose anchor happens not to be rendered\n for this user (a guest sees no \"add account\" button), leaving the\n undocumented ArrowRight key as the sole escape. */}\n {!((step.awaitClick || step.awaitInput) && step.target && rect) && (\n <Button variant=\"brand\" onClick={onNext} className={cn(\"px-2.5 py-1 text-xs\")}>\n {isLast ? labels.done : labels.next}\n </Button>\n )}\n </div>\n </div>\n {(step.awaitClick || step.awaitInput) && step.target && rect && (\n <div className=\"text-center text-xs italic text-placeholder\">\n {step.awaitInput && !step.awaitClick ? labels.awaitInputHint : labels.awaitClickHint}\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";AA+TI,SA4YA,UAzYI,KAHJ;AA/TJ;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AACnB,SAAS,oBAAwC;AACjD,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AACzB,SAAS,OAAO,sBAAsB;AAEtC,SAAS,2BAA2B;AAEpC,SAAS,gBAAgB,iBAAiB,uBAAoD;AAiI9F,MAAM,cAAc,cAAuC,IAAI;AAExD,SAAS,UAA4B;AAC1C,QAAM,MAAM,WAAW,WAAW;AAClC,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,4CAA4C;AACtE,SAAO;AACT;AAsBO,SAAS,kBAA2C;AACzD,SAAO,WAAW,WAAW;AAC/B;AAGA,SAAS,cAAuB;AAC9B,SAAO,QAAQ,YAAY,KAAK,GAAG,KAAK,CAAC,YAAY,KAAK;AAC5D;AAuBO,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAOG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AAAA,+BAAC,SAAI,WAAU,2CACb;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,MAAK;AAAA,gBACL,SAAS;AAAA,gBACT,WAAU;AAAA,gBAET,iBAAO;AAAA;AAAA,YACV;AAAA,YACA,qBAAC,SAAI,WAAU,2BACb;AAAA,kCAAC,UAAK,WAAU,2DACb,iBAAO,KAAK,QAAQ,GAAG,KAAK,GAC/B;AAAA,cACC,CAAC,WACA,oBAAC,UAAO,SAAQ,aAAY,SAAS,QAAQ,WAAU,uBACpD,iBAAO,MACV;AAAA,cAUD,GAAG,KAAK,cAAc,KAAK,eAAe,KAAK,UAAU,SACxD,oBAAC,UAAO,SAAQ,SAAQ,SAAS,QAAQ,WAAW,GAAG,qBAAqB,GACzE,mBAAS,OAAO,OAAO,OAAO,MACjC;AAAA,eAEJ;AAAA,aACF;AAAA,WACE,KAAK,cAAc,KAAK,eAAe,KAAK,UAAU,QACtD,oBAAC,SAAI,WAAU,+CACZ,eAAK,cAAc,CAAC,KAAK,aAAa,OAAO,iBAAiB,OAAO,gBACxE;AAAA,WAEJ;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eifi1/ui-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "App-agnostic shared design system: domain-free React components, theme and tokens.",
|
|
6
6
|
"_sideEffects": "The barrel (src/index.ts) re-exports EVERY component, including components/chart, which statically imports recharts. Without this field a bundler must assume each of those modules has side effects, so it cannot drop the unused ones: importing a Button from '@eifi1/ui-kit' dragged all 433KB of recharts into the consumer's ENTRY chunk, and Keksdose was preloading it on every page load, login included. Nothing in src/ imports for side effects (no bare imports, no CSS imports from JS, no module-level global writes) — the token stylesheet is its own './tokens.css' export — so this is safe. CSS is still listed so any future stylesheet survives. Re-checked when `flag-icons` left `dependencies` and tsup started emitting a `\"use client\"` banner: neither touches this. The flag stylesheet was never imported from JS in the first place (that was the finding), and a directive prologue is a string literal every bundler lifts out before it decides whether a module is inert.",
|
|
@@ -68,6 +68,18 @@
|
|
|
68
68
|
"types": "./dist/offline.d.ts",
|
|
69
69
|
"import": "./dist/offline.js"
|
|
70
70
|
},
|
|
71
|
+
"./sync": {
|
|
72
|
+
"types": "./dist/sync.d.ts",
|
|
73
|
+
"import": "./dist/sync.js"
|
|
74
|
+
},
|
|
75
|
+
"./sync/testing": {
|
|
76
|
+
"types": "./dist/sync/testing.d.ts",
|
|
77
|
+
"import": "./dist/sync/testing.js"
|
|
78
|
+
},
|
|
79
|
+
"./push-worker": {
|
|
80
|
+
"types": "./dist/push-worker.d.ts",
|
|
81
|
+
"import": "./dist/push-worker.js"
|
|
82
|
+
},
|
|
71
83
|
"./i18n/*": {
|
|
72
84
|
"types": "./dist/i18n/locales/*.d.ts",
|
|
73
85
|
"import": "./dist/i18n/locales/*.js"
|
|
@@ -119,6 +131,7 @@
|
|
|
119
131
|
"@tanstack/query-async-storage-persister": "^5",
|
|
120
132
|
"@tanstack/react-query": "^5",
|
|
121
133
|
"@tanstack/react-query-persist-client": "^5",
|
|
134
|
+
"dexie": "^4",
|
|
122
135
|
"idb-keyval": "^6",
|
|
123
136
|
"lucide-react": ">=0.400.0 <2",
|
|
124
137
|
"modern-screenshot": "^4.7.0",
|
|
@@ -139,6 +152,9 @@
|
|
|
139
152
|
"@tanstack/react-query-persist-client": {
|
|
140
153
|
"optional": true
|
|
141
154
|
},
|
|
155
|
+
"dexie": {
|
|
156
|
+
"optional": true
|
|
157
|
+
},
|
|
142
158
|
"idb-keyval": {
|
|
143
159
|
"optional": true
|
|
144
160
|
},
|
|
@@ -174,11 +190,13 @@
|
|
|
174
190
|
"@vitest/coverage-v8": "^5.0.2",
|
|
175
191
|
"axe-core": "4.13.0",
|
|
176
192
|
"commit-and-tag-version": "^13.2.1",
|
|
193
|
+
"dexie": "^4.4.6",
|
|
177
194
|
"eslint": "^10.11.0",
|
|
178
195
|
"eslint-import-resolver-typescript": "^4.4.5",
|
|
179
196
|
"eslint-plugin-import-x": "^4.17.1",
|
|
180
197
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
181
198
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
199
|
+
"fake-indexeddb": "^6.2.5",
|
|
182
200
|
"flag-icons": "^7.5.0",
|
|
183
201
|
"globals": "^17.12.0",
|
|
184
202
|
"husky": "^9.1.7",
|
|
@@ -24,6 +24,15 @@ export interface AdminTileLabels {
|
|
|
24
24
|
users: string;
|
|
25
25
|
/** `users_new_7d`, the line under the users tile. */
|
|
26
26
|
usersNew: (count: number) => string;
|
|
27
|
+
/** 0.46 (Kurvenschmiede 1, admin §9.5): server-kit's `awaiting_verdict` as an `extra`
|
|
28
|
+
* tile — answered reports that wait on a verdict (IN_EVALUATION, NEEDS_LIVE_TEST). */
|
|
29
|
+
awaitingVerdict: string;
|
|
30
|
+
/** Its line under the count. */
|
|
31
|
+
awaitingVerdictHint: string;
|
|
32
|
+
/** 0.46: server-kit's `released_for_work` — the reports released for the work queue. */
|
|
33
|
+
releasedForWork: string;
|
|
34
|
+
/** Its line under the count. */
|
|
35
|
+
releasedForWorkHint: string;
|
|
27
36
|
}
|
|
28
37
|
|
|
29
38
|
export interface AdminAreaLabels {
|
|
@@ -83,6 +92,10 @@ export const DEFAULT_ADMIN_AREA_LABELS: AdminAreaLabels = {
|
|
|
83
92
|
invitationsPending: "Pending invitations",
|
|
84
93
|
users: "Users",
|
|
85
94
|
usersNew: (count) => `${count} new in 7 days`,
|
|
95
|
+
awaitingVerdict: "Awaiting a verdict",
|
|
96
|
+
awaitingVerdictHint: "Answered, and waiting for you or the reporter to confirm the fix",
|
|
97
|
+
releasedForWork: "Released for work",
|
|
98
|
+
releasedForWorkHint: "Ready, rework requested or in progress",
|
|
86
99
|
},
|
|
87
100
|
overviewError: "The overview couldn’t be loaded.",
|
|
88
101
|
retry: "Try again",
|
|
@@ -86,8 +86,18 @@ export function AttentionTile({ count, href, ...tile }: AttentionTileProps) {
|
|
|
86
86
|
return <StatTile data-slot="attention-tile" {...tile} value={count ?? null} href={href} />;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
/**
|
|
90
|
+
* 0.46 (Kurvenschmiede 1, admin §9.5): the `extra` keys server-kit's
|
|
91
|
+
* `feedback_attention` fills, whose tiles have the kit's words
|
|
92
|
+
* (`adminArea.tiles.awaitingVerdict`, `releasedForWork`, with a line each).
|
|
93
|
+
*/
|
|
94
|
+
export type AdminFeedbackTileKey = "awaiting_verdict" | "released_for_work";
|
|
95
|
+
|
|
89
96
|
/** One of the app's own tiles (§2.4 decision 13: keksdose's "Support waiting"). */
|
|
90
|
-
export
|
|
97
|
+
export type AdminExtraTile = AdminOwnTile | AdminFeedbackTile;
|
|
98
|
+
|
|
99
|
+
/** A tile of the app's own: it brings its words. */
|
|
100
|
+
export interface AdminOwnTile {
|
|
91
101
|
/** Unique among the tiles; usually the `extra` key it shows. */
|
|
92
102
|
key: string;
|
|
93
103
|
label: ReactNode;
|
|
@@ -100,6 +110,14 @@ export interface AdminExtraTile {
|
|
|
100
110
|
description?: ReactNode;
|
|
101
111
|
}
|
|
102
112
|
|
|
113
|
+
/** 0.46: a tile of server-kit's feedback counts — `label` and `description` default to
|
|
114
|
+
* the kit's words; an app's own still win. The kit's `description` fills in only when
|
|
115
|
+
* `label` is left out too: an app that names the tile gets no hint line it did not ask for. */
|
|
116
|
+
export interface AdminFeedbackTile extends Omit<AdminOwnTile, "key" | "label"> {
|
|
117
|
+
key: AdminFeedbackTileKey;
|
|
118
|
+
label?: ReactNode;
|
|
119
|
+
}
|
|
120
|
+
|
|
103
121
|
export interface AdminOverviewProps {
|
|
104
122
|
/** The server's answer; `undefined` while it loads (the grid shows its skeletons). */
|
|
105
123
|
attention: AdminAttention | null | undefined;
|
|
@@ -186,9 +204,26 @@ export function AdminOverview({
|
|
|
186
204
|
attention && typeof attention.users_new_7d === "number" ? labels.tiles.usersNew(attention.users_new_7d) : undefined,
|
|
187
205
|
},
|
|
188
206
|
];
|
|
207
|
+
const feedbackWords: Record<AdminFeedbackTileKey, { label: string; description: string }> = {
|
|
208
|
+
awaiting_verdict: { label: labels.tiles.awaitingVerdict, description: labels.tiles.awaitingVerdictHint },
|
|
209
|
+
released_for_work: { label: labels.tiles.releasedForWork, description: labels.tiles.releasedForWorkHint },
|
|
210
|
+
};
|
|
189
211
|
const tiles = [
|
|
190
212
|
...shared.map((t) => ({ ...t, count: attention ? attention[t.key] : undefined, href: href[t.key] })),
|
|
191
|
-
...extraTiles
|
|
213
|
+
...extraTiles.map((t) => {
|
|
214
|
+
const words = Object.prototype.hasOwnProperty.call(feedbackWords, t.key)
|
|
215
|
+
? feedbackWords[t.key as AdminFeedbackTileKey]
|
|
216
|
+
: undefined;
|
|
217
|
+
// The kit's hint comes with the kit's label only: an app that names the tile
|
|
218
|
+
// itself gets no line it did not ask for (keksdose S5, round 0.46).
|
|
219
|
+
return words
|
|
220
|
+
? {
|
|
221
|
+
...t,
|
|
222
|
+
label: t.label ?? words.label,
|
|
223
|
+
description: t.description ?? (t.label === undefined ? words.description : undefined),
|
|
224
|
+
}
|
|
225
|
+
: t;
|
|
226
|
+
}),
|
|
192
227
|
].filter((t) => loading || (t.count !== null && t.count !== undefined));
|
|
193
228
|
if (!loading && tiles.length === 0) return error ? errorBox(true) : null;
|
|
194
229
|
const grid = (
|
|
@@ -55,8 +55,9 @@ export const MAIL_TEST_ANCHOR = "admin-mail-test";
|
|
|
55
55
|
export interface MailTestCardProps
|
|
56
56
|
extends Omit<SettingsSectionProps, "anchor" | "title" | "description" | "children"> {
|
|
57
57
|
/** The installation's transport, as the admin page has it (`mail_backend`): the chip
|
|
58
|
-
* before a send. After one, the answer's.
|
|
59
|
-
|
|
58
|
+
* before a send. After one, the answer's. Optional (0.46): without it the chip shows
|
|
59
|
+
* from the first answer on, and an app needs no query only for the chip. */
|
|
60
|
+
mailBackend?: string;
|
|
60
61
|
/** The app's `POST /admin/mail/test` (kastlan `/platform/mail/test`), no body: it
|
|
61
62
|
* awaits the app's own send and answers `{sent, mail_backend}`. A rejection is read
|
|
62
63
|
* for a 429 (the limiter); anything else is "could not send". */
|
|
@@ -114,6 +115,8 @@ export function MailTestCard({
|
|
|
114
115
|
const labels = useKitLabels("mailTestCard", DEFAULT_MAIL_TEST_CARD_LABELS, labelsProp);
|
|
115
116
|
const [busy, setBusy] = useState(false);
|
|
116
117
|
const [outcome, setOutcome] = useState<Outcome | null>(null);
|
|
118
|
+
// The last transport an answer named: a later send with no answer (429, network) keeps it.
|
|
119
|
+
const [answered, setAnswered] = useState<string | undefined>(undefined);
|
|
117
120
|
|
|
118
121
|
const run = async () => {
|
|
119
122
|
if (busy) return;
|
|
@@ -122,6 +125,7 @@ export function MailTestCard({
|
|
|
122
125
|
try {
|
|
123
126
|
const answer = await send();
|
|
124
127
|
const backend = answer.mail_backend;
|
|
128
|
+
if (backend) setAnswered(backend);
|
|
125
129
|
if (backend === "console") setOutcome({ kind: "console", backend });
|
|
126
130
|
else setOutcome(answer.sent ? { kind: "sent", backend } : { kind: "failed", backend });
|
|
127
131
|
} catch (error) {
|
|
@@ -131,7 +135,7 @@ export function MailTestCard({
|
|
|
131
135
|
}
|
|
132
136
|
};
|
|
133
137
|
|
|
134
|
-
const backend =
|
|
138
|
+
const backend = answered ?? mailBackend;
|
|
135
139
|
|
|
136
140
|
return (
|
|
137
141
|
<SettingsSection
|
|
@@ -266,6 +266,10 @@ export interface UserRosterColumnsOptions<T extends UserRosterRow, R extends str
|
|
|
266
266
|
extra?: readonly DataTableColumn<T>[];
|
|
267
267
|
/** The row's action menu (§4). Left out: no actions column. */
|
|
268
268
|
actions?: (row: T) => UserRowActionList;
|
|
269
|
+
/** The actions column's heading (0.46.1, keksdose dev#598 rework — a VISIBLE "Actions"
|
|
270
|
+
* on every table with an actions column). Default: `labels.actions`, shown. A node
|
|
271
|
+
* replaces it; `false` keeps the pre-0.46.1 heading, a screen reader's name only. */
|
|
272
|
+
actionsHeader?: ReactNode | false;
|
|
269
273
|
/**
|
|
270
274
|
* Whether this row's role is a select rather than a chip, and with which reasons.
|
|
271
275
|
* Left out, or `false`: a chip. kastlan's several roles are never a select here — they
|
|
@@ -344,6 +348,7 @@ export function userRosterColumns<T extends UserRosterRow, R extends string = st
|
|
|
344
348
|
stateOf = adminUserStates,
|
|
345
349
|
extra = [],
|
|
346
350
|
actions,
|
|
351
|
+
actionsHeader,
|
|
347
352
|
editableRole,
|
|
348
353
|
onRoleChange,
|
|
349
354
|
roleOf,
|
|
@@ -459,7 +464,9 @@ export function userRosterColumns<T extends UserRosterRow, R extends string = st
|
|
|
459
464
|
if (actions) {
|
|
460
465
|
columns.push({
|
|
461
466
|
key: "actions",
|
|
462
|
-
|
|
467
|
+
// On screen, as every actions column's heading is (0.46.1, keksdose dev#598 rework).
|
|
468
|
+
header:
|
|
469
|
+
actionsHeader === false ? <span className="sr-only">{labels.actions}</span> : (actionsHeader ?? labels.actions),
|
|
463
470
|
headerText: labels.actions,
|
|
464
471
|
// The caller's own words only: the menu reads the provider's itself, and the
|
|
465
472
|
// English defaults merged in above must not shadow them.
|
|
@@ -469,7 +476,7 @@ export function userRosterColumns<T extends UserRosterRow, R extends string = st
|
|
|
469
476
|
</RowName>
|
|
470
477
|
),
|
|
471
478
|
className: "w-px whitespace-nowrap text-end",
|
|
472
|
-
headClassName: "w-px",
|
|
479
|
+
headClassName: "w-px text-end",
|
|
473
480
|
// The menu button keeps its own click: a row link must not wrap it.
|
|
474
481
|
noRowLink: true,
|
|
475
482
|
});
|
|
@@ -487,6 +494,7 @@ export function useUserRosterColumns<T extends UserRosterRow, R extends string =
|
|
|
487
494
|
stateOf,
|
|
488
495
|
extra,
|
|
489
496
|
actions,
|
|
497
|
+
actionsHeader,
|
|
490
498
|
editableRole,
|
|
491
499
|
onRoleChange,
|
|
492
500
|
roleOf,
|
|
@@ -501,12 +509,13 @@ export function useUserRosterColumns<T extends UserRosterRow, R extends string =
|
|
|
501
509
|
stateOf,
|
|
502
510
|
extra,
|
|
503
511
|
actions,
|
|
512
|
+
actionsHeader,
|
|
504
513
|
editableRole,
|
|
505
514
|
onRoleChange,
|
|
506
515
|
roleOf,
|
|
507
516
|
emailColumn,
|
|
508
517
|
labels,
|
|
509
518
|
}),
|
|
510
|
-
[roles, stateOf, extra, actions, editableRole, onRoleChange, roleOf, emailColumn, labels],
|
|
519
|
+
[roles, stateOf, extra, actions, actionsHeader, editableRole, onRoleChange, roleOf, emailColumn, labels],
|
|
511
520
|
);
|
|
512
521
|
}
|
|
@@ -28,6 +28,16 @@ export interface AppearanceLabels {
|
|
|
28
28
|
* toast or the line under the setting (0.32.1, keksdose's 0.32 report).
|
|
29
29
|
*/
|
|
30
30
|
saveFailed: string;
|
|
31
|
+
/** The date-format setting's name (0.46, `DateFormatSetting`). */
|
|
32
|
+
dateFormat: string;
|
|
33
|
+
/** One line under it: the format is its own choice, apart from the language. */
|
|
34
|
+
dateFormatHelp: string;
|
|
35
|
+
/** Its first option, followed by that language's sample: "Follow language — 01 Aug 2026". */
|
|
36
|
+
dateFormatAuto: string;
|
|
37
|
+
/** `AccountMenuTextSize`'s A− button (0.46, keksdose live #426): one step smaller. */
|
|
38
|
+
textSmaller: string;
|
|
39
|
+
/** Its A+ button: one step larger. */
|
|
40
|
+
textLarger: string;
|
|
31
41
|
}
|
|
32
42
|
|
|
33
43
|
export const DEFAULT_APPEARANCE_LABELS: AppearanceLabels = {
|
|
@@ -38,6 +48,12 @@ export const DEFAULT_APPEARANCE_LABELS: AppearanceLabels = {
|
|
|
38
48
|
contrastHelp: "More contrast darkens quiet text and lines, and thickens focus frames. System follows this device.",
|
|
39
49
|
contrastModes: { system: "System", standard: "Standard", more: "More" },
|
|
40
50
|
saveFailed: "Couldn't save this to your account. It still applies on this device.",
|
|
51
|
+
dateFormat: "Date format",
|
|
52
|
+
dateFormatHelp:
|
|
53
|
+
"How dates are written throughout the app. Independent of the interface language, so you can read the app in English and still see German dates.",
|
|
54
|
+
dateFormatAuto: "Follow language",
|
|
55
|
+
textSmaller: "Smaller text",
|
|
56
|
+
textLarger: "Larger text",
|
|
41
57
|
};
|
|
42
58
|
|
|
43
59
|
/** The `appearance` namespace, resolved — English, then the provider, then `labels`. For
|
|
@@ -4,7 +4,7 @@ import { X } from "lucide-react";
|
|
|
4
4
|
import { cn } from "../lib/cn";
|
|
5
5
|
import { Tooltip } from "./tooltip";
|
|
6
6
|
import type { DataTableLabels } from "./data-table-labels";
|
|
7
|
-
import {
|
|
7
|
+
import { isTableOwnColumn } from "./data-table-row-actions";
|
|
8
8
|
import { columnLabel } from "./data-table-shared";
|
|
9
9
|
import type { DataTableColumn } from "./data-table";
|
|
10
10
|
|
|
@@ -101,7 +101,7 @@ export function ColumnSettingsPanel<T>({
|
|
|
101
101
|
</button>
|
|
102
102
|
<div className="flex flex-col gap-0.5">
|
|
103
103
|
{columns.map((col) => {
|
|
104
|
-
if (col.key
|
|
104
|
+
if (isTableOwnColumn(col.key)) return null;
|
|
105
105
|
const checked = !hiddenCols.has(col.key);
|
|
106
106
|
const headerLabel = columnLabel(col);
|
|
107
107
|
return (
|
|
@@ -8,7 +8,7 @@ import { FilterPopover } from "./data-table-filter-popover";
|
|
|
8
8
|
import { Popover } from "./popover";
|
|
9
9
|
import { Tooltip } from "./tooltip";
|
|
10
10
|
import type { DataTableLabels } from "./data-table-labels";
|
|
11
|
-
import {
|
|
11
|
+
import { isTableOwnColumn } from "./data-table-row-actions";
|
|
12
12
|
import { columnLabel, logicalAlign, splitCellProps } from "./data-table-shared";
|
|
13
13
|
import type { DataTableColumn, DataTableProps, FilterState } from "./data-table";
|
|
14
14
|
|
|
@@ -223,7 +223,7 @@ export function DataTableHead<T>({
|
|
|
223
223
|
</Popover>
|
|
224
224
|
)}
|
|
225
225
|
</div>
|
|
226
|
-
{resizable && col.key
|
|
226
|
+
{resizable && !isTableOwnColumn(col.key) && (
|
|
227
227
|
/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- a
|
|
228
228
|
pointer-only drag handle for a visual preference (column width); it is
|
|
229
229
|
deliberately not a tab stop, and no content or action depends on it. */
|