atom.io 0.18.3 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/data/dist/index.cjs +173 -1
  2. package/data/dist/index.d.ts +52 -21
  3. package/data/dist/index.js +12 -331
  4. package/data/src/join.ts +321 -53
  5. package/dist/{chunk-CVBEVTM5.js → chunk-7VCCW45K.js} +1 -39
  6. package/dist/chunk-7ZR244C2.js +489 -0
  7. package/dist/index.cjs +1 -0
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.js +1 -0
  10. package/internal/dist/index.cjs +1 -1
  11. package/internal/dist/index.d.ts +1 -1
  12. package/internal/dist/index.js +1 -1
  13. package/internal/src/mutable/tracker.ts +1 -1
  14. package/internal/src/set-state/become.ts +1 -1
  15. package/internal/src/subscribe/subscribe-to-state.ts +2 -2
  16. package/internal/src/timeline/add-atom-to-timeline.ts +3 -3
  17. package/internal/src/transaction/build-transaction.ts +1 -1
  18. package/introspection/dist/index.cjs +3 -2
  19. package/introspection/dist/index.d.ts +4 -4
  20. package/introspection/dist/index.js +3 -2
  21. package/introspection/src/attach-atom-index.ts +5 -4
  22. package/introspection/src/index.ts +3 -3
  23. package/json/dist/index.d.ts +1 -1
  24. package/json/dist/index.js +2 -2
  25. package/package.json +18 -19
  26. package/react-devtools/dist/index.cjs +218 -927
  27. package/react-devtools/dist/index.css +0 -18
  28. package/react-devtools/dist/index.d.ts +4 -4
  29. package/react-devtools/dist/index.js +181 -833
  30. package/react-devtools/src/AtomIODevtools.tsx +2 -1
  31. package/react-devtools/src/Button.tsx +3 -1
  32. package/react-devtools/src/StateEditor.tsx +13 -16
  33. package/react-devtools/src/StateIndex.tsx +22 -19
  34. package/react-devtools/src/TimelineIndex.tsx +11 -4
  35. package/react-devtools/src/TransactionIndex.tsx +10 -3
  36. package/react-devtools/src/Updates.tsx +10 -3
  37. package/realtime/dist/index.cjs +4 -2
  38. package/realtime/dist/index.d.ts +1 -96
  39. package/realtime/dist/index.js +5 -3
  40. package/realtime/src/shared-room-store.ts +5 -3
  41. package/realtime-react/dist/index.cjs +1 -1
  42. package/realtime-react/dist/index.js +1 -1
  43. package/realtime-react/src/use-single-effect.ts +1 -1
  44. package/realtime-server/dist/index.cjs +162 -18
  45. package/realtime-server/dist/index.d.ts +2 -92
  46. package/realtime-server/dist/index.js +31 -17
  47. package/realtime-server/src/ipc-sockets/child-socket.ts +1 -1
  48. package/realtime-server/src/realtime-continuity-synchronizer.ts +8 -6
  49. package/realtime-server/src/realtime-server-stores/server-room-external-actions.ts +22 -10
  50. package/realtime-server/src/realtime-server-stores/server-room-external-store.ts +2 -2
  51. package/realtime-testing/dist/index.cjs +48 -6
  52. package/realtime-testing/dist/index.js +10 -3
  53. package/realtime-testing/src/setup-realtime-test.tsx +9 -3
  54. package/src/silo.ts +4 -0
  55. package/src/validators.ts +2 -2
  56. /package/dist/{chunk-VAE5OCKN.js → chunk-BF4MVQF6.js} +0 -0
@@ -2,31 +2,10 @@
2
2
 
3
3
  var atom_io = require('atom.io');
4
4
  var introspection = require('atom.io/introspection');
5
- var react = require('atom.io/react');
5
+ var react$1 = require('atom.io/react');
6
6
  var framerMotion = require('framer-motion');
7
- var React = require('react');
7
+ var react = require('react');
8
8
  var jsxRuntime = require('react/jsx-runtime');
9
- var react$1 = require('@floating-ui/react');
10
-
11
- function _interopNamespace(e) {
12
- if (e && e.__esModule) return e;
13
- var n = Object.create(null);
14
- if (e) {
15
- Object.keys(e).forEach(function (k) {
16
- if (k !== 'default') {
17
- var d = Object.getOwnPropertyDescriptor(e, k);
18
- Object.defineProperty(n, k, d.get ? d : {
19
- enumerable: true,
20
- get: function () { return e[k]; }
21
- });
22
- }
23
- });
24
- }
25
- n.default = e;
26
- return Object.freeze(n);
27
- }
28
-
29
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
30
9
 
31
10
  var __defProp = Object.defineProperty;
32
11
  var __defProps = Object.defineProperties;
@@ -97,18 +76,6 @@ var doNothing = () => void 0;
97
76
  var become = (nextVersionOfThing) => (originalThing) => nextVersionOfThing instanceof Function ? nextVersionOfThing(
98
77
  originalThing instanceof Function ? originalThing() : originalThing
99
78
  ) : nextVersionOfThing;
100
- var isModifier = (validate) => (sample) => {
101
- const sampleIsValid = validate(sample);
102
- if (!sampleIsValid) {
103
- throw new Error(`Invalid test case: JSON.stringify(${sample})`);
104
- }
105
- return (input) => {
106
- if (typeof input !== `function`)
107
- return false;
108
- const testResult = input(sample);
109
- return validate(testResult);
110
- };
111
- };
112
79
  var pass = (...params) => (fn) => fn(...params);
113
80
  var raiseError = (message) => {
114
81
  throw new Error(message);
@@ -121,24 +88,11 @@ var fallback = (fn, fallbackValue) => {
121
88
  }
122
89
  };
123
90
 
124
- // ../anvl/src/array/venn.ts
125
- var includesAll = (items) => (array) => {
126
- for (const item of items) {
127
- if (!array.includes(item))
128
- return false;
129
- }
130
- return true;
131
- };
132
- var comprises = (items) => (array) => includesAll(items)(array) && includesAll(array)(items);
133
-
134
91
  // ../anvl/src/array/index.ts
135
92
  var isArray = (isType) => (input) => Array.isArray(input) && input.every((item) => isType(item));
136
93
  var map = (f) => (a2) => a2.map(f);
137
94
  var every = (f = Boolean) => (a2) => a2.every(f);
138
95
  var allTrue = every((x) => x === true);
139
- var addTo = (a2) => (x) => a2.includes(x) ? a2 : [...a2, x];
140
- var isEmptyArray = (input) => Array.isArray(input) && input.length === 0;
141
- var isOneOf = (...args) => (input) => args.includes(input);
142
96
 
143
97
  // ../anvl/src/nullish/index.ts
144
98
  var isUndefined = (input) => input === void 0;
@@ -166,7 +120,6 @@ var mob = (fn) => (obj) => mapObject(obj, fn);
166
120
  // ../anvl/src/object/refinement.ts
167
121
  var isNonNullObject = (input) => typeof input === `object` && input !== null;
168
122
  var isPlainObject = (input) => isNonNullObject(input) && Object.getPrototypeOf(input) === Object.prototype;
169
- var isEmptyObject = (input) => isPlainObject(input) && Object.keys(input).length === 0;
170
123
  var isRecord = (isKey, isValue) => (input) => isPlainObject(input) && Object.entries(input).every(([k, v]) => isKey(k) && isValue(v));
