@sprawlify/primitives 0.0.97 → 0.0.98

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 (107) hide show
  1. package/dist/{collection-DZeodezM.cjs → collection-BBgC8xCb.cjs} +22 -7
  2. package/dist/{collection-CcsrqDFY.mjs → collection-DgzidRvr.mjs} +22 -7
  3. package/dist/collection.cjs +1 -1
  4. package/dist/collection.d.cts +3 -3
  5. package/dist/collection.d.mts +3 -3
  6. package/dist/collection.mjs +1 -1
  7. package/dist/dom-query.d.cts +1 -1
  8. package/dist/dom-query.d.mts +1 -1
  9. package/dist/{i18n-utils-DHGN_KCY.mjs → i18n-utils-BsXTdcWB.mjs} +52 -1
  10. package/dist/{i18n-utils-Dm8cGCol.cjs → i18n-utils-bHwTSOWi.cjs} +57 -0
  11. package/dist/i18n-utils.cjs +2 -1
  12. package/dist/i18n-utils.d.cts +14 -1
  13. package/dist/i18n-utils.d.mts +14 -1
  14. package/dist/i18n-utils.mjs +2 -2
  15. package/dist/{list-collection-DkRA5LOq.d.mts → list-collection-AgReIMJ0.d.mts} +1 -1
  16. package/dist/{list-collection-B_8BN0XB.d.cts → list-collection-C0swT4Wu.d.cts} +1 -1
  17. package/dist/machines/accordion/index.d.cts +1 -1
  18. package/dist/machines/accordion/index.d.mts +1 -1
  19. package/dist/machines/angle-slider/index.d.cts +1 -1
  20. package/dist/machines/angle-slider/index.d.mts +1 -1
  21. package/dist/machines/bottom-sheet/index.d.cts +1 -1
  22. package/dist/machines/bottom-sheet/index.d.mts +1 -1
  23. package/dist/machines/carousel/index.d.cts +1 -1
  24. package/dist/machines/carousel/index.d.mts +1 -1
  25. package/dist/machines/cascade-select/index.cjs +1367 -0
  26. package/dist/machines/cascade-select/index.d.cts +164 -0
  27. package/dist/machines/cascade-select/index.d.mts +164 -0
  28. package/dist/machines/cascade-select/index.mjs +1360 -0
  29. package/dist/machines/clipboard/index.d.cts +1 -1
  30. package/dist/machines/clipboard/index.d.mts +1 -1
  31. package/dist/machines/collapsible/index.d.cts +1 -1
  32. package/dist/machines/collapsible/index.d.mts +1 -1
  33. package/dist/machines/color-picker/index.d.cts +1 -1
  34. package/dist/machines/color-picker/index.d.mts +1 -1
  35. package/dist/machines/combobox/index.cjs +2 -2
  36. package/dist/machines/combobox/index.d.cts +2 -2
  37. package/dist/machines/combobox/index.d.mts +2 -2
  38. package/dist/machines/combobox/index.mjs +2 -2
  39. package/dist/machines/date-picker/index.d.cts +1 -1
  40. package/dist/machines/date-picker/index.d.mts +1 -1
  41. package/dist/machines/dialog/index.d.cts +1 -1
  42. package/dist/machines/dialog/index.d.mts +1 -1
  43. package/dist/machines/dropdown-menu/index.d.cts +1 -1
  44. package/dist/machines/dropdown-menu/index.d.mts +1 -1
  45. package/dist/machines/editable/index.d.cts +1 -1
  46. package/dist/machines/editable/index.d.mts +1 -1
  47. package/dist/machines/file-upload/index.cjs +1 -1
  48. package/dist/machines/file-upload/index.d.cts +1 -1
  49. package/dist/machines/file-upload/index.d.mts +1 -1
  50. package/dist/machines/file-upload/index.mjs +1 -1
  51. package/dist/machines/floating-panel/index.d.cts +1 -1
  52. package/dist/machines/floating-panel/index.d.mts +1 -1
  53. package/dist/machines/hover-card/index.d.cts +1 -1
  54. package/dist/machines/hover-card/index.d.mts +1 -1
  55. package/dist/machines/listbox/index.cjs +1 -1
  56. package/dist/machines/listbox/index.d.cts +3 -3
  57. package/dist/machines/listbox/index.d.mts +3 -3
  58. package/dist/machines/listbox/index.mjs +1 -1
  59. package/dist/machines/marquee/index.d.cts +3 -3
  60. package/dist/machines/marquee/index.d.mts +3 -3
  61. package/dist/machines/navigation-menu/index.d.cts +1 -1
  62. package/dist/machines/navigation-menu/index.d.mts +1 -1
  63. package/dist/machines/number-input/index.d.cts +1 -1
  64. package/dist/machines/number-input/index.d.mts +1 -1
  65. package/dist/machines/password-input/index.d.cts +1 -1
  66. package/dist/machines/password-input/index.d.mts +1 -1
  67. package/dist/machines/pin-input/index.d.cts +1 -1
  68. package/dist/machines/pin-input/index.d.mts +1 -1
  69. package/dist/machines/popover/index.d.cts +1 -1
  70. package/dist/machines/popover/index.d.mts +1 -1
  71. package/dist/machines/progress/index.d.cts +1 -1
  72. package/dist/machines/progress/index.d.mts +1 -1
  73. package/dist/machines/radio-group/index.d.cts +1 -1
  74. package/dist/machines/radio-group/index.d.mts +1 -1
  75. package/dist/machines/rating-group/index.d.cts +1 -1
  76. package/dist/machines/rating-group/index.d.mts +1 -1
  77. package/dist/machines/scroll-area/index.d.cts +1 -1
  78. package/dist/machines/scroll-area/index.d.mts +1 -1
  79. package/dist/machines/select/index.cjs +1 -1
  80. package/dist/machines/select/index.d.cts +2 -2
  81. package/dist/machines/select/index.d.mts +2 -2
  82. package/dist/machines/select/index.mjs +1 -1
  83. package/dist/machines/slider/index.d.cts +1 -1
  84. package/dist/machines/slider/index.d.mts +1 -1
  85. package/dist/machines/steps/index.d.cts +1 -1
  86. package/dist/machines/steps/index.d.mts +1 -1
  87. package/dist/machines/tabs/index.d.cts +1 -1
  88. package/dist/machines/tabs/index.d.mts +1 -1
  89. package/dist/machines/tags-input/index.d.cts +1 -1
  90. package/dist/machines/tags-input/index.d.mts +1 -1
  91. package/dist/machines/timer/index.d.cts +1 -1
  92. package/dist/machines/timer/index.d.mts +1 -1
  93. package/dist/machines/toast/index.d.cts +1 -1
  94. package/dist/machines/toast/index.d.mts +1 -1
  95. package/dist/machines/tooltip/index.d.cts +1 -1
  96. package/dist/machines/tooltip/index.d.mts +1 -1
  97. package/dist/machines/tour/index.d.cts +1 -1
  98. package/dist/machines/tour/index.d.mts +1 -1
  99. package/dist/machines/tree-view/index.cjs +1 -1
  100. package/dist/machines/tree-view/index.d.cts +2 -2
  101. package/dist/machines/tree-view/index.d.mts +2 -2
  102. package/dist/machines/tree-view/index.mjs +1 -1
  103. package/dist/{selection-DdNvrKbj.d.mts → selection-aObDFAzS.d.mts} +1 -1
  104. package/dist/{selection-Bb_ZSVxe.d.cts → selection-k8FM_y4w.d.cts} +1 -1
  105. package/dist/{tree-collection-DlBCued7.d.mts → tree-collection-Dlf9EUrT.d.mts} +2 -1
  106. package/dist/{tree-collection-DjtppzYh.d.cts → tree-collection-DlqV5kYO.d.cts} +2 -1
  107. package/package.json +11 -1
