@quidgest/ui 0.17.8 → 0.18.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.
Files changed (109) hide show
  1. package/dist/json/api.json +490 -20
  2. package/dist/manifest/components.json +3 -0
  3. package/dist/ui.css +3426 -3165
  4. package/dist/ui.esm.js +582 -614
  5. package/dist/ui.js +526 -560
  6. package/dist/ui.min.css +1 -1
  7. package/dist/ui.min.js +526 -560
  8. package/dist/ui.scss +389 -135
  9. package/esm/components/QAccordion/QAccordionItem.vue.js +1 -0
  10. package/esm/components/QCarousel/QCarousel.vue.js +1 -1
  11. package/esm/components/QCheckbox/QCheckbox.d.ts.map +1 -1
  12. package/esm/components/QCheckbox/QCheckbox.vue.js +2 -0
  13. package/esm/components/QCollapsible/QCollapsible.d.ts +2 -1
  14. package/esm/components/QCollapsible/QCollapsible.d.ts.map +1 -1
  15. package/esm/components/QCollapsible/QCollapsible.vue.js +50 -47
  16. package/esm/components/QCollapsible/constants.d.ts +6 -0
  17. package/esm/components/QCollapsible/constants.d.ts.map +1 -1
  18. package/esm/components/QCollapsible/constants.js +3 -2
  19. package/esm/components/QCollapsible/index.d.ts +6 -0
  20. package/esm/components/QCollapsible/index.d.ts.map +1 -1
  21. package/esm/components/QCollapsible/types.d.ts +11 -1
  22. package/esm/components/QCollapsible/types.d.ts.map +1 -1
  23. package/esm/components/QDateTimePicker/QDateTimePicker.d.ts.map +1 -1
  24. package/esm/components/QDateTimePicker/QDateTimePicker.vue.js +505 -597
  25. package/esm/components/QDropdownMenu/QDropdownMenuContent.d.ts +32 -16
  26. package/esm/components/QDropdownMenu/QDropdownMenuContent.d.ts.map +1 -1
  27. package/esm/components/QDropdownMenu/QDropdownMenuContent.vue.js +179 -86
  28. package/esm/components/QDropdownMenu/types.d.ts +6 -0
  29. package/esm/components/QDropdownMenu/types.d.ts.map +1 -1
  30. package/esm/components/QField/types.d.ts +3 -0
  31. package/esm/components/QField/types.d.ts.map +1 -1
  32. package/esm/components/QLabel/QLabel.d.ts.map +1 -1
  33. package/esm/components/QLabel/QLabel.vue.js +19 -17
  34. package/esm/components/QLabel/types.d.ts +3 -0
  35. package/esm/components/QLabel/types.d.ts.map +1 -1
  36. package/esm/components/QObfuscation/QObfuscation.d.ts +74 -0
  37. package/esm/components/QObfuscation/QObfuscation.d.ts.map +1 -0
  38. package/esm/components/QObfuscation/QObfuscation.vue.js +183 -0
  39. package/esm/components/QObfuscation/QObfuscation2.vue.js +5 -0
  40. package/esm/components/QObfuscation/constants.d.ts +17 -0
  41. package/esm/components/QObfuscation/constants.d.ts.map +1 -0
  42. package/esm/components/QObfuscation/constants.js +12 -0
  43. package/esm/components/QObfuscation/index.d.ts +162 -0
  44. package/esm/components/QObfuscation/index.d.ts.map +1 -0
  45. package/esm/components/QObfuscation/index.js +6 -0
  46. package/esm/components/QObfuscation/types.d.ts +44 -0
  47. package/esm/components/QObfuscation/types.d.ts.map +1 -0
  48. package/esm/components/QTabs/QTab.d.ts +172 -0
  49. package/esm/components/QTabs/QTab.d.ts.map +1 -0
  50. package/esm/components/QTabs/QTab.vue.js +122 -0
  51. package/esm/components/QTabs/QTab2.vue.js +5 -0
  52. package/esm/components/QTabs/QTabs.d.ts +35 -0
  53. package/esm/components/QTabs/QTabs.d.ts.map +1 -0
  54. package/esm/components/QTabs/QTabs.vue.js +83 -0
  55. package/esm/components/QTabs/QTabs2.vue.js +5 -0
  56. package/esm/components/QTabs/constants.d.ts +5 -0
  57. package/esm/components/QTabs/constants.d.ts.map +1 -0
  58. package/esm/components/QTabs/context.d.ts +78 -0
  59. package/esm/components/QTabs/context.d.ts.map +1 -0
  60. package/esm/components/QTabs/context.js +4 -0
  61. package/esm/components/QTabs/index.d.ts +164 -0
  62. package/esm/components/QTabs/index.d.ts.map +1 -0
  63. package/esm/components/QTabs/index.js +7 -0
  64. package/esm/components/QTabs/types.d.ts +106 -0
  65. package/esm/components/QTabs/types.d.ts.map +1 -0
  66. package/esm/components/__internal__/QRequiredIndicator/QRequiredIndicator.d.ts +7 -0
  67. package/esm/components/__internal__/QRequiredIndicator/QRequiredIndicator.d.ts.map +1 -0
  68. package/esm/components/__internal__/QRequiredIndicator/QRequiredIndicator.vue.js +24 -0
  69. package/esm/components/__internal__/QRequiredIndicator/QRequiredIndicator2.vue.js +5 -0
  70. package/esm/components/__internal__/QRequiredIndicator/constants.d.ts +7 -0
  71. package/esm/components/__internal__/QRequiredIndicator/constants.d.ts.map +1 -0
  72. package/esm/components/__internal__/QRequiredIndicator/constants.js +4 -0
  73. package/esm/components/__internal__/QRequiredIndicator/index.d.ts +6 -0
  74. package/esm/components/__internal__/QRequiredIndicator/index.d.ts.map +1 -0
  75. package/esm/components/__internal__/QRequiredIndicator/index.js +6 -0
  76. package/esm/components/__internal__/QRequiredIndicator/types.d.ts +18 -0
  77. package/esm/components/__internal__/QRequiredIndicator/types.d.ts.map +1 -0
  78. package/esm/components/__internal__/QSafeTriangle/QSafeTriangle.d.ts +10 -0
  79. package/esm/components/__internal__/QSafeTriangle/QSafeTriangle.d.ts.map +1 -0
  80. package/esm/components/__internal__/QSafeTriangle/QSafeTriangle.vue.js +31 -0
  81. package/esm/components/__internal__/QSafeTriangle/QSafeTriangle2.vue.js +5 -0
  82. package/esm/components/__internal__/QSafeTriangle/index.d.ts +10 -0
  83. package/esm/components/__internal__/QSafeTriangle/index.d.ts.map +1 -0
  84. package/esm/components/__internal__/QSafeTriangle/index.js +6 -0
  85. package/esm/components/__internal__/QSafeTriangle/types.d.ts +33 -0
  86. package/esm/components/__internal__/QSafeTriangle/types.d.ts.map +1 -0
  87. package/esm/components/index.d.ts +2 -0
  88. package/esm/components/index.d.ts.map +1 -1
  89. package/esm/components/index.js +37 -32
  90. package/esm/composables/useSafeTriangle/index.d.ts +31 -0
  91. package/esm/composables/useSafeTriangle/index.d.ts.map +1 -0
  92. package/esm/composables/useSafeTriangle/index.js +87 -0
  93. package/esm/index.d.ts +3 -0
  94. package/esm/utils/date.d.ts +36 -1
  95. package/esm/utils/date.d.ts.map +1 -1
  96. package/esm/utils/date.js +90 -1
  97. package/esm/utils/index.d.ts +1 -0
  98. package/esm/utils/index.d.ts.map +1 -1
  99. package/esm/utils/index.js +30 -24
  100. package/esm/utils/mask.d.ts +17 -0
  101. package/esm/utils/mask.d.ts.map +1 -0
  102. package/esm/utils/mask.js +154 -0
  103. package/esm/utils/safeTriangle.d.ts +68 -0
  104. package/esm/utils/safeTriangle.d.ts.map +1 -0
  105. package/esm/utils/safeTriangle.js +83 -0
  106. package/package.json +6 -6
  107. package/esm/composables/useInputMask/index.d.ts +0 -50
  108. package/esm/composables/useInputMask/index.d.ts.map +0 -1
  109. package/esm/composables/useInputMask/index.js +0 -408
