atom.io 0.19.0 → 0.19.2

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 (110) hide show
  1. package/data/dist/index.cjs +99 -79
  2. package/data/dist/index.js +2 -2
  3. package/data/src/join.ts +91 -74
  4. package/dist/{chunk-YDOGCZ53.js → chunk-ATKDGVTV.js} +29 -29
  5. package/dist/{chunk-CVBEVTM5.js → chunk-CC7IF7QF.js} +5 -42
  6. package/dist/{chunk-WX2NCOZR.js → chunk-FTONNX2R.js} +8 -8
  7. package/dist/{chunk-7ZR244C2.js → chunk-MSCJWACE.js} +92 -72
  8. package/dist/index.cjs +15 -7
  9. package/dist/index.d.ts +24 -35
  10. package/dist/index.js +15 -7
  11. package/internal/dist/index.cjs +56 -44
  12. package/internal/dist/index.d.ts +21 -21
  13. package/internal/dist/index.js +49 -37
  14. package/internal/src/atom/create-regular-atom.ts +7 -5
  15. package/internal/src/atom/delete-atom.ts +2 -2
  16. package/internal/src/families/create-readonly-selector-family.ts +2 -2
  17. package/internal/src/families/create-regular-atom-family.ts +1 -1
  18. package/internal/src/families/create-writable-selector-family.ts +1 -1
  19. package/internal/src/future.ts +4 -2
  20. package/internal/src/lineage.ts +1 -0
  21. package/internal/src/mutable/create-mutable-atom-family.ts +1 -1
  22. package/internal/src/mutable/create-mutable-atom.ts +7 -5
  23. package/internal/src/mutable/tracker.ts +4 -4
  24. package/internal/src/mutable/transceiver.ts +2 -2
  25. package/internal/src/selector/delete-selector.ts +1 -1
  26. package/internal/src/set-state/become.ts +1 -1
  27. package/internal/src/set-state/copy-mutable-if-needed.ts +1 -1
  28. package/internal/src/store/deposit.ts +5 -5
  29. package/internal/src/store/store.ts +5 -5
  30. package/internal/src/store/withdraw.ts +4 -5
  31. package/internal/src/subject.ts +3 -1
  32. package/internal/src/subscribe/subscribe-to-state.ts +2 -2
  33. package/internal/src/subscribe/subscribe-to-transaction.ts +4 -4
  34. package/internal/src/timeline/add-atom-to-timeline.ts +16 -11
  35. package/internal/src/timeline/create-timeline.ts +3 -4
  36. package/internal/src/transaction/act-upon-store.ts +5 -5
  37. package/internal/src/transaction/apply-transaction.ts +4 -4
  38. package/internal/src/transaction/build-transaction.ts +10 -7
  39. package/internal/src/transaction/create-transaction.ts +10 -10
  40. package/internal/src/transaction/index.ts +3 -3
  41. package/internal/src/transaction/is-root-store.ts +2 -2
  42. package/introspection/dist/index.cjs +3 -2
  43. package/introspection/dist/index.d.ts +6 -6
  44. package/introspection/dist/index.js +3 -2
  45. package/introspection/src/attach-atom-index.ts +5 -4
  46. package/introspection/src/attach-introspection-states.ts +3 -3
  47. package/introspection/src/attach-transaction-index.ts +4 -4
  48. package/introspection/src/attach-transaction-logs.ts +8 -4
  49. package/introspection/src/index.ts +3 -3
  50. package/json/dist/index.cjs +6 -2
  51. package/json/dist/index.d.ts +1 -1
  52. package/json/dist/index.js +8 -4
  53. package/json/src/select-json-family.ts +3 -2
  54. package/json/src/select-json.ts +3 -1
  55. package/package.json +243 -242
  56. package/react/dist/index.cjs +9 -3
  57. package/react/dist/index.js +9 -3
  58. package/react/src/use-i.ts +3 -1
  59. package/react/src/use-tl.ts +6 -2
  60. package/react-devtools/dist/index.cjs +332 -978
  61. package/react-devtools/dist/index.css +0 -18
  62. package/react-devtools/dist/index.d.ts +7 -9
  63. package/react-devtools/dist/index.js +291 -881
  64. package/react-devtools/src/AtomIODevtools.tsx +5 -2
  65. package/react-devtools/src/Button.tsx +6 -2
  66. package/react-devtools/src/StateEditor.tsx +13 -16
  67. package/react-devtools/src/StateIndex.tsx +28 -21
  68. package/react-devtools/src/TimelineIndex.tsx +17 -6
  69. package/react-devtools/src/TransactionIndex.tsx +13 -6
  70. package/react-devtools/src/Updates.tsx +24 -9
  71. package/realtime/dist/index.cjs +1 -0
  72. package/realtime/dist/index.d.ts +2 -2
  73. package/realtime/dist/index.js +1 -0
  74. package/realtime/src/realtime-continuity.ts +4 -3
  75. package/realtime-client/dist/index.cjs +29 -29
  76. package/realtime-client/dist/index.d.ts +2 -2
  77. package/realtime-client/dist/index.js +1 -1
  78. package/realtime-client/src/server-action.ts +2 -2
  79. package/realtime-client/src/sync-continuity.ts +23 -23
  80. package/realtime-react/dist/index.cjs +30 -30
  81. package/realtime-react/dist/index.d.ts +2 -2
  82. package/realtime-react/dist/index.js +2 -2
  83. package/realtime-react/src/use-server-action.ts +3 -3
  84. package/realtime-react/src/use-single-effect.ts +1 -1
  85. package/realtime-server/dist/index.cjs +54 -44
  86. package/realtime-server/dist/index.d.ts +6 -6
  87. package/realtime-server/dist/index.js +34 -24
  88. package/realtime-server/src/ipc-sockets/child-socket.ts +7 -7
  89. package/realtime-server/src/ipc-sockets/custom-socket.ts +4 -8
  90. package/realtime-server/src/ipc-sockets/parent-socket.ts +13 -7
  91. package/realtime-server/src/realtime-action-receiver.ts +7 -5
  92. package/realtime-server/src/realtime-continuity-synchronizer.ts +3 -3
  93. package/realtime-server/src/realtime-server-stores/server-room-external-store.ts +2 -2
  94. package/realtime-server/src/realtime-state-receiver.ts +3 -1
  95. package/realtime-testing/dist/index.cjs +15 -13
  96. package/realtime-testing/dist/index.js +9 -7
  97. package/realtime-testing/src/setup-realtime-test.tsx +7 -5
  98. package/src/atom.ts +4 -8
  99. package/src/dispose.ts +1 -0
  100. package/src/index.ts +2 -9
  101. package/src/selector.ts +4 -8
  102. package/src/silo.ts +13 -3
  103. package/src/subscribe.ts +6 -6
  104. package/src/timeline.ts +4 -4
  105. package/src/transaction.ts +24 -24
  106. package/src/validators.ts +2 -2
  107. package/transceivers/set-rtx/dist/index.cjs +11 -12
  108. package/transceivers/set-rtx/dist/index.js +11 -12
  109. package/transceivers/set-rtx/src/set-rtx.ts +10 -10
  110. /package/dist/{chunk-VAE5OCKN.js → chunk-BF4MVQF6.js} +0 -0
@@ -1,15 +1,13 @@
1
- import { treeShake, isEmptyArray, pipe, ifDefined, isArray, isRecord, doesExtend, isModifier, isPlainObject, raiseError, sprawl, recordToEntries, fallback, hasExactProperties, isEmptyObject, doNothing, isOneOf, map, entriesToRecord, comprises, addTo, become, mapObject, delve } from '../../dist/chunk-CVBEVTM5.js';
1
+ import { pipe, ifDefined, isArray, isRecord, doesExtend, isPlainObject, raiseError, sprawl, recordToEntries, fallback, doNothing, become, mapObject, delve } from '../../dist/chunk-CC7IF7QF.js';
2
2
  import { lazyLocalStorageEffect } from '../../dist/chunk-BWWVY5O5.js';
3
- import { JSON_TYPE_NAMES, isString, isNumber, isBoolean, stringifyJson, JSON_DEFAULTS } from '../../dist/chunk-VAE5OCKN.js';
3
+ import { JSON_TYPE_NAMES, isString, isNumber, isBoolean, stringifyJson, JSON_DEFAULTS } from '../../dist/chunk-BF4MVQF6.js';
4
4
  import { __spreadProps, __spreadValues, __objRest, __restKey } from '../../dist/chunk-U2IICNHQ.js';
5
5
  import { selectorFamily, atom, atomFamily, findState, undo, redo, getState } from 'atom.io';
6
6
  import { attachIntrospectionStates } from 'atom.io/introspection';
7
7
  import { useI, useO } from 'atom.io/react';
8
8
  import { motion, spring, LayoutGroup } from 'framer-motion';
9
- import * as React from 'react';
10
9
  import { forwardRef, useRef, useState, useImperativeHandle, useLayoutEffect, Fragment as Fragment$1, Component, useId } from 'react';
11
10
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
12
- import { useFloating, useClick, useInteractions, FloatingPortal } from '@floating-ui/react';
13
11
 
14
12
  // ../anvl/src/refinement/refinery.ts
15
13
  var Refinery = class {
@@ -30,7 +28,7 @@ var Refinery = class {
30
28
  if (input instanceof refiner) {
31
29
  return { type: key, data: input };
32
30
  }
33
- } catch (e2) {
31
+ } catch (_) {
34
32
  }
35
33
  }
36
34
  }
@@ -74,8 +72,8 @@ var isJson = (input) => {
74
72
  if (input === void 0)
75
73
  return false;
76
74
  const prototype = (_a2 = Object.getPrototypeOf(input)) == null ? void 0 : _a2.constructor.name;
77
- const isJson2 = JSON_PROTOTYPES.includes(prototype);
78
- return isJson2;
75
+ const refine = JSON_PROTOTYPES.includes(prototype);
76
+ return refine;
79
77
  };
