@stonecrop/utilities 0.52.0 → 0.54.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.
@@ -3,6 +3,41 @@ import { ComponentPublicInstance } from 'vue';
3
3
  import { Ref } from 'vue';
4
4
  import { Temporal } from 'temporal-polyfill';
5
5
 
6
+ /**
7
+ * What an arithmetic number box may hold while it is typed in: digits, a decimal point, whitespace,
8
+ * `+ - * / %` and parentheses, plus the given separators, after an optional leading `=` (as a spreadsheet formula
9
+ * starts). Exponents (`e`, `^`) and any other letter are refused, and so is `=` anywhere but first.
10
+ * @public
11
+ */
12
+ export declare function arithmeticEntryPattern(separators?: NumberSeparators): RegExp;
13
+
14
+ /**
15
+ * Configuration for {@link useArithmeticInput}.
16
+ * @public
17
+ */
18
+ export declare type ArithmeticInputOptions = {
19
+ /** The model's number. A record may hand it over as text (`"40"`, as a database numeric arrives). */
20
+ value: () => unknown;
21
+ /** Hands the model a new number, or null once the box is emptied */
22
+ commit: (value: number | null) => void;
23
+ /** The box's text for the model's number */
24
+ format?: (value: number | null) => string;
25
+ /** The marks the box writes numbers with; a plain `.` decimal point when omitted */
26
+ separators?: () => NumberSeparators;
27
+ /** The field's decimal places, where it has a fixed number of them; at `0` (as for JPY) a decimal mark is refused */
28
+ fractionDigits?: () => number | undefined;
29
+ /** Rounds a result before it is committed, as to a currency's decimals: `10/3` is `3.33`, as the box shows */
30
+ round?: (value: number) => number;
31
+ /** Commit each well-formed result as it is typed (default), or only once the box settles */
32
+ live?: boolean;
33
+ /** The box's text, when the caller already keeps it (as in `v-model`) */
34
+ text?: Ref<string>;
35
+ /** Whether the box takes arithmetic at all; while false the box's text is left alone. Default true. */
36
+ enabled?: () => boolean;
37
+ /** Select the box's text on focus, so typing replaces it */
38
+ selectOnFocus?: boolean;
39
+ };
40
+
6
41
  /**
7
42
  * Orders two versions by SemVer 2.0.0 precedence: major, minor and patch as numbers, a prerelease
8
43
  * before its release, and prerelease identifiers one by one. Build metadata does not count, so
@@ -22,6 +57,16 @@ export declare function compareSemver(a: string, b: string): number;
22
57
  */
23
58
  export declare function currencyAmountEntryPattern(currencyId: string | undefined, locale?: string): RegExp;
24
59
 
60
+ /**
61
+ * The separators a currency amount field writes amounts with: the locale's grouping and decimal marks.
62
+ * @param locale - The browser's own when omitted
63
+ * @public
64
+ */
65
+ export declare function currencyAmountSeparators(locale?: string): {
66
+ group: string;
67
+ decimal: string;
68
+ };
69
+
25
70
  /**
26
71
  * Fraction digits for a currency in amount inputs (e.g. JPY → 0).
27
72
  * @public
@@ -40,6 +85,22 @@ declare type CurrencyLike = {
40
85
  */
41
86
  export declare const defaultKeypressHandlers: KeypressHandlers;
42
87
 
88
+ /**
89
+ * Evaluate the arithmetic typed into a number box: `12*3+4` is `40`. Supports `+ - * / %` (remainder, as
90
+ * JavaScript's `%`), parentheses, signed numbers and decimals; nothing else, so no exponents, functions or names.
91
+ * A leading `=` or `+` is read as a spreadsheet reads it, so `=12*3` and `+12*3` are both `36`.
92
+ *
93
+ * The result is rounded to 15 significant digits to shed binary floating-point noise (`0.1*3` is `0.3`, not
94
+ * `0.30000000000000004`).
95
+ *
96
+ * @param text - The box's text
97
+ * @param separators - The marks the box writes numbers with; a plain `.` decimal point with no grouping when omitted
98
+ * @returns The number, or null when the text is empty or no well-formed expression (`12*`, `(3`, `5/0`, or a number
99
+ * written with the separators the other way round, as `1.234,56` in English)
100
+ * @public
101
+ */
102
+ export declare function evaluateArithmetic(text: string, separators?: NumberSeparators): number | null;
103
+
43
104
  /**
44
105
  * Format a currency amount for display (forms, table cells). Uses `Intl` when `currency.id` is a
45
106
  * valid ISO code; otherwise falls back to symbol, display text, or id.
@@ -91,6 +152,21 @@ export declare function fromISODate(day: string): Temporal.PlainDate | undefined
91
152
  */
92
153
  export declare function install(_app: App): void;
93
154
 
155
+ /**
156
+ * Whether an arithmetic number box may hold `text` while it is typed in: what {@link arithmeticEntryPattern} allows,
157
+ * with each number in it well formed (grouping marks only in the whole part, then at most one decimal mark).
158
+ * @param fractionDigits - The field's decimal places; at `0` (as for JPY) a decimal mark is refused
159
+ * @public
160
+ */
161
+ export declare function isArithmeticEntry(text: string, separators?: NumberSeparators, fractionDigits?: number): boolean;
162
+
163
+ /**
164
+ * Whether a single typed character may go into an arithmetic number box. `=` is one, though only as the box's first
165
+ * character: check the box's text with {@link arithmeticEntryPattern} where the caret is known.
166
+ * @public
167
+ */
168
+ export declare function isArithmeticKey(key: string, separators?: NumberSeparators): boolean;
169
+
94
170
  /**
95
171
  * Whether the text is a version under SemVer 2.0.0: `1.4.0`, `1.4.0-beta.2`, `1.4.0+build.5`. A `v`
96
172
  * prefix, a missing part (`1.4`) and a leading zero (`01.4.0`) are not.
@@ -126,6 +202,16 @@ export declare type KeypressHandlers = {
126
202
  [key: string]: (ev: KeyboardEvent) => any;
127
203
  };
128
204
 
205
+ /**
206
+ * The marks a number box writes numbers with. The decimal mark is read as the decimal point and the group mark is
207
+ * dropped, so `1.000,5*2` reads as `1000.5*2` with German separators.
208
+ * @public
209
+ */
210
+ export declare type NumberSeparators = {
211
+ group?: string;
212
+ decimal?: string;
213
+ };
214
+
129
215
  /**
130
216
  * Parse user-entered text in a currency amount field back to a number, read with the separators the
131
217
  * field writes it with.
@@ -134,6 +220,55 @@ export declare type KeypressHandlers = {
134
220
  */
135
221
  export declare function parseCurrencyAmountInput(text: string, locale?: string): number | null;
136
222
 