171
124
  var hasProperties = (isValue, options = { allowExtraProperties: false }) => {
172
125
  const name = `{${recordToEntries(
@@ -195,8 +148,6 @@ var hasProperties = (isValue, options = { allowExtraProperties: false }) => {
195
148
  };
196
149
  var ALLOW_EXTENSION = { allowExtraProperties: true };
197
150
  var doesExtend = (isValue) => hasProperties(isValue, ALLOW_EXTENSION);
198
- var DO_NOT_ALLOW_EXTENSION = { allowExtraProperties: false };
199
- var hasExactProperties = (isValue) => hasProperties(isValue, DO_NOT_ALLOW_EXTENSION);
200
151
 
201
152
  // ../anvl/src/object/sprawl.ts
202
153
  var sprawl = (tree, inspector) => {
@@ -224,16 +175,6 @@ var sprawl = (tree, inspector) => {
224
175
  };
225
176
 
226
177
  // ../anvl/src/object/index.ts
227
- var treeShake = (shouldDiscard = isUndefined) => (obj) => {
228
- const newObj = {};
229
- const entries = Object.entries(obj);
230
- for (const [key, val] of entries) {
231
- if (!shouldDiscard(val, key)) {
232
- newObj[key] = val;
233
- }
234
- }
235
- return newObj;
236
- };
237
178
  var delve = (obj, path) => {
238
179
  const found = path.reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
239
180
  return found === void 0 ? new Error(`Not found`) : { found };
@@ -526,11 +467,12 @@ var persistAtom = (storage) => ({ stringify, parse }) => (key) => ({ setSelf, on
526
467
  });
527
468
  };
528
469
  var lazyLocalStorageEffect = persistAtom(window.localStorage)(JSON);
529
- var OpenClose = ({ isOpen, setIsOpen, disabled }) => {
470
+ var OpenClose = ({ isOpen, setIsOpen, disabled, testid }) => {
530
471
  return /* @__PURE__ */ jsxRuntime.jsx(
531
472
  "button",
532
473
  {
533
474
  type: "button",
475
+ "data-testid": testid,
534
476
  className: `carat ${isOpen ? `open` : `closed`}`,
535
477
  onClick: () => setIsOpen((isOpen2) => !isOpen2),
536
478
  disabled,
@@ -541,307 +483,12 @@ var OpenClose = ({ isOpen, setIsOpen, disabled }) => {
541
483
  var button = {
542
484
  OpenClose
543
485
  };
544
-
545
- // ../anvl/src/join/core-relation-data.ts
546
- var RELATION_TYPES = [`1:1`, `1:n`, `n:n`];
547
- var isRelationType = (x) => RELATION_TYPES.includes(x);
548
- var EMPTY_RELATION_DATA = {
549
- contents: {},
550
- relations: {},
551
- relationType: `n:n`,
552
- a: `from`,
553
- b: `to`
554
- };
555
- var isRelationData = ({
556
- from: a2 = `from`,
557
- to: b2 = `to`,
558
- isContent
559
- } = {}) => (input) => {
560
- return hasExactProperties({
561
- contents: isContent ? isRecord(isString, isContent) : hasExactProperties({}),
562
- relations: isRecord(isString, isArray(isString)),
563
- relationType: isRelationType,
564
- a: isLiteral(a2),
565
- b: isLiteral(b2)
566
- })(input);
567
- };
568
-
569
- // ../anvl/src/join/get-related-ids.ts
570
- var getRelatedIds = (relationMap, id) => {
571
- var _a2;
572
- return (_a2 = relationMap.relations[id]) != null ? _a2 : [];
573
- };
574
- var getRelatedId = (relationMap, id) => {
575
- const relations = getRelatedIds(relationMap, id);
576
- if (relations.length > 1) {
577
- console.warn(
578
- `entry with id ${id} was not expected to have multiple relations`
579
- );
580
- }
581
- return relations[0];
582
- };
583
-
584
- // ../anvl/src/join/make-json-interface.ts
585
- var makeJsonInterface = (join, ...params) => {
586
- const isContent = params[0];
587
- const { a: a2, b: b2 } = join;
588
- const options = {
589
- from: a2,
590
- to: b2,
591
- isContent
592
- };
593
- return {
594
- toJson: (join2) => join2.toJSON(),
595
- fromJson: (json) => Join.fromJSON(json, options)
596
- };
597
- };
598
-
599
- // ../anvl/src/join/relation-record.ts
600
- var getRelationEntries = (relationMap, idA) => getRelatedIds(relationMap, idA).map((idB) => [
601
- idB,
602
- getContent(relationMap, idA, idB)
603
- ]);
604
- var getRelationRecord = (relationMap, id) => Object.fromEntries(getRelationEntries(relationMap, id));
605
-
606
- // ../anvl/src/string/split.ts
607
- var split = (separator) => (str) => str.split(separator);
608
-
609
- // ../anvl/src/join/remove-relation.ts
610
- var removeSpecific = (current, idA, idB) => {
611
- const isIdForRemoval = isOneOf(idA, idB);
612
- return __spreadProps(__spreadValues({}, current), {
613
- relations: pipe(
614
- current.relations,
615
- recordToEntries,
616
- map(([id, relations]) => [
617
- id,
618
- isIdForRemoval(id) ? relations.filter((relation) => !isIdForRemoval(relation)) : relations
619
- ]),
620
- entriesToRecord,
621
- treeShake(isEmptyArray)
622
- ),
623
- contents: pipe(
624
- current.contents,
625
- treeShake(
626
- (_, key) => isString(key) && pipe(key, split(`/`), comprises([idA, idB]))
627
- )
628
- )
629
- });
630
- };
631
- var removeAll = (current, idToRemove) => {
632
- const next = __spreadProps(__spreadValues({}, current), {
633
- relations: pipe(
634
- current.relations,
635
- recordToEntries,
636
- map(([id, relations]) => [
637
- id,
638
- relations.filter((relation) => relation !== idToRemove)
639
- ]),
640
- entriesToRecord,
641
- treeShake((val, key) => key === idToRemove || isEmptyArray(val))
642
- ),
643
- contents: pipe(
644
- current.contents,
645
- treeShake(
646
- (_, key) => isString(key) && key.split(`/`).includes(idToRemove)
647
- )
648
- )
649
- });
650
- return next;
651
- };
652
- var removeRelation = (current, relation) => {
653
- const idA = relation[current.a];
654
- const idB = relation[current.b];
655
- return idB ? removeSpecific(current, idA, idB) : removeAll(current, idA);
656
- };
657
-
658
- // ../anvl/src/join/set-relation.ts
659
- var setManyToMany = (map2, idA, idB, ...rest) => {
660
- var _a2, _b;
661
- const next = __spreadProps(__spreadValues({}, map2), {
662
- relations: __spreadProps(__spreadValues({}, map2.relations), {
663
- [idA]: addTo((_a2 = map2.relations[idA]) != null ? _a2 : [])(idB),
664
- [idB]: addTo((_b = map2.relations[idB]) != null ? _b : [])(idA)
665
- })
666
- });
667
- const content = rest[0];
668
- return content ? setContent(next, idA, idB, content) : next;
669
- };
670
- var removeEmpties = treeShake(isEmptyArray);
671
- var set1ToMany = (current, leaderId, followerId, ...rest) => {
672
- var _a2;
673
- const relations = __spreadValues({}, current.relations);
674
- const prevLeaderId = getRelatedId(current, followerId);
675
- const next = __spreadProps(__spreadValues({}, current), {
676
- relations: removeEmpties(__spreadProps(__spreadValues(__spreadValues({}, relations), prevLeaderId && prevLeaderId !== leaderId && {
677
- [prevLeaderId]: relations[prevLeaderId].filter(
678
- (id) => id !== followerId
679
- )
680
- }), {
681
- [followerId]: [leaderId],
682
- [leaderId]: addTo((_a2 = relations[leaderId]) != null ? _a2 : [])(followerId)
683
- }))
684
- });
685
- const content = rest[0];
686
- return content ? setContent(next, leaderId, followerId, content) : next;
687
- };
688
- var set1To1 = (current, wifeId, husbandId, ...rest) => {
689
- const prevWifeId = getRelatedId(current, husbandId);
690
- const prevHusbandId = getRelatedId(current, wifeId);
691
- const next = __spreadProps(__spreadValues({}, current), {
692
- relations: removeEmpties(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, current.relations), prevWifeId && { [prevWifeId]: [] }), prevHusbandId && { [prevHusbandId]: [] }), {
693
- [wifeId]: [husbandId],
694
- [husbandId]: [wifeId]
695
- }))
696
- });
697
- const content = rest[0];
698
- return content ? setContent(next, wifeId, husbandId, content) : next;
699
- };
700
- var setRelationWithContent = (current, relation, ...rest) => {
701
- const { [current.a]: idA, [current.b]: idB } = relation;
702
- switch (current.relationType) {
703
- case `1:1`:
704
- return set1To1(current, idA, idB, ...rest);
705
- case `1:n`:
706
- return set1ToMany(current, idA, idB, ...rest);
707
- case `n:n`:
708
- return setManyToMany(current, idA, idB, ...rest);
709
- }
710
- };
711
-
712
- // ../anvl/src/join/relation-contents.ts
713
- var makeContentId = (idA, idB) => [idA, idB].sort().join(`/`);
714
- var getContent = (relationMap, idA, idB) => relationMap.contents[makeContentId(idA, idB)];
715
- var setContent = (map2, idA, idB, content) => __spreadProps(__spreadValues({}, map2), {
716
- contents: __spreadProps(__spreadValues({}, map2.contents), {
717
- [makeContentId(idA, idB)]: content
718
- })
719
- });
720
- var getRelations = (relationMap, id) => getRelationEntries(relationMap, id).map(
721
- ([id2, content]) => __spreadValues({
722
- id: id2
723
- }, content)
724
- );
725
- var setRelations = (current, subject, relations) => {
726
- const idA = subject[current.a];
727
- const idB = subject[current.b];
728
- return pipe(
729
- current,
730
- (relationData) => {
731
- const relatedIds = getRelatedIds(current, idA);
732
- const removedIds = relatedIds.filter(
733
- (id) => !relations.some((r) => r.id === id)
734
- );
735
- let step = relationData;
736
- for (const id of removedIds) {
737
- const remove = {
738
- [current.a]: idA != null ? idA : id,
739
- [current.b]: idB != null ? idB : id
740
- };
741
- step = removeRelation(step, remove);
742
- }
743
- return step;
744
- },
745
- (relationData) => {
746
- let step = relationData;
747
- for (const _a2 of relations) {
748
- const _b = _a2, { id } = _b, rest = __objRest(_b, ["id"]);
749
- const content = isEmptyObject(rest) ? void 0 : rest;
750
- step = setRelationWithContent(
751
- step,
752
- { [current.a]: idA != null ? idA : id, [current.b]: idB != null ? idB : id },
753
- // @ts-expect-error hacky
754
- content
755
- );
756
- }
757
- return step;
758
- },
759
- (relationData) => {
760
- const newlyOrderedIds = relations.map((r) => r.id);
761
- return __spreadProps(__spreadValues({}, relationData), {
762
- relations: __spreadProps(__spreadValues({}, relationData.relations), {
763
- [idA != null ? idA : idB]: newlyOrderedIds
764
- })
765
- });
766
- }
767
- );
768
- };
769
-
770
- // ../anvl/src/join/index.ts
771
- var Join = class _Join {
772
- constructor(json) {
773
- this.a = `from`;
774
- this.b = `to`;
775
- this.makeJsonInterface = (...params) => {
776
- return makeJsonInterface(this, ...params);
777
- };
778
- Object.assign(this, __spreadProps(__spreadValues(__spreadValues({}, EMPTY_RELATION_DATA), json), {
779
- makeJsonInterface: this.makeJsonInterface
780
- }));
781
- }
782
- toJSON() {
783
- return {
784
- relationType: this.relationType,
785
- relations: this.relations,
786
- contents: this.contents,
787
- a: this.a,
788
- b: this.b
789
- };
790
- }
791
- static fromJSON(json, options) {
792
- const isValid = isRelationData(options)(json);
793
- if (isValid) {
794
- return new _Join(json);
795
- }
796
- throw new Error(
797
- `Saved JSON for this Join is invalid: ${JSON.stringify(json)}`
798
- );
799
- }
800
- from(newA) {
801
- return new _Join(__spreadProps(__spreadValues({}, this), { a: newA }));
802
- }
803
- to(newB) {
804
- return new _Join(__spreadProps(__spreadValues({}, this), { b: newB }));
805
- }
806
- getRelatedId(id) {
807
- return getRelatedId(this, id);
808
- }
809
- getRelatedIds(id) {
810
- return getRelatedIds(this, id);
811
- }
812
- getContent(idA, idB) {
813
- return getContent(this, idA, idB);
814
- }
815
- getRelationEntries(id) {
816
- return getRelationEntries(this, id);
817
- }
818
- getRelationRecord(id) {
819
- return getRelationRecord(this, id);
820
- }
821
- getRelation(id) {
822
- return getRelations(this, id)[0];
823
- }
824
- getRelations(id) {
825
- return getRelations(this, id);
826
- }
827
- setRelations(subject, relations) {
828
- return new _Join(setRelations(this, subject, relations));
829
- }
830
- set(relation, ...rest) {
831
- return new _Join(setRelationWithContent(this, relation, ...rest));
832
- }
833
- remove(relation) {
834
- return new _Join(
835
- removeRelation(this, relation)
836
- );
837
- }
838
- };
839
- var ElasticInput = React.forwardRef(function ElasticInputFC(props, ref) {
486
+ var ElasticInput = react.forwardRef(function ElasticInputFC(props, ref) {
840
487
  var _a2, _b, _c, _d;
841
- const inputRef = React.useRef(null);
842
- const spanRef = React.useRef(null);
843
- const [inputWidth, setInputWidth] = React.useState(`auto`);
844
- React.useImperativeHandle(
488
+ const inputRef = react.useRef(null);
489
+ const spanRef = react.useRef(null);
490
+ const [inputWidth, setInputWidth] = react.useState(`auto`);
491
+ react.useImperativeHandle(
845
492
  ref,
846
493
  () => ({
847
494
  focus: () => {
@@ -851,7 +498,7 @@ var ElasticInput = React.forwardRef(function ElasticInputFC(props, ref) {
851
498
  })
852
499
  );
853
500
  const extraWidth = props.type === `number` ? 15 : 0;
854
- React.useLayoutEffect(() => {
501
+ react.useLayoutEffect(() => {
855
502
  if (spanRef.current) {
856
503
  setInputWidth(`${spanRef.current.offsetWidth + extraWidth}px`);
857
504
  const interval = setInterval(() => {
@@ -898,9 +545,6 @@ var ElasticInput = React.forwardRef(function ElasticInputFC(props, ref) {
898
545
 
899
546
  // ../anvl/src/number/clamp.ts
900
547
  var clampInto = (min, max) => (value) => value < min ? min : value > max ? max : value;
901
-
902
- // ../anvl/src/number/wrap.ts
903
- var wrapInto = (min, max) => (value) => value < min ? max - (min - value) % (max - min) : min + (value - min) % (max - min);
904
548
  function round(value, decimalPlaces) {
905
549
  if (decimalPlaces === void 0)
906
550
  return value;
@@ -919,11 +563,11 @@ var isDecimalInProgress = (input) => input === `0` || !Number.isNaN(Number(input
919
563
  var textToValue = (input, allowDecimal) => {
920
564
  if (isValidNonNumber(input))
921
565
  return VALID_NON_NUMBER_INTERPRETATIONS[input];
922
- return allowDecimal ? parseFloat(input) : Math.round(parseFloat(input));
566
+ return allowDecimal ? Number.parseFloat(input) : Math.round(Number.parseFloat(input));
923
567
  };
924
568
  var DEFAULT_NUMBER_CONSTRAINTS = {
925
- max: Infinity,
926
- min: -Infinity,
569
+ max: Number.POSITIVE_INFINITY,
570
+ min: Number.NEGATIVE_INFINITY,
927
571
  decimalPlaces: 100,
928
572
  nullable: true
929
573
  };
@@ -960,9 +604,9 @@ var NumberInput = ({
960
604
  testId,
961
605
  value = null
962
606
  }) => {
963
- const id = React.useId();
964
- const [temporaryEntry, setTemporaryEntry] = React.useState(null);
965
- const userHasMadeDeliberateChange = React.useRef(false);
607
+ const id = react.useId();
608
+ const [temporaryEntry, setTemporaryEntry] = react.useState(null);
609
+ const userHasMadeDeliberateChange = react.useRef(false);
966
610
  const refine = initRefinery({ max, min, decimalPlaces, nullable: true });
967
611
  const allowDecimal = decimalPlaces === void 0 || decimalPlaces > 0;
968
612
  const handleBlur = () => {
@@ -1194,7 +838,7 @@ var Int = Object.assign((input) => parseInteger(input), {
1194
838
  from: (input) => pipe(
1195
839
  input,
1196
840
  String,
1197
- parseFloat,
841
+ Number.parseFloat,
1198
842
  (num) => isInteger(num) ? {
1199
843
  value: num,
1200
844
  error: null,
@@ -1675,7 +1319,7 @@ var ObjectEditor = ({
1675
1319
  }) => {
1676
1320
  var _a2;
1677
1321
  const disabled = isReadonly(path);
1678
- const stableKeyMap = React.useRef(
1322
+ const stableKeyMap = react.useRef(
1679
1323
  Object.keys(data).reduce(
1680
1324
  (acc, key) => {
1681
1325
  acc[key] = key;
@@ -1841,7 +1485,7 @@ var DefaultFallback = ({ error, errorInfo }) => {
1841
1485
  }
1842
1486
  );
1843
1487
  };
1844
- var ErrorBoundary = class extends React.Component {
1488
+ var ErrorBoundary = class extends react.Component {
1845
1489
  constructor(props) {
1846
1490
  super(props);
1847
1491
  this.state = {};
@@ -1948,419 +1592,19 @@ var SubEditors = {
1948
1592
  object: ObjectEditor,
1949
1593
  string: StringEditor
1950
1594
  };
1951
-
1952
- // ../anvl/src/string/string-to-color.ts
1953
- function stringToColor(input) {
1954
- let hash = 0;
1955
- for (let i = 0; i < input.length; i++) {
1956
- const char = input.charCodeAt(i);
1957
- hash = (hash << 5) - hash + char;
1958
- hash |= 0;
1959
- }
1960
- let hexColor = (hash & 16777215).toString(16);
1961
- while (hexColor.length < 6) {
1962
- hexColor = `0` + hexColor;
1963
- }
1964
- return `#${hexColor}`;
1965
- }
1966
-
1967
- // ../luum/src/constants/index.ts
1968
- var CHANNEL_SPECIFIC_LUM = {
1969
- R: 0.3,
1970
- G: 0.5,
1971
- B: 0.2
1972
- };
1973
-
1974
- // ../luum/src/constants/filters.ts
1975
- var unfiltered = [
1976
- { sat: 255, hue: 0 },
1977
- { sat: 255, hue: 360 }
1978
- ];
1979
-
1980
- // ../luum/src/export/channelsToHex.ts
1981
- var channelsToHex = (channels) => `#${Object.values(channels).map((channel) => {
1982
- let channelHex = channel.toString(16);
1983
- if (channelHex.length === 1)
1984
- channelHex = 0 + channelHex;
1985
- return channelHex;
1986
- }).join(``)}`;
1987
- var channelsToHex_default = channelsToHex;
1988
-
1989
- // ../luum/src/import/hueToRelativeChannels.ts
1990
- var hueToRelativeChannels_default = (hue) => {
1991
- const hueWrapped = wrapInto(0, 360)(hue);
1992
- const hueReduced = hueWrapped / 60;
1993
- const hueInteger = Math.floor(hueReduced);
1994
- const hueDecimal = hueReduced - hueInteger;
1995
- const x = hueDecimal;
1996
- const y = 1 - hueDecimal;
1997
- switch (hueInteger) {
1998
- case 0:
1999
- return [1, x, 0];
2000
- case 1:
2001
- return [y, 1, 0];
2002
- case 2:
2003
- return [0, 1, x];
2004
- case 3:
2005
- return [0, y, 1];
2006
- case 4:
2007
- return [x, 0, 1];
2008
- case 5:
2009
- return [1, 0, y];
2010
- default:
2011
- throw new Error(`invalid hue served: ${hue}`);
2012
- }
2013
- };
2014
-
2015
- // ../luum/src/solveFor/hueFromChannels.ts
2016
- var hueFromChannels = ({ R, G, B }) => {
2017
- let hue = 0;
2018
- if (R > G && G >= B)
2019
- hue = 60 * (0 + (G - B) / (R - B));
2020
- if (G >= R && R > B)
2021
- hue = 60 * (2 - (R - B) / (G - B));
2022
- if (G > B && B >= R)
2023
- hue = 60 * (2 + (B - R) / (G - R));
2024
- if (B >= G && G > R)
2025
- hue = 60 * (4 - (G - R) / (B - R));
2026
- if (B > R && R >= G)
2027
- hue = 60 * (4 + (R - G) / (B - G));
2028
- if (R >= B && B > G)
2029
- hue = 60 * (6 - (B - G) / (R - G));
2030
- return hue;
2031
- };
2032
- var hueFromChannels_default = hueFromChannels;
2033
-
2034
- // ../luum/src/solveFor/lumFromChannels.ts
2035
- var lumFromChannels = ({ R, G, B }) => {
2036
- const lum = CHANNEL_SPECIFIC_LUM.R * R / 255 + CHANNEL_SPECIFIC_LUM.G * G / 255 + CHANNEL_SPECIFIC_LUM.B * B / 255;
2037
- return lum;
2038
- };
2039
- var lumFromChannels_default = lumFromChannels;
2040
-
2041
- // ../luum/src/solveFor/maxSatForHueInFilter.ts
2042
- var maxSatForHueInFilter_default = (hue, filter) => {
2043
- let maxSat = 255;
2044
- const hueWrapped = wrapInto(0, 360)(hue);
2045
- for (let a2 = -1, b2 = 0; b2 < filter.length; a2++, b2++) {
2046
- a2 = wrapInto(0, filter.length)(a2);
2047
- const hueDoubleWrapped = a2 > b2 ? wrapInto(-180, 180)(hueWrapped) : void 0;
2048
- const tuningPointA = filter[a2];
2049
- const tuningPointB = filter[b2];
2050
- const hueA = a2 > b2 ? wrapInto(-180, 180)(tuningPointA.hue) : tuningPointA.hue;
2051
- const hueB = tuningPointB.hue;
2052
- if ((hueDoubleWrapped || hueWrapped) >= hueA && (hueDoubleWrapped || hueWrapped) < hueB) {
2053
- let $ = hueDoubleWrapped || hueWrapped;
2054
- $ -= hueA;
2055
- $ /= hueB - hueA;
2056
- $ *= tuningPointB.sat - tuningPointA.sat;
2057
- $ += tuningPointA.sat;
2058
- maxSat = $;
2059
- }
2060
- }
2061
- return maxSat;
2062
- };
2063
-
2064
- // ../luum/src/solveFor/satFromChannels.ts
2065
- var satFromChannels = ({ R, G, B }) => {
2066
- const sat = Math.max(R, G, B) - Math.min(R, G, B);
2067
- return sat;
2068
- };
2069
- var satFromChannels_default = satFromChannels;
2070
-
2071
- // ../luum/src/solveFor/specificLumFromHue.ts
2072
- var specificLumFromHue_default = (hue) => {
2073
- const [factorR, factorG, factorB] = hueToRelativeChannels_default(hue);
2074
- const lumR = CHANNEL_SPECIFIC_LUM.R * factorR;
2075
- const lumG = CHANNEL_SPECIFIC_LUM.G * factorG;
2076
- const lumB = CHANNEL_SPECIFIC_LUM.B * factorB;
2077
- const specificLum = lumR + lumG + lumB;
2078
- return specificLum;
2079
- };
2080
-
2081
- // ../luum/src/export/specToChannelsFixLimit.ts
2082
- var minChannelsForSaturationFromHue = (hue) => {
2083
- const relativeChannels = hueToRelativeChannels_default(hue);
2084
- const channelSpreader = (trueSaturation) => {
2085
- const makeMinChannel = (idx) => Math.round(relativeChannels[idx] * trueSaturation);
2086
- return {
2087
- R: makeMinChannel(0),
2088
- G: makeMinChannel(1),
2089
- B: makeMinChannel(2)
2090
- };
2091
- };
2092
- return channelSpreader;
2093
- };
2094
- var channelsFromIlluminationObj = ({
2095
- minChannels,
2096
- trueLuminosity,
2097
- minLum
2098
- }) => {
2099
- const { max, round: round2 } = Math;
2100
- const maxWhite = 255 - max(...Object.values(minChannels));
2101
- const white = clampInto(0, maxWhite)(round2((trueLuminosity - minLum) * 255));
2102
- const channels = {
2103
- R: minChannels.R + white,
2104
- G: minChannels.G + white,
2105
- B: minChannels.B + white
2106
- };
2107
- return channels;
2108
- };
2109
- var specToChannelsFixLimit = ({ hue, sat, lum, prefer = `lum` }, filter = unfiltered) => {
2110
- const minChannelsForSaturation = minChannelsForSaturationFromHue(hue);
2111
- let trueSaturation;
2112
- let trueLuminosity;
2113
- let minChannels;
2114
- let maxChannels;
2115
- let specificLum;
2116
- let minLum = 0;
2117
- let maxLum = 1;
2118
- let maxSat = maxSatForHueInFilter_default(hue, filter);
2119
- switch (prefer) {
2120
- case `sat`:
2121
- trueSaturation = clampInto(0, 255)(Math.min(sat, maxSat));
2122
- minChannels = minChannelsForSaturation(trueSaturation);
2123
- maxChannels = {
2124
- R: minChannels.R + 255 - trueSaturation,
2125
- G: minChannels.G + 255 - trueSaturation,
2126
- B: minChannels.B + 255 - trueSaturation
2127
- };
2128
- minLum = lumFromChannels_default(minChannels);
2129
- maxLum = lumFromChannels_default(maxChannels);
2130
- trueLuminosity = clampInto(minLum, maxLum)(lum);
2131
- break;
2132
- case `lum`:
2133
- trueLuminosity = clampInto(0, 1)(lum);
2134
- specificLum = specificLumFromHue_default(hue);
2135
- maxSat = Math.min(
2136
- maxSat,
2137
- Math.round(
2138
- trueLuminosity <= specificLum ? 255 * (trueLuminosity / specificLum) : 255 * (1 - trueLuminosity) / (1 - specificLum)
2139
- )
2140
- );
2141
- trueSaturation = Math.min(sat, maxSat);
2142
- minChannels = minChannelsForSaturation(trueSaturation);
2143
- minLum = lumFromChannels_default(minChannels);
2144
- break;
2145
- }
2146
- const channels = channelsFromIlluminationObj({
2147
- minChannels,
2148
- trueLuminosity,
2149
- minLum
2150
- });
2151
- return {
2152
- channels,
2153
- fix: {
2154
- sat: trueSaturation,
2155
- lum: trueLuminosity
2156
- },
2157
- limit: {
2158
- sat: [0, maxSat],
2159
- lum: [prefer === `lum` ? 0 : minLum, maxLum]
2160
- }
2161
- };
2162
- };
2163
- var specToChannelsFixLimit_default = specToChannelsFixLimit;
2164
-
2165
- // ../luum/src/export/specToHexFixLimit.ts
2166
- var specToHexFixLimit = ({ hue, sat, lum, prefer }, filter) => {
2167
- const { channels, fix, limit } = specToChannelsFixLimit_default(
2168
- {
2169
- hue,
2170
- sat,
2171
- lum,
2172
- prefer
2173
- },
2174
- filter
2175
- );
2176
- const { R, G, B } = channels;
2177
- const hex = channelsToHex_default({ R, G, B });
2178
- return { hex, fix, limit };
2179
- };
2180
- var specToHexFixLimit_default = specToHexFixLimit;
2181
-
2182
- // ../luum/src/export/specToHex.ts
2183
- var specToHex = ({ hue, sat, lum, prefer }, filter) => {
2184
- const { hex } = specToHexFixLimit_default({ hue, sat, lum, prefer }, filter);
2185
- return hex;
2186
- };
2187
- var specToHex_default = specToHex;
2188
-
2189
- // ../luum/src/import/channelsToSpec.ts
2190
- var channelsToSpec = ({ R, G, B }) => {
2191
- const hue = hueFromChannels_default({ R, G, B });
2192
- const sat = satFromChannels_default({ R, G, B });
2193
- const lum = lumFromChannels_default({ R, G, B });
2194
- return { hue, sat, lum };
2195
- };
2196
- var channelsToSpec_default = channelsToSpec;
2197
-
2198
- // ../luum/src/import/normalizeHex.ts
2199
- var BASE_16_CHAR_SET = `[a-fA-F0-9]+`;
2200
- var miniHexToHex = (miniHex) => {
2201
- const miniHexArray = miniHex.split(``);
2202
- const hexTemplate = [0, 0, 1, 1, 2, 2];
2203
- return hexTemplate.map((idx) => miniHexArray[idx]).join(``);
2204
- };
2205
- var normalizeHex = (maybeHex) => {
2206
- const hex = maybeHex.replace(/^#/, ``);
2207
- const hexIsCorrectLength = hex.length === 6 || hex.length === 3;
2208
- const hexIsCorrectCharSet = hex.match(new RegExp(`^${BASE_16_CHAR_SET}$`)) !== null;
2209
- const hexIsValid = hexIsCorrectLength && hexIsCorrectCharSet;
2210
- if (!hexIsValid) {
2211
- throw new Error(`${maybeHex} is not a valid hex code`);
2212
- }
2213
- if (hex.length === 3) {
2214
- return miniHexToHex(hex);
2215
- }
2216
- return hex;
2217
- };
2218
- var normalizeHex_default = normalizeHex;
2219
-
2220
- // ../luum/src/import/hexToChannels.ts
2221
- var hexToChannels_default = (maybeHex) => {
2222
- const hex = normalizeHex_default(maybeHex);
2223
- return {
2224
- R: parseInt(hex.slice(0, 2), 16),
2225
- G: parseInt(hex.slice(2, 4), 16),
2226
- B: parseInt(hex.slice(4, 6), 16)
2227
- };
2228
- };
2229
-
2230
- // ../luum/src/import/hexToSpec.ts
2231
- var hexToSpec = (hex) => {
2232
- const { R, G, B } = hexToChannels_default(hex);
2233
- const { hue, sat, lum } = channelsToSpec_default({ R, G, B });
2234
- return { hue, sat, lum };
2235
- };
2236
- var hexToSpec_default = hexToSpec;
2237
-
2238
- // ../luum/src/mixers/contrast.ts
2239
- var contrastMax = (color) => __spreadProps(__spreadValues({}, color), {
2240
- lum: color.lum > 0.666 ? 0 : 1
2241
- });
2242
- var offset = (offsetAmount) => (color) => __spreadProps(__spreadValues({}, color), {
2243
- lum: color.lum > 0.666 ? color.lum - offsetAmount : color.lum + offsetAmount
2244
- });
2245
-
2246
- // ../luum/src/constants/luum-spec.ts
2247
- var defaultSpec = {
2248
- hue: 0,
2249
- lum: 0,
2250
- sat: 0,
2251
- prefer: `lum`
2252
- };
2253
-
2254
- // ../luum/src/scheme/index.ts
2255
- 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);
2256
- isModifier(isLuumSpec)(defaultSpec);
2257
- var WAYFORGE_CORE_COLOR_NAMES = [
2258
- `Red`,
2259
- `Orange`,
2260
- `Yellow`,
2261
- `Lime`,
2262
- `Green`,
2263
- `Teal`,
2264
- `Cyan`,
2265
- `Blue`,
2266
- `Indigo`,
2267
- `Violet`,
2268
- `Magenta`,
2269
- `Pink`
2270
- ];
2271
- WAYFORGE_CORE_COLOR_NAMES.reduce(
2272
- (acc, name, idx) => {
2273
- acc[name] = {
2274
- hue: idx * 30,
2275
- sat: 255,
2276
- lum: 0.5,
2277
- prefer: `sat`
2278
- };
2279
- return acc;
2280
- },
2281
- {}
2282
- );
2283
- var Id = ({ id }) => {
2284
- const [isOpen, setIsOpen] = React__namespace.useState(false);
2285
- const { refs, floatingStyles, context } = react$1.useFloating({
2286
- open: isOpen,
2287
- onOpenChange: setIsOpen,
2288
- placement: `bottom-start`
2289
- });
2290
- const click = react$1.useClick(context);
2291
- const { getReferenceProps, getFloatingProps } = react$1.useInteractions([click]);
2292
- const bgColor = stringToColor(id);
2293
- const contrastColor = pipe(bgColor, hexToSpec_default, contrastMax, specToHex_default);
2294
- const offsetColor = pipe(bgColor, hexToSpec_default, offset(0.25), specToHex_default);
2295
- const contrastOffsetColor = pipe(
2296
- offsetColor,
2297
- hexToSpec_default,
2298
- contrastMax,
2299
- specToHex_default
2300
- );
2301
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2302
- /* @__PURE__ */ jsxRuntime.jsx(
2303
- "span",
2304
- __spreadProps(__spreadValues({
2305
- ref: refs.setReference
2306
- }, getReferenceProps()), {
2307
- style: {
2308
- background: bgColor,
2309
- cursor: `pointer`,
2310
- padding: `0px 4px`,
2311
- color: contrastColor,
2312
- userSelect: `none`,
2313
- whiteSpace: `nowrap`
2314
- },
2315
- children: id.substring(0, 3)
2316
- })
2317
- ),
2318
- isOpen && /* @__PURE__ */ jsxRuntime.jsx(react$1.FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(
2319
- "span",
2320
- __spreadProps(__spreadValues({
2321
- ref: refs.setFloating
2322
- }, getFloatingProps()), {
2323
- style: __spreadProps(__spreadValues({}, floatingStyles), {
2324
- color: contrastOffsetColor,
2325
- background: offsetColor,
2326
- padding: `0px 4px`,
2327
- boxShadow: `0px 2px 10px rgba(0, 0, 0, 0.1)`
2328
- }),
2329
- children: id
2330
- })
2331
- ) })
2332
- ] });
2333
- };
2334
- var RelationEditor = (props) => {
2335
- const seen = /* @__PURE__ */ new Set();
2336
- const data = Object.entries(props.data.relations).sort(([_, a2], [__, b2]) => b2.length - a2.length).filter(([head, tail]) => {
2337
- if (seen.has(head))
2338
- return false;
2339
- seen.add(head);
2340
- for (const tailElement of tail) {
2341
- seen.add(tailElement);
2342
- }
2343
- return true;
2344
- });
2345
- return /* @__PURE__ */ jsxRuntime.jsx("article", { className: "relation-editor-0123456789", children: data.map(([head, tail]) => /* @__PURE__ */ jsxRuntime.jsxs("section", { children: [
2346
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: /* @__PURE__ */ jsxRuntime.jsx(Id, { id: head }) }),
2347
- ":",
2348
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: tail.map((child) => /* @__PURE__ */ jsxRuntime.jsx(Id, { id: child })) })
2349
- ] })) });
2350
- };
2351
1595
  var StateEditor = ({ token }) => {
2352
- const set = react.useI(token);
2353
- const data = react.useO(token);
2354
- return isJson(data) ? /* @__PURE__ */ jsxRuntime.jsx(JsonEditor, { data, set, schema: true }) : data instanceof Join ? /* @__PURE__ */ jsxRuntime.jsx(RelationEditor, { data, set }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "json_editor", children: /* @__PURE__ */ jsxRuntime.jsx(
1596
+ const set = react$1.useI(token);
1597
+ const data = react$1.useO(token);
1598
+ return isJson(data) ? /* @__PURE__ */ jsxRuntime.jsx(JsonEditor, { data, set, schema: true }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "json_editor", children: /* @__PURE__ */ jsxRuntime.jsx(
2355
1599
  ElasticInput,
2356
1600
  {
2357
- 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), `?`),
1601
+ 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), `?`),
2358
1602
  disabled: true
2359
1603
  }
2360
1604
  ) });
