@dxos/react-ui-attention 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6

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 (47) hide show
  1. package/dist/lib/browser/{chunk-HJRZWOEX.mjs → chunk-4SEURHOL.mjs} +122 -106
  2. package/dist/lib/browser/chunk-4SEURHOL.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-GMKHOVJ5.mjs +1 -0
  4. package/dist/lib/browser/chunk-GMKHOVJ5.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +17 -12
  6. package/dist/lib/browser/index.mjs.map +3 -3
  7. package/dist/lib/browser/meta.json +1 -1
  8. package/dist/lib/browser/testing/index.mjs +16 -7
  9. package/dist/lib/browser/testing/index.mjs.map +3 -3
  10. package/dist/lib/browser/types.mjs +1 -6
  11. package/dist/lib/node-esm/{chunk-7TQWDE4M.mjs → chunk-6PQ4P7AL.mjs} +122 -105
  12. package/dist/lib/node-esm/chunk-6PQ4P7AL.mjs.map +7 -0
  13. package/dist/lib/node-esm/chunk-UHVMYYIB.mjs +2 -0
  14. package/dist/lib/node-esm/chunk-UHVMYYIB.mjs.map +7 -0
  15. package/dist/lib/node-esm/index.mjs +17 -12
  16. package/dist/lib/node-esm/index.mjs.map +3 -3
  17. package/dist/lib/node-esm/meta.json +1 -1
  18. package/dist/lib/node-esm/testing/index.mjs +16 -7
  19. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  20. package/dist/lib/node-esm/types.mjs +1 -6
  21. package/dist/types/src/attention.d.ts +41 -10
  22. package/dist/types/src/attention.d.ts.map +1 -1
  23. package/dist/types/src/components/AttentionGlyph.d.ts.map +1 -1
  24. package/dist/types/src/components/AttentionProvider.d.ts +9 -11
  25. package/dist/types/src/components/AttentionProvider.d.ts.map +1 -1
  26. package/dist/types/src/components/SelectionProvider.d.ts.map +1 -1
  27. package/dist/types/src/testing/decorators/withAttention.d.ts +5 -1
  28. package/dist/types/src/testing/decorators/withAttention.d.ts.map +1 -1
  29. package/dist/types/src/types.d.ts +0 -1
  30. package/dist/types/src/types.d.ts.map +1 -1
  31. package/dist/types/tsconfig.tsbuildinfo +1 -1
  32. package/package.json +16 -16
  33. package/src/attention.test.ts +179 -23
  34. package/src/attention.ts +132 -54
  35. package/src/components/AttentionGlyph.stories.tsx +3 -3
  36. package/src/components/AttentionGlyph.tsx +12 -5
  37. package/src/components/AttentionProvider.stories.tsx +2 -2
  38. package/src/components/AttentionProvider.tsx +21 -48
  39. package/src/components/SelectionProvider.tsx +6 -4
  40. package/src/testing/decorators/withAttention.ts +18 -7
  41. package/src/types.ts +0 -3
  42. package/dist/lib/browser/chunk-HJRZWOEX.mjs.map +0 -7
  43. package/dist/lib/browser/chunk-PAZBZOO2.mjs +0 -7
  44. package/dist/lib/browser/chunk-PAZBZOO2.mjs.map +0 -7
  45. package/dist/lib/node-esm/chunk-7TQWDE4M.mjs.map +0 -7
  46. package/dist/lib/node-esm/chunk-PMGNPL4M.mjs +0 -9
  47. package/dist/lib/node-esm/chunk-PMGNPL4M.mjs.map +0 -7