80
78
 
81
79
  // ../anvl/src/refinement/can-exist.ts
@@ -253,13 +251,16 @@ var Differ = class {
253
251
  };
254
252
  }
255
253
  };
256
- var OpenClose = ({ isOpen, setIsOpen, disabled }) => {
254
+ var OpenClose = ({ isOpen, setIsOpen, disabled, testid }) => {
257
255
  return /* @__PURE__ */ jsx(
258
256
  "button",
259
257
  {
260
258
  type: "button",
259
+ "data-testid": testid,
261
260
  className: `carat ${isOpen ? `open` : `closed`}`,
262
- onClick: () => setIsOpen((isOpen2) => !isOpen2),
261
+ onClick: () => {
262
+ setIsOpen((prev) => !prev);
263
+ },
263
264
  disabled,
264
265
  children: "\u25B6"
265
266
  }
@@ -268,303 +269,8 @@ var OpenClose = ({ isOpen, setIsOpen, disabled }) => {
268
269
  var button = {
269
270
  OpenClose
270
271
  };
271
-
272
- // ../anvl/src/join/core-relation-data.ts
273
- var RELATION_TYPES = [`1:1`, `1:n`, `n:n`];
274
- var isRelationType = (x) => RELATION_TYPES.includes(x);
275
- var EMPTY_RELATION_DATA = {
276
- contents: {},
277
- relations: {},
278
- relationType: `n:n`,
279
- a: `from`,
280
- b: `to`
281
- };
282
- var isRelationData = ({
283
- from: a2 = `from`,
284
- to: b2 = `to`,
285
- isContent
286
- } = {}) => (input) => {
287
- return hasExactProperties({
288
- contents: isContent ? isRecord(isString, isContent) : hasExactProperties({}),
289
- relations: isRecord(isString, isArray(isString)),
290
- relationType: isRelationType,
291
- a: isLiteral(a2),
292
- b: isLiteral(b2)
293
- })(input);
294
- };
295
-
296
- // ../anvl/src/join/get-related-ids.ts
297
- var getRelatedIds = (relationMap, id) => {
298
- var _a2;
299
- return (_a2 = relationMap.relations[id]) != null ? _a2 : [];
300
- };
301
- var getRelatedId = (relationMap, id) => {
302
- const relations = getRelatedIds(relationMap, id);
303
- if (relations.length > 1) {
304
- console.warn(
305
- `entry with id ${id} was not expected to have multiple relations`
306
- );
307
- }
308
- return relations[0];
309
- };
310
-
311
- // ../anvl/src/join/make-json-interface.ts
312
- var makeJsonInterface = (join, ...params) => {
313
- const isContent = params[0];
314
- const { a: a2, b: b2 } = join;
315
- const options = {
316
- from: a2,
317
- to: b2,
318
- isContent
319
- };
320
- return {
321
- toJson: (join2) => join2.toJSON(),
322
- fromJson: (json) => Join.fromJSON(json, options)
323
- };
324
- };
325
-
326
- // ../anvl/src/join/relation-record.ts
327
- var getRelationEntries = (relationMap, idA) => getRelatedIds(relationMap, idA).map((idB) => [
328
- idB,
329
- getContent(relationMap, idA, idB)
330
- ]);
331
- var getRelationRecord = (relationMap, id) => Object.fromEntries(getRelationEntries(relationMap, id));
332
-
333
- // ../anvl/src/string/split.ts
334
- var split = (separator) => (str) => str.split(separator);
335
-
336
- // ../anvl/src/join/remove-relation.ts
337
- var removeSpecific = (current, idA, idB) => {
338
- const isIdForRemoval = isOneOf(idA, idB);
339
- return __spreadProps(__spreadValues({}, current), {
340
- relations: pipe(
341
- current.relations,
342
- recordToEntries,
343
- map(([id, relations]) => [
344
- id,
345
- isIdForRemoval(id) ? relations.filter((relation) => !isIdForRemoval(relation)) : relations
346
- ]),
347
- entriesToRecord,
348
- treeShake(isEmptyArray)
349
- ),
350
- contents: pipe(
351
- current.contents,
352
- treeShake(
353
- (_, key) => isString(key) && pipe(key, split(`/`), comprises([idA, idB]))
354
- )
355
- )
356
- });
357
- };
358
- var removeAll = (current, idToRemove) => {
359
- const next = __spreadProps(__spreadValues({}, current), {
360
- relations: pipe(
361
- current.relations,
362
- recordToEntries,
363
- map(([id, relations]) => [
364
- id,
365
- relations.filter((relation) => relation !== idToRemove)
366
- ]),
367
- entriesToRecord,
368
- treeShake((val, key) => key === idToRemove || isEmptyArray(val))
369
- ),
370
- contents: pipe(
371
- current.contents,
372
- treeShake(
373
- (_, key) => isString(key) && key.split(`/`).includes(idToRemove)
374
- )
375
- )
376
- });
377
- return next;
378
- };
379
- var removeRelation = (current, relation) => {
380
- const idA = relation[current.a];
381
- const idB = relation[current.b];
382
- return idB ? removeSpecific(current, idA, idB) : removeAll(current, idA);
383
- };
384
-
385
- // ../anvl/src/join/set-relation.ts
386
- var setManyToMany = (map2, idA, idB, ...rest) => {
387
- var _a2, _b;
388
- const next = __spreadProps(__spreadValues({}, map2), {
389
- relations: __spreadProps(__spreadValues({}, map2.relations), {
390
- [idA]: addTo((_a2 = map2.relations[idA]) != null ? _a2 : [])(idB),
391
- [idB]: addTo((_b = map2.relations[idB]) != null ? _b : [])(idA)
392
- })
393
- });
394
- const content = rest[0];
395
- return content ? setContent(next, idA, idB, content) : next;
396
- };
397
- var removeEmpties = treeShake(isEmptyArray);
398
- var set1ToMany = (current, leaderId, followerId, ...rest) => {
399
- var _a2;
400
- const relations = __spreadValues({}, current.relations);
401
- const prevLeaderId = getRelatedId(current, followerId);
402
- const next = __spreadProps(__spreadValues({}, current), {
403
- relations: removeEmpties(__spreadProps(__spreadValues(__spreadValues({}, relations), prevLeaderId && prevLeaderId !== leaderId && {
404
- [prevLeaderId]: relations[prevLeaderId].filter(
405
- (id) => id !== followerId
406
- )
407
- }), {
408
- [followerId]: [leaderId],
409
- [leaderId]: addTo((_a2 = relations[leaderId]) != null ? _a2 : [])(followerId)
410
- }))
411
- });
412
- const content = rest[0];
413
- return content ? setContent(next, leaderId, followerId, content) : next;
414
- };
415
- var set1To1 = (current, wifeId, husbandId, ...rest) => {
416
- const prevWifeId = getRelatedId(current, husbandId);
417
- const prevHusbandId = getRelatedId(current, wifeId);
418
- const next = __spreadProps(__spreadValues({}, current), {
419
- relations: removeEmpties(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, current.relations), prevWifeId && { [prevWifeId]: [] }), prevHusbandId && { [prevHusbandId]: [] }), {
420
- [wifeId]: [husbandId],
421
- [husbandId]: [wifeId]
422
- }))
423
- });
424
- const content = rest[0];
425
- return content ? setContent(next, wifeId, husbandId, content) : next;
426
- };
427
- var setRelationWithContent = (current, relation, ...rest) => {
428
- const { [current.a]: idA, [current.b]: idB } = relation;
429
- switch (current.relationType) {
430
- case `1:1`:
431
- return set1To1(current, idA, idB, ...rest);
432
- case `1:n`:
433
- return set1ToMany(current, idA, idB, ...rest);
434
- case `n:n`:
435
- return setManyToMany(current, idA, idB, ...rest);
436
- }
437
- };
438
-
439
- // ../anvl/src/join/relation-contents.ts
440
- var makeContentId = (idA, idB) => [idA, idB].sort().join(`/`);
441
- var getContent = (relationMap, idA, idB) => relationMap.contents[makeContentId(idA, idB)];
442
- var setContent = (map2, idA, idB, content) => __spreadProps(__spreadValues({}, map2), {
443
- contents: __spreadProps(__spreadValues({}, map2.contents), {
444
- [makeContentId(idA, idB)]: content
445
- })
446
- });
447
- var getRelations = (relationMap, id) => getRelationEntries(relationMap, id).map(
448
- ([id2, content]) => __spreadValues({
449
- id: id2
450
- }, content)
451
- );
452
- var setRelations = (current, subject, relations) => {
453
- const idA = subject[current.a];
454
- const idB = subject[current.b];
455
- return pipe(
456
- current,
457
- (relationData) => {
458
- const relatedIds = getRelatedIds(current, idA);
459
- const removedIds = relatedIds.filter(
460
- (id) => !relations.some((r) => r.id === id)
461
- );
462
- let step = relationData;
463
- for (const id of removedIds) {
464
- const remove = {
465
- [current.a]: idA != null ? idA : id,
466
- [current.b]: idB != null ? idB : id
467
- };
468
- step = removeRelation(step, remove);
469
- }
470
- return step;
471
- },
472
- (relationData) => {
473
- let step = relationData;
474
- for (const _a2 of relations) {
475
- const _b = _a2, { id } = _b, rest = __objRest(_b, ["id"]);
476
- const content = isEmptyObject(rest) ? void 0 : rest;
477
- step = setRelationWithContent(
478
- step,
479
- { [current.a]: idA != null ? idA : id, [current.b]: idB != null ? idB : id },
480
- // @ts-expect-error hacky
481
- content
482
- );
483
- }
484
- return step;
485
- },
486
- (relationData) => {
487
- const newlyOrderedIds = relations.map((r) => r.id);
488
- return __spreadProps(__spreadValues({}, relationData), {
489
- relations: __spreadProps(__spreadValues({}, relationData.relations), {
490
- [idA != null ? idA : idB]: newlyOrderedIds
491
- })
492
- });
493
- }
494
- );
495
- };
496
-
497
- // ../anvl/src/join/index.ts
498
- var Join = class _Join {
499
- constructor(json) {
500
- this.a = `from`;
501
- this.b = `to`;
502
- this.makeJsonInterface = (...params) => {
503
- return makeJsonInterface(this, ...params);
504
- };
505
- Object.assign(this, __spreadProps(__spreadValues(__spreadValues({}, EMPTY_RELATION_DATA), json), {
506
- makeJsonInterface: this.makeJsonInterface
507
- }));
508
- }
509
- toJSON() {
510
- return {
511
- relationType: this.relationType,
512
- relations: this.relations,
513
- contents: this.contents,
514
- a: this.a,
515
- b: this.b
516
- };
517
- }
518
- static fromJSON(json, options) {
519
- const isValid = isRelationData(options)(json);
520
- if (isValid) {
521
- return new _Join(json);
522
- }
523
- throw new Error(
524
- `Saved JSON for this Join is invalid: ${JSON.stringify(json)}`
525
- );
526
- }
527
- from(newA) {
528
- return new _Join(__spreadProps(__spreadValues({}, this), { a: newA }));
529
- }
530
- to(newB) {
531
- return new _Join(__spreadProps(__spreadValues({}, this), { b: newB }));
532
- }
533
- getRelatedId(id) {
534
- return getRelatedId(this, id);
535
- }
536
- getRelatedIds(id) {
537
- return getRelatedIds(this, id);
538
- }
539
- getContent(idA, idB) {
540
- return getContent(this, idA, idB);
541
- }
542
- getRelationEntries(id) {
543
- return getRelationEntries(this, id);
544
- }
545
- getRelationRecord(id) {
546
- return getRelationRecord(this, id);
547
- }
548
- getRelation(id) {
549
- return getRelations(this, id)[0];
550
- }
551
- getRelations(id) {
552
- return getRelations(this, id);
553
- }
554
- setRelations(subject, relations) {
555
- return new _Join(setRelations(this, subject, relations));
556
- }
557
- set(relation, ...rest) {
558
- return new _Join(setRelationWithContent(this, relation, ...rest));
559
- }
560
- remove(relation) {
561
- return new _Join(
562
- removeRelation(this, relation)
563
- );
564
- }
565
- };
566
272
  var ElasticInput = forwardRef(function ElasticInputFC(props, ref) {
567
- var _a2, _b, _c, _d;
273
+ var _a2, _b, _c, _d, _e, _f;
568
274
  const inputRef = useRef(null);
569
275
  const spanRef = useRef(null);
570
276
  const [inputWidth, setInputWidth] = useState(`auto`);
@@ -586,7 +292,9 @@ var ElasticInput = forwardRef(function ElasticInputFC(props, ref) {
586
292
  setInputWidth(`${spanRef.current.offsetWidth + extraWidth}px`);
587
293
  }
588
294
  }, 1e3);
589
- return () => clearInterval(interval);
295
+ return () => {
296
+ clearInterval(interval);
297
+ };
590
298
  }