223
+ /**
224
+ * Round a number to a field's decimal places, as a column with a fixed scale holds it: `3.3333333333333` at 2 is
225
+ * `3.33`. A missing or unusable precision (not a whole number from 0 to 100) leaves the number as it is.
226
+ * @public
227
+ */
228
+ export declare function roundToPrecision(value: number, precision?: number): number;
229
+
230
+ /**
231
+ * A number box that takes arithmetic: `12*3+4` is read as `40`, and a leading `=` or `+` as a spreadsheet reads it.
232
+ * The box holds the typed text while it is edited and settles to the result on blur or Enter; text that is no
233
+ * expression by then (`12*`) leaves the model at its last number.
234
+ *
235
+ * Only an edit writes: a box focused and left as it was commits nothing, so a value is never rewritten (or rounded)
236
+ * by being looked at. "Edited" means the text differs from what the box last showed or saved.
237
+ *
238
+ * An `<input>` binds the returned `inputAttrs` (`v-bind="arithmetic.inputAttrs"`); an attribute written after the bind
239
+ * overrides it, and a listener written beside it runs as well. A box that is no `<input>` (a contenteditable table
240
+ * cell), or one that is not always an arithmetic box, drives `begin`, `update`, `settle`, `end` and `accepts` itself.
241
+ *
242
+ * @public
243
+ */
244
+ export declare function useArithmeticInput({ value, commit, format, separators, fractionDigits, round, live, text, enabled, selectOnFocus, }: ArithmeticInputOptions): {
245
+ inputAttrs: {
246
+ value: string;
247
+ type: "text";
248
+ inputmode: "decimal";
249
+ autocomplete: "off";
250
+ onFocus: (event: FocusEvent) => void;
251
+ onInput: (event: Event) => void;
252
+ onKeydown: (event: KeyboardEvent) => void;
253
+ onPaste: (event: ClipboardEvent) => void;
254
+ onBlur: () => void;
255
+ };
256
+ text: Ref<string, string>;
257
+ focused: Ref<boolean, boolean>;
258
+ accepts: (next: string) => boolean;
259
+ begin: (current?: string) => void;
260
+ update: (next: string) => void;
261
+ settle: () => void;
262
+ end: () => void;
263
+ rebase: (current: string) => void;
264
+ syncText: () => void;
265
+ onFocus: (event: FocusEvent) => void;
266
+ onInput: (event: Event) => void;
267
+ onKeydown: (event: KeyboardEvent) => void;
268
+ onPaste: (event: ClipboardEvent) => void;
269
+ onBlur: () => void;
270
+ };
271
+
137
272
  /**
138
273
  * Keyboard navigation composable
139
274
  * @param options - Keyboard navigation options
package/dist/utilities.js CHANGED
@@ -1,4 +1,4 @@
1
- import { onBeforeUnmount, onMounted, ref, watch } from "vue";
1
+ import { onBeforeUnmount, onMounted, reactive, ref, watch } from "vue";
2
2
  import { defaultWindow, unrefElement, useEventListener, useFocusWithin } from "@vueuse/core";
3
3
  import { Temporal } from "temporal-polyfill";
4
4
  //#region src/composables/visibility/index.ts
@@ -399,6 +399,264 @@ function useKeyboardNav(options) {
399
399
  });
400
400
  }
401
401
  //#endregion
402
+ //#region src/arithmetic.ts
403
+ var MAX_DEPTH = 64;
404
+ var escapeMark = (mark) => mark.replace(/[.*+?^${}()|[\]\\-]/g, "\\$&");
405
+ /**
406
+ * What an arithmetic number box may hold while it is typed in: digits, a decimal point, whitespace,
407
+ * `+ - * / %` and parentheses, plus the given separators, after an optional leading `=` (as a spreadsheet formula
408
+ * starts). Exponents (`e`, `^`) and any other letter are refused, and so is `=` anywhere but first.
409
+ * @public
410
+ */
411
+ function arithmeticEntryPattern(separators = {}) {
412
+ const marks = [separators.group, separators.decimal].filter(Boolean).map((mark) => escapeMark(mark));
413
+ return new RegExp(`^\\s*=?[\\d.\\s+\\-*/%()${marks.join("")}]*$`);
414
+ }
415
+ /**
416
+ * Whether every number in the text is written as the box writes numbers: grouping marks only in the whole part, then
417
+ * at most one decimal mark, and none at all where the field carries no decimals. "1.234,56" in English is no number
418
+ * (grouping after the decimal point), and neither is "1.2.3".
419
+ */
420
+ function numbersWellFormed(text, separators, fractionDigits) {
421
+ const decimal = separators.decimal ?? ".";
422
+ const group = separators.group && separators.group !== decimal ? separators.group : void 0;
423
+ const d = escapeMark(decimal);
424
+ const g = group ? escapeMark(group) : "";
425
+ const whole = group ? `\\d[\\d${g}]*` : "\\d+";
426
+ const number = new RegExp(fractionDigits === 0 ? `^${whole}$` : `^(?:${whole})?(?:${d}\\d*)?$`);
427
+ return (text.match(new RegExp(`[\\d${d}${g}]+`, "g")) ?? []).every((token) => number.test(token));
428
+ }
429
+ /**
430
+ * Whether an arithmetic number box may hold `text` while it is typed in: what {@link arithmeticEntryPattern} allows,
431
+ * with each number in it well formed (grouping marks only in the whole part, then at most one decimal mark).
432
+ * @param fractionDigits - The field's decimal places; at `0` (as for JPY) a decimal mark is refused
433
+ * @public
434
+ */
435
+ function isArithmeticEntry(text, separators = {}, fractionDigits) {
436
+ return arithmeticEntryPattern(separators).test(text) && numbersWellFormed(text, separators, fractionDigits);
437
+ }
438
+ /**
439
+ * Whether a single typed character may go into an arithmetic number box. `=` is one, though only as the box's first
440
+ * character: check the box's text with {@link arithmeticEntryPattern} where the caret is known.
441
+ * @public
442
+ */
443
+ function isArithmeticKey(key, separators = {}) {
444
+ return key.length === 1 && arithmeticEntryPattern(separators).test(key);
445
+ }
446
+ /**
447
+ * Round a number to a field's decimal places, as a column with a fixed scale holds it: `3.3333333333333` at 2 is
448
+ * `3.33`. A missing or unusable precision (not a whole number from 0 to 100) leaves the number as it is.
449
+ * @public
450
+ */
451
+ function roundToPrecision(value, precision) {
452
+ if (precision === void 0 || !Number.isInteger(precision) || precision < 0 || precision > 100) return value;
453
+ return Number(value.toFixed(precision));
454
+ }
455
+ /**
456
+ * Evaluate the arithmetic typed into a number box: `12*3+4` is `40`. Supports `+ - * / %` (remainder, as
457
+ * JavaScript's `%`), parentheses, signed numbers and decimals; nothing else, so no exponents, functions or names.
458
+ * A leading `=` or `+` is read as a spreadsheet reads it, so `=12*3` and `+12*3` are both `36`.
459
+ *
460
+ * The result is rounded to 15 significant digits to shed binary floating-point noise (`0.1*3` is `0.3`, not
461
+ * `0.30000000000000004`).
462
+ *
463
+ * @param text - The box's text
464
+ * @param separators - The marks the box writes numbers with; a plain `.` decimal point with no grouping when omitted
465
+ * @returns The number, or null when the text is empty or no well-formed expression (`12*`, `(3`, `5/0`, or a number
466
+ * written with the separators the other way round, as `1.234,56` in English)
467
+ * @public
468
+ */
469
+ function evaluateArithmetic(text, separators = {}) {
470
+ if (!numbersWellFormed(text, separators)) return null;
471
+ let source = text.replace(/\s/g, "");
472
+ if (separators.group && separators.group !== separators.decimal) source = source.replaceAll(separators.group, "");
473
+ if (separators.decimal && separators.decimal !== ".") source = source.replaceAll(separators.decimal, ".");
474
+ if (source.startsWith("=")) source = source.slice(1);
475
+ if (source === "" || !/^[\d.+\-*/%()]*$/.test(source)) return null;
476
+ let pos = 0;
477
+ let depth = 0;
478
+ const fail = () => {
479
+ throw new SyntaxError(`Not an arithmetic expression: ${text}`);
480
+ };
481
+ const peek = () => source[pos];
482
+ const parseNumber = () => {
483
+ const match = /^(?:\d+\.?\d*|\.\d+)/.exec(source.slice(pos));
484
+ if (!match) return fail();
485
+ pos += match[0].length;
486
+ return Number(match[0]);
487
+ };
488
+ const parsePrimary = () => {
489
+ if (peek() !== "(") return parseNumber();
490
+ if (++depth > MAX_DEPTH) fail();
491
+ pos++;
492
+ const value = parseSum();
493
+ if (peek() !== ")") fail();
494
+ pos++;
495
+ depth--;
496
+ return value;
497
+ };
498
+ const parseUnary = () => {
499
+ const sign = peek();
500
+ if (sign !== "+" && sign !== "-") return parsePrimary();
501
+ if (++depth > MAX_DEPTH) fail();
502
+ pos++;
503
+ const value = parseUnary();
504
+ depth--;
505
+ return sign === "-" ? -value : value;
506
+ };
507
+ const parseProduct = () => {
508
+ let value = parseUnary();
509
+ for (let op = peek(); op === "*" || op === "/" || op === "%"; op = peek()) {
510
+ pos++;
511
+ const right = parseUnary();
512
+ value = op === "*" ? value * right : op === "/" ? value / right : value % right;
513
+ }
514
+ return value;
515
+ };
516
+ function parseSum() {
517
+ let value = parseProduct();
518
+ for (let op = peek(); op === "+" || op === "-"; op = peek()) {
519
+ pos++;
520
+ const right = parseProduct();
521
+ value = op === "+" ? value + right : value - right;
522
+ }
523
+ return value;
524
+ }
525
+ try {
526
+ const value = parseSum();
527
+ if (pos !== source.length || !Number.isFinite(value)) return null;
528
+ return Number(value.toPrecision(15)) + 0;
529
+ } catch {
530
+ return null;
531
+ }
532
+ }
533
+ //#endregion
534
+ //#region src/composables/arithmeticInput.ts
535
+ /** The model's number, read from a number or from the text a record may carry instead. */
536
+ var numberOf = (value) => {
537
+ if (typeof value === "number") return Number.isFinite(value) ? value : null;
538
+ if (typeof value === "string" && value.trim() !== "") {
539
+ const n = Number(value);
540
+ return Number.isFinite(n) ? n : null;
541
+ }
542
+ return null;
543
+ };
544
+ /** The box's text once `inserted` replaces its selection. */
545
+ var textWith = (input, inserted) => input.value.slice(0, input.selectionStart ?? 0) + inserted + input.value.slice(input.selectionEnd ?? 0);
546
+ /**
547
+ * A number box that takes arithmetic: `12*3+4` is read as `40`, and a leading `=` or `+` as a spreadsheet reads it.
548
+ * The box holds the typed text while it is edited and settles to the result on blur or Enter; text that is no
549
+ * expression by then (`12*`) leaves the model at its last number.
550
+ *
551
+ * Only an edit writes: a box focused and left as it was commits nothing, so a value is never rewritten (or rounded)
552
+ * by being looked at. "Edited" means the text differs from what the box last showed or saved.
553
+ *
554
+ * An `<input>` binds the returned `inputAttrs` (`v-bind="arithmetic.inputAttrs"`); an attribute written after the bind
555
+ * overrides it, and a listener written beside it runs as well. A box that is no `<input>` (a contenteditable table
556
+ * cell), or one that is not always an arithmetic box, drives `begin`, `update`, `settle`, `end` and `accepts` itself.
557
+ *
558
+ * @public
559
+ */
560
+ function useArithmeticInput({ value, commit, format = (n) => n === null ? "" : String(n), separators = () => ({}), fractionDigits = () => void 0, round = (n) => n, live = true, text = ref(""), enabled = () => true, selectOnFocus = false }) {
561
+ const focused = ref(false);
562
+ let committedText = text.value;
563
+ /** Set the box's text without it counting as an edit */
564
+ const rebase = (current) => {
565
+ text.value = current;
566
+ committedText = current;
567
+ };
568
+ /** Show the model's number in the box */
569
+ const syncText = () => rebase(format(numberOf(value())));
570
+ watch(value, () => {
571
+ if (enabled() && !focused.value) syncText();
572
+ }, { immediate: true });
573
+ const commitText = () => {
574
+ if (text.value === committedText) return;
575
+ const empty = text.value.trim() === "";
576
+ const result = empty ? null : evaluateArithmetic(text.value, separators());
577
+ if (result === null && !empty) return;
578
+ commit(result === null ? null : round(result));
579
+ committedText = text.value;
580
+ };
581
+ /**
582
+ * Whether the box may hold `next`: digits, `.`, `+ - * / %`, parentheses and a leading `=`, with each number
583
+ * written as the box writes numbers (so not `1.2.3`, nor `1.234,56` in English)
584
+ */
585
+ const accepts = (next) => isArithmeticEntry(next, separators(), fractionDigits());
586
+ /** The box gained focus; `current` is its text, when the caller keeps it */
587
+ const begin = (current) => {
588
+ focused.value = true;
589
+ if (current !== void 0) rebase(current);
590
+ };
591
+ /** The box's text changed as it was typed in */
592
+ const update = (next) => {
593
+ text.value = next;
594
+ if (live) commitText();
595
+ };
596
+ /** Commit an edit, then show the result in place of the expression */
597
+ const settle = () => {
598
+ commitText();
599
+ syncText();
600
+ };
601
+ /** The box lost focus */
602
+ const end = () => {
603
+ focused.value = false;
604
+ settle();
605
+ };
606
+ const onFocus = (event) => {
607
+ begin();
608
+ const input = event.target;
609
+ if (selectOnFocus && input instanceof HTMLInputElement) requestAnimationFrame(() => input.select());
610
+ };
611
+ const onInput = (event) => {
612
+ if (event.target instanceof HTMLInputElement) update(event.target.value);
613
+ };
614
+ const onKeydown = (event) => {
615
+ if (event.ctrlKey || event.metaKey || event.altKey) return;
616
+ if (event.key === "Enter") {
617
+ settle();
618
+ return;
619
+ }
620
+ if (event.key.length !== 1) return;
621
+ const input = event.target;
622
+ const next = input instanceof HTMLInputElement ? textWith(input, event.key) : event.key;
623
+ if (!accepts(next)) event.preventDefault();
624
+ };
625
+ const onPaste = (event) => {
626
+ const input = event.target;
627
+ if (!(input instanceof HTMLInputElement)) return;
628
+ if (!accepts(textWith(input, event.clipboardData?.getData("text") ?? ""))) event.preventDefault();
629
+ };
630
+ const onBlur = () => end();
631
+ return {
632
+ inputAttrs: reactive({
633
+ value: text,
634
+ type: "text",
635
+ inputmode: "decimal",
636
+ autocomplete: "off",
637
+ onFocus,
638
+ onInput,
639
+ onKeydown,
640
+ onPaste,
641
+ onBlur
642
+ }),
643
+ text,
644
+ focused,
645
+ accepts,
646
+ begin,
647
+ update,
648
+ settle,
649
+ end,
650
+ rebase,
651
+ syncText,
652
+ onFocus,
653
+ onInput,
654
+ onKeydown,
655
+ onPaste,
656
+ onBlur
657
+ };
658
+ }
659
+ //#endregion
402
660
  //#region src/dates.ts