@@ -1 +1 @@
1
- {"inputs":{"src/types.ts":{"bytes":1000,"imports":[],"format":"esm"},"src/attention.ts":{"bytes":18649,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"src/components/AttentionGlyph.tsx":{"bytes":10517,"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/AttentionProvider.tsx":{"bytes":20805,"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"},{"path":"src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"src/selection.ts":{"bytes":28228,"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.tsx":{"bytes":15416,"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/index.ts":{"bytes":708,"imports":[{"path":"src/components/AttentionGlyph.tsx","kind":"import-statement","original":"./AttentionGlyph"},{"path":"src/components/AttentionProvider.tsx","kind":"import-statement","original":"./AttentionProvider"},{"path":"src/components/SelectionProvider.tsx","kind":"import-statement","original":"./SelectionProvider"}],"format":"esm"},"src/index.ts":{"bytes":726,"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/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"src/testing/decorators/withAttention.ts":{"bytes":2287,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/components/index.ts","kind":"import-statement","original":"../../components"}],"format":"esm"},"src/testing/decorators/index.ts":{"bytes":493,"imports":[{"path":"src/testing/decorators/withAttention.ts","kind":"import-statement","original":"./withAttention"}],"format":"esm"},"src/testing/index.ts":{"bytes":471,"imports":[{"path":"src/testing/decorators/index.ts","kind":"import-statement","original":"./decorators"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5370},"dist/lib/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-HJRZWOEX.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-PAZBZOO2.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}],"exports":["ATTENDABLE_ATTRIBUTE","ATTENDABLE_PATH_SEPARATOR","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionGlyph","AttentionManager","AttentionProvider","RootAttentionProvider","SelectionManager","SelectionProvider","SelectionSchema","Syncing","defaultSelection","getAttendables","getSelectionSet","useAttended","useAttention","useAttentionAttributes","useAttentionContext","useAttentionPath","useSelected","useSelectionActions","useSelectionManager"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0},"src/components/AttentionGlyph.tsx":{"bytesInOutput":3223}},"bytes":4350},"dist/lib/browser/types.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/types.mjs":{"imports":[{"path":"dist/lib/browser/chunk-PAZBZOO2.mjs","kind":"import-statement"}],"exports":["ATTENDABLE_PATH_SEPARATOR"],"entryPoint":"src/types.ts","inputs":{},"bytes":143},"dist/lib/browser/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1257},"dist/lib/browser/testing/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-HJRZWOEX.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-PAZBZOO2.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":387},"src/testing/index.ts":{"bytesInOutput":0}},"bytes":612},"dist/lib/browser/chunk-HJRZWOEX.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":41564},"dist/lib/browser/chunk-HJRZWOEX.mjs":{"imports":[{"path":"dist/lib/browser/chunk-PAZBZOO2.mjs","kind":"import-statement"},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"@dxos/util","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":"@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":"effect/Match","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","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":["ATTENDABLE_ATTRIBUTE","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionManager","AttentionProvider","RootAttentionProvider","SelectionManager","SelectionProvider","SelectionSchema","defaultSelection","getAttendables","getSelectionSet","useAttended","useAttention","useAttentionAttributes","useAttentionContext","useAttentionPath","useSelected","useSelectionActions","useSelectionManager"],"inputs":{"src/attention.ts":{"bytesInOutput":4196},"src/components/AttentionProvider.tsx":{"bytesInOutput":4350},"src/selection.ts":{"bytesInOutput":7192},"src/components/SelectionProvider.tsx":{"bytesInOutput":3445}},"bytes":19870},"dist/lib/browser/chunk-PAZBZOO2.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":503},"dist/lib/browser/chunk-PAZBZOO2.mjs":{"imports":[],"exports":["ATTENDABLE_PATH_SEPARATOR"],"inputs":{"src/types.ts":{"bytesInOutput":37}},"bytes":138}}}
1
+ {"inputs":{"src/attention.ts":{"bytes":25938,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true}],"format":"esm"},"src/components/AttentionGlyph.tsx":{"bytes":10090,"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/AttentionProvider.tsx":{"bytes":18018,"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/selection.ts":{"bytes":28228,"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.tsx":{"bytes":15632,"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/index.ts":{"bytes":708,"imports":[{"path":"src/components/AttentionGlyph.tsx","kind":"import-statement","original":"./AttentionGlyph"},{"path":"src/components/AttentionProvider.tsx","kind":"import-statement","original":"./AttentionProvider"},{"path":"src/components/SelectionProvider.tsx","kind":"import-statement","original":"./SelectionProvider"}],"format":"esm"},"src/types.ts":{"bytes":613,"imports":[],"format":"esm"},"src/index.ts":{"bytes":726,"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/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"src/testing/decorators/withAttention.ts":{"bytes":3609,"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":493,"imports":[{"path":"src/testing/decorators/withAttention.ts","kind":"import-statement","original":"./withAttention"}],"format":"esm"},"src/testing/index.ts":{"bytes":471,"imports":[{"path":"src/testing/decorators/index.ts","kind":"import-statement","original":"./decorators"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5234},"dist/lib/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-GMKHOVJ5.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-4SEURHOL.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}],"exports":["ATTENDABLE_ATTRIBUTE","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionGlyph","AttentionManager","RootAttentionProvider","SelectionManager","SelectionProvider","SelectionSchema","Syncing","defaultSelection","expandAttendableId","getAttendables","getLinkedVariant","getParentId","getSegmentId","getSelectionSet","isLinkedSegment","linkedSegment","useAttended","useAttention","useAttentionAttributes","useAttentionContext","useSelected","useSelectionActions","useSelectionManager"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0},"src/components/AttentionGlyph.tsx":{"bytesInOutput":2992}},"bytes":4189},"dist/lib/browser/types.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/types.mjs":{"imports":[{"path":"dist/lib/browser/chunk-GMKHOVJ5.mjs","kind":"import-statement"}],"exports":[],"entryPoint":"src/types.ts","inputs":{},"bytes":66},"dist/lib/browser/chunk-GMKHOVJ5.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/chunk-GMKHOVJ5.mjs":{"imports":[],"exports":[],"inputs":{"src/types.ts":{"bytesInOutput":0}},"bytes":44},"dist/lib/browser/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1871},"dist/lib/browser/testing/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-4SEURHOL.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":823},"dist/lib/browser/chunk-4SEURHOL.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":43665},"dist/lib/browser/chunk-4SEURHOL.mjs":{"imports":[{"path":"@effect-atom/atom-react","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":"@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":"effect/Match","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","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":["ATTENDABLE_ATTRIBUTE","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionManager","RootAttentionProvider","SelectionManager","SelectionProvider","SelectionSchema","defaultSelection","expandAttendableId","getAttendables","getLinkedVariant","getParentId","getSegmentId","getSelectionSet","isLinkedSegment","linkedSegment","useAttended","useAttention","useAttentionAttributes","useAttentionContext","useSelected","useSelectionActions","useSelectionManager"],"inputs":{"src/attention.ts":{"bytesInOutput":5433},"src/components/AttentionProvider.tsx":{"bytesInOutput":3752},"src/selection.ts":{"bytesInOutput":7192},"src/components/SelectionProvider.tsx":{"bytesInOutput":3533}},"bytes":20596}}}
@@ -1,17 +1,26 @@
1
1
  import {
2
+ AttentionManager,
2
3
  RootAttentionProvider,
3
4
  SelectionProvider
4
- } from "../chunk-HJRZWOEX.mjs";
5
- import "../chunk-PAZBZOO2.mjs";
5
+ } from "../chunk-4SEURHOL.mjs";
6
6
 
7
7
  // src/testing/decorators/withAttention.ts
8
8
  import { Registry, RegistryContext } from "@effect-atom/atom-react";
9
9
  import { createElement, useMemo } from "react";
10
- var withAttention = (Story) => {
11
- const registry = useMemo(() => Registry.make(), []);
12
- return createElement(RegistryContext.Provider, {
13
- value: registry
14
- }, createElement(RootAttentionProvider, {}, createElement(SelectionProvider, {}, createElement(Story))));
10
+ var withAttention = (initialAttendedId) => {
11
+ return (Story) => {
12
+ const registry = useMemo(() => Registry.make(), []);
13
+ const attention = useMemo(() => initialAttendedId ? new AttentionManager(registry, [
14
+ initialAttendedId
15
+ ]) : void 0, [
16
+ registry
17
+ ]);
18
+ return createElement(RegistryContext.Provider, {
19
+ value: registry
20
+ }, createElement(RootAttentionProvider, {
21
+ attention
22
+ }, createElement(SelectionProvider, {}, createElement(Story))));
23
+ };
15
24
  };
16
25
  export {
17
26
  withAttention
@@ -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 { RootAttentionProvider, SelectionProvider } from '../../components';\n\nexport const withAttention: Decorator = (Story) => {\n const registry = useMemo(() => Registry.make(), []);\n return createElement(\n RegistryContext.Provider,\n { value: registry },\n createElement(RootAttentionProvider, {}, createElement(SelectionProvider, {}, createElement(Story))),\n );\n};\n"],
5
- "mappings": ";;;;;;;AAIA,SAASA,UAAUC,uBAAuB;AAE1C,SAASC,eAAeC,eAAe;AAIhC,IAAMC,gBAA2B,CAACC,UAAAA;AACvC,QAAMC,WAAWC,QAAQ,MAAMC,SAASC,KAAI,GAAI,CAAA,CAAE;AAClD,SAAOC,cACLC,gBAAgBC,UAChB;IAAEC,OAAOP;EAAS,GAClBI,cAAcI,uBAAuB,CAAC,GAAGJ,cAAcK,mBAAmB,CAAC,GAAGL,cAAcL,KAAAA,CAAAA,CAAAA,CAAAA;AAEhG;",
6
- "names": ["Registry", "RegistryContext", "createElement", "useMemo", "withAttention", "Story", "registry", "useMemo", "Registry", "make", "createElement", "RegistryContext", "Provider", "value", "RootAttentionProvider", "SelectionProvider"]
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 return createElement(\n RegistryContext.Provider,\n { value: registry },\n createElement(RootAttentionProvider, { attention }, createElement(SelectionProvider, {}, createElement(Story))),\n );\n };\n};\n"],
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;AAEZ,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"]
7
7
  }
@@ -1,7 +1,2 @@
1
- import {
2
- ATTENDABLE_PATH_SEPARATOR
3
- } from "./chunk-PAZBZOO2.mjs";
4
- export {
5
- ATTENDABLE_PATH_SEPARATOR
6
- };
1
+ import "./chunk-GMKHOVJ5.mjs";
7
2
  //# sourceMappingURL=types.mjs.map
@@ -1,39 +1,32 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- ATTENDABLE_PATH_SEPARATOR
4
- } from "./chunk-PMGNPL4M.mjs";
5
2
 
6
3
  // src/attention.ts
7
4
  import { Atom } from "@effect-atom/atom-react";
8
- import { ComplexMap } from "@dxos/util";
9
- var stringKey = (key) => key.join(",");
10
5
  var AttentionManager = class {
11
6
  _registry;
12
- // Each attention path is associated with an attention atom.
13
- // The lookup is not a reactive object to ensure that attention for each path is subscribable independently.
14
- _map = new ComplexMap(stringKey);
7
+ _map = /* @__PURE__ */ new Map();
15
8
  _currentAtom;
16
9
  constructor(_registry, initial = []) {
17
10
  this._registry = _registry;
18
- this._currentAtom = Atom.make([]);
11
+ this._currentAtom = Atom.make([]).pipe(Atom.keepAlive);
19
12
  if (initial.length > 0) {
20
13
  this.update(initial);
21
14
  }
22
15
  }
23
16
  /**
24
- * Atom for the currently attended element path.
17
+ * Atom for the currently attended element IDs.
25
18
  */
26
19
  get current() {
27
20
  return this._currentAtom;
28
21
  }
29
22
  /**
30
- * Gets the currently attended element path.
23
+ * Gets the currently attended element IDs.
31
24
  */
32
25
  getCurrent() {
33
26
  return this._registry.get(this._currentAtom);
34
27
  }
35
28
  /**
36
- * Subscribe to changes in the current attention path.
29
+ * Subscribe to changes in the current attention IDs.
37
30
  */
38
31
  subscribeCurrent(cb) {
39
32
  this._registry.get(this._currentAtom);
@@ -42,30 +35,30 @@ var AttentionManager = class {
42
35
  });
43
36
  }
44
37
  /**
45
- * All attention paths.
38
+ * All tracked qualified IDs.
46
39
  */
47
40
  keys() {
48
41
  return Array.from(this._map.keys());
49
42
  }
