@dxos/react-ui-attention 0.9.0 → 0.9.1-main.c7dcc2e112

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 (76) hide show
  1. package/dist/lib/browser/chunk-4HYAJ4IO.mjs +434 -0
  2. package/dist/lib/browser/chunk-4HYAJ4IO.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-I4VO2RQM.mjs → chunk-KCQFVRZ6.mjs} +88 -112
  4. package/dist/lib/browser/chunk-KCQFVRZ6.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +29 -11
  6. package/dist/lib/browser/index.mjs.map +1 -1
  7. package/dist/lib/browser/meta.json +1 -1
  8. package/dist/lib/browser/testing/index.mjs +4 -4
  9. package/dist/lib/browser/testing/index.mjs.map +2 -2
  10. package/dist/lib/browser/types/index.mjs +19 -5
  11. package/dist/lib/node-esm/{chunk-ZTUVSH4P.mjs → chunk-5JUZQDCR.mjs} +88 -112
  12. package/dist/lib/node-esm/chunk-5JUZQDCR.mjs.map +7 -0
  13. package/dist/lib/node-esm/chunk-HWN7KJDX.mjs +436 -0
  14. package/dist/lib/node-esm/chunk-HWN7KJDX.mjs.map +7 -0
  15. package/dist/lib/node-esm/index.mjs +29 -11
  16. package/dist/lib/node-esm/index.mjs.map +1 -1
  17. package/dist/lib/node-esm/meta.json +1 -1
  18. package/dist/lib/node-esm/testing/index.mjs +4 -4
  19. package/dist/lib/node-esm/testing/index.mjs.map +2 -2
  20. package/dist/lib/node-esm/types/index.mjs +19 -5
  21. package/dist/types/src/components/ViewStateProvider/ViewStateProvider.d.ts +29 -0
  22. package/dist/types/src/components/ViewStateProvider/ViewStateProvider.d.ts.map +1 -0
  23. package/dist/types/src/components/ViewStateProvider/ViewStateProvider.test.d.ts +2 -0
  24. package/dist/types/src/components/ViewStateProvider/ViewStateProvider.test.d.ts.map +1 -0
  25. package/dist/types/src/components/ViewStateProvider/index.d.ts +2 -0
  26. package/dist/types/src/components/ViewStateProvider/index.d.ts.map +1 -0
  27. package/dist/types/src/components/index.d.ts +1 -1
  28. package/dist/types/src/index.d.ts +1 -0
  29. package/dist/types/src/index.d.ts.map +1 -1
  30. package/dist/types/src/selection.d.ts +10 -40
  31. package/dist/types/src/selection.d.ts.map +1 -1
  32. package/dist/types/src/selection.test.d.ts +2 -0
  33. package/dist/types/src/selection.test.d.ts.map +1 -0
  34. package/dist/types/src/types/index.d.ts +1 -0
  35. package/dist/types/src/types/index.d.ts.map +1 -1
  36. package/dist/types/src/view-state/backends.d.ts +24 -0
  37. package/dist/types/src/view-state/backends.d.ts.map +1 -0
  38. package/dist/types/src/view-state/backends.test.d.ts +2 -0
  39. package/dist/types/src/view-state/backends.test.d.ts.map +1 -0
  40. package/dist/types/src/view-state/index.d.ts +3 -0
  41. package/dist/types/src/view-state/index.d.ts.map +1 -0
  42. package/dist/types/src/view-state/view-state.d.ts +54 -0
  43. package/dist/types/src/view-state/view-state.d.ts.map +1 -0
  44. package/dist/types/src/view-state/view-state.test.d.ts +2 -0
  45. package/dist/types/src/view-state/view-state.test.d.ts.map +1 -0
  46. package/dist/types/src/vitest-setup.d.ts +2 -0
  47. package/dist/types/src/vitest-setup.d.ts.map +1 -0
  48. package/dist/types/tsconfig.tsbuildinfo +1 -1
  49. package/package.json +15 -13
  50. package/src/components/ViewStateProvider/ViewStateProvider.test.tsx +45 -0
  51. package/src/components/ViewStateProvider/ViewStateProvider.tsx +123 -0
  52. package/src/components/ViewStateProvider/index.ts +5 -0
  53. package/src/components/index.ts +1 -1
  54. package/src/index.ts +1 -0
  55. package/src/selection.test.ts +67 -0
  56. package/src/selection.ts +39 -169
  57. package/src/testing/decorators/withAttention.ts +2 -2
  58. package/src/types/index.ts +1 -0
  59. package/src/view-state/backends.test.ts +104 -0
  60. package/src/view-state/backends.ts +145 -0
  61. package/src/view-state/index.ts +6 -0
  62. package/src/view-state/view-state.test.ts +54 -0
  63. package/src/view-state/view-state.ts +91 -0
  64. package/src/vitest-setup.ts +6 -0
  65. package/dist/lib/browser/chunk-D2BLVJ6Z.mjs +0 -421
  66. package/dist/lib/browser/chunk-D2BLVJ6Z.mjs.map +0 -7
  67. package/dist/lib/browser/chunk-I4VO2RQM.mjs.map +0 -7
  68. package/dist/lib/node-esm/chunk-6INLBC62.mjs +0 -423
  69. package/dist/lib/node-esm/chunk-6INLBC62.mjs.map +0 -7
  70. package/dist/lib/node-esm/chunk-ZTUVSH4P.mjs.map +0 -7
  71. package/dist/types/src/components/SelectionProvider/SelectionProvider.d.ts +0 -28
  72. package/dist/types/src/components/SelectionProvider/SelectionProvider.d.ts.map +0 -1
  73. package/dist/types/src/components/SelectionProvider/index.d.ts +0 -2
  74. package/dist/types/src/components/SelectionProvider/index.d.ts.map +0 -1
  75. package/src/components/SelectionProvider/SelectionProvider.tsx +0 -174
  76. package/src/components/SelectionProvider/index.ts +0 -5
