@atomscraft/core 0.0.0-stage → 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nassim Farhat
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,55 @@
1
- # Temporary Holding Version
1
+ # @atomscraft/core
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Framework-agnostic behavior primitives used by AtomCraft components. Use this
4
+ package when you need the interaction and data logic without React or CSS.
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ npm install @atomscraft/core
10
+ ```
11
+
12
+ ## What is included?
13
+
14
+ - Position calculations for popovers, menus and floating elements
15
+ - Keyboard navigation and typeahead helpers for list-like controls
16
+ - Date and calendar helpers, including ISO conversion and date ranges
17
+ - Filtering and text matching helpers
18
+ - Pagination and slider calculations
19
+ - Focusable-element discovery
20
+ - Small state-store, clipboard, class-name and data-attribute utilities
21
+
22
+ Everything is typed and has no React or DOM rendering dependency.
23
+
24
+ ## Example
25
+
26
+ ```ts
27
+ import { computePosition, getPageItems, snapToStep } from "@atomscraft/core";
28
+
29
+ const pageItems = getPageItems(3, 20);
30
+ const sliderValue = snapToStep(42, { min: 0, max: 100, step: 5 });
31
+
32
+ const position = computePosition(
33
+ { x: 100, y: 80, width: 40, height: 32 },
34
+ { width: 240, height: 120 },
35
+ { width: 1024, height: 768 },
36
+ { side: "bottom", align: "start", offset: 8 },
37
+ );
38
+ ```
39
+
40
+ The exact options and return types are available through TypeScript
41
+ autocomplete. The source implementation and tests are in the repository.
42
+
43
+ ## When should I use it?
44
+
45
+ Use `@atomscraft/core` to build a custom renderer, integrate AtomCraft behavior
46
+ into another framework, or share interaction logic between platforms. For ready-
47
+ made React components, install `@atomscraft/react` and `@atomscraft/css`.
48
+
49
+ ## Related packages
50
+
51
+ - [`@atomscraft/react`](https://www.npmjs.com/package/@atomscraft/react) - React components
52
+ - [`@atomscraft/css`](https://www.npmjs.com/package/@atomscraft/css) - generated styles
53
+ - [`@atomscraft/tokens`](https://www.npmjs.com/package/@atomscraft/tokens) - design tokens
54
+
55
+ Documentation and examples: [AtomCraft UI on GitHub](https://github.com/NassimFarhat/AtomCraft-UI).
package/dist/index.cjs ADDED
@@ -0,0 +1,358 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ SLIDER_KEYS: () => SLIDER_KEYS,
24
+ addDays: () => addDays,
25
+ addMonths: () => addMonths,
26
+ addYears: () => addYears,
27
+ clampDate: () => clampDate,
28
+ cn: () => cn,
29
+ computePosition: () => computePosition,
30
+ copyText: () => copyText,
31
+ createStore: () => createStore,
32
+ dataAttr: () => dataAttr,
33
+ endOfWeek: () => endOfWeek,
34
+ findTypeaheadMatch: () => findTypeaheadMatch,
35
+ fromIsoDate: () => fromIsoDate,
36
+ getFocusableElements: () => getFocusableElements,
37
+ getInitials: () => getInitials,
38
+ getMonthGrid: () => getMonthGrid,
39
+ getNextIndex: () => getNextIndex,
40
+ getPageItems: () => getPageItems,
41
+ getWeekStart: () => getWeekStart,
42
+ getWeekdays: () => getWeekdays,
43
+ includesText: () => includesText,
44
+ isDateInRange: () => isDateInRange,
45
+ isSameDay: () => isSameDay,
46
+ isSameMonth: () => isSameMonth,
47
+ matchText: () => matchText,
48
+ nextSliderValue: () => nextSliderValue,
49
+ normalizeText: () => normalizeText,
50
+ ratioOf: () => ratioOf,
51
+ snapToStep: () => snapToStep,
52
+ splitMatch: () => splitMatch,
53
+ startOfDay: () => startOfDay,
54
+ startOfWeek: () => startOfWeek,
55
+ toIsoDate: () => toIsoDate,
56
+ toWeeks: () => toWeeks,
57
+ valueFromRatio: () => valueFromRatio
58
+ });
59
+ module.exports = __toCommonJS(index_exports);
60
+
61
+ // src/class-names.ts
62
+ function cn(...classes) {
63
+ return classes.filter(Boolean).join(" ");
64
+ }
65
+
66
+ // src/clipboard.ts
67
+ async function copyText(text) {
68
+ try {
69
+ await navigator.clipboard.writeText(text);
70
+ return true;
71
+ } catch {
72
+ return copyWithSelection(text);
73
+ }
74
+ }
75
+ function copyWithSelection(text) {
76
+ if (typeof document === "undefined") return false;
77
+ const area = document.createElement("textarea");
78
+ area.value = text;
79
+ area.setAttribute("readonly", "");
80
+ area.style.position = "fixed";
81
+ area.style.opacity = "0";
82
+ document.body.append(area);
83
+ area.select();
84
+ const copied = document.execCommand?.("copy") ?? false;
85
+ area.remove();
86
+ return copied;
87
+ }
88
+
89
+ // src/data-attributes.ts
90
+ function dataAttr(condition) {
91
+ return condition ? "" : void 0;
92
+ }
93
+
94
+ // src/date.ts
95
+ var startOfDay = (date) => new Date(date.getFullYear(), date.getMonth(), date.getDate());
96
+ var isSameDay = (first, second) => first.getFullYear() === second.getFullYear() && first.getMonth() === second.getMonth() && first.getDate() === second.getDate();
97
+ var isSameMonth = (first, second) => first.getFullYear() === second.getFullYear() && first.getMonth() === second.getMonth();
98
+ var addDays = (date, amount) => new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
99
+ function addMonths(date, amount) {
100
+ const target = new Date(date.getFullYear(), date.getMonth() + amount, 1);
101
+ const lastDay = new Date(target.getFullYear(), target.getMonth() + 1, 0).getDate();
102
+ return new Date(target.getFullYear(), target.getMonth(), Math.min(date.getDate(), lastDay));
103
+ }
104
+ var addYears = (date, amount) => addMonths(date, amount * 12);
105
+ function clampDate(date, min, max) {
106
+ if (min && date < min) return min;
107
+ if (max && date > max) return max;
108
+ return date;
109
+ }
110
+ function startOfWeek(date, weekStartsOn = 1) {
111
+ const offset = (date.getDay() - weekStartsOn + 7) % 7;
112
+ return addDays(startOfDay(date), -offset);
113
+ }
114
+ var endOfWeek = (date, weekStartsOn = 1) => addDays(startOfWeek(date, weekStartsOn), 6);
115
+ function getMonthGrid(month, weekStartsOn = 1) {
116
+ const first = new Date(month.getFullYear(), month.getMonth(), 1);
117
+ const offset = (first.getDay() - weekStartsOn + 7) % 7;
118
+ const start = addDays(first, -offset);
119
+ return Array.from({ length: 42 }, (_, index) => {
120
+ const date = addDays(start, index);
121
+ return { date, inMonth: isSameMonth(date, month) };
122
+ });
123
+ }
124
+ var toWeeks = (days) => Array.from(
125
+ { length: Math.ceil(days.length / 7) },
126
+ (_, week) => days.slice(week * 7, week * 7 + 7)
127
+ );
128
+ var getWeekdays = (weekStartsOn = 1) => Array.from({ length: 7 }, (_, index) => (weekStartsOn + index) % 7);
129
+ function getWeekStart(locale) {
130
+ const firstDay = new Intl.Locale(locale).getWeekInfo?.().firstDay;
131
+ return firstDay === void 0 ? 1 : firstDay % 7;
132
+ }
133
+ function toIsoDate(date) {
134
+ const month = String(date.getMonth() + 1).padStart(2, "0");
135
+ const day = String(date.getDate()).padStart(2, "0");
136
+ return `${date.getFullYear()}-${month}-${day}`;
137
+ }
138
+ function fromIsoDate(value) {
139
+ const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value.trim());
140
+ if (!match) return null;
141
+ const [, year, month, day] = match;
142
+ const date = new Date(Number(year), Number(month) - 1, Number(day));
143
+ const isReal = date.getMonth() === Number(month) - 1 && date.getDate() === Number(day);
144
+ return isReal ? date : null;
145
+ }
146
+ var isDateInRange = (date, { start, end }) => start !== null && end !== null && startOfDay(date) >= startOfDay(start) && startOfDay(date) <= startOfDay(end);
147
+
148
+ // src/filter.ts
149
+ var normalizeText = (value) => value.normalize("NFD").replace(/\p{Diacritic}/gu, "").toLocaleLowerCase();
150
+ function matchText(text, query) {
151
+ if (query.trim() === "") return { start: 0, end: 0 };
152
+ const index = normalizeText(text).indexOf(normalizeText(query));
153
+ return index === -1 ? null : { start: index, end: index + query.trim().length };
154
+ }
155
+ var includesText = (text, query) => matchText(text, query) !== null;
156
+ function splitMatch(text, query) {
157
+ const range = matchText(text, query);
158
+ if (!range || range.end === range.start) return [text, "", ""];
159
+ return [text.slice(0, range.start), text.slice(range.start, range.end), text.slice(range.end)];
160
+ }
161
+
162
+ // src/focus.ts
163
+ var FOCUSABLE = [
164
+ "a[href]",
165
+ "button:not([disabled])",
166
+ "input:not([disabled]):not([type='hidden'])",
167
+ "select:not([disabled])",
168
+ "textarea:not([disabled])",
169
+ "[tabindex]:not([tabindex='-1'])"
170
+ ].join(",");
171
+ function getFocusableElements(container) {
172
+ return [...container.querySelectorAll(FOCUSABLE)].filter(
173
+ (element) => !element.hasAttribute("inert") && element.getAttribute("aria-hidden") !== "true"
174
+ );
175
+ }
176
+
177
+ // src/initials.ts
178
+ function getInitials(name, maxLength = 2) {
179
+ return name.trim().split(/\s+/).filter(Boolean).slice(0, maxLength).map((word) => word.charAt(0).toUpperCase()).join("");
180
+ }
181
+
182
+ // src/navigation.ts
183
+ var EDGE_KEYS = { Home: "first", End: "last" };
184
+ var VERTICAL_KEYS = { ArrowDown: "next", ArrowUp: "previous" };
185
+ var HORIZONTAL_KEYS = {
186
+ ltr: { ArrowRight: "next", ArrowLeft: "previous" },
187
+ rtl: { ArrowLeft: "next", ArrowRight: "previous" }
188
+ };
189
+ function moveFor(key, orientation, dir) {
190
+ const horizontal = orientation === "vertical" ? {} : HORIZONTAL_KEYS[dir];
191
+ const vertical = orientation === "horizontal" ? {} : VERTICAL_KEYS;
192
+ return EDGE_KEYS[key] ?? horizontal[key] ?? vertical[key];
193
+ }
194
+ function step(current, count, move, loop) {
195
+ if (move === "first") return 0;
196
+ if (move === "last") return count - 1;
197
+ const target = move === "next" ? current + 1 : current - 1;
198
+ if (loop) return (target + count) % count;
199
+ return Math.min(Math.max(target, 0), count - 1);
200
+ }
201
+ function getNextIndex(current, count, key, { orientation = "vertical", loop = true, dir = "ltr" } = {}) {
202
+ if (count === 0) return void 0;
203
+ const move = moveFor(key, orientation, dir);
204
+ return move === void 0 ? void 0 : step(current, count, move, loop);
205
+ }
206
+ function findTypeaheadMatch(labels, query, startIndex) {
207
+ const needle = query.toLocaleLowerCase();
208
+ const ordered = labels.map((label, index) => ({ label, index }));
209
+ const rotated = [...ordered.slice(startIndex + 1), ...ordered.slice(0, startIndex + 1)];
210
+ return rotated.find(({ label }) => label.trim().toLocaleLowerCase().startsWith(needle))?.index;
211
+ }
212
+
213
+ // src/pagination.ts
214
+ function getPageItems(current, total, siblings = 1) {
215
+ const visible = siblings * 2 + 5;
216
+ if (total <= visible) return Array.from({ length: total }, (_, index) => index + 1);
217
+ const start = Math.max(2, Math.min(current - siblings, total - siblings * 2 - 2));
218
+ const end = Math.min(total - 1, Math.max(current + siblings, siblings * 2 + 3));
219
+ const middle = Array.from({ length: end - start + 1 }, (_, index) => start + index);
220
+ return [
221
+ 1,
222
+ ...start > 2 ? ["ellipsis-start"] : [],
223
+ ...middle,
224
+ ...end < total - 1 ? ["ellipsis-end"] : [],
225
+ total
226
+ ];
227
+ }
228
+
229
+ // src/position.ts
230
+ var OPPOSITE = {
231
+ top: "bottom",
232
+ bottom: "top",
233
+ left: "right",
234
+ right: "left"
235
+ };
236
+ var isVertical = (side) => side === "top" || side === "bottom";
237
+ function alignOffset(anchorStart, anchorSize, floatingSize, align) {
238
+ if (align === "start") return anchorStart;
239
+ if (align === "end") return anchorStart + anchorSize - floatingSize;
240
+ return anchorStart + (anchorSize - floatingSize) / 2;
241
+ }
242
+ function place(anchor, floating, side, align, offset) {
243
+ if (isVertical(side)) {
244
+ const y = side === "top" ? anchor.y - floating.height - offset : anchor.y + anchor.height + offset;
245
+ return { x: alignOffset(anchor.x, anchor.width, floating.width, align), y, side };
246
+ }
247
+ const x = side === "left" ? anchor.x - floating.width - offset : anchor.x + anchor.width + offset;
248
+ return { x, y: alignOffset(anchor.y, anchor.height, floating.height, align), side };
249
+ }
250
+ function overflows(position, floating, viewport, padding) {
251
+ return isVertical(position.side) ? position.y < padding || position.y + floating.height > viewport.height - padding : position.x < padding || position.x + floating.width > viewport.width - padding;
252
+ }
253
+ var clamp = (value, min, max) => Math.min(Math.max(value, min), Math.max(min, max));
254
+ function computePosition(anchor, floating, viewport, { side = "bottom", align = "center", offset = 8, padding = 8 } = {}) {
255
+ const preferred = place(anchor, floating, side, align, offset);
256
+ const flipped = place(anchor, floating, OPPOSITE[side], align, offset);
257
+ const chosen = overflows(preferred, floating, viewport, padding) && !overflows(flipped, floating, viewport, padding) ? flipped : preferred;
258
+ return {
259
+ side: chosen.side,
260
+ x: clamp(chosen.x, padding, viewport.width - floating.width - padding),
261
+ y: clamp(chosen.y, padding, viewport.height - floating.height - padding)
262
+ };
263
+ }
264
+
265
+ // src/slider.ts
266
+ var decimalsOf = (step2) => (String(step2).split(".")[1] ?? "").length;
267
+ function snapToStep(value, { min, max, step: step2 }) {
268
+ const steps = Math.round((value - min) / step2);
269
+ const snapped = min + steps * step2;
270
+ return Number(Math.min(Math.max(snapped, min), max).toFixed(decimalsOf(step2)));
271
+ }
272
+ var ratioOf = (value, { min, max }) => max === min ? 0 : Math.min(Math.max((value - min) / (max - min), 0), 1);
273
+ var valueFromRatio = (ratio, scale) => snapToStep(scale.min + ratio * (scale.max - scale.min), scale);
274
+ var DECREASE = /* @__PURE__ */ new Set(["ArrowDown", "ArrowLeft"]);
275
+ var INCREASE = /* @__PURE__ */ new Set(["ArrowUp", "ArrowRight"]);
276
+ function deltaFor(key, step2, largeStep) {
277
+ if (key === "PageUp") return largeStep;
278
+ if (key === "PageDown") return -largeStep;
279
+ if (INCREASE.has(key)) return step2;
280
+ if (DECREASE.has(key)) return -step2;
281
+ return void 0;
282
+ }
283
+ function nextSliderValue(current, key, options) {
284
+ const { largeStep = options.step * 10, dir = "ltr" } = options;
285
+ if (key === "Home") return options.min;
286
+ if (key === "End") return options.max;
287
+ const delta = deltaFor(key, options.step, largeStep);
288
+ if (delta === void 0) return current;
289
+ const horizontal = key === "ArrowLeft" || key === "ArrowRight";
290
+ const mirrored = dir === "rtl" && horizontal ? -delta : delta;
291
+ return snapToStep(current + mirrored, options);
292
+ }
293
+ var SLIDER_KEYS = [
294
+ "ArrowUp",
295
+ "ArrowDown",
296
+ "ArrowLeft",
297
+ "ArrowRight",
298
+ "PageUp",
299
+ "PageDown",
300
+ "Home",
301
+ "End"
302
+ ];
303
+
304
+ // src/store.ts
305
+ function createStore(initialValue) {
306
+ let value = initialValue;
307
+ const listeners = /* @__PURE__ */ new Set();
308
+ return {
309
+ get: () => value,
310
+ set(update) {
311
+ value = typeof update === "function" ? update(value) : update;
312
+ listeners.forEach((listener) => listener());
313
+ },
314
+ subscribe(listener) {
315
+ listeners.add(listener);
316
+ return () => listeners.delete(listener);
317
+ }
318
+ };
319
+ }
320
+ // Annotate the CommonJS export names for ESM import in node:
321
+ 0 && (module.exports = {
322
+ SLIDER_KEYS,
323
+ addDays,
324
+ addMonths,
325
+ addYears,
326
+ clampDate,
327
+ cn,
328
+ computePosition,
329
+ copyText,
330
+ createStore,
331
+ dataAttr,
332
+ endOfWeek,
333
+ findTypeaheadMatch,
334
+ fromIsoDate,
335
+ getFocusableElements,
336
+ getInitials,
337
+ getMonthGrid,
338
+ getNextIndex,
339
+ getPageItems,
340
+ getWeekStart,
341
+ getWeekdays,
342
+ includesText,
343
+ isDateInRange,
344
+ isSameDay,
345
+ isSameMonth,
346
+ matchText,
347
+ nextSliderValue,
348
+ normalizeText,
349
+ ratioOf,
350
+ snapToStep,
351
+ splitMatch,
352
+ startOfDay,
353
+ startOfWeek,
354
+ toIsoDate,
355
+ toWeeks,
356
+ valueFromRatio
357
+ });
358
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/class-names.ts","../src/clipboard.ts","../src/data-attributes.ts","../src/date.ts","../src/filter.ts","../src/focus.ts","../src/initials.ts","../src/navigation.ts","../src/pagination.ts","../src/position.ts","../src/slider.ts","../src/store.ts"],"sourcesContent":["export * from \"./class-names\";\nexport * from \"./clipboard\";\nexport * from \"./data-attributes\";\nexport * from \"./date\";\nexport * from \"./filter\";\nexport * from \"./focus\";\nexport * from \"./initials\";\nexport * from \"./navigation\";\nexport * from \"./pagination\";\nexport * from \"./position\";\nexport * from \"./slider\";\nexport * from \"./store\";\n","export type ClassValue = string | false | null | undefined;\n\n/** Joins truthy class names with a single space. */\nexport function cn(...classes: ClassValue[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n","/** Copies text, falling back to a hidden selection where the async clipboard is unavailable. */\nexport async function copyText(text: string): Promise<boolean> {\n try {\n await navigator.clipboard.writeText(text);\n return true;\n } catch {\n return copyWithSelection(text);\n }\n}\n\nfunction copyWithSelection(text: string): boolean {\n if (typeof document === \"undefined\") return false;\n const area = document.createElement(\"textarea\");\n area.value = text;\n area.setAttribute(\"readonly\", \"\");\n area.style.position = \"fixed\";\n area.style.opacity = \"0\";\n document.body.append(area);\n area.select();\n const copied = document.execCommand?.(\"copy\") ?? false;\n area.remove();\n return copied;\n}\n","/**\n * Boolean data attribute: present (empty string) when true, absent when false.\n * Lets CSS target `[data-disabled]` instead of `[data-disabled=\"true\"]`.\n */\nexport function dataAttr(condition: boolean | undefined): \"\" | undefined {\n return condition ? \"\" : undefined;\n}\n","/** Calendar arithmetic on plain `Date` objects, in local time and free of any library. */\n\nexport type DateRange = { start: Date | null; end: Date | null };\n\n/** Midnight of the given day: the canonical form of a calendar date. */\nexport const startOfDay = (date: Date): Date =>\n new Date(date.getFullYear(), date.getMonth(), date.getDate());\n\nexport const isSameDay = (first: Date, second: Date): boolean =>\n first.getFullYear() === second.getFullYear() &&\n first.getMonth() === second.getMonth() &&\n first.getDate() === second.getDate();\n\nexport const isSameMonth = (first: Date, second: Date): boolean =>\n first.getFullYear() === second.getFullYear() && first.getMonth() === second.getMonth();\n\nexport const addDays = (date: Date, amount: number): Date =>\n new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);\n\n/** Adds months, keeping the day inside the target month (31 Jan + 1 month = 28/29 Feb). */\nexport function addMonths(date: Date, amount: number): Date {\n const target = new Date(date.getFullYear(), date.getMonth() + amount, 1);\n const lastDay = new Date(target.getFullYear(), target.getMonth() + 1, 0).getDate();\n return new Date(target.getFullYear(), target.getMonth(), Math.min(date.getDate(), lastDay));\n}\n\nexport const addYears = (date: Date, amount: number): Date => addMonths(date, amount * 12);\n\nexport function clampDate(date: Date, min?: Date | undefined, max?: Date | undefined): Date {\n if (min && date < min) return min;\n if (max && date > max) return max;\n return date;\n}\n\n/** Midnight of the first day of the week containing `date`. */\nexport function startOfWeek(date: Date, weekStartsOn = 1): Date {\n const offset = (date.getDay() - weekStartsOn + 7) % 7;\n return addDays(startOfDay(date), -offset);\n}\n\nexport const endOfWeek = (date: Date, weekStartsOn = 1): Date =>\n addDays(startOfWeek(date, weekStartsOn), 6);\n\nexport type DayCell = {\n date: Date;\n /** False for the leading and trailing days that pad the first and last week. */\n inMonth: boolean;\n};\n\n/**\n * The six weeks shown by a month view, always 42 days, so the grid never\n * changes height between months.\n * @param weekStartsOn 0 for Sunday, 1 for Monday, as `Date.getDay()` numbers them.\n */\nexport function getMonthGrid(month: Date, weekStartsOn = 1): DayCell[] {\n const first = new Date(month.getFullYear(), month.getMonth(), 1);\n const offset = (first.getDay() - weekStartsOn + 7) % 7;\n const start = addDays(first, -offset);\n return Array.from({ length: 42 }, (_, index) => {\n const date = addDays(start, index);\n return { date, inMonth: isSameMonth(date, month) };\n });\n}\n\n/** Splits a flat day list into weeks of seven. */\nexport const toWeeks = <T>(days: readonly T[]): T[][] =>\n Array.from({ length: Math.ceil(days.length / 7) }, (_, week) =>\n days.slice(week * 7, week * 7 + 7),\n );\n\n/** Weekday numbers in display order, e.g. [1,2,3,4,5,6,0] for a Monday-first week. */\nexport const getWeekdays = (weekStartsOn = 1): number[] =>\n Array.from({ length: 7 }, (_, index) => (weekStartsOn + index) % 7);\n\n/** `Intl.Locale.getWeekInfo` is not in every runtime, nor in the TypeScript lib yet. */\ntype LocaleWithWeekInfo = Intl.Locale & { getWeekInfo?: () => { firstDay: number } };\n\n/**\n * First day of the week in this locale, as a `Date.getDay()` number.\n * Falls back to Monday where the runtime has no week data.\n */\nexport function getWeekStart(locale: string): number {\n const firstDay = (new Intl.Locale(locale) as LocaleWithWeekInfo).getWeekInfo?.().firstDay;\n return firstDay === undefined ? 1 : firstDay % 7;\n}\n\n/** ISO `yyyy-mm-dd`, which is also the value format of `<input type=\"date\">`. */\nexport function toIsoDate(date: Date): string {\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n return `${date.getFullYear()}-${month}-${day}`;\n}\n\n/** Parses `yyyy-mm-dd` as a local date. Returns null for anything else. */\nexport function fromIsoDate(value: string): Date | null {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(value.trim());\n if (!match) return null;\n const [, year, month, day] = match;\n const date = new Date(Number(year), Number(month) - 1, Number(day));\n const isReal = date.getMonth() === Number(month) - 1 && date.getDate() === Number(day);\n return isReal ? date : null;\n}\n\nexport const isDateInRange = (date: Date, { start, end }: DateRange): boolean =>\n start !== null &&\n end !== null &&\n startOfDay(date) >= startOfDay(start) &&\n startOfDay(date) <= startOfDay(end);\n","/** Text matching for Combobox and CommandPalette: same rules in every consumer. */\n\n/** Lowercase and strip diacritics, so \"é\" matches \"e\" and \"Ş\" matches \"s\". */\nexport const normalizeText = (value: string): string =>\n value\n .normalize(\"NFD\")\n .replace(/\\p{Diacritic}/gu, \"\")\n .toLocaleLowerCase();\n\nexport type MatchRange = { start: number; end: number };\n\n/**\n * Case- and accent-insensitive substring match.\n * Returns the matched range in the original string, or null when there is no match.\n */\nexport function matchText(text: string, query: string): MatchRange | null {\n if (query.trim() === \"\") return { start: 0, end: 0 };\n const index = normalizeText(text).indexOf(normalizeText(query));\n return index === -1 ? null : { start: index, end: index + query.trim().length };\n}\n\nexport const includesText = (text: string, query: string): boolean =>\n matchText(text, query) !== null;\n\n/** Splits `text` into the part before the match, the match and the part after it. */\nexport function splitMatch(text: string, query: string): [string, string, string] {\n const range = matchText(text, query);\n if (!range || range.end === range.start) return [text, \"\", \"\"];\n return [text.slice(0, range.start), text.slice(range.start, range.end), text.slice(range.end)];\n}\n","const FOCUSABLE = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled]):not([type='hidden'])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n \"[tabindex]:not([tabindex='-1'])\",\n].join(\",\");\n\n/** Keyboard-focusable descendants, in DOM order. */\nexport function getFocusableElements(container: ParentNode): HTMLElement[] {\n return [...container.querySelectorAll<HTMLElement>(FOCUSABLE)].filter(\n (element) => !element.hasAttribute(\"inert\") && element.getAttribute(\"aria-hidden\") !== \"true\",\n );\n}\n","/** Up to two uppercase initials from a display name (\"Nassim Farhat\" -> \"NF\"). */\nexport function getInitials(name: string, maxLength = 2): string {\n return name\n .trim()\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, maxLength)\n .map((word) => word.charAt(0).toUpperCase())\n .join(\"\");\n}\n","/** Keyboard navigation inside a list of items (APG roving tabindex / active descendant). */\n\nexport type Orientation = \"horizontal\" | \"vertical\" | \"both\";\nexport type Direction = \"ltr\" | \"rtl\";\n\nexport type NavigationOptions = {\n orientation?: Orientation;\n /** Wrap from the last item to the first and back. */\n loop?: boolean;\n dir?: Direction;\n};\n\ntype Move = \"next\" | \"previous\" | \"first\" | \"last\";\n\nconst EDGE_KEYS: Readonly<Record<string, Move>> = { Home: \"first\", End: \"last\" };\nconst VERTICAL_KEYS: Readonly<Record<string, Move>> = { ArrowDown: \"next\", ArrowUp: \"previous\" };\nconst HORIZONTAL_KEYS: Readonly<Record<Direction, Readonly<Record<string, Move>>>> = {\n ltr: { ArrowRight: \"next\", ArrowLeft: \"previous\" },\n rtl: { ArrowLeft: \"next\", ArrowRight: \"previous\" },\n};\n\nfunction moveFor(key: string, orientation: Orientation, dir: Direction): Move | undefined {\n const horizontal = orientation === \"vertical\" ? {} : HORIZONTAL_KEYS[dir];\n const vertical = orientation === \"horizontal\" ? {} : VERTICAL_KEYS;\n return EDGE_KEYS[key] ?? horizontal[key] ?? vertical[key];\n}\n\nfunction step(current: number, count: number, move: Move, loop: boolean): number {\n if (move === \"first\") return 0;\n if (move === \"last\") return count - 1;\n const target = move === \"next\" ? current + 1 : current - 1;\n if (loop) return (target + count) % count;\n return Math.min(Math.max(target, 0), count - 1);\n}\n\n/** Index to focus after `key`, or `undefined` when the key is not a navigation key. */\nexport function getNextIndex(\n current: number,\n count: number,\n key: string,\n { orientation = \"vertical\", loop = true, dir = \"ltr\" }: NavigationOptions = {},\n): number | undefined {\n if (count === 0) return undefined;\n const move = moveFor(key, orientation, dir);\n return move === undefined ? undefined : step(current, count, move, loop);\n}\n\n/** Index of the next item whose label starts with `query`, searching after `startIndex`. */\nexport function findTypeaheadMatch(\n labels: readonly string[],\n query: string,\n startIndex: number,\n): number | undefined {\n const needle = query.toLocaleLowerCase();\n const ordered = labels.map((label, index) => ({ label, index }));\n const rotated = [...ordered.slice(startIndex + 1), ...ordered.slice(0, startIndex + 1)];\n return rotated.find(({ label }) => label.trim().toLocaleLowerCase().startsWith(needle))?.index;\n}\n","export type PageItem = number | \"ellipsis-start\" | \"ellipsis-end\";\n\n/**\n * Pages to display: always the first and last, `siblings` around the current one,\n * and an ellipsis where pages are skipped. The length stays constant while paging.\n */\nexport function getPageItems(current: number, total: number, siblings = 1): PageItem[] {\n const visible = siblings * 2 + 5;\n if (total <= visible) return Array.from({ length: total }, (_, index) => index + 1);\n\n const start = Math.max(2, Math.min(current - siblings, total - siblings * 2 - 2));\n const end = Math.min(total - 1, Math.max(current + siblings, siblings * 2 + 3));\n const middle = Array.from({ length: end - start + 1 }, (_, index) => start + index);\n\n return [\n 1,\n ...(start > 2 ? ([\"ellipsis-start\"] as const) : []),\n ...middle,\n ...(end < total - 1 ? ([\"ellipsis-end\"] as const) : []),\n total,\n ];\n}\n","/** Floating element positioning (tooltips, popovers, menus). Pure: easy to test. */\n\nexport type Side = \"top\" | \"bottom\" | \"left\" | \"right\";\nexport type Align = \"start\" | \"center\" | \"end\";\n\nexport type Rect = {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n};\nexport type Size = { readonly width: number; readonly height: number };\n\nexport type PositionOptions = {\n side?: Side;\n align?: Align;\n /** Gap between the anchor and the floating element, in px. */\n offset?: number;\n /** Minimum distance kept from the viewport edges, in px. */\n padding?: number;\n};\n\nexport type Position = { readonly x: number; readonly y: number; readonly side: Side };\n\nconst OPPOSITE: Readonly<Record<Side, Side>> = {\n top: \"bottom\",\n bottom: \"top\",\n left: \"right\",\n right: \"left\",\n};\n\nconst isVertical = (side: Side): boolean => side === \"top\" || side === \"bottom\";\n\nfunction alignOffset(\n anchorStart: number,\n anchorSize: number,\n floatingSize: number,\n align: Align,\n): number {\n if (align === \"start\") return anchorStart;\n if (align === \"end\") return anchorStart + anchorSize - floatingSize;\n return anchorStart + (anchorSize - floatingSize) / 2;\n}\n\nfunction place(anchor: Rect, floating: Size, side: Side, align: Align, offset: number): Position {\n if (isVertical(side)) {\n const y =\n side === \"top\" ? anchor.y - floating.height - offset : anchor.y + anchor.height + offset;\n return { x: alignOffset(anchor.x, anchor.width, floating.width, align), y, side };\n }\n const x = side === \"left\" ? anchor.x - floating.width - offset : anchor.x + anchor.width + offset;\n return { x, y: alignOffset(anchor.y, anchor.height, floating.height, align), side };\n}\n\nfunction overflows(position: Position, floating: Size, viewport: Size, padding: number): boolean {\n return isVertical(position.side)\n ? position.y < padding || position.y + floating.height > viewport.height - padding\n : position.x < padding || position.x + floating.width > viewport.width - padding;\n}\n\nconst clamp = (value: number, min: number, max: number): number =>\n Math.min(Math.max(value, min), Math.max(min, max));\n\n/**\n * Places `floating` next to `anchor`, flips to the opposite side when it does not fit,\n * then shifts it along the cross axis to stay inside the viewport.\n */\nexport function computePosition(\n anchor: Rect,\n floating: Size,\n viewport: Size,\n { side = \"bottom\", align = \"center\", offset = 8, padding = 8 }: PositionOptions = {},\n): Position {\n const preferred = place(anchor, floating, side, align, offset);\n const flipped = place(anchor, floating, OPPOSITE[side], align, offset);\n const chosen =\n overflows(preferred, floating, viewport, padding) &&\n !overflows(flipped, floating, viewport, padding)\n ? flipped\n : preferred;\n return {\n side: chosen.side,\n x: clamp(chosen.x, padding, viewport.width - floating.width - padding),\n y: clamp(chosen.y, padding, viewport.height - floating.height - padding),\n };\n}\n","/** Value arithmetic of a slider: ratios, stepping and keyboard moves, without any DOM. */\n\nexport type SliderScale = {\n min: number;\n max: number;\n step: number;\n};\n\nconst decimalsOf = (step: number): number => (String(step).split(\".\")[1] ?? \"\").length;\n\n/** Rounds to the step grid and clamps to the bounds, keeping the step's precision. */\nexport function snapToStep(value: number, { min, max, step }: SliderScale): number {\n const steps = Math.round((value - min) / step);\n const snapped = min + steps * step;\n return Number(Math.min(Math.max(snapped, min), max).toFixed(decimalsOf(step)));\n}\n\n/** Position of a value on the track, from 0 (min) to 1 (max). */\nexport const ratioOf = (value: number, { min, max }: SliderScale): number =>\n max === min ? 0 : Math.min(Math.max((value - min) / (max - min), 0), 1);\n\nexport const valueFromRatio = (ratio: number, scale: SliderScale): number =>\n snapToStep(scale.min + ratio * (scale.max - scale.min), scale);\n\ntype SliderKeyOptions = SliderScale & {\n /** Jump of PageUp and PageDown. Defaults to ten steps. */\n largeStep?: number;\n dir?: \"ltr\" | \"rtl\";\n};\n\nconst DECREASE = new Set([\"ArrowDown\", \"ArrowLeft\"]);\nconst INCREASE = new Set([\"ArrowUp\", \"ArrowRight\"]);\n\nfunction deltaFor(key: string, step: number, largeStep: number): number | undefined {\n if (key === \"PageUp\") return largeStep;\n if (key === \"PageDown\") return -largeStep;\n if (INCREASE.has(key)) return step;\n if (DECREASE.has(key)) return -step;\n return undefined;\n}\n\n/** Value after a key press, or undefined when the key does not move the slider. */\nexport function nextSliderValue(current: number, key: string, options: SliderKeyOptions): number {\n const { largeStep = options.step * 10, dir = \"ltr\" } = options;\n if (key === \"Home\") return options.min;\n if (key === \"End\") return options.max;\n const delta = deltaFor(key, options.step, largeStep);\n if (delta === undefined) return current;\n const horizontal = key === \"ArrowLeft\" || key === \"ArrowRight\";\n const mirrored = dir === \"rtl\" && horizontal ? -delta : delta;\n return snapToStep(current + mirrored, options);\n}\n\nexport const SLIDER_KEYS: readonly string[] = [\n \"ArrowUp\",\n \"ArrowDown\",\n \"ArrowLeft\",\n \"ArrowRight\",\n \"PageUp\",\n \"PageDown\",\n \"Home\",\n \"End\",\n];\n","/** Minimal observable store, framework-agnostic. Adapters subscribe to it. */\nexport type Store<T> = {\n get(): T;\n set(update: T | ((previous: T) => T)): void;\n subscribe(listener: () => void): () => void;\n};\n\nexport function createStore<T>(initialValue: T): Store<T> {\n let value = initialValue;\n const listeners = new Set<() => void>();\n return {\n get: () => value,\n set(update) {\n value = typeof update === \"function\" ? (update as (previous: T) => T)(value) : update;\n listeners.forEach((listener) => listener());\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGO,SAAS,MAAM,SAA+B;AACnD,SAAO,QAAQ,OAAO,OAAO,EAAE,KAAK,GAAG;AACzC;;;ACJA,eAAsB,SAAS,MAAgC;AAC7D,MAAI;AACF,UAAM,UAAU,UAAU,UAAU,IAAI;AACxC,WAAO;AAAA,EACT,QAAQ;AACN,WAAO,kBAAkB,IAAI;AAAA,EAC/B;AACF;AAEA,SAAS,kBAAkB,MAAuB;AAChD,MAAI,OAAO,aAAa,YAAa,QAAO;AAC5C,QAAM,OAAO,SAAS,cAAc,UAAU;AAC9C,OAAK,QAAQ;AACb,OAAK,aAAa,YAAY,EAAE;AAChC,OAAK,MAAM,WAAW;AACtB,OAAK,MAAM,UAAU;AACrB,WAAS,KAAK,OAAO,IAAI;AACzB,OAAK,OAAO;AACZ,QAAM,SAAS,SAAS,cAAc,MAAM,KAAK;AACjD,OAAK,OAAO;AACZ,SAAO;AACT;;;AClBO,SAAS,SAA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AO,QAAO,QAAQ;AAClC,QAAM,QAAQ,SAAS,KAAK,QAAQ,MAAM,SAAS;AACnD,MAAI,UAAU,OAAW,QAAO;AAChC,QAAM,aAAa,QAAQ,eAAe,QAAQ;AAClD,QAAM,WAAW,QAAQ,SAAS,aAAa,CAAC,QAAQ;AACxD,SAAO,WAAW,UAAU,UAAU,OAAO;AAC/C;AAEO,IAAM,cAAiC;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;ACvDO,SAAS,YAAe,cAA2B;AACxD,MAAI,QAAQ;AACZ,QAAM,YAAY,oBAAI,IAAgB;AACtC,SAAO;AAAA,IACL,KAAK,MAAM;AAAA,IACX,IAAI,QAAQ;AACV,cAAQ,OAAO,WAAW,aAAc,OAA8B,KAAK,IAAI;AAC/E,gBAAU,QAAQ,CAAC,aAAa,SAAS,CAAC;AAAA,IAC5C;AAAA,IACA,UAAU,UAAU;AAClB,gBAAU,IAAI,QAAQ;AACtB,aAAO,MAAM,UAAU,OAAO,QAAQ;AAAA,IACxC;AAAA,EACF;AACF;","names":["step"]}
@@ -0,0 +1,161 @@
1
+ type ClassValue = string | false | null | undefined;
2
+ /** Joins truthy class names with a single space. */
3
+ declare function cn(...classes: ClassValue[]): string;
4
+
5
+ /** Copies text, falling back to a hidden selection where the async clipboard is unavailable. */
6
+ declare function copyText(text: string): Promise<boolean>;
7
+
8
+ /**
9
+ * Boolean data attribute: present (empty string) when true, absent when false.
10
+ * Lets CSS target `[data-disabled]` instead of `[data-disabled="true"]`.
11
+ */
12
+ declare function dataAttr(condition: boolean | undefined): "" | undefined;
13
+
14
+ /** Calendar arithmetic on plain `Date` objects, in local time and free of any library. */
15
+ type DateRange = {
16
+ start: Date | null;
17
+ end: Date | null;
18
+ };
19
+ /** Midnight of the given day: the canonical form of a calendar date. */
20
+ declare const startOfDay: (date: Date) => Date;
21
+ declare const isSameDay: (first: Date, second: Date) => boolean;
22
+ declare const isSameMonth: (first: Date, second: Date) => boolean;
23
+ declare const addDays: (date: Date, amount: number) => Date;
24
+ /** Adds months, keeping the day inside the target month (31 Jan + 1 month = 28/29 Feb). */
25
+ declare function addMonths(date: Date, amount: number): Date;
26
+ declare const addYears: (date: Date, amount: number) => Date;
27
+ declare function clampDate(date: Date, min?: Date | undefined, max?: Date | undefined): Date;
28
+ /** Midnight of the first day of the week containing `date`. */
29
+ declare function startOfWeek(date: Date, weekStartsOn?: number): Date;
30
+ declare const endOfWeek: (date: Date, weekStartsOn?: number) => Date;
31
+ type DayCell = {
32
+ date: Date;
33
+ /** False for the leading and trailing days that pad the first and last week. */
34
+ inMonth: boolean;
35
+ };
36
+ /**
37
+ * The six weeks shown by a month view, always 42 days, so the grid never
38
+ * changes height between months.
39
+ * @param weekStartsOn 0 for Sunday, 1 for Monday, as `Date.getDay()` numbers them.
40
+ */
41
+ declare function getMonthGrid(month: Date, weekStartsOn?: number): DayCell[];
42
+ /** Splits a flat day list into weeks of seven. */
43
+ declare const toWeeks: <T>(days: readonly T[]) => T[][];
44
+ /** Weekday numbers in display order, e.g. [1,2,3,4,5,6,0] for a Monday-first week. */
45
+ declare const getWeekdays: (weekStartsOn?: number) => number[];
46
+ /**
47
+ * First day of the week in this locale, as a `Date.getDay()` number.
48
+ * Falls back to Monday where the runtime has no week data.
49
+ */
50
+ declare function getWeekStart(locale: string): number;
51
+ /** ISO `yyyy-mm-dd`, which is also the value format of `<input type="date">`. */
52
+ declare function toIsoDate(date: Date): string;
53
+ /** Parses `yyyy-mm-dd` as a local date. Returns null for anything else. */
54
+ declare function fromIsoDate(value: string): Date | null;
55
+ declare const isDateInRange: (date: Date, { start, end }: DateRange) => boolean;
56
+
57
+ /** Text matching for Combobox and CommandPalette: same rules in every consumer. */
58
+ /** Lowercase and strip diacritics, so "é" matches "e" and "Ş" matches "s". */
59
+ declare const normalizeText: (value: string) => string;
60
+ type MatchRange = {
61
+ start: number;
62
+ end: number;
63
+ };
64
+ /**
65
+ * Case- and accent-insensitive substring match.
66
+ * Returns the matched range in the original string, or null when there is no match.
67
+ */
68
+ declare function matchText(text: string, query: string): MatchRange | null;
69
+ declare const includesText: (text: string, query: string) => boolean;
70
+ /** Splits `text` into the part before the match, the match and the part after it. */
71
+ declare function splitMatch(text: string, query: string): [string, string, string];
72
+
73
+ /** Keyboard-focusable descendants, in DOM order. */
74
+ declare function getFocusableElements(container: ParentNode): HTMLElement[];
75
+
76
+ /** Up to two uppercase initials from a display name ("Nassim Farhat" -> "NF"). */
77
+ declare function getInitials(name: string, maxLength?: number): string;
78
+
79
+ /** Keyboard navigation inside a list of items (APG roving tabindex / active descendant). */
80
+ type Orientation = "horizontal" | "vertical" | "both";
81
+ type Direction = "ltr" | "rtl";
82
+ type NavigationOptions = {
83
+ orientation?: Orientation;
84
+ /** Wrap from the last item to the first and back. */
85
+ loop?: boolean;
86
+ dir?: Direction;
87
+ };
88
+ /** Index to focus after `key`, or `undefined` when the key is not a navigation key. */
89
+ declare function getNextIndex(current: number, count: number, key: string, { orientation, loop, dir }?: NavigationOptions): number | undefined;
90
+ /** Index of the next item whose label starts with `query`, searching after `startIndex`. */
91
+ declare function findTypeaheadMatch(labels: readonly string[], query: string, startIndex: number): number | undefined;
92
+
93
+ type PageItem = number | "ellipsis-start" | "ellipsis-end";
94
+ /**
95
+ * Pages to display: always the first and last, `siblings` around the current one,
96
+ * and an ellipsis where pages are skipped. The length stays constant while paging.
97
+ */
98
+ declare function getPageItems(current: number, total: number, siblings?: number): PageItem[];
99
+
100
+ /** Floating element positioning (tooltips, popovers, menus). Pure: easy to test. */
101
+ type Side = "top" | "bottom" | "left" | "right";
102
+ type Align = "start" | "center" | "end";
103
+ type Rect = {
104
+ readonly x: number;
105
+ readonly y: number;
106
+ readonly width: number;
107
+ readonly height: number;
108
+ };
109
+ type Size = {
110
+ readonly width: number;
111
+ readonly height: number;
112
+ };
113
+ type PositionOptions = {
114
+ side?: Side;
115
+ align?: Align;
116
+ /** Gap between the anchor and the floating element, in px. */
117
+ offset?: number;
118
+ /** Minimum distance kept from the viewport edges, in px. */
119
+ padding?: number;
120
+ };
121
+ type Position = {
122
+ readonly x: number;
123
+ readonly y: number;
124
+ readonly side: Side;
125
+ };
126
+ /**
127
+ * Places `floating` next to `anchor`, flips to the opposite side when it does not fit,
128
+ * then shifts it along the cross axis to stay inside the viewport.
129
+ */
130
+ declare function computePosition(anchor: Rect, floating: Size, viewport: Size, { side, align, offset, padding }?: PositionOptions): Position;
131
+
132
+ /** Value arithmetic of a slider: ratios, stepping and keyboard moves, without any DOM. */
133
+ type SliderScale = {
134
+ min: number;
135
+ max: number;
136
+ step: number;
137
+ };
138
+ /** Rounds to the step grid and clamps to the bounds, keeping the step's precision. */
139
+ declare function snapToStep(value: number, { min, max, step }: SliderScale): number;
140
+ /** Position of a value on the track, from 0 (min) to 1 (max). */
141
+ declare const ratioOf: (value: number, { min, max }: SliderScale) => number;
142
+ declare const valueFromRatio: (ratio: number, scale: SliderScale) => number;
143
+ type SliderKeyOptions = SliderScale & {
144
+ /** Jump of PageUp and PageDown. Defaults to ten steps. */
145
+ largeStep?: number;
146
+ dir?: "ltr" | "rtl";
147
+ };
148
+ /** Value after a key press, or undefined when the key does not move the slider. */
149
+ declare function nextSliderValue(current: number, key: string, options: SliderKeyOptions): number;
150
+ declare const SLIDER_KEYS: readonly string[];
151
+
152
+ /** Minimal observable store, framework-agnostic. Adapters subscribe to it. */
153
+ type Store<T> = {
154
+ get(): T;
155
+ set(update: T | ((previous: T) => T)): void;
156
+ subscribe(listener: () => void): () => void;
157
+ };
158
+ declare function createStore<T>(initialValue: T): Store<T>;
159
+
160
+ export { SLIDER_KEYS, addDays, addMonths, addYears, clampDate, cn, computePosition, copyText, createStore, dataAttr, endOfWeek, findTypeaheadMatch, fromIsoDate, getFocusableElements, getInitials, getMonthGrid, getNextIndex, getPageItems, getWeekStart, getWeekdays, includesText, isDateInRange, isSameDay, isSameMonth, matchText, nextSliderValue, normalizeText, ratioOf, snapToStep, splitMatch, startOfDay, startOfWeek, toIsoDate, toWeeks, valueFromRatio };
161
+ export type { Align, ClassValue, DateRange, DayCell, Direction, MatchRange, NavigationOptions, Orientation, PageItem, Position, PositionOptions, Rect, Side, Size, SliderScale, Store };
@@ -0,0 +1,161 @@
1
+ type ClassValue = string | false | null | undefined;
2
+ /** Joins truthy class names with a single space. */
3
+ declare function cn(...classes: ClassValue[]): string;
4
+
5
+ /** Copies text, falling back to a hidden selection where the async clipboard is unavailable. */
6
+ declare function copyText(text: string): Promise<boolean>;
7
+
8
+ /**
9
+ * Boolean data attribute: present (empty string) when true, absent when false.
10
+ * Lets CSS target `[data-disabled]` instead of `[data-disabled="true"]`.
11
+ */
12
+ declare function dataAttr(condition: boolean | undefined): "" | undefined;
13
+
14
+ /** Calendar arithmetic on plain `Date` objects, in local time and free of any library. */
15
+ type DateRange = {
16
+ start: Date | null;
17
+ end: Date | null;
18
+ };
19
+ /** Midnight of the given day: the canonical form of a calendar date. */
20
+ declare const startOfDay: (date: Date) => Date;
21
+ declare const isSameDay: (first: Date, second: Date) => boolean;
22
+ declare const isSameMonth: (first: Date, second: Date) => boolean;
23
+ declare const addDays: (date: Date, amount: number) => Date;
24
+ /** Adds months, keeping the day inside the target month (31 Jan + 1 month = 28/29 Feb). */
25
+ declare function addMonths(date: Date, amount: number): Date;
26
+ declare const addYears: (date: Date, amount: number) => Date;
27
+ declare function clampDate(date: Date, min?: Date | undefined, max?: Date | undefined): Date;
28
+ /** Midnight of the first day of the week containing `date`. */
29
+ declare function startOfWeek(date: Date, weekStartsOn?: number): Date;
30
+ declare const endOfWeek: (date: Date, weekStartsOn?: number) => Date;
31
+ type DayCell = {
32
+ date: Date;
33
+ /** False for the leading and trailing days that pad the first and last week. */
34
+ inMonth: boolean;
35
+ };
36
+ /**
37
+ * The six weeks shown by a month view, always 42 days, so the grid never
38
+ * changes height between months.
39
+ * @param weekStartsOn 0 for Sunday, 1 for Monday, as `Date.getDay()` numbers them.
40
+ */
41
+ declare function getMonthGrid(month: Date, weekStartsOn?: number): DayCell[];
42
+ /** Splits a flat day list into weeks of seven. */
43
+ declare const toWeeks: <T>(days: readonly T[]) => T[][];
44
+ /** Weekday numbers in display order, e.g. [1,2,3,4,5,6,0] for a Monday-first week. */
45
+ declare const getWeekdays: (weekStartsOn?: number) => number[];
46
+ /**
47
+ * First day of the week in this locale, as a `Date.getDay()` number.
48
+ * Falls back to Monday where the runtime has no week data.
49
+ */
50
+ declare function getWeekStart(locale: string): number;
51
+ /** ISO `yyyy-mm-dd`, which is also the value format of `<input type="date">`. */
52
+ declare function toIsoDate(date: Date): string;
53
+ /** Parses `yyyy-mm-dd` as a local date. Returns null for anything else. */
54
+ declare function fromIsoDate(value: string): Date | null;
55
+ declare const isDateInRange: (date: Date, { start, end }: DateRange) => boolean;
56
+
57
+ /** Text matching for Combobox and CommandPalette: same rules in every consumer. */
58
+ /** Lowercase and strip diacritics, so "é" matches "e" and "Ş" matches "s". */
59
+ declare const normalizeText: (value: string) => string;
60
+ type MatchRange = {
61
+ start: number;
62
+ end: number;
63
+ };
64
+ /**
65
+ * Case- and accent-insensitive substring match.
66
+ * Returns the matched range in the original string, or null when there is no match.
67
+ */
68
+ declare function matchText(text: string, query: string): MatchRange | null;
69
+ declare const includesText: (text: string, query: string) => boolean;
70
+ /** Splits `text` into the part before the match, the match and the part after it. */
71
+ declare function splitMatch(text: string, query: string): [string, string, string];
72
+
73
+ /** Keyboard-focusable descendants, in DOM order. */
74
+ declare function getFocusableElements(container: ParentNode): HTMLElement[];
75
+
76
+ /** Up to two uppercase initials from a display name ("Nassim Farhat" -> "NF"). */
77
+ declare function getInitials(name: string, maxLength?: number): string;
78
+
79
+ /** Keyboard navigation inside a list of items (APG roving tabindex / active descendant). */
80
+ type Orientation = "horizontal" | "vertical" | "both";
81
+ type Direction = "ltr" | "rtl";
82
+ type NavigationOptions = {
83
+ orientation?: Orientation;
84
+ /** Wrap from the last item to the first and back. */
85
+ loop?: boolean;
86
+ dir?: Direction;
87
+ };
88
+ /** Index to focus after `key`, or `undefined` when the key is not a navigation key. */
89
+ declare function getNextIndex(current: number, count: number, key: string, { orientation, loop, dir }?: NavigationOptions): number | undefined;
90
+ /** Index of the next item whose label starts with `query`, searching after `startIndex`. */
91
+ declare function findTypeaheadMatch(labels: readonly string[], query: string, startIndex: number): number | undefined;
92
+
93
+ type PageItem = number | "ellipsis-start" | "ellipsis-end";
94
+ /**
95
+ * Pages to display: always the first and last, `siblings` around the current one,
96
+ * and an ellipsis where pages are skipped. The length stays constant while paging.
97
+ */
98
+ declare function getPageItems(current: number, total: number, siblings?: number): PageItem[];
99
+
100
+ /** Floating element positioning (tooltips, popovers, menus). Pure: easy to test. */
101
+ type Side = "top" | "bottom" | "left" | "right";
102
+ type Align = "start" | "center" | "end";
103
+ type Rect = {
104
+ readonly x: number;
105
+ readonly y: number;
106
+ readonly width: number;
107
+ readonly height: number;
108
+ };
109
+ type Size = {
110
+ readonly width: number;
111
+ readonly height: number;
112
+ };
113
+ type PositionOptions = {
114
+ side?: Side;
115
+ align?: Align;
116
+ /** Gap between the anchor and the floating element, in px. */
117
+ offset?: number;
118
+ /** Minimum distance kept from the viewport edges, in px. */
119
+ padding?: number;
120
+ };
121
+ type Position = {
122
+ readonly x: number;
123
+ readonly y: number;
124
+ readonly side: Side;
125
+ };
126
+ /**
127
+ * Places `floating` next to `anchor`, flips to the opposite side when it does not fit,
128
+ * then shifts it along the cross axis to stay inside the viewport.
129
+ */
130
+ declare function computePosition(anchor: Rect, floating: Size, viewport: Size, { side, align, offset, padding }?: PositionOptions): Position;
131
+
132
+ /** Value arithmetic of a slider: ratios, stepping and keyboard moves, without any DOM. */
133
+ type SliderScale = {
134
+ min: number;
135
+ max: number;
136
+ step: number;
137
+ };
138
+ /** Rounds to the step grid and clamps to the bounds, keeping the step's precision. */
139
+ declare function snapToStep(value: number, { min, max, step }: SliderScale): number;
140
+ /** Position of a value on the track, from 0 (min) to 1 (max). */
141
+ declare const ratioOf: (value: number, { min, max }: SliderScale) => number;
142
+ declare const valueFromRatio: (ratio: number, scale: SliderScale) => number;
143
+ type SliderKeyOptions = SliderScale & {
144
+ /** Jump of PageUp and PageDown. Defaults to ten steps. */
145
+ largeStep?: number;
146
+ dir?: "ltr" | "rtl";
147
+ };
148
+ /** Value after a key press, or undefined when the key does not move the slider. */
149
+ declare function nextSliderValue(current: number, key: string, options: SliderKeyOptions): number;
150
+ declare const SLIDER_KEYS: readonly string[];
151
+
152
+ /** Minimal observable store, framework-agnostic. Adapters subscribe to it. */
153
+ type Store<T> = {
154
+ get(): T;
155
+ set(update: T | ((previous: T) => T)): void;
156
+ subscribe(listener: () => void): () => void;
157
+ };
158
+ declare function createStore<T>(initialValue: T): Store<T>;
159
+
160
+ export { SLIDER_KEYS, addDays, addMonths, addYears, clampDate, cn, computePosition, copyText, createStore, dataAttr, endOfWeek, findTypeaheadMatch, fromIsoDate, getFocusableElements, getInitials, getMonthGrid, getNextIndex, getPageItems, getWeekStart, getWeekdays, includesText, isDateInRange, isSameDay, isSameMonth, matchText, nextSliderValue, normalizeText, ratioOf, snapToStep, splitMatch, startOfDay, startOfWeek, toIsoDate, toWeeks, valueFromRatio };
161
+ export type { Align, ClassValue, DateRange, DayCell, Direction, MatchRange, NavigationOptions, Orientation, PageItem, Position, PositionOptions, Rect, Side, Size, SliderScale, Store };
package/dist/index.js ADDED
@@ -0,0 +1,297 @@
1
+ // src/class-names.ts
2
+ function cn(...classes) {
3
+ return classes.filter(Boolean).join(" ");
4
+ }
5
+
6
+ // src/clipboard.ts
7
+ async function copyText(text) {
8
+ try {
9
+ await navigator.clipboard.writeText(text);
10
+ return true;
11
+ } catch {
12
+ return copyWithSelection(text);
13
+ }
14
+ }
15
+ function copyWithSelection(text) {
16
+ if (typeof document === "undefined") return false;
17
+ const area = document.createElement("textarea");
18
+ area.value = text;
19
+ area.setAttribute("readonly", "");
20
+ area.style.position = "fixed";
21
+ area.style.opacity = "0";
22
+ document.body.append(area);
23
+ area.select();
24
+ const copied = document.execCommand?.("copy") ?? false;
25
+ area.remove();
26
+ return copied;
27
+ }
28
+
29
+ // src/data-attributes.ts
30
+ function dataAttr(condition) {
31
+ return condition ? "" : void 0;
32
+ }
33
+
34
+ // src/date.ts
35
+ var startOfDay = (date) => new Date(date.getFullYear(), date.getMonth(), date.getDate());
36
+ var isSameDay = (first, second) => first.getFullYear() === second.getFullYear() && first.getMonth() === second.getMonth() && first.getDate() === second.getDate();
37
+ var isSameMonth = (first, second) => first.getFullYear() === second.getFullYear() && first.getMonth() === second.getMonth();
38
+ var addDays = (date, amount) => new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
39
+ function addMonths(date, amount) {
40
+ const target = new Date(date.getFullYear(), date.getMonth() + amount, 1);
41
+ const lastDay = new Date(target.getFullYear(), target.getMonth() + 1, 0).getDate();
42
+ return new Date(target.getFullYear(), target.getMonth(), Math.min(date.getDate(), lastDay));
43
+ }
44
+ var addYears = (date, amount) => addMonths(date, amount * 12);
45
+ function clampDate(date, min, max) {
46
+ if (min && date < min) return min;
47
+ if (max && date > max) return max;
48
+ return date;
49
+ }
50
+ function startOfWeek(date, weekStartsOn = 1) {
51
+ const offset = (date.getDay() - weekStartsOn + 7) % 7;
52
+ return addDays(startOfDay(date), -offset);
53
+ }
54
+ var endOfWeek = (date, weekStartsOn = 1) => addDays(startOfWeek(date, weekStartsOn), 6);
55
+ function getMonthGrid(month, weekStartsOn = 1) {
56
+ const first = new Date(month.getFullYear(), month.getMonth(), 1);
57
+ const offset = (first.getDay() - weekStartsOn + 7) % 7;
58
+ const start = addDays(first, -offset);
59
+ return Array.from({ length: 42 }, (_, index) => {
60
+ const date = addDays(start, index);
61
+ return { date, inMonth: isSameMonth(date, month) };
62
+ });
63
+ }
64
+ var toWeeks = (days) => Array.from(
65
+ { length: Math.ceil(days.length / 7) },
66
+ (_, week) => days.slice(week * 7, week * 7 + 7)
67
+ );
68
+ var getWeekdays = (weekStartsOn = 1) => Array.from({ length: 7 }, (_, index) => (weekStartsOn + index) % 7);
69
+ function getWeekStart(locale) {
70
+ const firstDay = new Intl.Locale(locale).getWeekInfo?.().firstDay;
71
+ return firstDay === void 0 ? 1 : firstDay % 7;
72
+ }
73
+ function toIsoDate(date) {
74
+ const month = String(date.getMonth() + 1).padStart(2, "0");
75
+ const day = String(date.getDate()).padStart(2, "0");
76
+ return `${date.getFullYear()}-${month}-${day}`;
77
+ }
78
+ function fromIsoDate(value) {
79
+ const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value.trim());
80
+ if (!match) return null;
81
+ const [, year, month, day] = match;
82
+ const date = new Date(Number(year), Number(month) - 1, Number(day));
83
+ const isReal = date.getMonth() === Number(month) - 1 && date.getDate() === Number(day);
84
+ return isReal ? date : null;
85
+ }
86
+ var isDateInRange = (date, { start, end }) => start !== null && end !== null && startOfDay(date) >= startOfDay(start) && startOfDay(date) <= startOfDay(end);
87
+
88
+ // src/filter.ts
89
+ var normalizeText = (value) => value.normalize("NFD").replace(/\p{Diacritic}/gu, "").toLocaleLowerCase();
90
+ function matchText(text, query) {
91
+ if (query.trim() === "") return { start: 0, end: 0 };
92
+ const index = normalizeText(text).indexOf(normalizeText(query));
93
+ return index === -1 ? null : { start: index, end: index + query.trim().length };
94
+ }
95
+ var includesText = (text, query) => matchText(text, query) !== null;
96
+ function splitMatch(text, query) {
97
+ const range = matchText(text, query);
98
+ if (!range || range.end === range.start) return [text, "", ""];
99
+ return [text.slice(0, range.start), text.slice(range.start, range.end), text.slice(range.end)];
100
+ }
101
+
102
+ // src/focus.ts
103
+ var FOCUSABLE = [
104
+ "a[href]",
105
+ "button:not([disabled])",
106
+ "input:not([disabled]):not([type='hidden'])",
107
+ "select:not([disabled])",
108
+ "textarea:not([disabled])",
109
+ "[tabindex]:not([tabindex='-1'])"
110
+ ].join(",");
111
+ function getFocusableElements(container) {
112
+ return [...container.querySelectorAll(FOCUSABLE)].filter(
113
+ (element) => !element.hasAttribute("inert") && element.getAttribute("aria-hidden") !== "true"
114
+ );
115
+ }
116
+
117
+ // src/initials.ts
118
+ function getInitials(name, maxLength = 2) {
119
+ return name.trim().split(/\s+/).filter(Boolean).slice(0, maxLength).map((word) => word.charAt(0).toUpperCase()).join("");
120
+ }
121
+
122
+ // src/navigation.ts
123
+ var EDGE_KEYS = { Home: "first", End: "last" };
124
+ var VERTICAL_KEYS = { ArrowDown: "next", ArrowUp: "previous" };
125
+ var HORIZONTAL_KEYS = {
126
+ ltr: { ArrowRight: "next", ArrowLeft: "previous" },
127
+ rtl: { ArrowLeft: "next", ArrowRight: "previous" }
128
+ };
129
+ function moveFor(key, orientation, dir) {
130
+ const horizontal = orientation === "vertical" ? {} : HORIZONTAL_KEYS[dir];
131
+ const vertical = orientation === "horizontal" ? {} : VERTICAL_KEYS;
132
+ return EDGE_KEYS[key] ?? horizontal[key] ?? vertical[key];
133
+ }
134
+ function step(current, count, move, loop) {
135
+ if (move === "first") return 0;
136
+ if (move === "last") return count - 1;
137
+ const target = move === "next" ? current + 1 : current - 1;
138
+ if (loop) return (target + count) % count;
139
+ return Math.min(Math.max(target, 0), count - 1);
140
+ }
141
+ function getNextIndex(current, count, key, { orientation = "vertical", loop = true, dir = "ltr" } = {}) {
142
+ if (count === 0) return void 0;
143
+ const move = moveFor(key, orientation, dir);
144
+ return move === void 0 ? void 0 : step(current, count, move, loop);
145
+ }
146
+ function findTypeaheadMatch(labels, query, startIndex) {
147
+ const needle = query.toLocaleLowerCase();
148
+ const ordered = labels.map((label, index) => ({ label, index }));
149
+ const rotated = [...ordered.slice(startIndex + 1), ...ordered.slice(0, startIndex + 1)];
150
+ return rotated.find(({ label }) => label.trim().toLocaleLowerCase().startsWith(needle))?.index;
151
+ }
152
+
153
+ // src/pagination.ts
154
+ function getPageItems(current, total, siblings = 1) {
155
+ const visible = siblings * 2 + 5;
156
+ if (total <= visible) return Array.from({ length: total }, (_, index) => index + 1);
157
+ const start = Math.max(2, Math.min(current - siblings, total - siblings * 2 - 2));
158
+ const end = Math.min(total - 1, Math.max(current + siblings, siblings * 2 + 3));
159
+ const middle = Array.from({ length: end - start + 1 }, (_, index) => start + index);
160
+ return [
161
+ 1,
162
+ ...start > 2 ? ["ellipsis-start"] : [],
163
+ ...middle,
164
+ ...end < total - 1 ? ["ellipsis-end"] : [],
165
+ total
166
+ ];
167
+ }
168
+
169
+ // src/position.ts
170
+ var OPPOSITE = {
171
+ top: "bottom",
172
+ bottom: "top",
173
+ left: "right",
174
+ right: "left"
175
+ };
176
+ var isVertical = (side) => side === "top" || side === "bottom";
177
+ function alignOffset(anchorStart, anchorSize, floatingSize, align) {
178
+ if (align === "start") return anchorStart;
179
+ if (align === "end") return anchorStart + anchorSize - floatingSize;
180
+ return anchorStart + (anchorSize - floatingSize) / 2;
181
+ }
182
+ function place(anchor, floating, side, align, offset) {
183
+ if (isVertical(side)) {
184
+ const y = side === "top" ? anchor.y - floating.height - offset : anchor.y + anchor.height + offset;
185
+ return { x: alignOffset(anchor.x, anchor.width, floating.width, align), y, side };
186
+ }
187
+ const x = side === "left" ? anchor.x - floating.width - offset : anchor.x + anchor.width + offset;
188
+ return { x, y: alignOffset(anchor.y, anchor.height, floating.height, align), side };
189
+ }
190
+ function overflows(position, floating, viewport, padding) {
191
+ return isVertical(position.side) ? position.y < padding || position.y + floating.height > viewport.height - padding : position.x < padding || position.x + floating.width > viewport.width - padding;
192
+ }
193
+ var clamp = (value, min, max) => Math.min(Math.max(value, min), Math.max(min, max));
194
+ function computePosition(anchor, floating, viewport, { side = "bottom", align = "center", offset = 8, padding = 8 } = {}) {
195
+ const preferred = place(anchor, floating, side, align, offset);
196
+ const flipped = place(anchor, floating, OPPOSITE[side], align, offset);
197
+ const chosen = overflows(preferred, floating, viewport, padding) && !overflows(flipped, floating, viewport, padding) ? flipped : preferred;
198
+ return {
199
+ side: chosen.side,
200
+ x: clamp(chosen.x, padding, viewport.width - floating.width - padding),
201
+ y: clamp(chosen.y, padding, viewport.height - floating.height - padding)
202
+ };
203
+ }
204
+
205
+ // src/slider.ts
206
+ var decimalsOf = (step2) => (String(step2).split(".")[1] ?? "").length;
207
+ function snapToStep(value, { min, max, step: step2 }) {
208
+ const steps = Math.round((value - min) / step2);
209
+ const snapped = min + steps * step2;
210
+ return Number(Math.min(Math.max(snapped, min), max).toFixed(decimalsOf(step2)));
211
+ }
212
+ var ratioOf = (value, { min, max }) => max === min ? 0 : Math.min(Math.max((value - min) / (max - min), 0), 1);
213
+ var valueFromRatio = (ratio, scale) => snapToStep(scale.min + ratio * (scale.max - scale.min), scale);
214
+ var DECREASE = /* @__PURE__ */ new Set(["ArrowDown", "ArrowLeft"]);
215
+ var INCREASE = /* @__PURE__ */ new Set(["ArrowUp", "ArrowRight"]);
216
+ function deltaFor(key, step2, largeStep) {
217
+ if (key === "PageUp") return largeStep;
218
+ if (key === "PageDown") return -largeStep;
219
+ if (INCREASE.has(key)) return step2;
220
+ if (DECREASE.has(key)) return -step2;
221
+ return void 0;
222
+ }
223
+ function nextSliderValue(current, key, options) {
224
+ const { largeStep = options.step * 10, dir = "ltr" } = options;
225
+ if (key === "Home") return options.min;
226
+ if (key === "End") return options.max;
227
+ const delta = deltaFor(key, options.step, largeStep);
228
+ if (delta === void 0) return current;
229
+ const horizontal = key === "ArrowLeft" || key === "ArrowRight";
230
+ const mirrored = dir === "rtl" && horizontal ? -delta : delta;
231
+ return snapToStep(current + mirrored, options);
232
+ }
233
+ var SLIDER_KEYS = [
234
+ "ArrowUp",
235
+ "ArrowDown",
236
+ "ArrowLeft",
237
+ "ArrowRight",
238
+ "PageUp",
239
+ "PageDown",
240
+ "Home",
241
+ "End"
242
+ ];
243
+
244
+ // src/store.ts
245
+ function createStore(initialValue) {
246
+ let value = initialValue;
247
+ const listeners = /* @__PURE__ */ new Set();
248
+ return {
249
+ get: () => value,
250
+ set(update) {
251
+ value = typeof update === "function" ? update(value) : update;
252
+ listeners.forEach((listener) => listener());
253
+ },
254
+ subscribe(listener) {
255
+ listeners.add(listener);
256
+ return () => listeners.delete(listener);
257
+ }
258
+ };
259
+ }
260
+ export {
261
+ SLIDER_KEYS,
262
+ addDays,
263
+ addMonths,
264
+ addYears,
265
+ clampDate,
266
+ cn,
267
+ computePosition,
268
+ copyText,
269
+ createStore,
270
+ dataAttr,
271
+ endOfWeek,
272
+ findTypeaheadMatch,
273
+ fromIsoDate,
274
+ getFocusableElements,
275
+ getInitials,
276
+ getMonthGrid,
277
+ getNextIndex,
278
+ getPageItems,
279
+ getWeekStart,
280
+ getWeekdays,
281
+ includesText,
282
+ isDateInRange,
283
+ isSameDay,
284
+ isSameMonth,
285
+ matchText,
286
+ nextSliderValue,
287
+ normalizeText,
288
+ ratioOf,
289
+ snapToStep,
290
+ splitMatch,
291
+ startOfDay,
292
+ startOfWeek,
293
+ toIsoDate,
294
+ toWeeks,
295
+ valueFromRatio
296
+ };
297
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/class-names.ts","../src/clipboard.ts","../src/data-attributes.ts","../src/date.ts","../src/filter.ts","../src/focus.ts","../src/initials.ts","../src/navigation.ts","../src/pagination.ts","../src/position.ts","../src/slider.ts","../src/store.ts"],"sourcesContent":["export type ClassValue = string | false | null | undefined;\n\n/** Joins truthy class names with a single space. */\nexport function cn(...classes: ClassValue[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n","/** Copies text, falling back to a hidden selection where the async clipboard is unavailable. */\nexport async function copyText(text: string): Promise<boolean> {\n try {\n await navigator.clipboard.writeText(text);\n return true;\n } catch {\n return copyWithSelection(text);\n }\n}\n\nfunction copyWithSelection(text: string): boolean {\n if (typeof document === \"undefined\") return false;\n const area = document.createElement(\"textarea\");\n area.value = text;\n area.setAttribute(\"readonly\", \"\");\n area.style.position = \"fixed\";\n area.style.opacity = \"0\";\n document.body.append(area);\n area.select();\n const copied = document.execCommand?.(\"copy\") ?? false;\n area.remove();\n return copied;\n}\n","/**\n * Boolean data attribute: present (empty string) when true, absent when false.\n * Lets CSS target `[data-disabled]` instead of `[data-disabled=\"true\"]`.\n */\nexport function dataAttr(condition: boolean | undefined): \"\" | undefined {\n return condition ? \"\" : undefined;\n}\n","/** Calendar arithmetic on plain `Date` objects, in local time and free of any library. */\n\nexport type DateRange = { start: Date | null; end: Date | null };\n\n/** Midnight of the given day: the canonical form of a calendar date. */\nexport const startOfDay = (date: Date): Date =>\n new Date(date.getFullYear(), date.getMonth(), date.getDate());\n\nexport const isSameDay = (first: Date, second: Date): boolean =>\n first.getFullYear() === second.getFullYear() &&\n first.getMonth() === second.getMonth() &&\n first.getDate() === second.getDate();\n\nexport const isSameMonth = (first: Date, second: Date): boolean =>\n first.getFullYear() === second.getFullYear() && first.getMonth() === second.getMonth();\n\nexport const addDays = (date: Date, amount: number): Date =>\n new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);\n\n/** Adds months, keeping the day inside the target month (31 Jan + 1 month = 28/29 Feb). */\nexport function addMonths(date: Date, amount: number): Date {\n const target = new Date(date.getFullYear(), date.getMonth() + amount, 1);\n const lastDay = new Date(target.getFullYear(), target.getMonth() + 1, 0).getDate();\n return new Date(target.getFullYear(), target.getMonth(), Math.min(date.getDate(), lastDay));\n}\n\nexport const addYears = (date: Date, amount: number): Date => addMonths(date, amount * 12);\n\nexport function clampDate(date: Date, min?: Date | undefined, max?: Date | undefined): Date {\n if (min && date < min) return min;\n if (max && date > max) return max;\n return date;\n}\n\n/** Midnight of the first day of the week containing `date`. */\nexport function startOfWeek(date: Date, weekStartsOn = 1): Date {\n const offset = (date.getDay() - weekStartsOn + 7) % 7;\n return addDays(startOfDay(date), -offset);\n}\n\nexport const endOfWeek = (date: Date, weekStartsOn = 1): Date =>\n addDays(startOfWeek(date, weekStartsOn), 6);\n\nexport type DayCell = {\n date: Date;\n /** False for the leading and trailing days that pad the first and last week. */\n inMonth: boolean;\n};\n\n/**\n * The six weeks shown by a month view, always 42 days, so the grid never\n * changes height between months.\n * @param weekStartsOn 0 for Sunday, 1 for Monday, as `Date.getDay()` numbers them.\n */\nexport function getMonthGrid(month: Date, weekStartsOn = 1): DayCell[] {\n const first = new Date(month.getFullYear(), month.getMonth(), 1);\n const offset = (first.getDay() - weekStartsOn + 7) % 7;\n const start = addDays(first, -offset);\n return Array.from({ length: 42 }, (_, index) => {\n const date = addDays(start, index);\n return { date, inMonth: isSameMonth(date, month) };\n });\n}\n\n/** Splits a flat day list into weeks of seven. */\nexport const toWeeks = <T>(days: readonly T[]): T[][] =>\n Array.from({ length: Math.ceil(days.length / 7) }, (_, week) =>\n days.slice(week * 7, week * 7 + 7),\n );\n\n/** Weekday numbers in display order, e.g. [1,2,3,4,5,6,0] for a Monday-first week. */\nexport const getWeekdays = (weekStartsOn = 1): number[] =>\n Array.from({ length: 7 }, (_, index) => (weekStartsOn + index) % 7);\n\n/** `Intl.Locale.getWeekInfo` is not in every runtime, nor in the TypeScript lib yet. */\ntype LocaleWithWeekInfo = Intl.Locale & { getWeekInfo?: () => { firstDay: number } };\n\n/**\n * First day of the week in this locale, as a `Date.getDay()` number.\n * Falls back to Monday where the runtime has no week data.\n */\nexport function getWeekStart(locale: string): number {\n const firstDay = (new Intl.Locale(locale) as LocaleWithWeekInfo).getWeekInfo?.().firstDay;\n return firstDay === undefined ? 1 : firstDay % 7;\n}\n\n/** ISO `yyyy-mm-dd`, which is also the value format of `<input type=\"date\">`. */\nexport function toIsoDate(date: Date): string {\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n return `${date.getFullYear()}-${month}-${day}`;\n}\n\n/** Parses `yyyy-mm-dd` as a local date. Returns null for anything else. */\nexport function fromIsoDate(value: string): Date | null {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(value.trim());\n if (!match) return null;\n const [, year, month, day] = match;\n const date = new Date(Number(year), Number(month) - 1, Number(day));\n const isReal = date.getMonth() === Number(month) - 1 && date.getDate() === Number(day);\n return isReal ? date : null;\n}\n\nexport const isDateInRange = (date: Date, { start, end }: DateRange): boolean =>\n start !== null &&\n end !== null &&\n startOfDay(date) >= startOfDay(start) &&\n startOfDay(date) <= startOfDay(end);\n","/** Text matching for Combobox and CommandPalette: same rules in every consumer. */\n\n/** Lowercase and strip diacritics, so \"é\" matches \"e\" and \"Ş\" matches \"s\". */\nexport const normalizeText = (value: string): string =>\n value\n .normalize(\"NFD\")\n .replace(/\\p{Diacritic}/gu, \"\")\n .toLocaleLowerCase();\n\nexport type MatchRange = { start: number; end: number };\n\n/**\n * Case- and accent-insensitive substring match.\n * Returns the matched range in the original string, or null when there is no match.\n */\nexport function matchText(text: string, query: string): MatchRange | null {\n if (query.trim() === \"\") return { start: 0, end: 0 };\n const index = normalizeText(text).indexOf(normalizeText(query));\n return index === -1 ? null : { start: index, end: index + query.trim().length };\n}\n\nexport const includesText = (text: string, query: string): boolean =>\n matchText(text, query) !== null;\n\n/** Splits `text` into the part before the match, the match and the part after it. */\nexport function splitMatch(text: string, query: string): [string, string, string] {\n const range = matchText(text, query);\n if (!range || range.end === range.start) return [text, \"\", \"\"];\n return [text.slice(0, range.start), text.slice(range.start, range.end), text.slice(range.end)];\n}\n","const FOCUSABLE = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled]):not([type='hidden'])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n \"[tabindex]:not([tabindex='-1'])\",\n].join(\",\");\n\n/** Keyboard-focusable descendants, in DOM order. */\nexport function getFocusableElements(container: ParentNode): HTMLElement[] {\n return [...container.querySelectorAll<HTMLElement>(FOCUSABLE)].filter(\n (element) => !element.hasAttribute(\"inert\") && element.getAttribute(\"aria-hidden\") !== \"true\",\n );\n}\n","/** Up to two uppercase initials from a display name (\"Nassim Farhat\" -> \"NF\"). */\nexport function getInitials(name: string, maxLength = 2): string {\n return name\n .trim()\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, maxLength)\n .map((word) => word.charAt(0).toUpperCase())\n .join(\"\");\n}\n","/** Keyboard navigation inside a list of items (APG roving tabindex / active descendant). */\n\nexport type Orientation = \"horizontal\" | \"vertical\" | \"both\";\nexport type Direction = \"ltr\" | \"rtl\";\n\nexport type NavigationOptions = {\n orientation?: Orientation;\n /** Wrap from the last item to the first and back. */\n loop?: boolean;\n dir?: Direction;\n};\n\ntype Move = \"next\" | \"previous\" | \"first\" | \"last\";\n\nconst EDGE_KEYS: Readonly<Record<string, Move>> = { Home: \"first\", End: \"last\" };\nconst VERTICAL_KEYS: Readonly<Record<string, Move>> = { ArrowDown: \"next\", ArrowUp: \"previous\" };\nconst HORIZONTAL_KEYS: Readonly<Record<Direction, Readonly<Record<string, Move>>>> = {\n ltr: { ArrowRight: \"next\", ArrowLeft: \"previous\" },\n rtl: { ArrowLeft: \"next\", ArrowRight: \"previous\" },\n};\n\nfunction moveFor(key: string, orientation: Orientation, dir: Direction): Move | undefined {\n const horizontal = orientation === \"vertical\" ? {} : HORIZONTAL_KEYS[dir];\n const vertical = orientation === \"horizontal\" ? {} : VERTICAL_KEYS;\n return EDGE_KEYS[key] ?? horizontal[key] ?? vertical[key];\n}\n\nfunction step(current: number, count: number, move: Move, loop: boolean): number {\n if (move === \"first\") return 0;\n if (move === \"last\") return count - 1;\n const target = move === \"next\" ? current + 1 : current - 1;\n if (loop) return (target + count) % count;\n return Math.min(Math.max(target, 0), count - 1);\n}\n\n/** Index to focus after `key`, or `undefined` when the key is not a navigation key. */\nexport function getNextIndex(\n current: number,\n count: number,\n key: string,\n { orientation = \"vertical\", loop = true, dir = \"ltr\" }: NavigationOptions = {},\n): number | undefined {\n if (count === 0) return undefined;\n const move = moveFor(key, orientation, dir);\n return move === undefined ? undefined : step(current, count, move, loop);\n}\n\n/** Index of the next item whose label starts with `query`, searching after `startIndex`. */\nexport function findTypeaheadMatch(\n labels: readonly string[],\n query: string,\n startIndex: number,\n): number | undefined {\n const needle = query.toLocaleLowerCase();\n const ordered = labels.map((label, index) => ({ label, index }));\n const rotated = [...ordered.slice(startIndex + 1), ...ordered.slice(0, startIndex + 1)];\n return rotated.find(({ label }) => label.trim().toLocaleLowerCase().startsWith(needle))?.index;\n}\n","export type PageItem = number | \"ellipsis-start\" | \"ellipsis-end\";\n\n/**\n * Pages to display: always the first and last, `siblings` around the current one,\n * and an ellipsis where pages are skipped. The length stays constant while paging.\n */\nexport function getPageItems(current: number, total: number, siblings = 1): PageItem[] {\n const visible = siblings * 2 + 5;\n if (total <= visible) return Array.from({ length: total }, (_, index) => index + 1);\n\n const start = Math.max(2, Math.min(current - siblings, total - siblings * 2 - 2));\n const end = Math.min(total - 1, Math.max(current + siblings, siblings * 2 + 3));\n const middle = Array.from({ length: end - start + 1 }, (_, index) => start + index);\n\n return [\n 1,\n ...(start > 2 ? ([\"ellipsis-start\"] as const) : []),\n ...middle,\n ...(end < total - 1 ? ([\"ellipsis-end\"] as const) : []),\n total,\n ];\n}\n","/** Floating element positioning (tooltips, popovers, menus). Pure: easy to test. */\n\nexport type Side = \"top\" | \"bottom\" | \"left\" | \"right\";\nexport type Align = \"start\" | \"center\" | \"end\";\n\nexport type Rect = {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n};\nexport type Size = { readonly width: number; readonly height: number };\n\nexport type PositionOptions = {\n side?: Side;\n align?: Align;\n /** Gap between the anchor and the floating element, in px. */\n offset?: number;\n /** Minimum distance kept from the viewport edges, in px. */\n padding?: number;\n};\n\nexport type Position = { readonly x: number; readonly y: number; readonly side: Side };\n\nconst OPPOSITE: Readonly<Record<Side, Side>> = {\n top: \"bottom\",\n bottom: \"top\",\n left: \"right\",\n right: \"left\",\n};\n\nconst isVertical = (side: Side): boolean => side === \"top\" || side === \"bottom\";\n\nfunction alignOffset(\n anchorStart: number,\n anchorSize: number,\n floatingSize: number,\n align: Align,\n): number {\n if (align === \"start\") return anchorStart;\n if (align === \"end\") return anchorStart + anchorSize - floatingSize;\n return anchorStart + (anchorSize - floatingSize) / 2;\n}\n\nfunction place(anchor: Rect, floating: Size, side: Side, align: Align, offset: number): Position {\n if (isVertical(side)) {\n const y =\n side === \"top\" ? anchor.y - floating.height - offset : anchor.y + anchor.height + offset;\n return { x: alignOffset(anchor.x, anchor.width, floating.width, align), y, side };\n }\n const x = side === \"left\" ? anchor.x - floating.width - offset : anchor.x + anchor.width + offset;\n return { x, y: alignOffset(anchor.y, anchor.height, floating.height, align), side };\n}\n\nfunction overflows(position: Position, floating: Size, viewport: Size, padding: number): boolean {\n return isVertical(position.side)\n ? position.y < padding || position.y + floating.height > viewport.height - padding\n : position.x < padding || position.x + floating.width > viewport.width - padding;\n}\n\nconst clamp = (value: number, min: number, max: number): number =>\n Math.min(Math.max(value, min), Math.max(min, max));\n\n/**\n * Places `floating` next to `anchor`, flips to the opposite side when it does not fit,\n * then shifts it along the cross axis to stay inside the viewport.\n */\nexport function computePosition(\n anchor: Rect,\n floating: Size,\n viewport: Size,\n { side = \"bottom\", align = \"center\", offset = 8, padding = 8 }: PositionOptions = {},\n): Position {\n const preferred = place(anchor, floating, side, align, offset);\n const flipped = place(anchor, floating, OPPOSITE[side], align, offset);\n const chosen =\n overflows(preferred, floating, viewport, padding) &&\n !overflows(flipped, floating, viewport, padding)\n ? flipped\n : preferred;\n return {\n side: chosen.side,\n x: clamp(chosen.x, padding, viewport.width - floating.width - padding),\n y: clamp(chosen.y, padding, viewport.height - floating.height - padding),\n };\n}\n","/** Value arithmetic of a slider: ratios, stepping and keyboard moves, without any DOM. */\n\nexport type SliderScale = {\n min: number;\n max: number;\n step: number;\n};\n\nconst decimalsOf = (step: number): number => (String(step).split(\".\")[1] ?? \"\").length;\n\n/** Rounds to the step grid and clamps to the bounds, keeping the step's precision. */\nexport function snapToStep(value: number, { min, max, step }: SliderScale): number {\n const steps = Math.round((value - min) / step);\n const snapped = min + steps * step;\n return Number(Math.min(Math.max(snapped, min), max).toFixed(decimalsOf(step)));\n}\n\n/** Position of a value on the track, from 0 (min) to 1 (max). */\nexport const ratioOf = (value: number, { min, max }: SliderScale): number =>\n max === min ? 0 : Math.min(Math.max((value - min) / (max - min), 0), 1);\n\nexport const valueFromRatio = (ratio: number, scale: SliderScale): number =>\n snapToStep(scale.min + ratio * (scale.max - scale.min), scale);\n\ntype SliderKeyOptions = SliderScale & {\n /** Jump of PageUp and PageDown. Defaults to ten steps. */\n largeStep?: number;\n dir?: \"ltr\" | \"rtl\";\n};\n\nconst DECREASE = new Set([\"ArrowDown\", \"ArrowLeft\"]);\nconst INCREASE = new Set([\"ArrowUp\", \"ArrowRight\"]);\n\nfunction deltaFor(key: string, step: number, largeStep: number): number | undefined {\n if (key === \"PageUp\") return largeStep;\n if (key === \"PageDown\") return -largeStep;\n if (INCREASE.has(key)) return step;\n if (DECREASE.has(key)) return -step;\n return undefined;\n}\n\n/** Value after a key press, or undefined when the key does not move the slider. */\nexport function nextSliderValue(current: number, key: string, options: SliderKeyOptions): number {\n const { largeStep = options.step * 10, dir = \"ltr\" } = options;\n if (key === \"Home\") return options.min;\n if (key === \"End\") return options.max;\n const delta = deltaFor(key, options.step, largeStep);\n if (delta === undefined) return current;\n const horizontal = key === \"ArrowLeft\" || key === \"ArrowRight\";\n const mirrored = dir === \"rtl\" && horizontal ? -delta : delta;\n return snapToStep(current + mirrored, options);\n}\n\nexport const SLIDER_KEYS: readonly string[] = [\n \"ArrowUp\",\n \"ArrowDown\",\n \"ArrowLeft\",\n \"ArrowRight\",\n \"PageUp\",\n \"PageDown\",\n \"Home\",\n \"End\",\n];\n","/** Minimal observable store, framework-agnostic. Adapters subscribe to it. */\nexport type Store<T> = {\n get(): T;\n set(update: T | ((previous: T) => T)): void;\n subscribe(listener: () => void): () => void;\n};\n\nexport function createStore<T>(initialValue: T): Store<T> {\n let value = initialValue;\n const listeners = new Set<() => void>();\n return {\n get: () => value,\n set(update) {\n value = typeof update === \"function\" ? (update as (previous: T) => T)(value) : update;\n listeners.forEach((listener) => listener());\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n };\n}\n"],"mappings":";AAGO,SAAS,MAAM,SAA+B;AACnD,SAAO,QAAQ,OAAO,OAAO,EAAE,K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HANGED
@@ -1,6 +1,47 @@
1
1
  {
2
2
  "name": "@atomscraft/core",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.1",
4
+ "description": "Framework-agnostic behavior primitives for AtomCraft.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "main": "./dist/index.cjs",
11
+ "module": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js",
17
+ "require": "./dist/index.cjs"
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/NassimFarhat/AtomCraft-UI.git",
24
+ "directory": "packages/core"
25
+ },
26
+ "homepage": "https://github.com/NassimFarhat/AtomCraft-UI#readme",
27
+ "bugs": {
28
+ "url": "https://github.com/NassimFarhat/AtomCraft-UI/issues"
29
+ },
30
+ "keywords": [
31
+ "atomcraft",
32
+ "design-system",
33
+ "ui",
34
+ "behavior"
35
+ ],
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "devDependencies": {
40
+ "vitest": "^5.1.1"
41
+ },
42
+ "scripts": {
43
+ "build": "tsup",
44
+ "pack:check": "npm pack --dry-run",
45
+ "test": "vitest run"
46
+ }
6
47
  }