@@ -933,12 +933,6 @@ var TreeCollection = class TreeCollection {
933
933
  return acc;
934
934
  }, []).sort((a, b) => compareIndexPaths(a.indexPath, b.indexPath)).map(({ value }) => value);
935
935
  });
936
- require_defineProperty._defineProperty(this, "getIndexPath", (value) => {
937
- return findIndexPath(this.rootNode, {
938
- getChildren: this.getNodeChildren,
939
- predicate: (node) => this.getNodeValue(node) === value
940
- });
941
- });
942
936
  require_defineProperty._defineProperty(this, "getValue", (indexPath) => {
943
937
  const node = this.at(indexPath);
944
938
  return node ? this.getNodeValue(node) : void 0;
@@ -1200,6 +1194,27 @@ var TreeCollection = class TreeCollection {
1200
1194
  });
1201
1195
  this.rootNode = options.rootNode;
1202
1196
  }
1197
+ getIndexPath(valueOrValuePath) {
1198
+ if (Array.isArray(valueOrValuePath)) {
1199
+ if (valueOrValuePath.length === 0) return [];
1200
+ const indexPath = [];
1201
+ let currentChildren = this.getNodeChildren(this.rootNode);
1202
+ for (let i = 0; i < valueOrValuePath.length; i++) {
1203
+ const currentValue = valueOrValuePath[i];
1204
+ const matchingChildIndex = currentChildren.findIndex((child) => this.getNodeValue(child) === currentValue);
1205
+ if (matchingChildIndex === -1) break;
1206
+ indexPath.push(matchingChildIndex);
1207
+ if (i < valueOrValuePath.length - 1) {
1208
+ const currentNode = currentChildren[matchingChildIndex];
1209
+ currentChildren = this.getNodeChildren(currentNode);
1210
+ }
1211
+ }
1212
+ return indexPath;
1213
+ } else return findIndexPath(this.rootNode, {
1214
+ getChildren: this.getNodeChildren,
1215
+ predicate: (node) => this.getNodeValue(node) === valueOrValuePath
1216
+ });
1217
+ }
1203
1218
  };