@@ -0,0 +1,31 @@
1
+ import { Placement } from '../overlay';
2
+ import { Ref } from 'vue';
3
+ type UseSafeTriangleOptions = {
4
+ enabled: Ref<boolean>;
5
+ placement: Ref<Placement>;
6
+ getParentRect: () => DOMRect | null;
7
+ getContentRect: () => DOMRect | null;
8
+ getContentRoot: () => HTMLElement | null;
9
+ shouldSuppressLeave: () => boolean;
10
+ onLeave: () => void;
11
+ /** Called when the pointer enters the open submenu (or a deeper nested menu). */
12
+ onEnterContent?: (clientX: number, clientY: number) => void;
13
+ };
14
+ /**
15
+ * Tracks pointer movement and exposes safe triangle geometry for nested submenus.
16
+ */
17
+ export declare function useSafeTriangle(options: UseSafeTriangleOptions): {
18
+ visible: Ref<boolean, boolean>;
19
+ top: Ref<number, number>;
20
+ left: Ref<number, number>;
21
+ width: Ref<number, number>;
22
+ height: Ref<number, number>;
23
+ path: Ref<string, string>;
24
+ refresh: (clientX?: number, clientY?: number) => void;
25
+ getLastPointer: () => {
26
+ x: number;
27
+ y: number;
28
+ };
29
+ };
30
+ export {};
31
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/useSafeTriangle/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAW3C,OAAO,EAA+B,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AAE3D,KAAK,sBAAsB,GAAG;IAC7B,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACrB,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,CAAA;IACzB,aAAa,EAAE,MAAM,OAAO,GAAG,IAAI,CAAA;IACnC,cAAc,EAAE,MAAM,OAAO,GAAG,IAAI,CAAA;IACpC,cAAc,EAAE,MAAM,WAAW,GAAG,IAAI,CAAA;IACxC,mBAAmB,EAAE,MAAM,OAAO,CAAA;IAClC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,iFAAiF;IACjF,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAC3D,CAAA;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB;;;;;;;wBA4HnC,MAAM,YAAY,MAAM;;;;;EA0DnD"}
@@ -0,0 +1,87 @@
1
+ import { getSafeTriangleGeometry as e, isPointInRect as t, isPointerInsideMenuTree as n, isPointerMovingTowardSubmenu as r, resolveSafeTrianglePlacement as i } from "../../utils/safeTriangle.js";
2
+ import { onBeforeUnmount as a, ref as o, watch as s } from "vue";
3
+ //#region src/composables/useSafeTriangle/index.ts
4
+ function c(c) {
5
+ let l = o(!1), u = o(0), d = o(0), f = o(0), p = o(0), m = o(""), h = !1, g = {
6
+ x: 0,
7
+ y: 0
8
+ }, _ = null, v = !1;
9
+ function y(e, t) {
10
+ return i(c.placement.value, e, t);
11
+ }
12
+ function b(t, n, r, i) {
13
+ if (!i) {
14
+ l.value = !1;
15
+ return;
16
+ }
17
+ let a = e(y(r, i), i, t, n);
18
+ if (!a) {
19
+ l.value = !1;
20
+ return;
21
+ }
22
+ l.value = !0, u.value = a.top, d.value = a.left, f.value = a.width, p.value = a.height, m.value = a.path;
23
+ }
24
+ function x(e, r) {
25
+ let i = c.getContentRect(), a = c.getContentRoot();
26
+ return i !== null && t(e, r, i) || a !== null && n(e, r, a);
27
+ }
28
+ function S(e, n) {
29
+ let i = c.getParentRect(), a = c.getContentRect(), o = c.getContentRoot();
30
+ if (x(e, n)) {
31
+ l.value = !1, v || c.onEnterContent?.(e, n), v = !0;
32
+ return;
33
+ }
34
+ if (v = !1, i && t(e, n, i)) {
35
+ _ = {
36
+ x: e,
37
+ y: n
38
+ }, b(e, n, i, a);
39
+ return;
40
+ }
41
+ if (!a || !_) {
42
+ l.value = !1;
43
+ return;
44
+ }
45
+ if (!r(e, n, i, a, y(i, a), _, o)) {
46
+ l.value = !1, c.shouldSuppressLeave() || c.onLeave();
47
+ return;
48
+ }
49
+ b(_.x, _.y, i, a);
50
+ }
51
+ function C(e) {
52
+ g = {
53
+ x: e.clientX,
54
+ y: e.clientY
55
+ }, c.enabled.value && S(e.clientX, e.clientY);
56
+ }
57
+ function w(e, t) {
58
+ e !== void 0 && t !== void 0 && (g = {
59
+ x: e,
60
+ y: t
61
+ }), c.enabled.value && S(g.x, g.y);
62
+ }
63
+ function T() {
64
+ h || (h = !0, document.addEventListener("pointermove", C, !0));
65
+ }
66
+ function E() {
67
+ h && (h = !1, document.removeEventListener("pointermove", C, !0), l.value = !1, v = !1, _ = null);
68
+ }
69
+ return s(c.enabled, (e) => {
70
+ if (e) {
71
+ v = !1;
72
+ let e = c.getParentRect();
73
+ _ = e && t(g.x, g.y, e) ? { ...g } : null, T(), w();
74
+ } else E();
75
+ }, { immediate: !0 }), a(E), {
76
+ visible: l,
77
+ top: u,
78
+ left: d,
79
+ width: f,
80
+ height: p,
81
+ path: m,
82
+ refresh: w,
83
+ getLastPointer: () => ({ ...g })
84
+ };
85
+ }
86
+ //#endregion
87
+ export { c as useSafeTriangle };
package/esm/index.d.ts CHANGED
@@ -48,6 +48,7 @@ declare module '@vue/runtime-core' {
48
48
  QListItem: typeof import('@quidgest/ui/components')['QListItem']
49
49
  QListItemGroup: typeof import('@quidgest/ui/components')['QListItemGroup']
50
50
  QMeter: typeof import('@quidgest/ui/components')['QMeter']
51
+ QObfuscation: typeof import('@quidgest/ui/components')['QObfuscation']
51
52
  QOverlay: typeof import('@quidgest/ui/components')['QOverlay']
52
53
  QPasswordField: typeof import('@quidgest/ui/components')['QPasswordField']
53
54
  QPopover: typeof import('@quidgest/ui/components')['QPopover']
@@ -62,6 +63,8 @@ declare module '@vue/runtime-core' {
62
63
  QSkeletonLoader: typeof import('@quidgest/ui/components')['QSkeletonLoader']
63
64
  QSpinnerLoader: typeof import('@quidgest/ui/components')['QSpinnerLoader']
64
65
  QSwitch: typeof import('@quidgest/ui/components')['QSwitch']
66
+ QTabs: typeof import('@quidgest/ui/components')['QTabs']
67
+ QTab: typeof import('@quidgest/ui/components')['QTab']
65
68
  QTextArea: typeof import('@quidgest/ui/components')['QTextArea']
66
69
  QTextField: typeof import('@quidgest/ui/components')['QTextField']
67
70
  DEFAULT_TEXTS: typeof import('@quidgest/ui/components')['DEFAULT_TEXTS']
@@ -2,7 +2,7 @@
2
2
  * Converts a date format pattern to an input mask pattern.
3
3
  * Supports numeric, textual, weekday, meridiem, milliseconds and quoted literal tokens.
4
4
  * @param format Date format pattern (e.g. `dd/MM/yyyy HH:mm`).
5
- * @returns Mask string consumed by `useInputMask`.
5
+ * @returns Mask string.
6
6
  * @example
7
7
  * convertDatePatternToMask('dd/MM/yyyy') => '##/##/####'
8
8
  * convertDatePatternToMask('HH:mm:ss') => '##:##:##'
@@ -193,4 +193,39 @@ export declare function getFirstDayOfMonth(date: Date): Date;
193
193
  * @returns New date set to the last day of that month.
194
194
  */
195
195
  export declare function getLastDayOfMonth(date: Date): Date;
196
+ /**
197
+ * Advances the value cursor past a format literal when it is present in the input.
198
+ * @param value Date formatted string.
199
+ * @param cursor The position of the cursor in value.
200
+ * @param token A string that represents part of the date format (ex. 'yyyy', 'MM', 'dd').
201
+ * @returns Updated cursor, or `null` when the literal is not yet in the value.
202
+ */
203
+ export declare function advancePastFormatLiteral(value: string, cursor: number, token: string): number | null;
204
+ /**
205
+ * Get the string value of the part of the datetime within it's range of possible valid values
206
+ * and padded to the specified number of digits.
207
+ * @param token A string that represents part of the date format (ex. 'yyyy', 'MM', 'dd').
208
+ * @param digits A string of digit characters that represents part of a datetime value (year, month, day etc.)
209
+ * @param value The actual numeric value of a part of a datetime (year, month, day etc.)
210
+ * @returns Normalized string value of the part of the datetime.
211
+ */
212
+ export declare function normalizeNumericToken(token: string, digits: string, value: number): string;
213
+ /**
214
+ * Get the string value of the datetime where the day is guaranteed to be within it's range of valid values.
215
+ * @param value Date formatted string.
216
+ * @param tokens Strings that represent parts of the date format (ex. 'yyyy', 'MM', 'dd').
217
+ * @returns String value of the datetime with the day clamped to it's maximum possible value.
218
+ */
219
+ export declare function clampDayByMonthYear(value: string, tokens: string[]): string;
220
+ /**
221
+ * Clamps fully-typed numeric segments to valid ranges for the provided format.
222
+ * @param value Masked user input.
223
+ * @param format Date/time format pattern.
224
+ * @param options Options
225
+ * @param options.padMaxDigits Whether to pad each segment to it's maximum digits
226
+ * @returns Input with out-of-range numeric segments normalized.
227
+ */
228
+ export declare function clampNumericSegments(value: string, format: string, options?: {
229
+ padMaxDigits: boolean;
230
+ }): string;
196
231
  //# sourceMappingURL=date.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/utils/date.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAqE/D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAExD;A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,IAAI,EAAE,IAAI,GAAG,IAAI,CAI9C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAI5C;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAItD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAI1D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAElD;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACvC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACX,MAAM,GAAG,IAAI,CAiBf;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAuB1F;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CA6D3E;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;IAAE,YAAY,EAAE,OAAO,CAAA;CAAE,GACjC,MAAM,CAwER"}
package/esm/utils/date.js CHANGED
@@ -476,5 +476,94 @@ function T(e) {
476
476
  function E(e) {
477
477
  return new Date(e.getFullYear(), e.getMonth() + 1, 0);
478
478
  }
479
+ function D(e, t, n) {
480
+ if (n.startsWith("'")) {
481
+ let r = n.slice(1, -1).replace(/''/g, "'");
482
+ return e.slice(t).startsWith(r) ? t + r.length : null;
483
+ }
484
+ if (n === "a") {
485
+ let n = e.slice(t), r = n.match(/^\s*(AM|PM)/i);
486
+ return r ? t + r[0].length : n.startsWith(" ") ? t + 1 : null;
487
+ }
488
+ return t >= e.length || e[t] !== n ? null : t + 1;
489
+ }
490
+ function O(e, t, n) {
491
+ let r = n;
492
+ return (e === "MM" || e === "M") && (r = Math.min(12, Math.max(1, n))), (e === "dd" || e === "d") && (r = Math.min(31, Math.max(1, n))), (e === "HH" || e === "H") && (r = Math.min(23, Math.max(0, n))), (e === "hh" || e === "h") && (r = Math.min(12, Math.max(1, n))), (e === "mm" || e === "m" || e === "ss" || e === "s") && (r = Math.min(59, Math.max(0, n))), t.length > 1 ? a(r, t.length) : r === 0 && (e === "hh" || e === "h" || e === "MM" || e === "M" || e === "dd" || e === "d") ? "1" : String(r);
493
+ }
494
+ function k(e, t) {
495
+ let n = null, r = null, i = -1, o = 0, s = null, c = 0;
496
+ for (let a of t) {
497
+ if (a.startsWith("'")) {
498
+ let t = D(e, c, a);
499
+ if (t === null) break;
500
+ c = t;
501
+ continue;
502
+ }
503
+ let t = a === "yyyy" ? 4 : a === "yy" || [
504
+ "MM",
505
+ "dd",
506
+ "M",
507
+ "d"
508
+ ].includes(a) ? 2 : 0;
509
+ if (t === 0) {
510
+ let t = D(e, c, a);
511
+ if (t === null) break;
512
+ c = t;
513
+ continue;
514
+ }
515
+ let l = e.slice(c).match(/^\d+/)?.[0]?.slice(0, t) ?? "";
516
+ if (!l) continue;
517
+ let u = c + l.length;
518
+ if (!(l.length === t || u < e.length && !/\d/.test(e[u]))) continue;
519
+ let d = Number.parseInt(l, 10);
520
+ Number.isNaN(d) || ((a === "MM" || a === "M") && (n = Math.min(12, Math.max(1, d))), a === "yyyy" && (r = d), a === "yy" && (r = d < 50 ? 2e3 + d : 1900 + d), (a === "dd" || a === "d") && (i = c, o = l.length, s = Math.max(1, d)), c = u);
521
+ }
522
+ if (i < 0 || s === null || n === null || r === null) return e;
523
+ let l = h(n - 1, r);
524
+ if (s <= l) return e;
525
+ let u = o > 1 ? a(l, o) : String(l);
526
+ return `${e.slice(0, i)}${u}${e.slice(i + o)}`;
527
+ }
528
+ function A(e, t, n) {
529
+ let r = t.match(/yyyy|yy|MMMM|MMM|MM|M|dd|d|EEEE|EEE|HH|H|hh|h|mm|m|ss|s|SSS|S|a|'(?:''|[^'])*'|./g) ?? [], i = e, o = 0;
530
+ for (let e of r) {
531
+ if (e.startsWith("'")) {
532
+ let t = D(i, o, e);
533
+ if (t === null) break;
534
+ o = t;
535
+ continue;
536
+ }
537
+ let t = e === "yyyy" ? 4 : e === "yy" ? 2 : e === "SSS" ? 3 : e === "S" ? 1 : [
538
+ "MM",
539
+ "dd",
540
+ "HH",
541
+ "hh",
542
+ "mm",
543
+ "ss",
544
+ "M",
545
+ "d",
546
+ "H",
547
+ "h",
548
+ "m",
549
+ "s"
550
+ ].includes(e) ? 2 : 0;
551
+ if (t === 0) {
552
+ let t = D(i, o, e);
553
+ if (t === null) break;
554
+ o = t;
555
+ continue;
556
+ }
557
+ let r = i.slice(o).match(/^\d+/)?.[0]?.slice(0, t) ?? "";
558
+ if (!r) continue;
559
+ let s = o + r.length;
560
+ if (!(r.length === t || s < i.length && !/\d/.test(i[s]))) continue;
561
+ let c = Number.parseInt(r, 10);
562
+ if (Number.isNaN(c)) continue;
563
+ let l = O(e, n?.padMaxDigits ? a(r, t) : r, c);
564
+ i = `${i.slice(0, o)}${l}${i.slice(s)}`, o += l.length;
565
+ }
566
+ return k(i, r);
567
+ }
479
568
  //#endregion
480
- export { C as addDays, w as addMonths, d as completePartialDateInput, e as convertDatePatternToMask, y as formatDate, n as formatUsesSeconds, t as formatUsesTime, h as getDaysInMonth, S as getEndOfDay, T as getFirstDayOfMonth, g as getFirstDayOfWeek, E as getLastDayOfMonth, x as getStartOfDay, f as inputIncludesTimePortion, v as isBetween, m as isLeapYear, _ as isSameDay, i as isTimeOnlyFormat, a as padNumber, b as parseDate, p as parseDateWithCompletion, s as parseIsoDate, r as uses12HourFormat };
569
+ export { C as addDays, w as addMonths, D as advancePastFormatLiteral, k as clampDayByMonthYear, A as clampNumericSegments, d as completePartialDateInput, e as convertDatePatternToMask, y as formatDate, n as formatUsesSeconds, t as formatUsesTime, h as getDaysInMonth, S as getEndOfDay, T as getFirstDayOfMonth, g as getFirstDayOfWeek, E as getLastDayOfMonth, x as getStartOfDay, f as inputIncludesTimePortion, v as isBetween, m as isLeapYear, _ as isSameDay, i as isTimeOnlyFormat, O as normalizeNumericToken, a as padNumber, b as parseDate, p as parseDateWithCompletion, s as parseIsoDate, r as uses12HourFormat };
@@ -16,4 +16,5 @@
16
16
  */
17
17
  export * from './color';
18
18
  export * from './date';
19
+ export * from './mask';
19
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA"}
@@ -4,45 +4,51 @@ import { isValidHex as o, parseColor as s, tryParseRgb as c } from "./color/pars
4
4
  import { getComplementaryColor as l, getContrastingColor as u } from "./color/contrast.js";
5
5
  import { darken as d, lighten as f } from "./color/manipulate.js";
6
6
  import { mergeColorSchemes as p } from "./color/merge.js";
7
- import { addDays as m, addMonths as h, completePartialDateInput as g, convertDatePatternToMask as _, formatDate as v, formatUsesSeconds as y, formatUsesTime as b, getDaysInMonth as x, getEndOfDay as S, getFirstDayOfMonth as C, getFirstDayOfWeek as w, getLastDayOfMonth as T, getStartOfDay as E, inputIncludesTimePortion as D, isBetween as O, isLeapYear as k, isSameDay as A, isTimeOnlyFormat as j, padNumber as M, parseDate as N, parseDateWithCompletion as P, parseIsoDate as F, uses12HourFormat as I } from "./date.js";
7
+ import { addDays as m, addMonths as h, advancePastFormatLiteral as g, clampDayByMonthYear as _, clampNumericSegments as v, completePartialDateInput as y, convertDatePatternToMask as b, formatDate as x, formatUsesSeconds as S, formatUsesTime as C, getDaysInMonth as w, getEndOfDay as T, getFirstDayOfMonth as E, getFirstDayOfWeek as D, getLastDayOfMonth as O, getStartOfDay as k, inputIncludesTimePortion as A, isBetween as j, isLeapYear as M, isSameDay as N, isTimeOnlyFormat as P, normalizeNumericToken as F, padNumber as I, parseDate as L, parseDateWithCompletion as R, parseIsoDate as z, uses12HourFormat as B } from "./date.js";
8
+ import { applyMask as V } from "./mask.js";
8
9
  //#region src/utils/index.ts
9
- var L = /* @__PURE__ */ e({
10
+ var H = /* @__PURE__ */ e({
10
11
  addDays: () => m,
11
12
  addMonths: () => h,
12
- completePartialDateInput: () => g,
13
- convertDatePatternToMask: () => _,
13
+ advancePastFormatLiteral: () => g,
14
+ applyMask: () => V,
15
+ clampDayByMonthYear: () => _,
16
+ clampNumericSegments: () => v,
17
+ completePartialDateInput: () => y,
18
+ convertDatePatternToMask: () => b,
14
19
  darken: () => d,
15
- formatDate: () => v,
16
- formatUsesSeconds: () => y,
17
- formatUsesTime: () => b,
20
+ formatDate: () => x,
21
+ formatUsesSeconds: () => S,
22
+ formatUsesTime: () => C,
18
23
  getComplementaryColor: () => l,
19
24
  getContrastingColor: () => u,
20
- getDaysInMonth: () => x,
21
- getEndOfDay: () => S,
22
- getFirstDayOfMonth: () => C,
23
- getFirstDayOfWeek: () => w,
24
- getLastDayOfMonth: () => T,
25
- getStartOfDay: () => E,
25
+ getDaysInMonth: () => w,
26
+ getEndOfDay: () => T,
27
+ getFirstDayOfMonth: () => E,
28
+ getFirstDayOfWeek: () => D,
29
+ getLastDayOfMonth: () => O,
30
+ getStartOfDay: () => k,
26
31
  hslToRgb: () => t,
27
32
  hueToRgb: () => n,
28
- inputIncludesTimePortion: () => D,
29
- isBetween: () => O,
30
- isLeapYear: () => k,
31
- isSameDay: () => A,
32
- isTimeOnlyFormat: () => j,
33
+ inputIncludesTimePortion: () => A,
34
+ isBetween: () => j,
35
+ isLeapYear: () => M,
36
+ isSameDay: () => N,
37
+ isTimeOnlyFormat: () => P,
33
38
  isValidHex: () => o,
34
39
  lighten: () => f,
35
40
  mergeColorSchemes: () => p,
36
- padNumber: () => M,
41
+ normalizeNumericToken: () => F,
42
+ padNumber: () => I,
37
43
  parseColor: () => s,
38
- parseDate: () => N,
39
- parseDateWithCompletion: () => P,
40
- parseIsoDate: () => F,
44
+ parseDate: () => L,
45
+ parseDateWithCompletion: () => R,
46
+ parseIsoDate: () => z,
41
47
  rgbToHex: () => r,
42
48
  rgbToHsl: () => i,
43
49
  rgbToVariableString: () => a,
44
50
  tryParseRgb: () => c,
45
- uses12HourFormat: () => I
51
+ uses12HourFormat: () => B
46
52
  });
47
53
  //#endregion
48
- export { m as addDays, h as addMonths, g as completePartialDateInput, _ as convertDatePatternToMask, d as darken, v as formatDate, y as formatUsesSeconds, b as formatUsesTime, l as getComplementaryColor, u as getContrastingColor, x as getDaysInMonth, S as getEndOfDay, C as getFirstDayOfMonth, w as getFirstDayOfWeek, T as getLastDayOfMonth, E as getStartOfDay, t as hslToRgb, n as hueToRgb, D as inputIncludesTimePortion, O as isBetween, k as isLeapYear, A as isSameDay, j as isTimeOnlyFormat, o as isValidHex, f as lighten, p as mergeColorSchemes, M as padNumber, s as parseColor, N as parseDate, P as parseDateWithCompletion, F as parseIsoDate, r as rgbToHex, i as rgbToHsl, a as rgbToVariableString, c as tryParseRgb, I as uses12HourFormat, L as utils_exports };
54
+ export { m as addDays, h as addMonths, g as advancePastFormatLiteral, V as applyMask, _ as clampDayByMonthYear, v as clampNumericSegments, y as completePartialDateInput, b as convertDatePatternToMask, d as darken, x as formatDate, S as formatUsesSeconds, C as formatUsesTime, l as getComplementaryColor, u as getContrastingColor, w as getDaysInMonth, T as getEndOfDay, E as getFirstDayOfMonth, D as getFirstDayOfWeek, O as getLastDayOfMonth, k as getStartOfDay, t as hslToRgb, n as hueToRgb, A as inputIncludesTimePortion, j as isBetween, M as isLeapYear, N as isSameDay, P as isTimeOnlyFormat, o as isValidHex, f as lighten, p as mergeColorSchemes, F as normalizeNumericToken, I as padNumber, s as parseColor, L as parseDate, R as parseDateWithCompletion, z as parseIsoDate, r as rgbToHex, i as rgbToHsl, a as rgbToVariableString, c as tryParseRgb, B as uses12HourFormat, H as utils_exports };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Applies a mask pattern to an input value.
3
+ * The mask supports:
4
+ * - `#` / `n`: single numeric digit
5
+ * - `A`: single alphabetic character, normalized to uppercase
6
+ * - `a`: single alphabetic character, normalized to lowercase
7
+ * - `p`: meridiem token (`AM` or `PM` only)
8
+ * - `W`: variable-width alphabetic segment
9
+ * - any other character: fixed separator/literal
10
+ * @param value Raw user input.
11
+ * @param maskPattern Mask to apply.
12
+ * @returns Masked value normalized to the provided pattern.
13
+ * @example
14
+ * applyMask('1234567', '##/##/####') => '12/34/567'
15
+ */
16
+ export declare function applyMask(value: string, maskPattern: string): string;
17
+ //# sourceMappingURL=mask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mask.d.ts","sourceRoot":"","sources":["../../src/utils/mask.ts"],"names":[],"mappings":"AA0MA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAsGpE"}
@@ -0,0 +1,154 @@
1
+ //#region src/utils/mask.ts
2
+ function e(e) {
3
+ return /[\p{L}\s.'-]/u.test(e);
4
+ }
5
+ function t(e, t) {
6
+ let n = t;
7
+ for (; n < e.length;) {
8
+ let t = e[n];
9
+ if (t === "!") {
10
+ n += 2;
11
+ continue;
12
+ }
13
+ if (t === "#" || t === "n" || t === "A" || t === "a" || t === "W" || t === "p") return n;
14
+ n += 1;
15
+ }
16
+ return -1;
17
+ }
18
+ function n(e, t) {
19
+ let n = t;
20
+ for (; n < e.length && e[n] === " ";) n += 1;
21
+ let r = "", i = n;
22
+ for (; i < e.length && /[A-Za-z]/.test(e[i] ?? "");) {
23
+ let t = (e[i] ?? "").toUpperCase();
24
+ if (r.length === 0) {
25
+ if (t === "A" || t === "P") {
26
+ r = `${t}M`, i += 1, i < e.length && (e[i] ?? "").toUpperCase() === "M" && (i += 1);
27
+ break;
28
+ }
29
+ } else if (r.length === 1 && t === "M") {
30
+ r += "M", i += 1;
31
+ break;
32
+ }
33
+ i += 1;
34
+ }
35
+ for (; i < e.length && /[A-Za-z]/.test(e[i] ?? "");) i += 1;
36
+ return {
37
+ consumed: i - t,
38
+ text: r
39
+ };
40
+ }
41
+ function r(t, n) {
42
+ let r = 0, i = 0;
43
+ for (; i < n.length;) {
44
+ let a = n[i];
45
+ if (a === "p") return r;
46
+ if (a === "!") {
47
+ let e = n[i + 1];
48
+ e && t[r] === e && (r += 1), i += 2;
49
+ continue;
50
+ }
51
+ if (a === "#" || a === "n") {
52
+ if (/\d/.test(t[r] ?? "")) {
53
+ r += 1, i += 1;
54
+ continue;
55
+ }
56
+ return -1;
57
+ }
58
+ if (a === "A" || a === "a") {
59
+ if (e(t[r] ?? "")) {
60
+ r += 1, i += 1;
61
+ continue;
62
+ }
63
+ return -1;
64
+ }
65
+ if (a === "W") {
66
+ let a = n[i + 1];
67
+ if (e(t[r] ?? "") && t[r] !== a) {
68
+ r += 1;
69
+ continue;
70
+ }
71
+ i += 1;
72
+ continue;
73
+ }
74
+ if (t[r] === a) {
75
+ r += 1, i += 1;
76
+ continue;
77
+ }
78
+ if (a === " " && n[i + 1] === "p") {
79
+ let e = t[r];
80
+ if ((e === void 0 || e === " " || /[A-Za-z]/.test(e)) && (i += 1, n[i] === "p")) return r;
81
+ }
82
+ return -1;
83
+ }
84
+ return -1;
85
+ }
86
+ function i(e, t, i) {
87
+ let a = r(e, t);
88
+ return a < 0 || i <= a ? "" : n(e.slice(0, i), a).text;
89
+ }
90
+ function a(e, t) {
91
+ let n = t.toUpperCase();
92
+ if (n === "AM" || n === "PM") return !1;
93
+ let r = e.toUpperCase();
94
+ return t ? n.length === 1 && (n === "A" || n === "P") ? r === "M" : !1 : r === "A" || r === "P";
95
+ }
96
+ function o(t, n) {
97
+ return n === "#" || n === "n" ? /\d/.test(t) : n === "p" ? a(t, "") : n === "A" || n === "a" || n === "W" ? e(t) : t === n;
98
+ }
99
+ function s(e, n, r, s, c) {
100
+ let l = t(n, r);
101
+ if (l < 0) return !1;
102
+ let u = n[l];
103
+ return !u || u === "!" ? !1 : u === "p" ? a(e, s !== void 0 && c !== void 0 ? i(s, n, c) : "") : o(e, u);
104
+ }
105
+ function c(t, r) {
106
+ let i = "", a = 0, o = 0;
107
+ for (; o < r.length && a < t.length;) {
108
+ let c = r[o], l = t[a];
109
+ if (c === "!") {
110
+ let e = r[o + 1];
111
+ if (!e) break;
112
+ l === e ? (i += e, a++) : i += e, o += 2;
113
+ continue;
114
+ }
115
+ if (c === "#") if (/\d/.test(l)) i += l, a++;
116
+ else {
117
+ a++;
118
+ continue;
119
+ }
120
+ else if (c === "n") /\d/.test(l) && (i += l, a++);
121
+ else if (c === "A" || c === "a") if (e(l)) i += c === "A" ? l.toUpperCase() : l.toLowerCase(), a++;
122
+ else {
123
+ a++;
124
+ continue;
125
+ }
126
+ else if (c === "p") {
127
+ let e = n(t, a);
128
+ if (e.consumed === 0) break;
129
+ a += e.consumed, e.text && (i += e.text), o++;
130
+ continue;
131
+ } else if (c === "W") {
132
+ let n = r[o + 1], s = !1;
133
+ for (; a < t.length;) {
134
+ let r = t[a];
135
+ if (n && r === n && s) break;
136
+ if (e(r)) {
137
+ i += r, a++, s = !0;
138
+ continue;
139
+ }
140
+ if (n && r === n) break;
141
+ a++;
142
+ }
143
+ } else if (l === c) i += c, a++;
144
+ else if (/\d/.test(l)) i += c;
145
+ else if (s(l, r, o + 1, t, a)) {
146
+ i += c, o++;
147
+ continue;
148
+ } else a++;
149
+ o++;
150
+ }
151
+ return i;
152
+ }
153
+ //#endregion
154
+ export { c as applyMask };
@@ -0,0 +1,68 @@
1
+ import { Placement } from '../composables/overlay';
2
+ export type SafeTriangleGeometry = {
3
+ left: number;
4
+ top: number;
5
+ width: number;
6
+ height: number;
7
+ path: string;
8
+ };
9
+ export type SafeTriangleVertices = {
10
+ a: {
11
+ x: number;
12
+ y: number;
13
+ };
14
+ b: {
15
+ x: number;
16
+ y: number;
17
+ };
18
+ c: {
19
+ x: number;
20
+ y: number;
21
+ };
22
+ };
23
+ export type Point = {
24
+ x: number;
25
+ y: number;
26
+ };
27
+ /**
28
+ * Returns whether a point lies inside an axis-aligned rectangle.
29
+ */
30
+ export declare function isPointInRect(x: number, y: number, rect: DOMRect): boolean;
31
+ /**
32
+ * Returns whether a point lies inside the triangle defined by three vertices.
33
+ */
34
+ export declare function isPointInTriangle(x: number, y: number, a: {
35
+ x: number;
36
+ y: number;
37
+ }, b: {
38
+ x: number;
39
+ y: number;
40
+ }, c: {
41
+ x: number;
42
+ y: number;
43
+ }): boolean;
44
+ /**
45
+ * Picks left/right safe-triangle placement from where the submenu actually sits
46
+ * relative to its parent (handles overlay flip).
47
+ */
48
+ export declare function resolveSafeTrianglePlacement(preferred: Placement, parentRect: DOMRect | null, contentRect: DOMRect | null): Placement;
49
+ /**
50
+ * Builds safe triangle vertices for a submenu placement.
51
+ */
52
+ export declare function getSafeTriangleVertices(placement: Placement, contentRect: DOMRect, cursorX: number, cursorY: number): SafeTriangleVertices | null;
53
+ /**
54
+ * Builds SVG geometry for the safe triangle overlay.
55
+ */
56
+ export declare function getSafeTriangleGeometry(placement: Placement, contentRect: DOMRect, cursorX: number, cursorY: number): SafeTriangleGeometry | null;
57
+ /**
58
+ * Returns whether the pointer is inside any submenu body nested under a menu panel.
59
+ */
60
+ export declare function isPointerInsideMenuTree(x: number, y: number, contentRoot: HTMLElement | null): boolean;
61
+ /**
62
+ * Returns whether the pointer can traverse toward an open submenu.
63
+ *
64
+ * @param apex - Frozen pointer position from the parent menu (exit / last in-parent point).
65
+ * Leave detection uses the triangle from this apex to the submenu edge — not the current cursor.
66
+ */
67
+ export declare function isPointerMovingTowardSubmenu(clientX: number, clientY: number, parentRect: DOMRect | null, contentRect: DOMRect | null, placement: Placement, apex: Point | null, contentRoot?: HTMLElement | null): boolean;
68
+ //# sourceMappingURL=safeTriangle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safeTriangle.d.ts","sourceRoot":"","sources":["../../src/utils/safeTriangle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAEvD,MAAM,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IAClC,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC3B,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC3B,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,KAAK,GAAG;IACnB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACT,CAAA;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAE1E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAChC,CAAC,EAAE,MAAM,EACT,CAAC,E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