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
@@ -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-7VCCW45K.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 {
@@ -253,11 +251,12 @@ 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
261
  onClick: () => setIsOpen((isOpen2) => !isOpen2),
263
262
  disabled,
@@ -268,301 +267,6 @@ var OpenClose = ({ isOpen, setIsOpen, disabled }) => {
268
267
  var button = {
269
268
  OpenClose
270
269
  };
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
270
  var ElasticInput = forwardRef(function ElasticInputFC(props, ref) {
567
271
  var _a2, _b, _c, _d;
568
272
  const inputRef = useRef(null);
@@ -625,9 +329,6 @@ var ElasticInput = forwardRef(function ElasticInputFC(props, ref) {
625
329
 
626
330
  // ../anvl/src/number/clamp.ts
627
331
  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
332
  function round(value, decimalPlaces) {
632
333
  if (decimalPlaces === void 0)
633
334
  return value;
@@ -646,11 +347,11 @@ var isDecimalInProgress = (input) => input === `0` || !Number.isNaN(Number(input
646
347
  var textToValue = (input, allowDecimal) => {
647
348
  if (isValidNonNumber(input))
648
349
  return VALID_NON_NUMBER_INTERPRETATIONS[input];
649
- return allowDecimal ? parseFloat(input) : Math.round(parseFloat(input));
350
+ return allowDecimal ? Number.parseFloat(input) : Math.round(Number.parseFloat(input));
650
351
  };
651
352
  var DEFAULT_NUMBER_CONSTRAINTS = {
652
- max: Infinity,
653
- min: -Infinity,
353
+ max: Number.POSITIVE_INFINITY,
354
+ min: Number.NEGATIVE_INFINITY,
654
355
  decimalPlaces: 100,
655
356
  nullable: true
656
357
  };
@@ -921,7 +622,7 @@ var Int = Object.assign((input) => parseInteger(input), {
921
622
  from: (input) => pipe(
922
623
  input,
923
624
  String,
924
- parseFloat,
625
+ Number.parseFloat,
925
626
  (num) => isInteger(num) ? {
926
627
  value: num,
927
628
  error: null,
@@ -1675,413 +1376,13 @@ var SubEditors = {
1675
1376
  object: ObjectEditor,
1676
1377
  string: StringEditor
1677
1378
  };
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
1379
  var StateEditor = ({ token }) => {
2079
1380
  const set = useI(token);
2080
1381
  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(
1382
+ return isJson(data) ? /* @__PURE__ */ jsx(JsonEditor, { data, set, schema: true }) : /* @__PURE__ */ jsx("div", { className: "json_editor", children: /* @__PURE__ */ jsx(
2082
1383
  ElasticInput,
2083
1384
  {
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), `?`),
1385
+ 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
1386
  disabled: true
2086
1387
  }
2087
1388
  ) });
@@ -2099,7 +1400,7 @@ var ReadonlySelectorViewer = ({ token }) => {
2099
1400
  ) : /* @__PURE__ */ jsx("div", { className: "json_editor", children: /* @__PURE__ */ jsx(
2100
1401
  ElasticInput,
2101
1402
  {
2102
- value: data instanceof Set ? `Set ` + JSON.stringify([...data]) : data instanceof Map ? `Map ` + JSON.stringify([...data]) : Object.getPrototypeOf(data).constructor.name + ` ` + JSON.stringify(data),
1403
+ value: data instanceof Set ? `Set ` + JSON.stringify([...data]) : Object.getPrototypeOf(data).constructor.name + ` ` + JSON.stringify(data),
2103
1404
  disabled: true
2104
1405
  }
2105
1406
  ) });
@@ -2139,6 +1440,7 @@ var StateIndexLeafNode = ({ node, isOpenState, typeState }) => {
2139
1440
  button.OpenClose,
2140
1441
  {
2141
1442
  isOpen: isOpen && !isPrimitive,
1443
+ testid: `open-close-state-${node.key}`,
2142
1444
  setIsOpen,
2143
1445
  disabled: isPrimitive
2144
1446
  }
@@ -2158,7 +1460,7 @@ var StateIndexLeafNode = ({ node, isOpenState, typeState }) => {
2158
1460
  ]
2159
1461
  }
2160
1462
  ),
2161
- isPrimitive ? /* @__PURE__ */ jsx(StoreEditor, { token: node }) : null
1463
+ /* @__PURE__ */ jsx(StoreEditor, { token: node })
2162
1464
  ] }),
2163
1465
  isOpen && !isPrimitive ? /* @__PURE__ */ jsx("main", { children: /* @__PURE__ */ jsx(StoreEditor, { token: node }) }) : null
2164
1466
  ] });
@@ -2167,12 +1469,19 @@ var StateIndexTreeNode = ({ node, isOpenState }) => {
2167
1469
  const setIsOpen = useI(isOpenState);
2168
1470
  const isOpen = useO(isOpenState);
2169
1471
  for (const [key, childNode] of recordToEntries(node.familyMembers)) {
2170
- findViewIsOpenState(key);
2171
- findStateTypeState(childNode);
1472
+ findState(findViewIsOpenState, key);
1473
+ findState(findStateTypeState, childNode);
2172
1474
  }
2173
1475
  return /* @__PURE__ */ jsxs(Fragment, { children: [
2174
1476
  /* @__PURE__ */ jsxs("header", { children: [
2175
- /* @__PURE__ */ jsx(button.OpenClose, { isOpen, setIsOpen }),
1477
+ /* @__PURE__ */ jsx(
1478
+ button.OpenClose,
1479
+ {
1480
+ isOpen,
1481
+ testid: `open-close-state-family-${node.key}`,
1482
+ setIsOpen
1483
+ }
1484
+ ),
2176
1485
  /* @__PURE__ */ jsxs("label", { children: [
2177
1486
  /* @__PURE__ */ jsx("h2", { children: node.key }),
2178
1487
  /* @__PURE__ */ jsx("span", { className: "type detail", children: " (family)" })
@@ -2182,18 +1491,15 @@ var StateIndexTreeNode = ({ node, isOpenState }) => {
2182
1491
  StateIndexNode,
2183
1492
  {
2184
1493
  node: childNode,
2185
- isOpenState: findViewIsOpenState(childNode.key),
2186
- typeState: findStateTypeState(childNode)
1494
+ isOpenState: findState(findViewIsOpenState, childNode.key),
1495
+ typeState: findState(findStateTypeState, childNode)
2187
1496
  },
2188
1497
  key
2189
1498
  )) : null
2190
1499
  ] });
2191
1500
  };
2192
1501
  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(
1502
+ return /* @__PURE__ */ jsx("section", { className: "node state", "data-testid": `state-${node.key}`, children: `type` in node ? /* @__PURE__ */ jsx(
2197
1503
  StateIndexLeafNode,
2198
1504
  {
2199
1505
  node,
@@ -2204,13 +1510,13 @@ var StateIndexNode = ({ node, isOpenState, typeState }) => {
2204
1510
  };
2205
1511
  var StateIndex = ({ tokenIndex }) => {
2206
1512
  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]) => {
1513
+ 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
1514
  return /* @__PURE__ */ jsx(
2209
1515
  StateIndexNode,
2210
1516
  {
2211
1517
  node,
2212
- isOpenState: findViewIsOpenState(node.key),
2213
- typeState: findStateTypeState(node)
1518
+ isOpenState: findState(findViewIsOpenState, node.key),
1519
+ typeState: findState(findStateTypeState, node)
2214
1520
  },
2215
1521
  key
2216
1522
  );
@@ -2235,104 +1541,118 @@ var AtomUpdateFC = ({ atomUpdate }) => {
2235
1541
  );
2236
1542
  };
2237
1543
  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: [
1544
+ return /* @__PURE__ */ jsxs(
1545
+ "article",
1546
+ {
1547
+ className: "node transaction_update",
1548
+ "data-testid": `transaction-update-${transactionUpdate.key}-${serialNumber}`,
1549
+ children: [
1550
+ /* @__PURE__ */ jsx("header", { children: /* @__PURE__ */ jsx("h4", { children: serialNumber }) }),
1551
+ /* @__PURE__ */ jsxs("main", { children: [
1552
+ /* @__PURE__ */ jsxs("section", { className: "transaction_params", children: [
1553
+ /* @__PURE__ */ jsx("span", { className: "detail", children: "params: " }),
1554
+ transactionUpdate.params.map((param, index) => {
1555
+ return /* @__PURE__ */ jsxs(
1556
+ "article",
1557
+ {
1558
+ className: "node transaction_param",
1559
+ onClick: () => console.log(transactionUpdate),
1560
+ onKeyUp: () => console.log(transactionUpdate),
1561
+ children: [
1562
+ /* @__PURE__ */ jsxs("span", { className: "detail", children: [
1563
+ discoverType(param),
1564
+ ": "
1565
+ ] }),
1566
+ /* @__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) }) })
1567
+ ]
1568
+ },
1569
+ `param` + index
1570
+ );
1571
+ })
1572
+ ] }),
1573
+ /* @__PURE__ */ jsxs("section", { className: "node transaction_output", children: [
1574
+ /* @__PURE__ */ jsx("span", { className: "detail", children: "output: " }),
1575
+ /* @__PURE__ */ jsx("span", { className: "detail", children: discoverType(transactionUpdate.output) }),
1576
+ transactionUpdate.output ? /* @__PURE__ */ jsxs("span", { className: "summary", children: [
1577
+ ": ",
1578
+ JSON.stringify(transactionUpdate.output)
1579
+ ] }) : null
1580
+ ] }),
1581
+ /* @__PURE__ */ jsxs("section", { className: "transaction_impact", children: [
1582
+ /* @__PURE__ */ jsx("span", { className: "detail", children: "impact: " }),
1583
+ transactionUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
1584
+ return `newValue` in update ? /* @__PURE__ */ jsx(
1585
+ article.AtomUpdate,
1586
+ {
1587
+ serialNumber: index,
1588
+ atomUpdate: update
1589
+ },
1590
+ `${transactionUpdate.key}:${index}:${update.key}`
1591
+ ) : /* @__PURE__ */ jsx(
1592
+ TransactionUpdateFC,
1593
+ {
1594
+ serialNumber: index,
1595
+ transactionUpdate: update
1596
+ },
1597
+ `${transactionUpdate.key}:${index}:${update.key}`
1598
+ );
1599
+ })
1600
+ ] })
1601
+ ] })
1602
+ ]
1603
+ }
1604
+ );
1605
+ };
1606
+ var TimelineUpdateFC = ({ timelineUpdate, serialNumber }) => {
1607
+ return /* @__PURE__ */ jsxs(
1608
+ "article",
1609
+ {
1610
+ className: "node timeline_update",
1611
+ "data-testid": `timeline-update-${timelineUpdate.key}-${serialNumber}`,
1612
+ children: [
1613
+ /* @__PURE__ */ jsx("header", { children: /* @__PURE__ */ jsxs("h4", { children: [
1614
+ timelineUpdate.timestamp,
2266
1615
  ": ",
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) => {
1616
+ timelineUpdate.type,
1617
+ " (",
1618
+ timelineUpdate.key,
1619
+ ")"
1620
+ ] }) }),
1621
+ /* @__PURE__ */ jsx("main", { children: timelineUpdate.type === `transaction_update` ? timelineUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
2273
1622
  return `newValue` in update ? /* @__PURE__ */ jsx(
2274
1623
  article.AtomUpdate,
2275
1624
  {
2276
1625
  serialNumber: index,
2277
1626
  atomUpdate: update
2278
1627
  },
2279
- `${transactionUpdate.key}:${index}:${update.key}`
1628
+ `${timelineUpdate.key}:${index}:${update.key}`
2280
1629
  ) : /* @__PURE__ */ jsx(
2281
1630
  TransactionUpdateFC,
2282
1631
  {
2283
1632
  serialNumber: index,
2284
1633
  transactionUpdate: update
2285
1634
  },
2286
- `${transactionUpdate.key}:${index}:${update.key}`
1635
+ `${timelineUpdate.key}:${index}:${update.key}`
2287
1636
  );
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
- ] });
1637
+ }) : timelineUpdate.type === `selector_update` ? timelineUpdate.atomUpdates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((atomUpdate, index) => {
1638
+ return /* @__PURE__ */ jsx(
1639
+ article.AtomUpdate,
1640
+ {
1641
+ serialNumber: index,
1642
+ atomUpdate
1643
+ },
1644
+ `${timelineUpdate.key}:${index}:${atomUpdate.key}`
1645
+ );
1646
+ }) : timelineUpdate.type === `atom_update` ? /* @__PURE__ */ jsx(
1647
+ article.AtomUpdate,
1648
+ {
1649
+ serialNumber: timelineUpdate.timestamp,
1650
+ atomUpdate: timelineUpdate
1651
+ }
1652
+ ) : null })
1653
+ ]
1654
+ }
1655
+ );
2336
1656
  };
2337
1657
  var article = {
2338
1658
  AtomUpdate: AtomUpdateFC,
@@ -2346,9 +1666,16 @@ var TimelineLog = ({ token, isOpenState, timelineState }) => {
2346
1666
  const timeline = useO(timelineState);
2347
1667
  const isOpen = useO(isOpenState);
2348
1668
  const setIsOpen = useI(isOpenState);
2349
- return /* @__PURE__ */ jsxs("section", { className: "node timeline_log", children: [
1669
+ return /* @__PURE__ */ jsxs("section", { className: "node timeline_log", "data-testid": `timeline-${token.key}`, children: [
2350
1670
  /* @__PURE__ */ jsxs("header", { children: [
2351
- /* @__PURE__ */ jsx(button.OpenClose, { isOpen, setIsOpen }),
1671
+ /* @__PURE__ */ jsx(
1672
+ button.OpenClose,
1673
+ {
1674
+ isOpen,
1675
+ testid: `open-close-timeline-${token.key}`,
1676
+ setIsOpen
1677
+ }
1678
+ ),
2352
1679
  /* @__PURE__ */ jsxs("label", { children: [
2353
1680
  /* @__PURE__ */ jsx("h2", { children: token.key }),
2354
1681
  /* @__PURE__ */ jsxs("span", { className: "detail length", children: [
@@ -2383,14 +1710,20 @@ var TimelineLog = ({ token, isOpenState, timelineState }) => {
2383
1710
  ] }),
2384
1711
  isOpen ? /* @__PURE__ */ jsx("main", { children: timeline.history.map((update, index) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
2385
1712
  index === timeline.at ? /* @__PURE__ */ jsx(YouAreHere, {}) : null,
2386
- /* @__PURE__ */ jsx(article.TimelineUpdate, { timelineUpdate: update }),
1713
+ /* @__PURE__ */ jsx(
1714
+ article.TimelineUpdate,
1715
+ {
1716
+ timelineUpdate: update,
1717
+ serialNumber: index
1718
+ }
1719
+ ),
2387
1720
  index === timeline.history.length - 1 && timeline.at === timeline.history.length ? /* @__PURE__ */ jsx(YouAreHere, {}) : null
2388
1721
  ] }, update.key + index + timeline.at)) }) : null
2389
1722
  ] });
2390
1723
  };
2391
1724
  var TimelineIndex = () => {
2392
1725
  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) => {
1726
+ 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
1727
  return /* @__PURE__ */ jsx(
2395
1728
  TimelineLog,
2396
1729
  {
@@ -2406,31 +1739,45 @@ var TransactionLog = ({ token, isOpenState, logState }) => {
2406
1739
  const log = useO(logState);
2407
1740
  const isOpen = useO(isOpenState);
2408
1741
  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
- ] });
1742
+ return /* @__PURE__ */ jsxs(
1743
+ "section",
1744
+ {
1745
+ className: "node transaction_log",
1746
+ "data-testid": `transaction-${token.key}`,
1747
+ children: [
1748
+ /* @__PURE__ */ jsxs("header", { children: [
1749
+ /* @__PURE__ */ jsx(
1750
+ button.OpenClose,
1751
+ {
1752
+ isOpen,
1753
+ testid: `open-close-transaction-${token.key}`,
1754
+ setIsOpen
1755
+ }
1756
+ ),
1757
+ /* @__PURE__ */ jsxs("label", { children: [
1758
+ /* @__PURE__ */ jsx("h2", { children: token.key }),
1759
+ /* @__PURE__ */ jsxs("span", { className: "detail length", children: [
1760
+ "(",
1761
+ log.length,
1762
+ ")"
1763
+ ] })
1764
+ ] })
1765
+ ] }),
1766
+ isOpen ? /* @__PURE__ */ jsx("main", { children: log.map((update, index) => /* @__PURE__ */ jsx(
1767
+ article.TransactionUpdate,
1768
+ {
1769
+ serialNumber: index,
1770
+ transactionUpdate: update
1771
+ },
1772
+ update.key + index
1773
+ )) }) : null
1774
+ ]
1775
+ }
1776
+ );
2430
1777
  };
2431
1778
  var TransactionIndex = () => {
2432
1779
  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) => {
1780
+ 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
1781
  return /* @__PURE__ */ jsx(
2435
1782
  TransactionLog,
2436
1783
  {
@@ -2487,6 +1834,7 @@ var AtomIODevtools = () => {
2487
1834
  "button",
2488
1835
  {
2489
1836
  type: "button",
1837
+ "data-testid": `view-${viewOption}`,
2490
1838
  className: viewOption === devtoolsView ? `active` : ``,
2491
1839
  onClick: () => setDevtoolsView(viewOption),
2492
1840
  disabled: viewOption === devtoolsView,