@@ -1 +1 @@
1
- {"inputs":{"src/attention.ts":{"bytes":25933,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true}],"format":"esm"},"src/components/AttentionGlyph/AttentionGlyph.tsx":{"bytes":9775,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/components/AttentionGlyph/index.ts":{"bytes":394,"imports":[{"path":"src/components/AttentionGlyph/AttentionGlyph.tsx","kind":"import-statement","original":"./AttentionGlyph"}],"format":"esm"},"src/components/AttentionProvider/AttentionProvider.tsx":{"bytes":18161,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"src/attention.ts","kind":"import-statement","original":"../../attention"}],"format":"esm"},"src/components/AttentionProvider/index.ts":{"bytes":401,"imports":[{"path":"src/components/AttentionProvider/AttentionProvider.tsx","kind":"import-statement","original":"./AttentionProvider"}],"format":"esm"},"src/selection.ts":{"bytes":27361,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Match","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/components/SelectionProvider/SelectionProvider.tsx":{"bytes":16598,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"effect/Match","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"src/selection.ts","kind":"import-statement","original":"../../selection"}],"format":"esm"},"src/components/SelectionProvider/index.ts":{"bytes":401,"imports":[{"path":"src/components/SelectionProvider/SelectionProvider.tsx","kind":"import-statement","original":"./SelectionProvider"}],"format":"esm"},"src/components/index.ts":{"bytes":616,"imports":[{"path":"src/components/AttentionGlyph/index.ts","kind":"import-statement","original":"./AttentionGlyph"},{"path":"src/components/AttentionProvider/index.ts","kind":"import-statement","original":"./AttentionProvider"},{"path":"src/components/SelectionProvider/index.ts","kind":"import-statement","original":"./SelectionProvider"}],"format":"esm"},"src/useArticleKeyboardNavigation.ts":{"bytes":11610,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/keyboard","kind":"import-statement","external":true},{"path":"src/components/index.ts","kind":"import-statement","original":"./components"}],"format":"esm"},"src/index.ts":{"bytes":700,"imports":[{"path":"src/attention.ts","kind":"import-statement","original":"./attention"},{"path":"src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"src/selection.ts","kind":"import-statement","original":"./selection"},{"path":"src/useArticleKeyboardNavigation.ts","kind":"import-statement","original":"./useArticleKeyboardNavigation"}],"format":"esm"},"src/testing/decorators/withAttention.ts":{"bytes":3505,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/attention.ts","kind":"import-statement","original":"../../attention"},{"path":"src/components/index.ts","kind":"import-statement","original":"../../components"}],"format":"esm"},"src/testing/decorators/index.ts":{"bytes":389,"imports":[{"path":"src/testing/decorators/withAttention.ts","kind":"import-statement","original":"./withAttention"}],"format":"esm"},"src/testing/index.ts":{"bytes":382,"imports":[{"path":"src/testing/decorators/index.ts","kind":"import-statement","original":"./decorators"}],"format":"esm"},"src/types/index.ts":{"bytes":1067,"imports":[{"path":"src/attention.ts","kind":"import-statement","original":"../attention"},{"path":"src/selection.ts","kind":"import-statement","original":"../selection"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":11017},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-ZTUVSH4P.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-6INLBC62.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/keyboard","kind":"import-statement","external":true}],"exports":["AttendableContainer","AttentionGlyph","AttentionManager","RootAttentionProvider","SelectionManager","SelectionProvider","SelectionSchema","Syncing","advance","defaultSelection","expandAttendableId","getAttendables","getLinkedVariant","getParentId","getSegmentId","getSelectionSet","isLinkedSegment","linkedSegment","useArticleKeyboardNavigation","useAttended","useAttention","useAttentionAttributes","useAttentionContext","useSelected","useSelectionActions","useSelectionManager"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0},"src/components/AttentionGlyph/AttentionGlyph.tsx":{"bytesInOutput":2911},"src/useArticleKeyboardNavigation.ts":{"bytesInOutput":1896}},"bytes":6058},"dist/lib/node-esm/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1876},"dist/lib/node-esm/testing/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-ZTUVSH4P.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-6INLBC62.mjs","kind":"import-statement"},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["withAttention"],"entryPoint":"src/testing/index.ts","inputs":{"src/testing/decorators/withAttention.ts":{"bytesInOutput":610},"src/testing/index.ts":{"bytesInOutput":0}},"bytes":955},"dist/lib/node-esm/chunk-ZTUVSH4P.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":17647},"dist/lib/node-esm/chunk-ZTUVSH4P.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-6INLBC62.mjs","kind":"import-statement"},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"effect/Match","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true}],"exports":["AttendableContainer","RootAttentionProvider","SelectionProvider","useAttended","useAttention","useAttentionAttributes","useAttentionContext","useSelected","useSelectionActions","useSelectionManager"],"inputs":{"src/components/AttentionProvider/AttentionProvider.tsx":{"bytesInOutput":3786},"src/components/SelectionProvider/SelectionProvider.tsx":{"bytesInOutput":3529}},"bytes":7908},"dist/lib/node-esm/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/node-esm/types/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-6INLBC62.mjs","kind":"import-statement"}],"exports":["AttentionManager","SelectionManager","SelectionSchema","defaultSelection","expandAttendableId","getAttendables","getLinkedVariant","getParentId","getSegmentId","getSelectionSet","isLinkedSegment","linkedSegment"],"entryPoint":"src/types/index.ts","inputs":{"src/types/index.ts":{"bytesInOutput":0}},"bytes":628},"dist/lib/node-esm/chunk-6INLBC62.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":25346},"dist/lib/node-esm/chunk-6INLBC62.mjs":{"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Match","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"exports":["AttentionManager","SelectionManager","SelectionSchema","defaultSelection","expandAttendableId","getAttendables","getLinkedVariant","getParentId","getSegmentId","getSelectionSet","isLinkedSegment","linkedSegment"],"inputs":{"src/attention.ts":{"bytesInOutput":5433},"src/selection.ts":{"bytesInOutput":6966}},"bytes":12814}}}
1
+ {"inputs":{"src/attention.ts":{"bytes":25933,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true}],"format":"esm"},"src/components/AttentionGlyph/AttentionGlyph.tsx":{"bytes":9775,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/components/AttentionGlyph/index.ts":{"bytes":394,"imports":[{"path":"src/components/AttentionGlyph/AttentionGlyph.tsx","kind":"import-statement","original":"./AttentionGlyph"}],"format":"esm"},"src/components/AttentionProvider/AttentionProvider.tsx":{"bytes":18161,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"src/attention.ts","kind":"import-statement","original":"../../attention"}],"format":"esm"},"src/components/AttentionProvider/index.ts":{"bytes":401,"imports":[{"path":"src/components/AttentionProvider/AttentionProvider.tsx","kind":"import-statement","original":"./AttentionProvider"}],"format":"esm"},"src/view-state/view-state.ts":{"bytes":8199,"imports":[],"format":"esm"},"src/view-state/backends.ts":{"bytes":19210,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true}],"format":"esm"},"src/view-state/index.ts":{"bytes":470,"imports":[{"path":"src/view-state/view-state.ts","kind":"import-statement","original":"./view-state"},{"path":"src/view-state/backends.ts","kind":"import-statement","original":"./backends"}],"format":"esm"},"src/selection.ts":{"bytes":12380,"imports":[{"path":"effect/Match","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"src/view-state/index.ts","kind":"import-statement","original":"./view-state"}],"format":"esm"},"src/components/ViewStateProvider/ViewStateProvider.tsx":{"bytes":14288,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"src/selection.ts","kind":"import-statement","original":"../../selection"},{"path":"src/view-state/index.ts","kind":"import-statement","original":"../../view-state"}],"format":"esm"},"src/components/ViewStateProvider/index.ts":{"bytes":401,"imports":[{"path":"src/components/ViewStateProvider/ViewStateProvider.tsx","kind":"import-statement","original":"./ViewStateProvider"}],"format":"esm"},"src/components/index.ts":{"bytes":616,"imports":[{"path":"src/components/AttentionGlyph/index.ts","kind":"import-statement","original":"./AttentionGlyph"},{"path":"src/components/AttentionProvider/index.ts","kind":"import-statement","original":"./AttentionProvider"},{"path":"src/components/ViewStateProvider/index.ts","kind":"import-statement","original":"./ViewStateProvider"}],"format":"esm"},"src/useArticleKeyboardNavigation.ts":{"bytes":11610,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/keyboard","kind":"import-statement","external":true},{"path":"src/components/index.ts","kind":"import-statement","original":"./components"}],"format":"esm"},"src/index.ts":{"bytes":790,"imports":[{"path":"src/attention.ts","kind":"import-statement","original":"./attention"},{"path":"src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"src/selection.ts","kind":"import-statement","original":"./selection"},{"path":"src/useArticleKeyboardNavigation.ts","kind":"import-statement","original":"./useArticleKeyboardNavigation"},{"path":"src/view-state/index.ts","kind":"import-statement","original":"./view-state"}],"format":"esm"},"src/testing/decorators/withAttention.ts":{"bytes":3505,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/attention.ts","kind":"import-statement","original":"../../attention"},{"path":"src/components/index.ts","kind":"import-statement","original":"../../components"}],"format":"esm"},"src/testing/decorators/index.ts":{"bytes":389,"imports":[{"path":"src/testing/decorators/withAttention.ts","kind":"import-statement","original":"./withAttention"}],"format":"esm"},"src/testing/index.ts":{"bytes":382,"imports":[{"path":"src/testing/decorators/index.ts","kind":"import-statement","original":"./decorators"}],"format":"esm"},"src/types/index.ts":{"bytes":1166,"imports":[{"path":"src/attention.ts","kind":"import-statement","original":"../attention"},{"path":"src/selection.ts","kind":"import-statement","original":"../selection"},{"path":"src/view-state/index.ts","kind":"import-statement","original":"../view-state"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":11026},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-5JUZQDCR.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-HWN7KJDX.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/keyboard","kind":"import-statement","external":true}],"exports":["AttendableContainer","AttentionGlyph","AttentionManager","LocalBackend","MemoryBackend","RootAttentionProvider","SelectionSchema","Syncing","ViewStateManager","ViewStateProvider","advance","createDefaultBackends","defaultSelection","defineViewState","expandAttendableId","getAttendables","getLinkedVariant","getParentId","getSegmentId","getSelectionSet","isLinkedSegment","linkedSegment","resolveSelection","selectionAspect","toggleSelection","useArticleKeyboardNavigation","useAttended","useAttention","useAttentionAttributes","useAttentionContext","useSelection","useSelectionActions","useViewState","useViewStateActions","useViewStateManager"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0},"src/components/AttentionGlyph/AttentionGlyph.tsx":{"bytesInOutput":2911},"src/useArticleKeyboardNavigation.ts":{"bytesInOutput":1896}},"bytes":6408},"dist/lib/node-esm/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1876},"dist/lib/node-esm/testing/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-5JUZQDCR.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-HWN7KJDX.mjs","kind":"import-statement"},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["withAttention"],"entryPoint":"src/testing/index.ts","inputs":{"src/testing/decorators/withAttention.ts":{"bytesInOutput":610},"src/testing/index.ts":{"bytesInOutput":0}},"bytes":955},"dist/lib/node-esm/chunk-5JUZQDCR.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":15599},"dist/lib/node-esm/chunk-5JUZQDCR.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-HWN7KJDX.mjs","kind":"import-statement"},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true}],"exports":["AttendableContainer","RootAttentionProvider","ViewStateProvider","useAttended","useAttention","useAttentionAttributes","useAttentionContext","useSelection","useSelectionActions","useViewState","useViewStateActions","useViewStateManager"],"inputs":{"src/components/AttentionProvider/AttentionProvider.tsx":{"bytesInOutput":3786},"src/components/ViewStateProvider/ViewStateProvider.tsx":{"bytesInOutput":3076}},"bytes":7558},"dist/lib/node-esm/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/node-esm/types/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-HWN7KJDX.mjs","kind":"import-statement"}],"exports":["AttentionManager","LocalBackend","MemoryBackend","SelectionSchema","ViewStateManager","createDefaultBackends","defaultSelection","defineViewState","expandAttendableId","getAttendables","getLinkedVariant","getParentId","getSegmentId","getSelectionSet","isLinkedSegment","linkedSegment","resolveSelection","selectionAspect","toggleSelection"],"entryPoint":"src/types/index.ts","inputs":{"src/types/index.ts":{"bytesInOutput":0}},"bytes":898},"dist/lib/node-esm/chunk-HWN7KJDX.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":33378},"dist/lib/node-esm/chunk-HWN7KJDX.mjs":{"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"effect/Match","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true}],"exports":["AttentionManager","LocalBackend","MemoryBackend","SelectionSchema","ViewStateManager","createDefaultBackends","defaultSelection","defineViewState","expandAttendableId","getAttendables","getLinkedVariant","getParentId","getSegmentId","getSelectionSet","isLinkedSegment","linkedSegment","resolveSelection","selectionAspect","toggleSelection"],"inputs":{"src/attention.ts":{"bytesInOutput":5433},"src/view-state/view-state.ts":{"bytesInOutput":1053},"src/view-state/backends.ts":{"bytesInOutput":3752},"src/selection.ts":{"bytesInOutput":2312}},"bytes":13164}}}
@@ -1,11 +1,11 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
  import {
3
3
  RootAttentionProvider,
4
- SelectionProvider
5
- } from "../chunk-ZTUVSH4P.mjs";
4
+ ViewStateProvider
5
+ } from "../chunk-5JUZQDCR.mjs";
6
6
  import {
7
7
  AttentionManager
8
- } from "../chunk-6INLBC62.mjs";
8
+ } from "../chunk-HWN7KJDX.mjs";
9
9
 
