react-devbelt 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +16 -0
  3. package/README.md +324 -2
  4. package/dist/announce-6XECDMRI.js +12 -0
  5. package/dist/announce-6XECDMRI.js.map +1 -0
  6. package/dist/chunk-3SXZJ6OP.js +65 -0
  7. package/dist/chunk-3SXZJ6OP.js.map +1 -0
  8. package/dist/chunk-63DO3YVL.js +330 -0
  9. package/dist/chunk-63DO3YVL.js.map +1 -0
  10. package/dist/chunk-6PAFI4BJ.js +14615 -0
  11. package/dist/chunk-6PAFI4BJ.js.map +1 -0
  12. package/dist/chunk-7JLNVGRQ.js +164 -0
  13. package/dist/chunk-7JLNVGRQ.js.map +1 -0
  14. package/dist/chunk-C7RMX5PF.js +57 -0
  15. package/dist/chunk-C7RMX5PF.js.map +1 -0
  16. package/dist/chunk-GB5T3MS2.js +8030 -0
  17. package/dist/chunk-GB5T3MS2.js.map +1 -0
  18. package/dist/chunk-GNJF3UHO.js +1030 -0
  19. package/dist/chunk-GNJF3UHO.js.map +1 -0
  20. package/dist/chunk-PRTINXUT.js +105 -0
  21. package/dist/chunk-PRTINXUT.js.map +1 -0
  22. package/dist/chunk-QRXHNBFY.js +22 -0
  23. package/dist/chunk-QRXHNBFY.js.map +1 -0
  24. package/dist/chunk-QT3YSHQA.js +18 -0
  25. package/dist/chunk-QT3YSHQA.js.map +1 -0
  26. package/dist/cli.js +2174 -0
  27. package/dist/context-D2euxPc4.d.ts +6 -0
  28. package/dist/core.d.ts +266 -0
  29. package/dist/core.js +1070 -0
  30. package/dist/core.js.map +1 -0
  31. package/dist/findable-rows-UQBKFZ45.js +356 -0
  32. package/dist/findable-rows-UQBKFZ45.js.map +1 -0
  33. package/dist/index.d.ts +57 -0
  34. package/dist/index.js +47 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/install.d.ts +2 -0
  37. package/dist/install.js +21 -0
  38. package/dist/install.js.map +1 -0
  39. package/dist/next.d.ts +18 -0
  40. package/dist/next.js +13 -0
  41. package/dist/next.js.map +1 -0
  42. package/dist/plugin-C8VytW9X.d.ts +162 -0
  43. package/dist/plugins.d.ts +118 -0
  44. package/dist/plugins.js +36 -0
  45. package/dist/plugins.js.map +1 -0
  46. package/dist/sheet-presentation-S6GGOKMB.js +2667 -0
  47. package/dist/sheet-presentation-S6GGOKMB.js.map +1 -0
  48. package/dist/styles.css +2 -0
  49. package/dist/toolbar-entry-QHIQKNOO.js +1687 -0
  50. package/dist/toolbar-entry-QHIQKNOO.js.map +1 -0
  51. package/dist/ui.d.ts +37 -0
  52. package/dist/ui.js +126 -0
  53. package/dist/ui.js.map +1 -0
  54. package/licenses/motion-MIT.txt +21 -0
  55. package/licenses/ui-sdk-APACHE-2.0.txt +202 -0
  56. package/package.json +120 -3
