@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.
- package/dist/{collection-DZeodezM.cjs → collection-BBgC8xCb.cjs} +22 -7
- package/dist/{collection-CcsrqDFY.mjs → collection-DgzidRvr.mjs} +22 -7
- package/dist/collection.cjs +1 -1
- package/dist/collection.d.cts +3 -3
- package/dist/collection.d.mts +3 -3
- package/dist/collection.mjs +1 -1
- package/dist/dom-query.d.cts +1 -1
- package/dist/dom-query.d.mts +1 -1
- package/dist/{i18n-utils-DHGN_KCY.mjs → i18n-utils-BsXTdcWB.mjs} +52 -1
- package/dist/{i18n-utils-Dm8cGCol.cjs → i18n-utils-bHwTSOWi.cjs} +57 -0
- package/dist/i18n-utils.cjs +2 -1
- package/dist/i18n-utils.d.cts +14 -1
- package/dist/i18n-utils.d.mts +14 -1
- package/dist/i18n-utils.mjs +2 -2
- package/dist/{list-collection-DkRA5LOq.d.mts → list-collection-AgReIMJ0.d.mts} +1 -1
- package/dist/{list-collection-B_8BN0XB.d.cts → list-collection-C0swT4Wu.d.cts} +1 -1
- package/dist/machines/accordion/index.d.cts +1 -1
- package/dist/machines/accordion/index.d.mts +1 -1
- package/dist/machines/angle-slider/index.d.cts +1 -1
- package/dist/machines/angle-slider/index.d.mts +1 -1
- package/dist/machines/bottom-sheet/index.d.cts +1 -1
- package/dist/machines/bottom-sheet/index.d.mts +1 -1
- package/dist/machines/carousel/index.d.cts +1 -1
- package/dist/machines/carousel/index.d.mts +1 -1
- package/dist/machines/cascade-select/index.cjs +1367 -0
- package/dist/machines/cascade-select/index.d.cts +164 -0
- package/dist/machines/cascade-select/index.d.mts +164 -0
- package/dist/machines/cascade-select/index.mjs +1360 -0
- package/dist/machines/clipboard/index.d.cts +1 -1
- package/dist/machines/clipboard/index.d.mts +1 -1
- package/dist/machines/collapsible/index.d.cts +1 -1
- package/dist/machines/collapsible/index.d.mts +1 -1
- package/dist/machines/color-picker/index.d.cts +1 -1
- package/dist/machines/color-picker/index.d.mts +1 -1
- package/dist/machines/combobox/index.cjs +2 -2
- package/dist/machines/combobox/index.d.cts +2 -2
- package/dist/machines/combobox/index.d.mts +2 -2
- package/dist/machines/combobox/index.mjs +2 -2
- package/dist/machines/date-picker/index.d.cts +1 -1
- package/dist/machines/date-picker/index.d.mts +1 -1
- package/dist/machines/dialog/index.d.cts +1 -1
- package/dist/machines/dialog/index.d.mts +1 -1
- package/dist/machines/dropdown-menu/index.d.cts +1 -1
- package/dist/machines/dropdown-menu/index.d.mts +1 -1
- package/dist/machines/editable/index.d.cts +1 -1
- package/dist/machines/editable/index.d.mts +1 -1
- package/dist/machines/file-upload/index.cjs +1 -1
- package/dist/machines/file-upload/index.d.cts +1 -1
- package/dist/machines/file-upload/index.d.mts +1 -1
- package/dist/machines/file-upload/index.mjs +1 -1
- package/dist/machines/floating-panel/index.d.cts +1 -1
- package/dist/machines/floating-panel/index.d.mts +1 -1
- package/dist/machines/hover-card/index.d.cts +1 -1
- package/dist/machines/hover-card/index.d.mts +1 -1
- package/dist/machines/listbox/index.cjs +1 -1
- package/dist/machines/listbox/index.d.cts +3 -3
- package/dist/machines/listbox/index.d.mts +3 -3
- package/dist/machines/listbox/index.mjs +1 -1
- package/dist/machines/marquee/index.d.cts +3 -3
- package/dist/machines/marquee/index.d.mts +3 -3
- package/dist/machines/navigation-menu/index.d.cts +1 -1
- package/dist/machines/navigation-menu/index.d.mts +1 -1
- package/dist/machines/number-input/index.d.cts +1 -1
- package/dist/machines/number-input/index.d.mts +1 -1
- package/dist/machines/password-input/index.d.cts +1 -1
- package/dist/machines/password-input/index.d.mts +1 -1
- package/dist/machines/pin-input/index.d.cts +1 -1
- package/dist/machines/pin-input/index.d.mts +1 -1
- package/dist/machines/popover/index.d.cts +1 -1
- package/dist/machines/popover/index.d.mts +1 -1
- package/dist/machines/progress/index.d.cts +1 -1
- package/dist/machines/progress/index.d.mts +1 -1
- package/dist/machines/radio-group/index.d.cts +1 -1
- package/dist/machines/radio-group/index.d.mts +1 -1
- package/dist/machines/rating-group/index.d.cts +1 -1
- package/dist/machines/rating-group/index.d.mts +1 -1
- package/dist/machines/scroll-area/index.d.cts +1 -1
- package/dist/machines/scroll-area/index.d.mts +1 -1
- package/dist/machines/select/index.cjs +1 -1
- package/dist/machines/select/index.d.cts +2 -2
- package/dist/machines/select/index.d.mts +2 -2
- package/dist/machines/select/index.mjs +1 -1
- package/dist/machines/slider/index.d.cts +1 -1
- package/dist/machines/slider/index.d.mts +1 -1
- package/dist/machines/steps/index.d.cts +1 -1
- package/dist/machines/steps/index.d.mts +1 -1
- package/dist/machines/tabs/index.d.cts +1 -1
- package/dist/machines/tabs/index.d.mts +1 -1
- package/dist/machines/tags-input/index.d.cts +1 -1
- package/dist/machines/tags-input/index.d.mts +1 -1
- package/dist/machines/timer/index.d.cts +1 -1
- package/dist/machines/timer/index.d.mts +1 -1
- package/dist/machines/toast/index.d.cts +1 -1
- package/dist/machines/toast/index.d.mts +1 -1
- package/dist/machines/tooltip/index.d.cts +1 -1
- package/dist/machines/tooltip/index.d.mts +1 -1
- package/dist/machines/tour/index.d.cts +1 -1
- package/dist/machines/tour/index.d.mts +1 -1
- package/dist/machines/tree-view/index.cjs +1 -1
- package/dist/machines/tree-view/index.d.cts +2 -2
- package/dist/machines/tree-view/index.d.mts +2 -2
- package/dist/machines/tree-view/index.mjs +1 -1
- package/dist/{selection-DdNvrKbj.d.mts → selection-aObDFAzS.d.mts} +1 -1
- package/dist/{selection-Bb_ZSVxe.d.cts → selection-k8FM_y4w.d.cts} +1 -1
- package/dist/{tree-collection-DlBCued7.d.mts → tree-collection-Dlf9EUrT.d.mts} +2 -1
- package/dist/{tree-collection-DjtppzYh.d.cts → tree-collection-DlqV5kYO.d.cts} +2 -1
- 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));
|
package/dist/collection.cjs
CHANGED
|
@@ -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-
|
|
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;
|
package/dist/collection.d.cts
CHANGED
|
@@ -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-
|
|
3
|
-
import { a as isGridCollection, i as GridCollectionOptions, n as SelectionMode, r as GridCollection, t as Selection } from "./selection-
|
|
4
|
-
import { n as filePathToTree, r as flattenedToTree, t as TreeCollection } from "./tree-collection-
|
|
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 };
|
package/dist/collection.d.mts
CHANGED
|
@@ -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-
|
|
3
|
-
import { a as isGridCollection, i as GridCollectionOptions, n as SelectionMode, r as GridCollection, t as Selection } from "./selection-
|
|
4
|
-
import { n as filePathToTree, r as flattenedToTree, t as TreeCollection } from "./tree-collection-
|
|
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 };
|
package/dist/collection.mjs
CHANGED
|
@@ -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-
|
|
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 };
|
package/dist/dom-query.d.cts
CHANGED
|
@@ -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 |
|
|
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;
|
package/dist/dom-query.d.mts
CHANGED
|
@@ -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 |
|
|
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 {
|
|
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() {
|
package/dist/i18n-utils.cjs
CHANGED
|
@@ -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-
|
|
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;
|
package/dist/i18n-utils.d.cts
CHANGED
|
@@ -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 };
|
package/dist/i18n-utils.d.mts
CHANGED
|
@@ -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 };
|
package/dist/i18n-utils.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "./dom-query-dX8Dakb4.mjs";
|
|
2
|
-
import { a as
|
|
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) =>
|
|
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) =>
|
|
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" | "
|
|
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" | "
|
|
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<"
|
|
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<"
|
|
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<"
|
|
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<"
|
|
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" | "
|
|
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" | "
|
|
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 {
|