591
299
  }, [(_a2 = inputRef.current) == null ? void 0 : _a2.value, props.value]);
592
300
  return /* @__PURE__ */ jsxs("div", { style: { display: `inline-block`, position: `relative` }, children: [
@@ -614,8 +322,8 @@ var ElasticInput = forwardRef(function ElasticInputFC(props, ref) {
614
322
  visibility: `hidden`,
615
323
  // color: `red`,
616
324
  whiteSpace: `pre`,
617
- fontFamily: ((_c = props.style) == null ? void 0 : _c.fontFamily) || `inherit`,
618
- fontSize: ((_d = props.style) == null ? void 0 : _d.fontSize) || `inherit`
325
+ fontFamily: (_d = (_c = props.style) == null ? void 0 : _c.fontFamily) != null ? _d : `inherit`,
326
+ fontSize: (_f = (_e = props.style) == null ? void 0 : _e.fontSize) != null ? _f : `inherit`
619
327
  },
620
328
  children: props.value
621
329
  }
@@ -625,9 +333,6 @@ var ElasticInput = forwardRef(function ElasticInputFC(props, ref) {
625
333
 
626
334
  // ../anvl/src/number/clamp.ts
627
335
  var clampInto = (min, max) => (value) => value < min ? min : value > max ? max : value;
628
-
629
- // ../anvl/src/number/wrap.ts
630
- var wrapInto = (min, max) => (value) => value < min ? max - (min - value) % (max - min) : min + (value - min) % (max - min);
631
336
  function round(value, decimalPlaces) {
632
337
  if (decimalPlaces === void 0)
633
338
  return value;
@@ -646,11 +351,11 @@ var isDecimalInProgress = (input) => input === `0` || !Number.isNaN(Number(input
646
351
  var textToValue = (input, allowDecimal) => {
647
352
  if (isValidNonNumber(input))
648
353
  return VALID_NON_NUMBER_INTERPRETATIONS[input];
649
- return allowDecimal ? parseFloat(input) : Math.round(parseFloat(input));
354
+ return allowDecimal ? Number.parseFloat(input) : Math.round(Number.parseFloat(input));
650
355
  };
651
356
  var DEFAULT_NUMBER_CONSTRAINTS = {
652
- max: Infinity,
653
- min: -Infinity,
357
+ max: Number.POSITIVE_INFINITY,
358
+ min: Number.NEGATIVE_INFINITY,
654
359
  decimalPlaces: 100,
655
360
  nullable: true
656
361
  };
@@ -828,7 +533,9 @@ var JsonEditor_INTERNAL = ({
828
533
  ElasticInput,
829
534
  {
830
535
  value: name,
831
- onChange: disabled ? doNothing : (e) => rename(e.target.value),
536
+ onChange: disabled ? doNothing : (e) => {
537
+ rename(e.target.value);
538
+ },
832
539
  disabled
833
540
  }
834
541
  ) }),
@@ -849,7 +556,9 @@ var JsonEditor_INTERNAL = ({
849
556
  recast && dataIsJson ? /* @__PURE__ */ jsx(
850
557
  "select",
851
558
  {
852
- onChange: disabled ? doNothing : (e) => recast(e.target.value),
559
+ onChange: disabled ? doNothing : (e) => {
560
+ recast(e.target.value);
561
+ },
853
562
  value: refined.type,
854
563
  disabled,
855
564
  children: Object.keys(SubEditors).map((type) => /* @__PURE__ */ jsx("option", { value: type, children: type }, type))
@@ -859,13 +568,13 @@ var JsonEditor_INTERNAL = ({
859
568
  };
860
569
 
861
570
  // ../hamr/react-json-editor/src/editors-by-type/utilities/array-elements.ts
862
- var makeElementSetters = (data, set) => data.map(
863
- (value, index) => (newValue) => set(() => {
571
+ var makeElementSetters = (data, set) => data.map((value, index) => (newValue) => {
572
+ set(() => {
864
573
  const newData = [...data];
865
574
  newData[index] = become(newValue)(value);
866
575
  return newData;
867
- })
868
- );
576
+ });
577
+ });
869
578
  var ArrayEditor = ({
870
579
  path = [],
871
580
  isReadonly = () => false,
@@ -921,7 +630,7 @@ var Int = Object.assign((input) => parseInteger(input), {
921
630
  from: (input) => pipe(
922
631
  input,
923
632
  String,
924
- parseFloat,
633
+ Number.parseFloat,
925
634
  (num) => isInteger(num) ? {
926
635
  value: num,
927
636
  error: null,
@@ -1162,7 +871,9 @@ var expandPathForSchema = (path) => {
1162
871
  );
1163
872
  default:
1164
873
  throw new TypeError(
1165
- `The key ${key} is not a valid JSON key; expected string or number, got ${typeof key}`
874
+ `The key ${JSON.stringify(
875
+ key
876
+ )} is not a valid JSON key; expected string or number, got ${typeof key}`
1166
877
  );
1167
878
  }
1168
879
  });
@@ -1185,10 +896,11 @@ var findSubSchema = (schema) => {
1185
896
  if (typeof schema === `boolean`) {
1186
897
  return new TypeError(`The schema is not a JsonSchema`);
1187
898
  }
1188
- const { node, refMap } = pathIntoSchema.reduce(
899
+ const reduction = pathIntoSchema.reduce(
1189
900
  ({ node: node2, refMap: refMap2 = void 0 }, key) => (console.log({ node: node2, key }), isJsonSchemaRef(node2) ? retrieveRef({ refNode: node2, root: schema, refMap: refMap2 }) : { node: node2[key], refMap: refMap2 }),
1190
901
  { node: schema, refMap: void 0 }
1191
902
  );
903
+ const { node, refMap } = reduction;
1192
904
  if (node instanceof Error)
1193
905
  throw node;
1194
906
  let subSchema = node;
@@ -1343,35 +1055,44 @@ var castToJson = (input) => {
1343
1055
  // ../hamr/react-json-editor/src/editors-by-type/utilities/object-properties.ts
1344
1056
  var makePropertySetters = (data, set) => mapObject(
1345
1057
  data,
1346
- (value, key) => (newValue) => set(__spreadProps(__spreadValues({}, data), { [key]: become(newValue)(value[key]) }))
1058
+ (value, key) => (newValue) => {
1059
+ set(__spreadProps(__spreadValues({}, data), { [key]: become(newValue)(value[key]) }));
1060
+ }
1347
1061
  );
1348
1062
  var makePropertyRenamers = (data, set, stableKeyMapRef) => mapObject(
1349
1063
  data,
1350
- (value, key) => (newKey) => Object.hasOwn(data, newKey) ? null : set(() => {
1351
- const entries = Object.entries(data);
1352
- const index = entries.findIndex(([k]) => k === key);
1353
- entries[index] = [newKey, value];
1354
- const stableKeyMap = stableKeyMapRef.current;
1355
- stableKeyMapRef.current = __spreadProps(__spreadValues({}, stableKeyMap), {
1356
- [newKey]: stableKeyMap[key]
1357
- });
1358
- return Object.fromEntries(entries);
1359
- })
1064
+ (value, key) => (newKey) => {
1065
+ if (!Object.hasOwn(data, newKey)) {
1066
+ set(() => {
1067
+ const entries = Object.entries(data);
1068
+ const index = entries.findIndex(([k]) => k === key);
1069
+ entries[index] = [newKey, value];
1070
+ const stableKeyMap = stableKeyMapRef.current;
1071
+ stableKeyMapRef.current = __spreadProps(__spreadValues({}, stableKeyMap), {
1072
+ [newKey]: stableKeyMap[key]
1073
+ });
1074
+ return Object.fromEntries(entries);
1075
+ });
1076
+ }
1077
+ }
1360
1078
  );
1361
- var makePropertyRemovers = (data, set) => mapObject(
1362
- data,
1363
- (_, key) => () => set(() => {
1079
+ var makePropertyRemovers = (data, set) => mapObject(data, (_, key) => () => {
1080
+ set(() => {
1364
1081
  const _a2 = data, rest = __objRest(_a2, [__restKey(key)]);
1365
1082
  return rest;
1366
- })
1367
- );
1083
+ });
1084
+ });
1368
1085
  var makePropertyRecasters = (data, set) => mapObject(
1369
1086
  data,
1370
- (value, key) => (newType) => set(() => __spreadProps(__spreadValues({}, data), {
1371
- [key]: castToJson(value).to[newType]()
1372
- }))
1087
+ (value, key) => (newType) => {
1088
+ set(() => __spreadProps(__spreadValues({}, data), {
1089
+ [key]: castToJson(value).to[newType]()
1090
+ }));
1091
+ }
1373
1092
  );
1374
- var makePropertyCreationInterface = (data, set) => (key, type) => (value) => set(__spreadProps(__spreadValues({}, data), { [key]: value != null ? value : JSON_DEFAULTS[type] }));
1093
+ var makePropertyCreationInterface = (data, set) => (key, type) => (value) => {
1094
+ set(__spreadProps(__spreadValues({}, data), { [key]: value != null ? value : JSON_DEFAULTS[type] }));
1095
+ };
1375
1096
  var makePropertySorter = (data, set, sortFn) => () => {
1376
1097
  const sortedKeys = Object.keys(data).sort(sortFn);
1377
1098
  const sortedObj = {};
@@ -1389,7 +1110,16 @@ var PropertyAdder = ({
1389
1110
  /* @__PURE__ */ jsx(ElasticInput, { disabled: true, defaultValue: propertyKey }),
1390
1111
  ` `,
1391
1112
  /* @__PURE__ */ jsx(ElasticInput, { disabled: true, defaultValue: "is missing" }),
1392
- /* @__PURE__ */ jsx(Components.Button, { onClick: () => addProperty(), disabled, children: "+" })
1113
+ /* @__PURE__ */ jsx(
1114
+ Components.Button,
1115
+ {
1116
+ onClick: () => {
1117
+ addProperty();
1118
+ },
1119
+ disabled,
1120
+ children: "+"
1121
+ }
1122
+ )
1393
1123
  ] });
1394
1124
  var ObjectEditor = ({
1395
1125
  schema,
@@ -1429,7 +1159,16 @@ var ObjectEditor = ({
1429
1159
  );
1430
1160
  const missingKeys = schemaKeys === true ? [] : schemaKeys.filter((key) => !dataKeys.includes(key));
1431
1161
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1432
- /* @__PURE__ */ jsx(Components.Button, { onClick: () => sortProperties(), disabled, children: "Sort" }),
1162
+ /* @__PURE__ */ jsx(
1163
+ Components.Button,
1164
+ {
1165
+ onClick: () => {
1166
+ sortProperties();
1167
+ },
1168
+ disabled,
1169
+ children: "Sort"
1170
+ }
1171
+ ),
1433
1172
  /* @__PURE__ */ jsxs(Components.ObjectWrapper, { children: [
1434
1173
  /* @__PURE__ */ jsx("div", { className: "json_editor_properties", children: [...missingKeys, ...officialKeys, ...unofficialKeys].map((key) => {
1435
1174
  const originalKey = stableKeyMap.current[key];
@@ -1468,7 +1207,9 @@ var ObjectEditor = ({
1468
1207
  /* @__PURE__ */ jsx(
1469
1208
  Components.Button,
1470
1209
  {
1471
- onClick: disabled ? doNothing : () => makePropertyAdder(`new_property`, `string`)(),
1210
+ onClick: disabled ? doNothing : () => {
1211
+ makePropertyAdder(`new_property`, `string`)();
1212
+ },
1472
1213
  disabled,
1473
1214
  children: "+"
1474
1215
  }
@@ -1485,7 +1226,9 @@ var BooleanEditor = ({
1485
1226
  {
1486
1227
  type: "checkbox",
1487
1228
  checked: data,
1488
- onChange: (event) => set(event.target.checked)
1229
+ onChange: (event) => {
1230
+ set(event.target.checked);
1231
+ }
1489
1232
  }
1490
1233
  ) });
1491
1234
  var NullEditor = ({
@@ -1501,7 +1244,9 @@ var NumberEditor = ({
1501
1244
  NumberInput,
1502
1245
  {
1503
1246
  value: data,
1504
- set: isReadonly(path) ? void 0 : (newValue) => set(Number(newValue)),
1247
+ set: isReadonly(path) ? void 0 : (newValue) => {
1248
+ set(Number(newValue));
1249
+ },
1505
1250
  autoSize: true
1506
1251
  }
1507
1252
  ) });
@@ -1675,413 +1420,13 @@ var SubEditors = {
1675
1420
  object: ObjectEditor,
1676
1421
  string: StringEditor
1677
1422
  };
1678
-
1679
- // ../anvl/src/string/string-to-color.ts
1680
- function stringToColor(input) {
1681
- let hash = 0;
1682
- for (let i = 0; i < input.length; i++) {
1683
- const char = input.charCodeAt(i);
1684
- hash = (hash << 5) - hash + char;
1685
- hash |= 0;
1686
- }
1687
- let hexColor = (hash & 16777215).toString(16);
1688
- while (hexColor.length < 6) {
1689
- hexColor = `0` + hexColor;
1690
- }
1691
- return `#${hexColor}`;
1692
- }
1693
-
1694
- // ../luum/src/constants/index.ts
1695
- var CHANNEL_SPECIFIC_LUM = {
1696
- R: 0.3,
1697
- G: 0.5,
1698
- B: 0.2
1699
- };
1700
-
1701
- // ../luum/src/constants/filters.ts
1702
- var unfiltered = [
1703
- { sat: 255, hue: 0 },
1704
- { sat: 255, hue: 360 }
1705
- ];
1706
-
1707
- // ../luum/src/export/channelsToHex.ts
1708
- var channelsToHex = (channels) => `#${Object.values(channels).map((channel) => {
1709
- let channelHex = channel.toString(16);
1710
- if (channelHex.length === 1)
1711
- channelHex = 0 + channelHex;
1712
- return channelHex;
1713
- }).join(``)}`;
1714
- var channelsToHex_default = channelsToHex;
1715
-
1716
- // ../luum/src/import/hueToRelativeChannels.ts
1717
- var hueToRelativeChannels_default = (hue) => {
1718
- const hueWrapped = wrapInto(0, 360)(hue);
1719
- const hueReduced = hueWrapped / 60;
1720
- const hueInteger = Math.floor(hueReduced);
1721
- const hueDecimal = hueReduced - hueInteger;
1722
- const x = hueDecimal;
1723
- const y = 1 - hueDecimal;
1724
- switch (hueInteger) {
1725
- case 0:
1726
- return [1, x, 0];
1727
- case 1:
1728
- return [y, 1, 0];
1729
- case 2:
1730
- return [0, 1, x];
1731
- case 3:
1732
- return [0, y, 1];
1733
- case 4:
1734
- return [x, 0, 1];
1735
- case 5:
1736
- return [1, 0, y];
1737
- default:
1738
- throw new Error(`invalid hue served: ${hue}`);
1739
- }
1740
- };
1741
-
1742
- // ../luum/src/solveFor/hueFromChannels.ts
1743
- var hueFromChannels = ({ R, G, B }) => {
1744
- let hue = 0;
1745
- if (R > G && G >= B)
1746
- hue = 60 * (0 + (G - B) / (R - B));
1747
- if (G >= R && R > B)
1748
- hue = 60 * (2 - (R - B) / (G - B));
1749
- if (G > B && B >= R)
1750
- hue = 60 * (2 + (B - R) / (G - R));
1751
- if (B >= G && G > R)
1752
- hue = 60 * (4 - (G - R) / (B - R));
1753
- if (B > R && R >= G)
1754
- hue = 60 * (4 + (R - G) / (B - G));
1755
- if (R >= B && B > G)
1756
- hue = 60 * (6 - (B - G) / (R - G));
1757
- return hue;
1758
- };
1759
- var hueFromChannels_default = hueFromChannels;
1760
-
1761
- // ../luum/src/solveFor/lumFromChannels.ts
1762
- var lumFromChannels = ({ R, G, B }) => {
1763
- const lum = CHANNEL_SPECIFIC_LUM.R * R / 255 + CHANNEL_SPECIFIC_LUM.G * G / 255 + CHANNEL_SPECIFIC_LUM.B * B / 255;
1764
- return lum;
1765
- };
1766
- var lumFromChannels_default = lumFromChannels;
1767
-
1768
- // ../luum/src/solveFor/maxSatForHueInFilter.ts
1769
- var maxSatForHueInFilter_default = (hue, filter) => {
1770
- let maxSat = 255;
1771
- const hueWrapped = wrapInto(0, 360)(hue);
1772
- for (let a2 = -1, b2 = 0; b2 < filter.length; a2++, b2++) {
1773
- a2 = wrapInto(0, filter.length)(a2);
1774
- const hueDoubleWrapped = a2 > b2 ? wrapInto(-180, 180)(hueWrapped) : void 0;
1775
- const tuningPointA = filter[a2];
1776
- const tuningPointB = filter[b2];
1777
- const hueA = a2 > b2 ? wrapInto(-180, 180)(tuningPointA.hue) : tuningPointA.hue;
1778
- const hueB = tuningPointB.hue;
1779
- if ((hueDoubleWrapped || hueWrapped) >= hueA && (hueDoubleWrapped || hueWrapped) < hueB) {
1780
- let $ = hueDoubleWrapped || hueWrapped;
1781
- $ -= hueA;
1782
- $ /= hueB - hueA;
1783
- $ *= tuningPointB.sat - tuningPointA.sat;
1784
- $ += tuningPointA.sat;
1785
- maxSat = $;
1786
- }
1787
- }
1788
- return maxSat;
1789
- };
1790
-
1791
- // ../luum/src/solveFor/satFromChannels.ts
1792
- var satFromChannels = ({ R, G, B }) => {
1793
- const sat = Math.max(R, G, B) - Math.min(R, G, B);
1794
- return sat;
1795
- };
1796
- var satFromChannels_default = satFromChannels;
1797
-
1798
- // ../luum/src/solveFor/specificLumFromHue.ts
1799
- var specificLumFromHue_default = (hue) => {
1800
- const [factorR, factorG, factorB] = hueToRelativeChannels_default(hue);
1801
- const lumR = CHANNEL_SPECIFIC_LUM.R * factorR;
1802
- const lumG = CHANNEL_SPECIFIC_LUM.G * factorG;
1803
- const lumB = CHANNEL_SPECIFIC_LUM.B * factorB;
1804
- const specificLum = lumR + lumG + lumB;
1805
- return specificLum;
1806
- };
1807
-
1808
- // ../luum/src/export/specToChannelsFixLimit.ts
1809
- var minChannelsForSaturationFromHue = (hue) => {
1810
- const relativeChannels = hueToRelativeChannels_default(hue);
1811
- const channelSpreader = (trueSaturation) => {
1812
- const makeMinChannel = (idx) => Math.round(relativeChannels[idx] * trueSaturation);
1813
- return {
1814
- R: makeMinChannel(0),
1815
- G: makeMinChannel(1),
1816
- B: makeMinChannel(2)
1817
- };
1818
- };
1819
- return channelSpreader;
1820
- };
1821
- var channelsFromIlluminationObj = ({
1822
- minChannels,
1823
- trueLuminosity,
1824
- minLum
1825
- }) => {
1826
- const { max, round: round2 } = Math;
1827
- const maxWhite = 255 - max(...Object.values(minChannels));
1828
- const white = clampInto(0, maxWhite)(round2((trueLuminosity - minLum) * 255));
1829
- const channels = {
1830
- R: minChannels.R + white,
1831
- G: minChannels.G + white,
1832
- B: minChannels.B + white
1833
- };
1834
- return channels;
1835
- };
1836
- var specToChannelsFixLimit = ({ hue, sat, lum, prefer = `lum` }, filter = unfiltered) => {
1837
- const minChannelsForSaturation = minChannelsForSaturationFromHue(hue);
1838
- let trueSaturation;
1839
- let trueLuminosity;
1840
- let minChannels;
1841
- let maxChannels;
1842
- let specificLum;
1843
- let minLum = 0;
1844
- let maxLum = 1;
1845
- let maxSat = maxSatForHueInFilter_default(hue, filter);
1846
- switch (prefer) {
1847
- case `sat`:
1848
- trueSaturation = clampInto(0, 255)(Math.min(sat, maxSat));
1849
- minChannels = minChannelsForSaturation(trueSaturation);
1850
- maxChannels = {
1851
- R: minChannels.R + 255 - trueSaturation,
1852
- G: minChannels.G + 255 - trueSaturation,
1853
- B: minChannels.B + 255 - trueSaturation
1854
- };
1855
- minLum = lumFromChannels_default(minChannels);
1856
- maxLum = lumFromChannels_default(maxChannels);
1857
- trueLuminosity = clampInto(minLum, maxLum)(lum);
1858
- break;
1859
- case `lum`:
1860
- trueLuminosity = clampInto(0, 1)(lum);
1861
- specificLum = specificLumFromHue_default(hue);
1862
- maxSat = Math.min(
1863
- maxSat,
1864
- Math.round(
1865
- trueLuminosity <= specificLum ? 255 * (trueLuminosity / specificLum) : 255 * (1 - trueLuminosity) / (1 - specificLum)
1866
- )
1867
- );
1868
- trueSaturation = Math.min(sat, maxSat);
1869
- minChannels = minChannelsForSaturation(trueSaturation);
1870
- minLum = lumFromChannels_default(minChannels);
1871
- break;
1872
- }
1873
- const channels = channelsFromIlluminationObj({
1874
- minChannels,
1875
- trueLuminosity,
1876
- minLum
1877
- });
1878
- return {
1879
- channels,
1880
- fix: {
1881
- sat: trueSaturation,
1882
- lum: trueLuminosity
1883
- },
1884
- limit: {
1885
- sat: [0, maxSat],
1886
- lum: [prefer === `lum` ? 0 : minLum, maxLum]
1887
- }
1888
- };
1889
- };
1890
- var specToChannelsFixLimit_default = specToChannelsFixLimit;
1891
-
1892
- // ../luum/src/export/specToHexFixLimit.ts
1893
- var specToHexFixLimit = ({ hue, sat, lum, prefer }, filter) => {
1894
- const { channels, fix, limit } = specToChannelsFixLimit_default(
1895
- {
1896
- hue,
1897
- sat,
1898
- lum,
1899
- prefer
1900
- },
1901
- filter
1902
- );
1903
- const { R, G, B } = channels;
1904
- const hex = channelsToHex_default({ R, G, B });
1905
- return { hex, fix, limit };
1906
- };
1907
- var specToHexFixLimit_default = specToHexFixLimit;
1908
-
1909
- // ../luum/src/export/specToHex.ts
1910
- var specToHex = ({ hue, sat, lum, prefer }, filter) => {
1911
- const { hex } = specToHexFixLimit_default({ hue, sat, lum, prefer }, filter);
1912
- return hex;
1913
- };
1914
- var specToHex_default = specToHex;
1915
-
1916
- // ../luum/src/import/channelsToSpec.ts
1917
- var channelsToSpec = ({ R, G, B }) => {
1918
- const hue = hueFromChannels_default({ R, G, B });
1919
- const sat = satFromChannels_default({ R, G, B });
1920
- const lum = lumFromChannels_default({ R, G, B });
1921
- return { hue, sat, lum };
1922
- };
1923
- var channelsToSpec_default = channelsToSpec;
1924
-
1925
- // ../luum/src/import/normalizeHex.ts
1926
- var BASE_16_CHAR_SET = `[a-fA-F0-9]+`;
1927
- var miniHexToHex = (miniHex) => {
1928
- const miniHexArray = miniHex.split(``);
1929
- const hexTemplate = [0, 0, 1, 1, 2, 2];
1930
- return hexTemplate.map((idx) => miniHexArray[idx]).join(``);
1931
- };
1932
- var normalizeHex = (maybeHex) => {
1933
- const hex = maybeHex.replace(/^#/, ``);
1934
- const hexIsCorrectLength = hex.length === 6 || hex.length === 3;
1935
- const hexIsCorrectCharSet = hex.match(new RegExp(`^${BASE_16_CHAR_SET}$`)) !== null;
1936
- const hexIsValid = hexIsCorrectLength && hexIsCorrectCharSet;
1937
- if (!hexIsValid) {
1938
- throw new Error(`${maybeHex} is not a valid hex code`);
1939
- }
1940
- if (hex.length === 3) {
1941
- return miniHexToHex(hex);
1942
- }
1943
- return hex;
1944
- };
1945
- var normalizeHex_default = normalizeHex;
1946
-
1947
- // ../luum/src/import/hexToChannels.ts
1948
- var hexToChannels_default = (maybeHex) => {
1949
- const hex = normalizeHex_default(maybeHex);
1950
- return {
1951
- R: parseInt(hex.slice(0, 2), 16),
1952
- G: parseInt(hex.slice(2, 4), 16),
1953
- B: parseInt(hex.slice(4, 6), 16)
1954
- };
1955
- };
1956
-
1957
- // ../luum/src/import/hexToSpec.ts
1958
- var hexToSpec = (hex) => {
1959
- const { R, G, B } = hexToChannels_default(hex);
1960
- const { hue, sat, lum } = channelsToSpec_default({ R, G, B });
1961
- return { hue, sat, lum };
1962
- };
1963
- var hexToSpec_default = hexToSpec;
1964
-
1965
- // ../luum/src/mixers/contrast.ts
1966
- var contrastMax = (color) => __spreadProps(__spreadValues({}, color), {
1967
- lum: color.lum > 0.666 ? 0 : 1
1968
- });
1969
- var offset = (offsetAmount) => (color) => __spreadProps(__spreadValues({}, color), {
1970
- lum: color.lum > 0.666 ? color.lum - offsetAmount : color.lum + offsetAmount
1971
- });
1972
-
1973
- // ../luum/src/constants/luum-spec.ts
1974
- var defaultSpec = {
1975
- hue: 0,
1976
- lum: 0,
1977
- sat: 0,
1978
- prefer: `lum`
1979
- };
1980
-
1981
- // ../luum/src/scheme/index.ts
1982
- var isLuumSpec = (input) => typeof input === `object` && input !== null && typeof input.hue === `number` && typeof input.sat === `number` && typeof input.lum === `number` && [`sat`, `lum`].includes(input.prefer);
1983
- isModifier(isLuumSpec)(defaultSpec);
1984
- var WAYFORGE_CORE_COLOR_NAMES = [
1985
- `Red`,
1986
- `Orange`,
1987
- `Yellow`,
1988
- `Lime`,
1989
- `Green`,
1990
- `Teal`,
1991
- `Cyan`,
1992
- `Blue`,
1993
- `Indigo`,
1994
- `Violet`,
1995
- `Magenta`,
1996
- `Pink`
1997
- ];
1998
- WAYFORGE_CORE_COLOR_NAMES.reduce(
1999
- (acc, name, idx) => {
2000
- acc[name] = {
2001
- hue: idx * 30,
2002
- sat: 255,
2003
- lum: 0.5,
2004
- prefer: `sat`
2005
- };
2006
- return acc;
2007
- },
2008
- {}
2009
- );
2010
- var Id = ({ id }) => {
2011
- const [isOpen, setIsOpen] = React.useState(false);
2012
- const { refs, floatingStyles, context } = useFloating({
2013
- open: isOpen,
2014
- onOpenChange: setIsOpen,
2015
- placement: `bottom-start`
2016
- });
2017
- const click = useClick(context);
2018
- const { getReferenceProps, getFloatingProps } = useInteractions([click]);
2019
- const bgColor = stringToColor(id);
2020
- const contrastColor = pipe(bgColor, hexToSpec_default, contrastMax, specToHex_default);
2021
- const offsetColor = pipe(bgColor, hexToSpec_default, offset(0.25), specToHex_default);
2022
- const contrastOffsetColor = pipe(
2023
- offsetColor,
2024
- hexToSpec_default,
2025
- contrastMax,
2026
- specToHex_default
2027
- );
2028
- return /* @__PURE__ */ jsxs(Fragment, { children: [
2029
- /* @__PURE__ */ jsx(
2030
- "span",
2031
- __spreadProps(__spreadValues({
2032
- ref: refs.setReference
2033
- }, getReferenceProps()), {
2034
- style: {
2035
- background: bgColor,
2036
- cursor: `pointer`,
2037
- padding: `0px 4px`,
2038
- color: contrastColor,
2039
- userSelect: `none`,
2040
- whiteSpace: `nowrap`
2041
- },
2042
- children: id.substring(0, 3)
2043
- })
2044
- ),
2045
- isOpen && /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(
2046
- "span",
2047
- __spreadProps(__spreadValues({
2048
- ref: refs.setFloating
2049
- }, getFloatingProps()), {
2050
- style: __spreadProps(__spreadValues({}, floatingStyles), {
2051
- color: contrastOffsetColor,
2052
- background: offsetColor,
2053
- padding: `0px 4px`,
2054
- boxShadow: `0px 2px 10px rgba(0, 0, 0, 0.1)`
2055
- }),
2056
- children: id
2057
- })
2058
- ) })
2059
- ] });
2060
- };
2061
- var RelationEditor = (props) => {
2062
- const seen = /* @__PURE__ */ new Set();
2063
- const data = Object.entries(props.data.relations).sort(([_, a2], [__, b2]) => b2.length - a2.length).filter(([head, tail]) => {
2064
- if (seen.has(head))
2065
- return false;
2066
- seen.add(head);
2067
- for (const tailElement of tail) {
2068
- seen.add(tailElement);
2069
- }
2070
- return true;
2071
- });
2072
- return /* @__PURE__ */ jsx("article", { className: "relation-editor-0123456789", children: data.map(([head, tail]) => /* @__PURE__ */ jsxs("section", { children: [
2073
- /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Id, { id: head }) }),
2074
- ":",
2075
- /* @__PURE__ */ jsx("span", { children: tail.map((child) => /* @__PURE__ */ jsx(Id, { id: child })) })
2076
- ] })) });
2077
- };
2078
1423
  var StateEditor = ({ token }) => {
2079
1424
  const set = useI(token);
2080
1425
  const data = useO(token);
2081
- return isJson(data) ? /* @__PURE__ */ jsx(JsonEditor, { data, set, schema: true }) : data instanceof Join ? /* @__PURE__ */ jsx(RelationEditor, { data, set }) : /* @__PURE__ */ jsx("div", { className: "json_editor", children: /* @__PURE__ */ jsx(
1426
+ return isJson(data) ? /* @__PURE__ */ jsx(JsonEditor, { data, set, schema: true }) : /* @__PURE__ */ jsx("div", { className: "json_editor", children: /* @__PURE__ */ jsx(
2082
1427
  ElasticInput,
2083
1428
  {
2084
- value: data instanceof Set ? `Set { ${JSON.stringify([...data]).slice(1, -1)} }` : data instanceof Map ? `Map ` + JSON.stringify([...data]) : Object.getPrototypeOf(data).constructor.name + ` ` + fallback(() => JSON.stringify(data), `?`),
1429
+ value: data !== null && typeof data === `object` && `toJson` in data && typeof data.toJson === `function` ? JSON.stringify(data.toJson()) : data instanceof Set ? `Set { ${JSON.stringify([...data]).slice(1, -1)} }` : Object.getPrototypeOf(data).constructor.name + ` ` + fallback(() => JSON.stringify(data), `?`),
2085
1430
  disabled: true
2086
1431
  }
2087
1432
  ) });
@@ -2099,7 +1444,7 @@ var ReadonlySelectorViewer = ({ token }) => {
2099
1444
  ) : /* @__PURE__ */ jsx("div", { className: "json_editor", children: /* @__PURE__ */ jsx(
2100
1445
  ElasticInput,
2101
1446
  {
2102
- value: data instanceof Set ? `Set ` + JSON.stringify([...data]) : data instanceof Map ? `Map ` + JSON.stringify([...data]) : Object.getPrototypeOf(data).constructor.name + ` ` + JSON.stringify(data),
1447
+ value: data instanceof Set ? `Set ` + JSON.stringify([...data]) : Object.getPrototypeOf(data).constructor.name + ` ` + JSON.stringify(data),
2103
1448
  disabled: true
2104
1449
  }
2105
1450
  ) });
@@ -2139,6 +1484,7 @@ var StateIndexLeafNode = ({ node, isOpenState, typeState }) => {
2139
1484
  button.OpenClose,
2140
1485
  {
2141
1486
  isOpen: isOpen && !isPrimitive,
1487
+ testid: `open-close-state-${node.key}`,
2142
1488
  setIsOpen,
2143
1489
  disabled: isPrimitive
2144
1490
  }
@@ -2146,8 +1492,12 @@ var StateIndexLeafNode = ({ node, isOpenState, typeState }) => {
2146
1492
  /* @__PURE__ */ jsxs(
2147
1493
  "label",
2148
1494
  {
2149
- onClick: () => console.log(node, getState(node)),
2150
- onKeyUp: () => console.log(node, getState(node)),
1495
+ onClick: () => {
1496
+ console.log(node, getState(node));
1497
+ },
1498
+ onKeyUp: () => {
1499
+ console.log(node, getState(node));
1500
+ },
2151
1501
  children: [
2152
1502
  /* @__PURE__ */ jsx("h2", { children: (_b = (_a2 = node.family) == null ? void 0 : _a2.subKey) != null ? _b : node.key }),
2153
1503
  /* @__PURE__ */ jsxs("span", { className: "type detail", children: [
@@ -2158,7 +1508,7 @@ var StateIndexLeafNode = ({ node, isOpenState, typeState }) => {
2158
1508
  ]
2159
1509
  }
2160
1510
  ),
2161
- isPrimitive ? /* @__PURE__ */ jsx(StoreEditor, { token: node }) : null
1511
+ /* @__PURE__ */ jsx(StoreEditor, { token: node })
2162
1512
  ] }),
2163
1513
  isOpen && !isPrimitive ? /* @__PURE__ */ jsx("main", { children: /* @__PURE__ */ jsx(StoreEditor, { token: node }) }) : null
2164
1514
  ] });
@@ -2167,12 +1517,19 @@ var StateIndexTreeNode = ({ node, isOpenState }) => {
2167
1517
  const setIsOpen = useI(isOpenState);
2168
1518
  const isOpen = useO(isOpenState);
2169
1519
  for (const [key, childNode] of recordToEntries(node.familyMembers)) {
2170
- findViewIsOpenState(key);
2171
- findStateTypeState(childNode);
1520
+ findState(findViewIsOpenState, key);
1521
+ findState(findStateTypeState, childNode);
2172
1522
  }
2173
1523
  return /* @__PURE__ */ jsxs(Fragment, { children: [
2174
1524
  /* @__PURE__ */ jsxs("header", { children: [
2175
- /* @__PURE__ */ jsx(button.OpenClose, { isOpen, setIsOpen }),
1525
+ /* @__PURE__ */ jsx(
1526
+ button.OpenClose,
1527
+ {
1528
+ isOpen,
1529
+ testid: `open-close-state-family-${node.key}`,
1530
+ setIsOpen
1531
+ }
1532
+ ),
2176
1533
  /* @__PURE__ */ jsxs("label", { children: [
2177
1534
  /* @__PURE__ */ jsx("h2", { children: node.key }),
2178
1535
  /* @__PURE__ */ jsx("span", { className: "type detail", children: " (family)" })
@@ -2182,18 +1539,15 @@ var StateIndexTreeNode = ({ node, isOpenState }) => {
2182
1539
  StateIndexNode,
2183
1540
  {
2184
1541
  node: childNode,
2185
- isOpenState: findViewIsOpenState(childNode.key),
2186
- typeState: findStateTypeState(childNode)
1542
+ isOpenState: findState(findViewIsOpenState, childNode.key),
1543
+ typeState: findState(findStateTypeState, childNode)
2187
1544
  },
2188
1545
  key
2189
1546
  )) : null
2190
1547
  ] });
2191
1548
  };
2192
1549
  var StateIndexNode = ({ node, isOpenState, typeState }) => {
2193
- if (node.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)) {
2194
- return null;
2195
- }
2196
- return /* @__PURE__ */ jsx("section", { className: "node state", children: `type` in node ? /* @__PURE__ */ jsx(
1550
+ return /* @__PURE__ */ jsx("section", { className: "node state", "data-testid": `state-${node.key}`, children: `type` in node ? /* @__PURE__ */ jsx(
2197
1551
  StateIndexLeafNode,
2198
1552
  {
2199
1553
  node,
@@ -2204,13 +1558,13 @@ var StateIndexNode = ({ node, isOpenState, typeState }) => {
2204
1558
  };
2205
1559
  var StateIndex = ({ tokenIndex }) => {
2206
1560
  const tokenIds = useO(tokenIndex);
2207
- return /* @__PURE__ */ jsx("article", { className: "index state_index", children: Object.entries(tokenIds).filter(([key]) => !key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).sort().map(([key, node]) => {
1561
+ return /* @__PURE__ */ jsx("article", { className: "index state_index", "data-testid": "state-index", children: Object.entries(tokenIds).filter(([key]) => !key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).sort().map(([key, node]) => {
2208
1562
  return /* @__PURE__ */ jsx(
2209
1563
  StateIndexNode,
2210
1564
  {
2211
1565
  node,
2212
- isOpenState: findViewIsOpenState(node.key),
2213
- typeState: findStateTypeState(node)
1566
+ isOpenState: findState(findViewIsOpenState, node.key),
1567
+ typeState: findState(findStateTypeState, node)
2214
1568
  },
2215
1569
  key
2216
1570
  );
@@ -2221,8 +1575,12 @@ var AtomUpdateFC = ({ atomUpdate }) => {
2221
1575
  "article",
2222
1576
  {
2223
1577
  className: "node atom_update",
2224
- onClick: () => console.log(atomUpdate),
2225
- onKeyUp: () => console.log(atomUpdate),
1578
+ onClick: () => {
1579
+ console.log(atomUpdate);
1580
+ },
1581
+ onKeyUp: () => {
1582
+ console.log(atomUpdate);
1583
+ },
2226
1584
  children: [
2227
1585
  /* @__PURE__ */ jsxs("span", { className: "detail", children: [
2228
1586
  atomUpdate.key,
@@ -2235,104 +1593,122 @@ var AtomUpdateFC = ({ atomUpdate }) => {
2235
1593
  );
2236
1594
  };
2237
1595
  var TransactionUpdateFC = ({ serialNumber, transactionUpdate }) => {
2238
- return /* @__PURE__ */ jsxs("article", { className: "node transaction_update", children: [
2239
- /* @__PURE__ */ jsx("header", { children: /* @__PURE__ */ jsx("h4", { children: serialNumber }) }),
2240
- /* @__PURE__ */ jsxs("main", { children: [
2241
- /* @__PURE__ */ jsxs("section", { className: "transaction_params", children: [
2242
- /* @__PURE__ */ jsx("span", { className: "detail", children: "params: " }),
2243
- transactionUpdate.params.map((param, index) => {
2244
- return /* @__PURE__ */ jsxs(
2245
- "article",
2246
- {
2247
- className: "node transaction_param",
2248
- onClick: () => console.log(transactionUpdate),
2249
- onKeyUp: () => console.log(transactionUpdate),
2250
- children: [
2251
- /* @__PURE__ */ jsxs("span", { className: "detail", children: [
2252
- discoverType(param),
2253
- ": "
2254
- ] }),
2255
- /* @__PURE__ */ jsx("span", { className: "summary", children: typeof param === `object` && param !== null && `type` in param && `target` in param ? /* @__PURE__ */ jsx(Fragment, { children: JSON.stringify(param.type) }) : /* @__PURE__ */ jsx(Fragment, { children: JSON.stringify(param) }) })
2256
- ]
2257
- },
2258
- `param` + index
2259
- );
2260
- })
2261
- ] }),
2262
- /* @__PURE__ */ jsxs("section", { className: "node transaction_output", children: [
2263
- /* @__PURE__ */ jsx("span", { className: "detail", children: "output: " }),
2264
- /* @__PURE__ */ jsx("span", { className: "detail", children: discoverType(transactionUpdate.output) }),
2265
- transactionUpdate.output ? /* @__PURE__ */ jsxs("span", { className: "summary", children: [
1596
+ return /* @__PURE__ */ jsxs(
1597
+ "article",
1598
+ {
1599
+ className: "node transaction_update",
1600
+ "data-testid": `transaction-update-${transactionUpdate.key}-${serialNumber}`,
1601
+ children: [
1602
+ /* @__PURE__ */ jsx("header", { children: /* @__PURE__ */ jsx("h4", { children: serialNumber }) }),
1603
+ /* @__PURE__ */ jsxs("main", { children: [
1604
+ /* @__PURE__ */ jsxs("section", { className: "transaction_params", children: [
1605
+ /* @__PURE__ */ jsx("span", { className: "detail", children: "params: " }),
1606
+ transactionUpdate.params.map((param, index) => {
1607
+ return /* @__PURE__ */ jsxs(
1608
+ "article",
1609
+ {
1610
+ className: "node transaction_param",
1611
+ onClick: () => {
1612
+ console.log(transactionUpdate);
1613
+ },
1614
+ onKeyUp: () => {
1615
+ console.log(transactionUpdate);
1616
+ },
1617
+ children: [
1618
+ /* @__PURE__ */ jsxs("span", { className: "detail", children: [
1619
+ discoverType(param),
1620
+ ": "
1621
+ ] }),
1622
+ /* @__PURE__ */ jsx("span", { className: "summary", children: typeof param === `object` && param !== null && `type` in param && `target` in param ? /* @__PURE__ */ jsx(Fragment, { children: JSON.stringify(param.type) }) : /* @__PURE__ */ jsx(Fragment, { children: JSON.stringify(param) }) })
1623
+ ]
1624
+ },
1625
+ `param` + index
1626
+ );
1627
+ })
1628
+ ] }),
1629
+ /* @__PURE__ */ jsxs("section", { className: "node transaction_output", children: [
1630
+ /* @__PURE__ */ jsx("span", { className: "detail", children: "output: " }),
1631
+ /* @__PURE__ */ jsx("span", { className: "detail", children: discoverType(transactionUpdate.output) }),
1632
+ transactionUpdate.output ? /* @__PURE__ */ jsxs("span", { className: "summary", children: [
1633
+ ": ",
1634
+ JSON.stringify(transactionUpdate.output)
1635
+ ] }) : null
1636
+ ] }),
1637
+ /* @__PURE__ */ jsxs("section", { className: "transaction_impact", children: [
1638
+ /* @__PURE__ */ jsx("span", { className: "detail", children: "impact: " }),
1639
+ transactionUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
1640
+ return `newValue` in update ? /* @__PURE__ */ jsx(
1641
+ article.AtomUpdate,
1642
+ {
1643
+ serialNumber: index,
1644
+ atomUpdate: update
1645
+ },
1646
+ `${transactionUpdate.key}:${index}:${update.key}`
1647
+ ) : /* @__PURE__ */ jsx(
1648
+ TransactionUpdateFC,
1649
+ {
1650
+ serialNumber: index,
1651
+ transactionUpdate: update
1652
+ },
1653
+ `${transactionUpdate.key}:${index}:${update.key}`
1654
+ );
1655
+ })
1656
+ ] })
1657
+ ] })
1658
+ ]
1659
+ }
1660
+ );
1661
+ };
1662
+ var TimelineUpdateFC = ({ timelineUpdate, serialNumber }) => {
1663
+ return /* @__PURE__ */ jsxs(
1664
+ "article",
1665
+ {
1666
+ className: "node timeline_update",
1667
+ "data-testid": `timeline-update-${timelineUpdate.key}-${serialNumber}`,
1668
+ children: [
1669
+ /* @__PURE__ */ jsx("header", { children: /* @__PURE__ */ jsxs("h4", { children: [
1670
+ timelineUpdate.timestamp,
2266
1671
  ": ",
2267
- JSON.stringify(transactionUpdate.output)
2268
- ] }) : null
2269
- ] }),
2270
- /* @__PURE__ */ jsxs("section", { className: "transaction_impact", children: [
2271
- /* @__PURE__ */ jsx("span", { className: "detail", children: "impact: " }),
2272
- transactionUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
1672
+ timelineUpdate.type,
1673
+ " (",
1674
+ timelineUpdate.key,
1675
+ ")"
1676
+ ] }) }),
1677
+ /* @__PURE__ */ jsx("main", { children: timelineUpdate.type === `transaction_update` ? timelineUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
2273
1678
  return `newValue` in update ? /* @__PURE__ */ jsx(
2274
1679
  article.AtomUpdate,
2275
1680
  {
2276
1681
  serialNumber: index,
2277
1682
  atomUpdate: update
2278
1683
  },
2279
- `${transactionUpdate.key}:${index}:${update.key}`
1684
+ `${timelineUpdate.key}:${index}:${update.key}`
2280
1685
  ) : /* @__PURE__ */ jsx(
2281
1686
  TransactionUpdateFC,
2282
1687
  {
2283
1688
  serialNumber: index,
2284
1689
  transactionUpdate: update
2285
1690
  },
2286
- `${transactionUpdate.key}:${index}:${update.key}`
1691
+ `${timelineUpdate.key}:${index}:${update.key}`
2287
1692
  );
2288
- })
2289
- ] })
2290
- ] })
2291
- ] });
2292
- };
2293
- var TimelineUpdateFC = ({ timelineUpdate }) => {
2294
- return /* @__PURE__ */ jsxs("article", { className: "node timeline_update", children: [
2295
- /* @__PURE__ */ jsx("header", { children: /* @__PURE__ */ jsxs("h4", { children: [
2296
- timelineUpdate.timestamp,
2297
- ": ",
2298
- timelineUpdate.type,
2299
- " (",
2300
- timelineUpdate.key,
2301
- ")"
2302
- ] }) }),
2303
- /* @__PURE__ */ jsx("main", { children: timelineUpdate.type === `transaction_update` ? timelineUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
2304
- return `newValue` in update ? /* @__PURE__ */ jsx(
2305
- article.AtomUpdate,
2306
- {
2307
- serialNumber: index,
2308
- atomUpdate: update
2309
- },
2310
- `${timelineUpdate.key}:${index}:${update.key}`
2311
- ) : /* @__PURE__ */ jsx(
2312
- TransactionUpdateFC,
2313
- {
2314
- serialNumber: index,
2315
- transactionUpdate: update
2316
- },
2317
- `${timelineUpdate.key}:${index}:${update.key}`
2318
- );
2319
- }) : timelineUpdate.type === `selector_update` ? timelineUpdate.atomUpdates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((atomUpdate, index) => {
2320
- return /* @__PURE__ */ jsx(
2321
- article.AtomUpdate,
2322
- {
2323
- serialNumber: index,
2324
- atomUpdate
2325
- },
2326
- `${timelineUpdate.key}:${index}:${atomUpdate.key}`
2327
- );
2328
- }) : timelineUpdate.type === `atom_update` ? /* @__PURE__ */ jsx(
2329
- article.AtomUpdate,
2330
- {
2331
- serialNumber: timelineUpdate.timestamp,
2332
- atomUpdate: timelineUpdate
2333
- }
2334
- ) : null })
2335
- ] });
1693
+ }) : timelineUpdate.type === `selector_update` ? timelineUpdate.atomUpdates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((atomUpdate, index) => {
1694
+ return /* @__PURE__ */ jsx(
1695
+ article.AtomUpdate,
1696
+ {
1697
+ serialNumber: index,
1698
+ atomUpdate
1699
+ },
1700
+ `${timelineUpdate.key}:${index}:${atomUpdate.key}`
1701
+ );
1702
+ }) : timelineUpdate.type === `atom_update` ? /* @__PURE__ */ jsx(
1703
+ article.AtomUpdate,
1704
+ {
1705
+ serialNumber: timelineUpdate.timestamp,
1706
+ atomUpdate: timelineUpdate
1707
+ }
1708
+ ) : null })
1709
+ ]
1710
+ }
1711
+ );
2336
1712
  };
2337
1713
  var article = {
2338
1714
  AtomUpdate: AtomUpdateFC,
@@ -2346,9 +1722,16 @@ var TimelineLog = ({ token, isOpenState, timelineState }) => {
2346
1722
  const timeline = useO(timelineState);
2347
1723
  const isOpen = useO(isOpenState);
2348
1724
  const setIsOpen = useI(isOpenState);
2349
- return /* @__PURE__ */ jsxs("section", { className: "node timeline_log", children: [
1725
+ return /* @__PURE__ */ jsxs("section", { className: "node timeline_log", "data-testid": `timeline-${token.key}`, children: [
2350
1726
  /* @__PURE__ */ jsxs("header", { children: [
2351
- /* @__PURE__ */ jsx(button.OpenClose, { isOpen, setIsOpen }),
1727
+ /* @__PURE__ */ jsx(
1728
+ button.OpenClose,
1729
+ {
1730
+ isOpen,
1731
+ testid: `open-close-timeline-${token.key}`,
1732
+ setIsOpen
1733
+ }
1734
+ ),
2352
1735
  /* @__PURE__ */ jsxs("label", { children: [
2353
1736
  /* @__PURE__ */ jsx("h2", { children: token.key }),
2354
1737
  /* @__PURE__ */ jsxs("span", { className: "detail length", children: [
@@ -2364,7 +1747,9 @@ var TimelineLog = ({ token, isOpenState, timelineState }) => {
2364
1747
  "button",
2365
1748
  {
2366
1749
  type: "button",
2367
- onClick: () => undo(token),
1750
+ onClick: () => {
1751
+ undo(token);
1752
+ },
2368
1753
  disabled: timeline.at === 0,
2369
1754
  children: "undo"
2370
1755
  }
@@ -2373,7 +1758,9 @@ var TimelineLog = ({ token, isOpenState, timelineState }) => {
2373
1758
  "button",
2374
1759
  {
2375
1760
  type: "button",
2376
- onClick: () => redo(token),
1761
+ onClick: () => {
1762
+ redo(token);
1763
+ },
2377
1764
  disabled: timeline.at === timeline.history.length,
2378
1765
  children: "redo"
2379
1766
  }
@@ -2383,14 +1770,20 @@ var TimelineLog = ({ token, isOpenState, timelineState }) => {
2383
1770
  ] }),
2384
1771
  isOpen ? /* @__PURE__ */ jsx("main", { children: timeline.history.map((update, index) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
2385
1772
  index === timeline.at ? /* @__PURE__ */ jsx(YouAreHere, {}) : null,
2386
- /* @__PURE__ */ jsx(article.TimelineUpdate, { timelineUpdate: update }),
1773
+ /* @__PURE__ */ jsx(
1774
+ article.TimelineUpdate,
1775
+ {
1776
+ timelineUpdate: update,
1777
+ serialNumber: index
1778
+ }
1779
+ ),
2387
1780
  index === timeline.history.length - 1 && timeline.at === timeline.history.length ? /* @__PURE__ */ jsx(YouAreHere, {}) : null
2388
1781
  ] }, update.key + index + timeline.at)) }) : null
2389
1782
  ] });
2390
1783
  };
2391
1784
  var TimelineIndex = () => {
2392
1785
  const tokenIds = useO(timelineIndex);
2393
- return /* @__PURE__ */ jsx("article", { className: "index timeline_index", children: tokenIds.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((token) => {
1786
+ return /* @__PURE__ */ jsx("article", { className: "index timeline_index", "data-testid": "timeline-index", children: tokenIds.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((token) => {
2394
1787
  return /* @__PURE__ */ jsx(
2395
1788
  TimelineLog,
2396
1789
  {
@@ -2406,31 +1799,45 @@ var TransactionLog = ({ token, isOpenState, logState }) => {
2406
1799
  const log = useO(logState);
2407
1800
  const isOpen = useO(isOpenState);
2408
1801
  const setIsOpen = useI(isOpenState);
2409
- return /* @__PURE__ */ jsxs("section", { className: "node transaction_log", children: [
2410
- /* @__PURE__ */ jsxs("header", { children: [
2411
- /* @__PURE__ */ jsx(button.OpenClose, { isOpen, setIsOpen }),
2412
- /* @__PURE__ */ jsxs("label", { children: [
2413
- /* @__PURE__ */ jsx("h2", { children: token.key }),
2414
- /* @__PURE__ */ jsxs("span", { className: "detail length", children: [
2415
- "(",
2416
- log.length,
2417
- ")"
2418
- ] })
2419
- ] })
2420
- ] }),
2421
- isOpen ? /* @__PURE__ */ jsx("main", { children: log.map((update, index) => /* @__PURE__ */ jsx(
2422
- article.TransactionUpdate,
2423
- {
2424
- serialNumber: index,
2425
- transactionUpdate: update
2426
- },
2427
- update.key + index
2428
- )) }) : null
2429
- ] });
1802
+ return /* @__PURE__ */ jsxs(
1803
+ "section",
1804
+ {
1805
+ className: "node transaction_log",
1806
+ "data-testid": `transaction-${token.key}`,
1807
+ children: [
1808
+ /* @__PURE__ */ jsxs("header", { children: [
1809
+ /* @__PURE__ */ jsx(
1810
+ button.OpenClose,
1811
+ {
1812
+ isOpen,
1813
+ testid: `open-close-transaction-${token.key}`,
1814
+ setIsOpen
1815
+ }
1816
+ ),
1817
+ /* @__PURE__ */ jsxs("label", { children: [
1818
+ /* @__PURE__ */ jsx("h2", { children: token.key }),
1819
+ /* @__PURE__ */ jsxs("span", { className: "detail length", children: [
1820
+ "(",
1821
+ log.length,
1822
+ ")"
1823
+ ] })
1824
+ ] })
1825
+ ] }),
1826
+ isOpen ? /* @__PURE__ */ jsx("main", { children: log.map((update, index) => /* @__PURE__ */ jsx(
1827
+ article.TransactionUpdate,
1828
+ {
1829
+ serialNumber: index,
1830
+ transactionUpdate: update
1831
+ },
1832
+ update.key + index
1833
+ )) }) : null
1834
+ ]
1835
+ }
1836
+ );
2430
1837
  };
2431
1838
  var TransactionIndex = () => {
2432
1839
  const tokenIds = useO(transactionIndex);
2433
- return /* @__PURE__ */ jsx("article", { className: "index transaction_index", children: tokenIds.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((token) => {
1840
+ return /* @__PURE__ */ jsx("article", { className: "index transaction_index", "data-testid": "transaction-index", children: tokenIds.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((token) => {
2434
1841
  return /* @__PURE__ */ jsx(
2435
1842
  TransactionLog,
2436
1843
  {
@@ -2487,8 +1894,11 @@ var AtomIODevtools = () => {
2487
1894
  "button",
2488
1895
  {
2489
1896
  type: "button",
1897
+ "data-testid": `view-${viewOption}`,
2490
1898
  className: viewOption === devtoolsView ? `active` : ``,
2491
- onClick: () => setDevtoolsView(viewOption),
1899
+ onClick: () => {
1900
+ setDevtoolsView(viewOption);
1901
+ },
2492
1902
  disabled: viewOption === devtoolsView,
2493
1903
  children: viewOption
2494
1904
  },