2361
1605
  };
2362
1606
  var ReadonlySelectorViewer = ({ token }) => {
2363
- const data = react.useO(token);
1607
+ const data = react$1.useO(token);
2364
1608
  return isJson(data) ? /* @__PURE__ */ jsxRuntime.jsx(
2365
1609
  JsonEditor,
2366
1610
  {
@@ -2372,7 +1616,7 @@ var ReadonlySelectorViewer = ({ token }) => {
2372
1616
  ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "json_editor", children: /* @__PURE__ */ jsxRuntime.jsx(
2373
1617
  ElasticInput,
2374
1618
  {
2375
- value: data instanceof Set ? `Set ` + JSON.stringify([...data]) : data instanceof Map ? `Map ` + JSON.stringify([...data]) : Object.getPrototypeOf(data).constructor.name + ` ` + JSON.stringify(data),
1619
+ value: data instanceof Set ? `Set ` + JSON.stringify([...data]) : Object.getPrototypeOf(data).constructor.name + ` ` + JSON.stringify(data),
2376
1620
  disabled: true
2377
1621
  }
2378
1622
  ) });
@@ -2401,10 +1645,10 @@ var findStateTypeState = atom_io.selectorFamily({
2401
1645
  });
2402
1646
  var StateIndexLeafNode = ({ node, isOpenState, typeState }) => {
2403
1647
  var _a2, _b;
2404
- const setIsOpen = react.useI(isOpenState);
2405
- const isOpen = react.useO(isOpenState);
2406
- const state = react.useO(node);
2407
- const stateType = react.useO(typeState);
1648
+ const setIsOpen = react$1.useI(isOpenState);
1649
+ const isOpen = react$1.useO(isOpenState);
1650
+ const state = react$1.useO(node);
1651
+ const stateType = react$1.useO(typeState);
2408
1652
  const isPrimitive = Boolean(primitiveRefinery.refine(state));
2409
1653
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2410
1654
  /* @__PURE__ */ jsxRuntime.jsxs("header", { children: [
@@ -2412,6 +1656,7 @@ var StateIndexLeafNode = ({ node, isOpenState, typeState }) => {
2412
1656
  button.OpenClose,
2413
1657
  {
2414
1658
  isOpen: isOpen && !isPrimitive,
1659
+ testid: `open-close-state-${node.key}`,
2415
1660
  setIsOpen,
2416
1661
  disabled: isPrimitive
2417
1662
  }
@@ -2431,21 +1676,28 @@ var StateIndexLeafNode = ({ node, isOpenState, typeState }) => {
2431
1676
  ]
2432
1677
  }
2433
1678
  ),
2434
- isPrimitive ? /* @__PURE__ */ jsxRuntime.jsx(StoreEditor, { token: node }) : null
1679
+ /* @__PURE__ */ jsxRuntime.jsx(StoreEditor, { token: node })
2435
1680
  ] }),
2436
1681
  isOpen && !isPrimitive ? /* @__PURE__ */ jsxRuntime.jsx("main", { children: /* @__PURE__ */ jsxRuntime.jsx(StoreEditor, { token: node }) }) : null
2437
1682
  ] });