50
43
  /**
51
- * Get the attention state for a given path.
44
+ * Get the attention state for a given qualified ID.
52
45
  */
53
- get(key) {
54
- const atom = this._getAtom(key);
46
+ get(id) {
47
+ const atom = this._getAtom(id);
55
48
  return this._registry.get(atom);
56
49
  }
57
50
  /**
58
- * Subscribe to changes in the attention state for a given path.
51
+ * Subscribe to changes in the attention state for a given qualified ID.
59
52
  */
60
- subscribe(key, cb) {
61
- const atom = this._getAtom(key);
53
+ subscribe(id, cb) {
54
+ const atom = this._getAtom(id);
62
55
  this._registry.get(atom);
63
56
  return this._registry.subscribe(atom, () => {
64
57
  cb(this._registry.get(atom));
65
58
  });
66
59
  }
67
- _getAtom(key) {
68
- const existing = this._map.get(key);
60
+ _getAtom(id) {
61
+ const existing = this._map.get(id);
69
62
  if (existing) {
70
63
  return existing;
71
64
  }
@@ -73,43 +66,70 @@ var AttentionManager = class {
73
66
  hasAttention: false,
74
67
  isAncestor: false,
75
68
  isRelated: false
76
- });
77
- this._map.set(key, newAtom);
69
+ }).pipe(Atom.keepAlive);
70
+ this._map.set(id, newAtom);
78
71
  return newAtom;
79
72
  }
80
73
  /**
81
74
  * Update the currently attended element.
75
+ * Takes the array of qualified IDs collected from the DOM; the first element is the primary attended item.
76
+ * Ancestry is derived from the progressive prefixes of the primary ID.
77
+ * Relatedness is derived from the segment ID: any tracked key whose last `/` segment matches the
78
+ * attended ID's segment ID is marked `isRelated`. Additionally, if the primary ID is a linked segment
79
+ * (starts with `~`), its immediate parent gets `isRelated` alongside `isAncestor`.
82
80
  *
83
81
  * @internal
84
82
  */
85
- update(nextKey) {
86
- const currentKey = this.getCurrent();
87
- const currentRelatedTo = currentKey[0];
88
- const nextRelatedTo = nextKey[0];
89
- this._getAtom([
90
- nextRelatedTo
91
- ]);
92
- const currentRelatedKeys = this.keys().filter((key) => key[0] === currentRelatedTo);
93
- const nextRelatedKeys = this.keys().filter((key) => key[0] === nextRelatedTo && stringKey(key) !== stringKey(nextKey));
94
- const prevRelatedKeys = currentRelatedKeys.filter((curr) => !nextRelatedKeys.find((next) => stringKey(curr) === stringKey(next)));
95
- const currentAncestorKeys = currentKey.slice(1).map((_, i) => currentKey.slice(i + 1, currentKey.length));
96
- const nextAncestorKeys = nextKey.slice(1).map((_, i) => nextKey.slice(i + 1, nextKey.length));
97
- const prevAncestorKeys = currentAncestorKeys.filter((curr) => !nextAncestorKeys.find((next) => stringKey(curr) === stringKey(next)));
98
- this._registry.set(this._currentAtom, nextKey);
99
- prevRelatedKeys.forEach((key) => this._set(key, {}));
100
- prevAncestorKeys.forEach((key) => this._set(key, {}));
101
- nextRelatedKeys.forEach((key) => this._set(key, {
102
- isRelated: true
103
- }));
104
- nextAncestorKeys.forEach((key) => this._set(key, {
105
- isAncestor: true
106
- }));
107
- this._set(nextKey, {
108
- hasAttention: true
109
- });
83
+ update(nextIds) {
84
+ const primaryId = nextIds[0];
85
+ if (!primaryId) {
86
+ return;
87
+ }
88
+ const currentIds = this.getCurrent();
89
+ const prevPrimaryId = currentIds[0];
90
+ if (prevPrimaryId) {
91
+ const prevPrefixes = expandAttendableId(prevPrimaryId);
92
+ for (const prefix of prevPrefixes) {
93
+ this._set(prefix, {});
94
+ }
95
+ const prevSegmentId = getSegmentId(prevPrimaryId);
96
+ for (const key of this.keys()) {
97
+ if (getSegmentId(key) === prevSegmentId) {
98
+ this._set(key, {});
99
+ }
100
+ }
101
+ }
102
+ this._registry.set(this._currentAtom, nextIds);
103
+ const prefixes = expandAttendableId(primaryId);
104
+ const prefixSet = new Set(prefixes);
105
+ const linkedParent = isLinkedSegment(primaryId) ? getParentId(primaryId) : void 0;
106
+ for (const prefix of prefixes) {
107
+ if (prefix === primaryId) {
108
+ this._set(prefix, {
109
+ hasAttention: true
110
+ });
111
+ } else if (prefix === linkedParent) {
112
+ this._set(prefix, {
113
+ isAncestor: true,
114
+ isRelated: true
115
+ });
116
+ } else {
117
+ this._set(prefix, {
118
+ isAncestor: true
119
+ });
120
+ }
121
+ }
122
+ const segmentId = getSegmentId(primaryId);
123
+ for (const key of this.keys()) {
124
+ if (!prefixSet.has(key) && getSegmentId(key) === segmentId) {
125
+ this._set(key, {
126
+ isRelated: true
127
+ });
128
+ }
129
+ }
110
130
  }
111
- _set(key, attention) {
112
- const atom = this._getAtom(key);
131
+ _set(id, attention) {
132
+ const atom = this._getAtom(id);
113
133
  this._registry.set(atom, {
114
134
  hasAttention: attention.hasAttention ?? false,
115
135
  isAncestor: attention.isAncestor ?? false,
@@ -129,7 +149,7 @@ var getAttendables = (selector, cursor, acc = []) => {
129
149
  return getAttendables(selector, trigger, acc);
130
150
  }
131
151
  } else {
132
- acc.push(...attendableId.split(ATTENDABLE_PATH_SEPARATOR));
152
+ acc.push(attendableId);
133
153
  return !closestAttendable.parentElement ? acc : getAttendables(selector, closestAttendable.parentElement, acc);
134
154
  }
135
155
  }
@@ -137,6 +157,30 @@ var getAttendables = (selector, cursor, acc = []) => {
137
157
  ...new Set(acc)
138
158
  ];
139
159
  };
160
+ var LINKED_PREFIX = "~";
161
+ var expandAttendableId = (qualifiedId) => {
162
+ const segments = qualifiedId.split("/");
163
+ return segments.map((_, index) => segments.slice(0, index + 1).join("/"));
164
+ };
165
+ var isLinkedSegment = (qualifiedId) => {
166
+ const lastSegment = qualifiedId.split("/").pop() ?? "";
167
+ return lastSegment.startsWith(LINKED_PREFIX);
168
+ };
169
+ var linkedSegment = (variant) => `${LINKED_PREFIX}${variant}`;
170
+ var getLinkedVariant = (qualifiedId) => {
171
+ const lastSegment = qualifiedId.split("/").pop() ?? "";
172
+ return lastSegment.startsWith(LINKED_PREFIX) ? lastSegment.slice(LINKED_PREFIX.length) : lastSegment;
173
+ };
174
+ var getParentId = (qualifiedId) => {
175
+ if (!qualifiedId) {
176
+ return void 0;
177
+ }
178
+ const lastSlash = qualifiedId.lastIndexOf("/");
179
+ return lastSlash > 0 ? qualifiedId.slice(0, lastSlash) : void 0;
180
+ };
181
+ var getSegmentId = (qualifiedId) => {
182
+ return qualifiedId.split("/").pop() ?? qualifiedId;
183
+ };
140
184
 
141
185
  // src/components/AttentionProvider.tsx
142
186
  import { RegistryContext } from "@effect-atom/atom-react";
@@ -150,10 +194,9 @@ import { mx } from "@dxos/ui-theme";
150
194
  var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-attention/src/components/AttentionProvider.tsx";
151
195
  var ATTENTION_NAME = "Attention";
152
196
  var ATTENDABLE_ATTRIBUTE = "data-attendable-id";
153
- var ATTENTION_SOURCE_ATTRIBUTE = "data-is-attention-source";
197
+ var ATTENTION_SOURCE_ATTRIBUTE = "data-w-attention-source";
154
198
  var [AttentionContextProvider, useAttentionContext] = createContext(ATTENTION_NAME, {
155
- attention: void 0,
156
- path: []
199
+ attention: void 0
157
200
  });
158
201
  var UNKNOWN_ATTENDABLE = {
159
202
  hasAttention: false,
@@ -161,32 +204,21 @@ var UNKNOWN_ATTENDABLE = {
161
204
  isRelated: false
162
205
  };
163
206
  var useAttention = (attendableId) => {
164
- const { attention, path } = useAttentionContext(ATTENTION_NAME);
207
+ const { attention } = useAttentionContext(ATTENTION_NAME);
165
208
  const [state, setState] = useState(UNKNOWN_ATTENDABLE);
166
- const key = useMemo(() => {
167
- if (!attendableId) {
168
- return void 0;
169
- }
170
- return [
171
- ...attendableId.split(ATTENDABLE_PATH_SEPARATOR),
172
- ...path
173
- ];
174
- }, [
175
- attendableId,
176
- path
177
- ]);
178
209
  useEffect(() => {
179
- if (!key || !attention) {
210
+ if (!attendableId || !attention) {
180
211
  setState(UNKNOWN_ATTENDABLE);
181
212
  return;
182
213
  }
183
- setState(attention.get(key));
184
- return attention.subscribe(key, (newState) => {
214
+ const currentState = attention.get(attendableId);
215
+ setState(currentState);
216
+ return attention.subscribe(attendableId, (newState) => {
185
217
  setState(newState);
186
218
  });
187
219
  }, [
188
220
  attention,
189
- key
221
+ attendableId
190
222
  ]);
191
223
  return state;
192
224
  };
@@ -221,10 +253,6 @@ var useAttentionAttributes = (attendableId) => {
221
253
  hasAttention
222
254
  ]);
223
255
  };
224
- var useAttentionPath = () => {
225
- const { path } = useAttentionContext(ATTENTION_NAME);
226
- return path;
227
- };
228
256
  var RootAttentionProvider = ({ children, attention: propsAttention, onChange }) => {
229
257
  const registry = useContext(RegistryContext);
230
258
  const attention = useDefaultValue(propsAttention, () => new AttentionManager(registry));
@@ -234,7 +262,7 @@ var RootAttentionProvider = ({ children, attention: propsAttention, onChange })
234
262
  target: event.target
235
263
  }, {
236
264
  F: __dxlog_file,
237
- L: 130,
265
+ L: 115,
238
266
  S: void 0,
239
267
  C: (f, a) => f(...a)
240
268
  });
@@ -250,36 +278,21 @@ var RootAttentionProvider = ({ children, attention: propsAttention, onChange })
250
278
  }
251
279
  };
252
280
  return /* @__PURE__ */ React.createElement(AttentionContextProvider, {
253
- attention,
254
- path: []
281
+ attention
255
282
  }, /* @__PURE__ */ React.createElement("div", {
256
283
  role: "none",
257
284
  className: "contents",
258
285
  onFocusCapture: handleFocus
259
286
  }, children));
260
287
  };