10
10
  // src/testing/decorators/withAttention.ts
11
11
  import { Registry, RegistryContext } from "@effect-atom/atom-react";
@@ -22,7 +22,7 @@ var withAttention = (initialAttendedId) => {
22
22
  value: registry
23
23
  }, createElement(RootAttentionProvider, {
24
24
  attention
25
- }, createElement(SelectionProvider, {}, createElement(Story))));
25
+ }, createElement(ViewStateProvider, {}, createElement(Story))));
26
26
  };
27
27
  };
28
28
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/testing/decorators/withAttention.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Registry, RegistryContext } from '@effect-atom/atom-react';\nimport { type Decorator } from '@storybook/react';\nimport { createElement, useMemo } from 'react';\n\nimport { AttentionManager } from '../../attention';\nimport { RootAttentionProvider, SelectionProvider } from '../../components';\n\n/**\n * Storybook decorator that provides attention context.\n * @param initialAttendedId Optional ID to set as initially attended.\n */\nexport const withAttention = (initialAttendedId?: string): Decorator => {\n return (Story) => {\n const registry = useMemo(() => Registry.make(), []);\n const attention = useMemo(\n () => (initialAttendedId ? new AttentionManager(registry, [initialAttendedId]) : undefined),\n [registry],\n );\n\n return createElement(\n RegistryContext.Provider,\n { value: registry },\n createElement(RootAttentionProvider, { attention }, createElement(SelectionProvider, {}, createElement(Story))),\n );\n };\n};\n"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Registry, RegistryContext } from '@effect-atom/atom-react';\nimport { type Decorator } from '@storybook/react';\nimport { createElement, useMemo } from 'react';\n\nimport { AttentionManager } from '../../attention';\nimport { RootAttentionProvider, ViewStateProvider } from '../../components';\n\n/**\n * Storybook decorator that provides attention context.\n * @param initialAttendedId Optional ID to set as initially attended.\n */\nexport const withAttention = (initialAttendedId?: string): Decorator => {\n return (Story) => {\n const registry = useMemo(() => Registry.make(), []);\n const attention = useMemo(\n () => (initialAttendedId ? new AttentionManager(registry, [initialAttendedId]) : undefined),\n [registry],\n );\n\n return createElement(\n RegistryContext.Provider,\n { value: registry },\n createElement(RootAttentionProvider, { attention }, createElement(ViewStateProvider, {}, createElement(Story))),\n );\n };\n};\n"],
5
5
  "mappings": ";;;;;;;;;;AAIA,SAASA,UAAUC,uBAAuB;AAE1C,SAASC,eAAeC,eAAe;AAShC,IAAMC,gBAAgB,CAACC,sBAAAA;AAC5B,SAAO,CAACC,UAAAA;AACN,UAAMC,WAAWC,QAAQ,MAAMC,SAASC,KAAI,GAAI,CAAA,CAAE;AAClD,UAAMC,YAAYH,QAChB,MAAOH,oBAAoB,IAAIO,iBAAiBL,UAAU;MAACF;KAAkB,IAAIQ,QACjF;MAACN;KAAS;AAGZ,WAAOO,cACLC,gBAAgBC,UAChB;MAAEC,OAAOV;IAAS,GAClBO,cAAcI,uBAAuB;MAAEP;IAAU,GAAGG,cAAcK,mBAAmB,CAAC,GAAGL,cAAcR,KAAAA,CAAAA,CAAAA,CAAAA;EAE3G;AACF;",