2438
1683
  };
2439
1684
  var StateIndexTreeNode = ({ node, isOpenState }) => {
2440
- const setIsOpen = react.useI(isOpenState);
2441
- const isOpen = react.useO(isOpenState);
1685
+ const setIsOpen = react$1.useI(isOpenState);
1686
+ const isOpen = react$1.useO(isOpenState);
2442
1687
  for (const [key, childNode] of recordToEntries(node.familyMembers)) {
2443
- findViewIsOpenState(key);
2444
- findStateTypeState(childNode);
1688
+ atom_io.findState(findViewIsOpenState, key);
1689
+ atom_io.findState(findStateTypeState, childNode);
2445
1690
  }
2446
1691
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2447
1692
  /* @__PURE__ */ jsxRuntime.jsxs("header", { children: [
2448
- /* @__PURE__ */ jsxRuntime.jsx(button.OpenClose, { isOpen, setIsOpen }),
1693
+ /* @__PURE__ */ jsxRuntime.jsx(
1694
+ button.OpenClose,
1695
+ {
1696
+ isOpen,
1697
+ testid: `open-close-state-family-${node.key}`,
1698
+ setIsOpen
1699
+ }
1700
+ ),
2449
1701
  /* @__PURE__ */ jsxRuntime.jsxs("label", { children: [
2450
1702
  /* @__PURE__ */ jsxRuntime.jsx("h2", { children: node.key }),
2451
1703
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "type detail", children: " (family)" })
@@ -2455,18 +1707,15 @@ var StateIndexTreeNode = ({ node, isOpenState }) => {
2455
1707
  StateIndexNode,
2456
1708
  {
2457
1709
  node: childNode,
2458
- isOpenState: findViewIsOpenState(childNode.key),
2459
- typeState: findStateTypeState(childNode)
1710
+ isOpenState: atom_io.findState(findViewIsOpenState, childNode.key),
1711
+ typeState: atom_io.findState(findStateTypeState, childNode)
2460
1712
  },
2461
1713
  key
2462
1714
  )) : null
2463
1715
  ] });
2464
1716
  };