261
- var AttentionProvider = ({ id, children }) => {
262
- const { attention, path } = useAttentionContext(ATTENTION_NAME);
263
- const nextPath = useMemo(() => [
264
- id,
265
- ...path
266
- ], [
267
- id,
268
- path
269
- ]);
270
- return /* @__PURE__ */ React.createElement(AttentionContextProvider, {
271
- attention,
272
- path: nextPath
273
- }, children);
274
- };
275
288
  var AttendableContainer = /* @__PURE__ */ forwardRef(({ id, classNames, children, asChild, ...props }, forwardedRef) => {
276
289
  const attentionAttrs = useAttentionAttributes(id);
277
- const Root = asChild ? Slot : Primitive.div;
278
- return /* @__PURE__ */ React.createElement(Root, {
290
+ const Comp = asChild ? Slot : Primitive.div;
291
+ return /* @__PURE__ */ React.createElement(Comp, {
279
292
  role: "none",
280
- ...attentionAttrs,
281
293
  ...props,
282
- className: mx("attention-surface", props.tabIndex === 0 && "dx-focus-ring-inset-over-all", classNames),
294
+ ...attentionAttrs,
295
+ className: mx("dx-attention-surface", props.tabIndex === 0 && "dx-focus-ring-inset-over-all", classNames),
283
296
  ref: forwardedRef
284
297
  }, children);
285
298
  });
@@ -581,16 +594,16 @@ var useSelectionManager = () => {
581
594
  var getDefaultResult = (mode) => {
582
595
  return Match2.type().pipe(Match2.when({
583
596
  mode: "single"
584
- }, (s) => s.id), Match2.when({
597
+ }, (selection) => selection.id), Match2.when({
585
598
  mode: "multi"
586
- }, (s) => s.ids), Match2.when({
599
+ }, (selection) => selection.ids), Match2.when({
587
600
  mode: "range"
588
- }, (s) => s.from && s.to ? {
589
- from: s.from,
590
- to: s.to
601
+ }, (selection) => selection.from && selection.to ? {
602
+ from: selection.from,
603
+ to: selection.to
591
604
  } : void 0), Match2.when({
592
605
  mode: "multi-range"
593
- }, (s) => s.ranges), Match2.exhaustive)(defaultSelection(mode));
606
+ }, (selection) => selection.ranges), Match2.exhaustive)(defaultSelection(mode));
594
607
  };
