@stonecrop/utilities 0.35.0 → 0.38.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/utilities.d.ts +11 -0
- package/dist/utilities.js +20 -1
- package/dist/utilities.js.map +1 -1
- package/package.json +3 -2
package/dist/utilities.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { App } from 'vue';
|
|
2
2
|
import { ComponentPublicInstance } from 'vue';
|
|
3
3
|
import { Ref } from 'vue';
|
|
4
|
+
import { Temporal } from 'temporal-polyfill';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Default keypress handlers for keyboard navigation
|
|
@@ -8,6 +9,16 @@ import { Ref } from 'vue';
|
|
|
8
9
|
*/
|
|
9
10
|
export declare const defaultKeypressHandlers: KeypressHandlers;
|
|
10
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Reads a `YYYY-MM-DD` day. Anything that is not a real day written exactly that way reads as no day.
|
|
14
|
+
*
|
|
15
|
+
* Not `Temporal.PlainDate.from` alone: it also takes the day out of a date-time, which would show a day
|
|
16
|
+
* field over a date-time column as a day instead of as the mismatch it is.
|
|
17
|
+
* @param day - The day, as `YYYY-MM-DD`
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export declare function fromISODate(day: string): Temporal.PlainDate | undefined;
|
|
21
|
+
|
|
11
22
|
/**
|
|
12
23
|
* Install all utility components
|
|
13
24
|
* @param _app - Vue app instance
|
package/dist/utilities.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { onBeforeUnmount, onMounted, ref, watch } from "vue";
|
|
2
2
|
import { defaultWindow, unrefElement, useEventListener, useFocusWithin } from "@vueuse/core";
|
|
3
|
+
import { Temporal } from "temporal-polyfill";
|
|
3
4
|
//#region src/composables/visibility/index.ts
|
|
4
5
|
/**
|
|
5
6
|
* Tracks the visibility of an element within the viewport.
|
|
@@ -391,6 +392,24 @@ function useKeyboardNav(options) {
|
|
|
391
392
|
});
|
|
392
393
|
}
|
|
393
394
|
//#endregion
|
|
395
|
+
//#region src/dates.ts
|
|
396
|
+
/**
|
|
397
|
+
* Reads a `YYYY-MM-DD` day. Anything that is not a real day written exactly that way reads as no day.
|
|
398
|
+
*
|
|
399
|
+
* Not `Temporal.PlainDate.from` alone: it also takes the day out of a date-time, which would show a day
|
|
400
|
+
* field over a date-time column as a day instead of as the mismatch it is.
|
|
401
|
+
* @param day - The day, as `YYYY-MM-DD`
|
|
402
|
+
* @public
|
|
403
|
+
*/
|
|
404
|
+
function fromISODate(day) {
|
|
405
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(day)) return void 0;
|
|
406
|
+
try {
|
|
407
|
+
return Temporal.PlainDate.from(day);
|
|
408
|
+
} catch {
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
//#endregion
|
|
394
413
|
//#region src/index.ts
|
|
395
414
|
/**
|
|
396
415
|
* Install all utility components
|
|
@@ -399,6 +418,6 @@ function useKeyboardNav(options) {
|
|
|
399
418
|
*/
|
|
400
419
|
function install(_app) {}
|
|
401
420
|
//#endregion
|
|
402
|
-
export { defaultKeypressHandlers, install, useKeyboardNav };
|
|
421
|
+
export { defaultKeypressHandlers, fromISODate, install, useKeyboardNav };
|
|
403
422
|
|
|
404
423
|
//# sourceMappingURL=utilities.js.map
|
package/dist/utilities.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.js","names":[],"sources":["../src/composables/visibility/index.ts","../src/composables/keyboard.ts","../src/index.ts"],"sourcesContent":["import {\n\ttype ConfigurableWindow,\n\ttype MaybeComputedElementRef,\n\tdefaultWindow,\n\tunrefElement,\n\tuseEventListener,\n} from '@vueuse/core'\nimport { ref, watch, type MaybeRefOrGetter } from 'vue'\n\nexport interface UseElementVisibilityOptions extends ConfigurableWindow {\n\tscrollTarget?: MaybeRefOrGetter<HTMLElement | undefined | null>\n}\n\n/**\n * Tracks the visibility of an element within the viewport.\n *\n * Compatibility version to get Stonecrop keyboard navigation to work. This function is a copy of the\n * `useElementVisibility` function from VueUse v9.13.0, with the `IntersectionObserver` API removed.\n *\n * This version uses the `getBoundingClientRect` method to determine if an element is visible\n * in the viewport. This is less performant than the `IntersectionObserver` API, but it is\n * more compatible.\n *\n * Note: the newer versions of the VueUse dependencies imported here are sufficient for this composable.\n * (Last verified: v10.9.0 on May 2, 2024)\n *\n * @see https://v9-13-0.vueuse.org/core/useElementVisibility\n * @param element - Element to track visibility for\n * @param options - Configuration options (window, scrollTarget)\n */\nexport function useElementVisibility(\n\telement: MaybeComputedElementRef,\n\t{ window = defaultWindow, scrollTarget }: UseElementVisibilityOptions = {}\n) {\n\tconst elementIsVisible = ref(false)\n\n\tconst testBounding = () => {\n\t\tif (!window) return\n\n\t\tconst document = window.document\n\t\tconst el = unrefElement(element)\n\t\tif (!el) {\n\t\t\telementIsVisible.value = false\n\t\t} else {\n\t\t\tconst rect = el.getBoundingClientRect()\n\t\t\telementIsVisible.value =\n\t\t\t\trect.top <= (window.innerHeight || document.documentElement.clientHeight) &&\n\t\t\t\trect.left <= (window.innerWidth || document.documentElement.clientWidth) &&\n\t\t\t\trect.bottom >= 0 &&\n\t\t\t\trect.right >= 0\n\t\t}\n\t}\n\n\twatch(\n\t\t() => unrefElement(element),\n\t\t() => testBounding(),\n\t\t{ immediate: true, flush: 'post' }\n\t)\n\n\tif (window) {\n\t\tuseEventListener(scrollTarget || window, 'scroll', testBounding, {\n\t\t\tcapture: false,\n\t\t\tpassive: true,\n\t\t})\n\t}\n\n\treturn elementIsVisible\n}\n","import { type WatchStopHandle, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useFocusWithin } from '@vueuse/core'\n\nimport { useElementVisibility } from './visibility'\nimport type { KeyboardNavigationOptions, KeypressHandlers } from '../types'\n\n// helper functions\nconst isVisible = (element: HTMLElement) => {\n\tlet visible = useElementVisibility(element).value\n\tvisible = visible && element.offsetHeight > 0\n\treturn visible\n}\n\nconst isFocusable = (element: HTMLElement) => {\n\treturn element.tabIndex >= 0\n}\n\n// navigation functions\nconst getUpCell = (event: KeyboardEvent) => {\n\tif (!(event.target instanceof HTMLElement)) return undefined\n\treturn getUpCellEl(event.target)\n}\n\nconst getUpCellEl = (element: HTMLElement): HTMLElement | undefined => {\n\tlet $upCell: HTMLElement | undefined\n\tif (element instanceof HTMLTableCellElement) {\n\t\tconst $prevSibling = element.parentElement?.previousElementSibling\n\t\tif ($prevSibling instanceof HTMLTableRowElement) {\n\t\t\tconst $prevRowCells = Array.from($prevSibling.children)\n\t\t\tconst $cellEl = $prevRowCells[element.cellIndex]\n\t\t\tif ($cellEl instanceof HTMLElement) {\n\t\t\t\t$upCell = $cellEl\n\t\t\t}\n\t\t}\n\t} else if (element instanceof HTMLTableRowElement) {\n\t\tconst $prevSibling = element.previousElementSibling\n\t\tif ($prevSibling instanceof HTMLTableRowElement) {\n\t\t\t$upCell = $prevSibling\n\t\t}\n\t} else {\n\t\t// handle other contexts\n\t}\n\tif ($upCell && (!isFocusable($upCell) || !isVisible($upCell))) {\n\t\treturn getUpCellEl($upCell)\n\t}\n\treturn $upCell\n}\n\nconst getTopCell = (event: KeyboardEvent) => {\n\tif (!(event.target instanceof HTMLElement)) return undefined\n\tconst $target = event.target\n\tlet $topCell: HTMLElement | undefined\n\tif ($target instanceof HTMLTableCellElement) {\n\t\tconst $table = $target.parentElement?.parentElement\n\t\tif ($table) {\n\t\t\tconst $firstRow = $table.firstElementChild\n\t\t\tconst $navEl = $firstRow?.children[$target.cellIndex]\n\t\t\tif ($navEl instanceof HTMLElement) {\n\t\t\t\t$topCell = $navEl\n\t\t\t}\n\t\t}\n\t} else if ($target instanceof HTMLTableRowElement) {\n\t\tconst $parent = $target.parentElement\n\t\tif ($parent) {\n\t\t\tconst $firstEl = $parent.firstElementChild\n\t\t\tif ($firstEl instanceof HTMLTableRowElement) {\n\t\t\t\t$topCell = $firstEl\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// handle other contexts\n\t}\n\tif ($topCell && (!isFocusable($topCell) || !isVisible($topCell))) {\n\t\treturn getDownCellEl($topCell)\n\t}\n\treturn $topCell\n}\n\nconst getDownCell = (event: KeyboardEvent) => {\n\tif (!(event.target instanceof HTMLElement)) return undefined\n\treturn getDownCellEl(event.target)\n}\n\nconst getDownCellEl = (element: HTMLElement): HTMLElement | undefined => {\n\tlet $downCell: HTMLElement | undefined\n\tif (element instanceof HTMLTableCellElement) {\n\t\tconst $nextSibling = element.parentElement?.nextElementSibling\n\t\tif ($nextSibling) {\n\t\t\tconst $nextRowCells = Array.from($nextSibling.children)\n\t\t\tconst $cellEl = $nextRowCells[element.cellIndex]\n\t\t\tif ($cellEl instanceof HTMLElement) {\n\t\t\t\t$downCell = $cellEl\n\t\t\t}\n\t\t}\n\t} else if (element instanceof HTMLTableRowElement) {\n\t\tconst $nextSibling = element.nextElementSibling\n\t\tif ($nextSibling instanceof HTMLTableRowElement) {\n\t\t\t$downCell = $nextSibling\n\t\t}\n\t} else {\n\t\t// handle other contexts\n\t}\n\tif ($downCell && (!isFocusable($downCell) || !isVisible($downCell))) {\n\t\treturn getDownCellEl($downCell)\n\t}\n\treturn $downCell\n}\n\nconst getBottomCell = (event: KeyboardEvent) => {\n\tif (!(event.target instanceof HTMLElement)) return undefined\n\tconst $target = event.target\n\tlet $bottomCell: HTMLElement | undefined\n\tif ($target instanceof HTMLTableCellElement) {\n\t\tconst $table = $target.parentElement?.parentElement\n\t\tif ($table) {\n\t\t\tconst $lastRow = $table.lastElementChild\n\t\t\tconst $navEl = $lastRow?.children[$target.cellIndex]\n\t\t\tif ($navEl instanceof HTMLElement) {\n\t\t\t\t$bottomCell = $navEl\n\t\t\t}\n\t\t}\n\t} else if ($target instanceof HTMLTableRowElement) {\n\t\tconst $parent = $target.parentElement\n\t\tif ($parent) {\n\t\t\tconst $lastEl = $parent.lastElementChild\n\t\t\tif ($lastEl instanceof HTMLTableRowElement) {\n\t\t\t\t$bottomCell = $lastEl\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// handle other contexts\n\t}\n\tif ($bottomCell && (!isFocusable($bottomCell) || !isVisible($bottomCell))) {\n\t\treturn getUpCellEl($bottomCell)\n\t}\n\treturn $bottomCell\n}\n\nconst getPrevCell = (event: KeyboardEvent) => {\n\tif (!(event.target instanceof HTMLElement)) return undefined\n\treturn getPrevCellEl(event.target)\n}\n\nconst getPrevCellEl = (element: HTMLElement): HTMLElement | undefined => {\n\tlet $prevCell: HTMLElement | undefined\n\tconst $prevSibling = element.previousElementSibling\n\tif ($prevSibling instanceof HTMLElement) {\n\t\t$prevCell = $prevSibling\n\t} else {\n\t\tconst $prevRow = element.parentElement?.previousElementSibling\n\t\tconst $lastEl = $prevRow?.lastElementChild\n\t\tif ($lastEl instanceof HTMLElement) {\n\t\t\t$prevCell = $lastEl\n\t\t}\n\t}\n\tif ($prevCell && (!isFocusable($prevCell) || !isVisible($prevCell))) {\n\t\treturn getPrevCellEl($prevCell)\n\t}\n\treturn $prevCell\n}\n\nconst getNextCell = (event: KeyboardEvent) => {\n\tif (!(event.target instanceof HTMLElement)) return undefined\n\treturn getNextCellEl(event.target)\n}\n\nconst getNextCellEl = (element: HTMLElement): HTMLElement | undefined => {\n\tlet $nextCell: HTMLElement | undefined\n\tconst $nextSibling = element.nextElementSibling\n\tif ($nextSibling instanceof HTMLElement) {\n\t\t$nextCell = $nextSibling\n\t} else {\n\t\tconst $nextRow = element.parentElement?.nextElementSibling\n\t\tconst $firstEl = $nextRow?.firstElementChild\n\t\tif ($firstEl instanceof HTMLElement) {\n\t\t\t$nextCell = $firstEl\n\t\t}\n\t}\n\tif ($nextCell && (!isFocusable($nextCell) || !isVisible($nextCell))) {\n\t\treturn getNextCellEl($nextCell)\n\t}\n\treturn $nextCell\n}\n\nconst getFirstCell = (event: KeyboardEvent) => {\n\tif (!(event.target instanceof HTMLElement)) return undefined\n\tconst $parent = event.target.parentElement\n\tconst $firstEl = $parent?.firstElementChild\n\tconst $firstCell = $firstEl instanceof HTMLElement ? $firstEl : null\n\tif ($firstCell && (!isFocusable($firstCell) || !isVisible($firstCell))) {\n\t\treturn getNextCellEl($firstCell)\n\t}\n\treturn $firstCell\n}\n\nconst getLastCell = (event: KeyboardEvent) => {\n\tif (!(event.target instanceof HTMLElement)) return undefined\n\tconst $parent = event.target.parentElement\n\tconst $lastEl = $parent?.lastElementChild\n\tconst $lastCell = $lastEl instanceof HTMLElement ? $lastEl : null\n\tif ($lastCell && (!isFocusable($lastCell) || !isVisible($lastCell))) {\n\t\treturn getPrevCellEl($lastCell)\n\t}\n\treturn $lastCell\n}\n\nconst modifierKeys = ['alt', 'control', 'shift', 'meta']\n\nconst eventKeyMap: Record<string, string> = {\n\tArrowUp: 'up',\n\tArrowDown: 'down',\n\tArrowLeft: 'left',\n\tArrowRight: 'right',\n}\n\n/**\n * Default keypress handlers for keyboard navigation\n * @public\n */\nexport const defaultKeypressHandlers: KeypressHandlers = {\n\t'keydown.up': (event: KeyboardEvent) => {\n\t\tconst $upCell = getUpCell(event)\n\t\tif ($upCell) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\t$upCell.focus()\n\t\t}\n\t},\n\t'keydown.down': (event: KeyboardEvent) => {\n\t\tconst $downCell = getDownCell(event)\n\t\tif ($downCell) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\t$downCell.focus()\n\t\t}\n\t},\n\t'keydown.left': (event: KeyboardEvent) => {\n\t\tconst $prevCell = getPrevCell(event)\n\t\t// prevent default edit-cell behaviour on first cell\n\t\tevent.preventDefault()\n\t\tevent.stopPropagation()\n\t\tif ($prevCell) {\n\t\t\t$prevCell.focus()\n\t\t}\n\t},\n\t'keydown.right': (event: KeyboardEvent) => {\n\t\tconst $nextCell = getNextCell(event)\n\t\t// prevent default edit-cell behaviour on last cell\n\t\tevent.preventDefault()\n\t\tevent.stopPropagation()\n\t\tif ($nextCell) {\n\t\t\t$nextCell.focus()\n\t\t}\n\t},\n\t'keydown.control.up': (event: KeyboardEvent) => {\n\t\tconst $topCell = getTopCell(event)\n\t\tif ($topCell) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\t$topCell.focus()\n\t\t}\n\t},\n\t'keydown.control.down': (event: KeyboardEvent) => {\n\t\tconst $bottomCell = getBottomCell(event)\n\t\tif ($bottomCell) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\t$bottomCell.focus()\n\t\t}\n\t},\n\t'keydown.control.left': (event: KeyboardEvent) => {\n\t\tconst $firstCell = getFirstCell(event)\n\t\tif ($firstCell) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\t$firstCell.focus()\n\t\t}\n\t},\n\t'keydown.control.right': (event: KeyboardEvent) => {\n\t\tconst $lastCell = getLastCell(event)\n\t\tif ($lastCell) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\t$lastCell.focus()\n\t\t}\n\t},\n\t'keydown.end': (event: KeyboardEvent) => {\n\t\tconst $lastCell = getLastCell(event)\n\t\tif ($lastCell) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\t$lastCell.focus()\n\t\t}\n\t},\n\t'keydown.enter': (event: KeyboardEvent) => {\n\t\tif (!(event.target instanceof HTMLElement)) return\n\t\tconst $target = event.target\n\t\tif ($target instanceof HTMLTableCellElement) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tconst $downCell = getDownCell(event)\n\t\t\tif ($downCell) {\n\t\t\t\t$downCell.focus()\n\t\t\t}\n\t\t} else {\n\t\t\t// handle other contexts\n\t\t}\n\t},\n\t'keydown.shift.enter': (event: KeyboardEvent) => {\n\t\tif (!(event.target instanceof HTMLElement)) return\n\t\tconst $target = event.target\n\t\tif ($target instanceof HTMLTableCellElement) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tconst $upCell = getUpCell(event)\n\t\t\tif ($upCell) {\n\t\t\t\t$upCell.focus()\n\t\t\t}\n\t\t} else {\n\t\t\t// handle other contexts\n\t\t}\n\t},\n\t'keydown.home': (event: KeyboardEvent) => {\n\t\tconst $firstCell = getFirstCell(event)\n\t\tif ($firstCell) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\t$firstCell.focus()\n\t\t}\n\t},\n\t'keydown.tab': (event: KeyboardEvent) => {\n\t\tconst $nextCell = getNextCell(event)\n\t\tif ($nextCell) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\t$nextCell.focus()\n\t\t}\n\t},\n\t'keydown.shift.tab': (event: KeyboardEvent) => {\n\t\tconst $prevCell = getPrevCell(event)\n\t\tif ($prevCell) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\t$prevCell.focus()\n\t\t}\n\t},\n}\n\n/**\n * Gets the parent element from a keyboard navigation option.\n * @internal\n */\nfunction getParentElement(option: KeyboardNavigationOptions): HTMLElement | null {\n\tlet $parent: HTMLElement | null = null\n\tif (option.parent) {\n\t\tif (typeof option.parent === 'string') {\n\t\t\t$parent = document.querySelector(option.parent)\n\t\t} else if (option.parent instanceof HTMLElement) {\n\t\t\t$parent = option.parent\n\t\t} else {\n\t\t\t$parent = option.parent.value\n\t\t}\n\t}\n\treturn $parent\n}\n\n/**\n * Keyboard navigation composable\n * @param options - Keyboard navigation options\n * @public\n */\nexport function useKeyboardNav(options: KeyboardNavigationOptions[]) {\n\tconst getSelectorsFromOption = (option: KeyboardNavigationOptions) => {\n\t\t// assumes that option.selectors is provided\n\t\tconst $parent = getParentElement(option)\n\t\tlet selectors: HTMLElement[] = []\n\t\tif (typeof option.selectors === 'string') {\n\t\t\tselectors = $parent\n\t\t\t\t? Array.from($parent.querySelectorAll(option.selectors))\n\t\t\t\t: Array.from(document.querySelectorAll(option.selectors))\n\t\t} else if (Array.isArray(option.selectors)) {\n\t\t\tfor (const element of option.selectors) {\n\t\t\t\tif (element instanceof HTMLElement) {\n\t\t\t\t\tselectors.push(element)\n\t\t\t\t} else {\n\t\t\t\t\t// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- Vue component $el is typed as any; shape guaranteed by VNode contract\n\t\t\t\t\tselectors.push(element.$el as HTMLElement)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (option.selectors instanceof HTMLElement) {\n\t\t\tselectors.push(option.selectors)\n\t\t} else if (option.selectors?.value) {\n\t\t\tif (Array.isArray(option.selectors.value)) {\n\t\t\t\tfor (const element of option.selectors.value) {\n\t\t\t\t\tif (element instanceof HTMLElement) {\n\t\t\t\t\t\tselectors.push(element)\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- Vue component $el is typed as any; shape guaranteed by VNode contract\n\t\t\t\t\t\tselectors.push(element.$el as HTMLElement)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tselectors.push(option.selectors.value)\n\t\t\t}\n\t\t}\n\t\treturn selectors\n\t}\n\n\tconst getSelectors = (option: KeyboardNavigationOptions) => {\n\t\tconst $parent = getParentElement(option)\n\t\tlet selectors: HTMLElement[] = []\n\t\tif (option.selectors) {\n\t\t\tselectors = getSelectorsFromOption(option)\n\t\t} else if ($parent) {\n\t\t\t// TODO: what should happen if no parent or selectors are provided?\n\t\t\tconst $children = Array.from($parent.children).filter((el): el is HTMLElement => el instanceof HTMLElement)\n\t\t\tselectors = $children.filter(selector => {\n\t\t\t\t// ignore elements not in the tab order or are not visible\n\t\t\t\treturn isFocusable(selector) && isVisible(selector)\n\t\t\t})\n\t\t}\n\t\treturn selectors\n\t}\n\n\tconst getEventListener = (option: KeyboardNavigationOptions) => {\n\t\treturn (event: KeyboardEvent) => {\n\t\t\tconst activeKey = eventKeyMap[event.key] || event.key.toLowerCase()\n\t\t\tif (modifierKeys.includes(activeKey)) return // ignore modifier key presses\n\n\t\t\tconst handlers = option.handlers || defaultKeypressHandlers\n\t\t\tfor (const key of Object.keys(handlers)) {\n\t\t\t\tconst [eventType, ...keys] = key.split('.')\n\t\t\t\tif (eventType !== 'keydown') {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif (keys.includes(activeKey)) {\n\t\t\t\t\tconst listener = handlers[key]\n\n\t\t\t\t\t// check if the handler has modifiers, and if the modifier is active;\n\t\t\t\t\t// this is to ensure exact key-press matches\n\t\t\t\t\tconst hasModifier = keys.filter(k => modifierKeys.includes(k))\n\t\t\t\t\tconst isModifierActive = modifierKeys.some(mk => {\n\t\t\t\t\t\tconst modifierKey = mk.charAt(0).toUpperCase() + mk.slice(1)\n\t\t\t\t\t\treturn event.getModifierState(modifierKey)\n\t\t\t\t\t})\n\n\t\t\t\t\tif (hasModifier.length > 0) {\n\t\t\t\t\t\tif (isModifierActive) {\n\t\t\t\t\t\t\tfor (const modifier of modifierKeys) {\n\t\t\t\t\t\t\t\tif (keys.includes(modifier)) {\n\t\t\t\t\t\t\t\t\t// docs: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState\n\t\t\t\t\t\t\t\t\tconst modifierKey = modifier.charAt(0).toUpperCase() + modifier.slice(1)\n\t\t\t\t\t\t\t\t\tif (event.getModifierState(modifierKey)) {\n\t\t\t\t\t\t\t\t\t\tlistener(event)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (!isModifierActive) {\n\t\t\t\t\t\t\tlistener(event)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tconst watchStopHandlers: WatchStopHandle[] = []\n\tonMounted(() => {\n\t\tfor (const option of options) {\n\t\t\tconst $parent = getParentElement(option)\n\t\t\tconst selectors = getSelectors(option)\n\t\t\tconst listener = getEventListener(option)\n\t\t\tconst listenerElements = $parent\n\t\t\t\t? [$parent] // watch for focus recursively within the parent element\n\t\t\t\t: selectors // watch for focus on each selector element TODO: too much JS?\n\n\t\t\tfor (const element of listenerElements) {\n\t\t\t\tconst { focused } = useFocusWithin(ref(element))\n\t\t\t\tconst stopHandler = watch(focused, value => {\n\t\t\t\t\tif (value) {\n\t\t\t\t\t\telement.addEventListener('keydown', listener)\n\t\t\t\t\t} else {\n\t\t\t\t\t\telement.removeEventListener('keydown', listener)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\twatchStopHandlers.push(stopHandler)\n\t\t\t}\n\t\t}\n\t})\n\n\tonBeforeUnmount(() => {\n\t\tfor (const stopHandler of watchStopHandlers) {\n\t\t\tstopHandler()\n\t\t}\n\t})\n}\n","import { App } from 'vue'\n\nimport { defaultKeypressHandlers, useKeyboardNav } from './composables/keyboard'\nexport type * from './types'\n\n/**\n * Install all utility components\n * @param _app - Vue app instance\n * @public\n */\nfunction install(_app: App /* options */) {}\n\nexport { defaultKeypressHandlers, install, useKeyboardNav }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,qBACf,SACA,EAAE,SAAS,eAAe,iBAA8C,CAAC,GACxE;CACD,MAAM,mBAAmB,IAAI,KAAK;CAElC,MAAM,qBAAqB;EAC1B,IAAI,CAAC,QAAQ;EAEb,MAAM,WAAW,OAAO;EACxB,MAAM,KAAK,aAAa,OAAO;EAC/B,IAAI,CAAC,IACJ,iBAAiB,QAAQ;OACnB;GACN,MAAM,OAAO,GAAG,sBAAsB;GACtC,iBAAiB,QAChB,KAAK,QAAQ,OAAO,eAAe,SAAS,gBAAgB,iBAC5D,KAAK,SAAS,OAAO,cAAc,SAAS,gBAAgB,gBAC5D,KAAK,UAAU,KACf,KAAK,SAAS;EAChB;CACD;CAEA,YACO,aAAa,OAAO,SACpB,aAAa,GACnB;EAAE,WAAW;EAAM,OAAO;CAAO,CAClC;CAEA,IAAI,QACH,iBAAiB,gBAAgB,Q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
1
|
+
{"version":3,"file":"utilities.js","names":[],"sources":["../src/composables/visibility/index.ts","../src/composables/keyboard.ts","../src/dates.ts","../src/index.ts"],"sourcesContent":["import {\n\ttype ConfigurableWindow,\n\ttype MaybeComputedElementRef,\n\tdefaultWindow,\n\tunrefElement,\n\tuseEventListener,\n} from '@vueuse/core'\nimport { ref, watch, type MaybeRefOrGetter } from 'vue'\n\nexport interface UseElementVisibilityOptions extends ConfigurableWindow {\n\tscrollTarget?: MaybeRefOrGetter<HTMLElement | undefined | null>\n}\n\n/**\n * Tracks the visibility of an element within the viewport.\n *\n * Compatibility version to get Stonecrop keyboard navigation to work. This function is a copy of the\n * `useElementVisibility` function from VueUse v9.13.0, with the `IntersectionObserver` API removed.\n *\n * This version uses the `getBoundingClientRect` method to determine if an element is visible\n * in the viewport. This is less performant than the `IntersectionObserver` API, but it is\n * more compatible.\n *\n * Note: the newer versions of the VueUse dependencies imported here are sufficient for this composable.\n * (Last verified: v10.9.0 on May 2, 2024)\n *\n * @see https://v9-13-0.vueuse.org/core/useElementVisibility\n * @param element - Element to track visibility for\n * @param options - Configuration options (window, scrollTarget)\n */\nexport function useElementVisibility(\n\telement: MaybeComputedElementRef,\n\t{ window = defaultWindow, scrollTarget }: UseElementVisibilityOptions = {}\n) {\n\tconst elementIsVisible = ref(false)\n\n\tconst testBounding = () => {\n\t\tif (!window) return\n\n\t\tconst document = window.document\n\t\tconst el = unrefElement(element)\n\t\tif (!el) {\n\t\t\telementIsVisible.value = false\n\t\t} else {\n\t\t\tconst rect = el.getBoundingClientRect()\n\t\t\telementIsVisible.value =\n\t\t\t\trect.top <= (window.innerHeight || document.documentElement.clientHeight) &&\n\t\t\t\trect.left <= (window.innerWidth || document.documentElement.clientWidth) &&\n\t\t\t\trect.bottom >= 0 &&\n\t\t\t\trect.right >= 0\n\t\t}\n\t}\n\n\twatch(\n\t\t() => unrefElement(element),\n\t\t() => testBounding(),\n\t\t{ immediate: true, flush: 'post' }\n\t)\n\n\tif (window) {\n\t\tuseEventListener(scrollTarget || window, 'scroll', testBounding, {\n\t\t\tcapture: false,\n\t\t\tpassive: true,\n\t\t})\n\t}\n\n\treturn elementIsVisible\n}\n","import { type WatchStopHandle, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useFocusWithin } from '@vueuse/core'\n\nimport { useElementVisibility } from './visibility'\nimport type { KeyboardNavigationOptions, KeypressHandlers } from '../types'\n\n// helper functions\nconst isVisible = (element: HTMLElement) => {\n\tlet visible = useElementVisibility(element).value\n\tvisible = visible && element.offsetHeight > 0\n\treturn visible\n}\n\nconst isFocusable = (element: HTMLElement) => {\n\treturn element.tabIndex >= 0\n}\n\n// navigation functions\nconst getUpCell = (event: KeyboardEvent) => {\n\tif (!(event.target instanceof HTMLElement)) return undefined\n\treturn getUpCellEl(event.target)\n}\n\nconst getUpCellEl = (element: HTMLElement): HTMLElement | undefined => {\n\tlet $upCell: HTMLElement | undefined\n\tif (element instanceof HTMLTableCellElement) {\n\t\tconst $prevSibling = element.parentElement?.previousElementSibling\n\t\tif ($prevSibling instanceof HTMLTableRowElement) {\n\t\t\tconst $prevRowCells = Array.from($prevSibling.children)\n\t\t\tconst $cellEl = $prevRowCells[element.cellIndex]\n\t\t\tif ($cellEl instanceof HTMLElement) {\n\t\t\t\t$upCell = $cellEl\n\t\t\t}\n\t\t}\n\t} else if (element instanceof HTMLTableRowElement) {\n\t\tconst $prevSibling = element.previousElementSibling\n\t\tif ($prevSibling instanceof HTMLTableRowElement) {\n\t\t\t$upCell = $prevSibling\n\t\t}\n\t} else {\n\t\t// handle other contexts\n\t}\n\tif ($upCell && (!isFocusable($upCell) || !isVisible($upCell))) {\n\t\treturn getUpCellEl($upCell)\n\t}\n\treturn $upCell\n}\n\nconst getTopCell = (event: KeyboardEvent) => {\n\tif (!(event.target instanceof HTMLElement)) return undefined\n\tconst $target = event.target\n\tlet $topCell: HTMLElement | undefined\n\tif ($target instanceof HTMLTableCellElement) {\n\t\tconst $table = $target.parentElement?.parentElement\n\t\tif ($table) {\n\t\t\tconst $firstRow = $table.firstElementChild\n\t\t\tconst $navEl = $firstRow?.children[$target.cellIndex]\n\t\t\tif ($navEl instanceof HTMLElement) {\n\t\t\t\t$topCell = $navEl\n\t\t\t}\n\t\t}\n\t} else if ($target instanceof HTMLTableRowElement) {\n\t\tconst $parent = $target.parentElement\n\t\tif ($parent) {\n\t\t\tconst $firstEl = $parent.firstElementChild\n\t\t\tif ($firstEl instanceof HTMLTableRowElement) {\n\t\t\t\t$topCell = $firstEl\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// handle other contexts\n\t}\n\tif ($topCell && (!isFocusable($topCell) || !isVisible($topCell))) {\n\t\treturn getDownCellEl($topCell)\n\t}\n\treturn $topCell\n}\n\nconst getDownCell = (event: KeyboardEvent) => {\n\tif (!(event.target instanceof HTMLElement)) return undefined\n\treturn getDownCellEl(event.target)\n}\n\nconst getDownCellEl = (element: HTMLElement): HTMLElement | undefined => {\n\tlet $downCell: HTMLElement | undefined\n\tif (element instanceof HTMLTableCellElement) {\n\t\tconst $nextSibling = element.parentElement?.nextElementSibling\n\t\tif ($nextSibling) {\n\t\t\tconst $nextRowCells = Array.from($nextSibling.children)\n\t\t\tconst $cellEl = $nextRowCells[element.cellIndex]\n\t\t\tif ($cellEl instanceof HTMLElement) {\n\t\t\t\t$downCell = $cellEl\n\t\t\t}\n\t\t}\n\t} else if (element instanceof HTMLTableRowElement) {\n\t\tconst $nextSibling = element.nextElementSibling\n\t\tif ($nextSibling instanceof HTMLTableRowElement) {\n\t\t\t$downCell = $nextSibling\n\t\t}\n\t} else {\n\t\t// handle other contexts\n\t}\n\tif ($downCell && (!isFocusable($downCell) || !isVisible($downCell))) {\n\t\treturn getDownCellEl($downCell)\n\t}\n\treturn $downCell\n}\n\nconst getBottomCell = (event: KeyboardEvent) => {\n\tif (!(event.target instanceof HTMLElement)) return undefined\n\tconst $target = event.target\n\tlet $bottomCell: HTMLElement | undefined\n\tif ($target instanceof HTMLTableCellElement) {\n\t\tconst $table = $target.parentElement?.parentElement\n\t\tif ($table) {\n\t\t\tconst $lastRow = $table.lastElementChild\n\t\t\tconst $navEl = $lastRow?.children[$target.cellIndex]\n\t\t\tif ($navEl instanceof HTMLElement) {\n\t\t\t\t$bottomCell = $navEl\n\t\t\t}\n\t\t}\n\t} else if ($target instanceof HTMLTableRowElement) {\n\t\tconst $parent = $target.parentElement\n\t\tif ($parent) {\n\t\t\tconst $lastEl = $parent.lastElementChild\n\t\t\tif ($lastEl instanceof HTMLTableRowElement) {\n\t\t\t\t$bottomCell = $lastEl\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// handle other contexts\n\t}\n\tif ($bottomCell && (!isFocusable($bottomCell) || !isVisible($bottomCell))) {\n\t\treturn getUpCellEl($bottomCell)\n\t}\n\treturn $bottomCell\n}\n\nconst getPrevCell = (event: KeyboardEvent) => {\n\tif (!(event.target instanceof HTMLElement)) return undefined\n\treturn getPrevCellEl(event.target)\n}\n\nconst getPrevCellEl = (element: HTMLElement): HTMLElement | undefined => {\n\tlet $prevCell: HTMLElement | undefined\n\tconst $prevSibling = element.previousElementSibling\n\tif ($prevSibling instanceof HTMLElement) {\n\t\t$prevCell = $prevSibling\n\t} else {\n\t\tconst $prevRow = element.parentElement?.previousElementSibling\n\t\tconst $lastEl = $prevRow?.lastElementChild\n\t\tif ($lastEl instanceof HTMLElement) {\n\t\t\t$prevCell = $lastEl\n\t\t}\n\t}\n\tif ($prevCell && (!isFocusable($prevCell) || !isVisible($prevCell))) {\n\t\treturn getPrevCellEl($prevCell)\n\t}\n\treturn $prevCell\n}\n\nconst getNextCell = (event: KeyboardEvent) => {\n\tif (!(event.target instanceof HTMLElement)) return undefined\n\treturn getNextCellEl(event.target)\n}\n\nconst getNextCellEl = (element: HTMLElement): HTMLElement | undefined => {\n\tlet $nextCell: HTMLElement | undefined\n\tconst $nextSibling = element.nextElementSibling\n\tif ($nextSibling instanceof HTMLElement) {\n\t\t$nextCell = $nextSibling\n\t} else {\n\t\tconst $nextRow = element.parentElement?.nextElementSibling\n\t\tconst $firstEl = $nextRow?.firstElementChild\n\t\tif ($firstEl instanceof HTMLElement) {\n\t\t\t$nextCell = $firstEl\n\t\t}\n\t}\n\tif ($nextCell && (!isFocusable($nextCell) || !isVisible($nextCell))) {\n\t\treturn getNextCellEl($nextCell)\n\t}\n\treturn $nextCell\n}\n\nconst getFirstCell = (event: KeyboardEvent) => {\n\tif (!(event.target instanceof HTMLElement)) return undefined\n\tconst $parent = event.target.parentElement\n\tconst $firstEl = $parent?.firstElementChild\n\tconst $firstCell = $firstEl instanceof HTMLElement ? $firstEl : null\n\tif ($firstCell && (!isFocusable($firstCell) || !isVisible($firstCell))) {\n\t\treturn getNextCellEl($firstCell)\n\t}\n\treturn $firstCell\n}\n\nconst getLastCell = (event: KeyboardEvent) => {\n\tif (!(event.target instanceof HTMLElement)) return undefined\n\tconst $parent = event.target.parentElement\n\tconst $lastEl = $parent?.lastElementChild\n\tconst $lastCell = $lastEl instanceof HTMLElement ? $lastEl : null\n\tif ($lastCell && (!isFocusable($lastCell) || !isVisible($lastCell))) {\n\t\treturn getPrevCellEl($lastCell)\n\t}\n\treturn $lastCell\n}\n\nconst modifierKeys = ['alt', 'control', 'shift', 'meta']\n\nconst eventKeyMap: Record<string, string> = {\n\tArrowUp: 'up',\n\tArrowDown: 'down',\n\tArrowLeft: 'left',\n\tArrowRight: 'right',\n}\n\n/**\n * Default keypress handlers for keyboard navigation\n * @public\n */\nexport const defaultKeypressHandlers: KeypressHandlers = {\n\t'keydown.up': (event: KeyboardEvent) => {\n\t\tconst $upCell = getUpCell(event)\n\t\tif ($upCell) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\t$upCell.focus()\n\t\t}\n\t},\n\t'keydown.down': (event: KeyboardEvent) => {\n\t\tconst $downCell = getDownCell(event)\n\t\tif ($downCell) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\t$downCell.focus()\n\t\t}\n\t},\n\t'keydown.left': (event: KeyboardEvent) => {\n\t\tconst $prevCell = getPrevCell(event)\n\t\t// prevent default edit-cell behaviour on first cell\n\t\tevent.preventDefault()\n\t\tevent.stopPropagation()\n\t\tif ($prevCell) {\n\t\t\t$prevCell.focus()\n\t\t}\n\t},\n\t'keydown.right': (event: KeyboardEvent) => {\n\t\tconst $nextCell = getNextCell(event)\n\t\t// prevent default edit-cell behaviour on last cell\n\t\tevent.preventDefault()\n\t\tevent.stopPropagation()\n\t\tif ($nextCell) {\n\t\t\t$nextCell.focus()\n\t\t}\n\t},\n\t'keydown.control.up': (event: KeyboardEvent) => {\n\t\tconst $topCell = getTopCell(event)\n\t\tif ($topCell) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\t$topCell.focus()\n\t\t}\n\t},\n\t'keydown.control.down': (event: KeyboardEvent) => {\n\t\tconst $bottomCell = getBottomCell(event)\n\t\tif ($bottomCell) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\t$bottomCell.focus()\n\t\t}\n\t},\n\t'keydown.control.left': (event: KeyboardEvent) => {\n\t\tconst $firstCell = getFirstCell(event)\n\t\tif ($firstCell) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\t$firstCell.focus()\n\t\t}\n\t},\n\t'keydown.control.right': (event: KeyboardEvent) => {\n\t\tconst $lastCell = getLastCell(event)\n\t\tif ($lastCell) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\t$lastCell.focus()\n\t\t}\n\t},\n\t'keydown.end': (event: KeyboardEvent) => {\n\t\tconst $lastCell = getLastCell(event)\n\t\tif ($lastCell) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\t$lastCell.focus()\n\t\t}\n\t},\n\t'keydown.enter': (event: KeyboardEvent) => {\n\t\tif (!(event.target instanceof HTMLElement)) return\n\t\tconst $target = event.target\n\t\tif ($target instanceof HTMLTableCellElement) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tconst $downCell = getDownCell(event)\n\t\t\tif ($downCell) {\n\t\t\t\t$downCell.focus()\n\t\t\t}\n\t\t} else {\n\t\t\t// handle other contexts\n\t\t}\n\t},\n\t'keydown.shift.enter': (event: KeyboardEvent) => {\n\t\tif (!(event.target instanceof HTMLElement)) return\n\t\tconst $target = event.target\n\t\tif ($target instanceof HTMLTableCellElement) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tconst $upCell = getUpCell(event)\n\t\t\tif ($upCell) {\n\t\t\t\t$upCell.focus()\n\t\t\t}\n\t\t} else {\n\t\t\t// handle other contexts\n\t\t}\n\t},\n\t'keydown.home': (event: KeyboardEvent) => {\n\t\tconst $firstCell = getFirstCell(event)\n\t\tif ($firstCell) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\t$firstCell.focus()\n\t\t}\n\t},\n\t'keydown.tab': (event: KeyboardEvent) => {\n\t\tconst $nextCell = getNextCell(event)\n\t\tif ($nextCell) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\t$nextCell.focus()\n\t\t}\n\t},\n\t'keydown.shift.tab': (event: KeyboardEvent) => {\n\t\tconst $prevCell = getPrevCell(event)\n\t\tif ($prevCell) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\t$prevCell.focus()\n\t\t}\n\t},\n}\n\n/**\n * Gets the parent element from a keyboard navigation option.\n * @internal\n */\nfunction getParentElement(option: KeyboardNavigationOptions): HTMLElement | null {\n\tlet $parent: HTMLElement | null = null\n\tif (option.parent) {\n\t\tif (typeof option.parent === 'string') {\n\t\t\t$parent = document.querySelector(option.parent)\n\t\t} else if (option.parent instanceof HTMLElement) {\n\t\t\t$parent = option.parent\n\t\t} else {\n\t\t\t$parent = option.parent.value\n\t\t}\n\t}\n\treturn $parent\n}\n\n/**\n * Keyboard navigation composable\n * @param options - Keyboard navigation options\n * @public\n */\nexport function useKeyboardNav(options: KeyboardNavigationOptions[]) {\n\tconst getSelectorsFromOption = (option: KeyboardNavigationOptions) => {\n\t\t// assumes that option.selectors is provided\n\t\tconst $parent = getParentElement(option)\n\t\tlet selectors: HTMLElement[] = []\n\t\tif (typeof option.selectors === 'string') {\n\t\t\tselectors = $parent\n\t\t\t\t? Array.from($parent.querySelectorAll(option.selectors))\n\t\t\t\t: Array.from(document.querySelectorAll(option.selectors))\n\t\t} else if (Array.isArray(option.selectors)) {\n\t\t\tfor (const element of option.selectors) {\n\t\t\t\tif (element instanceof HTMLElement) {\n\t\t\t\t\tselectors.push(element)\n\t\t\t\t} else {\n\t\t\t\t\t// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- Vue component $el is typed as any; shape guaranteed by VNode contract\n\t\t\t\t\tselectors.push(element.$el as HTMLElement)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (option.selectors instanceof HTMLElement) {\n\t\t\tselectors.push(option.selectors)\n\t\t} else if (option.selectors?.value) {\n\t\t\tif (Array.isArray(option.selectors.value)) {\n\t\t\t\tfor (const element of option.selectors.value) {\n\t\t\t\t\tif (element instanceof HTMLElement) {\n\t\t\t\t\t\tselectors.push(element)\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- Vue component $el is typed as any; shape guaranteed by VNode contract\n\t\t\t\t\t\tselectors.push(element.$el as HTMLElement)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tselectors.push(option.selectors.value)\n\t\t\t}\n\t\t}\n\t\treturn selectors\n\t}\n\n\tconst getSelectors = (option: KeyboardNavigationOptions) => {\n\t\tconst $parent = getParentElement(option)\n\t\tlet selectors: HTMLElement[] = []\n\t\tif (option.selectors) {\n\t\t\tselectors = getSelectorsFromOption(option)\n\t\t} else if ($parent) {\n\t\t\t// TODO: what should happen if no parent or selectors are provided?\n\t\t\tconst $children = Array.from($parent.children).filter((el): el is HTMLElement => el instanceof HTMLElement)\n\t\t\tselectors = $children.filter(selector => {\n\t\t\t\t// ignore elements not in the tab order or are not visible\n\t\t\t\treturn isFocusable(selector) && isVisible(selector)\n\t\t\t})\n\t\t}\n\t\treturn selectors\n\t}\n\n\tconst getEventListener = (option: KeyboardNavigationOptions) => {\n\t\treturn (event: KeyboardEvent) => {\n\t\t\tconst activeKey = eventKeyMap[event.key] || event.key.toLowerCase()\n\t\t\tif (modifierKeys.includes(activeKey)) return // ignore modifier key presses\n\n\t\t\tconst handlers = option.handlers || defaultKeypressHandlers\n\t\t\tfor (const key of Object.keys(handlers)) {\n\t\t\t\tconst [eventType, ...keys] = key.split('.')\n\t\t\t\tif (eventType !== 'keydown') {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif (keys.includes(activeKey)) {\n\t\t\t\t\tconst listener = handlers[key]\n\n\t\t\t\t\t// check if the handler has modifiers, and if the modifier is active;\n\t\t\t\t\t// this is to ensure exact key-press matches\n\t\t\t\t\tconst hasModifier = keys.filter(k => modifierKeys.includes(k))\n\t\t\t\t\tconst isModifierActive = modifierKeys.some(mk => {\n\t\t\t\t\t\tconst modifierKey = mk.charAt(0).toUpperCase() + mk.slice(1)\n\t\t\t\t\t\treturn event.getModifierState(modifierKey)\n\t\t\t\t\t})\n\n\t\t\t\t\tif (hasModifier.length > 0) {\n\t\t\t\t\t\tif (isModifierActive) {\n\t\t\t\t\t\t\tfor (const modifier of modifierKeys) {\n\t\t\t\t\t\t\t\tif (keys.includes(modifier)) {\n\t\t\t\t\t\t\t\t\t// docs: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState\n\t\t\t\t\t\t\t\t\tconst modifierKey = modifier.charAt(0).toUpperCase() + modifier.slice(1)\n\t\t\t\t\t\t\t\t\tif (event.getModifierState(modifierKey)) {\n\t\t\t\t\t\t\t\t\t\tlistener(event)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (!isModifierActive) {\n\t\t\t\t\t\t\tlistener(event)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tconst watchStopHandlers: WatchStopHandle[] = []\n\tonMounted(() => {\n\t\tfor (const option of options) {\n\t\t\tconst $parent = getParentElement(option)\n\t\t\tconst selectors = getSelectors(option)\n\t\t\tconst listener = getEventListener(option)\n\t\t\tconst listenerElements = $parent\n\t\t\t\t? [$parent] // watch for focus recursively within the parent element\n\t\t\t\t: selectors // watch for focus on each selector element TODO: too much JS?\n\n\t\t\tfor (const element of listenerElements) {\n\t\t\t\tconst { focused } = useFocusWithin(ref(element))\n\t\t\t\tconst stopHandler = watch(focused, value => {\n\t\t\t\t\tif (value) {\n\t\t\t\t\t\telement.addEventListener('keydown', listener)\n\t\t\t\t\t} else {\n\t\t\t\t\t\telement.removeEventListener('keydown', listener)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\twatchStopHandlers.push(stopHandler)\n\t\t\t}\n\t\t}\n\t})\n\n\tonBeforeUnmount(() => {\n\t\tfor (const stopHandler of watchStopHandlers) {\n\t\t\tstopHandler()\n\t\t}\n\t})\n}\n","import { Temporal } from 'temporal-polyfill'\n\n/**\n * Reads a `YYYY-MM-DD` day. Anything that is not a real day written exactly that way reads as no day.\n *\n * Not `Temporal.PlainDate.from` alone: it also takes the day out of a date-time, which would show a day\n * field over a date-time column as a day instead of as the mismatch it is.\n * @param day - The day, as `YYYY-MM-DD`\n * @public\n */\nexport function fromISODate(day: string): Temporal.PlainDate | undefined {\n\tif (!/^\\d{4}-\\d{2}-\\d{2}$/.test(day)) return undefined\n\n\ttry {\n\t\treturn Temporal.PlainDate.from(day)\n\t} catch {\n\t\treturn undefined\n\t}\n}\n","import { App } from 'vue'\n\nimport { defaultKeypressHandlers, useKeyboardNav } from './composables/keyboard'\nimport { fromISODate } from './dates'\nexport type * from './types'\n\n/**\n * Install all utility components\n * @param _app - Vue app instance\n * @public\n */\nfunction install(_app: App /* options */) {}\n\nexport { defaultKeypressHandlers, fromISODate, install, useKeyboardNav }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,qBACf,SACA,EAAE,SAAS,eAAe,iBAA8C,CAAC,GACxE;CACD,MAAM,mBAAmB,IAAI,KAAK;CAElC,MAAM,qBAAqB;EAC1B,IAAI,CAAC,QAAQ;EAEb,MAAM,WAAW,OAAO;EACxB,MAAM,KAAK,aAAa,OAAO;EAC/B,IAAI,CAAC,IACJ,iBAAiB,QAAQ;OACnB;GACN,MAAM,OAAO,GAAG,sBAAsB;GACtC,iBAAiB,QAChB,KAAK,QAAQ,OAAO,eAAe,SAAS,gBAAgB,iBAC5D,KAAK,SAAS,OAAO,cAAc,SAAS,gBAAgB,gBAC5D,KAAK,UAAU,KACf,KAAK,SAAS;EAChB;CACD;CAEA,YACO,aAAa,OAAO,SACpB,aAAa,GACnB;EAAE,WAAW;EAAM,OAAO;CAAO,CAClC;CAEA,IAAI,QACH,iBAAiB,gBAAgB,QAAQ,UAAU,cAAc;EAChE,SAAS;EACT,SAAS;CACV,CAAC;CAGF,OAAO;AACR;;;AC5DA,IAAM,aAAa,YAAyB;CAC3C,IAAI,UAAU,qBAAqB,OAAO,CAAC,CAAC;CAC5C,UAAU,WAAW,QAAQ,eAAe;CAC5C,OAAO;AACR;AAEA,IAAM,eAAe,YAAyB;CAC7C,OAAO,QAAQ,YAAY;AAC5B;AAGA,IAAM,aAAa,UAAyB;CAC3C,IAAI,EAAE,MAAM,kBAAkB,cAAc,OAAO,KAAA;CACnD,OAAO,YAAY,MAAM,MAAM;AAChC;AAEA,IAAM,eAAe,YAAkD;CACtE,IAAI;CACJ,IAAI,mBAAmB,sBAAsB;EAC5C,MAAM,eAAe,QAAQ,eAAe;EAC5C,IAAI,wBAAwB,qBAAqB;GAEhD,MAAM,UADgB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AM,CAAC;QACvE,IAAI,MAAM,iBAAiB,WAAW,GACrC,SAAS,KAAK;OAEhB;;KACD,OAGD,IAAI,CAAC,kBACJ,SAAS,KAAK;IAGjB;GACD;EACD;CACD;CAEA,MAAM,oBAAuC,CAAC;CAC9C,gBAAgB;EACf,KAAK,MAAM,UAAU,SAAS;GAC7B,MAAM,UAAU,iBAAiB,MAAM;GACvC,MAAM,YAAY,aAAa,MAAM;GACrC,MAAM,WAAW,iBAAiB,MAAM;GACxC,MAAM,mBAAmB,UACtB,CAAC,OAAO,IACR;GAEH,KAAK,MAAM,WAAW,kBAAkB;IACvC,MAAM,EAAE,YAAY,eAAe,IAAI,OAAO,CAAC;IAC/C,MAAM,cAAc,MAAM,UAAS,UAAS;KAC3C,IAAI,OACH,QAAQ,iBAAiB,WAAW,QAAQ;UAE5C,QAAQ,oBAAoB,WAAW,QAAQ;IAEjD,CAAC;IACD,kBAAkB,KAAK,WAAW;GACnC;EACD;CACD,CAAC;CAED,sBAAsB;EACrB,KAAK,MAAM,eAAe,mBACzB,YAAY;CAEd,CAAC;AACF;;;;;;;;;;;ACxeA,SAAgB,YAAY,KAA6C;CACxE,IAAI,CAAC,sBAAsB,KAAK,GAAG,GAAG,OAAO,KAAA;CAE7C,IAAI;EACH,OAAO,SAAS,UAAU,KAAK,GAAG;CACnC,QAAQ;EACP;CACD;AACD;;;;;;;;ACPA,SAAS,QAAQ,MAAyB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stonecrop/utilities",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"description": "Shared utility functions for Stonecrop",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"helpers",
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@vueuse/core": "^14.2.1"
|
|
43
|
+
"@vueuse/core": "^14.2.1",
|
|
44
|
+
"temporal-polyfill": "^1.0.5"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"@microsoft/api-extractor": "^7.58.7",
|