@plexui/vue 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/components/ButtonGroup/ButtonGroup.js +7 -0
- package/dist/es/components/ButtonGroup/ButtonGroup.js.map +1 -1
- package/dist/es/components/ButtonGroup/index.js.map +1 -1
- package/dist/es/components/ContextMenu/shared.js +3 -2
- package/dist/es/components/ContextMenu/shared.js.map +1 -1
- package/dist/es/components/Dialog/Dialog.js +135 -18
- package/dist/es/components/Dialog/Dialog.js.map +1 -1
- package/dist/es/components/Dialog/dialogSteps.js +85 -0
- package/dist/es/components/Dialog/dialogSteps.js.map +1 -0
- package/dist/es/components/Dialog/dialogViewport.js +74 -0
- package/dist/es/components/Dialog/dialogViewport.js.map +1 -0
- package/dist/es/components/Dialog/index.js +1 -1
- package/dist/es/components/Dialog/index.js.map +1 -1
- package/dist/es/components/Dialog/sheetDrag.js +2 -1
- package/dist/es/components/Dialog/sheetDrag.js.map +1 -1
- package/dist/es/components/IndexBar/IndexBar.js +215 -0
- package/dist/es/components/IndexBar/IndexBar.js.map +1 -0
- package/dist/es/components/IndexBar/index.js +2 -0
- package/dist/es/components/IndexBar/index.js.map +1 -0
- package/dist/es/components/MarkdownEditor/MarkdownEditor.js +149 -1
- package/dist/es/components/MarkdownEditor/MarkdownEditor.js.map +1 -1
- package/dist/es/components/Menu/Menu.js +54 -28
- package/dist/es/components/Menu/Menu.js.map +1 -1
- package/dist/es/components/Page/Page.js +2 -2
- package/dist/es/components/Page/Page.js.map +1 -1
- package/dist/es/components/PhoneLayout/PhoneLayout.js +50 -0
- package/dist/es/components/PhoneLayout/PhoneLayout.js.map +1 -0
- package/dist/es/components/PhoneLayout/index.js +2 -0
- package/dist/es/components/PhoneLayout/index.js.map +1 -0
- package/dist/es/components/Popover/Popover.js +1 -1
- package/dist/es/components/Popover/Popover.js.map +1 -1
- package/dist/es/components/Popover/deferredPointerDownOutside.js +59 -4
- package/dist/es/components/Popover/deferredPointerDownOutside.js.map +1 -1
- package/dist/es/components/Select/Select.js +2 -2
- package/dist/es/components/Select/Select.js.map +1 -1
- package/dist/es/components/Slider/Slider.js +34 -3
- package/dist/es/components/Slider/Slider.js.map +1 -1
- package/dist/es/components/SwipeActions/SwipeActions.js +374 -0
- package/dist/es/components/SwipeActions/SwipeActions.js.map +1 -0
- package/dist/es/components/SwipeActions/index.js +2 -0
- package/dist/es/components/SwipeActions/index.js.map +1 -0
- package/dist/es/components/Switch/Switch.js +3 -1
- package/dist/es/components/Switch/Switch.js.map +1 -1
- package/dist/es/components/TabBar/TabBar.js +23 -8
- package/dist/es/components/TabBar/TabBar.js.map +1 -1
- package/dist/es/components/TabBar/index.js.map +1 -1
- package/dist/es/components/Tabs/Tabs.js +1 -0
- package/dist/es/components/Tabs/Tabs.js.map +1 -1
- package/dist/es/components/TagInput/TagInput.js +3 -46
- package/dist/es/components/TagInput/TagInput.js.map +1 -1
- package/dist/es/components/Textarea/Textarea.js +1 -0
- package/dist/es/components/Textarea/Textarea.js.map +1 -1
- package/dist/es/components/Tip/Tip.js +276 -0
- package/dist/es/components/Tip/Tip.js.map +1 -0
- package/dist/es/components/Tip/index.js +2 -0
- package/dist/es/components/Tip/index.js.map +1 -0
- package/dist/es/components/Toast/ToastRenderer.js +30 -13
- package/dist/es/components/Toast/ToastRenderer.js.map +1 -1
- package/dist/es/components/Toast/Toaster.js +17 -6
- package/dist/es/components/Toast/Toaster.js.map +1 -1
- package/dist/es/components/Toast/toastLifecycle.js +113 -1
- package/dist/es/components/Toast/toastLifecycle.js.map +1 -1
- package/dist/es/components/Toolbar/Toolbar.js +3 -3
- package/dist/es/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/es/composables/useEscCloseStack.js +8 -4
- package/dist/es/composables/useEscCloseStack.js.map +1 -1
- package/dist/es/composables/usePhoneSubmenu.js +3 -2
- package/dist/es/composables/usePhoneSubmenu.js.map +1 -1
- package/dist/es/lib/floatingBoundary.js +3 -1
- package/dist/es/lib/floatingBoundary.js.map +1 -1
- package/dist/es/lib/helpers.js +21 -0
- package/dist/es/lib/helpers.js.map +1 -1
- package/dist/es/lib/menuInitialFocus.js +5 -3
- package/dist/es/lib/menuInitialFocus.js.map +1 -1
- package/dist/es/lib/menuSubmenuPlacement.js +129 -5
- package/dist/es/lib/menuSubmenuPlacement.js.map +1 -1
- package/dist/es/lib/menuTriggerCover.js +10 -4
- package/dist/es/lib/menuTriggerCover.js.map +1 -1
- package/dist/es/lib/phoneLayout.js +16 -0
- package/dist/es/lib/phoneLayout.js.map +1 -0
- package/dist/es/lib/toastRegion.js +6 -0
- package/dist/es/lib/toastRegion.js.map +1 -0
- package/dist/types/components/ButtonGroup/ButtonGroup.d.ts +13 -0
- package/dist/types/components/ButtonGroup/index.d.ts +1 -1
- package/dist/types/components/ContextMenu/shared.d.ts +3 -2
- package/dist/types/components/Dialog/Dialog.d.ts +93 -3
- package/dist/types/components/Dialog/dialogSteps.d.ts +10 -0
- package/dist/types/components/Dialog/dialogViewport.d.ts +1 -0
- package/dist/types/components/Dialog/index.d.ts +1 -1
- package/dist/types/components/IndexBar/IndexBar.d.ts +112 -0
- package/dist/types/components/IndexBar/index.d.ts +1 -0
- package/dist/types/components/Menu/Menu.d.ts +14 -15
- package/dist/types/components/Page/Page.d.ts +2 -2
- package/dist/types/components/PhoneLayout/PhoneLayout.d.ts +21 -0
- package/dist/types/components/PhoneLayout/index.d.ts +1 -0
- package/dist/types/components/Popover/deferredPointerDownOutside.d.ts +1 -1
- package/dist/types/components/SwipeActions/SwipeActions.d.ts +135 -0
- package/dist/types/components/SwipeActions/index.d.ts +1 -0
- package/dist/types/components/TabBar/TabBar.d.ts +55 -6
- package/dist/types/components/TabBar/index.d.ts +1 -1
- package/dist/types/components/Tip/Tip.d.ts +146 -0
- package/dist/types/components/Tip/index.d.ts +1 -0
- package/dist/types/components/Toast/toastLifecycle.d.ts +34 -0
- package/dist/types/components/Toolbar/Toolbar.d.ts +9 -7
- package/dist/types/composables/useEscCloseStack.d.ts +2 -2
- package/dist/types/composables/usePhoneSubmenu.d.ts +2 -1
- package/dist/types/lib/helpers.d.ts +6 -0
- package/dist/types/lib/menuSubmenuPlacement.d.ts +9 -2
- package/dist/types/lib/phoneLayout.d.ts +11 -0
- package/dist/types/lib/toastRegion.d.ts +5 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toastLifecycle.js","sourceRoot":"","sources":["../../../../src/components/Toast/toastLifecycle.ts"],"names":[],"mappings":"AASA,MAAM,aAAa,GAAG,GAAG,CAAA;AAEzB,MAAM,OAAO,cAAc;IAgBL;IAAgD;IAfpE,OAAO,GAAoB,EAAE,CAAA;IAC7B,MAAM,GAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE,CAAA;IACnF,SAAS,GAAG,IAAI,GAAG,EAAc,CAAA;IACjC,QAAQ,GAAG,CAAC,CAAA;IACZ,GAAG,GAAoB,IAAI,CAAA;IAC3B,MAAM,GAAG,KAAK,CAAA;IACd,OAAO,GAAG,KAAK,CAAA;IACf,OAAO,GAAG,KAAK,CAAA;IACf,OAAO,CAAU;IACjB,aAAa,GAAuB,IAAI,CAAA;IACxC,KAAK,GAAG,IAAI,GAAG,EAAwB,CAAA;IACvC,KAAK,GAAG,IAAI,GAAG,EAAyB,CAAA;IACxC,UAAU,GAAG,IAAI,GAAG,EAAc,CAAA;IAClC,eAAe,GAAG,EAAE,CAAA;IAE5B,YAAoB,YAAsC,EAAU,MAAsD;QAAtG,iBAAY,GAAZ,YAAY,CAA0B;QAAU,WAAM,GAAN,MAAM,CAAgD;IAAG,CAAC;IAC9H,SAAS,GAAG,CAAC,QAAoB,EAAE,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,GAAG,EAAE,GAAG,IA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,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAyB,EAAE,EAAE;IAC7D,MAAM,SAAS,GAAG,GAAG,EAAE,eAAe,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;IAC1D,IAAI,SAAS,KAAK,KAAK,IAAI,SAAS,KAAK,KAAK;QAAE,OAAO,SAAS,CAAA;IAChE,OAAO,GAAG,EAAE,WAAW,EAAE,gBAAgB,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;AACpG,CAAC,CAAA","sourcesContent":["/** Framework-independent lifecycle, mirrored in the Vue/React packages so neither\n * published port depends on the other framework. Vendor stores remain public. */\nexport type ToastId = string | number\nexport type Position = \"top-left\" | \"top-center\" | \"top-right\" | \"bottom-left\" | \"bottom-center\" | \"bottom-right\"\nexport type Direction = \"top\" | \"bottom\" | \"left\" | \"right\"\ntype ToastData = { id: ToastId; toasterId?: string; position?: Position; duration?: number; type?: string; dismissible?: boolean }\nexport type ToastConfig = { id?: string; position: Position; duration: number; gap: number; visibleToasts: number; expand?: boolean; swipeDirections?: Direction[] }\nexport type ToastEntry<T> = { toast: T; removed: boolean; detached?: boolean; mounted: boolean; height: number; x: number; y: number; swiping: boolean; swipeOut?: \"up\" | \"down\" | \"left\" | \"right\"; remaining: number; started?: number; timer?: ReturnType<typeof setTimeout>; exitTimer?: ReturnType<typeof setTimeout>; mountTimer?: ReturnType<typeof setTimeout>; exitOffset: number }\ntype Gesture = { id: ToastId; pointerId: number; x: number; y: number; started: number; axis?: \"x\" | \"y\" }\nconst EXIT_DURATION = 200\n\nexport class ToastLifecycle<T extends ToastData> {\n entries: ToastEntry<T>[] = []\n config: ToastConfig = { position: \"top-center\", duration: 3000, gap: 14, visibleToasts: 3 }\n private listeners = new Set<() => void>()\n private revision = 0\n private doc: Document | null = null\n private hidden = false\n private hovered = false\n private focused = false\n private gesture?: Gesture\n private previousFocus: HTMLElement | null = null\n private nodes = new Map<ToastId, HTMLElement>()\n private lists = new Map<Position, HTMLElement>()\n private suppressed = new Map<ToastId, T>()\n private lastPointerType = \"\"\n\n constructor(private dismissStore: (id: ToastId) => unknown, private notify: (reason: \"dismiss\" | \"auto\", toast: T) => void) {}\n subscribe = (listener: () => void) => { this.listeners.add(listener); return () => { this.listeners.delete(listener) } }\n snapshot = () => this.revision\n private emit() { this.revision++; this.listeners.forEach((listener) => listener()) }\n get expanded() { return this.hovered || this.focused }\n get paused() { return this.expanded || Boolean(this.gesture) || this.hidden }\n connect(doc: Document) { this.doc = doc; this.hidden = doc.hidden; doc.addEventListener(\"visibilitychange\", this.visibility); this.refreshTimers() }\n private visibility = () => { this.hidden = Boolean(this.doc?.hidden); this.refreshTimers(); this.emit() }\n disconnect() {\n this.doc?.removeEventListener(\"visibilitychange\", this.visibility)\n for (const entry of this.entries) { clearTimeout(entry.timer); clearTimeout(entry.exitTimer); clearTimeout(entry.mountTimer); entry.timer = undefined; entry.started = undefined }\n this.doc = null\n this.gesture = undefined\n this.hovered = false\n this.focused = false\n this.previousFocus = null\n }\n sync(toasts: T[], config: ToastConfig) {\n const oldDuration = this.config.duration\n this.config = config\n const incoming = toasts.filter((toast) => config.id ? toast.toasterId === config.id : !toast.toasterId)\n const present = new Set(incoming.map((toast) => toast.id))\n for (const entry of this.entries) if (!present.has(entry.toast.id) && !entry.removed) this.close(entry.toast.id, toasts.some((toast) => toast.id === entry.toast.id) ? \"detach\" : \"external\")\n const ordered: ToastEntry<T>[] = []\n for (const toast of incoming) {\n if (this.suppressed.get(toast.id) === toast) continue\n let entry = this.entries.find((item) => item.toast.id === toast.id)\n if (!entry) {\n entry = { toast, removed: false, mounted: false, height: 0, x: 0, y: 0, swiping: false, remaining: toast.duration || config.duration, exitOffset: 0 }\n const mountedEntry = entry\n entry.mountTimer = setTimeout(() => { mountedEntry.mounted = true; this.emit() }, 0)\n } else if (entry.toast !== toast || entry.detached) {\n const restart = entry.removed || entry.toast.type !== toast.type || entry.toast.duration !== toast.duration\n entry.toast = toast\n entry.detached = false\n // Same-id updates restart the current budget; only an actual pause\n // subtracts elapsed time (the public Sonner store/update contract).\n clearTimeout(entry.timer); entry.timer = undefined; entry.started = undefined\n if (restart) {\n clearTimeout(entry.exitTimer); this.pause(entry); entry.removed = false; entry.swipeOut = undefined\n entry.remaining = toast.duration || config.duration\n }\n }\n if (this.gesture?.id === toast.id && (toast.type === \"loading\" || toast.dismissible === false)) { this.gesture = undefined; entry.swiping = false; entry.x = 0; entry.y = 0 }\n if (oldDuration !== config.duration && !toast.duration) { this.pause(entry); entry.remaining = config.duration }\n ordered.push(entry)\n }\n this.entries = [...ordered, ...this.entries.filter((entry) => entry.removed && !present.has(entry.toast.id))]\n for (const id of this.suppressed.keys()) if (!present.has(id)) this.suppressed.delete(id)\n this.refreshTimers()\n this.emit()\n }\n private pause(entry: ToastEntry<T>) {\n if (entry.started !== undefined) entry.remaining = Math.max(0, entry.remaining - (Date.now() - entry.started))\n clearTimeout(entry.timer); entry.timer = undefined; entry.started = undefined\n }\n private refreshTimers() {\n for (const entry of this.entries) {\n if (entry.removed || this.paused || entry.toast.type === \"loading\" || entry.remaining === Infinity) { this.pause(entry); continue }\n if (entry.timer !== undefined) continue\n entry.started = Date.now()\n entry.timer = setTimeout(() => this.close(entry.toast.id, \"auto\"), Math.max(0, entry.remaining))\n }\n }\n position(entry: ToastEntry<T>) { return entry.toast.position ?? this.config.position }\n at(position: Position) { return this.entries.filter((entry) => this.position(entry) === position) }\n offset(entry: ToastEntry<T>) {\n if (entry.removed) return entry.exitOffset\n const siblings = this.at(this.position(entry)).filter((item) => !item.removed)\n return siblings.slice(0, siblings.indexOf(entry)).reduce((sum, item) => sum + item.height + this.config.gap, 0)\n }\n setNode(id: ToastId, node: HTMLElement | null) { if (node) this.nodes.set(id, node); else this.nodes.delete(id) }\n setList(position: Position, node: HTMLElement | null) { if (node) this.lists.set(position, node); else this.lists.delete(position) }\n measure(id: ToastId, height: number) { const entry = this.entries.find((item) => item.toast.id === id); if (entry && entry.height !== height) { entry.height = height; this.emit() } }\n close(id: ToastId, reason: \"dismiss\" | \"auto\" | \"action\" | \"external\" | \"detach\") {\n const entry = this.entries.find((item) => item.toast.id === id)\n if (!entry || entry.removed || reason === \"dismiss\" && (entry.toast.dismissible === false || entry.toast.type === \"loading\")) return\n entry.exitOffset = this.offset(entry)\n entry.removed = true\n entry.detached = reason === \"detach\"\n this.pause(entry)\n if (this.gesture?.id === id) this.gesture = undefined\n entry.swiping = false\n if (reason === \"dismiss\" || reason === \"auto\" || reason === \"external\") this.notify(reason === \"external\" ? \"dismiss\" : reason, entry.toast)\n const node = this.nodes.get(id)\n if (node?.contains(this.doc?.activeElement ?? null)) this.restoreFocus()\n entry.exitTimer = setTimeout(() => {\n if (reason !== \"detach\") this.suppressed.set(id, entry.toast)\n this.entries = this.entries.filter((item) => item !== entry)\n if (reason !== \"external\" && reason !== \"detach\") this.dismissStore(id)\n this.emit()\n }, EXIT_DURATION)\n this.refreshTimers(); this.emit()\n }\n private ownsFocus(target: EventTarget | null) { return target instanceof Node && [...this.lists.values()].some((list) => list.contains(target)) }\n focusIn(event: FocusEvent) {\n if (!this.focused && event.relatedTarget instanceof HTMLElement && !this.ownsFocus(event.relatedTarget)) this.previousFocus = event.relatedTarget\n this.focused = true; this.refreshTimers(); this.emit()\n }\n focusOut(event: FocusEvent) {\n if (this.ownsFocus(event.relatedTarget)) return\n this.focused = false\n // An intentional move to another control owns focus. Never bounce through the opener.\n if (event.relatedTarget instanceof HTMLElement) this.previousFocus = null\n this.refreshTimers(); this.emit()\n }\n private restoreFocus() {\n const previous = this.previousFocus\n this.previousFocus = null; this.focused = false\n if (previous?.isConnected) previous.focus({ preventScroll: true })\n }\n keyDown(event: KeyboardEvent, hotkey: string[]) {\n if (hotkey.length && hotkey.every((key) => key === event.code || (key === \"altKey\" && event.altKey) || (key === \"ctrlKey\" && event.ctrlKey) || (key === \"metaKey\" && event.metaKey) || (key === \"shiftKey\" && event.shiftKey))) {\n const list = this.lists.values().next().value\n if (list) { event.preventDefault(); list.focus({ preventScroll: true }) }\n } else if (event.key === \"Escape\" && this.ownsFocus(this.doc?.activeElement ?? null)) {\n this.hovered = false; this.restoreFocus(); this.refreshTimers(); this.emit()\n }\n }\n pointerEnter(event: PointerEvent) { this.lastPointerType = event.pointerType; this.hover(event.pointerType !== \"touch\") }\n hover(value: boolean) {\n if (value && (this.lastPointerType === \"touch\" || this.doc?.documentElement.dataset.input === \"touch\" || this.doc?.defaultView?.matchMedia?.(\"(hover: none) and (pointer: coarse)\").matches)) return\n this.hovered = value; this.refreshTimers(); this.emit()\n }\n pointerDown(id: ToastId, event: PointerEvent) {\n this.lastPointerType = event.pointerType\n if (event.pointerType === \"touch\" && this.hovered) { this.hovered = false; this.refreshTimers(); this.emit() }\n const entry = this.entries.find((item) => item.toast.id === id)\n if (this.gesture || !entry || entry.removed || event.button !== 0 || entry.toast.type === \"loading\" || entry.toast.dismissible === false) return\n if (event.target instanceof Element && event.target.closest(\"button, a, input, textarea, select, [contenteditable='true']\")) return\n this.gesture = { id, pointerId: event.pointerId, x: event.clientX, y: event.clientY, started: Date.now() }\n entry.swiping = true\n this.nodes.get(id)?.setPointerCapture?.(event.pointerId)\n this.refreshTimers(); this.emit()\n }\n pointerMove(id: ToastId, event: PointerEvent) {\n const gesture = this.gesture\n const entry = this.entries.find((item) => item.toast.id === id)\n if (!gesture || gesture.id !== id || gesture.pointerId !== event.pointerId || !entry) return\n if (this.doc?.getSelection()?.toString()) return\n const dx = event.clientX - gesture.x, dy = event.clientY - gesture.y\n if (!gesture.axis && Math.max(Math.abs(dx), Math.abs(dy)) > 1) gesture.axis = Math.abs(dx) > Math.abs(dy) ? \"x\" : \"y\"\n const [vertical, horizontal] = this.position(entry).split(\"-\")\n const allowed = this.config.swipeDirections ?? [vertical, horizontal]\n entry.x = gesture.axis === \"x\" && allowed.includes(dx > 0 ? \"right\" : \"left\") ? dx : 0\n entry.y = gesture.axis === \"y\" && allowed.includes(dy > 0 ? \"bottom\" : \"top\") ? dy : 0\n this.emit()\n }\n pointerEnd(id: ToastId, event: PointerEvent, cancelled = false) {\n const gesture = this.gesture\n const entry = this.entries.find((item) => item.toast.id === id)\n if (!gesture || gesture.id !== id || gesture.pointerId !== event.pointerId || !entry) return\n const distance = Math.max(Math.abs(entry.x), Math.abs(entry.y))\n this.gesture = undefined; entry.swiping = false\n if (!cancelled && (distance >= 45 || distance > 3 && distance / Math.max(1, Date.now() - gesture.started) > 0.11)) {\n entry.swipeOut = entry.x ? entry.x > 0 ? \"right\" : \"left\" : entry.y > 0 ? \"down\" : \"up\"\n this.close(id, \"dismiss\")\n } else { entry.x = 0; entry.y = 0 }\n this.refreshTimers(); this.emit()\n }\n}\n\nexport type Offset = number | string | Partial<Record<\"top\" | \"right\" | \"bottom\" | \"left\", number | string>>\nexport const offsetStyles = (offset: Offset | undefined, mobileOffset: Offset | undefined) => {\n const style: Record<string, string> = {}\n for (const [prefix, value, fallback] of [[\"--offset\", offset, \"32px\"], [\"--mobile-offset\", mobileOffset, \"16px\"]] as const) {\n for (const edge of [\"top\", \"right\", \"bottom\", \"left\"] as const) {\n const size = typeof value === \"object\" ? value[edge] ?? fallback : value ?? fallback\n style[`${prefix}-${edge}`] = typeof size === \"number\" ? `${size}px` : size\n }\n }\n return style\n}\n\nexport const documentDirection = (doc: Document | undefined) => {\n const direction = doc?.documentElement.getAttribute(\"dir\")\n if (direction === \"ltr\" || direction === \"rtl\") return direction\n return doc?.defaultView?.getComputedStyle(doc.documentElement).direction === \"rtl\" ? \"rtl\" : \"ltr\"\n}\n"]}
|
|
1
|
+
{"version":3,"file":"toastLifecycle.js","sourceRoot":"","sources":["../../../../src/components/Toast/toastLifecycle.ts"],"names":[],"mappings":"AASA,MAAM,aAAa,GAAG,GAAG,CAAA;AACzB,qFAAqF;AACrF,MAAM,iBAAiB,GAAG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AAe,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;IAC1D,IAAI,SAAS,KAAK,KAAK,IAAI,SAAS,KAAK,KAAK;QAAE,OAAO,SAAS,CAAA;IAChE,OAAO,GAAG,EAAE,WAAW,EAAE,gBAAgB,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;AACpG,CAAC,CAAA","sourcesContent":["/** Framework-independent lifecycle, mirrored in the Vue/React packages so neither\n * published port depends on the other framework. Vendor stores remain public. */\nexport type ToastId = string | number\nexport type Position = \"top-left\" | \"top-center\" | \"top-right\" | \"bottom-left\" | \"bottom-center\" | \"bottom-right\"\nexport type Direction = \"top\" | \"bottom\" | \"left\" | \"right\"\ntype ToastData = { id: ToastId; toasterId?: string; position?: Position; duration?: number; type?: string; dismissible?: boolean }\nexport type ToastConfig = { id?: string; position: Position; duration: number; gap: number; visibleToasts: number; expand?: boolean; swipeDirections?: Direction[] }\nexport type ToastEntry<T> = { toast: T; removed: boolean; detached?: boolean; mounted: boolean; height: number; x: number; y: number; swiping: boolean; swipeOut?: \"up\" | \"down\" | \"left\" | \"right\"; remaining: number; started?: number; timer?: ReturnType<typeof setTimeout>; exitTimer?: ReturnType<typeof setTimeout>; mountTimer?: ReturnType<typeof setTimeout>; exitOffset: number }\ntype Gesture = { id: ToastId; pointerId: number; x: number; y: number; started: number; axis?: \"x\" | \"y\" }\nconst EXIT_DURATION = 200\n/** How long an announced line stays in the polite region before it leaves the DOM */\nconst ANNOUNCE_DURATION = 7000\n\nexport class ToastLifecycle<T extends ToastData> {\n entries: ToastEntry<T>[] = []\n config: ToastConfig = { position: \"top-center\", duration: 3000, gap: 14, visibleToasts: 3 }\n private listeners = new Set<() => void>()\n private revision = 0\n private doc: Document | null = null\n private hidden = false\n private hovered = false\n private focused = false\n private gesture?: Gesture\n private previousFocus: HTMLElement | null = null\n private nodes = new Map<ToastId, HTMLElement>()\n private lists = new Map<Position, HTMLElement>()\n private suppressed = new Map<ToastId, T>()\n private lastPointerType = \"\"\n private region: HTMLElement | null = null\n private announcers: { polite: HTMLElement | null; assertive: HTMLElement | null } = { polite: null, assertive: null }\n private announced = new Map<ToastId, string>()\n /** Alerts read by the assertive announcer: shown behind the stack, their own role could not speak */\n private assertive = new Set<ToastId>()\n private announceTimers = new Set<ReturnType<typeof setTimeout>>()\n private pending = new Map<ToastId, { text: string; assertive: boolean }>()\n private flushTimer?: ReturnType<typeof setTimeout>\n\n constructor(private dismissStore: (id: ToastId) => unknown, private notify: (reason: \"dismiss\" | \"auto\", toast: T) => void) {}\n subscribe = (listener: () => void) => { this.listeners.add(listener); return () => { this.listeners.delete(listener) } }\n snapshot = () => this.revision\n private emit() { this.revision++; this.listeners.forEach((listener) => listener()) }\n get expanded() { return this.hovered || this.focused }\n get paused() { return this.expanded || Boolean(this.gesture) || this.hidden }\n connect(doc: Document) {\n this.doc = doc; this.hidden = doc.hidden\n doc.addEventListener(\"visibilitychange\", this.visibility)\n for (const type of ISOLATED_EVENTS) doc.addEventListener(type, this.isolate)\n this.refreshTimers()\n }\n private visibility = () => { this.hidden = Boolean(this.doc?.hidden); this.refreshTimers(); this.emit() }\n /* The region is a layer of its own, above any modal. A modal layer (Radix, Reka) listens on the\n document for focus and presses outside it: it would pull focus back out of a toast and close\n on a press of its close or action. This listener, added when the Toaster mounts and so before a\n Dialog opens, runs after the framework's own (React delegates to its root, Vue binds to the\n element) and stops the ones added after it, only while a modal layer has turned the page's\n pointer events off: then nothing under the toast should hear it. Without a modal, a Popover a\n custom toast opened still hears a press elsewhere in the toast. */\n private isolate = (event: Event) => {\n const region = this.region\n if (!region || this.doc?.body.style.pointerEvents !== \"none\") return\n const related = event.type === \"focusout\" ? (event as FocusEvent).relatedTarget : null\n if (event.target instanceof Node && region.contains(event.target) || related instanceof Node && region.contains(related)) event.stopImmediatePropagation()\n }\n setRegion(node: HTMLElement | null) { this.region = node }\n setAnnouncer(kind: \"polite\" | \"assertive\", node: HTMLElement | null) { this.announcers[kind] = node }\n /** An error that waits to be closed interrupts as an alert; every other toast is read politely. */\n alert(entry: ToastEntry<T>) { return entry.toast.type === \"error\" && (entry.toast.duration || this.config.duration) === Infinity }\n /** Whether a toast's content carries role=\"alert\": an alert, unless it came in behind the stack and the assertive announcer read it. */\n alertRole(entry: ToastEntry<T>, custom: boolean) { return !custom && this.alert(entry) && !this.assertive.has(entry.toast.id) }\n private visible(entry: ToastEntry<T>) { return this.at(this.position(entry)).indexOf(entry) < this.config.visibleToasts }\n /** Reads a toast's words once, and again only when they change (a promise that settles, a custom toast's own state). */\n speak(id: ToastId, node: HTMLElement, custom: boolean) {\n const entry = this.entries.find((item) => item.toast.id === id)\n if (!entry || entry.removed) return\n const text = toastText(node)\n const alert = this.alert(entry) && !custom\n // An alert speaks at once, never also politely: words still waiting to be read politely are read as the alert\n if (alert && this.pending.get(id)?.assertive === false) { this.pending.delete(id); this.announced.delete(id) }\n if (!text || this.announced.get(id) === text) return\n this.announced.set(id, text)\n // A shown alert reads itself by its role; one that came in behind the stack (inert, aria-hidden) cannot\n if (alert && this.visible(entry) && !this.assertive.has(id)) return\n this.pending.set(id, { text, assertive: alert })\n // Its content then drops role=\"alert\", so it does not speak again once the stack brings it forward\n if (alert && !this.assertive.has(id)) { this.assertive.add(id); this.emit() }\n // Toasts shown together are read together, the oldest first, whichever framework renders them first\n if (this.flushTimer === undefined) this.flushTimer = setTimeout(this.flush, 0)\n }\n private flush = () => {\n this.flushTimer = undefined\n const order = this.entries.map((entry) => entry.toast.id).reverse()\n const lines = [...this.pending].sort(([a], [b]) => order.indexOf(a) - order.indexOf(b))\n this.pending.clear()\n for (const [, { text, assertive }] of lines) {\n const node = this.announcers[assertive ? \"assertive\" : \"polite\"]\n if (!node) continue\n const line = node.ownerDocument.createElement(\"div\")\n line.textContent = text\n node.append(line)\n const timer = setTimeout(() => { line.remove(); this.announceTimers.delete(timer) }, ANNOUNCE_DURATION)\n this.announceTimers.add(timer)\n }\n }\n disconnect() {\n this.doc?.removeEventListener(\"visibilitychange\", this.visibility)\n for (const type of ISOLATED_EVENTS) this.doc?.removeEventListener(type, this.isolate)\n for (const timer of this.announceTimers) clearTimeout(timer)\n clearTimeout(this.flushTimer); this.flushTimer = undefined\n this.announceTimers.clear()\n this.announced.clear()\n this.assertive.clear()\n this.pending.clear()\n this.announcers.polite?.replaceChildren()\n this.announcers.assertive?.replaceChildren()\n for (const entry of this.entries) { clearTimeout(entry.timer); clearTimeout(entry.exitTimer); clearTimeout(entry.mountTimer); entry.timer = undefined; entry.started = undefined }\n this.doc = null\n this.gesture = undefined\n this.hovered = false\n this.focused = false\n this.previousFocus = null\n }\n sync(toasts: T[], config: ToastConfig) {\n const oldDuration = this.config.duration\n this.config = config\n const incoming = toasts.filter((toast) => config.id ? toast.toasterId === config.id : !toast.toasterId)\n const present = new Set(incoming.map((toast) => toast.id))\n for (const entry of this.entries) if (!present.has(entry.toast.id) && !entry.removed) this.close(entry.toast.id, toasts.some((toast) => toast.id === entry.toast.id) ? \"detach\" : \"external\")\n const ordered: ToastEntry<T>[] = []\n for (const toast of incoming) {\n if (this.suppressed.get(toast.id) === toast) continue\n let entry = this.entries.find((item) => item.toast.id === toast.id)\n if (!entry) {\n entry = { toast, removed: false, mounted: false, height: 0, x: 0, y: 0, swiping: false, remaining: toast.duration || config.duration, exitOffset: 0 }\n const mountedEntry = entry\n entry.mountTimer = setTimeout(() => { mountedEntry.mounted = true; this.emit() }, 0)\n } else if (entry.toast !== toast || entry.detached) {\n const restart = entry.removed || entry.toast.type !== toast.type || entry.toast.duration !== toast.duration\n entry.toast = toast\n entry.detached = false\n // Same-id updates restart the current budget; only an actual pause\n // subtracts elapsed time (the public Sonner store/update contract).\n clearTimeout(entry.timer); entry.timer = undefined; entry.started = undefined\n if (restart) {\n clearTimeout(entry.exitTimer); this.pause(entry); entry.removed = false; entry.swipeOut = undefined\n entry.remaining = toast.duration || config.duration\n }\n }\n if (this.gesture?.id === toast.id && (toast.type === \"loading\" || toast.dismissible === false)) { this.gesture = undefined; entry.swiping = false; entry.x = 0; entry.y = 0 }\n if (oldDuration !== config.duration && !toast.duration) { this.pause(entry); entry.remaining = config.duration }\n ordered.push(entry)\n }\n this.entries = [...ordered, ...this.entries.filter((entry) => entry.removed && !present.has(entry.toast.id))]\n for (const id of this.suppressed.keys()) if (!present.has(id)) this.suppressed.delete(id)\n this.refreshTimers()\n this.emit()\n }\n private pause(entry: ToastEntry<T>) {\n if (entry.started !== undefined) entry.remaining = Math.max(0, entry.remaining - (Date.now() - entry.started))\n clearTimeout(entry.timer); entry.timer = undefined; entry.started = undefined\n }\n private refreshTimers() {\n for (const entry of this.entries) {\n if (entry.removed || this.paused || entry.toast.type === \"loading\" || entry.remaining === Infinity) { this.pause(entry); continue }\n if (entry.timer !== undefined) continue\n entry.started = Date.now()\n entry.timer = setTimeout(() => this.close(entry.toast.id, \"auto\"), Math.max(0, entry.remaining))\n }\n }\n position(entry: ToastEntry<T>) { return entry.toast.position ?? this.config.position }\n at(position: Position) { return this.entries.filter((entry) => this.position(entry) === position) }\n offset(entry: ToastEntry<T>) {\n if (entry.removed) return entry.exitOffset\n const siblings = this.at(this.position(entry)).filter((item) => !item.removed)\n return siblings.slice(0, siblings.indexOf(entry)).reduce((sum, item) => sum + item.height + this.config.gap, 0)\n }\n setNode(id: ToastId, node: HTMLElement | null) { if (node) this.nodes.set(id, node); else this.nodes.delete(id) }\n setList(position: Position, node: HTMLElement | null) { if (node) this.lists.set(position, node); else this.lists.delete(position) }\n measure(id: ToastId, height: number) { const entry = this.entries.find((item) => item.toast.id === id); if (entry && entry.height !== height) { entry.height = height; this.emit() } }\n close(id: ToastId, reason: \"dismiss\" | \"auto\" | \"action\" | \"external\" | \"detach\") {\n const entry = this.entries.find((item) => item.toast.id === id)\n if (!entry || entry.removed || reason === \"dismiss\" && (entry.toast.dismissible === false || entry.toast.type === \"loading\")) return\n entry.exitOffset = this.offset(entry)\n entry.removed = true\n this.announced.delete(id)\n this.assertive.delete(id)\n this.pending.delete(id)\n entry.detached = reason === \"detach\"\n this.pause(entry)\n if (this.gesture?.id === id) this.gesture = undefined\n entry.swiping = false\n if (reason === \"dismiss\" || reason === \"auto\" || reason === \"external\") this.notify(reason === \"external\" ? \"dismiss\" : reason, entry.toast)\n const node = this.nodes.get(id)\n if (node?.contains(this.doc?.activeElement ?? null)) this.restoreFocus()\n entry.exitTimer = setTimeout(() => {\n if (reason !== \"detach\") this.suppressed.set(id, entry.toast)\n this.entries = this.entries.filter((item) => item !== entry)\n if (reason !== \"external\" && reason !== \"detach\") this.dismissStore(id)\n this.emit()\n }, EXIT_DURATION)\n this.refreshTimers(); this.emit()\n }\n private ownsFocus(target: EventTarget | null) { return target instanceof Node && [...this.lists.values()].some((list) => list.contains(target)) }\n focusIn(event: FocusEvent) {\n if (!this.focused && event.relatedTarget instanceof HTMLElement && !this.ownsFocus(event.relatedTarget)) this.previousFocus = event.relatedTarget\n this.focused = true; this.refreshTimers(); this.emit()\n }\n focusOut(event: FocusEvent) {\n if (this.ownsFocus(event.relatedTarget)) return\n this.focused = false\n // An intentional move to another control owns focus. Never bounce through the opener.\n if (event.relatedTarget instanceof HTMLElement) this.previousFocus = null\n this.refreshTimers(); this.emit()\n }\n private restoreFocus() {\n const previous = this.previousFocus\n this.previousFocus = null; this.focused = false\n if (previous?.isConnected) previous.focus({ preventScroll: true })\n }\n keyDown(event: KeyboardEvent, hotkey: string[]) {\n if (hotkey.length && hotkey.every((key) => key === event.code || (key === \"altKey\" && event.altKey) || (key === \"ctrlKey\" && event.ctrlKey) || (key === \"metaKey\" && event.metaKey) || (key === \"shiftKey\" && event.shiftKey))) {\n const list = this.lists.values().next().value\n if (list) { event.preventDefault(); list.focus({ preventScroll: true }) }\n } else if (event.key === \"Escape\" && this.ownsFocus(this.doc?.activeElement ?? null)) {\n this.hovered = false; this.restoreFocus(); this.refreshTimers(); this.emit()\n }\n }\n pointerEnter(event: PointerEvent) { this.lastPointerType = event.pointerType; this.hover(event.pointerType !== \"touch\") }\n hover(value: boolean) {\n if (value && (this.lastPointerType === \"touch\" || this.doc?.documentElement.dataset.input === \"touch\" || this.doc?.defaultView?.matchMedia?.(\"(hover: none) and (pointer: coarse)\").matches)) return\n this.hovered = value; this.refreshTimers(); this.emit()\n }\n pointerDown(id: ToastId, event: PointerEvent) {\n this.lastPointerType = event.pointerType\n if (event.pointerType === \"touch\" && this.hovered) { this.hovered = false; this.refreshTimers(); this.emit() }\n const entry = this.entries.find((item) => item.toast.id === id)\n if (this.gesture || !entry || entry.removed || event.button !== 0 || entry.toast.type === \"loading\" || entry.toast.dismissible === false) return\n if (event.target instanceof Element && event.target.closest(\"button, a, input, textarea, select, [contenteditable='true']\")) return\n this.gesture = { id, pointerId: event.pointerId, x: event.clientX, y: event.clientY, started: Date.now() }\n entry.swiping = true\n this.nodes.get(id)?.setPointerCapture?.(event.pointerId)\n this.refreshTimers(); this.emit()\n }\n pointerMove(id: ToastId, event: PointerEvent) {\n const gesture = this.gesture\n const entry = this.entries.find((item) => item.toast.id === id)\n if (!gesture || gesture.id !== id || gesture.pointerId !== event.pointerId || !entry) return\n if (this.doc?.getSelection()?.toString()) return\n const dx = event.clientX - gesture.x, dy = event.clientY - gesture.y\n if (!gesture.axis && Math.max(Math.abs(dx), Math.abs(dy)) > 1) gesture.axis = Math.abs(dx) > Math.abs(dy) ? \"x\" : \"y\"\n const [vertical, horizontal] = this.position(entry).split(\"-\")\n const allowed = this.config.swipeDirections ?? [vertical, horizontal]\n entry.x = gesture.axis === \"x\" && allowed.includes(dx > 0 ? \"right\" : \"left\") ? dx : 0\n entry.y = gesture.axis === \"y\" && allowed.includes(dy > 0 ? \"bottom\" : \"top\") ? dy : 0\n this.emit()\n }\n pointerEnd(id: ToastId, event: PointerEvent, cancelled = false) {\n const gesture = this.gesture\n const entry = this.entries.find((item) => item.toast.id === id)\n if (!gesture || gesture.id !== id || gesture.pointerId !== event.pointerId || !entry) return\n const distance = Math.max(Math.abs(entry.x), Math.abs(entry.y))\n this.gesture = undefined; entry.swiping = false\n if (!cancelled && (distance >= 45 || distance > 3 && distance / Math.max(1, Date.now() - gesture.started) > 0.11)) {\n entry.swipeOut = entry.x ? entry.x > 0 ? \"right\" : \"left\" : entry.y > 0 ? \"down\" : \"up\"\n this.close(id, \"dismiss\")\n } else { entry.x = 0; entry.y = 0 }\n this.refreshTimers(); this.emit()\n }\n}\n\nconst ISOLATED_EVENTS = [\"focusin\", \"focusout\", \"pointerdown\"] as const\n\n/** The words a toast says: its title and description, or a custom toast's text. */\nexport const toastText = (node: HTMLElement) => {\n const words = (element: Element | null | undefined) => element?.textContent?.replace(/\\s+/g, \" \").trim() ?? \"\"\n if (!node.querySelector(\"[data-content]\")) return words(node)\n const title = words(node.querySelector(\"[data-title]\"))\n const description = words(node.querySelector(\"[data-description]\"))\n if (!title || !description) return title || description\n return `${/[.!?…:;。!?]$/u.test(title) ? title : `${title}.`} ${description}`\n}\n\n/** Hides the polite announcer from sight, not from a screen reader. */\nexport const announcerStyle = { position: \"absolute\", width: \"1px\", height: \"1px\", margin: \"-1px\", padding: \"0\", overflow: \"hidden\", clip: \"rect(0 0 0 0)\", clipPath: \"inset(50%)\", whiteSpace: \"nowrap\", border: \"0\" } as const\n\nexport type Offset = number | string | Partial<Record<\"top\" | \"right\" | \"bottom\" | \"left\", number | string>>\nexport const offsetStyles = (offset: Offset | undefined, mobileOffset: Offset | undefined) => {\n const style: Record<string, string> = {}\n for (const [prefix, value, fallback] of [[\"--offset\", offset, \"32px\"], [\"--mobile-offset\", mobileOffset, \"16px\"]] as const) {\n for (const edge of [\"top\", \"right\", \"bottom\", \"left\"] as const) {\n const size = typeof value === \"object\" ? value[edge] ?? fallback : value ?? fallback\n style[`${prefix}-${edge}`] = typeof size === \"number\" ? `${size}px` : size\n }\n }\n return style\n}\n\nexport const documentDirection = (doc: Document | undefined) => {\n const direction = doc?.documentElement.getAttribute(\"dir\")\n if (direction === \"ltr\" || direction === \"rtl\") return direction\n return doc?.defaultView?.getComputedStyle(doc.documentElement).direction === \"rtl\" ? \"rtl\" : \"ltr\"\n}\n"]}
|
|
@@ -26,8 +26,8 @@ const ToolbarComponent = defineComponent({
|
|
|
26
26
|
titleStyle: { type: String, default: "inline" },
|
|
27
27
|
/** Alignment of an inline title. Compact and large titles always start at the leading edge. @default "center" */
|
|
28
28
|
titleAlign: { type: String, default: "center" },
|
|
29
|
-
/** How the bar meets the content scrolled under it on a phone. @default "soft" */
|
|
30
|
-
background: { type: String, default:
|
|
29
|
+
/** How the bar meets the content scrolled under it on a phone. @default "glass" at the top, "soft" at the bottom */
|
|
30
|
+
background: { type: String, default: undefined },
|
|
31
31
|
},
|
|
32
32
|
setup(props, { slots }) {
|
|
33
33
|
const host = inject(TOOLBAR_HOST, null);
|
|
@@ -64,7 +64,7 @@ const ToolbarComponent = defineComponent({
|
|
|
64
64
|
"data-placement": props.placement,
|
|
65
65
|
"data-title-style": props.placement === "top" ? props.titleStyle : undefined,
|
|
66
66
|
"data-title-align": props.placement === "top" ? props.titleAlign : undefined,
|
|
67
|
-
"data-background": props.background === "edge" ? "soft" : props.background,
|
|
67
|
+
"data-background": props.background === "edge" ? "soft" : (props.background ?? (props.placement === "bottom" ? "soft" : "glass")),
|
|
68
68
|
"data-host": host?.kind,
|
|
69
69
|
"data-scrolled": props.placement === "top" && host?.scrolled?.value ? "" : undefined,
|
|
70
70
|
"data-content-below": props.placement === "bottom" && host?.contentBelow?.value ? "" : undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.js","sourceRoot":"","sources":["../../../../src/components/Toolbar/Toolbar.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,CAAC,EACD,MAAM,EACN,eAAe,EACf,SAAS,EACT,OAAO,EACP,GAAG,GAMJ,MAAM,KAAK,CAAA;AACZ,OAAO,CAAC,MAAM,sDAAsD,CAAA;AAmCpE,MAAM,CAAC,MAAM,Y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AM;gBAAE,OAAO,OAAO,CAAA;YAC1E,yGAAyG;YACzG,8FAA8F;YAC9F,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,KAAK,CAAC,QAAQ,CAAA;YACzD,MAAM,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC;gBAChC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,aAAa,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,iBAAiB,EAAE,EAAE,YAAY,CAAC,CAAC;gBACrH,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAA;YACrB,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,CAAC,CAAA;QACzF,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA","sourcesContent":["import {\n computed,\n defineComponent,\n h,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n type ComputedRef,\n type HTMLAttributes,\n type InjectionKey,\n type PropType,\n type Ref,\n} from \"vue\"\nimport s from \"@plexui/styles/components/Toolbar/Toolbar.module.css\"\n\n// Vue port of packages/ui/src/components/Toolbar/Toolbar.tsx. Exports are flat\n// (`ToolbarLeading` for `Toolbar.Leading`, ...).\n\nexport type ToolbarPlacement = \"top\" | \"bottom\"\n/** Title layouts of the phone top bar. */\nexport type ToolbarTitleStyle = \"inline\" | \"large\" | \"compact-large\" | \"compact-medium\"\nexport type ToolbarTitleAlign = \"center\" | \"start\"\n/**\n * How a bar meets the content scrolled under it, after the scroll edge effect of iOS 26:\n * - `\"soft\"`: the canvas color covers the content under the bar's controls and fades out past them, over a light blur\n * - `\"hard\"`: an opaque bar of the canvas color with a line once content is under it\n * - `\"glass\"`: a translucent, blurred bar with a hairline, shown once content is under it\n * - `\"solid\"`: an opaque bar of the canvas color without a line\n */\nexport type BarBackground = \"soft\" | \"hard\" | \"glass\" | \"solid\"\n/** `\"edge\"` is the earlier name of `\"soft\"`. */\nexport type ToolbarBackground = BarBackground | \"edge\"\n\n/**\n * A surface that places phone toolbars: `Page` puts the top bar over its content\n * and reserves the space; `Dialog` puts it under the Sheet's grabber.\n */\nexport type ToolbarHost = {\n kind: \"page\" | \"dialog\"\n setHeight?: (placement: ToolbarPlacement, height: number | undefined) => void\n /** Content has scrolled under the top bar, so its glass casts a shadow and a hard or glass bar shows its line. */\n scrolled?: Ref<boolean>\n /** Content continues under the bottom bar, so a hard or glass bar shows its line. */\n contentBelow?: Ref<boolean>\n /** Calls the listener with the content's scroll offset on every scroll; returns the unsubscribe. A TabBar minimizes with it. */\n subscribeScroll?: (listener: (scrollTop: number) => void) => () => void\n}\n\nexport const TOOLBAR_HOST: InjectionKey<ToolbarHost> = Symbol(\"ToolbarHost\")\n\n// The title style of the top bar, which a large title on a page needs to show itself inline once scrolled.\nconst TOOLBAR_TITLE_STYLE: InjectionKey<ComputedRef<ToolbarTitleStyle | undefined>> = Symbol(\"ToolbarTitleStyle\")\n\n/**\n * A large title on a page scrolls up with the content under the row of controls; the row shows the\n * title inline once it has gone. The distance it travels (the gap above it and its height) goes to\n * `--toolbar-large-title-travel`, in pixels as a number, as the page's `--page-scroll-y` is.\n */\nfunction measureLargeTitle(bar: HTMLElement) {\n if (bar.dataset.titleStyle !== \"large\") return\n const heading = Array.from(bar.children).find((child): child is HTMLElement => child instanceof HTMLElement && child.classList.contains(s.Heading))\n if (!heading) return\n const gap = Number.parseFloat(getComputedStyle(bar).rowGap) || 0\n bar.style.setProperty(\"--toolbar-large-title-travel\", String(heading.offsetHeight + gap))\n}\n\nconst ToolbarComponent = defineComponent({\n name: \"Toolbar\",\n props: {\n /** @default \"top\" */\n placement: { type: String as PropType<ToolbarPlacement>, default: \"top\" },\n /** Layout of `ToolbarTitle` in a top bar. @default \"inline\" */\n titleStyle: { type: String as PropType<ToolbarTitleStyle>, default: \"inline\" },\n /** Alignment of an inline title. Compact and large titles always start at the leading edge. @default \"center\" */\n titleAlign: { type: String as PropType<ToolbarTitleAlign>, default: \"center\" },\n /** How the bar meets the content scrolled under it on a phone. @default \"soft\" */\n background: { type: String as PropType<ToolbarBackground>, default: \"soft\" },\n },\n setup(props, { slots }) {\n const host = inject(TOOLBAR_HOST, null)\n provide(TOOLBAR_TITLE_STYLE, computed(() => (props.placement === \"top\" ? props.titleStyle : undefined)))\n const element = ref<HTMLElement | null>(null)\n let observer: ResizeObserver | undefined\n let reported: ToolbarPlacement | undefined\n onMounted(() => {\n const bar = element.value\n const setHeight = host?.setHeight\n if (!bar || !setHeight) return\n // A desktop layout hides the bar; its height then leaves the host's own header in charge.\n const update = () => {\n if (reported && reported !== props.placement) setHeight(reported, undefined)\n reported = props.placement\n setHeight(props.placement, bar.offsetHeight || undefined)\n measureLargeTitle(bar)\n }\n update()\n observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(bar, { box: \"border-box\" })\n })\n onBeforeUnmount(() => {\n observer?.disconnect()\n if (reported) host?.setHeight?.(reported, undefined)\n })\n return () => h(\"div\", {\n \"ref\": element,\n \"class\": s.Toolbar,\n \"data-toolbar\": \"\",\n \"data-placement\": props.placement,\n \"data-title-style\": props.placement === \"top\" ? props.titleStyle : undefined,\n \"data-title-align\": props.placement === \"top\" ? props.titleAlign : undefined,\n \"data-background\": props.background === \"edge\" ? \"soft\" : props.background,\n \"data-host\": host?.kind,\n \"data-scrolled\": props.placement === \"top\" && host?.scrolled?.value ? \"\" : undefined,\n \"data-content-below\": props.placement === \"bottom\" && host?.contentBelow?.value ? \"\" : undefined,\n }, slots.default?.())\n },\n})\n\n/** Props of `Toolbar`. */\nexport type ToolbarProps = {\n placement?: ToolbarPlacement\n titleStyle?: ToolbarTitleStyle\n titleAlign?: ToolbarTitleAlign\n /** How the bar meets the content scrolled under it on a phone. @default \"soft\" */\n background?: ToolbarBackground\n} & HTMLAttributes\n\n/** A phone toolbar, top or bottom. It never renders at the desktop breakpoint. */\nexport const Toolbar = ToolbarComponent as typeof ToolbarComponent & { new (): { $props: ToolbarProps } }\n\nfunction part(name: string, className: string, role?: string) {\n return defineComponent({\n name,\n setup(_, { slots }) {\n return () => h(\"div\", { class: className, role }, slots.default?.())\n },\n })\n}\n\n/** Items at the leading edge (React `Toolbar.Leading`). */\nexport const ToolbarLeading = part(\"ToolbarLeading\", s.Leading)\n/** Items at the trailing edge (React `Toolbar.Trailing`). */\nexport const ToolbarTrailing = part(\"ToolbarTrailing\", s.Trailing)\n/** Buttons that share one capsule (React `Toolbar.Group`). */\nexport const ToolbarGroup = part(\"ToolbarGroup\", s.Group, \"group\")\n\n/** Custom middle content: a search field, a segmented control or a single centered action (React `Toolbar.Content`). */\nexport const ToolbarContent = defineComponent({\n name: \"ToolbarContent\",\n props: {\n /** Stretch between the leading and trailing items, as a search field does. */\n fill: { type: Boolean, default: false },\n },\n setup(props, { slots }) {\n return () => h(\"div\", { \"class\": s.Content, \"data-fill\": props.fill ? \"\" : undefined }, slots.default?.())\n },\n})\n\n/** The bar title, with an optional second line (React `Toolbar.Title`). */\nexport const ToolbarTitle = defineComponent({\n name: \"ToolbarTitle\",\n inheritAttrs: false,\n props: {\n /** A second, smaller line below the title. The `subtitle` slot takes precedence. */\n subtitle: { type: String, default: undefined },\n /**\n * Heading level. In a Dialog the dialog's own title names the Sheet, so the bar title is hidden\n * from assistive technology there.\n * @default \"h1\"\n */\n as: { type: String as PropType<\"h1\" | \"h2\" | \"h3\">, default: \"h1\" },\n },\n setup(props, { slots, attrs }) {\n const host = inject(TOOLBAR_HOST, null)\n const titleStyle = inject(TOOLBAR_TITLE_STYLE, null)\n return () => {\n // An empty subtitle, from the prop or a slot that renders nothing, leaves the title on one line, as in React.\n const present = (value: unknown) => (Array.isArray(value) ? value.length > 0 : value != null && value !== \"\")\n const subtitle = slots.subtitle?.() ?? props.subtitle\n const heading = h(\"div\", { \"class\": s.Heading, \"aria-hidden\": host?.kind === \"dialog\" ? \"true\" : undefined }, [\n h(props.as, { ...attrs, class: [s.Title, attrs.class] }, slots.default?.()),\n present(subtitle) ? h(\"p\", { class: s.Subtitle }, subtitle) : null,\n ])\n if (titleStyle?.value !== \"large\" || host?.kind !== \"page\") return heading\n // The inline copy the row of controls shows once the large title has scrolled under it. A subtitle stays\n // as a second line, as in the inline title (iOS 26 kit Toolbar - Top - iPhone, Title 2 Line).\n const copySubtitle = slots.subtitle?.() ?? props.subtitle\n const copy = present(copySubtitle)\n ? [h(\"span\", { class: s.CollapsedLine }, slots.default?.()), h(\"span\", { class: s.CollapsedSubtitle }, copySubtitle)]\n : slots.default?.()\n return [heading, h(\"span\", { \"class\": s.CollapsedTitle, \"aria-hidden\": \"true\" }, copy)]\n }\n },\n})\n"]}
|
|
1
|
+
{"version":3,"file":"Toolbar.js","sourceRoot":"","sources":["../../../../src/components/Toolbar/Toolbar.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,CAAC,EACD,MAAM,EACN,eAAe,EACf,SAAS,EACT,OAAO,EACP,GAAG,GAMJ,MAAM,KAAK,CAAA;AACZ,OAAO,CAAC,MAAM,sDAAsD,CAAA;AAqCpE,MAAM,CAAC,MAAM,YAAY,GAA8B,MAAM,CAAC,aAAa,CAAC,CAAA;AAE5E,2GAA2G;AAC3G,MAAM,mBAAmB,GAA6D,MAAM,CAAC,mBAAmB,CAAC,CAAA;AAEjH;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,GAAgB;IACzC,IAAI,GAAG,CAAC,OAAO,CAAC,UAAU,KAAK,OAAO;QAAE,OAAM;IAC9C,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAwB,EAAE,CAAC,KAAK,YAA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,CAAC,CAAC,aAAa,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,iBAAiB,EAAE,EAAE,YAAY,CAAC,CAAC;gBACrH,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAA;YACrB,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,CAAC,CAAA;QACzF,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA","sourcesContent":["import {\n computed,\n defineComponent,\n h,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n type ComputedRef,\n type HTMLAttributes,\n type InjectionKey,\n type PropType,\n type Ref,\n} from \"vue\"\nimport s from \"@plexui/styles/components/Toolbar/Toolbar.module.css\"\n\n// Vue port of packages/ui/src/components/Toolbar/Toolbar.tsx. Exports are flat\n// (`ToolbarLeading` for `Toolbar.Leading`, ...).\n\nexport type ToolbarPlacement = \"top\" | \"bottom\"\n/** Title layouts of the phone top bar. */\nexport type ToolbarTitleStyle = \"inline\" | \"large\" | \"compact-large\" | \"compact-medium\"\nexport type ToolbarTitleAlign = \"center\" | \"start\"\n/**\n * How a bar meets the content scrolled under it, after the scroll edge effect of iOS 26:\n * - `\"soft\"` (the default of a bottom bar): at the top, the canvas color covers the content under the bar's controls and fades out past them, over a\n * light blur; at the bottom of a page the content stays clear under and around the controls, as on native iOS 26,\n * and a Sheet's bottom bar fades its content into the panel\n * - `\"hard\"`: an opaque bar of the canvas color with a line once content is under it\n * - `\"glass\"` (the default of a top bar): a translucent, blurred bar with a hairline, shown once content is under it\n * - `\"solid\"`: an opaque bar of the canvas color without a line\n */\nexport type BarBackground = \"soft\" | \"hard\" | \"glass\" | \"solid\"\n/** `\"edge\"` is the earlier name of `\"soft\"`. */\nexport type ToolbarBackground = BarBackground | \"edge\"\n\n/**\n * A surface that places phone toolbars: `Page` puts the top bar over its content\n * and reserves the space; `Dialog` puts it under the Sheet's grabber.\n */\nexport type ToolbarHost = {\n kind: \"page\" | \"dialog\"\n setHeight?: (placement: ToolbarPlacement, height: number | undefined) => void\n /** Content has scrolled under the top bar, so its glass casts a shadow and a hard or glass bar shows its line. */\n scrolled?: Ref<boolean>\n /** Content continues under the bottom bar, so a hard or glass bar shows its line. */\n contentBelow?: Ref<boolean>\n /** Calls the listener with the content's scroll offset on every scroll; returns the unsubscribe. A TabBar minimizes with it. */\n subscribeScroll?: (listener: (scrollTop: number) => void) => () => void\n}\n\nexport const TOOLBAR_HOST: InjectionKey<ToolbarHost> = Symbol(\"ToolbarHost\")\n\n// The title style of the top bar, which a large title on a page needs to show itself inline once scrolled.\nconst TOOLBAR_TITLE_STYLE: InjectionKey<ComputedRef<ToolbarTitleStyle | undefined>> = Symbol(\"ToolbarTitleStyle\")\n\n/**\n * A large title on a page scrolls up with the content under the row of controls; the row shows the\n * title inline once it has gone. The distance it travels (the gap above it and its height) goes to\n * `--toolbar-large-title-travel`, in pixels as a number, as the page's `--page-scroll-y` is.\n */\nfunction measureLargeTitle(bar: HTMLElement) {\n if (bar.dataset.titleStyle !== \"large\") return\n const heading = Array.from(bar.children).find((child): child is HTMLElement => child instanceof HTMLElement && child.classList.contains(s.Heading))\n if (!heading) return\n const gap = Number.parseFloat(getComputedStyle(bar).rowGap) || 0\n bar.style.setProperty(\"--toolbar-large-title-travel\", String(heading.offsetHeight + gap))\n}\n\nconst ToolbarComponent = defineComponent({\n name: \"Toolbar\",\n props: {\n /** @default \"top\" */\n placement: { type: String as PropType<ToolbarPlacement>, default: \"top\" },\n /** Layout of `ToolbarTitle` in a top bar. @default \"inline\" */\n titleStyle: { type: String as PropType<ToolbarTitleStyle>, default: \"inline\" },\n /** Alignment of an inline title. Compact and large titles always start at the leading edge. @default \"center\" */\n titleAlign: { type: String as PropType<ToolbarTitleAlign>, default: \"center\" },\n /** How the bar meets the content scrolled under it on a phone. @default \"glass\" at the top, \"soft\" at the bottom */\n background: { type: String as PropType<ToolbarBackground>, default: undefined },\n },\n setup(props, { slots }) {\n const host = inject(TOOLBAR_HOST, null)\n provide(TOOLBAR_TITLE_STYLE, computed(() => (props.placement === \"top\" ? props.titleStyle : undefined)))\n const element = ref<HTMLElement | null>(null)\n let observer: ResizeObserver | undefined\n let reported: ToolbarPlacement | undefined\n onMounted(() => {\n const bar = element.value\n const setHeight = host?.setHeight\n if (!bar || !setHeight) return\n // A desktop layout hides the bar; its height then leaves the host's own header in charge.\n const update = () => {\n if (reported && reported !== props.placement) setHeight(reported, undefined)\n reported = props.placement\n setHeight(props.placement, bar.offsetHeight || undefined)\n measureLargeTitle(bar)\n }\n update()\n observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(bar, { box: \"border-box\" })\n })\n onBeforeUnmount(() => {\n observer?.disconnect()\n if (reported) host?.setHeight?.(reported, undefined)\n })\n return () => h(\"div\", {\n \"ref\": element,\n \"class\": s.Toolbar,\n \"data-toolbar\": \"\",\n \"data-placement\": props.placement,\n \"data-title-style\": props.placement === \"top\" ? props.titleStyle : undefined,\n \"data-title-align\": props.placement === \"top\" ? props.titleAlign : undefined,\n \"data-background\": props.background === \"edge\" ? \"soft\" : (props.background ?? (props.placement === \"bottom\" ? \"soft\" : \"glass\")),\n \"data-host\": host?.kind,\n \"data-scrolled\": props.placement === \"top\" && host?.scrolled?.value ? \"\" : undefined,\n \"data-content-below\": props.placement === \"bottom\" && host?.contentBelow?.value ? \"\" : undefined,\n }, slots.default?.())\n },\n})\n\n/** Props of `Toolbar`. */\nexport type ToolbarProps = {\n placement?: ToolbarPlacement\n titleStyle?: ToolbarTitleStyle\n titleAlign?: ToolbarTitleAlign\n /** How the bar meets the content scrolled under it on a phone. @default \"glass\" at the top, \"soft\" at the bottom */\n background?: ToolbarBackground\n} & HTMLAttributes\n\n/** A phone toolbar, top or bottom. It never renders at the desktop breakpoint. */\nexport const Toolbar = ToolbarComponent as typeof ToolbarComponent & { new (): { $props: ToolbarProps } }\n\nfunction part(name: string, className: string, role?: string) {\n return defineComponent({\n name,\n setup(_, { slots }) {\n return () => h(\"div\", { class: className, role }, slots.default?.())\n },\n })\n}\n\n/** Items at the leading edge (React `Toolbar.Leading`). */\nexport const ToolbarLeading = part(\"ToolbarLeading\", s.Leading)\n/** Items at the trailing edge (React `Toolbar.Trailing`). */\nexport const ToolbarTrailing = part(\"ToolbarTrailing\", s.Trailing)\n/** Buttons that share one capsule (React `Toolbar.Group`). */\nexport const ToolbarGroup = part(\"ToolbarGroup\", s.Group, \"group\")\n\n/** Custom middle content: a search field, a segmented control or a single centered action (React `Toolbar.Content`). */\nexport const ToolbarContent = defineComponent({\n name: \"ToolbarContent\",\n props: {\n /** Stretch between the leading and trailing items, as a search field does. */\n fill: { type: Boolean, default: false },\n },\n setup(props, { slots }) {\n return () => h(\"div\", { \"class\": s.Content, \"data-fill\": props.fill ? \"\" : undefined }, slots.default?.())\n },\n})\n\n/** The bar title, with an optional second line (React `Toolbar.Title`). */\nexport const ToolbarTitle = defineComponent({\n name: \"ToolbarTitle\",\n inheritAttrs: false,\n props: {\n /** A second, smaller line below the title. The `subtitle` slot takes precedence. */\n subtitle: { type: String, default: undefined },\n /**\n * Heading level. In a Dialog the dialog's own title names the Sheet, so the bar title is hidden\n * from assistive technology there.\n * @default \"h1\"\n */\n as: { type: String as PropType<\"h1\" | \"h2\" | \"h3\">, default: \"h1\" },\n },\n setup(props, { slots, attrs }) {\n const host = inject(TOOLBAR_HOST, null)\n const titleStyle = inject(TOOLBAR_TITLE_STYLE, null)\n return () => {\n // An empty subtitle, from the prop or a slot that renders nothing, leaves the title on one line, as in React.\n const present = (value: unknown) => (Array.isArray(value) ? value.length > 0 : value != null && value !== \"\")\n const subtitle = slots.subtitle?.() ?? props.subtitle\n const heading = h(\"div\", { \"class\": s.Heading, \"aria-hidden\": host?.kind === \"dialog\" ? \"true\" : undefined }, [\n h(props.as, { ...attrs, class: [s.Title, attrs.class] }, slots.default?.()),\n present(subtitle) ? h(\"p\", { class: s.Subtitle }, subtitle) : null,\n ])\n if (titleStyle?.value !== \"large\" || host?.kind !== \"page\") return heading\n // The inline copy the row of controls shows once the large title has scrolled under it. A subtitle stays\n // as a second line, as in the inline title (iOS 26 kit Toolbar - Top - iPhone, Title 2 Line).\n const copySubtitle = slots.subtitle?.() ?? props.subtitle\n const copy = present(copySubtitle)\n ? [h(\"span\", { class: s.CollapsedLine }, slots.default?.()), h(\"span\", { class: s.CollapsedSubtitle }, copySubtitle)]\n : slots.default?.()\n return [heading, h(\"span\", { \"class\": s.CollapsedTitle, \"aria-hidden\": \"true\" }, copy)]\n }\n },\n})\n"]}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { onBeforeUnmount, onMounted, toValue, watch } from "vue";
|
|
2
|
+
import { inToastRegion } from "../lib/toastRegion.js";
|
|
2
3
|
let handlers = [];
|
|
3
4
|
let listenerBound = false;
|
|
4
5
|
const handleKeyDown = (evt) => {
|
|
5
6
|
if (evt.key === "Escape") {
|
|
6
7
|
// Attempt to call the first handler in the stack, if it exists
|
|
7
8
|
const [firstHandler] = handlers;
|
|
8
|
-
|
|
9
|
+
// Escape in a toast returns focus to where it came from (the toast's own handler); it closes nothing under
|
|
10
|
+
// the toast, only what the toast itself opened
|
|
11
|
+
if (firstHandler && (firstHandler.fromToast || !inToastRegion(evt.target))) {
|
|
9
12
|
evt.preventDefault();
|
|
10
|
-
firstHandler.callback();
|
|
13
|
+
firstHandler.callback(evt);
|
|
11
14
|
}
|
|
12
15
|
}
|
|
13
16
|
};
|
|
@@ -23,11 +26,11 @@ const managerListener = () => {
|
|
|
23
26
|
};
|
|
24
27
|
/**
|
|
25
28
|
* Escape closes the most recently registered listener first, so nested
|
|
26
|
-
* overlays close one at a time.
|
|
29
|
+
* overlays close one at a time. The callback gets the key event, already prevented.
|
|
27
30
|
*/
|
|
28
31
|
export const useEscCloseStack = (listening, cb) => {
|
|
29
32
|
const id = Symbol("esc-close");
|
|
30
|
-
const handler = { id, callback: cb };
|
|
33
|
+
const handler = { id, callback: cb, fromToast: false };
|
|
31
34
|
const unregister = () => {
|
|
32
35
|
handlers = handlers.filter((h) => h.id !== id);
|
|
33
36
|
managerListener();
|
|
@@ -38,6 +41,7 @@ export const useEscCloseStack = (listening, cb) => {
|
|
|
38
41
|
unregister();
|
|
39
42
|
if (!isListening)
|
|
40
43
|
return;
|
|
44
|
+
handler.fromToast = inToastRegion(document.activeElement);
|
|
41
45
|
handlers.unshift(handler);
|
|
42
46
|
managerListener();
|
|
43
47
|
}, { immediate: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEscCloseStack.js","sourceRoot":"","sources":["../../../src/composables/useEscCloseStack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAyB,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"useEscCloseStack.js","sourceRoot":"","sources":["../../../src/composables/useEscCloseStack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAyB,MAAM,KAAK,CAAA;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AASrD,IAAI,QAAQ,GAAc,EAAE,CAAA;AAC5B,IAAI,aAAa,GAAG,KAAK,CAAA;AAEzB,MAAM,aAAa,GAAG,CAAC,GAAkB,EAAE,EAAE;IAC3C,IAAI,GAAG,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;QACzB,+DAA+D;QAC/D,MAAM,CAAC,YAAY,CAAC,GAAG,QAAQ,CAAA;QAE/B,2GAA2G;QAC3G,+CAA+C;QAC/C,IAAI,YAAY,IAAI,CAAC,YAAY,CAAC,SAAS,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,C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,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAA;YACzD,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;YACzB,eAAe,EAAE,CAAA;QACnB,CAAC,EACD,EAAE,SAAS,EAAE,IAAI,EAAE,CACpB,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,eAAe,CAAC,UAAU,CAAC,CAAA;AAC7B,CAAC,CAAA","sourcesContent":["import { onBeforeUnmount, onMounted, toValue, watch, type MaybeRefOrGetter } from \"vue\"\nimport { inToastRegion } from \"../lib/toastRegion.js\"\n\ntype Handler = {\n id: symbol\n callback: (event: KeyboardEvent) => void\n /** Opened from a toast (a Popover in a custom toast): Escape in the toast closes it */\n fromToast: boolean\n}\n\nlet handlers: Handler[] = []\nlet listenerBound = false\n\nconst handleKeyDown = (evt: KeyboardEvent) => {\n if (evt.key === \"Escape\") {\n // Attempt to call the first handler in the stack, if it exists\n const [firstHandler] = handlers\n\n // Escape in a toast returns focus to where it came from (the toast's own handler); it closes nothing under\n // the toast, only what the toast itself opened\n if (firstHandler && (firstHandler.fromToast || !inToastRegion(evt.target))) {\n evt.preventDefault()\n firstHandler.callback(evt)\n }\n }\n}\n\nconst managerListener = () => {\n if (handlers.length > 0 && !listenerBound) {\n document.body.addEventListener(\"keydown\", handleKeyDown)\n listenerBound = true\n } else if (handlers.length === 0 && listenerBound) {\n document.body.removeEventListener(\"keydown\", handleKeyDown)\n listenerBound = false\n }\n}\n\n/**\n * Escape closes the most recently registered listener first, so nested\n * overlays close one at a time. The callback gets the key event, already prevented.\n */\nexport const useEscCloseStack = (listening: MaybeRefOrGetter<boolean>, cb: (event: KeyboardEvent) => void) => {\n const id = Symbol(\"esc-close\")\n const handler: Handler = { id, callback: cb, fromToast: false }\n const unregister = () => {\n handlers = handlers.filter((h) => h.id !== id)\n managerListener()\n }\n\n // Register on mount, like React's effect: nothing global happens during SSR\n onMounted(() => {\n watch(\n () => toValue(listening),\n (isListening) => {\n unregister()\n if (!isListening) return\n handler.fromToast = inToastRegion(document.activeElement)\n handlers.unshift(handler)\n managerListener()\n },\n { immediate: true },\n )\n })\n\n onBeforeUnmount(unregister)\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { onUpdated, shallowRef, watch } from "vue";
|
|
2
2
|
import { observePhoneSubmenu, samePhoneSubmenuState } from "../lib/menuSubmenuPlacement.js";
|
|
3
|
-
|
|
3
|
+
/** `onParentPress` collapses the submenu when a press lands on the parent it stands over. */
|
|
4
|
+
export function usePhoneSubmenu(active, trigger, content, boundary, onParentPress) {
|
|
4
5
|
const state = shallowRef({ mobile: false });
|
|
5
6
|
let observer;
|
|
6
7
|
watch([active, trigger, content, boundary], ([open, triggerElement, contentElement, options], _previous, onCleanup) => {
|
|
@@ -9,7 +10,7 @@ export function usePhoneSubmenu(active, trigger, content, boundary) {
|
|
|
9
10
|
const current = observePhoneSubmenu(triggerElement, contentElement, options, (next) => {
|
|
10
11
|
if (!samePhoneSubmenuState(state.value, next))
|
|
11
12
|
state.value = next;
|
|
12
|
-
});
|
|
13
|
+
}, onParentPress);
|
|
13
14
|
observer = current;
|
|
14
15
|
onCleanup(() => { current.dispose(); observer = undefined; });
|
|
15
16
|
}, { immediate: true, flush: "post" });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePhoneSubmenu.js","sourceRoot":"","sources":["../../../src/composables/usePhoneSubmenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAqC,MAAM,KAAK,CAAA;AACrF,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAqD,MAAM,gCAAgC,CAAA;AAE9I,MAAM,UAAU,eAAe,CAAC,MAAqB,EAAE,OAAuC,EAAE,OAAuC,EAAE,QAA2C;
|
|
1
|
+
{"version":3,"file":"usePhoneSubmenu.js","sourceRoot":"","sources":["../../../src/composables/usePhoneSubmenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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vue\"\nimport { observePhoneSubmenu, samePhoneSubmenuState, type MenuFloatingBoundary, type PhoneSubmenuState } from \"../lib/menuSubmenuPlacement.js\"\n\n/** `onParentPress` collapses the submenu when a press lands on the parent it stands over. */\nexport function usePhoneSubmenu(active: () => boolean, trigger: ShallowRef<HTMLElement | null>, content: ShallowRef<HTMLElement | null>, boundary: ComputedRef<MenuFloatingBoundary>, onParentPress?: () => void) {\n const state = shallowRef<PhoneSubmenuState>({ mobile: false })\n let observer: ReturnType<typeof observePhoneSubmenu> | undefined\n watch([active, trigger, content, boundary], ([open, triggerElement, contentElement, options], _previous, onCleanup) => {\n if (!open || !triggerElement || !contentElement) return\n const current = observePhoneSubmenu(triggerElement, contentElement, options, (next) => {\n if (!samePhoneSubmenuState(state.value, next)) state.value = next\n }, onParentPress)\n observer = current\n onCleanup(() => { current.dispose(); observer = undefined })\n }, { immediate: true, flush: \"post\" })\n onUpdated(() => observer?.refresh())\n return state\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PHONE_LAYOUT_SCOPE } from './phoneLayout.js';
|
|
1
2
|
export function readFloatingFooterInset(root, footer) {
|
|
2
3
|
const view = root.ownerDocument.defaultView;
|
|
3
4
|
if (!view ||
|
|
@@ -41,7 +42,8 @@ export function observeFloatingFooter(root, footer, onChange) {
|
|
|
41
42
|
const start = () => {
|
|
42
43
|
stopMobile?.();
|
|
43
44
|
stopMobile = undefined;
|
|
44
|
-
|
|
45
|
+
// A phone layout keeps its phone geometry at any window width
|
|
46
|
+
if (!media.matches && !root.closest(PHONE_LAYOUT_SCOPE)) {
|
|
45
47
|
onChange(null);
|
|
46
48
|
return;
|
|
47
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floatingBoundary.js","sourceRoot":"","sources":["../../../src/lib/floatingBoundary.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"floatingBoundary.js","sourceRoot":"","sources":["../../../src/lib/floatingBoundary.ts"],"names":[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AoB,CAAC,KAAK,CAAC,CAAC;YAC1D,MAAM,EAAE,UAAU,EAAE,CAAC;YACrB,UAAU,CAAC,UAAU,EAAE,CAAC;YACxB,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;YACnD,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAC7C,IAAI,CAAC,cAAc,EAAE,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAC7D,IAAI,CAAC,cAAc,EAAE,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACjE,CAAC,CAAC;IACN,CAAC,CAAC;IACF,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACxC,KAAK,EAAE,CAAC;IACR,OAAO,GAAG,EAAE;QACR,KAAK,CAAC,mBAAmB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC3C,UAAU,EAAE,EAAE,CAAC;IACnB,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,CAAsB,EAAE,CAAsB;IAClF,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;AACzF,CAAC","sourcesContent":["import { PHONE_LAYOUT_SCOPE } from './phoneLayout.js';\n/** Geometry shared by anchored menus in a Page or Dialog with pinned actions. */\nexport type FloatingFooterInset = { boundary: HTMLElement; bottom: number } | null;\n\nexport function readFloatingFooterInset(\n root: HTMLElement,\n footer: HTMLElement,\n): FloatingFooterInset {\n const view = root.ownerDocument.defaultView;\n if (\n !view ||\n !root.isConnected ||\n !footer.isConnected ||\n footer.ownerDocument !== root.ownerDocument\n )\n return null;\n const rootRect = root.getBoundingClientRect();\n const footerRect = footer.getBoundingClientRect();\n const footerStyle = view.getComputedStyle(footer);\n if (\n rootRect.height <= 0 ||\n footerRect.height <= 0 ||\n footer.hidden ||\n footerStyle.visibility === 'hidden' ||\n footerStyle.visibility === 'collapse'\n )\n return null;\n\n const viewport = view.visualViewport;\n const viewportTop = viewport?.offsetTop ?? 0;\n const viewportBottom =\n viewportTop + (viewport?.height ?? root.ownerDocument.documentElement.clientHeight);\n // Popper clips against the element's client box, excluding its bottom border.\n const scale = root.offsetHeight > 0 ? rootRect.height / root.offsetHeight : 1;\n const rootBottom =\n rootRect.bottom -\n Math.max(0, root.offsetHeight - root.clientHeight - root.clientTop) * scale;\n const visibleTop = Math.max(rootRect.top + root.clientTop * scale, viewportTop);\n const visibleBottom = Math.min(rootBottom, viewportBottom);\n if (visibleBottom <= visibleTop || footerRect.bottom <= visibleTop) return null;\n\n // Clip first, then reserve only the footer portion inside the visible area.\n // A keyboard can clip the Page below its footer; subtracting its full height\n // in that case would unnecessarily shrink the menu a second time.\n const bottom = Math.ceil(Math.max(0, visibleBottom - Math.max(visibleTop, footerRect.top)));\n return { boundary: root, bottom };\n}\n\n/** Observe only for the lifetime of an open popup, and only on Phone. */\nexport function observeFloatingFooter(\n root: HTMLElement,\n footer: HTMLElement,\n onChange: (value: FloatingFooterInset) => void,\n): () => void {\n const view = root.ownerDocument.defaultView;\n if (!view || typeof view.matchMedia !== 'function') return () => undefined;\n const media = view.matchMedia('(max-width: 767px)');\n let stopMobile: (() => void) | undefined;\n const start = () => {\n stopMobile?.();\n stopMobile = undefined;\n // A phone layout keeps its phone geometry at any window width\n if (!media.matches && !root.closest(PHONE_LAYOUT_SCOPE)) {\n onChange(null);\n return;\n }\n let frame: number | undefined;\n const measure = () => {\n frame = undefined;\n onChange(readFloatingFooterInset(root, footer));\n };\n const schedule = () => {\n frame ??= view.requestAnimationFrame(measure);\n };\n const resize =\n typeof ResizeObserver !== 'undefined' ? new ResizeObserver(schedule) : undefined;\n resize?.observe(root, { box: 'border-box' });\n resize?.observe(footer, { box: 'border-box' });\n const visibility = new MutationObserver(schedule);\n visibility.observe(footer, {\n attributes: true,\n attributeFilter: ['hidden', 'class', 'style'],\n });\n view.addEventListener('scroll', schedule, true);\n view.addEventListener('resize', schedule);\n view.visualViewport?.addEventListener('scroll', schedule);\n view.visualViewport?.addEventListener('resize', schedule);\n measure();\n stopMobile = () => {\n if (frame !== undefined) view.cancelAnimationFrame(frame);\n resize?.disconnect();\n visibility.disconnect();\n view.removeEventListener('scroll', schedule, true);\n view.removeEventListener('resize', schedule);\n view.visualViewport?.removeEventListener('scroll', schedule);\n view.visualViewport?.removeEventListener('resize', schedule);\n };\n };\n media.addEventListener('change', start);\n start();\n return () => {\n media.removeEventListener('change', start);\n stopMobile?.();\n };\n}\n\nexport function sameFloatingFooterInset(a: FloatingFooterInset, b: FloatingFooterInset): boolean {\n return a === b || (!!a && !!b && a.boundary === b.boundary && a.bottom === b.bottom);\n}\n"]}
|
package/dist/es/lib/helpers.js
CHANGED
|
@@ -97,6 +97,27 @@ export const toFilterProperty = ({ blur } = {}) => {
|
|
|
97
97
|
};
|
|
98
98
|
/** The `data-*` attributes among a component's props, to pass on to its element. */
|
|
99
99
|
export const dataAttributes = (props) => Object.fromEntries(Object.entries(props).filter(([key]) => key.startsWith("data-")));
|
|
100
|
+
/**
|
|
101
|
+
* A copy of a key event that a handler can cancel. An event that reaches the Escape stack is already prevented, so
|
|
102
|
+
* its own `defaultPrevented` cannot tell whether an owner's handler asked to keep the overlay open. The copy keeps
|
|
103
|
+
* the key, the modifiers and the target.
|
|
104
|
+
*/
|
|
105
|
+
export const cancelableKeyCopy = (event) => {
|
|
106
|
+
const copy = new KeyboardEvent(event.type, {
|
|
107
|
+
key: event.key,
|
|
108
|
+
code: event.code,
|
|
109
|
+
location: event.location,
|
|
110
|
+
repeat: event.repeat,
|
|
111
|
+
isComposing: event.isComposing,
|
|
112
|
+
ctrlKey: event.ctrlKey,
|
|
113
|
+
shiftKey: event.shiftKey,
|
|
114
|
+
altKey: event.altKey,
|
|
115
|
+
metaKey: event.metaKey,
|
|
116
|
+
cancelable: true,
|
|
117
|
+
});
|
|
118
|
+
Object.defineProperty(copy, "target", { value: event.target });
|
|
119
|
+
return copy;
|
|
120
|
+
};
|
|
100
121
|
export const preventDefaultHandler = (evt) => {
|
|
101
122
|
evt.preventDefault();
|
|
102
123
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/lib/helpers.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,8EAA8E;AAC9E,oEAAoE;AAEpE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAGpE,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,IAAI,CAAC,SAAS,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;QAC1D,OAAO,KAAK,CAAA;IACd,CAAC;IAED,OAAO,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC,OAAO,CAAA;AACtE,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,GAAU,EAAE,EAAE;IACtD,MAAM,MAAM,GAAG,GAAG,CAAC,aAAa,CAAA;IAEhC,wEAAwE;IACxE,IAAI,CAAC,CAAC,MAAM,YAAY,WAAW,CAAC,EAAE,CAAC;QACrC,OAAM;IACR,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CAAA;IAEvC,IAAI,KAAK,GAAG,KAAK,CAAA;IAEjB,IAAI,YAAY,IAAI,EAAE,EAAE,CAAC;QACvB,KAAK,GAAG,IAAI,CAAA;IACd,CAAC;SAAM,IAAI,YAAY,IAAI,GAAG,EAAE,CAAC;QAC/B,KAAK,GAAG,IAAI,CAAA;IACd,CAAC;SAAM,IAAI,YAAY,IAAI,GAAG,EAAE,CAAC;QAC/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KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAA;QAErC,wBAAwB;QACxB,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACpC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACjC,SAAQ;QACV,CAAC;QAED,mBAAmB;QACnB,MAAM,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,EAAsC,CAAA;QACjF,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;QAClC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["// Port of packages/ui/src/lib/helpers.ts with Vue-facing types (events are\n// DOM events, style objects are plain records). Keep the logic identical: the\n// parity tests compare the DOM these produce with the React output.\n\nimport { canUseDOM, hasDocument, hasWindow } from \"./environment.js\"\nimport type { Pretty } from \"./utilityTypes.js\"\n\nexport const prefersReducedMotion = () => {\n if (!hasWindow || typeof window.matchMedia !== \"function\") {\n return false\n }\n\n return window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches\n}\n\nexport const handlePressableMouseEnter = (evt: Event) => {\n const target = evt.currentTarget\n\n // Safely coerce type to HTMLElement so TS is peaceful with `evt.target`\n if (!(target instanceof HTMLElement)) {\n return\n }\n\n const elementWidth = target.offsetWidth\n\n let scale = 0.985\n\n if (elementWidth <= 80) {\n scale = 0.96\n } else if (elementWidth <= 150) {\n scale = 0.97\n } else if (elementWidth <= 220) {\n scale = 0.98\n } else if (elementWidth > 600) {\n scale = 0.995\n }\n\n target.style.setProperty(\"--scale\", scale.toString())\n}\n\ninterface CancelAnimationFrame {\n (): void\n}\n\nexport const waitForAnimationFrame = (\n cb: () => void,\n options?: { frames: number },\n): CancelAnimationFrame => {\n const runAfterTick = () => {\n const id = setTimeout(cb)\n return () => {\n clearTimeout(id)\n }\n }\n\n if (!canUseDOM || typeof window.requestAnimationFrame !== \"function\") {\n return runAfterTick()\n }\n\n const visibilityHidden = hasDocument && document.visibilityState === \"hidden\"\n if (visibilityHidden) {\n return runAfterTick()\n }\n\n let frames = options?.frames ?? 2\n let animationFrame = window.requestAnimationFrame(function recurse() {\n frames -= 1\n if (frames === 0) {\n cb()\n } else {\n animationFrame = window.requestAnimationFrame(recurse)\n }\n })\n\n return () => {\n if (typeof window.cancelAnimationFrame === \"function\") {\n window.cancelAnimationFrame(animationFrame)\n }\n }\n}\n\nexport const toCssVariables = (\n variables: Record<string, string | number | undefined>,\n): Record<string, string> => {\n const formattedVariables = Object.keys(variables).reduce(\n (acc, variable) => {\n // Ensure value is truthy\n const value = variables[variable]\n // Accept 0 as a valid value\n if (value || value === 0) {\n // Add the prefix if it wasn't already provided\n const prefix = variable.startsWith(\"--\") ? \"\" : \"--\"\n const formattedValue = typeof value === \"number\" ? `${value}px` : value\n\n acc[`${prefix}${variable}`] = formattedValue\n }\n\n return acc\n },\n {} as Record<string, string>,\n )\n\n // Safe casting because we know we've formatted an object of CSS Variable strings\n return formattedVariables\n}\n\nexport const toAngle = (value: number | string): string =>\n typeof value === \"number\" ? `${value}deg` : value\n\nexport const toOpacityProperty = (opacity: number): string => String(opacity)\n\nexport const toMsDurationProperty = (duration: number): string => `${duration}ms`\n\nexport const toTransformProperty = ({\n x,\n y,\n scale,\n rotate,\n skewX,\n skewY,\n}: {\n x?: number\n y?: number\n scale?: number\n rotate?: number | string\n skewX?: number | string\n skewY?: number | string\n} = {}): string => {\n const transforms = [\n x == null ? null : `translateX(${x}px)`,\n y == null ? null : `translateY(${y}px)`,\n scale == null ? null : `scale(${scale})`,\n rotate == null ? null : `rotate(${toAngle(rotate)})`,\n skewX == null ? null : `skewX(${toAngle(skewX)})`,\n skewY == null ? null : `skewY(${toAngle(skewY)})`,\n ].filter(Boolean)\n\n return transforms.length ? transforms.join(\" \") : \"none\"\n}\n\nexport const toFilterProperty = ({ blur }: { blur?: number | undefined } = {}) => {\n // Maybe add more support in the future\n const filters = [blur == null ? null : `blur(${blur}px)`].filter(Boolean)\n\n return filters.length ? filters.join(\" \") : \"none\"\n}\n\n/** The `data-*` attributes among a component's props, to pass on to its element. */\nexport const dataAttributes = (props: Record<string, unknown>) =>\n Object.fromEntries(Object.entries(props).filter(([key]) => key.startsWith(\"data-\")))\n\nexport const preventDefaultHandler = (evt: Event) => {\n evt.preventDefault()\n}\n\n/**\n * For an overlay's close auto focus: focus that moved on to something else\n * while the overlay left stays there instead of going back to the trigger.\n */\nexport const keepMovedFocus = (evt: Event) => {\n const active = document.activeElement\n const movedOut = !!active && active !== document.body && !(evt.target as Node | null)?.contains(active)\n if (movedOut) evt.preventDefault()\n}\n\n/*\n * Intentionally simple selector string. Purposeful exclusions: (for now)\n * - select, because our selects are better recognized as button\n * - unused selectors like iframe, object, .etc.\n * - states like [inert]\n */\nexport const focusableElements = (element: HTMLElement) =>\n element.querySelectorAll<HTMLElement>(\n 'a[href], input:not([disabled]):not([type=\"hidden\"]), textarea:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex^=\"-\"]), [contenteditable]',\n )\n\nexport const sleep = (ms: number): Promise<void> =>\n new Promise((resolve) => setTimeout(resolve, ms))\n\n/**\n * Group an array of objects by a property, preserving the *first-seen* order\n * of each group.\n *\n * @example\n * groupByOrdered(people, \"team\")\n * // => [ { team: \"infra\", items:[...] }, { team:\"design\", items:[...] }, ... ]\n */\nexport function groupByProperty<T extends object, K extends keyof T, F = T[K]>(\n items: T[],\n key: K,\n format: (raw: T[K], item: T) => F = (raw) => raw as F,\n // Explicit: the inferred `Pretty<...>` is expanded in the published\n // declaration into a form consumers' type checks reject (TS2536)\n): ({ [P in K]: F } & { items: T[] })[] {\n const groups: Pretty<{ [P in K]: F } & { items: T[] }>[] = []\n const indexMap = new Map<unknown, number>() // maps group value -> index in groups array\n\n for (const item of items) {\n const value = format(item[key], item)\n\n // Add to existing group\n const existing = indexMap.get(value)\n if (existing !== undefined) {\n groups[existing].items.push(item)\n continue\n }\n\n // Create new group\n const group = { [key]: value, items: [item] } as { [P in K]: F } & { items: T[] }\n indexMap.set(value, groups.length)\n groups.push(group)\n }\n\n return groups\n}\n"]}
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/lib/helpers.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,8EAA8E;AAC9E,oEAAoE;AAEpE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAGpE,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,IAAI,CAAC,SAAS,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;QAC1D,OAAO,KAAK,CAAA;IACd,CAAC;IAED,OAAO,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC,OAAO,CAAA;AACtE,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,GAAU,EAAE,EAAE;IACtD,MAAM,MAAM,GAAG,GAAG,CAAC,aAAa,CAAA;IAEhC,wEAAwE;IACxE,IAAI,CAAC,CAAC,MAAM,YAAY,WAAW,CAAC,EAAE,CAAC;QACrC,OAAM;IACR,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CAAA;IAEvC,IAAI,KAAK,GAAG,KAAK,CAAA;IAEjB,IAAI,YAAY,IAAI,EAAE,EAAE,CAAC;QACvB,KAAK,GAAG,IAAI,CAAA;IACd,CAAC;SAAM,IAAI,YAAY,IAAI,GAAG,EAAE,CAAC;QAC/B,KAAK,GAAG,IAAI,CAAA;IACd,C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AK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;QAClC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["// Port of packages/ui/src/lib/helpers.ts with Vue-facing types (events are\n// DOM events, style objects are plain records). Keep the logic identical: the\n// parity tests compare the DOM these produce with the React output.\n\nimport { canUseDOM, hasDocument, hasWindow } from \"./environment.js\"\nimport type { Pretty } from \"./utilityTypes.js\"\n\nexport const prefersReducedMotion = () => {\n if (!hasWindow || typeof window.matchMedia !== \"function\") {\n return false\n }\n\n return window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches\n}\n\nexport const handlePressableMouseEnter = (evt: Event) => {\n const target = evt.currentTarget\n\n // Safely coerce type to HTMLElement so TS is peaceful with `evt.target`\n if (!(target instanceof HTMLElement)) {\n return\n }\n\n const elementWidth = target.offsetWidth\n\n let scale = 0.985\n\n if (elementWidth <= 80) {\n scale = 0.96\n } else if (elementWidth <= 150) {\n scale = 0.97\n } else if (elementWidth <= 220) {\n scale = 0.98\n } else if (elementWidth > 600) {\n scale = 0.995\n }\n\n target.style.setProperty(\"--scale\", scale.toString())\n}\n\ninterface CancelAnimationFrame {\n (): void\n}\n\nexport const waitForAnimationFrame = (\n cb: () => void,\n options?: { frames: number },\n): CancelAnimationFrame => {\n const runAfterTick = () => {\n const id = setTimeout(cb)\n return () => {\n clearTimeout(id)\n }\n }\n\n if (!canUseDOM || typeof window.requestAnimationFrame !== \"function\") {\n return runAfterTick()\n }\n\n const visibilityHidden = hasDocument && document.visibilityState === \"hidden\"\n if (visibilityHidden) {\n return runAfterTick()\n }\n\n let frames = options?.frames ?? 2\n let animationFrame = window.requestAnimationFrame(function recurse() {\n frames -= 1\n if (frames === 0) {\n cb()\n } else {\n animationFrame = window.requestAnimationFrame(recurse)\n }\n })\n\n return () => {\n if (typeof window.cancelAnimationFrame === \"function\") {\n window.cancelAnimationFrame(animationFrame)\n }\n }\n}\n\nexport const toCssVariables = (\n variables: Record<string, string | number | undefined>,\n): Record<string, string> => {\n const formattedVariables = Object.keys(variables).reduce(\n (acc, variable) => {\n // Ensure value is truthy\n const value = variables[variable]\n // Accept 0 as a valid value\n if (value || value === 0) {\n // Add the prefix if it wasn't already provided\n const prefix = variable.startsWith(\"--\") ? \"\" : \"--\"\n const formattedValue = typeof value === \"number\" ? `${value}px` : value\n\n acc[`${prefix}${variable}`] = formattedValue\n }\n\n return acc\n },\n {} as Record<string, string>,\n )\n\n // Safe casting because we know we've formatted an object of CSS Variable strings\n return formattedVariables\n}\n\nexport const toAngle = (value: number | string): string =>\n typeof value === \"number\" ? `${value}deg` : value\n\nexport const toOpacityProperty = (opacity: number): string => String(opacity)\n\nexport const toMsDurationProperty = (duration: number): string => `${duration}ms`\n\nexport const toTransformProperty = ({\n x,\n y,\n scale,\n rotate,\n skewX,\n skewY,\n}: {\n x?: number\n y?: number\n scale?: number\n rotate?: number | string\n skewX?: number | string\n skewY?: number | string\n} = {}): string => {\n const transforms = [\n x == null ? null : `translateX(${x}px)`,\n y == null ? null : `translateY(${y}px)`,\n scale == null ? null : `scale(${scale})`,\n rotate == null ? null : `rotate(${toAngle(rotate)})`,\n skewX == null ? null : `skewX(${toAngle(skewX)})`,\n skewY == null ? null : `skewY(${toAngle(skewY)})`,\n ].filter(Boolean)\n\n return transforms.length ? transforms.join(\" \") : \"none\"\n}\n\nexport const toFilterProperty = ({ blur }: { blur?: number | undefined } = {}) => {\n // Maybe add more support in the future\n const filters = [blur == null ? null : `blur(${blur}px)`].filter(Boolean)\n\n return filters.length ? filters.join(\" \") : \"none\"\n}\n\n/** The `data-*` attributes among a component's props, to pass on to its element. */\nexport const dataAttributes = (props: Record<string, unknown>) =>\n Object.fromEntries(Object.entries(props).filter(([key]) => key.startsWith(\"data-\")))\n\n/**\n * A copy of a key event that a handler can cancel. An event that reaches the Escape stack is already prevented, so\n * its own `defaultPrevented` cannot tell whether an owner's handler asked to keep the overlay open. The copy keeps\n * the key, the modifiers and the target.\n */\nexport const cancelableKeyCopy = (event: KeyboardEvent): KeyboardEvent => {\n const copy = new KeyboardEvent(event.type, {\n key: event.key,\n code: event.code,\n location: event.location,\n repeat: event.repeat,\n isComposing: event.isComposing,\n ctrlKey: event.ctrlKey,\n shiftKey: event.shiftKey,\n altKey: event.altKey,\n metaKey: event.metaKey,\n cancelable: true,\n })\n Object.defineProperty(copy, \"target\", { value: event.target })\n return copy\n}\n\nexport const preventDefaultHandler = (evt: Event) => {\n evt.preventDefault()\n}\n\n/**\n * For an overlay's close auto focus: focus that moved on to something else\n * while the overlay left stays there instead of going back to the trigger.\n */\nexport const keepMovedFocus = (evt: Event) => {\n const active = document.activeElement\n const movedOut = !!active && active !== document.body && !(evt.target as Node | null)?.contains(active)\n if (movedOut) evt.preventDefault()\n}\n\n/*\n * Intentionally simple selector string. Purposeful exclusions: (for now)\n * - select, because our selects are better recognized as button\n * - unused selectors like iframe, object, .etc.\n * - states like [inert]\n */\nexport const focusableElements = (element: HTMLElement) =>\n element.querySelectorAll<HTMLElement>(\n 'a[href], input:not([disabled]):not([type=\"hidden\"]), textarea:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex^=\"-\"]), [contenteditable]',\n )\n\nexport const sleep = (ms: number): Promise<void> =>\n new Promise((resolve) => setTimeout(resolve, ms))\n\n/**\n * Group an array of objects by a property, preserving the *first-seen* order\n * of each group.\n *\n * @example\n * groupByOrdered(people, \"team\")\n * // => [ { team: \"infra\", items:[...] }, { team:\"design\", items:[...] }, ... ]\n */\nexport function groupByProperty<T extends object, K extends keyof T, F = T[K]>(\n items: T[],\n key: K,\n format: (raw: T[K], item: T) => F = (raw) => raw as F,\n // Explicit: the inferred `Pretty<...>` is expanded in the published\n // declaration into a form consumers' type checks reject (TS2536)\n): ({ [P in K]: F } & { items: T[] })[] {\n const groups: Pretty<{ [P in K]: F } & { items: T[] }>[] = []\n const indexMap = new Map<unknown, number>() // maps group value -> index in groups array\n\n for (const item of items) {\n const value = format(item[key], item)\n\n // Add to existing group\n const existing = indexMap.get(value)\n if (existing !== undefined) {\n groups[existing].items.push(item)\n continue\n }\n\n // Create new group\n const group = { [key]: value, items: [item] } as { [P in K]: F } & { items: T[] }\n indexMap.set(value, groups.length)\n groups.push(group)\n }\n\n return groups\n}\n"]}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { focusPhoneSubmenuEntry } from "./menuSubmenuPlacement.js";
|
|
2
|
+
import { isPhoneLayout } from "./phoneLayout.js";
|
|
2
3
|
// A root and controlled child can mount together. Keep the root's initial
|
|
3
4
|
// autofocus from visiting outside the portalled child before it is ready.
|
|
4
5
|
const pending = new WeakMap();
|
|
5
|
-
|
|
6
|
+
// A parent hidden behind its phone submenu (menuSubmenuPlacement.ts) is still open
|
|
7
|
+
const EXITING = '[aria-hidden="true"]:not([data-submenu-hidden]), [inert], [data-exiting], [data-exiting-active]';
|
|
6
8
|
function isOpen(element) {
|
|
7
9
|
return element.isConnected && element.getAttribute("data-state") !== "closed" && !element.closest(EXITING);
|
|
8
10
|
}
|
|
@@ -58,7 +60,7 @@ export function delegateInitialPhoneSubmenuFocus(event, content) {
|
|
|
58
60
|
if (event.defaultPrevented || !content || !isOpen(content))
|
|
59
61
|
return;
|
|
60
62
|
const view = content.ownerDocument.defaultView;
|
|
61
|
-
if (!view || !(
|
|
63
|
+
if (!view || !isPhoneLayout(content))
|
|
62
64
|
return;
|
|
63
65
|
const trigger = expandedChild(content);
|
|
64
66
|
if (!trigger)
|
|
@@ -72,7 +74,7 @@ export function deferInitialPhoneSubmenuFocus(event, content, usingKeyboard) {
|
|
|
72
74
|
if (event.defaultPrevented || !content || !isOpen(content) || !content.hasAttribute("data-submenu") || content.hasAttribute("data-submenu-positioned"))
|
|
73
75
|
return;
|
|
74
76
|
const view = content.ownerDocument.defaultView;
|
|
75
|
-
if (!view || !(
|
|
77
|
+
if (!view || !isPhoneLayout(content))
|
|
76
78
|
return;
|
|
77
79
|
const trigger = content.ownerDocument.getElementById(content.getAttribute("aria-labelledby") ?? "");
|
|
78
80
|
if (!trigger || childContent(trigger) !== content || (!usingKeyboard && !pending.has(trigger)))
|