595
608
  var useSelected = (contextId, mode = "multi") => {
596
609
  const { selection } = useSelectionContext(SELECTION_NAME);
@@ -683,6 +696,12 @@ var useSelectionActions = (contextIds, mode = "multi") => {
683
696
  export {
684
697
  AttentionManager,
685
698
  getAttendables,
699
+ expandAttendableId,
700
+ isLinkedSegment,
701
+ linkedSegment,
702
+ getLinkedVariant,
703
+ getParentId,
704
+ getSegmentId,
686
705
  ATTENTION_NAME,
687
706
  ATTENDABLE_ATTRIBUTE,
688
707
  ATTENTION_SOURCE_ATTRIBUTE,
@@ -690,9 +709,7 @@ export {
690
709
  useAttention,
691
710
  useAttended,
692
711
  useAttentionAttributes,
693
- useAttentionPath,
694
712
  RootAttentionProvider,
695
- AttentionProvider,
696
713
  AttendableContainer,
697
714
  SelectionSchema,
698
715
  defaultSelection,
@@ -703,4 +720,4 @@ export {
703
720
  useSelected,
704
721
  useSelectionActions
705
722
  };
706
- //# sourceMappingURL=chunk-7TQWDE4M.mjs.map
723
+ //# sourceMappingURL=chunk-6PQ4P7AL.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/attention.ts", "../../../src/components/AttentionProvider.tsx", "../../../src/selection.ts", "../../../src/components/SelectionProvider.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Atom, type Registry } from '@effect-atom/atom-react';\n\nimport { type Attention } from './types';\n\n/**\n * Manages attention state for an application.\n * Attention keys are slash-qualified graph IDs; ancestry is derived from progressive prefixes.\n */\nexport class AttentionManager {\n private readonly _map = new Map<string, Atom.Writable<Attention>>();\n private readonly _currentAtom: Atom.Writable<string[]>;\n\n constructor(\n private readonly _registry: Registry.Registry,\n initial: string[] = [],\n ) {\n this._currentAtom = Atom.make<string[]>([]).pipe(Atom.keepAlive);\n if (initial.length > 0) {\n this.update(initial);\n }\n }\n\n /**\n * Atom for the currently attended element IDs.\n */\n get current(): Atom.Atom<string[]> {\n return this._currentAtom;\n }\n\n /**\n * Gets the currently attended element IDs.\n */\n getCurrent(): readonly string[] {\n return this._registry.get(this._currentAtom);\n }\n\n /**\n * Subscribe to changes in the current attention IDs.\n */\n subscribeCurrent(cb: (current: readonly string[]) => void): () => void {\n this._registry.get(this._currentAtom);\n return this._registry.subscribe(this._currentAtom, () => {\n cb(this._registry.get(this._currentAtom));\n });\n }\n\n /**\n * All tracked qualified IDs.\n */\n keys(): string[] {\n return Array.from(this._map.keys());\n }\n\n /**\n * Get the attention state for a given qualified ID.\n */\n get(id: string): Attention {\n const atom = this._getAtom(id);\n return this._registry.get(atom);\n }\n\n /**\n * Subscribe to changes in the attention state for a given qualified ID.\n */\n subscribe(id: string, cb: (attention: Attention) => void): () => void {\n const atom = this._getAtom(id);\n this._registry.get(atom);\n return this._registry.subscribe(atom, () => {\n cb(this._registry.get(atom));\n });\n }\n\n private _getAtom(id: string): Atom.Writable<Attention> {\n const existing = this._map.get(id);\n if (existing) {\n return existing;\n }\n\n const newAtom = Atom.make<Attention>({ hasAttention: false, isAncestor: false, isRelated: false }).pipe(\n Atom.keepAlive,\n );\n this._map.set(id, newAtom);\n return newAtom;\n }\n\n /**\n * Update the currently attended element.\n * Takes the array of qualified IDs collected from the DOM; the first element is the primary attended item.\n * Ancestry is derived from the progressive prefixes of the primary ID.\n * Relatedness is derived from the segment ID: any tracked key whose last `/` segment matches the\n * attended ID's segment ID is marked `isRelated`. Additionally, if the primary ID is a linked segment\n * (starts with `~`), its immediate parent gets `isRelated` alongside `isAncestor`.\n *\n * @internal\n */\n update(nextIds: string[]): void {\n const primaryId = nextIds[0];\n if (!primaryId) {\n return;\n }\n\n const currentIds = this.getCurrent();\n const prevPrimaryId = currentIds[0];\n // Clear previous attention state: ancestors, primary, and related keys.\n if (prevPrimaryId) {\n const prevPrefixes = expandAttendableId(prevPrimaryId);\n for (const prefix of prevPrefixes) {\n this._set(prefix, {});\n }\n const prevSegmentId = getSegmentId(prevPrimaryId);\n for (const key of this.keys()) {\n if (getSegmentId(key) === prevSegmentId) {\n this._set(key, {});\n }\n }\n }\n\n this._registry.set(this._currentAtom, nextIds);\n\n // Set ancestors and primary.\n const prefixes = expandAttendableId(primaryId);\n const prefixSet = new Set(prefixes);\n const linkedParent = isLinkedSegment(primaryId) ? getParentId(primaryId) : undefined;\n\n for (const prefix of prefixes) {\n if (prefix === primaryId) {\n this._set(prefix, { hasAttention: true });\n } else if (prefix === linkedParent) {\n this._set(prefix, { isAncestor: true, isRelated: true });\n } else {\n this._set(prefix, { isAncestor: true });\n }\n }\n\n // Set related keys: any tracked key sharing the same segment ID.\n const segmentId = getSegmentId(primaryId);\n for (const key of this.keys()) {\n if (!prefixSet.has(key) && getSegmentId(key) === segmentId) {\n this._set(key, { isRelated: true });\n }\n }\n }\n\n private _set(id: string, attention: Partial<Attention>): void {\n const atom = this._getAtom(id);\n this._registry.set(atom, {\n hasAttention: attention.hasAttention ?? false,\n isAncestor: attention.isAncestor ?? false,\n isRelated: attention.isRelated ?? false,\n });\n }\n}\n\n/**\n * Accumulates all attendable IDs between the element provided and the root, inclusive.\n * Each `data-attendable-id` value is treated as a single qualified ID (no splitting).\n */\nexport const getAttendables = (selector: string, cursor: Element, acc: string[] = []): string[] => {\n // Find the closest element with `data-attendable-id`, if any; start from cursor and move up the DOM tree.\n const closestAttendable = cursor.closest(selector);\n if (closestAttendable) {\n const attendableId = closestAttendable.getAttribute('data-attendable-id');\n if (!attendableId) {\n // This has an id of an aria-controls elsewhere on the page, move cursor to that trigger.\n const trigger = document.querySelector(`[aria-controls=\"${closestAttendable.getAttribute('id')}\"]`);\n if (!trigger) {\n return acc;\n } else {\n return getAttendables(selector, trigger, acc);\n }\n } else {\n acc.push(attendableId);\n return !closestAttendable.parentElement ? acc : getAttendables(selector, closestAttendable.parentElement, acc);\n }\n }\n\n return [...new Set(acc)];\n};\n\nexport type AttendableId = { attendableId?: string };\n\nexport type Related = { related?: boolean };\n\n/**\n * Prefix for linked segments. A linked segment's attention state is shared with its parent:\n * when a linked node has attention, the parent is marked as both ancestor and related.\n */\nconst LINKED_PREFIX = '~';\n\n/**\n * Decompose a qualified graph ID into progressive prefixes for ancestry tracking.\n * e.g. `root/a/b/c` yields `['root', 'root/a', 'root/a/b', 'root/a/b/c']`.\n */\nexport const expandAttendableId = (qualifiedId: string): string[] => {\n const segments = qualifiedId.split('/');\n return segments.map((_, index) => segments.slice(0, index + 1).join('/'));\n};\n\n/**\n * Whether the last segment of a qualified ID is a linked segment (starts with `~`).\n * Linked segments share their attention state with the parent node.\n */\nexport const isLinkedSegment = (qualifiedId: string): boolean => {\n const lastSegment = qualifiedId.split('/').pop() ?? '';\n return lastSegment.startsWith(LINKED_PREFIX);\n};\n\n/**\n * Build a linked segment ID from a variant name (e.g., `'settings'` -> `'~settings'`).\n * Nodes identified by linked segments share their attention state with the parent node.\n */\nexport const linkedSegment = (variant: string): string => `${LINKED_PREFIX}${variant}`;\n\n/**\n * Extract the variant name from the last segment of a qualified ID, stripping the linked prefix.\n * e.g. `'root/space/obj/~settings'` -> `'settings'`.\n * If the segment is not linked (no `~` prefix), returns the segment as-is.\n */\nexport const getLinkedVariant = (qualifiedId: string): string => {\n const lastSegment = qualifiedId.split('/').pop() ?? '';\n return lastSegment.startsWith(LINKED_PREFIX) ? lastSegment.slice(LINKED_PREFIX.length) : lastSegment;\n};\n\n/**\n * Get the parent qualified ID (everything before the last `/` segment).\n */\nexport const getParentId = (qualifiedId: string | undefined): string | undefined => {\n if (!qualifiedId) {\n return undefined;\n }\n\n const lastSlash = qualifiedId.lastIndexOf('/');\n return lastSlash > 0 ? qualifiedId.slice(0, lastSlash) : undefined;\n};\n\n/**\n * Extract the segment ID (last segment) of a qualified ID.\n */\nexport const getSegmentId = (qualifiedId: string): string => {\n return qualifiedId.split('/').pop() ?? qualifiedId;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { RegistryContext } from '@effect-atom/atom-react';\nimport { createContext } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Slot } from '@radix-ui/react-slot';\nimport React, {\n type ComponentPropsWithRef,\n type FocusEvent,\n type PropsWithChildren,\n forwardRef,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react';\n\nimport { log } from '@dxos/log';\nimport { useDefaultValue } from '@dxos/react-hooks';\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\n\nimport { AttentionManager, getAttendables } from '../attention';\nimport { type Attention } from '../types';\n\nconst ATTENTION_NAME = 'Attention';\nconst ATTENDABLE_ATTRIBUTE = 'data-attendable-id';\nconst ATTENTION_SOURCE_ATTRIBUTE = 'data-w-attention-source';\n\ntype AttentionContextValue = {\n attention: AttentionManager;\n};\n\nconst [AttentionContextProvider, useAttentionContext] = createContext<AttentionContextValue>(ATTENTION_NAME, {\n attention: undefined as unknown as AttentionManager,\n});\n\nconst UNKNOWN_ATTENDABLE = { hasAttention: false, isAncestor: false, isRelated: false } as Attention;\n\n/**\n * Subscribe to the attention state for a qualified graph ID.\n */\nconst useAttention = (attendableId?: string): Attention => {\n const { attention } = useAttentionContext(ATTENTION_NAME);\n const [state, setState] = useState<Attention>(UNKNOWN_ATTENDABLE);\n\n useEffect(() => {\n if (!attendableId || !attention) {\n setState(UNKNOWN_ATTENDABLE);\n return;\n }\n\n const currentState = attention.get(attendableId);\n setState(currentState);\n\n return attention.subscribe(attendableId, (newState) => {\n setState(newState);\n });\n }, [attention, attendableId]);\n\n return state;\n};\n\nconst useAttended = () => {\n const { attention } = useAttentionContext(ATTENTION_NAME);\n const [current, setCurrent] = useState<readonly string[]>([]);\n\n useEffect(() => {\n if (!attention) {\n return;\n }\n\n setCurrent(attention.getCurrent());\n\n return attention.subscribeCurrent((newCurrent) => {\n setCurrent(newCurrent);\n });\n }, [attention]);\n\n return current;\n};\n\n/**\n * Computes HTML element attributes to apply so the attention system can detect changes.\n */\nconst useAttentionAttributes = (attendableId?: string) => {\n const { hasAttention } = useAttention(attendableId);\n return useMemo(() => {\n const attributes: Record<string, string | undefined> = { [ATTENDABLE_ATTRIBUTE]: attendableId };\n if (hasAttention) {\n attributes[ATTENTION_SOURCE_ATTRIBUTE] = 'true';\n }\n\n return attributes;\n }, [attendableId, hasAttention]);\n};\n\nconst RootAttentionProvider = ({\n children,\n attention: propsAttention,\n onChange,\n}: PropsWithChildren<\n Partial<{\n attention: AttentionManager;\n onChange: (nextAttended: string[]) => void;\n }>\n>) => {\n const registry = useContext(RegistryContext);\n const attention = useDefaultValue(propsAttention, () => new AttentionManager(registry));\n\n const handleFocus = (event: FocusEvent) => {\n // NOTE(thure): Use the following to debug focus movement across the app:\n log('focus', { related: event.relatedTarget, target: event.target });\n\n const selector = [\n '[data-attendable-id]',\n ...Array.from(document.querySelectorAll('[aria-controls]')).map(\n (el) => `[id=\"${el.getAttribute('aria-controls')}\"]`,\n ),\n ].join(',');\n const prev = attention.getCurrent();\n const next = getAttendables(selector, event.target);\n // TODO(wittjosiah): Not allowing empty state means that the attended item is not strictly guaranteed to be in the DOM.\n // Currently this depends on the deck in order to ensure that when the attended item is removed something else is attended.\n // Only update state if the result is different and not empty.\n if (next.length > 0 && (prev.length !== next.length || !!prev.find((id, index) => next[index] !== id))) {\n attention.update(next);\n onChange?.(next);\n }\n };\n\n return (\n <AttentionContextProvider attention={attention}>\n <div role='none' className='contents' onFocusCapture={handleFocus}>\n {children}\n </div>\n </AttentionContextProvider>\n );\n};\n\nexport type AttendableContainerProps = ThemedClassName<\n ComponentPropsWithRef<'div'> & { id: string; asChild?: boolean }\n>;\n\n/**\n * Note that DeckPlugin and StackPlugin both handle attention on their own,\n * and when rendering content in those cases it is not necessary to also render an `AttendableContainer`.\n * This component is primarily for Storybook stories and other testing scenarios,\n * or the rare cases where an attendable entity is rendered outside of either of those plugins.\n */\nconst AttendableContainer = forwardRef<HTMLDivElement, AttendableContainerProps>(\n ({ id, classNames, children, asChild, ...props }, forwardedRef) => {\n const attentionAttrs = useAttentionAttributes(id);\n const Comp = asChild ? Slot : Primitive.div;\n return (\n <Comp\n role='none'\n {...props}\n {...attentionAttrs}\n className={mx('dx-attention-surface', props.tabIndex === 0 && 'dx-focus-ring-inset-over-all', classNames)}\n ref={forwardedRef}\n >\n {children}\n </Comp>\n );\n },\n);\n\nexport {\n RootAttentionProvider,\n AttendableContainer,\n useAttentionContext,\n useAttention,\n useAttended,\n useAttentionAttributes,\n ATTENTION_NAME,\n ATTENDABLE_ATTRIBUTE,\n ATTENTION_SOURCE_ATTRIBUTE,\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom, type Registry } from '@effect-atom/atom-react';\nimport * as Match from 'effect/Match';\nimport * as Schema from 'effect/Schema';\n\nimport { invariant } from '@dxos/invariant';\n\n// TODO(burdon): Reconcile with @dxos/graph.\n\nexport type SelectionMode = 'single' | 'multi' | 'range' | 'multi-range';\n\nexport const SelectionSchema = Schema.Union(\n Schema.Struct({ mode: Schema.Literal('single'), id: Schema.optional(Schema.String) }).pipe(Schema.mutable),\n Schema.Struct({ mode: Schema.Literal('multi'), ids: Schema.Array(Schema.String).pipe(Schema.mutable) }).pipe(\n Schema.mutable,\n ),\n Schema.Struct({\n mode: Schema.Literal('range'),\n from: Schema.optional(Schema.String),\n to: Schema.optional(Schema.String),\n }).pipe(Schema.mutable),\n Schema.Struct({\n mode: Schema.Literal('multi-range'),\n ranges: Schema.Array(Schema.Struct({ from: Schema.String, to: Schema.String })).pipe(Schema.mutable),\n }).pipe(Schema.mutable),\n).pipe(Schema.mutable);\n\nexport type Selection = Schema.Schema.Type<typeof SelectionSchema>;\n\nexport const defaultSelection = Match.type<SelectionMode>().pipe(\n Match.withReturnType<Selection>(),\n Match.when('single', () => ({ mode: 'single' })),\n Match.when('multi', () => ({ mode: 'multi', ids: [] })),\n Match.when('range', () => ({ mode: 'range' })),\n Match.when('multi-range', () => ({ mode: 'multi-range', ranges: [] })),\n Match.exhaustive,\n);\n\nexport type SelectionResult<T extends SelectionMode> = T extends 'single'\n ? string | undefined\n : T extends 'multi'\n ? string[]\n : T extends 'range'\n ? { from: string; to: string } | undefined\n : T extends 'multi-range'\n ? { from: string; to: string }[]\n : never;\n\n// TODO(burdon): Refactor.\nexport const getSelectionSet = (selectionManager: SelectionManager, contextId?: string) => {\n const ids = new Set<string>(contextId ? [contextId] : []);\n for (const context of selectionManager.getSelectionContexts()) {\n const selection = selectionManager.getSelection(context);\n if (selection?.mode === 'multi') {\n for (const id of selection.ids) {\n ids.add(id);\n }\n }\n }\n\n return ids;\n};\n\n/**\n * Manages selection state for different contexts.\n * Each context maintains its own selection mode and state.\n */\nexport class SelectionManager {\n private readonly _state: Atom.Writable<{ selections: Record<string, Selection> }>;\n\n constructor(\n private readonly _registry: Registry.Registry,\n initial: Record<string, Selection> = {},\n ) {\n this._state = Atom.make<{ selections: Record<string, Selection> }>({\n selections: { ...initial },\n });\n }\n\n /**\n * Get the state atom for reactive access in the graph system.\n */\n get state(): Atom.Atom<{ selections: Record<string, Selection> }> {\n return this._state;\n }\n\n /**\n * Gets the current state.\n */\n getState(): { selections: Record<string, Selection> } {\n return this._registry.get(this._state);\n }\n\n /**\n * Subscribe to changes in the selection state.\n */\n subscribe(cb: (state: { selections: Record<string, Selection> }) => void): () => void {\n this._registry.get(this._state);\n return this._registry.subscribe(this._state, () => {\n cb(this._registry.get(this._state));\n });\n }\n\n getSelectionContexts(): string[] {\n return Object.keys(this._registry.get(this._state).selections);\n }\n\n getSelection(contextId: string): Selection | undefined;\n getSelection<T extends SelectionMode>(contextId: string, mode: T): Selection;\n getSelection<T extends SelectionMode | undefined>(\n contextId: string,\n mode: T = undefined as T,\n ): Selection | undefined {\n const state = this._registry.get(this._state);\n const selection = state.selections[contextId];\n if (!mode || selection) {\n return selection;\n }\n\n // Create new selection for the context.\n const newSelection = defaultSelection(mode);\n this._registry.update(this._state, (state) => ({\n selections: { ...state.selections, [contextId]: newSelection },\n }));\n return newSelection;\n }\n\n // TODO(burdon): Disambiguate with getSelection?\n getSelected<T extends SelectionMode>(contextId: string, mode: T = 'multi' as T): SelectionResult<T> {\n const selection = this.getSelection(contextId, mode);\n invariant(selection?.mode === mode, 'Selection mode mismatch');\n // Cast required because TypeScript can't infer the relationship between T and the matched result.\n return Match.type<Selection>().pipe(\n Match.when({ mode: 'single' }, (s) => s.id),\n Match.when({ mode: 'multi' }, (s) => s.ids),\n Match.when({ mode: 'range' }, (s) => (s.from && s.to ? { from: s.from, to: s.to } : undefined)),\n Match.when({ mode: 'multi-range' }, (s) => s.ranges),\n Match.exhaustive,\n )(selection) as SelectionResult<T>;\n }\n\n updateSingle(contextId: string, id: string): void {\n const selection = this.getSelection(contextId, 'single');\n invariant(selection?.mode === 'single', 'Selection mode is not single');\n this._registry.update(this._state, (state) => ({\n selections: {\n ...state.selections,\n [contextId]: { ...selection, id },\n },\n }));\n }\n\n updateMulti(contextId: string, ids: string[]) {\n const selection = this.getSelection(contextId, 'multi');\n invariant(selection?.mode === 'multi', 'Selection mode is not multi');\n this._registry.update(this._state, (state) => ({\n selections: {\n ...state.selections,\n [contextId]: { ...selection, ids: [...ids] },\n },\n }));\n }\n\n updateRange(contextId: string, from: string, to: string) {\n const selection = this.getSelection(contextId, 'range');\n invariant(selection?.mode === 'range', 'Selection mode is not range');\n this._registry.update(this._state, (state) => ({\n selections: {\n ...state.selections,\n [contextId]: { ...selection, from, to },\n },\n }));\n }\n\n updateMultiRange(contextId: string, ranges: { from: string; to: string }[]) {\n const selection = this.getSelection(contextId, 'multi-range');\n invariant(selection?.mode === 'multi-range', 'Selection mode is not multi-range');\n this._registry.update(this._state, (state) => ({\n selections: {\n ...state.selections,\n [contextId]: { ...selection, ranges: [...ranges] },\n },\n }));\n }\n\n clearSelection(contextId: string): void {\n const selection = this.getSelection(contextId);\n if (!selection) {\n return;\n }\n\n const clearedSelection = Match.type<Selection>().pipe(\n Match.when({ mode: 'single' }, (s) => ({ ...s, id: undefined })),\n Match.when({ mode: 'multi' }, (s) => ({ ...s, ids: [] })),\n Match.when({ mode: 'range' }, (s) => ({ ...s, from: undefined, to: undefined })),\n Match.when({ mode: 'multi-range' }, (s) => ({ ...s, ranges: [] })),\n Match.exhaustive,\n )(selection);\n\n this._registry.update(this._state, (state) => ({\n selections: {\n ...state.selections,\n [contextId]: clearedSelection,\n },\n }));\n }\n\n toggleSelection(contextId: string, id: string): void {\n const selection = this.getSelection(contextId, 'multi');\n invariant(selection?.mode === 'multi', 'Selection mode is not multi');\n\n const newIds = selection.ids.includes(id)\n ? selection.ids.filter((existingId) => existingId !== id)\n : [...selection.ids, id];\n\n this._registry.update(this._state, (state) => ({\n selections: {\n ...state.selections,\n [contextId]: { ...selection, ids: newIds },\n },\n }));\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { RegistryContext } from '@effect-atom/atom-react';\nimport { createContext } from '@radix-ui/react-context';\nimport * as Match from 'effect/Match';\nimport React, { type PropsWithChildren, useCallback, useContext, useEffect, useMemo, useState } from 'react';\n\nimport { useDefaultValue } from '@dxos/react-hooks';\n\nimport {\n type Selection,\n SelectionManager,\n type SelectionMode,\n type SelectionResult,\n defaultSelection,\n} from '../selection';\n\nconst SELECTION_NAME = 'Selection';\n\ntype SelectionContextValue = {\n selection: SelectionManager;\n};\n\nconst [SelectionContextProvider, useSelectionContext] = createContext<SelectionContextValue>(SELECTION_NAME, {\n selection: undefined as unknown as SelectionManager,\n});\n\n/**\n * Manages selection state across the app for multiple contexts.\n */\n// TODO(burdon): When is the selection removed?\nexport const SelectionProvider = ({\n children,\n selection: propsSelection,\n}: PropsWithChildren<{ selection?: SelectionManager }>) => {\n const registry = useContext(RegistryContext);\n const selection = useDefaultValue(propsSelection, () => new SelectionManager(registry));\n return <SelectionContextProvider selection={selection}>{children}</SelectionContextProvider>;\n};\n\n/**\n * Get the selection contexts.\n */\nexport const useSelectionManager = () => {\n const { selection } = useSelectionContext(SELECTION_NAME);\n return selection;\n};\n\nconst getDefaultResult = <T extends SelectionMode>(mode: T): SelectionResult<T> => {\n return Match.type<Selection>().pipe(\n Match.when({ mode: 'single' }, (selection) => selection.id),\n Match.when({ mode: 'multi' }, (selection) => selection.ids),\n Match.when({ mode: 'range' }, (selection) =>\n selection.from && selection.to ? { from: selection.from, to: selection.to } : undefined,\n ),\n Match.when({ mode: 'multi-range' }, (selection) => selection.ranges),\n Match.exhaustive,\n )(defaultSelection(mode)) as SelectionResult<T>;\n};\n\n/**\n * Get the selected objects for a given context.\n */\nexport const useSelected = <T extends SelectionMode>(\n contextId?: string,\n mode: T = 'multi' as T,\n): SelectionResult<T> => {\n const { selection } = useSelectionContext(SELECTION_NAME);\n const [state, setState] = useState<SelectionResult<T>>(() =>\n contextId && selection ? selection.getSelected(contextId, mode) : getDefaultResult(mode),\n );\n\n useEffect(() => {\n if (!contextId || !selection) {\n setState(getDefaultResult(mode));\n return;\n }\n\n // Set initial state.\n setState(selection.getSelected(contextId, mode));\n\n // Subscribe to changes.\n return selection.subscribe(() => {\n setState(selection.getSelected(contextId, mode));\n });\n }, [selection, contextId, mode]);\n\n return state;\n};\n\nexport type UseSelectionActions = {\n singleSelect: (id: string) => void;\n multiSelect: (ids: string[]) => void;\n rangeSelect: (from: string, to: string) => void;\n toggle: (id: string) => void;\n clear: () => void;\n};\n\n/**\n * Provides functions to manage the selection state for multiple contexts.\n */\n// TODO(burdon): Mode not used.\nexport const useSelectionActions = (contextIds: string[], mode: SelectionMode = 'multi'): UseSelectionActions => {\n const stableContextIds = useMemo(() => contextIds, [JSON.stringify(contextIds)]); // TODO(burdon): Avoid stringify.\n const { selection } = useSelectionContext(SELECTION_NAME);\n\n const singleSelect = useCallback(\n (id: string) => {\n if (!selection) {\n return;\n }\n for (const contextId of stableContextIds) {\n selection.updateSingle(contextId, id);\n }\n },\n [selection, stableContextIds],\n );\n\n const multiSelect = useCallback(\n (ids: string[]) => {\n if (!selection) {\n return;\n }\n for (const contextId of stableContextIds) {\n selection.updateMulti(contextId, ids);\n }\n },\n [selection, stableContextIds],\n );\n\n const rangeSelect = useCallback(\n (from: string, to: string) => {\n if (!selection) {\n return;\n }\n for (const contextId of stableContextIds) {\n selection.updateRange(contextId, from, to);\n }\n },\n [selection, stableContextIds],\n );\n\n const toggle = useCallback(\n (id: string) => {\n if (!selection) {\n return;\n }\n for (const contextId of stableContextIds) {\n selection.toggleSelection(contextId, id);\n }\n },\n [selection, stableContextIds],\n );\n\n const clear = useCallback(() => {\n if (!selection) {\n return;\n }\n for (const contextId of stableContextIds) {\n selection.clearSelection(contextId);\n }\n }, [selection, stableContextIds]);\n\n return { singleSelect, multiSelect, rangeSelect, toggle, clear };\n};\n"],
5
+ "mappings": ";;;AAIA,SAASA,YAA2B;AAQ7B,IAAMC,mBAAN,MAAMA;;EACMC,OAAO,oBAAIC,IAAAA;EACXC;EAEjB,YACmBC,WACjBC,UAAoB,CAAA,GACpB;SAFiBD,YAAAA;AAGjB,SAAKD,eAAeG,KAAKC,KAAe,CAAA,CAAE,EAAEC,KAAKF,KAAKG,SAAS;AAC/D,QAAIJ,QAAQK,SAAS,GAAG;AACtB,WAAKC,OAAON,OAAAA;IACd;EACF;;;;EAKA,IAAIO,UAA+B;AACjC,WAAO,KAAKT;EACd;;;;EAKAU,aAAgC;AAC9B,WAAO,KAAKT,UAAUU,IAAI,KAAKX,YAAY;EAC7C;;;;EAKAY,iBAAiBC,IAAsD;AACrE,SAAKZ,UAAUU,IAAI,KAAKX,YAAY;AACpC,WAAO,KAAKC,UAAUa,UAAU,KAAKd,cAAc,MAAA;AACjDa,SAAG,KAAKZ,UAAUU,IAAI,KAAKX,YAAY,CAAA;IACzC,CAAA;EACF;;;;EAKAe,OAAiB;AACf,WAAOC,MAAMC,KAAK,KAAKnB,KAAKiB,KAAI,CAAA;EAClC;;;;EAKAJ,IAAIO,IAAuB;AACzB,UAAMC,OAAO,KAA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,CAAClB,WAAW;AACd;IACF;AACA,eAAWyB,aAAaS,kBAAkB;AACxClC,gBAAU0C,YAAYjB,WAAWP,GAAAA;IACnC;EACF,GACA;IAAClB;IAAWkC;GAAiB;AAG/B,QAAMS,cAAcJ,YAClB,CAACpB,MAAcC,OAAAA;AACb,QAAI,CAACpB,WAAW;AACd;IACF;AACA,eAAWyB,aAAaS,kBAAkB;AACxClC,gBAAU4C,YAAYnB,WAAWN,MAAMC,EAAAA;IACzC;EACF,GACA;IAACpB;IAAWkC;GAAiB;AAG/B,QAAMW,SAASN,YACb,CAACtB,OAAAA;AACC,QAAI,CAACjB,WAAW;AACd;IACF;AACA,eAAWyB,aAAaS,kBAAkB;AACxClC,gBAAU8C,gBAAgBrB,WAAWR,EAAAA;IACvC;EACF,GACA;IAACjB;IAAWkC;GAAiB;AAG/B,QAAMa,QAAQR,YAAY,MAAA;AACxB,QAAI,CAACvC,WAAW;AACd;IACF;AACA,eAAWyB,aAAaS,kBAAkB;AACxClC,gBAAUgD,eAAevB,SAAAA;IAC3B;EACF,GAAG;IAACzB;IAAWkC;GAAiB;AAEhC,SAAO;IAAEI;IAAcG;IAAaE;IAAaE;IAAQE;EAAM;AACjE;",
6
+ "names": ["Atom", "AttentionManager", "_map", "Map", "_currentAtom", "_registry", "initial", "Atom", "make", "pipe", "keepAlive", "length", "update", "current", "getCurrent", "get", "subscribeCurrent", "cb", "subscribe", "keys", "Array", "from", "id", "atom", "_getAtom", "existing", "newAtom", "hasAttention", "isAncestor", "isRelated", "set", "nextIds", "primaryId", "currentIds", "prevPrimaryId", "prevPrefixes", "expandAttendableId", "prefix", "_set", "prevSegmentId", "getSegmentId", "key", "prefixes", "prefixSet", "Set", "linkedParent", "isLinkedSegment", "getParentId", "undefined", "segmentId", "has", "attention", "getAttendables", "selector", "cursor", "acc", "closestAttendable", "closest", "attendableId", "getAttribute", "trigger", "document", "querySelector", "push", "parentElement", "LINKED_PREFIX", "qualifiedId", "segments", "split", "map", "_", "index", "slice", "join", "lastSegment", "pop", "startsWith", "linkedSegment", "variant", "getLinkedVariant", "lastSlash", "lastIndexOf", "RegistryContext", "createContext", "Primitive", "Slot", "React", "forwardRef", "useContext", "useEffect", "useMemo", "useState", "log", "useDefaultValue", "mx", "ATTENTION_NAME", "ATTENDABLE_ATTRIBUTE", "ATTENTION_SOURCE_ATTRIBUTE", "AttentionContextProvider", "useAttentionContext", "createContext", "attention", "undefined", "UNKNOWN_ATTENDABLE", "hasAttention", "isAncestor", "isRelated", "useAttention", "attendableId", "state", "setState", "useState", "useEffect", "currentState", "get", "subscribe", "newState", "useAttended", "current", "setCurrent", "getCurrent", "subscribeCurrent", "newCurrent", "useAttentionAttributes", "useMemo", "attributes", "RootAttentionProvider", "children", "propsAttention", "onChange", "registry", "useContext", "RegistryContext", "useDefaultValue", "AttentionManager", "handleFocus", "event", "log", "related", "relatedTarget", "target", "selector", "Array", "from", "document", "querySelectorAll", "map", "el", "getAttribute", "join", "prev", "next", "getAttendables", "length", "find", "id", "index", "update", "div", "role", "className", "onFocusCapture", "AttendableContainer", "forwardRef", "classNames", "asChild", "props", "forwardedRef", "attentionAttrs", "Comp", "Slot", "Primitive", "mx", "tabIndex", "ref", "Atom", "Match", "Schema", "invariant", "SelectionSchema", "Union", "Struct", "mode", "Literal", "id", "optional", "String", "pipe", "mutable", "ids", "Array", "from", "to", "ranges", "defaultSelection", "type", "withReturnType", "when", "exhaustive", "getSelectionSet", "selectionManager", "contextId", "Set", "context", "getSelectionContexts", "selection", "getSelection", "add", "SelectionManager", "_state", "_registry", "initial", "make", "selections", "state", "getState", "get", "subscribe", "cb", "Object", "keys", "undefined", "newSelection", "update", "getSelected", "s", "updateSingle", "updateMulti", "updateRange", "updateMultiRange", "clearSelection", "clearedSelection", "toggleSelection", "newIds", "includes", "filter", "existingId", "RegistryContext", "createContext", "Match", "React", "useCallback", "useContext", "useEffect", "useMemo", "useState", "useDefaultValue", "SELECTION_NAME", "SelectionContextProvider", "useSelectionContext", "createContext", "selection", "undefined", "SelectionProvider", "children", "propsSelection", "registry", "useContext", "RegistryContext", "useDefaultValue", "SelectionManager", "React", "useSelectionManager", "getDefaultResult", "mode", "type", "pipe", "when", "id", "ids", "from", "to", "ranges", "exhaustive", "defaultSelection", "useSelected", "contextId", "state", "setState", "useState", "getSelected", "useEffect", "subscribe", "useSelectionActions", "contextIds", "stableContextIds", "useMemo", "JSON", "stringify", "singleSelect", "useCallback", "updateSingle", "multiSelect", "updateMulti", "rangeSelect", "updateRange", "toggle", "toggleSelection", "clear", "clearSelection"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ //# sourceMappingURL=chunk-UHVMYYIB.mjs.map