2465
1717
  var StateIndexNode = ({ node, isOpenState, typeState }) => {
2466
- if (node.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)) {
2467
- return null;
2468
- }
2469
- return /* @__PURE__ */ jsxRuntime.jsx("section", { className: "node state", children: `type` in node ? /* @__PURE__ */ jsxRuntime.jsx(
1718
+ return /* @__PURE__ */ jsxRuntime.jsx("section", { className: "node state", "data-testid": `state-${node.key}`, children: `type` in node ? /* @__PURE__ */ jsxRuntime.jsx(
2470
1719
  StateIndexLeafNode,
2471
1720
  {
2472
1721
  node,
@@ -2476,14 +1725,14 @@ var StateIndexNode = ({ node, isOpenState, typeState }) => {
2476
1725
  ) : /* @__PURE__ */ jsxRuntime.jsx(StateIndexTreeNode, { node, isOpenState }) });
2477
1726
  };
2478
1727
  var StateIndex = ({ tokenIndex }) => {
2479
- const tokenIds = react.useO(tokenIndex);
2480
- return /* @__PURE__ */ jsxRuntime.jsx("article", { className: "index state_index", children: Object.entries(tokenIds).filter(([key]) => !key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).sort().map(([key, node]) => {
1728
+ const tokenIds = react$1.useO(tokenIndex);
1729
+ return /* @__PURE__ */ jsxRuntime.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]) => {
2481
1730
  return /* @__PURE__ */ jsxRuntime.jsx(
2482
1731
  StateIndexNode,
2483
1732
  {
2484
1733
  node,
2485
- isOpenState: findViewIsOpenState(node.key),
2486
- typeState: findStateTypeState(node)
1734
+ isOpenState: atom_io.findState(findViewIsOpenState, node.key),
1735
+ typeState: atom_io.findState(findStateTypeState, node)
2487
1736
  },
2488
1737
  key
2489
1738
  );
@@ -2508,104 +1757,118 @@ var AtomUpdateFC = ({ atomUpdate }) => {
2508
1757
  );
2509
1758
  };
2510
1759
  var TransactionUpdateFC = ({ serialNumber, transactionUpdate }) => {
2511
- return /* @__PURE__ */ jsxRuntime.jsxs("article", { className: "node transaction_update", children: [
2512
- /* @__PURE__ */ jsxRuntime.jsx("header", { children: /* @__PURE__ */ jsxRuntime.jsx("h4", { children: serialNumber }) }),
2513
- /* @__PURE__ */ jsxRuntime.jsxs("main", { children: [
2514
- /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "transaction_params", children: [
2515
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "detail", children: "params: " }),
2516
- transactionUpdate.params.map((param, index) => {
2517
- return /* @__PURE__ */ jsxRuntime.jsxs(
2518
- "article",
2519
- {
2520
- className: "node transaction_param",
2521
- onClick: () => console.log(transactionUpdate),
2522
- onKeyUp: () => console.log(transactionUpdate),
2523
- children: [
2524
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "detail", children: [
2525
- discoverType(param),
2526
- ": "
2527
- ] }),
2528
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "summary", children: typeof param === `object` && param !== null && `type` in param && `target` in param ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: JSON.stringify(param.type) }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: JSON.stringify(param) }) })
2529
- ]
2530
- },
2531
- `param` + index
2532
- );
2533
- })
2534
- ] }),
2535
- /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "node transaction_output", children: [
2536
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "detail", children: "output: " }),
2537
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "detail", children: discoverType(transactionUpdate.output) }),
2538
- transactionUpdate.output ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "summary", children: [
1760
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1761
+ "article",
1762
+ {
1763
+ className: "node transaction_update",
1764
+ "data-testid": `transaction-update-${transactionUpdate.key}-${serialNumber}`,
1765
+ children: [
1766
+ /* @__PURE__ */ jsxRuntime.jsx("header", { children: /* @__PURE__ */ jsxRuntime.jsx("h4", { children: serialNumber }) }),
1767
+ /* @__PURE__ */ jsxRuntime.jsxs("main", { children: [
1768
+ /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "transaction_params", children: [
1769
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "detail", children: "params: " }),
1770
+ transactionUpdate.params.map((param, index) => {
1771
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1772
+ "article",
1773
+ {
1774
+ className: "node transaction_param",
1775
+ onClick: () => console.log(transactionUpdate),
1776
+ onKeyUp: () => console.log(transactionUpdate),
1777
+ children: [
1778
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "detail", children: [
1779
+ discoverType(param),
1780
+ ": "
1781
+ ] }),
1782
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "summary", children: typeof param === `object` && param !== null && `type` in param && `target` in param ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: JSON.stringify(param.type) }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: JSON.stringify(param) }) })
1783
+ ]
1784
+ },
1785
+ `param` + index
1786
+ );
1787
+ })
1788
+ ] }),
1789
+ /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "node transaction_output", children: [
1790
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "detail", children: "output: " }),
1791
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "detail", children: discoverType(transactionUpdate.output) }),
1792
+ transactionUpdate.output ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "summary", children: [
1793
+ ": ",
1794
+ JSON.stringify(transactionUpdate.output)
1795
+ ] }) : null
1796
+ ] }),
1797
+ /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "transaction_impact", children: [
1798
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "detail", children: "impact: " }),
1799
+ transactionUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
1800
+ return `newValue` in update ? /* @__PURE__ */ jsxRuntime.jsx(
1801
+ article.AtomUpdate,
1802
+ {
1803
+ serialNumber: index,
1804
+ atomUpdate: update
1805
+ },
1806
+ `${transactionUpdate.key}:${index}:${update.key}`
1807
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1808
+ TransactionUpdateFC,
1809
+ {
1810
+ serialNumber: index,
1811
+ transactionUpdate: update
1812
+ },
1813
+ `${transactionUpdate.key}:${index}:${update.key}`
1814
+ );
1815
+ })
1816
+ ] })
1817
+ ] })
1818
+ ]
1819
+ }
1820
+ );
1821
+ };
1822
+ var TimelineUpdateFC = ({ timelineUpdate, serialNumber }) => {
1823
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1824
+ "article",
1825
+ {
1826
+ className: "node timeline_update",
1827
+ "data-testid": `timeline-update-${timelineUpdate.key}-${serialNumber}`,
1828
+ children: [
1829
+ /* @__PURE__ */ jsxRuntime.jsx("header", { children: /* @__PURE__ */ jsxRuntime.jsxs("h4", { children: [
1830
+ timelineUpdate.timestamp,
2539
1831
  ": ",
2540
- JSON.stringify(transactionUpdate.output)
2541
- ] }) : null
2542
- ] }),
2543
- /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "transaction_impact", children: [
2544
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "detail", children: "impact: " }),
2545
- transactionUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
1832
+ timelineUpdate.type,
1833
+ " (",
1834
+ timelineUpdate.key,
1835
+ ")"
1836
+ ] }) }),
1837
+ /* @__PURE__ */ jsxRuntime.jsx("main", { children: timelineUpdate.type === `transaction_update` ? timelineUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
2546
1838
  return `newValue` in update ? /* @__PURE__ */ jsxRuntime.jsx(
2547
1839
  article.AtomUpdate,
2548
1840
  {
2549
1841
  serialNumber: index,
2550
1842
  atomUpdate: update
2551
1843
  },
2552
- `${transactionUpdate.key}:${index}:${update.key}`
1844
+ `${timelineUpdate.key}:${index}:${update.key}`
2553
1845
  ) : /* @__PURE__ */ jsxRuntime.jsx(
2554
1846
  TransactionUpdateFC,
2555
1847
  {
2556
1848
  serialNumber: index,
2557
1849
  transactionUpdate: update
2558
1850
  },
2559
- `${transactionUpdate.key}:${index}:${update.key}`
1851
+ `${timelineUpdate.key}:${index}:${update.key}`
2560
1852
  );
2561
- })
2562
- ] })
2563
- ] })
2564
- ] });
2565
- };
2566
- var TimelineUpdateFC = ({ timelineUpdate }) => {
2567
- return /* @__PURE__ */ jsxRuntime.jsxs("article", { className: "node timeline_update", children: [
2568
- /* @__PURE__ */ jsxRuntime.jsx("header", { children: /* @__PURE__ */ jsxRuntime.jsxs("h4", { children: [
2569
- timelineUpdate.timestamp,
2570
- ": ",
2571
- timelineUpdate.type,
2572
- " (",
2573
- timelineUpdate.key,
2574
- ")"
2575
- ] }) }),
2576
- /* @__PURE__ */ jsxRuntime.jsx("main", { children: timelineUpdate.type === `transaction_update` ? timelineUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
2577
- return `newValue` in update ? /* @__PURE__ */ jsxRuntime.jsx(
2578
- article.AtomUpdate,
2579
- {
2580
- serialNumber: index,
2581
- atomUpdate: update
2582
- },
2583
- `${timelineUpdate.key}:${index}:${update.key}`
2584
- ) : /* @__PURE__ */ jsxRuntime.jsx(
2585
- TransactionUpdateFC,
2586
- {
2587
- serialNumber: index,
2588
- transactionUpdate: update
2589
- },
2590
- `${timelineUpdate.key}:${index}:${update.key}`
2591
- );
2592
- }) : timelineUpdate.type === `selector_update` ? timelineUpdate.atomUpdates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((atomUpdate, index) => {
2593
- return /* @__PURE__ */ jsxRuntime.jsx(
2594
- article.AtomUpdate,
2595
- {
2596
- serialNumber: index,
2597
- atomUpdate
2598
- },
2599
- `${timelineUpdate.key}:${index}:${atomUpdate.key}`
2600
- );
2601
- }) : timelineUpdate.type === `atom_update` ? /* @__PURE__ */ jsxRuntime.jsx(
2602
- article.AtomUpdate,
2603
- {
2604
- serialNumber: timelineUpdate.timestamp,
2605
- atomUpdate: timelineUpdate
2606
- }
2607
- ) : null })
2608
- ] });
1853
+ }) : timelineUpdate.type === `selector_update` ? timelineUpdate.atomUpdates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((atomUpdate, index) => {
1854
+ return /* @__PURE__ */ jsxRuntime.jsx(
1855
+ article.AtomUpdate,
1856
+ {
1857
+ serialNumber: index,
1858
+ atomUpdate
1859
+ },
1860
+ `${timelineUpdate.key}:${index}:${atomUpdate.key}`
1861
+ );
1862
+ }) : timelineUpdate.type === `atom_update` ? /* @__PURE__ */ jsxRuntime.jsx(
1863
+ article.AtomUpdate,
1864
+ {
1865
+ serialNumber: timelineUpdate.timestamp,
1866
+ atomUpdate: timelineUpdate
1867
+ }
1868
+ ) : null })
1869
+ ]
1870
+ }
1871
+ );
2609
1872
  };
