mn-angular-lib 2.0.59 → 2.0.61
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/fesm2022/mn-angular-lib-calendar.mjs +114 -6
- package/fesm2022/mn-angular-lib-calendar.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-tour.mjs +765 -0
- package/fesm2022/mn-angular-lib-tour.mjs.map +1 -0
- package/fesm2022/mn-angular-lib.mjs +1 -0
- package/package.json +5 -1
- package/tour/src/mn-tour/mn-tour-overlay.css +198 -0
- package/types/mn-angular-lib-calendar.d.ts +45 -3
- package/types/mn-angular-lib-tour.d.ts +320 -0
- package/types/mn-angular-lib.d.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mn-angular-lib-tour.mjs","names":[],"sources":["../../../projects/mn-angular-lib/tour/src/mn-tour/mn-tour.types.ts","../../../projects/mn-angular-lib/tour/src/mn-tour/mn-tour-geometry.ts","../../../projects/mn-angular-lib/tour/src/mn-tour/mn-tour-overlay.ts","../../../projects/mn-angular-lib/tour/src/mn-tour/mn-tour-overlay.html","../../../projects/mn-angular-lib/tour/src/mn-tour/mn-tour.service.ts"],"sourcesContent":["/**\n * One stop of a tour.\n *\n * The library knows nothing about routing, modules or storage: the caller passes texts that are\n * already translated, and uses {@link before} to get the page into the state the step needs\n * (navigate, switch a tab, open a drawer).\n */\nexport type MnTourStep = {\n /**\n * Value of the `data-tour` attribute on the element to highlight (`'nav-book'` highlights\n * `[data-tour=\"nav-book\"]`). Omit it for a centred card with the page dimmed, such as a\n * welcome or final card.\n */\n target?: string;\n /** Small line above the title (e.g. the tour name). */\n kicker?: string;\n /** The step's title. Also the card's accessible name. */\n title: string;\n /** Short explanation. Also the card's accessible description. */\n body: string;\n /**\n * Runs before the step is shown, after the previous step's {@link after}. Awaited, so it can\n * navigate and return once the router has settled; the tour then still waits for the target\n * to appear. A step with `before` is treated as a page change: the highlight fades out, jumps\n * and fades back in instead of gliding. A `before` that throws skips the step.\n */\n before?: () => void | Promise<void>;\n /**\n * Runs when the tour leaves this step, in either direction or because the tour ended (e.g. to\n * close a drawer that {@link before} opened). Awaited; a throw is ignored.\n */\n after?: () => void | Promise<void>;\n};\n\n/** The \"next tour\" block on a tour's final card. */\nexport type MnTourNextTour = {\n /** Heading of the block (e.g. \"Volgende rondleiding\"). */\n kicker?: string;\n /** Name of the next tour. */\n title: string;\n /** Secondary line, e.g. its length (\"7 stappen\"). */\n meta?: string;\n};\n\n/**\n * Every label the tour card renders. The library ships no strings of its own, so all of them\n * come from the caller, already translated.\n */\nexport type MnTourLabels = {\n /** The small text link at the top right that ends the tour (e.g. \"Overslaan\"). */\n skip: string;\n /** Back one step (e.g. \"Vorige\"). */\n previous: string;\n /** Forward one step (e.g. \"Volgende\"). */\n next: string;\n /** Primary button on the last step when there is no next tour (e.g. \"Klaar\"). */\n done: string;\n /** Secondary button on the last step when a next tour is offered (e.g. \"Sluiten\"). */\n close: string;\n /** Primary button on the last step when a next tour is offered (e.g. \"Start volgende\"). */\n startNext: string;\n /**\n * Screen-reader text for the progress dots, given the 1-based position and the number of\n * steps (e.g. `(n, total) => \\`Stap ${n} van ${total}\\``).\n */\n stepLabel: (step: number, total: number) => string;\n};\n\n/** What a tour is started with. */\nexport type MnTourOptions = {\n /** The stops, in order. */\n steps: readonly MnTourStep[];\n /** Every label the card renders. */\n labels: MnTourLabels;\n /** Optional block on the final card that offers the next tour. */\n nextTour?: MnTourNextTour;\n /** Index of the first step to show (default 0), e.g. to resume a tour. */\n startAt?: number;\n /** How long a step waits for its target to appear before it is skipped (default 4000 ms). */\n targetTimeoutMs?: number;\n /**\n * Called when a step is skipped because its target never appeared or its `before` threw, so\n * the app can log a stale marker.\n */\n onStepMissing?: (index: number, step: MnTourStep, reason: 'target-not-found' | 'before-failed') => void;\n};\n\n/**\n * How a tour ended. `step` is the 0-based index (into `steps`) of the step that was on screen.\n *\n * - `completed`: the last step's primary or secondary button, or Volgende when every later step\n * turned out missing (then `step` is the last step that was shown). `startNext` is true when\n * the user chose the next tour from the final card.\n * - `skipped`: the skip link, or Escape.\n * - `closed`: ended from outside through `MnTourRef.close()` (e.g. the user navigated away), or\n * by starting another tour or offer. `step` is -1 when no step had been shown yet, which also\n * happens when every step of the tour was missing: the user saw nothing, so there is nothing\n * to resume.\n */\nexport type MnTourOutcome =\n | { status: 'completed'; step: number; startNext: boolean }\n | { status: 'skipped'; step: number }\n | { status: 'closed'; step: number };\n\n/**\n * Where an offer card appears: `centred` with the page dimmed (the general tour's welcome\n * offer), or `corner`, bottom-right with the page left undimmed and usable (a module tour).\n */\nexport type MnTourOfferPlacement = 'centred' | 'corner';\n\n/** What an offer card is opened with. */\nexport type MnTourOfferOptions = {\n /** Where the card appears. */\n placement: MnTourOfferPlacement;\n /** Small line above the title. */\n kicker?: string;\n /** The offer's title (e.g. \"Rondleiding: wedstrijden organiseren\"). */\n title: string;\n /** Short explanation, e.g. the tour's length. */\n body: string;\n /** Button labels. */\n labels: {\n /** Declines the offer (e.g. \"Niet nu\"). */\n dismiss: string;\n /** Accepts it (e.g. \"Rondleiding starten\" / \"Start\"). */\n accept: string;\n };\n};\n\n/**\n * How an offer ended: `accepted` / `dismissed` by its buttons (Escape dismisses), or `closed`\n * from outside through `MnTourOfferRef.close()` without an answer.\n */\nexport type MnTourOfferOutcome = { status: 'accepted' } | { status: 'dismissed' } | { status: 'closed' };\n\n/**\n * The library's motion timings (ms). Exported so an app's own motion and tests can line up\n * with them. Under `prefers-reduced-motion` every one of them is skipped.\n */\nexport const MN_TOUR_MOTION = {\n /** The highlight and the card glide between two stops on the same page. */\n glideMs: 450,\n /** The highlight and the dim fade in after a page, tab or drawer change (ease-out). */\n fadeInMs: 450,\n /** The highlight and the dim fade out before a page change, and at the end. */\n fadeOutMs: 200,\n /** The card's content fades out, and the new content in, over this each. */\n contentFadeMs: 120,\n} as const;\n","/** A box in viewport coordinates (px), as `getBoundingClientRect()` reports it. */\nexport type MnTourBox = { top: number; left: number; width: number; height: number };\n\n/** A width and a height (px). */\nexport type MnTourSize = { width: number; height: number };\n\n/** Air (px) between the target's edge and the highlight's ring. */\nexport const TOUR_HOLE_PADDING = 6;\n/** Gap (px) between the highlight and a card placed beside it. */\nexport const TOUR_CARD_GAP = 14;\n/** Minimum distance (px) a card keeps from the viewport edge. */\nexport const TOUR_VIEWPORT_MARGIN = 16;\n\n/**\n * Grows a target's box by {@link TOUR_HOLE_PADDING} on every side, so the ring sits around the\n * element instead of on its edge.\n * @param rect The target's box.\n * @param pad Padding to add on every side.\n */\nexport function padBox(rect: MnTourBox, pad = TOUR_HOLE_PADDING): MnTourBox {\n return { top: rect.top - pad, left: rect.left - pad, width: rect.width + pad * 2, height: rect.height + pad * 2 };\n}\n\n/** Whether two boxes differ by more than half a pixel on any edge. */\nexport function boxChanged(a: MnTourBox | null, b: MnTourBox | null): boolean {\n if (!a || !b) return a !== b;\n return (\n Math.abs(a.top - b.top) > 0.5 ||\n Math.abs(a.left - b.left) > 0.5 ||\n Math.abs(a.width - b.width) > 0.5 ||\n Math.abs(a.height - b.height) > 0.5\n );\n}\n\n/** Clamps `value` into `[min, max]`, preferring `min` when the range is empty. */\nfunction clamp(value: number, min: number, max: number): number {\n return Math.max(min, Math.min(value, max));\n}\n\n/**\n * Where a card goes beside a highlight: to the right if it fits, else left, else below, else\n * above, else (nothing fits) below and clamped into the viewport. Along the other axis the card\n * is centred on the highlight and kept {@link TOUR_VIEWPORT_MARGIN} away from the edges.\n * @param hole The highlight's box.\n * @param card The card's rendered size, padding included.\n * @param viewport The viewport's size.\n * @returns The card's top-left corner, in viewport coordinates.\n */\nexport function placeBeside(hole: MnTourBox, card: MnTourSize, viewport: MnTourSize): { x: number; y: number } {\n const m = TOUR_VIEWPORT_MARGIN;\n const gap = TOUR_CARD_GAP;\n const maxX = viewport.width - card.width - m;\n const maxY = viewport.height - card.height - m;\n const centredY = clamp(hole.top + hole.height / 2 - card.height / 2, m, maxY);\n const centredX = clamp(hole.left + hole.width / 2 - card.width / 2, m, maxX);\n\n const right = hole.left + hole.width + gap;\n if (right + card.width + m <= viewport.width) return { x: right, y: centredY };\n\n const left = hole.left - gap - card.width;\n if (left >= m) return { x: left, y: centredY };\n\n const below = hole.top + hole.height + gap;\n if (below + card.height + m <= viewport.height) return { x: centredX, y: below };\n\n const above = hole.top - gap - card.height;\n if (above >= m) return { x: centredX, y: above };\n\n return { x: centredX, y: clamp(below, m, maxY) };\n}\n\n/** Whether an element takes up space on screen (not `display: none`, not zero-sized, not hidden). */\nfunction isRendered(el: HTMLElement): boolean {\n const rect = el.getBoundingClientRect();\n if (rect.width <= 0 || rect.height <= 0) return false;\n return getComputedStyle(el).visibility !== 'hidden';\n}\n\n/**\n * The first rendered element carrying `data-tour=\"<name>\"`, or null. A marker that exists in\n * the DOM but is not rendered (a collapsed drawer's copy of a nav item) does not count.\n * @param name The `data-tour` value.\n * @param root Where to search (default: the document).\n */\nexport function findTourTarget(name: string, root: ParentNode = document): HTMLElement | null {\n const selector = `[data-tour=\"${CSS.escape(name)}\"]`;\n for (const el of Array.from(root.querySelectorAll<HTMLElement>(selector))) {\n if (isRendered(el)) return el;\n }\n return null;\n}\n\n/** How often (ms) a waiting step re-checks its target besides reacting to DOM mutations. */\nconst TARGET_POLL_MS = 50;\n\n/**\n * Resolves with the step's target as soon as it is rendered, or with null after `timeoutMs`.\n * Reacts to DOM mutations and also polls, because an element can become rendered without a\n * mutation in its own subtree (a parent's transition ends, a stylesheet loads). Never waits a\n * fixed delay when the target is already there.\n * @param name The `data-tour` value.\n * @param timeoutMs How long to wait at most.\n * @param isCancelled Stops the wait early (resolving null) once this returns true.\n */\nexport function waitForTourTarget(\n name: string,\n timeoutMs: number,\n isCancelled: () => boolean = () => false,\n): Promise<HTMLElement | null> {\n const found = findTourTarget(name);\n if (found || timeoutMs <= 0) return Promise.resolve(found);\n\n return new Promise((resolve) => {\n let settled = false;\n const finish = (el: HTMLElement | null): void => {\n if (settled) return;\n settled = true;\n observer.disconnect();\n clearInterval(poll);\n clearTimeout(timeout);\n resolve(el);\n };\n const check = (): void => {\n if (isCancelled()) {\n finish(null);\n return;\n }\n const el = findTourTarget(name);\n if (el) finish(el);\n };\n const observer = new MutationObserver(check);\n observer.observe(document.documentElement, { childList: true, subtree: true, attributes: true });\n const poll = setInterval(check, TARGET_POLL_MS);\n const timeout = setTimeout(() => finish(findTourTarget(name)), timeoutMs);\n });\n}\n","import { Component, computed, ElementRef, output, signal, viewChild } from '@angular/core';\nimport { MnButton, MnButtonTypes } from 'mn-angular-lib/button';\nimport { MnTourBox, MnTourSize } from './mn-tour-geometry';\nimport { MnTourNextTour } from './mn-tour.types';\n\n/**\n * How the card is placed:\n * - `beside`: next to the highlighted target (desktop);\n * - `centred`: in the middle of the viewport (welcome and final cards, centred offers);\n * - `corner`: bottom-right, for an offer that leaves the page usable;\n * - `sheet`: a bottom sheet, below the `lg` breakpoint.\n */\nexport type MnTourCardVariant = 'beside' | 'centred' | 'corner' | 'sheet';\n\n/** Which dim is on screen: none, the whole page, or everything around the highlight. */\nexport type MnTourDim = 'none' | 'full' | 'hole';\n\n/** A button or link on the card the user pressed. The service decides what it means. */\nexport type MnTourCardAction = 'skip' | 'secondary' | 'primary';\n\n/** What the card shows. Every string is the caller's, already translated. */\nexport type MnTourCardView = {\n /** Small line above the title. */\n kicker?: string;\n /** The title; the card's accessible name. */\n title: string;\n /** The body; the card's accessible description. */\n body: string;\n /** Optional \"next tour\" block above the footer. */\n nextTour?: MnTourNextTour;\n /** Label of the small skip link top right; no link when absent. */\n skip?: string;\n /** Label of the secondary (outline) button; no button when absent. */\n secondary?: string;\n /** Label of the primary button. */\n primary: string;\n /** Progress dots; none when absent. `active` is 0-based. */\n progress?: { total: number; active: number; label: string };\n};\n\n/** Counter for unique element ids, so two overlays never share an `aria-labelledby` target. */\nlet nextOverlayId = 0;\n\n/**\n * The tour's on-screen layer: the dim, the highlight around the target and the step card.\n *\n * Rendered and driven by `MnTourService`, which writes these signals; the component itself\n * holds no tour logic and only reports which control was pressed through {@link action}. It is\n * created once per tour (or offer) and stays mounted between steps, so the card never re-enters:\n * only its content crossfades.\n *\n * Motion lives in the stylesheet and is switched by classes: `is-gliding` animates the\n * highlight's and the card's position, `is-visible` / `is-shown` fade them in (450 ms ease-out)\n * and their absence fades them out (200 ms). `reducedMotion` drops every transition.\n */\n@Component({\n selector: 'mn-tour-overlay',\n standalone: true,\n imports: [MnButton],\n templateUrl: './mn-tour-overlay.html',\n styleUrl: './mn-tour-overlay.css',\n})\nexport class MnTourOverlay {\n /** What the card shows; the card is not rendered while null. */\n readonly view = signal<MnTourCardView | null>(null);\n /** Whether the card's content is faded in. Toggled around a content swap. */\n readonly contentVisible = signal(false);\n /** Whether the card itself is faded in. */\n readonly cardVisible = signal(false);\n /** How the card is placed. */\n readonly variant = signal<MnTourCardVariant>('centred');\n /** Which dim is shown. Anything but `none` also blocks clicks on the page. */\n readonly dim = signal<MnTourDim>('none');\n /** The highlight's box (target plus padding), in viewport coordinates. */\n readonly hole = signal<MnTourBox | null>(null);\n /** Whether the highlight (and its dim) is faded in. */\n readonly holeVisible = signal(false);\n /** While true, a change of the highlight's or the card's position glides instead of jumping. */\n readonly gliding = signal(false);\n /** Top-left corner of a `beside` card, in viewport coordinates. */\n readonly cardPos = signal<{ x: number; y: number } | null>(null);\n /** Turns every transition and animation off. */\n readonly reducedMotion = signal(false);\n\n /** Emitted when the user presses the skip link or one of the buttons. */\n readonly action = output<MnTourCardAction>();\n\n /** Id of the title element, the dialog's accessible name. */\n protected readonly titleId = `mn-tour-title-${nextOverlayId}`;\n /** Id of the body element, the dialog's accessible description. */\n protected readonly bodyId = `mn-tour-body-${nextOverlayId++}`;\n\n /** The primary button's look: filled, never wrapping its label. */\n protected readonly primaryButton: Partial<MnButtonTypes> = {\n variant: 'fill',\n color: 'primary',\n size: 'sm',\n borderRadius: 'lg',\n wrap: false,\n hover: true,\n };\n /** The secondary button's look: gray outline (Vorige, Sluiten, Niet nu), never wrapping. */\n protected readonly secondaryButton: Partial<MnButtonTypes> = {\n variant: 'outline',\n color: 'gray',\n size: 'sm',\n borderRadius: 'lg',\n wrap: false,\n hover: true,\n };\n\n /** The `beside` card's position as a transform, so a glide animates on the compositor. */\n protected readonly cardTransform = computed(() => {\n const pos = this.cardPos();\n return this.variant() === 'beside' && pos ? `translate(${pos.x}px, ${pos.y}px)` : null;\n });\n\n /** The card element. */\n private readonly cardRef = viewChild<ElementRef<HTMLElement>>('card');\n\n /** The card's rendered size (padding and border included), or null while it is not rendered. */\n cardSize(): MnTourSize | null {\n const el = this.cardRef()?.nativeElement;\n return el ? { width: el.offsetWidth, height: el.offsetHeight } : null;\n }\n\n /** Moves focus into the card without scrolling the page. */\n focusCard(): void {\n this.cardRef()?.nativeElement.focus({ preventScroll: true });\n }\n\n /** Whether focus is currently inside the card. */\n hasFocus(): boolean {\n return this.contains(document.activeElement);\n }\n\n /** Whether `node` lies inside the card. */\n contains(node: Node | null): boolean {\n const el = this.cardRef()?.nativeElement;\n return !!el && !!node && el.contains(node);\n }\n\n /**\n * Keeps Tab inside the card: from its last focusable control to its first and back. Focus that\n * is outside the card (or on the card itself) goes to the first or last control.\n * @param event The Tab keydown.\n */\n trapTab(event: KeyboardEvent): void {\n const el = this.cardRef()?.nativeElement;\n if (!el) return;\n const focusable = Array.from(\n el.querySelectorAll<HTMLElement>('button:not([disabled]), a[href], [tabindex]:not([tabindex=\"-1\"])'),\n );\n if (focusable.length === 0) {\n event.preventDefault();\n el.focus({ preventScroll: true });\n return;\n }\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n const active = document.activeElement as HTMLElement | null;\n const inside = !!active && focusable.includes(active);\n if (event.shiftKey && (!inside || active === first)) {\n event.preventDefault();\n last.focus({ preventScroll: true });\n } else if (!event.shiftKey && (!inside || active === last)) {\n event.preventDefault();\n first.focus({ preventScroll: true });\n }\n }\n\n /** The dots to render: one entry per step, true for the active one. */\n protected dots(total: number, active: number): boolean[] {\n return Array.from({ length: total }, (_, i) => i === active);\n }\n}\n","<div\n [class.mn-tour-passive]=\"dim() === 'none'\"\n [class.mn-tour-reduced]=\"reducedMotion()\"\n class=\"mn-tour-root\"\n>\n @if (dim() !== 'none') {\n <!-- Catches clicks on the page while the tour runs; the dim itself is purely visual. -->\n <div aria-hidden=\"true\" class=\"mn-tour-blocker\"></div>\n }\n <div [class.is-visible]=\"dim() === 'full'\" aria-hidden=\"true\" class=\"mn-tour-dim\"></div>\n <div\n [class.is-gliding]=\"gliding()\"\n [class.is-visible]=\"dim() === 'hole' && holeVisible()\"\n [style.height.px]=\"hole()?.height ?? 0\"\n [style.left.px]=\"hole()?.left ?? 0\"\n [style.top.px]=\"hole()?.top ?? 0\"\n [style.width.px]=\"hole()?.width ?? 0\"\n aria-hidden=\"true\"\n class=\"mn-tour-hole\"\n ></div>\n\n @if (view(); as v) {\n <div\n #card\n [attr.aria-describedby]=\"bodyId\"\n [attr.aria-labelledby]=\"titleId\"\n [attr.aria-modal]=\"dim() === 'none' ? null : 'true'\"\n [class.is-gliding]=\"gliding()\"\n [class.is-shown]=\"cardVisible()\"\n [class.mn-tour-card--beside]=\"variant() === 'beside'\"\n [class.mn-tour-card--centred]=\"variant() === 'centred'\"\n [class.mn-tour-card--corner]=\"variant() === 'corner'\"\n [class.mn-tour-card--sheet]=\"variant() === 'sheet'\"\n [style.transform]=\"cardTransform()\"\n class=\"mn-tour-card text-base-content\"\n role=\"dialog\"\n tabindex=\"-1\"\n >\n <div [class.is-visible]=\"contentVisible()\" aria-live=\"polite\" class=\"mn-tour-content\">\n <div class=\"flex items-start gap-4\">\n <div class=\"min-w-0 flex-1 text-left\">\n @if (v.kicker) {\n <p class=\"text-xs font-medium text-base-content/60\">{{ v.kicker }}</p>\n }\n <h2 [id]=\"titleId\" class=\"mt-0.5 text-base font-semibold leading-snug\">{{ v.title }}</h2>\n </div>\n @if (v.skip) {\n <button\n (click)=\"action.emit('skip')\"\n class=\"mn-tour-skip shrink-0 whitespace-nowrap rounded text-sm text-base-content/60 hover:text-base-content hover:underline underline-offset-2 cursor-pointer\"\n type=\"button\"\n >{{ v.skip }}</button>\n }\n </div>\n\n <p [id]=\"bodyId\" class=\"mt-1.5 text-left text-sm leading-relaxed text-base-content/80\">{{ v.body }}</p>\n\n @if (v.nextTour; as next) {\n <div class=\"mn-tour-next mt-4 rounded-xl bg-primary/10 px-3.5 py-3 text-left\">\n @if (next.kicker) {\n <p class=\"text-xs font-medium text-primary\">{{ next.kicker }}</p>\n }\n <p class=\"text-sm font-semibold\">{{ next.title }}</p>\n @if (next.meta) {\n <p class=\"text-xs text-base-content/60\">{{ next.meta }}</p>\n }\n </div>\n }\n\n <div class=\"mn-tour-footer mt-5 flex items-center gap-3\">\n @if (v.progress; as p) {\n <div aria-hidden=\"true\" class=\"mn-tour-dots flex shrink-0 items-center gap-1.5\">\n @for (active of dots(p.total, p.active); track $index) {\n <span [class.is-active]=\"active\" class=\"mn-tour-dot\"></span>\n }\n </div>\n <span class=\"sr-only\">{{ p.label }}</span>\n }\n <div class=\"mn-tour-actions ml-auto flex items-center gap-2\">\n @if (v.secondary) {\n <button\n (click)=\"action.emit('secondary')\"\n [data]=\"secondaryButton\"\n class=\"mn-tour-secondary\"\n mnButton\n type=\"button\"\n >{{ v.secondary }}</button>\n }\n <button\n (click)=\"action.emit('primary')\"\n [data]=\"primaryButton\"\n class=\"mn-tour-primary\"\n mnButton\n type=\"button\"\n >{{ v.primary }}</button>\n </div>\n </div>\n </div>\n </div>\n }\n</div>\n","import {\n ApplicationRef,\n ComponentRef,\n createComponent,\n EnvironmentInjector,\n inject,\n Injectable,\n OnDestroy,\n signal,\n Signal,\n WritableSignal,\n} from '@angular/core';\nimport { boxChanged, padBox, placeBeside, waitForTourTarget } from './mn-tour-geometry';\nimport { MnTourCardAction, MnTourCardVariant, MnTourCardView, MnTourOverlay } from './mn-tour-overlay';\nimport {\n MN_TOUR_MOTION,\n MnTourOfferOptions,\n MnTourOfferOutcome,\n MnTourOptions,\n MnTourOutcome,\n} from './mn-tour.types';\n\n/** Below this width (px) the card is a bottom sheet: Tailwind's `lg` breakpoint, exclusive. */\nconst COMPACT_MAX_WIDTH = 1023.98;\n/** How long a step waits for its target by default (ms). */\nconst DEFAULT_TARGET_TIMEOUT_MS = 4000;\n/** Space (px) a scrolled-to target keeps from the viewport's edges (and from the sheet). */\nconst SCROLL_MARGIN = 16;\n\n/** A running tour, as returned by {@link MnTourService.start}. */\nexport class MnTourRef {\n /**\n * @param result Settles once, with how the tour ended.\n * @param step The 0-based index of the step on screen (-1 before the first one shows). Read it\n * synchronously to persist \"the last step reached\" when the page unloads mid-tour.\n * @param closeFn Ends the tour from outside.\n */\n constructor(\n readonly result: Promise<MnTourOutcome>,\n readonly step: Signal<number>,\n private readonly closeFn: () => void,\n ) {}\n\n /** Ends the tour without an answer from the user (outcome `closed`). Idempotent. */\n close(): void {\n this.closeFn();\n }\n}\n\n/** An open offer card, as returned by {@link MnTourService.offer}. */\nexport class MnTourOfferRef {\n /**\n * @param result Settles once, with the user's answer.\n * @param closeFn Removes the card without an answer.\n */\n constructor(\n readonly result: Promise<MnTourOfferOutcome>,\n private readonly closeFn: () => void,\n ) {}\n\n /** Removes the card without an answer (outcome `closed`). Idempotent. */\n close(): void {\n this.closeFn();\n }\n}\n\n/** State of a tour while it runs. */\ntype TourSession = {\n /** Discriminates the session union. */\n kind: 'tour';\n /** What the tour was started with. */\n options: MnTourOptions;\n /** Index of the step on screen, -1 before the first. */\n index: WritableSignal<number>;\n /** Step whose `after` still has to run, or -1. */\n pendingAfter: number;\n /** Steps found missing, left out of the dots and skipped by Vorige. */\n missing: Set<number>;\n /** The highlighted element, null on a centred step. */\n target: HTMLElement | null;\n /** True while a step change is in flight; input is ignored meanwhile. */\n busy: boolean;\n /** True once the outcome is decided. */\n ended: boolean;\n /** Settles the ref's `result`. */\n resolve: (outcome: MnTourOutcome) => void;\n};\n\n/** State of an offer while it is open. */\ntype OfferSession = {\n /** Discriminates the session union. */\n kind: 'offer';\n /** What the offer was opened with. */\n options: MnTourOfferOptions;\n /** True once answered or closed. */\n ended: boolean;\n /** Settles the ref's `result`. */\n resolve: (outcome: MnTourOfferOutcome) => void;\n};\n\n/**\n * Runs guided tours: a highlight around `[data-tour=\"…\"]` elements and a card that walks the user\n * through them, plus the offer card that proposes a tour.\n *\n * The service knows nothing about routing, modules or storage. The caller passes translated\n * texts, moves the app between steps with each step's `before()`, and persists what the returned\n * outcome reports. One tour or offer is on screen at a time; starting another closes the current\n * one. Starting a tour straight from an accepted offer (or from a final card's \"Start volgende\")\n * reuses the card already on screen instead of removing and re-adding it.\n *\n * Motion (D10): between two targets on the same page the highlight and the card glide (450 ms).\n * A step with `before()`, a step after a centred card and a step after a missing one fade the\n * highlight out (200 ms), jump, and fade in (450 ms, ease-out). The card's content crossfades\n * (120 ms out, 120 ms in). Under `prefers-reduced-motion` there is no glide and no fade.\n *\n * Keyboard: Escape skips (on an offer: declines), ArrowRight and Enter go forward, ArrowLeft goes\n * back. Focus moves into the card and returns where it was when the tour ends. The corner offer\n * is the exception: it does not take focus, because it appears unasked on a page the user is\n * working on; it is still reachable with Tab, and Escape works once focus is inside it.\n */\n@Injectable({ providedIn: 'root' })\nexport class MnTourService implements OnDestroy {\n private readonly appRef = inject(ApplicationRef);\n private readonly injector = inject(EnvironmentInjector);\n\n /** The mounted overlay, or null. */\n private overlayRef: ComponentRef<MnTourOverlay> | null = null;\n /** The tour or offer on screen, or null. */\n private session: TourSession | OfferSession | null = null;\n /** Pending fade-out or removal of the overlay. */\n private teardownTimer: ReturnType<typeof setTimeout> | null = null;\n /** Where focus was before the overlay appeared, restored when it goes. */\n private returnFocus: HTMLElement | null = null;\n /** Undoes the listeners that keep the highlight on its target. */\n private stopTrackingFn: (() => void) | null = null;\n /** Document keydown listener, registered only while the overlay exists. */\n private readonly onKeyDown = (event: KeyboardEvent): void => this.handleKey(event);\n /** Window resize listener, registered only while the overlay exists. */\n private readonly onResize = (): void => this.reposition();\n\n /**\n * Starts a tour. A tour or offer already on screen is closed first (its outcome `closed`).\n * @param options The steps, labels and optional next-tour block.\n * @returns A ref whose `result` settles with how the tour ended.\n */\n start(options: MnTourOptions): MnTourRef {\n this.closeCurrent();\n let resolve!: (outcome: MnTourOutcome) => void;\n const result = new Promise<MnTourOutcome>((r) => (resolve = r));\n const index = signal(-1);\n const session: TourSession = {\n kind: 'tour',\n options,\n index,\n pendingAfter: -1,\n missing: new Set(),\n target: null,\n busy: false,\n ended: false,\n resolve,\n };\n const ref = new MnTourRef(result, index.asReadonly(), () => {\n void this.endTour(session, { status: 'closed', step: session.index() });\n });\n\n if (options.steps.length === 0) {\n session.ended = true;\n resolve({ status: 'completed', step: -1, startNext: false });\n return ref;\n }\n\n this.session = session;\n this.ensureOverlay();\n const first = Math.min(Math.max(options.startAt ?? 0, 0), options.steps.length - 1);\n void this.go(session, first, 1);\n return ref;\n }\n\n /**\n * Shows an offer card. A tour or offer already on screen is closed first.\n * @param options Placement, texts and button labels.\n * @returns A ref whose `result` settles with the user's answer.\n */\n offer(options: MnTourOfferOptions): MnTourOfferRef {\n this.closeCurrent();\n let resolve!: (outcome: MnTourOfferOutcome) => void;\n const result = new Promise<MnTourOfferOutcome>((r) => (resolve = r));\n const session: OfferSession = { kind: 'offer', options, ended: false, resolve };\n this.session = session;\n\n const ov = this.ensureOverlay();\n const corner = options.placement === 'corner';\n ov.variant.set(this.offerVariant(options));\n ov.view.set({\n kicker: options.kicker,\n title: options.title,\n body: options.body,\n secondary: options.labels.dismiss,\n primary: options.labels.accept,\n });\n ov.dim.set(corner ? 'none' : 'full');\n ov.holeVisible.set(false);\n ov.gliding.set(false);\n ov.cardPos.set(null);\n ov.cardVisible.set(true);\n ov.contentVisible.set(true);\n this.render();\n if (!corner) ov.focusCard();\n\n return new MnTourOfferRef(result, () => this.answerOffer(session, { status: 'closed' }));\n }\n\n /** Whether a tour or an offer is on screen. */\n isActive(): boolean {\n return this.session !== null;\n }\n\n /**\n * Whether the viewport is below `lg`, where the card is a bottom sheet. Public so a test (or\n * an app with its own breakpoint logic) can override it.\n */\n isCompactViewport(): boolean {\n return typeof window !== 'undefined' && typeof window.matchMedia === 'function'\n ? window.matchMedia(`(max-width: ${COMPACT_MAX_WIDTH}px)`).matches\n : false;\n }\n\n /** Whether the user asked for reduced motion. Public so a test can override it. */\n prefersReducedMotion(): boolean {\n return (\n typeof window !== 'undefined' &&\n typeof window.matchMedia === 'function' &&\n window.matchMedia('(prefers-reduced-motion: reduce)').matches\n );\n }\n\n /** Removes the overlay if the service itself is destroyed (an app or test teardown). */\n ngOnDestroy(): void {\n this.closeCurrent();\n this.destroyOverlay();\n }\n\n /** Steps through the tour: from the current step to `to`, skipping missing steps in `dir`. */\n private async go(s: TourSession, to: number, dir: 1 | -1): Promise<void> {\n if (s.busy || s.ended) return;\n s.busy = true;\n try {\n await this.advance(s, to, dir, true);\n } finally {\n s.busy = false;\n }\n }\n\n /**\n * {@link go} without the re-entrance guard.\n * @param allowFallback When going back finds nothing, re-show the current step once.\n */\n private async advance(s: TourSession, to: number, dir: 1 | -1, allowFallback: boolean): Promise<void> {\n const steps = s.options.steps;\n const ov = this.overlay();\n const from = s.index();\n const holeWasVisible = ov.dim() === 'hole' && ov.holeVisible();\n let left = false;\n let i = to;\n\n while (i >= 0 && i < steps.length) {\n const step = steps[i];\n const glide = holeWasVisible && !left && !!step.target && !step.before;\n\n if (!left) {\n left = true;\n this.stopTracking();\n ov.contentVisible.set(false);\n if (glide) await this.wait(MN_TOUR_MOTION.contentFadeMs);\n else await this.fadeOut();\n await this.runAfter(s);\n } else {\n await this.fadeOut();\n }\n if (s.ended) return;\n\n // From here on this step owns the page state its `before` sets up, so its `after` runs\n // even if the step turns out missing or the tour ends while it is still being prepared.\n s.pendingAfter = i;\n if (step.before) {\n try {\n await step.before();\n } catch {\n this.markMissing(s, i, 'before-failed');\n await this.runAfter(s);\n i += dir;\n continue;\n }\n if (s.ended) return;\n }\n\n let target: HTMLElement | null = null;\n if (step.target) {\n target = await waitForTourTarget(\n step.target,\n s.options.targetTimeoutMs ?? DEFAULT_TARGET_TIMEOUT_MS,\n () => s.ended,\n );\n if (s.ended) return;\n if (!target) {\n this.markMissing(s, i, 'target-not-found');\n await this.runAfter(s);\n i += dir;\n continue;\n }\n }\n\n await this.present(s, i, target, glide && i === to);\n return;\n }\n\n // Ran off an end. Back means nothing earlier exists: show the step we came from (or the\n // next one that does) again. Forward means nothing is left to show: the tour is over.\n if (dir === -1 && from >= 0 && allowFallback) {\n return this.advance(s, from, 1, false);\n }\n await this.endTour(\n s,\n s.index() >= 0 ? { status: 'completed', step: s.index(), startNext: false } : { status: 'closed', step: -1 },\n );\n }\n\n /** Puts step `i` on screen: content, highlight, card position, focus and tracking. */\n private async present(s: TourSession, i: number, target: HTMLElement | null, glide: boolean): Promise<void> {\n const ov = this.overlay();\n const reduced = this.prefersReducedMotion();\n s.index.set(i);\n s.pendingAfter = i;\n s.target = target;\n\n const variant = this.stepVariant(target);\n ov.reducedMotion.set(reduced);\n ov.variant.set(variant);\n ov.view.set(this.stepView(s, i));\n ov.dim.set(target ? 'hole' : 'full');\n this.render();\n\n if (target) this.scrollIntoView(target, variant === 'sheet');\n ov.gliding.set(glide && !reduced);\n this.place(target);\n ov.holeVisible.set(!!target);\n ov.cardVisible.set(true);\n ov.contentVisible.set(true);\n this.render();\n\n if (!ov.hasFocus()) ov.focusCard();\n this.startTracking(target);\n\n if (glide && !reduced) {\n await this.wait(MN_TOUR_MOTION.glideMs);\n if (this.session === s) ov.gliding.set(false);\n }\n }\n\n /** Sets the highlight's box and, beside a target, the card's position. */\n private place(target: HTMLElement | null): void {\n const ov = this.overlay();\n if (target) ov.hole.set(padBox(target.getBoundingClientRect()));\n const hole = ov.hole();\n const size = ov.cardSize();\n if (ov.variant() === 'beside' && hole && size) {\n ov.cardPos.set(placeBeside(hole, size, { width: window.innerWidth, height: window.innerHeight }));\n } else {\n ov.cardPos.set(null);\n }\n }\n\n /**\n * Fades the highlight and the dim out (200 ms), and the card too unless it is a bottom sheet,\n * which stays put. Returns at once when nothing was visible.\n */\n private async fadeOut(): Promise<void> {\n const ov = this.overlay();\n const holeVisible = ov.dim() === 'hole' && ov.holeVisible();\n const dimVisible = ov.dim() === 'full';\n const fadeCard = ov.cardVisible() && ov.variant() !== 'sheet';\n if (!holeVisible && !dimVisible && !fadeCard) return;\n ov.gliding.set(false);\n ov.holeVisible.set(false);\n if (dimVisible) ov.dim.set('hole');\n if (fadeCard) ov.cardVisible.set(false);\n await this.wait(MN_TOUR_MOTION.fadeOutMs);\n }\n\n /** Ends a tour once: runs the current step's `after`, settles the result, removes the overlay. */\n private async endTour(s: TourSession, outcome: MnTourOutcome): Promise<void> {\n if (s.ended) return;\n s.ended = true;\n if (this.session === s) {\n this.session = null;\n this.stopTracking();\n }\n await this.runAfter(s);\n s.resolve(outcome);\n this.scheduleTeardown();\n }\n\n /** Settles an offer once and removes the overlay unless a tour takes it over. */\n private answerOffer(s: OfferSession, outcome: MnTourOfferOutcome): void {\n if (s.ended) return;\n s.ended = true;\n if (this.session === s) this.session = null;\n s.resolve(outcome);\n this.scheduleTeardown();\n }\n\n /** Closes whatever is on screen, without an answer. */\n private closeCurrent(): void {\n const s = this.session;\n if (!s) return;\n if (s.kind === 'tour') void this.endTour(s, { status: 'closed', step: s.index() });\n else this.answerOffer(s, { status: 'closed' });\n }\n\n /** Runs the `after` of the step that was last shown, once. A throw is ignored. */\n private async runAfter(s: TourSession): Promise<void> {\n const i = s.pendingAfter;\n s.pendingAfter = -1;\n const after = i >= 0 ? s.options.steps[i].after : undefined;\n if (!after) return;\n try {\n await after();\n } catch {\n // A failing clean-up must not strand the user inside the tour.\n }\n }\n\n /** Records a step as missing and tells the caller. */\n private markMissing(s: TourSession, i: number, reason: 'target-not-found' | 'before-failed'): void {\n s.missing.add(i);\n s.options.onStepMissing?.(i, s.options.steps[i], reason);\n }\n\n /** Reacts to the card's controls. */\n private onAction(action: MnTourCardAction): void {\n const s = this.session;\n if (!s) return;\n if (s.kind === 'offer') {\n if (action === 'primary') this.answerOffer(s, { status: 'accepted' });\n else if (action === 'secondary') this.answerOffer(s, { status: 'dismissed' });\n return;\n }\n const i = s.index();\n if (i < 0) return;\n if (action === 'skip') {\n void this.endTour(s, { status: 'skipped', step: i });\n return;\n }\n if (s.busy) return;\n const last = this.isLastStep(s, i);\n if (action === 'primary') {\n if (last) void this.endTour(s, { status: 'completed', step: i, startNext: !!s.options.nextTour });\n else void this.go(s, i + 1, 1);\n } else if (last && s.options.nextTour) {\n void this.endTour(s, { status: 'completed', step: i, startNext: false });\n } else if (this.hasPrevious(s, i)) {\n void this.go(s, i - 1, -1);\n }\n }\n\n /** Keyboard: Escape skips/declines, ArrowRight/Enter forward, ArrowLeft back. */\n private handleKey(event: KeyboardEvent): void {\n const s = this.session;\n const ov = this.overlayRef?.instance;\n if (!s || !ov || event.defaultPrevented || event.isComposing) return;\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n\n // A dimmed card is modal: Tab cycles inside it instead of reaching the page behind the\n // blocker, where a focused link would navigate away mid-tour. The corner offer is not modal.\n if (event.key === 'Tab') {\n if (ov.dim() !== 'none') ov.trapTab(event);\n return;\n }\n\n if (s.kind === 'offer') {\n const inScope = s.options.placement === 'centred' || ov.hasFocus();\n if (event.key === 'Escape' && inScope) {\n event.preventDefault();\n this.answerOffer(s, { status: 'dismissed' });\n }\n return;\n }\n\n if (event.key === 'Escape') {\n event.preventDefault();\n this.onAction('skip');\n } else if (event.key === 'ArrowRight') {\n event.preventDefault();\n this.onAction('primary');\n } else if (event.key === 'ArrowLeft') {\n event.preventDefault();\n // On a final card with a next tour the secondary button is Sluiten, not Vorige.\n if (!(this.isLastStep(s, s.index()) && s.options.nextTour)) this.onAction('secondary');\n } else if (event.key === 'Enter') {\n // A focused button already turns Enter into its own click; handling it here too would\n // advance twice.\n const el = event.target as HTMLElement | null;\n if (el?.closest?.('button, a, input, textarea, select')) return;\n event.preventDefault();\n this.onAction('primary');\n }\n }\n\n /** Whether step `i` is the last one. */\n private isLastStep(s: TourSession, i: number): boolean {\n return i === s.options.steps.length - 1;\n }\n\n /** Whether there is an earlier step not known to be missing. */\n private hasPrevious(s: TourSession, i: number): boolean {\n for (let j = i - 1; j >= 0; j--) if (!s.missing.has(j)) return true;\n return false;\n }\n\n /** The card's content for step `i`. */\n private stepView(s: TourSession, i: number): MnTourCardView {\n const { steps, labels, nextTour } = s.options;\n const step = steps[i];\n const last = this.isLastStep(s, i);\n const total = steps.length - s.missing.size;\n let active = i;\n for (const m of s.missing) if (m < i) active--;\n const withNext = last && !!nextTour;\n return {\n kicker: step.kicker,\n title: step.title,\n body: step.body,\n nextTour: withNext ? nextTour : undefined,\n skip: last ? undefined : labels.skip,\n secondary: withNext ? labels.close : this.hasPrevious(s, i) ? labels.previous : undefined,\n primary: withNext ? labels.startNext : last ? labels.done : labels.next,\n progress: total > 1 ? { total, active, label: labels.stepLabel(active + 1, total) } : undefined,\n };\n }\n\n /** Where a step's card goes at the current viewport width. */\n private stepVariant(target: HTMLElement | null): MnTourCardVariant {\n if (this.isCompactViewport()) return 'sheet';\n return target ? 'beside' : 'centred';\n }\n\n /** Where an offer's card goes at the current viewport width. */\n private offerVariant(options: MnTourOfferOptions): MnTourCardVariant {\n if (options.placement === 'corner') return 'corner';\n return this.isCompactViewport() ? 'sheet' : 'centred';\n }\n\n /**\n * Scrolls the target into view if it is not fully visible: centred on desktop, and clear of\n * the sheet on a phone (a temporary `scroll-margin` makes the browser leave room for it).\n */\n private scrollIntoView(target: HTMLElement, sheet: boolean): void {\n const bottomReserve = SCROLL_MARGIN + (sheet ? (this.overlay().cardSize()?.height ?? 0) : 0);\n const rect = target.getBoundingClientRect();\n if (rect.top >= SCROLL_MARGIN && rect.bottom <= window.innerHeight - bottomReserve) return;\n const { scrollMarginTop, scrollMarginBottom } = target.style;\n target.style.scrollMarginTop = `${SCROLL_MARGIN}px`;\n target.style.scrollMarginBottom = `${bottomReserve}px`;\n // 'instant', not 'auto': 'auto' follows a page's `scroll-behavior: smooth`, and the highlight\n // would then be measured mid-scroll and chase its target while fading in.\n target.scrollIntoView({ block: sheet ? 'nearest' : 'center', inline: 'nearest', behavior: 'instant' });\n target.style.scrollMarginTop = scrollMarginTop;\n target.style.scrollMarginBottom = scrollMarginBottom;\n }\n\n /**\n * Keeps the highlight on its target while the page scrolls or the target reflows. Scroll is\n * listened for on the document in the capture phase: the app's scroll container is usually a\n * layout element, whose scroll events never reach `window`.\n */\n private startTracking(target: HTMLElement | null): void {\n this.stopTracking();\n if (!target) return;\n let frame = 0;\n const update = (): void => {\n if (frame) return;\n frame = requestAnimationFrame(() => {\n frame = 0;\n this.reposition();\n });\n };\n document.addEventListener('scroll', update, { capture: true, passive: true });\n const observer = typeof ResizeObserver === 'function' ? new ResizeObserver(update) : null;\n observer?.observe(target);\n this.stopTrackingFn = () => {\n document.removeEventListener('scroll', update, { capture: true });\n observer?.disconnect();\n if (frame) cancelAnimationFrame(frame);\n };\n }\n\n /** Undoes {@link startTracking}. */\n private stopTracking(): void {\n this.stopTrackingFn?.();\n this.stopTrackingFn = null;\n }\n\n /**\n * Re-measures after a scroll, a resize or a reflow: the card's variant (the viewport may have\n * crossed `lg`), the highlight and the card's position. A change during a glide retargets it;\n * otherwise it is instant, so the ring never lags behind the page.\n */\n private reposition(): void {\n const s = this.session;\n const ov = this.overlayRef?.instance;\n if (!s || !ov) return;\n if (s.kind === 'offer') {\n ov.variant.set(this.offerVariant(s.options));\n return;\n }\n if (s.busy && !ov.gliding()) return;\n const target = s.target;\n if (target && !target.isConnected) {\n // The page changed under the tour (e.g. browser back): hide the ring rather than point\n // at nothing. Whether to close the tour is the app's call.\n ov.holeVisible.set(false);\n return;\n }\n const variant = this.stepVariant(target);\n const moved = !target || boxChanged(ov.hole(), padBox(target.getBoundingClientRect()));\n if (variant === ov.variant() && !moved && variant !== 'beside') return;\n ov.variant.set(variant);\n this.render();\n this.place(target);\n }\n\n /** The overlay, created and attached on first use; a pending teardown is cancelled. */\n private ensureOverlay(): MnTourOverlay {\n if (this.teardownTimer) {\n clearTimeout(this.teardownTimer);\n this.teardownTimer = null;\n }\n if (this.overlayRef) return this.overlayRef.instance;\n\n const active = document.activeElement;\n this.returnFocus = active instanceof HTMLElement && active !== document.body ? active : null;\n\n const ref = createComponent(MnTourOverlay, { environmentInjector: this.injector });\n ref.instance.reducedMotion.set(this.prefersReducedMotion());\n ref.instance.action.subscribe((action) => this.onAction(action));\n this.appRef.attachView(ref.hostView);\n document.body.appendChild(ref.location.nativeElement);\n document.addEventListener('keydown', this.onKeyDown, true);\n window.addEventListener('resize', this.onResize);\n this.overlayRef = ref;\n return ref.instance;\n }\n\n /** The overlay, recreated if a teardown raced ahead of a late step. */\n private overlay(): MnTourOverlay {\n return this.overlayRef?.instance ?? this.ensureOverlay();\n }\n\n /**\n * Removes the overlay after a session ends, unless another one starts first: after a macrotask\n * (so a tour started from an accepted offer's `then` keeps the card), fade out, then destroy.\n */\n private scheduleTeardown(): void {\n if (this.teardownTimer) clearTimeout(this.teardownTimer);\n this.teardownTimer = setTimeout(() => {\n this.teardownTimer = null;\n const ov = this.overlayRef?.instance;\n if (this.session || !ov) return;\n ov.gliding.set(false);\n ov.contentVisible.set(false);\n ov.holeVisible.set(false);\n ov.cardVisible.set(false);\n if (ov.dim() === 'full') ov.dim.set('hole');\n const delay = this.prefersReducedMotion() ? 0 : MN_TOUR_MOTION.fadeOutMs;\n this.teardownTimer = setTimeout(() => {\n this.teardownTimer = null;\n if (!this.session) this.destroyOverlay();\n }, delay);\n });\n }\n\n /** Detaches and destroys the overlay, drops the listeners and gives focus back. */\n private destroyOverlay(): void {\n if (this.teardownTimer) {\n clearTimeout(this.teardownTimer);\n this.teardownTimer = null;\n }\n this.stopTracking();\n const ref = this.overlayRef;\n if (!ref) return;\n const hadFocus = ref.instance.hasFocus();\n this.overlayRef = null;\n document.removeEventListener('keydown', this.onKeyDown, true);\n window.removeEventListener('resize', this.onResize);\n this.appRef.detachView(ref.hostView);\n ref.destroy();\n ref.location.nativeElement.remove();\n const back = this.returnFocus;\n this.returnFocus = null;\n if (back?.isConnected && (hadFocus || document.activeElement === document.body)) {\n back.focus({ preventScroll: true });\n }\n }\n\n /** Synchronously renders the overlay, so it can be measured right after a state change. */\n private render(): void {\n this.overlayRef?.changeDetectorRef.detectChanges();\n }\n\n /** Waits `ms`, or not at all under reduced motion. */\n private wait(ms: number): Promise<void> {\n if (ms <= 0 || this.prefersReducedMotion()) return Promise.resolve();\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n}\n"],"mappings":";;;AA2IA,MAAa,iBAAiB;CAE5B,SAAS;CAET,UAAU;CAEV,WAAW;CAEX,eAAe;AACP;ACjIV,SAAgB,OAAO,MAAiB,MAAA,GAAuB;CAC7D,OAAO;EAAE,KAAK,KAAK,MAAM;EAAK,MAAM,KAAK,OAAO;EAAK,OAAO,KAAK,QAAQ,MAAM;EAAG,QAAQ,KAAK,SAAS,MAAM;CAAC;AACjH;AAGA,SAAgB,WAAW,GAAqB,GAAmB;CACjE,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO,MAAM;CAC3B,OACE,KAAK,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,MAC1B,KAAK,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,MAC5B,KAAK,IAAI,EAAE,QAAQ,EAAE,KAAK,IAAI,MAC9B,KAAK,IAAI,EAAE,SAAS,EAAE,MAAM,IAAI;AAEpC;AAGA,SAAS,MAAM,OAAe,KAAa,KAAW;CACpD,OAAO,KAAK,IAAI,KAAK,KAAK,IAAI,OAAO,GAAG,CAAC;AAC3C;AAWA,SAAgB,YAAY,MAAiB,MAAkB,UAAoB;CACjF,MAAM,IAAA;CACN,MAAM,MAAA;CACN,MAAM,OAAO,SAAS,QAAQ,KAAK,QAAQ;CAC3C,MAAM,OAAO,SAAS,SAAS,KAAK,SAAS;CAC7C,MAAM,WAAW,MAAM,KAAK,MAAM,KAAK,SAAS,IAAI,KAAK,SAAS,GAAG,GAAG,I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AAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAb,OAAA,QAAA,GAAA,sBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAa,YADA;CAAM,CAAA;;AACnB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAa,YAAA,CAAA;EADzB,MAAA;EAAW,MAAA,CAAA,EAAE,YAAY,OAAM,CAAE"}
|
|
@@ -7,6 +7,7 @@ export * from "mn-angular-lib/forms";
|
|
|
7
7
|
export * from "mn-angular-lib/collection";
|
|
8
8
|
export * from "mn-angular-lib/tab";
|
|
9
9
|
export * from "mn-angular-lib/segmented";
|
|
10
|
+
export * from "mn-angular-lib/tour";
|
|
10
11
|
export * from "mn-angular-lib/rich-text-editor";
|
|
11
12
|
export * from "mn-angular-lib/display";
|
|
12
13
|
export * from "mn-angular-lib/calendar-core";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mn-angular-lib",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.61",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^22.1.7",
|
|
6
6
|
"@angular/core": "^22.1.7",
|
|
@@ -99,6 +99,10 @@
|
|
|
99
99
|
"./tab": {
|
|
100
100
|
"types": "./types/mn-angular-lib-tab.d.ts",
|
|
101
101
|
"default": "./fesm2022/mn-angular-lib-tab.mjs"
|
|
102
|
+
},
|
|
103
|
+
"./tour": {
|
|
104
|
+
"types": "./types/mn-angular-lib-tour.d.ts",
|
|
105
|
+
"default": "./fesm2022/mn-angular-lib-tour.mjs"
|
|
102
106
|
}
|
|
103
107
|
},
|
|
104
108
|
"type": "module"
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
/* D10 timings. Kept in step with MN_TOUR_MOTION in mn-tour.types.ts, which the service waits on. */
|
|
3
|
+
--mn-tour-glide: 450ms;
|
|
4
|
+
--mn-tour-fade-in: 450ms;
|
|
5
|
+
--mn-tour-fade-out: 200ms;
|
|
6
|
+
--mn-tour-content-fade: 120ms;
|
|
7
|
+
/* The recorded prototype's curves and colours (D10), so the app matches what was approved. */
|
|
8
|
+
--mn-tour-glide-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
|
|
9
|
+
/* The bottom sheet's curve, so the phone card rises like mn-bottom-sheet does. */
|
|
10
|
+
--mn-tour-sheet-ease: cubic-bezier(0.32, 0.72, 0, 1);
|
|
11
|
+
--mn-tour-dim-color: rgb(15 23 42 / 0.55);
|
|
12
|
+
|
|
13
|
+
display: contents;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.mn-tour-root {
|
|
17
|
+
position: fixed;
|
|
18
|
+
inset: 0;
|
|
19
|
+
z-index: 9990;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* The corner offer leaves the page usable: only the card itself takes pointer input. */
|
|
23
|
+
.mn-tour-root.mn-tour-passive {
|
|
24
|
+
pointer-events: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.mn-tour-passive .mn-tour-card {
|
|
28
|
+
pointer-events: auto;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.mn-tour-blocker {
|
|
32
|
+
position: fixed;
|
|
33
|
+
inset: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Full-page dim behind a centred card. Fades out fast, in slowly with ease-out. */
|
|
37
|
+
.mn-tour-dim {
|
|
38
|
+
position: fixed;
|
|
39
|
+
inset: 0;
|
|
40
|
+
background: var(--mn-tour-dim-color);
|
|
41
|
+
opacity: 0;
|
|
42
|
+
pointer-events: none;
|
|
43
|
+
transition: opacity var(--mn-tour-fade-out) ease;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.mn-tour-dim.is-visible {
|
|
47
|
+
opacity: 1;
|
|
48
|
+
transition: opacity var(--mn-tour-fade-in) ease-out;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* The highlight: a rounded cut-out whose huge outer shadow is the dim around it, with a
|
|
52
|
+
primary ring on top. Position changes are instant unless .is-gliding is set. */
|
|
53
|
+
.mn-tour-hole {
|
|
54
|
+
position: fixed;
|
|
55
|
+
border-radius: 14px;
|
|
56
|
+
box-shadow:
|
|
57
|
+
0 0 0 3px var(--color-primary),
|
|
58
|
+
0 0 0 200vmax var(--mn-tour-dim-color);
|
|
59
|
+
opacity: 0;
|
|
60
|
+
pointer-events: none;
|
|
61
|
+
transition: opacity var(--mn-tour-fade-out) ease;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.mn-tour-hole.is-visible {
|
|
65
|
+
opacity: 1;
|
|
66
|
+
transition: opacity var(--mn-tour-fade-in) ease-out;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.mn-tour-hole.is-gliding {
|
|
70
|
+
transition:
|
|
71
|
+
opacity var(--mn-tour-fade-in) ease-out,
|
|
72
|
+
top var(--mn-tour-glide) var(--mn-tour-glide-ease),
|
|
73
|
+
left var(--mn-tour-glide) var(--mn-tour-glide-ease),
|
|
74
|
+
width var(--mn-tour-glide) var(--mn-tour-glide-ease),
|
|
75
|
+
height var(--mn-tour-glide) var(--mn-tour-glide-ease);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* The card. border-box, so the width it is given includes its padding and a label can never
|
|
79
|
+
be pushed past its edge. */
|
|
80
|
+
.mn-tour-card {
|
|
81
|
+
position: fixed;
|
|
82
|
+
box-sizing: border-box;
|
|
83
|
+
padding: 1.25rem;
|
|
84
|
+
border: 1px solid var(--color-base-300);
|
|
85
|
+
border-radius: 1rem;
|
|
86
|
+
background: var(--color-base-100);
|
|
87
|
+
box-shadow: 0 20px 50px rgb(0 0 0 / 0.28);
|
|
88
|
+
outline: none;
|
|
89
|
+
opacity: 0;
|
|
90
|
+
transition: opacity var(--mn-tour-fade-out) ease;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.mn-tour-card.is-shown {
|
|
94
|
+
opacity: 1;
|
|
95
|
+
transition: opacity var(--mn-tour-fade-in) ease-out;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.mn-tour-card.is-shown.is-gliding {
|
|
99
|
+
transition:
|
|
100
|
+
opacity var(--mn-tour-fade-in) ease-out,
|
|
101
|
+
transform var(--mn-tour-glide) var(--mn-tour-glide-ease);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.mn-tour-card--beside {
|
|
105
|
+
top: 0;
|
|
106
|
+
left: 0;
|
|
107
|
+
width: max-content;
|
|
108
|
+
min-width: min(18rem, calc(100vw - 2rem));
|
|
109
|
+
max-width: min(23rem, calc(100vw - 2rem));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.mn-tour-card--centred {
|
|
113
|
+
top: 50%;
|
|
114
|
+
left: 50%;
|
|
115
|
+
transform: translate(-50%, -50%);
|
|
116
|
+
width: min(26rem, calc(100vw - 2rem));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.mn-tour-card--corner {
|
|
120
|
+
right: 1rem;
|
|
121
|
+
bottom: 1rem;
|
|
122
|
+
width: min(23rem, calc(100vw - 2rem));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* Below lg: the mn-bottom-sheet surface. It rises once when it first appears and then stays
|
|
126
|
+
put; between steps only its content changes. */
|
|
127
|
+
.mn-tour-card--sheet {
|
|
128
|
+
right: 0;
|
|
129
|
+
bottom: 0;
|
|
130
|
+
left: 0;
|
|
131
|
+
width: auto;
|
|
132
|
+
border-width: 1px 0 0;
|
|
133
|
+
border-radius: 1rem 1rem 0 0;
|
|
134
|
+
padding-bottom: calc(1rem + env(safe-area-inset-bottom));
|
|
135
|
+
animation: mn-tour-sheet-in 0.35s var(--mn-tour-sheet-ease);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/* On the sheet the primary button takes the space the dots leave. */
|
|
139
|
+
.mn-tour-card--sheet .mn-tour-actions {
|
|
140
|
+
flex: 1 1 auto;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.mn-tour-card--sheet .mn-tour-primary {
|
|
144
|
+
flex: 1 1 auto;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.mn-tour-content {
|
|
148
|
+
opacity: 0;
|
|
149
|
+
transition: opacity var(--mn-tour-content-fade) ease;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.mn-tour-content.is-visible {
|
|
153
|
+
opacity: 1;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.mn-tour-dot {
|
|
157
|
+
display: block;
|
|
158
|
+
width: 0.375rem;
|
|
159
|
+
height: 0.375rem;
|
|
160
|
+
border-radius: 9999px;
|
|
161
|
+
background: var(--color-base-300);
|
|
162
|
+
transition: width var(--mn-tour-glide) var(--mn-tour-glide-ease), background-color var(--mn-tour-glide) ease;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.mn-tour-dot.is-active {
|
|
166
|
+
width: 1rem;
|
|
167
|
+
background: var(--color-primary);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.mn-tour-skip:focus-visible {
|
|
171
|
+
outline: 2px solid var(--color-primary);
|
|
172
|
+
outline-offset: 2px;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
@keyframes mn-tour-sheet-in {
|
|
176
|
+
from {
|
|
177
|
+
transform: translateY(100%);
|
|
178
|
+
}
|
|
179
|
+
to {
|
|
180
|
+
transform: translateY(0);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* No glide and no fade under reduced motion, whether the OS asks for it or the service set
|
|
185
|
+
the class (which is how the service's own waits and the styles stay in step). */
|
|
186
|
+
.mn-tour-reduced *,
|
|
187
|
+
.mn-tour-reduced {
|
|
188
|
+
transition: none !important;
|
|
189
|
+
animation: none !important;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
@media (prefers-reduced-motion: reduce) {
|
|
193
|
+
.mn-tour-root *,
|
|
194
|
+
.mn-tour-root {
|
|
195
|
+
transition: none !important;
|
|
196
|
+
animation: none !important;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { AfterViewInit, EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges, Type, ViewContainerRef } from "@angular/core";
|
|
2
|
+
import { AfterViewInit, ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges, Type, ViewContainerRef } from "@angular/core";
|
|
3
3
|
import { BehaviorSubject, Observable, Subject } from "rxjs";
|
|
4
4
|
import { CalendarButton, CalendarConfig, CalendarEvent, CalendarEventData, CalendarView, ColumnDay, HourRow, MonthItem } from "mn-angular-lib/calendar-core";
|
|
5
5
|
/**
|
|
@@ -156,7 +156,9 @@ type DisplayHourRow$1 = {
|
|
|
156
156
|
* Overlapping events within the same day are laid out in sub-columns
|
|
157
157
|
* so they appear side-by-side rather than stacked.
|
|
158
158
|
*/
|
|
159
|
-
export declare class CalendarWeekComponent implements OnInit, OnDestroy {
|
|
159
|
+
export declare class CalendarWeekComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
160
|
+
/** Fixed half-hour row height (px) matching the template `1.5rem` rows. */
|
|
161
|
+
static readonly ROW_HEIGHT_PX = 24;
|
|
160
162
|
private readonly lang;
|
|
161
163
|
/**
|
|
162
164
|
* Accessible name for this control. Resolved through the conventional
|
|
@@ -166,6 +168,17 @@ export declare class CalendarWeekComponent implements OnInit, OnDestroy {
|
|
|
166
168
|
get weekViewLabel(): string;
|
|
167
169
|
private layoutService;
|
|
168
170
|
private cdr;
|
|
171
|
+
/** Scrollable week body — vertical scroll for the full hour range (R7QVk8rz). */
|
|
172
|
+
bodyScroller?: ElementRef<HTMLElement>;
|
|
173
|
+
/**
|
|
174
|
+
* True from open / a date change until that week's first events batch lands,
|
|
175
|
+
* which then decides the initial scroll; later batches leave the user's scroll alone.
|
|
176
|
+
* An empty batch does not count: the host replays its last (often still empty) list on
|
|
177
|
+
* subscribe, before the real load lands.
|
|
178
|
+
*/
|
|
179
|
+
private pendingInitialScroll;
|
|
180
|
+
/** The user scrolled (wheel, touch, scrollbar) before events landed: keep their position. */
|
|
181
|
+
onUserScrollIntent(): void;
|
|
169
182
|
/** The date around which the week is centred. */
|
|
170
183
|
focusDay: Date;
|
|
171
184
|
/** Observable that emits the full event list whenever it changes. */
|
|
@@ -195,6 +208,7 @@ export declare class CalendarWeekComponent implements OnInit, OnDestroy {
|
|
|
195
208
|
private currentTimeInterval?;
|
|
196
209
|
constructor();
|
|
197
210
|
ngOnInit(): void;
|
|
211
|
+
ngAfterViewInit(): void;
|
|
198
212
|
ngOnDestroy(): void;
|
|
199
213
|
/** Returns the CSS `grid-row` value for an event based on its start/end times. */
|
|
200
214
|
getEventRow(event: CalendarEvent): string;
|
|
@@ -215,6 +229,13 @@ export declare class CalendarWeekComponent implements OnInit, OnDestroy {
|
|
|
215
229
|
private buildColumns;
|
|
216
230
|
/** Filters, splits, and lays out events for the current week. */
|
|
217
231
|
private refreshEvents;
|
|
232
|
+
/**
|
|
233
|
+
* Scrolls the body to the current hour (when today is in the week) or the first
|
|
234
|
+
* event (SuperBottie option 1 / R7QVk8rz).
|
|
235
|
+
*/
|
|
236
|
+
scrollToInitialRow(): void;
|
|
237
|
+
/** 1-based grid row to land on: now-line, else earliest event, else top. */
|
|
238
|
+
private resolveInitialScrollRow;
|
|
218
239
|
/** Computes the CSS grid-template-columns string based on per-day sub-column counts. */
|
|
219
240
|
private buildGridColumns;
|
|
220
241
|
/** Updates the current-time red line position. */
|
|
@@ -255,7 +276,9 @@ type DisplayHourRow = {
|
|
|
255
276
|
* Shares the same layout algorithm as the week view via
|
|
256
277
|
* {@link CalendarEventLayoutService}.
|
|
257
278
|
*/
|
|
258
|
-
export declare class CalendarDayComponent implements OnInit, OnDestroy {
|
|
279
|
+
export declare class CalendarDayComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
280
|
+
/** Fixed half-hour row height (px) matching the template `1.5rem` rows. */
|
|
281
|
+
static readonly ROW_HEIGHT_PX = 24;
|
|
259
282
|
private readonly lang;
|
|
260
283
|
/**
|
|
261
284
|
* Accessible name for this control. Resolved through the conventional
|
|
@@ -265,6 +288,17 @@ export declare class CalendarDayComponent implements OnInit, OnDestroy {
|
|
|
265
288
|
get dayViewLabel(): string;
|
|
266
289
|
private layoutService;
|
|
267
290
|
private cdr;
|
|
291
|
+
/** Scrollable day body — vertical scroll for the full hour range (R7QVk8rz). */
|
|
292
|
+
bodyScroller?: ElementRef<HTMLElement>;
|
|
293
|
+
/**
|
|
294
|
+
* True from open / a date change until that date's first events batch lands,
|
|
295
|
+
* which then decides the initial scroll; later batches leave the user's scroll alone.
|
|
296
|
+
* An empty batch does not count: the host replays its last (often still empty) list on
|
|
297
|
+
* subscribe, before the real load lands.
|
|
298
|
+
*/
|
|
299
|
+
private pendingInitialScroll;
|
|
300
|
+
/** The user scrolled (wheel, touch, scrollbar) before events landed: keep their position. */
|
|
301
|
+
onUserScrollIntent(): void;
|
|
268
302
|
/** The date to display. */
|
|
269
303
|
focusDay: Date;
|
|
270
304
|
/** Observable that emits the full event list whenever it changes. */
|
|
@@ -293,6 +327,7 @@ export declare class CalendarDayComponent implements OnInit, OnDestroy {
|
|
|
293
327
|
private currentTimeInterval?;
|
|
294
328
|
constructor();
|
|
295
329
|
ngOnInit(): void;
|
|
330
|
+
ngAfterViewInit(): void;
|
|
296
331
|
ngOnDestroy(): void;
|
|
297
332
|
/** Returns the CSS `grid-row` value for an event. */
|
|
298
333
|
getEventRow(event: CalendarEvent): string;
|
|
@@ -309,6 +344,13 @@ export declare class CalendarDayComponent implements OnInit, OnDestroy {
|
|
|
309
344
|
private updateDayInfo;
|
|
310
345
|
/** Filters, splits, and lays out events for the focus day. */
|
|
311
346
|
private refreshEvents;
|
|
347
|
+
/**
|
|
348
|
+
* Scrolls the body to the current hour (today) or the first event so evening
|
|
349
|
+
* slots are one scroll away instead of clipped (SuperBottie option 1 / R7QVk8rz).
|
|
350
|
+
*/
|
|
351
|
+
scrollToInitialRow(): void;
|
|
352
|
+
/** 1-based grid row to land on: now-line, else earliest event, else top. */
|
|
353
|
+
private resolveInitialScrollRow;
|
|
312
354
|
/** Updates the current-time red line position. */
|
|
313
355
|
private updateCurrentTime;
|
|
314
356
|
static ɵfac: i0.ɵɵFactoryDeclaration<CalendarDayComponent, never>;
|