403
661
  /**
404
662
  * Reads a `YYYY-MM-DD` day. Anything that is not a real day written exactly that way reads as no day.
@@ -519,7 +777,12 @@ function currencyInputFractionDigits(currencyId) {
519
777
  return 2;
520
778
  }
521
779
  }
522
- function separatorsForLocale(locale) {
780
+ /**
781
+ * The separators a currency amount field writes amounts with: the locale's grouping and decimal marks.
782
+ * @param locale - The browser's own when omitted
783
+ * @public
784
+ */
785
+ function currencyAmountSeparators(locale) {
523
786
  const parts = new Intl.NumberFormat(locale).formatToParts(1234567.89);
524
787
  return {
525
788
  group: parts.find((part) => part.type === "group")?.value ?? ",",
@@ -549,7 +812,7 @@ function formatCurrencyAmountInput(amount, currencyId, locale) {
549
812
  * @public
550
813
  */
551
814
  function parseCurrencyAmountInput(text, locale) {
552
- const { group, decimal } = separatorsForLocale(locale);
815
+ const { group, decimal } = currencyAmountSeparators(locale);
553
816
  const normalized = text.replace(/\s/g, "").replace(/[^\d.,\-+]/g, "").replaceAll(group, "").replace(decimal, ".");
554
817
  if (!/\d/.test(normalized)) return null;
555
818
  const value = Number(normalized);
@@ -562,7 +825,7 @@ function parseCurrencyAmountInput(text, locale) {
562
825
  * @public
563
826
  */
564
827
  function currencyAmountEntryPattern(currencyId, locale) {
565
- const { group, decimal } = separatorsForLocale(locale);
828
+ const { group, decimal } = currencyAmountSeparators(locale);
566
829
  const escape = (mark) => mark.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
567
830
  const whole = `-?[\\d${escape(group)}]*`;
568
831
  if (currencyInputFractionDigits(currencyId) === 0) return new RegExp(`^${whole}$`);
@@ -650,6 +913,6 @@ function formatCurrencyCell(value) {
650
913
  */
651
914
  function install(_app) {}
652
915
  //#endregion
653
- export { compareSemver, currencyAmountEntryPattern, currencyInputFractionDigits, defaultKeypressHandlers, formatCurrencyAmount, formatCurrencyAmountInput, formatCurrencyCell, formatCurrencySymbol, formatQuantityCell, fromISODate, install, isSemver, isSemverPrefix, parseCurrencyAmountInput, useKeyboardNav };
916
+ export { arithmeticEntryPattern, compareSemver, currencyAmountEntryPattern, currencyAmountSeparators, currencyInputFractionDigits, defaultKeypressHandlers, evaluateArithmetic, formatCurrencyAmount, formatCurrencyAmountInput, formatCurrencyCell, formatCurrencySymbol, formatQuantityCell, fromISODate, install, isArithmeticEntry, isArithmeticKey, isSemver, isSemverPrefix, parseCurrencyAmountInput, roundToPrecision, useArithmeticInput, useKeyboardNav };
654
917
 
655
918
  //# sourceMappingURL=utilities.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utilities.js","names":[],"sources":["../src/composables/visibility/index.ts","../src/composables/keyboard.ts","../src/dates.ts","../src/semver.ts","../src/currencyAmountFormat.ts","../src/denominatedFormat.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/** When focus is on a control inside a cell, grid navigation still uses the owning `<td>`. */\nconst resolveNavCell = (element: HTMLElement): HTMLElement => {\n\tif (element instanceof HTMLTableCellElement) {\n\t\treturn element\n\t}\n\tconst cell = element.closest('td, th')\n\tif (cell instanceof HTMLTableCellElement) {\n\t\treturn cell\n\t}\n\treturn element\n}\n\n// navigation functions\nconst getUpCell = (event: KeyboardEvent) => {\n\tif (!(event.target instanceof HTMLElement)) return undefined\n\treturn getUpCellEl(resolveNavCell(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 = resolveNavCell(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(resolveNavCell(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 = resolveNavCell(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(resolveNavCell(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(resolveNavCell(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 = resolveNavCell(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 = resolveNavCell(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 = resolveNavCell(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 = resolveNavCell(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","// SemVer 2.0.0, strictly: https://semver.org. The same grammar the `semver` Postgres extension stores,\n// so a version the form accepts is one the column takes, and the two order versions alike.\nconst SEMVER =\n\t/^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/\n\nconst NUMBER = /^(0|[1-9]\\d*)$/\nconst NUMBER_SO_FAR = /^(0|[1-9]\\d*)?$/\nconst PRERELEASE_IDENTIFIER = /^(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)$/\nconst BUILD_IDENTIFIER = /^[0-9a-zA-Z-]+$/\n// Any run of identifier characters can still become an identifier: `01` is not one, but `01a` is.\nconst IDENTIFIER_SO_FAR = /^[0-9a-zA-Z-]*$/\n\n/**\n * Whether the text is a version under SemVer 2.0.0: `1.4.0`, `1.4.0-beta.2`, `1.4.0+build.5`. A `v`\n * prefix, a missing part (`1.4`) and a leading zero (`01.4.0`) are not.\n * @param text - The text to check\n * @public\n */\nexport function isSemver(text: string): boolean {\n\treturn SEMVER.test(text)\n}\n\nconst splitOnce = (text: string, separator: string): [string, string | undefined] => {\n\tconst index = text.indexOf(separator)\n\treturn index === -1 ? [text, undefined] : [text.slice(0, index), text.slice(index + 1)]\n}\n\n/** Whether each dot-separated part before the last matches `whole`, and the last matches `last`. */\nconst partsMatch = (text: string, whole: RegExp, last: RegExp): boolean => {\n\tconst parts = text.split('.')\n\tconst typing = parts.pop() ?? ''\n\treturn parts.every(part => whole.test(part)) && last.test(typing)\n}\n\n/**\n * Whether typing more could still make the text a version: `1.`, `1.4.0-` and the empty text can,\n * while `v1`, `01` and `1.4-beta` cannot. Every version passes, so a box that refuses any edit failing\n * this one never stops someone typing a version.\n * @param text - The text so far\n * @public\n */\nexport function isSemverPrefix(text: string): boolean {\n\t// Neither `+` nor `-` can appear in the numbers, so the first of each ends the part before it.\n\tconst [head, build] = splitOnce(text, '+')\n\tconst [core, prerelease] = splitOnce(head, '-')\n\n\tconst coreDone = prerelease !== undefined || build !== undefined\n\tconst numbers = core.split('.').length\n\tif (numbers > 3 || (coreDone && numbers < 3)) return false\n\tif (!partsMatch(core, NUMBER, coreDone ? NUMBER : NUMBER_SO_FAR)) return false\n\n\tif (prerelease !== undefined) {\n\t\tconst last = build === undefined ? IDENTIFIER_SO_FAR : PRERELEASE_IDENTIFIER\n\t\tif (!partsMatch(prerelease, PRERELEASE_IDENTIFIER, last)) return false\n\t}\n\n\treturn build === undefined || partsMatch(build, BUILD_IDENTIFIER, IDENTIFIER_SO_FAR)\n}\n\n// Digits without leading zeros, compared without converting, so no version is too big to order.\nconst compareDigits = (a: string, b: string): number => a.length - b.length || (a < b ? -1 : a > b ? 1 : 0)\n\nconst compareIdentifiers = (a: string, b: string): number => {\n\tconst aNumeric = /^\\d+$/.test(a)\n\tconst bNumeric = /^\\d+$/.test(b)\n\tif (aNumeric && bNumeric) return compareDigits(a, b)\n\tif (aNumeric !== bNumeric) return aNumeric ? -1 : 1\n\treturn a < b ? -1 : a > b ? 1 : 0\n}\n\nconst comparePrereleases = (a: string | undefined, b: string | undefined): number => {\n\tif (a === b) return 0\n\t// A prerelease comes before its release.\n\tif (a === undefined) return 1\n\tif (b === undefined) return -1\n\n\tconst left = a.split('.')\n\tconst right = b.split('.')\n\tfor (let i = 0; i < Math.min(left.length, right.length); i++) {\n\t\tconst order = compareIdentifiers(left[i], right[i])\n\t\tif (order) return order\n\t}\n\treturn left.length - right.length\n}\n\n/**\n * Orders two versions by SemVer 2.0.0 precedence: major, minor and patch as numbers, a prerelease\n * before its release, and prerelease identifiers one by one. Build metadata does not count, so\n * `1.4.0+a` and `1.4.0+b` compare equal. Text that is not a version comes after every version.\n * @param a - The first version\n * @param b - The second version\n * @returns Negative when `a` comes first, positive when `b` does, zero when neither\n * @public\n */\nexport function compareSemver(a: string, b: string): number {\n\tconst left = SEMVER.exec(a)\n\tconst right = SEMVER.exec(b)\n\tif (!left || !right) return Number(!left) - Number(!right)\n\n\tfor (let part = 1; part <= 3; part++) {\n\t\tconst order = compareDigits(left[part], right[part])\n\t\tif (order) return order\n\t}\n\treturn comparePrereleases(left[4], right[4])\n}\n","/**\n * Fraction digits for a currency in amount inputs (e.g. JPY → 0).\n * @public\n */\nexport function currencyInputFractionDigits(currencyId: string | undefined): number {\n\tconst id = currencyId?.toUpperCase() ?? ''\n\tif (!id) return 2\n\ttry {\n\t\treturn (\n\t\t\tnew Intl.NumberFormat('en-US', {\n\t\t\t\tstyle: 'currency',\n\t\t\t\tcurrency: id,\n\t\t\t}).resolvedOptions().maximumFractionDigits ?? 2\n\t\t)\n\t} catch {\n\t\treturn 2\n\t}\n}\n\nfunction separatorsForLocale(locale: string | undefined): { group: string; decimal: string } {\n\tconst parts = new Intl.NumberFormat(locale).formatToParts(1234567.89)\n\treturn {\n\t\tgroup: parts.find(part => part.type === 'group')?.value ?? ',',\n\t\tdecimal: parts.find(part => part.type === 'decimal')?.value ?? '.',\n\t}\n}\n\n/**\n * Format a numeric amount for display in a currency amount field (no currency symbol). The currency\n * sets the decimals; the separators are the locale's, as in the table cell.\n * @param locale - The browser's own when omitted\n * @public\n */\nexport function formatCurrencyAmountInput(\n\tamount: number | null | undefined,\n\tcurrencyId: string | undefined,\n\tlocale?: string\n): string {\n\tif (amount === null || amount === undefined) return ''\n\tconst id = currencyId?.toUpperCase() ?? ''\n\tconst fractionDigits = currencyInputFractionDigits(id)\n\treturn new Intl.NumberFormat(locale, {\n\t\tminimumFractionDigits: fractionDigits,\n\t\tmaximumFractionDigits: fractionDigits,\n\t\tuseGrouping: id !== 'JPY',\n\t}).format(amount)\n}\n\n/**\n * Parse user-entered text in a currency amount field back to a number, read with the separators the\n * field writes it with.\n * @param locale - The browser's own when omitted\n * @public\n */\nexport function parseCurrencyAmountInput(text: string, locale?: string): number | null {\n\tconst { group, decimal } = separatorsForLocale(locale)\n\tconst normalized = text\n\t\t.replace(/\\s/g, '')\n\t\t.replace(/[^\\d.,\\-+]/g, '')\n\t\t.replaceAll(group, '')\n\t\t.replace(decimal, '.')\n\t// No digits is no amount, though `Number('')` is 0.\n\tif (!/\\d/.test(normalized)) return null\n\tconst value = Number(normalized)\n\treturn Number.isFinite(value) ? value : null\n}\n\n/**\n * What a masked currency amount field may hold while it is typed in: digits and grouping marks, then at most one\n * decimal point followed by digits.\n * @param locale - The browser's own when omitted\n * @public\n */\nexport function currencyAmountEntryPattern(currencyId: string | undefined, locale?: string): RegExp {\n\tconst { group, decimal } = separatorsForLocale(locale)\n\tconst escape = (mark: string) => mark.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n\tconst whole = `-?[\\\\d${escape(group)}]*`\n\tif (currencyInputFractionDigits(currencyId) === 0) return new RegExp(`^${whole}$`)\n\t// US-style keyboards often paste/type '.' even when the locale decimal is ','.\n\tconst point = decimal === '.' ? '\\\\.' : `[${escape(decimal)}.]`\n\treturn new RegExp(`^${whole}(?:${point}\\\\d*)?$`)\n}\n","type CurrencyLike = {\n\tid?: string | number\n\tsymbol?: string\n\tdisplayText?: string\n}\n\nfunction displayScalar(value: unknown): string {\n\tif (typeof value === 'string') return value\n\tif (typeof value === 'number' || typeof value === 'bigint') return String(value)\n\tif (typeof value === 'boolean') return String(value)\n\treturn ''\n}\n\nfunction displayQty(qty: unknown): string {\n\tif (qty === null || qty === undefined || qty === '') return ''\n\treturn displayScalar(qty)\n}\n\n/**\n * Format a currency amount for display (forms, table cells). Uses `Intl` when `currency.id` is a\n * valid ISO code; otherwise falls back to symbol, display text, or id.\n * @public\n */\nexport function formatCurrencyAmount(amount: number | null | undefined, currency: CurrencyLike | undefined): string {\n\tif (amount === null || amount === undefined) return ''\n\tconst id = currency?.id != null ? String(currency.id) : ''\n\tif (id) {\n\t\ttry {\n\t\t\treturn new Intl.NumberFormat(undefined, {\n\t\t\t\tstyle: 'currency',\n\t\t\t\tcurrency: id,\n\t\t\t\tcurrencyDisplay: 'symbol',\n\t\t\t}).format(amount)\n\t\t} catch {\n\t\t\t// Not a valid ISO 4217 code — fall through to symbol / displayText.\n\t\t}\n\t}\n\tconst suffix = formatCurrencySymbol(currency)\n\treturn suffix ? `${amount} ${suffix}`.trim() : String(amount)\n}\n\n/**\n * The mark that names a currency beside an amount: the symbol `Intl` formats a valid ISO code with,\n * as {@link formatCurrencyAmount} does; otherwise its symbol, display text, or id.\n * @public\n */\nexport function formatCurrencySymbol(currency: CurrencyLike | undefined): string {\n\tconst id = currency?.id != null ? String(currency.id) : ''\n\tif (id) {\n\t\ttry {\n\t\t\tconst parts = new Intl.NumberFormat(undefined, {\n\t\t\t\tstyle: 'currency',\n\t\t\t\tcurrency: id,\n\t\t\t\tcurrencyDisplay: 'symbol',\n\t\t\t}).formatToParts(0)\n\t\t\tconst symbol = parts.find(part => part.type === 'currency')?.value\n\t\t\tif (symbol) return symbol\n\t\t} catch {\n\t\t\t// Not a valid ISO 4217 code — fall through to symbol / displayText.\n\t\t}\n\t}\n\treturn currency?.symbol ?? currency?.displayText ?? id\n}\n\n/**\n * Render a composite quantity value for table cells. Omits the UOM when it matches `stockUom`.\n * @public\n */\nexport function formatQuantityCell(value: unknown): string {\n\tif (value === null || value === undefined) return ''\n\tif (typeof value !== 'object') return displayScalar(value)\n\tconst record = value as { qty?: unknown; uom?: string; stockUom?: string }\n\tconst qtyText = displayQty(record.qty)\n\tconst uom = record.uom ?? ''\n\tconst stockUom = record.stockUom ?? ''\n\tif (!uom) return qtyText\n\tif (stockUom && uom === stockUom) return qtyText\n\treturn `${qtyText} ${uom}`.trim()\n}\n\n/**\n * Render a composite currency value for table cells.\n * @public\n */\nexport function formatCurrencyCell(value: unknown): string {\n\tif (value === null || value === undefined) return ''\n\tif (typeof value !== 'object') return displayScalar(value)\n\tconst record = value as { amount?: number | null; currency?: CurrencyLike }\n\treturn formatCurrencyAmount(record.amount, record.currency)\n}\n","import { App } from 'vue'\n\nimport { defaultKeypressHandlers, useKeyboardNav } from './composables/keyboard'\nimport { fromISODate } from './dates'\nimport { compareSemver, isSemver, isSemverPrefix } from './semver'\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 {\n\tcurrencyAmountEntryPattern,\n\tcurrencyInputFractionDigits,\n\tformatCurrencyAmountInput,\n\tparseCurrencyAmountInput,\n} from './currencyAmountFormat'\nexport { formatCurrencyAmount, formatCurrencyCell, formatCurrencySymbol, formatQuantityCell } from './denominatedFormat'\nexport { compareSemver, defaultKeypressHandlers, fromISODate, install, isSemver, isSemverPrefix, 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;GACt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AC3D;;;;;;;;AC7EA,SAAS,QAAQ,MAAyB,CAAC"}
1
+ {"version":3,"file":"utilities.js","names":[],"sources":["../src/composables/visibility/index.ts","../src/composables/keyboard.ts","../src/arithmetic.ts","../src/composables/arithmeticInput.ts","../src/dates.ts","../src/semver.ts","../src/currencyAmountFormat.ts","../src/denominatedFormat.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/** When focus is on a control inside a cell, grid navigation still uses the owning `<td>`. */\nconst resolveNavCell = (element: HTMLElement): HTMLElement => {\n\tif (element instanceof HTMLTableCellElement) {\n\t\treturn element\n\t}\n\tconst cell = element.closest('td, th')\n\tif (cell instanceof HTMLTableCellElement) {\n\t\treturn cell\n\t}\n\treturn element\n}\n\n// navigation functions\nconst getUpCell = (event: KeyboardEvent) => {\n\tif (!(event.target instanceof HTMLElement)) return undefined\n\treturn getUpCellEl(resolveNavCell(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 = resolveNavCell(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(resolveNavCell(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 = resolveNavCell(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(resolveNavCell(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(resolveNavCell(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 = resolveNavCell(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 = resolveNavCell(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 = resolveNavCell(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 = resolveNavCell(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","/**\n * The marks a number box writes numbers with. The decimal mark is read as the decimal point and the group mark is\n * dropped, so `1.000,5*2` reads as `1000.5*2` with German separators.\n * @public\n */\nexport type NumberSeparators = {\n\tgroup?: string\n\tdecimal?: string\n}\n\n// Deep enough for any expression typed by hand, shallow enough that `((((…` can't exhaust the stack.\nconst MAX_DEPTH = 64\n\nconst escapeMark = (mark: string) => mark.replace(/[.*+?^${}()|[\\]\\\\-]/g, '\\\\$&')\n\n/**\n * What an arithmetic number box may hold while it is typed in: digits, a decimal point, whitespace,\n * `+ - * / %` and parentheses, plus the given separators, after an optional leading `=` (as a spreadsheet formula\n * starts). Exponents (`e`, `^`) and any other letter are refused, and so is `=` anywhere but first.\n * @public\n */\nexport function arithmeticEntryPattern(separators: NumberSeparators = {}): RegExp {\n\tconst marks = [separators.group, separators.decimal].filter(Boolean).map(mark => escapeMark(mark!))\n\treturn new RegExp(`^\\\\s*=?[\\\\d.\\\\s+\\\\-*/%()${marks.join('')}]*$`)\n}\n\n/**\n * Whether every number in the text is written as the box writes numbers: grouping marks only in the whole part, then\n * at most one decimal mark, and none at all where the field carries no decimals. \"1.234,56\" in English is no number\n * (grouping after the decimal point), and neither is \"1.2.3\".\n */\nfunction numbersWellFormed(text: string, separators: NumberSeparators, fractionDigits?: number): boolean {\n\tconst decimal = separators.decimal ?? '.'\n\tconst group = separators.group && separators.group !== decimal ? separators.group : undefined\n\tconst d = escapeMark(decimal)\n\tconst g = group ? escapeMark(group) : ''\n\tconst whole = group ? `\\\\d[\\\\d${g}]*` : '\\\\d+'\n\tconst number = new RegExp(fractionDigits === 0 ? `^${whole}$` : `^(?:${whole})?(?:${d}\\\\d*)?$`)\n\tconst tokens = text.match(new RegExp(`[\\\\d${d}${g}]+`, 'g')) ?? []\n\treturn tokens.every(token => number.test(token))\n}\n\n/**\n * Whether an arithmetic number box may hold `text` while it is typed in: what {@link arithmeticEntryPattern} allows,\n * with each number in it well formed (grouping marks only in the whole part, then at most one decimal mark).\n * @param fractionDigits - The field's decimal places; at `0` (as for JPY) a decimal mark is refused\n * @public\n */\nexport function isArithmeticEntry(text: string, separators: NumberSeparators = {}, fractionDigits?: number): boolean {\n\treturn arithmeticEntryPattern(separators).test(text) && numbersWellFormed(text, separators, fractionDigits)\n}\n\n/**\n * Whether a single typed character may go into an arithmetic number box. `=` is one, though only as the box's first\n * character: check the box's text with {@link arithmeticEntryPattern} where the caret is known.\n * @public\n */\nexport function isArithmeticKey(key: string, separators: NumberSeparators = {}): boolean {\n\treturn key.length === 1 && arithmeticEntryPattern(separators).test(key)\n}\n\n/**\n * Round a number to a field's decimal places, as a column with a fixed scale holds it: `3.3333333333333` at 2 is\n * `3.33`. A missing or unusable precision (not a whole number from 0 to 100) leaves the number as it is.\n * @public\n */\nexport function roundToPrecision(value: number, precision?: number): number {\n\tif (precision === undefined || !Number.isInteger(precision) || precision < 0 || precision > 100) return value\n\treturn Number(value.toFixed(precision))\n}\n\n/**\n * Evaluate the arithmetic typed into a number box: `12*3+4` is `40`. Supports `+ - * / %` (remainder, as\n * JavaScript's `%`), parentheses, signed numbers and decimals; nothing else, so no exponents, functions or names.\n * A leading `=` or `+` is read as a spreadsheet reads it, so `=12*3` and `+12*3` are both `36`.\n *\n * The result is rounded to 15 significant digits to shed binary floating-point noise (`0.1*3` is `0.3`, not\n * `0.30000000000000004`).\n *\n * @param text - The box's text\n * @param separators - The marks the box writes numbers with; a plain `.` decimal point with no grouping when omitted\n * @returns The number, or null when the text is empty or no well-formed expression (`12*`, `(3`, `5/0`, or a number\n * written with the separators the other way round, as `1.234,56` in English)\n * @public\n */\nexport function evaluateArithmetic(text: string, separators: NumberSeparators = {}): number | null {\n\tif (!numbersWellFormed(text, separators)) return null\n\tlet source = text.replace(/\\s/g, '')\n\tif (separators.group && separators.group !== separators.decimal) source = source.replaceAll(separators.group, '')\n\tif (separators.decimal && separators.decimal !== '.') source = source.replaceAll(separators.decimal, '.')\n\tif (source.startsWith('=')) source = source.slice(1)\n\tif (source === '' || !/^[\\d.+\\-*/%()]*$/.test(source)) return null\n\n\tlet pos = 0\n\tlet depth = 0\n\n\tconst fail = (): never => {\n\t\tthrow new SyntaxError(`Not an arithmetic expression: ${text}`)\n\t}\n\n\tconst peek = () => source[pos]\n\n\tconst parseNumber = (): number => {\n\t\tconst match = /^(?:\\d+\\.?\\d*|\\.\\d+)/.exec(source.slice(pos))\n\t\tif (!match) return fail()\n\t\tpos += match[0].length\n\t\treturn Number(match[0])\n\t}\n\n\tconst parsePrimary = (): number => {\n\t\tif (peek() !== '(') return parseNumber()\n\t\tif (++depth > MAX_DEPTH) fail()\n\t\tpos++\n\t\tconst value = parseSum()\n\t\tif (peek() !== ')') fail()\n\t\tpos++\n\t\tdepth--\n\t\treturn value\n\t}\n\n\tconst parseUnary = (): number => {\n\t\tconst sign = peek()\n\t\tif (sign !== '+' && sign !== '-') return parsePrimary()\n\t\tif (++depth > MAX_DEPTH) fail()\n\t\tpos++\n\t\tconst value = parseUnary()\n\t\tdepth--\n\t\treturn sign === '-' ? -value : value\n\t}\n\n\tconst parseProduct = (): number => {\n\t\tlet value = parseUnary()\n\t\tfor (let op = peek(); op === '*' || op === '/' || op === '%'; op = peek()) {\n\t\t\tpos++\n\t\t\tconst right = parseUnary()\n\t\t\tvalue = op === '*' ? value * right : op === '/' ? value / right : value % right\n\t\t}\n\t\treturn value\n\t}\n\n\tfunction parseSum(): number {\n\t\tlet value = parseProduct()\n\t\tfor (let op = peek(); op === '+' || op === '-'; op = peek()) {\n\t\t\tpos++\n\t\t\tconst right = parseProduct()\n\t\t\tvalue = op === '+' ? value + right : value - right\n\t\t}\n\t\treturn value\n\t}\n\n\ttry {\n\t\tconst value = parseSum()\n\t\tif (pos !== source.length || !Number.isFinite(value)) return null\n\t\t// `-0` reads as 0 in a box.\n\t\treturn Number(value.toPrecision(15)) + 0\n\t} catch {\n\t\treturn null\n\t}\n}\n","import { reactive, ref, watch, type Ref } from 'vue'\n\nimport { evaluateArithmetic, isArithmeticEntry, type NumberSeparators } from '../arithmetic'\n\n/**\n * Configuration for {@link useArithmeticInput}.\n * @public\n */\nexport type ArithmeticInputOptions = {\n\t/** The model's number. A record may hand it over as text (`\"40\"`, as a database numeric arrives). */\n\tvalue: () => unknown\n\t/** Hands the model a new number, or null once the box is emptied */\n\tcommit: (value: number | null) => void\n\t/** The box's text for the model's number */\n\tformat?: (value: number | null) => string\n\t/** The marks the box writes numbers with; a plain `.` decimal point when omitted */\n\tseparators?: () => NumberSeparators\n\t/** The field's decimal places, where it has a fixed number of them; at `0` (as for JPY) a decimal mark is refused */\n\tfractionDigits?: () => number | undefined\n\t/** Rounds a result before it is committed, as to a currency's decimals: `10/3` is `3.33`, as the box shows */\n\tround?: (value: number) => number\n\t/** Commit each well-formed result as it is typed (default), or only once the box settles */\n\tlive?: boolean\n\t/** The box's text, when the caller already keeps it (as in `v-model`) */\n\ttext?: Ref<string>\n\t/** Whether the box takes arithmetic at all; while false the box's text is left alone. Default true. */\n\tenabled?: () => boolean\n\t/** Select the box's text on focus, so typing replaces it */\n\tselectOnFocus?: boolean\n}\n\n/** The model's number, read from a number or from the text a record may carry instead. */\nconst numberOf = (value: unknown): number | null => {\n\tif (typeof value === 'number') return Number.isFinite(value) ? value : null\n\tif (typeof value === 'string' && value.trim() !== '') {\n\t\tconst n = Number(value)\n\t\treturn Number.isFinite(n) ? n : null\n\t}\n\treturn null\n}\n\n/** The box's text once `inserted` replaces its selection. */\nconst textWith = (input: HTMLInputElement, inserted: string) =>\n\tinput.value.slice(0, input.selectionStart ?? 0) + inserted + input.value.slice(input.selectionEnd ?? 0)\n\n/**\n * A number box that takes arithmetic: `12*3+4` is read as `40`, and a leading `=` or `+` as a spreadsheet reads it.\n * The box holds the typed text while it is edited and settles to the result on blur or Enter; text that is no\n * expression by then (`12*`) leaves the model at its last number.\n *\n * Only an edit writes: a box focused and left as it was commits nothing, so a value is never rewritten (or rounded)\n * by being looked at. \"Edited\" means the text differs from what the box last showed or saved.\n *\n * An `<input>` binds the returned `inputAttrs` (`v-bind=\"arithmetic.inputAttrs\"`); an attribute written after the bind\n * overrides it, and a listener written beside it runs as well. A box that is no `<input>` (a contenteditable table\n * cell), or one that is not always an arithmetic box, drives `begin`, `update`, `settle`, `end` and `accepts` itself.\n *\n * @public\n */\nexport function useArithmeticInput({\n\tvalue,\n\tcommit,\n\tformat = n => (n === null ? '' : String(n)),\n\tseparators = () => ({}),\n\tfractionDigits = () => undefined,\n\tround = n => n,\n\tlive = true,\n\ttext = ref(''),\n\tenabled = () => true,\n\tselectOnFocus = false,\n}: ArithmeticInputOptions) {\n\tconst focused = ref(false)\n\t// What the box last showed or saved: the text that commits nothing.\n\tlet committedText = text.value\n\n\t/** Set the box's text without it counting as an edit */\n\tconst rebase = (current: string) => {\n\t\ttext.value = current\n\t\tcommittedText = current\n\t}\n\n\t/** Show the model's number in the box */\n\tconst syncText = () => rebase(format(numberOf(value())))\n\n\t// Not while it is typed in: the box holds text on its way to a number (\"12*\"), which the number would overwrite.\n\twatch(\n\t\tvalue,\n\t\t() => {\n\t\t\tif (enabled() && !focused.value) syncText()\n\t\t},\n\t\t{ immediate: true }\n\t)\n\n\tconst commitText = () => {\n\t\tif (text.value === committedText) return\n\t\tconst empty = text.value.trim() === ''\n\t\tconst result = empty ? null : evaluateArithmetic(text.value, separators())\n\t\tif (result === null && !empty) return\n\t\tcommit(result === null ? null : round(result))\n\t\tcommittedText = text.value\n\t}\n\n\t/**\n\t * Whether the box may hold `next`: digits, `.`, `+ - * / %`, parentheses and a leading `=`, with each number\n\t * written as the box writes numbers (so not `1.2.3`, nor `1.234,56` in English)\n\t */\n\tconst accepts = (next: string) => isArithmeticEntry(next, separators(), fractionDigits())\n\n\t/** The box gained focus; `current` is its text, when the caller keeps it */\n\tconst begin = (current?: string) => {\n\t\tfocused.value = true\n\t\tif (current !== undefined) rebase(current)\n\t}\n\n\t/** The box's text changed as it was typed in */\n\tconst update = (next: string) => {\n\t\ttext.value = next\n\t\tif (live) commitText()\n\t}\n\n\t/** Commit an edit, then show the result in place of the expression */\n\tconst settle = () => {\n\t\tcommitText()\n\t\tsyncText()\n\t}\n\n\t/** The box lost focus */\n\tconst end = () => {\n\t\tfocused.value = false\n\t\tsettle()\n\t}\n\n\tconst onFocus = (event: FocusEvent) => {\n\t\tbegin()\n\t\tconst input = event.target\n\t\tif (selectOnFocus && input instanceof HTMLInputElement) requestAnimationFrame(() => input.select())\n\t}\n\n\tconst onInput = (event: Event) => {\n\t\tif (event.target instanceof HTMLInputElement) update(event.target.value)\n\t}\n\n\tconst onKeydown = (event: KeyboardEvent) => {\n\t\tif (event.ctrlKey || event.metaKey || event.altKey) return\n\t\tif (event.key === 'Enter') {\n\t\t\tsettle()\n\t\t\treturn\n\t\t}\n\t\tif (event.key.length !== 1) return\n\t\t// The box's text once typed in, as `=` may only start it.\n\t\tconst input = event.target\n\t\tconst next = input instanceof HTMLInputElement ? textWith(input, event.key) : event.key\n\t\tif (!accepts(next)) event.preventDefault()\n\t}\n\n\t// A pasted letter or exponent leaves the box as it was.\n\tconst onPaste = (event: ClipboardEvent) => {\n\t\tconst input = event.target\n\t\tif (!(input instanceof HTMLInputElement)) return\n\t\tif (!accepts(textWith(input, event.clipboardData?.getData('text') ?? ''))) event.preventDefault()\n\t}\n\n\tconst onBlur = () => end()\n\n\t// Text, not `type=\"number\"`, which refuses an operator.\n\tconst inputAttrs = reactive({\n\t\tvalue: text,\n\t\ttype: 'text' as const,\n\t\tinputmode: 'decimal' as const,\n\t\tautocomplete: 'off' as const,\n\t\tonFocus,\n\t\tonInput,\n\t\tonKeydown,\n\t\tonPaste,\n\t\tonBlur,\n\t})\n\n\treturn {\n\t\tinputAttrs,\n\t\ttext,\n\t\tfocused,\n\t\taccepts,\n\t\tbegin,\n\t\tupdate,\n\t\tsettle,\n\t\tend,\n\t\trebase,\n\t\tsyncText,\n\t\tonFocus,\n\t\tonInput,\n\t\tonKeydown,\n\t\tonPaste,\n\t\tonBlur,\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","// SemVer 2.0.0, strictly: https://semver.org. The same grammar the `semver` Postgres extension stores,\n// so a version the form accepts is one the column takes, and the two order versions alike.\nconst SEMVER =\n\t/^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/\n\nconst NUMBER = /^(0|[1-9]\\d*)$/\nconst NUMBER_SO_FAR = /^(0|[1-9]\\d*)?$/\nconst PRERELEASE_IDENTIFIER = /^(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)$/\nconst BUILD_IDENTIFIER = /^[0-9a-zA-Z-]+$/\n// Any run of identifier characters can still become an identifier: `01` is not one, but `01a` is.\nconst IDENTIFIER_SO_FAR = /^[0-9a-zA-Z-]*$/\n\n/**\n * Whether the text is a version under SemVer 2.0.0: `1.4.0`, `1.4.0-beta.2`, `1.4.0+build.5`. A `v`\n * prefix, a missing part (`1.4`) and a leading zero (`01.4.0`) are not.\n * @param text - The text to check\n * @public\n */\nexport function isSemver(text: string): boolean {\n\treturn SEMVER.test(text)\n}\n\nconst splitOnce = (text: string, separator: string): [string, string | undefined] => {\n\tconst index = text.indexOf(separator)\n\treturn index === -1 ? [text, undefined] : [text.slice(0, index), text.slice(index + 1)]\n}\n\n/** Whether each dot-separated part before the last matches `whole`, and the last matches `last`. */\nconst partsMatch = (text: string, whole: RegExp, last: RegExp): boolean => {\n\tconst parts = text.split('.')\n\tconst typing = parts.pop() ?? ''\n\treturn parts.every(part => whole.test(part)) && last.test(typing)\n}\n\n/**\n * Whether typing more could still make the text a version: `1.`, `1.4.0-` and the empty text can,\n * while `v1`, `01` and `1.4-beta` cannot. Every version passes, so a box that refuses any edit failing\n * this one never stops someone typing a version.\n * @param text - The text so far\n * @public\n */\nexport function isSemverPrefix(text: string): boolean {\n\t// Neither `+` nor `-` can appear in the numbers, so the first of each ends the part before it.\n\tconst [head, build] = splitOnce(text, '+')\n\tconst [core, prerelease] = splitOnce(head, '-')\n\n\tconst coreDone = prerelease !== undefined || build !== undefined\n\tconst numbers = core.split('.').length\n\tif (numbers > 3 || (coreDone && numbers < 3)) return false\n\tif (!partsMatch(core, NUMBER, coreDone ? NUMBER : NUMBER_SO_FAR)) return false\n\n\tif (prerelease !== undefined) {\n\t\tconst last = build === undefined ? IDENTIFIER_SO_FAR : PRERELEASE_IDENTIFIER\n\t\tif (!partsMatch(prerelease, PRERELEASE_IDENTIFIER, last)) return false\n\t}\n\n\treturn build === undefined || partsMatch(build, BUILD_IDENTIFIER, IDENTIFIER_SO_FAR)\n}\n\n// Digits without leading zeros, compared without converting, so no version is too big to order.\nconst compareDigits = (a: string, b: string): number => a.length - b.length || (a < b ? -1 : a > b ? 1 : 0)\n\nconst compareIdentifiers = (a: string, b: string): number => {\n\tconst aNumeric = /^\\d+$/.test(a)\n\tconst bNumeric = /^\\d+$/.test(b)\n\tif (aNumeric && bNumeric) return compareDigits(a, b)\n\tif (aNumeric !== bNumeric) return aNumeric ? -1 : 1\n\treturn a < b ? -1 : a > b ? 1 : 0\n}\n\nconst comparePrereleases = (a: string | undefined, b: string | undefined): number => {\n\tif (a === b) return 0\n\t// A prerelease comes before its release.\n\tif (a === undefined) return 1\n\tif (b === undefined) return -1\n\n\tconst left = a.split('.')\n\tconst right = b.split('.')\n\tfor (let i = 0; i < Math.min(left.length, right.length); i++) {\n\t\tconst order = compareIdentifiers(left[i], right[i])\n\t\tif (order) return order\n\t}\n\treturn left.length - right.length\n}\n\n/**\n * Orders two versions by SemVer 2.0.0 precedence: major, minor and patch as numbers, a prerelease\n * before its release, and prerelease identifiers one by one. Build metadata does not count, so\n * `1.4.0+a` and `1.4.0+b` compare equal. Text that is not a version comes after every version.\n * @param a - The first version\n * @param b - The second version\n * @returns Negative when `a` comes first, positive when `b` does, zero when neither\n * @public\n */\nexport function compareSemver(a: string, b: string): number {\n\tconst left = SEMVER.exec(a)\n\tconst right = SEMVER.exec(b)\n\tif (!left || !right) return Number(!left) - Number(!right)\n\n\tfor (let part = 1; part <= 3; part++) {\n\t\tconst order = compareDigits(left[part], right[part])\n\t\tif (order) return order\n\t}\n\treturn comparePrereleases(left[4], right[4])\n}\n","/**\n * Fraction digits for a currency in amount inputs (e.g. JPY → 0).\n * @public\n */\nexport function currencyInputFractionDigits(currencyId: string | undefined): number {\n\tconst id = currencyId?.toUpperCase() ?? ''\n\tif (!id) return 2\n\ttry {\n\t\treturn (\n\t\t\tnew Intl.NumberFormat('en-US', {\n\t\t\t\tstyle: 'currency',\n\t\t\t\tcurrency: id,\n\t\t\t}).resolvedOptions().maximumFractionDigits ?? 2\n\t\t)\n\t} catch {\n\t\treturn 2\n\t}\n}\n\n/**\n * The separators a currency amount field writes amounts with: the locale's grouping and decimal marks.\n * @param locale - The browser's own when omitted\n * @public\n */\nexport function currencyAmountSeparators(locale?: string): { group: string; decimal: string } {\n\tconst parts = new Intl.NumberFormat(locale).formatToParts(1234567.89)\n\treturn {\n\t\tgroup: parts.find(part => part.type === 'group')?.value ?? ',',\n\t\tdecimal: parts.find(part => part.type === 'decimal')?.value ?? '.',\n\t}\n}\n\n/**\n * Format a numeric amount for display in a currency amount field (no currency symbol). The currency\n * sets the decimals; the separators are the locale's, as in the table cell.\n * @param locale - The browser's own when omitted\n * @public\n */\nexport function formatCurrencyAmountInput(\n\tamount: number | null | undefined,\n\tcurrencyId: string | undefined,\n\tlocale?: string\n): string {\n\tif (amount === null || amount === undefined) return ''\n\tconst id = currencyId?.toUpperCase() ?? ''\n\tconst fractionDigits = currencyInputFractionDigits(id)\n\treturn new Intl.NumberFormat(locale, {\n\t\tminimumFractionDigits: fractionDigits,\n\t\tmaximumFractionDigits: fractionDigits,\n\t\tuseGrouping: id !== 'JPY',\n\t}).format(amount)\n}\n\n/**\n * Parse user-entered text in a currency amount field back to a number, read with the separators the\n * field writes it with.\n * @param locale - The browser's own when omitted\n * @public\n */\nexport function parseCurrencyAmountInput(text: string, locale?: string): number | null {\n\tconst { group, decimal } = currencyAmountSeparators(locale)\n\tconst normalized = text\n\t\t.replace(/\\s/g, '')\n\t\t.replace(/[^\\d.,\\-+]/g, '')\n\t\t.replaceAll(group, '')\n\t\t.replace(decimal, '.')\n\t// No digits is no amount, though `Number('')` is 0.\n\tif (!/\\d/.test(normalized)) return null\n\tconst value = Number(normalized)\n\treturn Number.isFinite(value) ? value : null\n}\n\n/**\n * What a masked currency amount field may hold while it is typed in: digits and grouping marks, then at most one\n * decimal point followed by digits.\n * @param locale - The browser's own when omitted\n * @public\n */\nexport function currencyAmountEntryPattern(currencyId: string | undefined, locale?: string): RegExp {\n\tconst { group, decimal } = currencyAmountSeparators(locale)\n\tconst escape = (mark: string) => mark.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n\tconst whole = `-?[\\\\d${escape(group)}]*`\n\tif (currencyInputFractionDigits(currencyId) === 0) return new RegExp(`^${whole}$`)\n\t// US-style keyboards often paste/type '.' even when the locale decimal is ','.\n\tconst point = decimal === '.' ? '\\\\.' : `[${escape(decimal)}.]`\n\treturn new RegExp(`^${whole}(?:${point}\\\\d*)?$`)\n}\n","type CurrencyLike = {\n\tid?: string | number\n\tsymbol?: string\n\tdisplayText?: string\n}\n\nfunction displayScalar(value: unknown): string {\n\tif (typeof value === 'string') return value\n\tif (typeof value === 'number' || typeof value === 'bigint') return String(value)\n\tif (typeof value === 'boolean') return String(value)\n\treturn ''\n}\n\nfunction displayQty(qty: unknown): string {\n\tif (qty === null || qty === undefined || qty === '') return ''\n\treturn displayScalar(qty)\n}\n\n/**\n * Format a currency amount for display (forms, table cells). Uses `Intl` when `currency.id` is a\n * valid ISO code; otherwise falls back to symbol, display text, or id.\n * @public\n */\nexport function formatCurrencyAmount(amount: number | null | undefined, currency: CurrencyLike | undefined): string {\n\tif (amount === null || amount === undefined) return ''\n\tconst id = currency?.id != null ? String(currency.id) : ''\n\tif (id) {\n\t\ttry {\n\t\t\treturn new Intl.NumberFormat(undefined, {\n\t\t\t\tstyle: 'currency',\n\t\t\t\tcurrency: id,\n\t\t\t\tcurrencyDisplay: 'symbol',\n\t\t\t}).format(amount)\n\t\t} catch {\n\t\t\t// Not a valid ISO 4217 code — fall through to symbol / displayText.\n\t\t}\n\t}\n\tconst suffix = formatCurrencySymbol(currency)\n\treturn suffix ? `${amount} ${suffix}`.trim() : String(amount)\n}\n\n/**\n * The mark that names a currency beside an amount: the symbol `Intl` formats a valid ISO code with,\n * as {@link formatCurrencyAmount} does; otherwise its symbol, display text, or id.\n * @public\n */\nexport function formatCurrencySymbol(currency: CurrencyLike | undefined): string {\n\tconst id = currency?.id != null ? String(currency.id) : ''\n\tif (id) {\n\t\ttry {\n\t\t\tconst parts = new Intl.NumberFormat(undefined, {\n\t\t\t\tstyle: 'currency',\n\t\t\t\tcurrency: id,\n\t\t\t\tcurrencyDisplay: 'symbol',\n\t\t\t}).formatToParts(0)\n\t\t\tconst symbol = parts.find(part => part.type === 'currency')?.value\n\t\t\tif (symbol) return symbol\n\t\t} catch {\n\t\t\t// Not a valid ISO 4217 code — fall through to symbol / displayText.\n\t\t}\n\t}\n\treturn currency?.symbol ?? currency?.displayText ?? id\n}\n\n/**\n * Render a composite quantity value for table cells. Omits the UOM when it matches `stockUom`.\n * @public\n */\nexport function formatQuantityCell(value: unknown): string {\n\tif (value === null || value === undefined) return ''\n\tif (typeof value !== 'object') return displayScalar(value)\n\tconst record = value as { qty?: unknown; uom?: string; stockUom?: string }\n\tconst qtyText = displayQty(record.qty)\n\tconst uom = record.uom ?? ''\n\tconst stockUom = record.stockUom ?? ''\n\tif (!uom) return qtyText\n\tif (stockUom && uom === stockUom) return qtyText\n\treturn `${qtyText} ${uom}`.trim()\n}\n\n/**\n * Render a composite currency value for table cells.\n * @public\n */\nexport function formatCurrencyCell(value: unknown): string {\n\tif (value === null || value === undefined) return ''\n\tif (typeof value !== 'object') return displayScalar(value)\n\tconst record = value as { amount?: number | null; currency?: CurrencyLike }\n\treturn formatCurrencyAmount(record.amount, record.currency)\n}\n","import { App } from 'vue'\n\nimport { defaultKeypressHandlers, useKeyboardNav } from './composables/keyboard'\nexport { useArithmeticInput, type ArithmeticInputOptions } from './composables/arithmeticInput'\nimport { fromISODate } from './dates'\nimport { compareSemver, isSemver, isSemverPrefix } from './semver'\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 {\n\tarithmeticEntryPattern,\n\tevaluateArithmetic,\n\tisArithmeticEntry,\n\tisArithmeticKey,\n\troundToPrecision,\n\ttype NumberSeparators,\n} from './arithmetic'\nexport {\n\tcurrencyAmountEntryPattern,\n\tcurrencyAmountSeparators,\n\tcurrencyInputFractionDigits,\n\tformatCurrencyAmountInput,\n\tparseCurrencyAmountInput,\n} from './currencyAmountFormat'\nexport { formatCurrencyAmount, formatCurrencyCell, formatCurrencySymbol, formatQuantityCell } from './denominatedFormat'\nexport { compareSemver, defaultKeypressHandlers, fromISODate, install, isSemver, isSemverPrefix, useKeyboardNav }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,qBACf,SACA,EAAE,SAAS,eAAe,iBAA8C,CAAC,GACxE;CACD,MAAM,mBAAmB,IAAI,KAAK;CAElC,MAAM,qBAA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AI,KAAK,aAAa,KAAA,GAAW;GAC9C,OAAO;GACP,UAAU;GACV,iBAAiB;EAClB,CAAC,CAAC,CAAC,cAAc,CACF,CAAA,CAAM,MAAK,SAAQ,KAAK,SAAS,UAAU,CAAC,EAAE;EAC7D,IAAI,QAAQ,OAAO;CACpB,QAAQ,CAER;CAED,OAAO,UAAU,UAAU,UAAU,eAAe;AACrD;;;;;AAMA,SAAgB,mBAAmB,OAAwB;CAC1D,IAAI,UAAU,QAAQ,UAAU,KAAA,GAAW,OAAO;CAClD,IAAI,OAAO,UAAU,UAAU,OAAO,cAAc,KAAK;CACzD,MAAM,SAAS;CACf,MAAM,UAAU,WAAW,OAAO,GAAG;CACrC,MAAM,MAAM,OAAO,OAAO;CAC1B,MAAM,WAAW,OAAO,YAAY;CACpC,IAAI,CAAC,KAAK,OAAO;CACjB,IAAI,YAAY,QAAQ,UAAU,OAAO;CACzC,OAAO,GAAG,QAAQ,GAAG,MAAM,KAAK;AACjC;;;;;AAMA,SAAgB,mBAAmB,OAAwB;CAC1D,IAAI,UAAU,QAAQ,UAAU,KAAA,GAAW,OAAO;CAClD,IAAI,OAAO,UAAU,UAAU,OAAO,cAAc,KAAK;CACzD,MAAM,SAAS;CACf,OAAO,qBAAqB,OAAO,QAAQ,OAAO,QAAQ;AAC3D;;;;;;;;AC5EA,SAAS,QAAQ,MAAyB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stonecrop/utilities",
3
- "version": "0.52.0",
3
+ "version": "0.54.0",
4
4
  "description": "Shared utility functions for Stonecrop",
5
5
  "keywords": [
6
6
  "helpers",