2610
1873
  var article = {
2611
1874
  AtomUpdate: AtomUpdateFC,
@@ -2616,12 +1879,19 @@ var YouAreHere = () => {
2616
1879
  return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "you_are_here", children: "you are here" });
2617
1880
  };
2618
1881
  var TimelineLog = ({ token, isOpenState, timelineState }) => {
2619
- const timeline = react.useO(timelineState);
2620
- const isOpen = react.useO(isOpenState);
2621
- const setIsOpen = react.useI(isOpenState);
2622
- return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "node timeline_log", children: [
1882
+ const timeline = react$1.useO(timelineState);
1883
+ const isOpen = react$1.useO(isOpenState);
1884
+ const setIsOpen = react$1.useI(isOpenState);
1885
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "node timeline_log", "data-testid": `timeline-${token.key}`, children: [
2623
1886
  /* @__PURE__ */ jsxRuntime.jsxs("header", { children: [
2624
- /* @__PURE__ */ jsxRuntime.jsx(button.OpenClose, { isOpen, setIsOpen }),
1887
+ /* @__PURE__ */ jsxRuntime.jsx(
1888
+ button.OpenClose,
1889
+ {
1890
+ isOpen,
1891
+ testid: `open-close-timeline-${token.key}`,
1892
+ setIsOpen
1893
+ }
1894
+ ),
2625
1895
  /* @__PURE__ */ jsxRuntime.jsxs("label", { children: [
2626
1896
  /* @__PURE__ */ jsxRuntime.jsx("h2", { children: token.key }),
2627
1897
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "detail length", children: [
@@ -2654,16 +1924,22 @@ var TimelineLog = ({ token, isOpenState, timelineState }) => {
2654
1924
  ] })
2655
1925
  ] })
2656
1926
  ] }),
2657
- isOpen ? /* @__PURE__ */ jsxRuntime.jsx("main", { children: timeline.history.map((update, index) => /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
1927
+ isOpen ? /* @__PURE__ */ jsxRuntime.jsx("main", { children: timeline.history.map((update, index) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
2658
1928
  index === timeline.at ? /* @__PURE__ */ jsxRuntime.jsx(YouAreHere, {}) : null,
2659
- /* @__PURE__ */ jsxRuntime.jsx(article.TimelineUpdate, { timelineUpdate: update }),
1929
+ /* @__PURE__ */ jsxRuntime.jsx(
1930
+ article.TimelineUpdate,
1931
+ {
1932
+ timelineUpdate: update,
1933
+ serialNumber: index
1934
+ }
1935
+ ),
2660
1936
  index === timeline.history.length - 1 && timeline.at === timeline.history.length ? /* @__PURE__ */ jsxRuntime.jsx(YouAreHere, {}) : null
2661
1937
  ] }, update.key + index + timeline.at)) }) : null
2662
1938
  ] });