1204
1219
  function flattenedToTree(nodes, options = fallbackMethods) {
1205
1220
  if (nodes.length === 0) throw new Error("[sprawlify-js/tree] Cannot create tree from empty flattened array");
@@ -1212,7 +1227,7 @@ function flattenedToTree(nodes, options = fallbackMethods) {
1212
1227
  const buildNode = (idx) => {
1213
1228
  const flatNode = nodeMap.get(idx);
1214
1229
  if (!flatNode) return {};
1215
- const { _children, ...cleanNode } = flatNode;
1230
+ const { _children, _parent, _index, ...cleanNode } = flatNode;
1216
1231
  const children = [];
1217
1232
  _children?.forEach((childIndex) => {
1218
1233
  children.push(buildNode(childIndex));
@@ -933,12 +933,6 @@ var TreeCollection = class TreeCollection {
933
933
  return acc;
934
934
  }, []).sort((a, b) => compareIndexPaths(a.indexPath, b.indexPath)).map(({ value }) => value);
935
935
  });
936
- _defineProperty(this, "getIndexPath", (value) => {
937
- return findIndexPath(this.rootNode, {
938
- getChildren: this.getNodeChildren,
939
- predicate: (node) => this.getNodeValue(node) === value
940
- });
941
- });
942
936
  _defineProperty(this, "getValue", (indexPath) => {
943
937
  const node = this.at(indexPath);
944
938
  return node ? this.getNodeValue(node) : void 0;
@@ -1200,6 +1194,27 @@ var TreeCollection = class TreeCollection {
1200
1194
  });
1201
1195
  this.rootNode = options.rootNode;
1202
1196
  }
1197
+ getIndexPath(valueOrValuePath) {
1198
+ if (Array.isArray(valueOrValuePath)) {
1199
+ if (valueOrValuePath.length === 0) return [];
1200
+ const indexPath = [];
1201
+ let currentChildren = this.getNodeChildren(this.rootNode);
1202
+ for (let i = 0; i < valueOrValuePath.length; i++) {
1203
+ const currentValue = valueOrValuePath[i];
1204
+ const matchingChildIndex = currentChildren.findIndex((child) => this.getNodeValue(child) === currentValue);
1205
+ if (matchingChildIndex === -1) break;
1206
+ indexPath.push(matchingChildIndex);
1207
+ if (i < valueOrValuePath.length - 1) {
1208
+ const currentNode = currentChildren[matchingChildIndex];
1209
+ currentChildren = this.getNodeChildren(currentNode);
1210
+ }
1211
+ }
1212
+ return indexPath;
1213
+ } else return findIndexPath(this.rootNode, {
1214
+ getChildren: this.getNodeChildren,
1215
+ predicate: (node) => this.getNodeValue(node) === valueOrValuePath
1216
+ });
1217
+ }
1203
1218
  };
1204
1219
  function flattenedToTree(nodes, options = fallbackMethods) {
1205
1220
  if (nodes.length === 0) throw new Error("[sprawlify-js/tree] Cannot create tree from empty flattened array");
@@ -1212,7 +1227,7 @@ function flattenedToTree(nodes, options = fallbackMethods) {
1212
1227
  const buildNode = (idx) => {
1213
1228
  const flatNode = nodeMap.get(idx);
1214
1229
  if (!flatNode) return {};
1215
- const { _children, ...cleanNode } = flatNode;
1230
+ const { _children, _parent, _index, ...cleanNode } = flatNode;
1216
1231
  const children = [];
1217
1232
  _children?.forEach((childIndex) => {
1218
1233
  children.push(buildNode(childIndex));
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./utils-ByNiZU8f.cjs");
3
- const require_collection = require("./collection-DZeodezM.cjs");
3
+ const require_collection = require("./collection-BBgC8xCb.cjs");
4
4
  exports.GridCollection = require_collection.GridCollection;
5
5
  exports.ListCollection = require_collection.ListCollection;
6
6
  exports.Selection = require_collection.Selection;
@@ -1,5 +1,5 @@
1
1
  import { a as CollectionSearchState, c as FlatTreeNode, d as TreeCollectionMethods, f as TreeCollectionOptions, g as ValuePath, i as CollectionSearchOptions, l as FlatTreeNodeMeta, m as TreeSkipFn, n as CollectionMethods, p as TreeNode, r as CollectionOptions, s as FilePathTreeNode, t as CollectionItem, u as IndexPath } from "./types-D-7AMgSE.cjs";
2
- import { n as isListCollection, t as ListCollection } from "./list-collection-B_8BN0XB.cjs";
3
- import { a as isGridCollection, i as GridCollectionOptions, n as SelectionMode, r as GridCollection, t as Selection } from "./selection-Bb_ZSVxe.cjs";
4
- import { n as filePathToTree, r as flattenedToTree, t as TreeCollection } from "./tree-collection-DjtppzYh.cjs";
2
+ import { n as isListCollection, t as ListCollection } from "./list-collection-C0swT4Wu.cjs";
3
+ import { a as isGridCollection, i as GridCollectionOptions, n as SelectionMode, r as GridCollection, t as Selection } from "./selection-k8FM_y4w.cjs";
4
+ import { n as filePathToTree, r as flattenedToTree, t as TreeCollection } from "./tree-collection-DlqV5kYO.cjs";
5
5
  export { CollectionItem, CollectionMethods, CollectionOptions, CollectionSearchOptions, CollectionSearchState, FilePathTreeNode, FlatTreeNode, FlatTreeNodeMeta, GridCollection, GridCollectionOptions, IndexPath, ListCollection, Selection, SelectionMode, TreeCollection, TreeCollectionMethods, TreeCollectionOptions, TreeNode, TreeSkipFn, ValuePath, filePathToTree, flattenedToTree, isGridCollection, isListCollection };
@@ -1,5 +1,5 @@
1
1
  import { a as CollectionSearchState, c as FlatTreeNode, d as TreeCollectionMethods, f as TreeCollectionOptions, g as ValuePath, i as CollectionSearchOptions, l as FlatTreeNodeMeta, m as TreeSkipFn, n as CollectionMethods, p as TreeNode, r as CollectionOptions, s as FilePathTreeNode, t as CollectionItem, u as IndexPath } from "./types-9uw8LHpE.mjs";
2
- import { n as isListCollection, t as ListCollection } from "./list-collection-DkRA5LOq.mjs";
3
- import { a as isGridCollection, i as GridCollectionOptions, n as SelectionMode, r as GridCollection, t as Selection } from "./selection-DdNvrKbj.mjs";
4
- import { n as filePathToTree, r as flattenedToTree, t as TreeCollection } from "./tree-collection-DlBCued7.mjs";
2
+ import { n as isListCollection, t as ListCollection } from "./list-collection-AgReIMJ0.mjs";
3
+ import { a as isGridCollection, i as GridCollectionOptions, n as SelectionMode, r as GridCollection, t as Selection } from "./selection-aObDFAzS.mjs";
4
+ import { n as filePathToTree, r as flattenedToTree, t as TreeCollection } from "./tree-collection-Dlf9EUrT.mjs";
5
5
  export { CollectionItem, CollectionMethods, CollectionOptions, CollectionSearchOptions, CollectionSearchState, FilePathTreeNode, FlatTreeNode, FlatTreeNodeMeta, GridCollection, GridCollectionOptions, IndexPath, ListCollection, Selection, SelectionMode, TreeCollection, TreeCollectionMethods, TreeCollectionOptions, TreeNode, TreeSkipFn, ValuePath, filePathToTree, flattenedToTree, isGridCollection, isListCollection };
@@ -1,3 +1,3 @@
1
1
  import "./utils-VVoZ_v29.mjs";
2
- import { a as GridCollection, c as isListCollection, i as Selection, n as filePathToTree, o as isGridCollection, r as flattenedToTree, s as ListCollection, t as TreeCollection } from "./collection-CcsrqDFY.mjs";
2
+ import { a as GridCollection, c as isListCollection, i as Selection, n as filePathToTree, o as isGridCollection, r as flattenedToTree, s as ListCollection, t as TreeCollection } from "./collection-DgzidRvr.mjs";
3
3
  export { GridCollection, ListCollection, Selection, TreeCollection, filePathToTree, flattenedToTree, isGridCollection, isListCollection };
@@ -57,7 +57,7 @@ declare const isModifierKey: (e: Pick<KeyboardEvent, "ctrlKey" | "metaKey" | "al
57
57
  declare const isTouchEvent: (event: AnyPointerEvent) => event is TouchEvent;
58
58
  declare function getEventKey(event: Pick<KeyboardEvent, "key">, options?: EventKeyOptions): string;
59
59
  declare function getNativeEvent<E>(event: E): NativeEvent<E>;
60
- declare function getEventStep(event: Pick<KeyboardEvent, "ctrlKey" | "metaKey" | "key" | "shiftKey">): 1 | 10 | 0.1;
60
+ declare function getEventStep(event: Pick<KeyboardEvent, "ctrlKey" | "metaKey" | "key" | "shiftKey">): 1 | 0.1 | 10;
61
61
  declare function getEventPoint(event: any, type?: "page" | "client"): {
62
62
  x: number;
63
63
  y: number;
@@ -57,7 +57,7 @@ declare const isModifierKey: (e: Pick<KeyboardEvent, "ctrlKey" | "metaKey" | "al
57
57
  declare const isTouchEvent: (event: AnyPointerEvent) => event is TouchEvent;
58
58
  declare function getEventKey(event: Pick<KeyboardEvent, "key">, options?: EventKeyOptions): string;
59
59
  declare function getNativeEvent<E>(event: E): NativeEvent<E>;
60
- declare function getEventStep(event: Pick<KeyboardEvent, "ctrlKey" | "metaKey" | "key" | "shiftKey">): 1 | 10 | 0.1;
60
+ declare function getEventStep(event: Pick<KeyboardEvent, "ctrlKey" | "metaKey" | "key" | "shiftKey">): 1 | 0.1 | 10;
61
61
  declare function getEventPoint(event: any, type?: "page" | "client"): {
62
62
  x: number;
63
63
  y: number;
@@ -349,6 +349,57 @@ function getDistance(startDate, endDate) {
349
349
  };
350
350
  }
351
351
  //#endregion
352
+ //#region src/shared/i18n-utils/format-time.ts
353
+ const getTimeFormatter = i18nCache(Intl.DateTimeFormat);
354
+ function splitTimeString(timeString) {
355
+ const [hours = null, minutes = null, seconds = null] = timeString.split(":");
356
+ const parsedHours = hours === null ? null : Number(hours);
357
+ const parsedMinutes = minutes === null ? null : Number(minutes);
358
+ const parsedSeconds = seconds === null ? null : Number(seconds);
359
+ return {
360
+ hours: Number.isNaN(parsedHours) ? null : parsedHours,
361
+ minutes: Number.isNaN(parsedMinutes) ? null : parsedMinutes,
362
+ seconds: Number.isNaN(parsedSeconds) ? null : parsedSeconds
363
+ };
364
+ }
365
+ function getTimeParts(value) {
366
+ if (value instanceof Date) {
367
+ if (Number.isNaN(value.getTime())) return null;
368
+ return {
369
+ date: value,
370
+ hours: value.getHours(),
371
+ minutes: value.getMinutes(),
372
+ seconds: value.getSeconds()
373
+ };
374
+ }
375
+ const { hours, minutes, seconds } = splitTimeString(value);
376
+ if (hours === null || minutes === null) return null;
377
+ if (hours < 0 || hours > 23 || minutes < 0 || minutes > 59) return null;
378
+ if (seconds !== null && (seconds < 0 || seconds > 59)) return null;
379
+ const date = /* @__PURE__ */ new Date(0);
380
+ date.setHours(hours, minutes, seconds ?? 0, 0);
381
+ return {
382
+ date,
383
+ hours,
384
+ minutes,
385
+ seconds: seconds ?? 0
386
+ };
387
+ }
388
+ function formatTime(value, locale, options = {}) {
389
+ const { format = "24h", amPmLabels, withSeconds = false } = options;
390
+ const parts = getTimeParts(value);
391
+ if (!parts) return null;
392
+ const formatter = getTimeFormatter(locale, {
393
+ hour: format === "24h" ? "2-digit" : "numeric",
394
+ minute: "2-digit",
395
+ second: withSeconds ? "2-digit" : void 0,
396
+ hour12: format === "12h"
397
+ });
398
+ if (format !== "12h" || !amPmLabels) return formatter.format(parts.date);
399
+ const isPm = parts.hours >= 12;
400
+ return formatter.formatToParts(parts.date).map((token) => token.type === "dayPeriod" ? isPm ? amPmLabels.pm : amPmLabels.am : token.value).join("");
401
+ }
402
+ //#endregion
352
403
  //#region src/shared/i18n-utils/is-rtl.ts
353
404
  const RTL_SCRIPTS = new Set([
354
405
  "Avst",
@@ -425,4 +476,4 @@ function trackLocale(options = {}) {
425
476
  };
426
477
  }
427
478
  //#endregion
428
- export { formatRelativeTime as a, formatBytes as c, createCollator as d, isRTL as i, formatNumber as l, getDefaultLocale as n, formatList as o, getLocaleDir as r, formatDate as s, trackLocale as t, createFilter as u };
479
+ export { formatTime as a, formatDate as c, createFilter as d, createCollator as f, isRTL as i, formatBytes as l, getDefaultLocale as n, formatRelativeTime as o, getLocaleDir as r, formatList as s, trackLocale as t, formatNumber as u };
@@ -349,6 +349,57 @@ function getDistance(startDate, endDate) {
349
349
  };
350
350
  }
351
351
  //#endregion
352
+ //#region src/shared/i18n-utils/format-time.ts
353
+ const getTimeFormatter = i18nCache(Intl.DateTimeFormat);
354
+ function splitTimeString(timeString) {
355
+ const [hours = null, minutes = null, seconds = null] = timeString.split(":");
356
+ const parsedHours = hours === null ? null : Number(hours);
357
+ const parsedMinutes = minutes === null ? null : Number(minutes);
358
+ const parsedSeconds = seconds === null ? null : Number(seconds);
359
+ return {
360
+ hours: Number.isNaN(parsedHours) ? null : parsedHours,
361
+ minutes: Number.isNaN(parsedMinutes) ? null : parsedMinutes,
362
+ seconds: Number.isNaN(parsedSeconds) ? null : parsedSeconds
363
+ };
364
+ }
365
+ function getTimeParts(value) {
366
+ if (value instanceof Date) {
367
+ if (Number.isNaN(value.getTime())) return null;
368
+ return {
369
+ date: value,
370
+ hours: value.getHours(),
371
+ minutes: value.getMinutes(),
372
+ seconds: value.getSeconds()
373
+ };
374
+ }
375
+ const { hours, minutes, seconds } = splitTimeString(value);
376
+ if (hours === null || minutes === null) return null;
377
+ if (hours < 0 || hours > 23 || minutes < 0 || minutes > 59) return null;
378
+ if (seconds !== null && (seconds < 0 || seconds > 59)) return null;
379
+ const date = /* @__PURE__ */ new Date(0);
380
+ date.setHours(hours, minutes, seconds ?? 0, 0);
381
+ return {
382
+ date,
383
+ hours,
384
+ minutes,
385
+ seconds: seconds ?? 0
386
+ };
387
+ }
388
+ function formatTime(value, locale, options = {}) {
389
+ const { format = "24h", amPmLabels, withSeconds = false } = options;
390
+ const parts = getTimeParts(value);
391
+ if (!parts) return null;
392
+ const formatter = getTimeFormatter(locale, {
393
+ hour: format === "24h" ? "2-digit" : "numeric",
394
+ minute: "2-digit",
395
+ second: withSeconds ? "2-digit" : void 0,
396
+ hour12: format === "12h"
397
+ });
398
+ if (format !== "12h" || !amPmLabels) return formatter.format(parts.date);
399
+ const isPm = parts.hours >= 12;
400
+ return formatter.formatToParts(parts.date).map((token) => token.type === "dayPeriod" ? isPm ? amPmLabels.pm : amPmLabels.am : token.value).join("");
401
+ }
402
+ //#endregion
352
403
  //#region src/shared/i18n-utils/is-rtl.ts
353
404
  const RTL_SCRIPTS = new Set([
354
405
  "Avst",
@@ -467,6 +518,12 @@ Object.defineProperty(exports, "formatRelativeTime", {
467
518
  return formatRelativeTime;
468
519
  }
469
520
  });
521
+ Object.defineProperty(exports, "formatTime", {
522
+ enumerable: true,
523
+ get: function() {
524
+ return formatTime;
525
+ }
526
+ });
470
527
  Object.defineProperty(exports, "getDefaultLocale", {
471
528
  enumerable: true,
472
529
  get: function() {
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./dom-query-6Wt-Tikf.cjs");
3
- const require_i18n_utils = require("./i18n-utils-Dm8cGCol.cjs");
3
+ const require_i18n_utils = require("./i18n-utils-bHwTSOWi.cjs");
4
4
  exports.createCollator = require_i18n_utils.createCollator;
5
5
  exports.createFilter = require_i18n_utils.createFilter;
6
6
  exports.formatBytes = require_i18n_utils.formatBytes;
@@ -8,6 +8,7 @@ exports.formatDate = require_i18n_utils.formatDate;
8
8
  exports.formatList = require_i18n_utils.formatList;
9
9
  exports.formatNumber = require_i18n_utils.formatNumber;
10
10
  exports.formatRelativeTime = require_i18n_utils.formatRelativeTime;
11
+ exports.formatTime = require_i18n_utils.formatTime;
11
12
  exports.getDefaultLocale = require_i18n_utils.getDefaultLocale;
12
13
  exports.getLocaleDir = require_i18n_utils.getLocaleDir;
13
14
  exports.isRTL = require_i18n_utils.isRTL;
@@ -33,6 +33,19 @@ declare function formatNumber(v: number, locale: string, options?: Intl.NumberFo
33
33
  //#region src/shared/i18n-utils/format-relative-time.d.ts
34
34
  declare function formatRelativeTime(value: Date, locale: string, options?: Intl.RelativeTimeFormatOptions): string;
35
35
  //#endregion
36
+ //#region src/shared/i18n-utils/format-time.d.ts
37
+ type TimeFormat = "12h" | "24h";
38
+ interface AmPmLabels {
39
+ am: string;
40
+ pm: string;
41
+ }
42
+ interface FormatTimeOptions {
43
+ format?: TimeFormat;
44
+ amPmLabels?: AmPmLabels;
45
+ withSeconds?: boolean;
46
+ }
47
+ declare function formatTime(value: string | Date, locale: string, options?: FormatTimeOptions): string | null;
48
+ //#endregion
36
49
  //#region src/shared/i18n-utils/is-rtl.d.ts
37
50
  declare function isRTL(locale: string): boolean;
38
51
  declare function getLocaleDir(locale: string): "ltr" | "rtl";
@@ -58,4 +71,4 @@ interface LocaleOptions {
58
71
  }
59
72
  declare function trackLocale(options?: LocaleOptions): () => void;
60
73
  //#endregion
61
- export { FilterOptions, FilterReturn, FormatBytesOptions, type Locale, type LocaleOptions, createCollator, createFilter, formatBytes, formatDate, formatList, formatNumber, formatRelativeTime, getDefaultLocale, getLocaleDir, isRTL, trackLocale };
74
+ export { AmPmLabels, FilterOptions, FilterReturn, FormatBytesOptions, FormatTimeOptions, type Locale, type LocaleOptions, TimeFormat, createCollator, createFilter, formatBytes, formatDate, formatList, formatNumber, formatRelativeTime, formatTime, getDefaultLocale, getLocaleDir, isRTL, trackLocale };
@@ -33,6 +33,19 @@ declare function formatNumber(v: number, locale: string, options?: Intl.NumberFo
33
33
  //#region src/shared/i18n-utils/format-relative-time.d.ts
34
34
  declare function formatRelativeTime(value: Date, locale: string, options?: Intl.RelativeTimeFormatOptions): string;
35
35
  //#endregion
36
+ //#region src/shared/i18n-utils/format-time.d.ts
37
+ type TimeFormat = "12h" | "24h";
38
+ interface AmPmLabels {
39
+ am: string;
40
+ pm: string;
41
+ }
42
+ interface FormatTimeOptions {
43
+ format?: TimeFormat;
44
+ amPmLabels?: AmPmLabels;
45
+ withSeconds?: boolean;
46
+ }
47
+ declare function formatTime(value: string | Date, locale: string, options?: FormatTimeOptions): string | null;
48
+ //#endregion
36
49
  //#region src/shared/i18n-utils/is-rtl.d.ts
37
50
  declare function isRTL(locale: string): boolean;
38
51
  declare function getLocaleDir(locale: string): "ltr" | "rtl";
@@ -58,4 +71,4 @@ interface LocaleOptions {
58
71
  }
59
72
  declare function trackLocale(options?: LocaleOptions): () => void;
60
73
  //#endregion
61
- export { FilterOptions, FilterReturn, FormatBytesOptions, type Locale, type LocaleOptions, createCollator, createFilter, formatBytes, formatDate, formatList, formatNumber, formatRelativeTime, getDefaultLocale, getLocaleDir, isRTL, trackLocale };
74
+ export { AmPmLabels, FilterOptions, FilterReturn, FormatBytesOptions, FormatTimeOptions, type Locale, type LocaleOptions, TimeFormat, createCollator, createFilter, formatBytes, formatDate, formatList, formatNumber, formatRelativeTime, formatTime, getDefaultLocale, getLocaleDir, isRTL, trackLocale };
@@ -1,3 +1,3 @@
1
1
  import "./dom-query-dX8Dakb4.mjs";
2
- import { a as formatRelativeTime, c as formatBytes, d as createCollator, i as isRTL, l as formatNumber, n as getDefaultLocale, o as formatList, r as getLocaleDir, s as formatDate, t as trackLocale, u as createFilter } from "./i18n-utils-DHGN_KCY.mjs";
3
- export { createCollator, createFilter, formatBytes, formatDate, formatList, formatNumber, formatRelativeTime, getDefaultLocale, getLocaleDir, isRTL, trackLocale };
2
+ import { a as formatTime, c as formatDate, d as createFilter, f as createCollator, i as isRTL, l as formatBytes, n as getDefaultLocale, o as formatRelativeTime, r as getLocaleDir, s as formatList, t as trackLocale, u as formatNumber } from "./i18n-utils-BsXTdcWB.mjs";
3
+ export { createCollator, createFilter, formatBytes, formatDate, formatList, formatNumber, formatRelativeTime, formatTime, getDefaultLocale, getLocaleDir, isRTL, trackLocale };
@@ -46,7 +46,7 @@ declare class ListCollection<T extends CollectionItem = CollectionItem> {
46
46
  moveBefore: (value: string, ...values: string[]) => ListCollection<T>;
47
47
  moveAfter: (value: string, ...values: string[]) => ListCollection<T>;
48
48
  reorder: (fromIndex: number, toIndex: number) => ListCollection<T>;
49
- compareValue: (a: string, b: string) => 0 | 1 | -1;
49
+ compareValue: (a: string, b: string) => 1 | -1 | 0;
50
50
  private range;
51
51
  getValueRange: (from: string | null, to: string | null) => string[];
52
52
  toString: () => string;
@@ -46,7 +46,7 @@ declare class ListCollection<T extends CollectionItem = CollectionItem> {
46
46
  moveBefore: (value: string, ...values: string[]) => ListCollection<T>;
47
47
  moveAfter: (value: string, ...values: string[]) => ListCollection<T>;
48
48
  reorder: (fromIndex: number, toIndex: number) => ListCollection<T>;
49
- compareValue: (a: string, b: string) => 0 | 1 | -1;
49
+ compareValue: (a: string, b: string) => 1 | -1 | 0;
50
50
  private range;
51
51
  getValueRange: (from: string | null, to: string | null) => string[];
52
52
  toString: () => string;
@@ -3,7 +3,7 @@ import { p as Machine, u as EventObject, y as Service } from "../../types-B24gMT
3
3
  import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-CLRsezW5.cjs";
4
4
 
5
5
  //#region src/machines/accordion/accordion.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "item" | "itemTrigger" | "itemContent" | "itemIndicator">;
6
+ declare const anatomy: AnatomyInstance<"root" | "item" | "itemIndicator" | "itemContent" | "itemTrigger">;
7
7
  //#endregion
8
8
  //#region src/machines/accordion/accordion.types.d.ts
9
9
  interface ValueChangeDetails {
@@ -3,7 +3,7 @@ import { p as Machine, u as EventObject, y as Service } from "../../types-DUM9rz
3
3
  import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-BVFlU3b9.mjs";
4
4
 
5
5
  //#region src/machines/accordion/accordion.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "item" | "itemTrigger" | "itemContent" | "itemIndicator">;
6
+ declare const anatomy: AnatomyInstance<"root" | "item" | "itemIndicator" | "itemContent" | "itemTrigger">;
7
7
  //#endregion
8
8
  //#region src/machines/accordion/accordion.types.d.ts
9
9
  interface ValueChangeDetails {
@@ -3,7 +3,7 @@ import { p as Machine, u as EventObject, y as Service } from "../../types-B24gMT
3
3
  import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-CLRsezW5.cjs";
4
4
 
5
5
  //#region src/machines/angle-slider/angle-slider.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"track" | "root" | "label" | "control" | "thumb" | "valueText" | "markerGroup" | "marker">;
6
+ declare const anatomy: AnatomyInstance<"root" | "label" | "control" | "track" | "valueText" | "thumb" | "markerGroup" | "marker">;
7
7
  //#endregion
8
8
  //#region src/machines/angle-slider/angle-slider.types.d.ts
9
9
  interface ValueChangeDetails {
@@ -3,7 +3,7 @@ import { p as Machine, u as EventObject, y as Service } from "../../types-DUM9rz
3
3
  import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-BVFlU3b9.mjs";
4
4
 
5
5
  //#region src/machines/angle-slider/angle-slider.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"track" | "root" | "label" | "control" | "thumb" | "valueText" | "markerGroup" | "marker">;
6
+ declare const anatomy: AnatomyInstance<"root" | "label" | "control" | "track" | "valueText" | "thumb" | "markerGroup" | "marker">;
7
7
  //#endregion
8
8
  //#region src/machines/angle-slider/angle-slider.types.d.ts
9
9
  interface ValueChangeDetails {
@@ -5,7 +5,7 @@ import { c as PointerDownOutsideEvent, n as FocusOutsideEvent, r as InteractOuts
5
5
  import { t as DismissableElementHandlers } from "../../dismissable-layer-ZgyqN8AD.cjs";
6
6
 
7
7
  //#region src/machines/bottom-sheet/bottom-sheet.anatomy.d.ts
8
- declare const anatomy: AnatomyInstance<"content" | "trigger" | "backdrop" | "title" | "closeTrigger" | "grabber" | "grabberIndicator">;
8
+ declare const anatomy: AnatomyInstance<"trigger" | "content" | "closeTrigger" | "title" | "backdrop" | "grabber" | "grabberIndicator">;
9
9
  //#endregion
10
10
  //#region src/machines/bottom-sheet/utils/drag-manager.d.ts
11
11
  declare class DragManager {
@@ -5,7 +5,7 @@ import { c as PointerDownOutsideEvent, n as FocusOutsideEvent, r as InteractOuts
5
5
  import { t as DismissableElementHandlers } from "../../dismissable-layer-h14gHVbJ.mjs";
6
6
 
7
7
  //#region src/machines/bottom-sheet/bottom-sheet.anatomy.d.ts
8
- declare const anatomy: AnatomyInstance<"content" | "trigger" | "backdrop" | "title" | "closeTrigger" | "grabber" | "grabberIndicator">;
8
+ declare const anatomy: AnatomyInstance<"trigger" | "content" | "closeTrigger" | "title" | "backdrop" | "grabber" | "grabberIndicator">;
9
9
  //#endregion
10
10
  //#region src/machines/bottom-sheet/utils/drag-manager.d.ts
11
11
  declare class DragManager {
@@ -3,7 +3,7 @@ import { p as Machine, u as EventObject, y as Service } from "../../types-B24gMT
3
3
  import { b as NormalizeProps, d as Orientation, f as OrientationProperty, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-CLRsezW5.cjs";
4
4
 
5
5
  //#region src/machines/carousel/carousel.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "control" | "indicator" | "item" | "progressText" | "nextTrigger" | "prevTrigger" | "itemGroup" | "indicatorGroup" | "autoplayTrigger">;
6
+ declare const anatomy: AnatomyInstance<"root" | "item" | "control" | "indicator" | "nextTrigger" | "prevTrigger" | "itemGroup" | "progressText" | "indicatorGroup" | "autoplayTrigger">;
7
7
  //#endregion
8
8
  //#region src/machines/carousel/carousel.types.d.ts
9
9
  interface PageChangeDetails {
@@ -3,7 +3,7 @@ import { p as Machine, u as EventObject, y as Service } from "../../types-DUM9rz
3
3
  import { b as NormalizeProps, d as Orientation, f as OrientationProperty, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-BVFlU3b9.mjs";
4
4
 
5
5
  //#region src/machines/carousel/carousel.anatomy.d.ts
6
- declare const anatomy: AnatomyInstance<"root" | "control" | "indicator" | "item" | "progressText" | "nextTrigger" | "prevTrigger" | "itemGroup" | "indicatorGroup" | "autoplayTrigger">;
6
+ declare const anatomy: AnatomyInstance<"root" | "item" | "control" | "indicator" | "nextTrigger" | "prevTrigger" | "itemGroup" | "progressText" | "indicatorGroup" | "autoplayTrigger">;
7
7
  //#endregion
8
8
  //#region src/machines/carousel/carousel.types.d.ts
9
9
  interface PageChangeDetails {