6
- "names": ["Registry", "RegistryContext", "createElement", "useMemo", "withAttention", "initialAttendedId", "Story", "registry", "useMemo", "Registry", "make", "attention", "AttentionManager", "undefined", "createElement", "RegistryContext", "Provider", "value", "RootAttentionProvider", "SelectionProvider"]
6
+ "names": ["Registry", "RegistryContext", "createElement", "useMemo", "withAttention", "initialAttendedId", "Story", "registry", "useMemo", "Registry", "make", "attention", "AttentionManager", "undefined", "createElement", "RegistryContext", "Provider", "value", "RootAttentionProvider", "ViewStateProvider"]
7
7
  }
@@ -1,9 +1,13 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
  import {
3
3
  AttentionManager,
4
- SelectionManager,
4
+ LocalBackend,
5
+ MemoryBackend,
5
6
  SelectionSchema,
7
+ ViewStateManager,
8
+ createDefaultBackends,
6
9
  defaultSelection,
10
+ defineViewState,
7
11
  expandAttendableId,
8
12
  getAttendables,
9
13
  getLinkedVariant,
@@ -11,13 +15,20 @@ import {
11
15
  getSegmentId,
12
16
  getSelectionSet,
13
17
  isLinkedSegment,
14
- linkedSegment
15
- } from "../chunk-6INLBC62.mjs";
18
+ linkedSegment,
19
+ resolveSelection,
20
+ selectionAspect,
21
+ toggleSelection
22
+ } from "../chunk-HWN7KJDX.mjs";
16
23
  export {
17
24
  AttentionManager,
18
- SelectionManager,
25
+ LocalBackend,
26
+ MemoryBackend,
19
27
  SelectionSchema,
28
+ ViewStateManager,
29
+ createDefaultBackends,
20
30
  defaultSelection,
31
+ defineViewState,
21
32
  expandAttendableId,
22
33
  getAttendables,
23
34
  getLinkedVariant,
@@ -25,6 +36,9 @@ export {
25
36
  getSegmentId,
26
37
  getSelectionSet,
27
38
  isLinkedSegment,
28
- linkedSegment
39
+ linkedSegment,
40
+ resolveSelection,
41
+ selectionAspect,
42
+ toggleSelection
29
43
  };
30
44
  //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,29 @@
1
+ import React, { type PropsWithChildren } from 'react';
2
+ import { type SelectionMode, type SelectionResult } from '../../selection';
3
+ import { type AspectDef, ViewStateManager } from '../../view-state';
4
+ /** Provides the per-context UI state manager. Replaces the former `SelectionProvider`. */
5
+ export declare const ViewStateProvider: ({ children, manager: managerProp, }: PropsWithChildren<{
6
+ manager?: ViewStateManager;
7
+ }>) => React.JSX.Element;
8
+ /** Access the underlying ViewStateManager from context. Throws when used outside a `ViewStateProvider`. */
9
+ export declare const useViewStateManager: () => ViewStateManager;
10
+ /** Reactive read of an aspect value for a context; yields the aspect default when unset or unprovided. */
11
+ export declare const useViewState: <T>(aspect: AspectDef<T>, contextId?: string) => T;
12
+ export type UseViewStateActions<T> = {
13
+ set: (value: T) => void;
14
+ update: (fn: (prev: T) => T) => void;
15
+ clear: () => void;
16
+ };
17
+ export declare const useViewStateActions: <T>(aspect: AspectDef<T>, contextId?: string) => UseViewStateActions<T>;
18
+ /** Resolved selection value for `contextId` in the requested `mode` (default `multi`). */
19
+ export declare const useSelection: <T extends SelectionMode>(contextId?: string, mode?: T) => SelectionResult<T>;
20
+ export type UseSelectionActions = {
21
+ single: (id: string) => void;
22
+ multi: (ids: string[]) => void;
23
+ range: (from: string, to: string) => void;
24
+ toggle: (id: string) => void;
25
+ clear: () => void;
26
+ };
27
+ /** Selection mutators for a single context, built on the generic ViewState actions. */
28
+ export declare const useSelectionActions: (contextId?: string) => UseSelectionActions;
29
+ //# sourceMappingURL=ViewStateProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ViewStateProvider.d.ts","sourceRoot":"","sources":["../../../../../src/components/ViewStateProvider/ViewStateProvider.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAA4C,MAAM,OAAO,CAAC;AAKhG,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,eAAe,EAIrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,SAAS,EAAE,gBAAgB,EAAyB,MAAM,kBAAkB,CAAC;AAY3F,0FAA0F;AAC1F,eAAO,MAAM,iBAAiB,wCAG3B,iBAAiB,CAAC;IAAE,OAAO,CAAC,EAAE,gBAAgB,CAAA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ewStateProvider.test.d.ts","sourceRoot":"","sources":["../../../../../src/components/ViewStateProvider/ViewStateProvider.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from './ViewStateProvider';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ViewStateProvider/index.ts"],"names":[],"mappings":"AAIA,cAAc,qBAAqB,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export * from './AttentionGlyph';
2
2
  export * from './AttentionProvider';
3
- export * from './SelectionProvider';
3
+ export * from './ViewStateProvider';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -2,4 +2,5 @@ export * from './attention';
2
2
  export * from './components';
3
3
  export * from './selection';
4
4
  export * from './useArticleKeyboardNavigation';
5
+ export * from './view-state';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,cAAc,CAAC"}
@@ -1,5 +1,5 @@
1
- import { Atom, type Registry } from '@effect-atom/atom-react';
2
1
  import * as Schema from 'effect/Schema';
2
+ import { type AspectDef, type ViewStateManager } from './view-state';
3
3
  export type SelectionMode = 'single' | 'multi' | 'range' | 'multi-range';
4
4
  export declare const SelectionSchema: Schema.mutable<Schema.Union<[Schema.mutable<Schema.Struct<{
5
5
  mode: Schema.Literal<["single"]>;
@@ -37,45 +37,15 @@ export type SelectionResult<T extends SelectionMode> = T extends 'single' ? stri
37
37
  from: string;
38
38
  to: string;
39
39
  }[] : never;
40
- export declare const getSelectionSet: (selectionManager: SelectionManager, contextId?: string) => Set<string>;
40
+ /** Selection state for a context, stored in memory (ephemeral, per-device session). */
41
+ export declare const selectionAspect: AspectDef<Selection>;
41
42
  /**
42
- * Manages selection state for different contexts.
43
- * Each context maintains its own selection mode and state.
43
+ * Extract the typed result for `mode` from a stored selection value, returning the requested
44
+ * mode's default when the stored value is absent or holds a different mode.
44
45
  */
45
- export declare class SelectionManager {
46
- private readonly _registry;
47
- private readonly _state;
48
- constructor(_registry: Registry.Registry, initial?: Record<string, Selection>);
49
- /**
50
- * Get the state atom for reactive access in the graph system.
51
- */
52
- get state(): Atom.Atom<{
53
- selections: Record<string, Selection>;
54
- }>;
55
- /**
56
- * Gets the current state.
57
- */
58
- getState(): {
59
- selections: Record<string, Selection>;
60
- };
61
- /**
62
- * Subscribe to changes in the selection state.
63
- */
64
- subscribe(cb: (state: {
65
- selections: Record<string, Selection>;
66
- }) => void): () => void;
67
- getSelectionContexts(): string[];
68
- getSelection(contextId: string): Selection | undefined;
69
- getSelection<T extends SelectionMode>(contextId: string, mode: T): Selection;
70
- getSelected<T extends SelectionMode>(contextId: string, mode?: T): SelectionResult<T>;
71
- updateSingle(contextId: string, id: string): void;
72
- updateMulti(contextId: string, ids: string[]): void;
73
- updateRange(contextId: string, from: string, to: string): void;
74
- updateMultiRange(contextId: string, ranges: {
75
- from: string;
76
- to: string;
77
- }[]): void;
78
- clearSelection(contextId: string): void;
79
- toggleSelection(contextId: string, id: string): void;
80
- }
46
+ export declare const resolveSelection: <T extends SelectionMode>(selection: Selection | undefined, mode: T) => SelectionResult<T>;
47
+ /** Toggle `id` within a multi selection; resets to a multi selection if the current value differs. */
48
+ export declare const toggleSelection: (selection: Selection | undefined, id: string) => Selection;
49
+ /** Union of all multi-selected ids across every selection context, plus an optional explicit id. */
50
+ export declare const getSelectionSet: (manager: ViewStateManager, contextId?: string) => Set<string>;
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 //# sourceMappingURL=selection.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selection.test.d.ts","sourceRoot":"","sources":["../../../src/selection.test.ts"],"names":[],"mappings":""}
@@ -1,3 +1,4 @@
1
1
  export * from '../attention';
2
2
  export * from '../selection';
3
+ export * from '../view-state';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAOA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAOA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { Atom, type Registry } from '@effect-atom/atom-react';
2
+ import { type AspectDef, type BackendName, type ViewStateBackend } from './view-state';
3
+ /** In-memory backend: state is ephemeral and scoped to the session (never persisted). */
4
+ export declare class MemoryBackend implements ViewStateBackend {
5
+ #private;
6
+ atom<T>(aspect: AspectDef<T>, contextId: string): Atom.Writable<T>;
7
+ contexts<T>(aspect: AspectDef<T>): string[];
8
+ }
9
+ export interface LocalBackendOptions {
10
+ readonly registry: Registry.Registry;
11
+ /** Injectable for tests; defaults to `window.localStorage`. */
12
+ readonly storage?: Storage;
13
+ }
14
+ /** localStorage-backed backend: seeds atoms from storage, persists on set, syncs across tabs. */
15
+ export declare class LocalBackend implements ViewStateBackend {
16
+ #private;
17
+ constructor({ registry, storage }: LocalBackendOptions);
18
+ atom<T>(aspect: AspectDef<T>, contextId: string): Atom.Writable<T>;
19
+ persist<T>(aspect: AspectDef<T>, contextId: string, value: T): void;
20
+ contexts<T>(aspect: AspectDef<T>): string[];
21
+ dispose(): void;
22
+ }
23
+ export declare const createDefaultBackends: (registry: Registry.Registry) => Record<BackendName, ViewStateBackend>;
24
+ //# sourceMappingURL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eAAO,MAAM,qBAAqB,aAAc,QAAQ,CAAC,QAAQ,KAAG,MAAM,CAAC,WAAW,EAAE,gBAAgB,CAGtG,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=backends.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backends.test.d.ts","sourceRoot":"","sources":["../../../../src/view-state/backends.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export * from './view-state';
2
+ export * from './backends';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/view-state/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { type Atom, type Registry } from '@effect-atom/atom-react';
2
+ import type * as Schema from 'effect/Schema';
3
+ /**
4
+ * Persistence backend identifier. `personal` (ECHO/personal-space) is reserved for a future backend.
5
+ */
6
+ export type BackendName = 'memory' | 'local';
7
+ /**
8
+ * Declares a kind of per-context UI state. The value type `T` is inferred from the schema.
9
+ */
10
+ export interface AspectDef<T> {
11
+ readonly key: string;
12
+ readonly backend: BackendName;
13
+ readonly schema: Schema.Schema<T, any>;
14
+ readonly defaultValue: () => T;
15
+ }
16
+ /**
17
+ * Identity helper that pins the value type from the schema while keeping the literal `key`/`backend`.
18
+ */
19
+ export declare const defineViewState: <T>(def: AspectDef<T>) => AspectDef<T>;
20
+ /**
21
+ * A backend produces a reactive, writable atom for each `(aspect, contextId)` pair. Backends may
22
+ * hydrate asynchronously (an ECHO backend would), yielding `aspect.defaultValue()` until loaded;
23
+ * the memory and local backends resolve synchronously.
24
+ */
25
+ export interface ViewStateBackend {
26
+ /** Stable atom for the pair; created (and seeded) on first access, cached thereafter. */
27
+ atom: <T>(aspect: AspectDef<T>, contextId: string) => Atom.Writable<T>;
28
+ /** Persist a value after the atom is updated. No-op for in-memory backends. */
29
+ persist?: <T>(aspect: AspectDef<T>, contextId: string, value: T) => void;
30
+ /** Context ids that currently hold a value for the aspect. */
31
+ contexts: <T>(aspect: AspectDef<T>) => string[];
32
+ /** Release listeners/timers (used by tests; app-lifetime managers do not call this). */
33
+ dispose?: () => void;
34
+ }
35
+ export interface ViewStateManagerOptions {
36
+ readonly registry: Registry.Registry;
37
+ readonly backends: Record<BackendName, ViewStateBackend>;
38
+ }
39
+ /**
40
+ * Routes per-context UI state to the backend declared by each aspect. Reads/writes go through the
41
+ * effect-atom registry so React hooks and graph atoms observe changes uniformly.
42
+ */
43
+ export declare class ViewStateManager {
44
+ #private;
45
+ constructor({ registry, backends }: ViewStateManagerOptions);
46
+ /** Reactive atom for `(aspect, contextId)`; pass to `registry.get` inside derived atoms/hooks. */
47
+ atom<T>(aspect: AspectDef<T>, contextId: string): Atom.Writable<T>;
48
+ get<T>(aspect: AspectDef<T>, contextId: string): T;
49
+ set<T>(aspect: AspectDef<T>, contextId: string, value: T): void;
50
+ update<T>(aspect: AspectDef<T>, contextId: string, fn: (prev: T) => T): void;
51
+ subscribe<T>(aspect: AspectDef<T>, contextId: string, cb: (value: T) => void): () => void;
52
+ contexts<T>(aspect: AspectDef<T>): string[];
53
+ }
54
+ //# sourceMappingURL=view-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-state.d.ts","sourceRoot":"","sources":["../../../../src/view-state/view-state.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAE7C;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAG9B,Q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C,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC,CAEjD;IAED,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAI9D;IAED,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAE3E;IAED,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI,CAGxF;IAED,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,CAE1C;CACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=view-state.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-state.test.d.ts","sourceRoot":"","sources":["../../../../src/view-state/view-state.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import '@testing-library/jest-dom/vitest';
2
+ //# sourceMappingURL=vitest-setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest-setup.d.ts","sourceRoot":"","sources":["../../../src/vitest-setup.ts"],"names":[],"mappings":"AAKA,OAAO,kCAAkC,CAAC"}