2663
1939
  };
2664
1940
  var TimelineIndex = () => {
2665
- const tokenIds = react.useO(timelineIndex);
2666
- return /* @__PURE__ */ jsxRuntime.jsx("article", { className: "index timeline_index", children: tokenIds.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((token) => {
1941
+ const tokenIds = react$1.useO(timelineIndex);
1942
+ return /* @__PURE__ */ jsxRuntime.jsx("article", { className: "index timeline_index", "data-testid": "timeline-index", children: tokenIds.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((token) => {
2667
1943
  return /* @__PURE__ */ jsxRuntime.jsx(
2668
1944
  TimelineLog,
2669
1945
  {
@@ -2676,34 +1952,48 @@ var TimelineIndex = () => {
2676
1952
  }) });
2677
1953
  };
2678
1954
  var TransactionLog = ({ token, isOpenState, logState }) => {
2679
- const log = react.useO(logState);
2680
- const isOpen = react.useO(isOpenState);
2681
- const setIsOpen = react.useI(isOpenState);
2682
- return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "node transaction_log", children: [
2683
- /* @__PURE__ */ jsxRuntime.jsxs("header", { children: [
2684
- /* @__PURE__ */ jsxRuntime.jsx(button.OpenClose, { isOpen, setIsOpen }),
2685
- /* @__PURE__ */ jsxRuntime.jsxs("label", { children: [
2686
- /* @__PURE__ */ jsxRuntime.jsx("h2", { children: token.key }),
2687
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "detail length", children: [
2688
- "(",
2689
- log.length,
2690
- ")"
2691
- ] })
2692
- ] })
2693
- ] }),
2694
- isOpen ? /* @__PURE__ */ jsxRuntime.jsx("main", { children: log.map((update, index) => /* @__PURE__ */ jsxRuntime.jsx(
2695
- article.TransactionUpdate,
2696
- {
2697
- serialNumber: index,
2698
- transactionUpdate: update
2699
- },
2700
- update.key + index
2701
- )) }) : null
2702
- ] });
1955
+ const log = react$1.useO(logState);
1956
+ const isOpen = react$1.useO(isOpenState);
1957
+ const setIsOpen = react$1.useI(isOpenState);
1958
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1959
+ "section",
1960
+ {
1961
+ className: "node transaction_log",
1962
+ "data-testid": `transaction-${token.key}`,
1963
+ children: [
1964
+ /* @__PURE__ */ jsxRuntime.jsxs("header", { children: [
1965
+ /* @__PURE__ */ jsxRuntime.jsx(
1966
+ button.OpenClose,
1967
+ {
1968
+ isOpen,
1969
+ testid: `open-close-transaction-${token.key}`,
1970
+ setIsOpen
1971
+ }
1972
+ ),
1973
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { children: [
1974
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { children: token.key }),
1975
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "detail length", children: [
1976
+ "(",
1977
+ log.length,
1978
+ ")"
1979
+ ] })
1980
+ ] })
1981
+ ] }),
1982
+ isOpen ? /* @__PURE__ */ jsxRuntime.jsx("main", { children: log.map((update, index) => /* @__PURE__ */ jsxRuntime.jsx(
1983
+ article.TransactionUpdate,
1984
+ {
1985
+ serialNumber: index,
1986
+ transactionUpdate: update
1987
+ },
1988
+ update.key + index
1989
+ )) }) : null
1990
+ ]
1991
+ }
1992
+ );
2703
1993
  };