@@ -0,0 +1,1030 @@
1
+ "use client";
2
+ import {
3
+ enforceHidden,
4
+ isComposing,
5
+ on
6
+ } from "./chunk-7JLNVGRQ.js";
7
+
8
+ // ../../node_modules/.pnpm/@ui-sdk+core@0.1.0-beta.5/node_modules/@ui-sdk/core/dist/foundation/kernel/dev-stub.js
9
+ var dev = false;
10
+ function emit(_event) {
11
+ }
12
+ function warn(_message, _from, _detail) {
13
+ }
14
+ function note(_message, _from, _detail) {
15
+ }
16
+ function warnMissing(slots, _from) {
17
+ return slots;
18
+ }
19
+ function exposeShortcuts(_list) {
20
+ }
21
+ function checkRoles(_slots, _from) {
22
+ }
23
+ function checkRole(_definition, _slot, _own, _role, _from, _live) {
24
+ }
25
+ function checkFocus(_focus, _slot, _el, _from) {
26
+ }
27
+ function expectControlled(_instance, _info, _current) {
28
+ }
29
+ function forgetControlled(_instance) {
30
+ }
31
+ function heardControlled(_instance, _options) {
32
+ }
33
+ function measured(read) {
34
+ read();
35
+ }
36
+ var isMeasuring = () => false;
37
+ function checkEvent(_reason, _event, _from) {
38
+ }
39
+ function checkPrevented(_name, _prevented, _details, _from) {
40
+ }
41
+ function checkControlled(_from, _keys, _options) {
42
+ }
43
+
44
+ // ../../node_modules/.pnpm/@ui-sdk+core@0.1.0-beta.5/node_modules/@ui-sdk/core/dist/foundation/kernel/store.js
45
+ var changedInPlace = /* @__PURE__ */ new WeakSet();
46
+ function sameValue(a, b) {
47
+ if (Object.is(a, b)) {
48
+ return true;
49
+ }
50
+ if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) {
51
+ return false;
52
+ }
53
+ if (changedInPlace.has(a) || changedInPlace.has(b)) {
54
+ return false;
55
+ }
56
+ return a.every((item, index) => Object.is(item, b[index]));
57
+ }
58
+ var isPlainObject = (value) => {
59
+ if (typeof value !== "object" || value === null) {
60
+ return false;
61
+ }
62
+ const prototype = Object.getPrototypeOf(value);
63
+ return prototype === Object.prototype || prototype === null;
64
+ };
65
+ function sameSlotState(a, b) {
66
+ return sameWithin(a, b, void 0);
67
+ }
68
+ function sameWithin(a, b, open) {
69
+ if (Object.is(a, b)) {
70
+ return true;
71
+ }
72
+ const arrays = Array.isArray(a) && Array.isArray(b);
73
+ if (!arrays && !(isPlainObject(a) && isPlainObject(b))) {
74
+ return false;
75
+ }
76
+ if (open) {
77
+ for (let index = 0; index < open.length; index += 2) {
78
+ if (open[index] === a && open[index + 1] === b) {
79
+ return true;
80
+ }
81
+ }
82
+ }
83
+ const within = open ?? [];
84
+ within.push(a, b);
85
+ try {
86
+ if (arrays) {
87
+ const left2 = a;
88
+ const right2 = b;
89
+ if (left2.length !== right2.length || changedInPlace.has(left2) || changedInPlace.has(right2)) {
90
+ return false;
91
+ }
92
+ for (let index = 0; index < left2.length; index++) {
93
+ if (!sameWithin(left2[index], right2[index], within)) {
94
+ return false;
95
+ }
96
+ }
97
+ return true;
98
+ }
99
+ const left = a;
100
+ const right = b;
101
+ const keys = Object.keys(left);
102
+ if (keys.length !== Object.keys(right).length) {
103
+ return false;
104
+ }
105
+ for (const key of keys) {
106
+ if (!(key in right) || !sameWithin(left[key], right[key], within)) {
107
+ return false;
108
+ }
109
+ }
110
+ return true;
111
+ } finally {
112
+ within.length -= 2;
113
+ }
114
+ }
115
+ function createStore(initial, live) {
116
+ let state = initial;
117
+ let renders2 = 0;
118
+ let writes2 = 0;
119
+ let followed;
120
+ let merged;
121
+ let reading = false;
122
+ let viewed;
123
+ const listeners = /* @__PURE__ */ new Set();
124
+ const skipping = /* @__PURE__ */ new Map();
125
+ let fanout;
126
+ const store = {
127
+ get() {
128
+ return viewed ?? withFollowed();
129
+ },
130
+ // `delivered` marks keys `follow` already delivers, which parts that read
131
+ // them through the framework skip.
132
+ set(patch, delivered = false) {
133
+ if (followed && !delivered && !reading) {
134
+ const over = withFollowed();
135
+ if (over !== state) {
136
+ const rest = { ...over };
137
+ for (const key in patch) {
138
+ delete rest[key];
139
+ }
140
+ store.set(rest, true);
141
+ }
142
+ }
143
+ const changed = [];
144
+ for (const key in patch) {
145
+ if (!sameValue(state[key], patch[key])) {
146
+ changed.push(key);
147
+ }
148
+ }
149
+ if (!changed.length) {
150
+ return;
151
+ }
152
+ const previous = state;
153
+ state = { ...state, ...patch };
154
+ const liveOnly = changed.every((key) => live.includes(key));
155
+ notify(changed, previous, liveOnly, delivered);
156
+ },
157
+ subscribe(listener) {
158
+ listeners.add(listener);
159
+ return () => {
160
+ listeners.delete(listener);
161
+ };
162
+ },
163
+ // The listeners of parts that select values, which `kernel/selects.ts` installs once.
164
+ setFanout(next) {
165
+ fanout = next;
166
+ },
167
+ // Keys `get()` reads from `read` from now on, ahead of `set`, like a
168
+ // framework's props it hands over from an effect. `read` gets the state
169
+ // the store holds.
170
+ follow(read) {
171
+ followed = read;
172
+ },
173
+ // Runs `read` with `get()` returning `next`, for state derived from state
174
+ // the store doesn't hold yet, like what the framework is rendering.
175
+ view(next, read) {
176
+ const before = viewed;
177
+ viewed = next;
178
+ try {
179
+ return read();
180
+ } finally {
181
+ viewed = before;
182
+ }
183
+ }
184
+ };
185
+ function withFollowed() {
186
+ if (!followed || reading) {
187
+ return state;
188
+ }
189
+ reading = true;
190
+ let over;
191
+ try {
192
+ over = followed(state);
193
+ } finally {
194
+ reading = false;
195
+ }
196
+ if (!over) {
197
+ return state;
198
+ }
199
+ if (merged?.state === state && merged.over === over) {
200
+ return merged.result;
201
+ }
202
+ let result = state;
203
+ for (const key in over) {
204
+ if (!sameValue(state[key], over[key])) {
205
+ result = { ...state, ...over };
206
+ break;
207
+ }
208
+ }
209
+ merged = { state, over, result };
210
+ return result;
211
+ }
212
+ function notify(changed, previous, liveOnly, delivered) {
213
+ if (!liveOnly) {
214
+ renders2++;
215
+ }
216
+ if (!delivered) {
217
+ writes2++;
218
+ }
219
+ const run = (listener) => listener(liveOnly, delivered, changed);
220
+ listeners.forEach(run);
221
+ for (const [skip, group] of skipping) {
222
+ if (!changed.length || changed.some((key) => !Object.hasOwn(skip, key))) {
223
+ group.forEach(run);
224
+ }
225
+ }
226
+ fanout?.(changed, previous, run);
227
+ }
228
+ held.set(store, {
229
+ state: () => state,
230
+ renders: () => renders2,
231
+ writes: () => writes2,
232
+ touch: () => notify([], state, false, false),
233
+ skipping
234
+ });
235
+ return store;
236
+ }
237
+ var held = /* @__PURE__ */ new WeakMap();
238
+ function subscribeSkipping(store, skip, listener) {
239
+ return join(held.get(store).skipping, skip, listener);
240
+ }
241
+ function join(groups, group, listener) {
242
+ let members = groups.get(group);
243
+ if (!members) {
244
+ groups.set(group, members = /* @__PURE__ */ new Set());
245
+ }
246
+ members.add(listener);
247
+ return () => {
248
+ members.delete(listener);
249
+ if (!members.size && groups.get(group) === members) {
250
+ groups.delete(group);
251
+ }
252
+ };
253
+ }
254
+ var heldState = (store) => held.get(store).state();
255
+ var renders = (store) => held.get(store).renders();
256
+ var standFor = (owner, store) => {
257
+ held.set(owner, held.get(store));
258
+ };
259
+ var touch = (store) => held.get(store).touch();
260
+
261
+ // ../../node_modules/.pnpm/@ui-sdk+core@0.1.0-beta.5/node_modules/@ui-sdk/core/dist/foundation/kernel/selects.js
262
+ var isReader = (values) => typeof values === "object" && values !== null && !Array.isArray(values);
263
+ var narrowedStores = /* @__PURE__ */ new WeakMap();
264
+ function narrowedOf(store) {
265
+ const found = narrowedStores.get(store);
266
+ if (found) {
267
+ return found;
268
+ }
269
+ const narrowed = {
270
+ selectors: /* @__PURE__ */ new Map(),
271
+ selecting: /* @__PURE__ */ new Map()
272
+ };
273
+ narrowedStores.set(store, narrowed);
274
+ store.setFanout((changed, previous, run) => {
275
+ const state = store.get();
276
+ for (const key of changed) {
277
+ const movers = narrowed.selecting.get(key);
278
+ if (!movers) {
279
+ continue;
280
+ }
281
+ const notify = (value) => narrowed.selectors.get(`${String(key)}:${value}`)?.forEach(run);
282
+ const before = previous[key];
283
+ for (const [moved, naming] of movers) {
284
+ if (moved(before, state[key], notify) === true) {
285
+ naming.forEach(run);
286
+ }
287
+ }
288
+ }
289
+ });
290
+ return narrowed;
291
+ }
292
+ function selects(reads) {
293
+ const narrowing = Object.entries(reads).filter(
294
+ ([, values]) => isReader(values) || typeof values === "function" || values.length > 0
295
+ );
296
+ const valuesOf = (values, partView) => isReader(values) ? values.values(partView) : typeof values === "function" ? values(partView) : values;
297
+ const selected = (part, props) => {
298
+ const partView = view(part, props);
299
+ return narrowing.map(
300
+ ([key, values]) => [key, valuesOf(values, partView)]
301
+ );
302
+ };
303
+ return {
304
+ /**
305
+ * The values a part reads each key it lists by, an empty list for a key it
306
+ * never reads. A key it doesn't list, it reads whole.
307
+ */
308
+ reading(part, props) {
309
+ const partView = view(part, props);
310
+ return new Map(
311
+ Object.entries(reads).flatMap(
312
+ ([key, values]) => isReader(values) ? [] : [[key, valuesOf(values, partView)]]
313
+ )
314
+ );
315
+ },
316
+ /** The values a part selects on, which it subscribes again for when they change. */
317
+ selection(part, props) {
318
+ const values = selected(part, props);
319
+ return values.length ? JSON.stringify(values) : "";
320
+ },
321
+ /**
322
+ * Runs `listener` when a change can affect the part: a key it selects on
323
+ * took or left one of its values, or any other key changed. Every part of
324
+ * the slot skips the listed keys as one group.
325
+ */
326
+ subscribe(part, listener, props) {
327
+ const cleanups = [subscribeSkipping(part.store, reads, listener)];
328
+ for (const [key, values] of selected(part, props)) {
329
+ const reader = reads[key];
330
+ const moved = isReader(reader) ? reader.moved : eachMoved;
331
+ cleanups.push(
332
+ ...values.map(
333
+ (value) => select(part.store, key, value, listener, moved)
334
+ )
335
+ );
336
+ if (moved !== eachMoved) {
337
+ cleanups.push(joinMover(part.store, key, moved, listener));
338
+ }
339
+ }
340
+ return () => cleanups.forEach((cleanup) => cleanup());
341
+ }
342
+ };
343
+ }
344
+ function select(store, key, value, listener, moved = eachMoved) {
345
+ const leaveMover = joinMover(store, key, moved, () => {
346
+ });
347
+ const leave = join(
348
+ narrowedOf(store).selectors,
349
+ `${String(key)}:${value}`,
350
+ listener
351
+ );
352
+ return () => {
353
+ leave();
354
+ leaveMover();
355
+ };
356
+ }
357
+ function joinMover(store, key, moved, listener) {
358
+ const { selecting } = narrowedOf(store);
359
+ let movers = selecting.get(key);
360
+ if (!movers) {
361
+ selecting.set(key, movers = /* @__PURE__ */ new Map());
362
+ }
363
+ const leave = join(movers, moved, listener);
364
+ return () => {
365
+ leave();
366
+ if (!movers.size && selecting.get(key) === movers) {
367
+ selecting.delete(key);
368
+ }
369
+ };
370
+ }
371
+ function eachMoved(before, after, notify) {
372
+ if (before == null) {
373
+ before = emptyLike(after, before);
374
+ } else if (after == null) {
375
+ after = emptyLike(before, after);
376
+ }
377
+ if (isRecord(before) && isRecord(after)) {
378
+ for (const name in before) {
379
+ if (!Object.hasOwn(after, name) || !Object.is(before[name], after[name])) {
380
+ notify(name);
381
+ }
382
+ }
383
+ for (const name in after) {
384
+ if (!Object.hasOwn(before, name)) {
385
+ notify(name);
386
+ }
387
+ }
388
+ return;
389
+ }
390
+ if (!Array.isArray(before) || !Array.isArray(after)) {
391
+ return [before, after].forEach(notify);
392
+ }
393
+ let start = 0;
394
+ let end = 0;
395
+ while (start < before.length && before[start] === after[start]) {
396
+ start++;
397
+ }
398
+ while (end < before.length - start && end < after.length - start && before[before.length - 1 - end] === after[after.length - 1 - end]) {
399
+ end++;
400
+ }
401
+ for (const values of [before, after]) {
402
+ for (let index = start; index < values.length - end; index++) {
403
+ notify(values[index]);
404
+ }
405
+ }
406
+ }
407
+ var isRecord = (value) => !!value && Object.getPrototypeOf(value) === Object.prototype;
408
+ var noItems = [];
409
+ var noEntries = {};
410
+ var emptyLike = (other, missing) => Array.isArray(other) ? noItems : isRecord(other) ? noEntries : missing;
411
+
412
+ // ../../node_modules/.pnpm/@ui-sdk+core@0.1.0-beta.5/node_modules/@ui-sdk/core/dist/foundation/kernel/part.js
413
+ var ownerOf = (part) => part.owner;
414
+ var definitionOf = (part) => ownerOf(part).slots[part.slot];
415
+ var view = (part, props) => ({
416
+ id: part.id,
417
+ key: part.key,
418
+ props,
419
+ api: part.api
420
+ });
421
+ var context = (part, props = part.props) => ({
422
+ el: part.el,
423
+ id: part.id,
424
+ key: part.key,
425
+ props,
426
+ store: part.store,
427
+ api: part.api
428
+ });
429
+ function lease(part) {
430
+ const { parts } = part.owner;
431
+ const mapKey = `${part.slot}:${part.key}`;
432
+ if (!parts.has(mapKey)) {
433
+ parts.set(mapKey, part);
434
+ }
435
+ part.leases++;
436
+ let held2 = true;
437
+ return () => {
438
+ if (!held2) {
439
+ return;
440
+ }
441
+ held2 = false;
442
+ if (--part.leases) {
443
+ return;
444
+ }
445
+ const { owner } = part;
446
+ if (!owner.released.length) {
447
+ queueMicrotask(() => sweep(owner));
448
+ }
449
+ owner.released.push(part);
450
+ };
451
+ }
452
+ function provisional(part) {
453
+ const { owner } = part;
454
+ if (!owner.released.length) {
455
+ queueMicrotask(() => sweep(owner));
456
+ }
457
+ owner.released.push(part);
458
+ }
459
+ function sweep(owner) {
460
+ for (const part of owner.released) {
461
+ const mapKey = `${part.slot}:${part.key}`;
462
+ if (!part.leases && owner.parts.get(mapKey) === part) {
463
+ owner.parts.delete(mapKey);
464
+ }
465
+ }
466
+ owner.released = [];
467
+ }
468
+ function attrs(part, props = part.props, state = part.store.get()) {
469
+ const definition = definitionOf(part);
470
+ const context2 = view(part, props);
471
+ const own = definition.attrs?.(state, context2);
472
+ const declared = definition.role;
473
+ const role = typeof declared === "function" ? declared(state, context2) : declared;
474
+ if (dev) {
475
+ checkRole(
476
+ definition,
477
+ part.slot,
478
+ own,
479
+ role,
480
+ { component: ownerOf(part).label, id: part.id },
481
+ definition.live?.read(state, context2)
482
+ );
483
+ }
484
+ const { name } = ownerOf(part);
485
+ const result = {
486
+ "data-slot": part.slot === "root" ? name : `${name}-${part.slot}`,
487
+ ...declared === void 0 ? void 0 : { role },
488
+ ...own
489
+ };
490
+ if (declared !== void 0) {
491
+ result.role = role;
492
+ }
493
+ return aliased(part, result);
494
+ }
495
+ var authorOwned = /* @__PURE__ */ new Set([
496
+ "aria-label",
497
+ "aria-labelledby",
498
+ "aria-description",
499
+ "title",
500
+ "autocomplete",
501
+ "autocapitalize",
502
+ "autocorrect",
503
+ "spellcheck",
504
+ "inputmode",
505
+ "enterkeyhint"
506
+ ]);
507
+ function yieldToAuthor(attrs2, given) {
508
+ let result;
509
+ for (const name in attrs2) {
510
+ if (attrs2[name] !== void 0 && authorOwned.has(name) && given(name)) {
511
+ ;
512
+ (result ??= { ...attrs2 })[name] = void 0;
513
+ }
514
+ }
515
+ return result ?? attrs2;
516
+ }
517
+ var madeLabel = (value) => typeof value === "string" && value.split(/\s+/).every((id) => id.startsWith("ui-sdk-"));
518
+ function partState(part, props = part.props, state = part.store.get()) {
519
+ return definitionOf(part).state?.(state, view(part, props)) ?? {};
520
+ }
521
+ function present(part, props = part.props, state = part.store.get()) {
522
+ return definitionOf(part).present?.(state, view(part, props)) ?? true;
523
+ }
524
+ function liveAttrs(part, props = part.props) {
525
+ return aliased(
526
+ part,
527
+ definitionOf(part).live?.read(part.store.get(), view(part, props)) ?? {}
528
+ );
529
+ }
530
+ var directNames = (part) => definitionOf(part).direct?.names;
531
+ var selectedKeys = (part, props = part.props) => definitionOf(part).selects?.selection(part, props) ?? "";
532
+ var skipNone = {};
533
+ function subscribe(part, listener, props = part.props) {
534
+ const narrowed = definitionOf(part).selects;
535
+ const cleanups = [
536
+ lease(part),
537
+ narrowed ? narrowed.subscribe(part, listener, props) : subscribeSkipping(part.store, skipNone, listener)
538
+ ];
539
+ return () => cleanups.forEach((cleanup) => cleanup());
540
+ }
541
+ function handlers(part) {
542
+ const { on: events, press: activate } = definitionOf(part);
543
+ const result = {};
544
+ for (const type in events) {
545
+ const handler = events[type];
546
+ result[type] = (event) => {
547
+ if (event.defaultPrevented || composing(event)) {
548
+ return;
549
+ }
550
+ ownerOf(part).sleeping?.wake();
551
+ handler(event, context(part));
552
+ };
553
+ }
554
+ if (typeof activate === "function" && !result.click) {
555
+ result.click = (event) => {
556
+ if (!event.defaultPrevented) {
557
+ ownerOf(part).sleeping?.wake();
558
+ activate(context(part), event);
559
+ }
560
+ };
561
+ }
562
+ return result;
563
+ }
564
+ function commit(part, props) {
565
+ if (part.props === props) {
566
+ return;
567
+ }
568
+ part.props = props;
569
+ propsRendered(part);
570
+ }
571
+ function propsRendered(part) {
572
+ part.propsListeners?.forEach((listener) => listener());
573
+ }
574
+ function onProps(part, listener) {
575
+ const listeners = part.propsListeners ??= /* @__PURE__ */ new Set();
576
+ listeners.add(listener);
577
+ return () => {
578
+ listeners.delete(listener);
579
+ };
580
+ }
581
+ var hidingSlots = /* @__PURE__ */ new WeakMap();
582
+ function canHide(part) {
583
+ const definition = definitionOf(part);
584
+ let hides = hidingSlots.get(definition);
585
+ if (hides === void 0) {
586
+ hides = !!definition.attrs && "hidden" in definition.attrs(part.store.get(), view(part, part.props));
587
+ hidingSlots.set(definition, hides);
588
+ }
589
+ return hides;
590
+ }
591
+ function bind(part, el, host = { by: "core" }) {
592
+ const kept = part;
593
+ const { parts } = kept.owner;
594
+ const mapKey = `${part.slot}:${part.key}`;
595
+ if (!part.el && (parts.get(mapKey) ?? kept) === kept) {
596
+ parts.delete(mapKey);
597
+ parts.set(mapKey, kept);
598
+ }
599
+ if (dev) {
600
+ checkShared(part, part.el, el);
601
+ const { focus } = definitionOf(part);
602
+ checkFocus(
603
+ typeof focus === "function" ? focus(part.store.get(), view(part, part.props)) : focus,
604
+ part.slot,
605
+ el,
606
+ {
607
+ component: ownerOf(part).label,
608
+ id: part.id
609
+ }
610
+ );
611
+ }
612
+ const binding = {};
613
+ part.el = el;
614
+ kept.binding = binding;
615
+ const cleanups = [lease(kept)];
616
+ if (canHide(part)) {
617
+ enforceHidden(el.ownerDocument);
618
+ }
619
+ for (const [type, handler] of Object.entries(handlers(part))) {
620
+ if (host.by === "core" || host.attaches !== "all" && !host.attaches.includes(type)) {
621
+ cleanups.push(on(el, type, handler));
622
+ }
623
+ }
624
+ const definition = definitionOf(part);
625
+ if (definition.live) {
626
+ cleanups.push(definition.live.attach(part, el));
627
+ }
628
+ if (host.by === "framework" && definition.direct) {
629
+ cleanups.push(definition.direct.attach(part, el));
630
+ }
631
+ const early = definition.asleep?.(el, part);
632
+ if (early) {
633
+ cleanups.push(early);
634
+ }
635
+ const late = () => {
636
+ const cleanup = definition.bind?.(el, part);
637
+ if (cleanup) {
638
+ cleanups.push(cleanup);
639
+ }
640
+ };
641
+ const { sleeping } = kept.owner;
642
+ if (sleeping && definition.bind) {
643
+ sleeping.binds.add(late);
644
+ cleanups.push(() => sleeping.binds.delete(late));
645
+ } else {
646
+ late();
647
+ }
648
+ if (definition.attrs && typeof MutationObserver !== "undefined") {
649
+ cleanups.push(followId(kept, el));
650
+ }
651
+ return () => {
652
+ cleanups.forEach((cleanup) => cleanup());
653
+ if (kept.binding !== binding) {
654
+ return;
655
+ }
656
+ part.el = kept.binding = void 0;
657
+ if (kept.own !== void 0) {
658
+ readIdLater(kept);
659
+ }
660
+ };
661
+ }
662
+ function checkShared(part, bound, el) {
663
+ if (!part.key || !bound || bound === el) {
664
+ return;
665
+ }
666
+ queueMicrotask(() => {
667
+ if (part.el !== el || !bound.isConnected || !el.isConnected) {
668
+ return;
669
+ }
670
+ const { parts, label } = ownerOf(part);
671
+ for (const other of parts.values()) {
672
+ if (other.el === bound) {
673
+ return;
674
+ }
675
+ }
676
+ warn(
677
+ `two "${part.slot}" parts share the key "${part.key}". Give each an id or a unique value.`,
678
+ {
679
+ component: label,
680
+ id: part.id
681
+ }
682
+ );
683
+ });
684
+ }
685
+ function ref(part, host) {
686
+ const kept = part;
687
+ if (kept.ref) {
688
+ return kept.ref;
689
+ }
690
+ let current = null;
691
+ let unbind = () => {
692
+ };
693
+ return kept.ref = (el) => {
694
+ if (el === current) {
695
+ return;
696
+ }
697
+ if (dev && el) {
698
+ checkShared(part, current, el);
699
+ }
700
+ unbind();
701
+ current = el;
702
+ unbind = el ? bind(part, el, host) : () => {
703
+ };
704
+ };
705
+ }
706
+ var references = [
707
+ "aria-activedescendant",
708
+ "aria-controls",
709
+ "aria-describedby",
710
+ "aria-details",
711
+ "aria-errormessage",
712
+ "aria-flowto",
713
+ "aria-labelledby",
714
+ "aria-owns",
715
+ "for",
716
+ "headers"
717
+ ];
718
+ var madeId = (part) => definitionOf(part).attrs?.(
719
+ part.store.get(),
720
+ view(part, { ...part.props, id: void 0 })
721
+ ).id;
722
+ function aliased(part, attrs2) {
723
+ const { owner } = part;
724
+ if (!owner.named?.size || !references.some((name) => attrs2[name])) {
725
+ return attrs2;
726
+ }
727
+ const aliases = aliasesOf(owner, part.store);
728
+ if (!aliases.size) {
729
+ return attrs2;
730
+ }
731
+ const result = { ...attrs2 };
732
+ for (const name of references) {
733
+ const ids = result[name];
734
+ if (ids) {
735
+ result[name] = ids.split(" ").map((id) => aliases.get(id) ?? id).join(" ");
736
+ }
737
+ }
738
+ return result;
739
+ }
740
+ function aliasesOf(owner, store) {
741
+ const version = renders(store);
742
+ if (owner.aliases?.version === version) {
743
+ return owner.aliases.map;
744
+ }
745
+ const map = /* @__PURE__ */ new Map();
746
+ for (const part of owner.named) {
747
+ const made = madeId(part);
748
+ if (made !== void 0 && made !== part.own) {
749
+ map.set(made, part.own);
750
+ }
751
+ }
752
+ owner.aliases = { version, map };
753
+ return map;
754
+ }
755
+ function followId(part, el) {
756
+ if (el.hasAttribute("id") || part.own !== void 0) {
757
+ readIdLater(part);
758
+ }
759
+ const observer = new MutationObserver(() => readIdLater(part));
760
+ observer.observe(el, { attributeFilter: ["id"] });
761
+ return () => observer.disconnect();
762
+ }
763
+ function readIdLater(part) {
764
+ const { owner } = part;
765
+ if (!owner.unread) {
766
+ owner.unread = /* @__PURE__ */ new Set();
767
+ queueMicrotask(() => readIds(owner, part.store));
768
+ }
769
+ owner.unread.add(part);
770
+ }
771
+ function readIds(owner, store) {
772
+ const parts = owner.unread;
773
+ owner.unread = void 0;
774
+ let renamed = owner.renamed === true;
775
+ owner.renamed = void 0;
776
+ for (const part of parts) {
777
+ renamed = rename(part, part.el && idOf(part.el)) || renamed;
778
+ }
779
+ if (renamed) {
780
+ touch(store);
781
+ }
782
+ }
783
+ var idOf = (el) => el.localName === "form" ? el.getAttribute("id") : el.id;
784
+ function takeOwnId(part, id) {
785
+ if (part.el || typeof id !== "string" || !definitionOf(part).attrs) {
786
+ return;
787
+ }
788
+ if (rename(part, id)) {
789
+ ownerOf(part).renamed = true;
790
+ }
791
+ }
792
+ function rename(part, id) {
793
+ const made = madeId(part);
794
+ const own = id && id !== made ? id : void 0;
795
+ if (own === part.own) {
796
+ return false;
797
+ }
798
+ const { owner } = part;
799
+ part.own = own;
800
+ owner.named ??= /* @__PURE__ */ new Set();
801
+ if (own === void 0) {
802
+ owner.named.delete(part);
803
+ } else {
804
+ owner.named.add(part);
805
+ }
806
+ owner.aliases = void 0;
807
+ return made !== void 0;
808
+ }
809
+ function composing(event) {
810
+ return (event.type === "keydown" || event.type === "keyup") && isComposing(event);
811
+ }
812
+
813
+ // ../../node_modules/.pnpm/@ui-sdk+core@0.1.0-beta.5/node_modules/@ui-sdk/core/dist/foundation/motion/presence.js
814
+ var pendingResets = /* @__PURE__ */ new WeakMap();
815
+ function animateIn(el, done) {
816
+ pendingResets.get(el)?.();
817
+ const settled = el.getAnimations?.().every((animation) => !isTransition(animation));
818
+ el.setAttribute("data-starting-style", "");
819
+ if (settled) {
820
+ for (const animation of el.getAnimations()) {
821
+ if (isTransition(animation)) {
822
+ animation.finish();
823
+ }
824
+ }
825
+ }
826
+ let stopWaiting;
827
+ let timer;
828
+ const frame = requestAnimationFrame(
829
+ () => timer = setTimeout(() => {
830
+ el.removeAttribute("data-starting-style");
831
+ if (done) {
832
+ stopWaiting = whenFinished(el, done);
833
+ }
834
+ })
835
+ );
836
+ return () => {
837
+ cancelAnimationFrame(frame);
838
+ clearTimeout(timer);
839
+ stopWaiting?.();
840
+ el.removeAttribute("data-starting-style");
841
+ };
842
+ }
843
+ var isTransition = (animation) => "transitionProperty" in animation;
844
+ function seconds(value) {
845
+ return value.split(",").map((part) => {
846
+ const number = parseFloat(part);
847
+ return part.trim().endsWith("ms") ? number / 1e3 : number;
848
+ });
849
+ }
850
+ function longest(el) {
851
+ return Math.max(
852
+ durationOf(getComputedStyle(el)),
853
+ durationOf(getComputedStyle(el, "::backdrop"))
854
+ );
855
+ }
856
+ function durationOf(style) {
857
+ const pairs = (durations, delays, iterations = "1") => {
858
+ const d = seconds(durations);
859
+ const l = seconds(delays);
860
+ const n = iterations.split(",").map((part) => part.trim() === "infinite" ? 1 : parseFloat(part) || 1);
861
+ return d.map(
862
+ (duration, index) => (duration * (n[index % n.length] ?? 1) + (l[index % l.length] ?? 0)) * 1e3
863
+ );
864
+ };
865
+ return Math.max(
866
+ 0,
867
+ ...pairs(style.transitionDuration, style.transitionDelay),
868
+ ...pairs(
869
+ style.animationDuration,
870
+ style.animationDelay,
871
+ style.animationIterationCount
872
+ )
873
+ );
874
+ }
875
+ function remaining(animations) {
876
+ let longestLeft = 0;
877
+ for (const animation of animations) {
878
+ const timing = animation.effect?.getComputedTiming();
879
+ const end = Number(timing?.endTime);
880
+ if (!timing || !Number.isFinite(end)) {
881
+ continue;
882
+ }
883
+ longestLeft = Math.max(longestLeft, end - (Number(timing.localTime) || 0));
884
+ }
885
+ return longestLeft;
886
+ }
887
+ function whenFinished(el, done) {
888
+ let finished = false;
889
+ const animations = el.getAnimations({ subtree: true });
890
+ const finish = () => {
891
+ if (finished) {
892
+ return;
893
+ }
894
+ finished = true;
895
+ clearTimeout(timer);
896
+ done();
897
+ };
898
+ const timer = animations.length ? setTimeout(finish, Math.max(longest(el), remaining(animations)) + 50) : void 0;
899
+ if (!animations.length) {
900
+ measured(finish);
901
+ } else {
902
+ Promise.allSettled(animations.map((animation) => animation.finished)).then(
903
+ finish
904
+ );
905
+ }
906
+ return () => {
907
+ finished = true;
908
+ clearTimeout(timer);
909
+ };
910
+ }
911
+ function writeOpen(el, open) {
912
+ el.toggleAttribute("data-open", open);
913
+ el.toggleAttribute("data-closed", !open);
914
+ }
915
+ function animateOut(el, done) {
916
+ pendingResets.get(el)?.();
917
+ el.removeAttribute("data-starting-style");
918
+ el.setAttribute("data-ending-style", "");
919
+ el.inert = true;
920
+ let frame = 0;
921
+ const reset = () => {
922
+ cancelAnimationFrame(frame);
923
+ pendingResets.delete(el);
924
+ el.removeAttribute("data-ending-style");
925
+ el.inert = false;
926
+ };
927
+ let isAnimating = false;
928
+ const stop = whenFinished(el, () => {
929
+ if (!isAnimating) {
930
+ reset();
931
+ return done();
932
+ }
933
+ pendingResets.set(el, reset);
934
+ frame = requestAnimationFrame(() => {
935
+ frame = requestAnimationFrame(reset);
936
+ });
937
+ done();
938
+ });
939
+ isAnimating = true;
940
+ return () => {
941
+ stop();
942
+ reset();
943
+ };
944
+ }
945
+
946
+ // ../../node_modules/.pnpm/@ui-sdk+core@0.1.0-beta.5/node_modules/@ui-sdk/core/dist/foundation/motion/panel.js
947
+ function hiddenAttrs(shown, findable) {
948
+ return { hidden: shown ? void 0 : findable ? "until-found" : "" };
949
+ }
950
+ function supportsHiddenUntilFound() {
951
+ return typeof document !== "undefined" && "onbeforematch" in document.body;
952
+ }
953
+ function bindFindable(el, panel) {
954
+ const keep = () => {
955
+ if (panel.shown()) {
956
+ return;
957
+ }
958
+ const hidden = el.getAttribute("hidden");
959
+ if (panel.findable()) {
960
+ if (hidden !== "until-found") {
961
+ el.setAttribute("hidden", "until-found");
962
+ }
963
+ } else if (hidden === "until-found") {
964
+ el.setAttribute("hidden", "");
965
+ }
966
+ };
967
+ keep();
968
+ const observer = typeof MutationObserver === "undefined" ? void 0 : new MutationObserver(keep);
969
+ observer?.observe(el, { attributes: true, attributeFilter: ["hidden"] });
970
+ el.addEventListener("beforematch", panel.reveal);
971
+ return Object.assign(
972
+ () => {
973
+ observer?.disconnect();
974
+ el.removeEventListener("beforematch", panel.reveal);
975
+ },
976
+ // Call when the panel's state changes.
977
+ { check: keep }
978
+ );
979
+ }
980
+
981
+ export {
982
+ dev,
983
+ emit,
984
+ warn,
985
+ note,
986
+ warnMissing,
987
+ exposeShortcuts,
988
+ checkRoles,
989
+ expectControlled,
990
+ forgetControlled,
991
+ heardControlled,
992
+ isMeasuring,
993
+ checkEvent,
994
+ checkPrevented,
995
+ checkControlled,
996
+ sameValue,
997
+ sameSlotState,
998
+ createStore,
999
+ subscribeSkipping,
1000
+ heldState,
1001
+ renders,
1002
+ standFor,
1003
+ selects,
1004
+ select,
1005
+ provisional,
1006
+ attrs,
1007
+ authorOwned,
1008
+ yieldToAuthor,
1009
+ madeLabel,
1010
+ partState,
1011
+ present,
1012
+ liveAttrs,
1013
+ directNames,
1014
+ selectedKeys,
1015
+ subscribe,
1016
+ handlers,
1017
+ commit,
1018
+ propsRendered,
1019
+ onProps,
1020
+ ref,
1021
+ references,
1022
+ takeOwnId,
1023
+ animateIn,
1024
+ writeOpen,
1025
+ animateOut,
1026
+ hiddenAttrs,
1027
+ supportsHiddenUntilFound,
1028
+ bindFindable
1029
+ };
1030
+ //# sourceMappingURL=chunk-GNJF3UHO.js.map