2704
1994
  var TransactionIndex = () => {
2705
- const tokenIds = react.useO(transactionIndex);
2706
- return /* @__PURE__ */ jsxRuntime.jsx("article", { className: "index transaction_index", children: tokenIds.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((token) => {
1995
+ const tokenIds = react$1.useO(transactionIndex);
1996
+ return /* @__PURE__ */ jsxRuntime.jsx("article", { className: "index transaction_index", "data-testid": "transaction-index", children: tokenIds.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((token) => {
2707
1997
  return /* @__PURE__ */ jsxRuntime.jsx(
2708
1998
  TransactionLog,
2709
1999
  {
@@ -2716,13 +2006,13 @@ var TransactionIndex = () => {
2716
2006
  }) });
2717
2007
  };
2718
2008
  var AtomIODevtools = () => {
2719
- const constraintsRef = React.useRef(null);
2720
- const setDevtoolsAreOpen = react.useI(devtoolsAreOpenState);
2721
- const devtoolsAreOpen = react.useO(devtoolsAreOpenState);
2722
- const setDevtoolsView = react.useI(devtoolsViewSelectionState);
2723
- const devtoolsView = react.useO(devtoolsViewSelectionState);
2724
- const devtoolsViewOptions = react.useO(devtoolsViewOptionsState);
2725
- const mouseHasMoved = React.useRef(false);
2009
+ const constraintsRef = react.useRef(null);
2010
+ const setDevtoolsAreOpen = react$1.useI(devtoolsAreOpenState);
2011
+ const devtoolsAreOpen = react$1.useO(devtoolsAreOpenState);
2012
+ const setDevtoolsView = react$1.useI(devtoolsViewSelectionState);
2013
+ const devtoolsView = react$1.useO(devtoolsViewSelectionState);
2014
+ const devtoolsViewOptions = react$1.useO(devtoolsViewOptionsState);
2015
+ const mouseHasMoved = react.useRef(false);
2726
2016
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2727
2017
  /* @__PURE__ */ jsxRuntime.jsx(
2728
2018
  framerMotion.motion.span,
@@ -2760,6 +2050,7 @@ var AtomIODevtools = () => {
2760
2050
  "button",
2761
2051
  {
2762
2052
  type: "button",
2053
+ "data-testid": `view-${viewOption}`,
2763
2054
  className: viewOption === devtoolsView ? `active` : ``,
2764
2055
  onClick: () => setDevtoolsView(viewOption),
2765
2056
  disabled: viewOption === devtoolsView,