@dxos/react-ui-attention 0.7.5-labs.e27f9b9 → 0.7.5-labs.f400bbc

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 (36) hide show
  1. package/dist/lib/browser/{chunk-2TNGSB43.mjs → chunk-44KSBCYW.mjs} +106 -2
  2. package/dist/lib/browser/{chunk-2TNGSB43.mjs.map → chunk-44KSBCYW.mjs.map} +4 -4
  3. package/dist/lib/browser/index.mjs +11 -3
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/testing/index.mjs +1 -1
  6. package/dist/lib/node/{chunk-BID3HPBP.cjs → chunk-MNJCPTGQ.cjs} +110 -6
  7. package/dist/lib/node/{chunk-BID3HPBP.cjs.map → chunk-MNJCPTGQ.cjs.map} +4 -4
  8. package/dist/lib/node/index.cjs +26 -18
  9. package/dist/lib/node/index.cjs.map +2 -2
  10. package/dist/lib/node/meta.json +1 -1
  11. package/dist/lib/node/testing/index.cjs +2 -2
  12. package/dist/lib/node-esm/{chunk-ARQ2A5DK.mjs → chunk-AQL352GI.mjs} +106 -2
  13. package/dist/lib/node-esm/{chunk-ARQ2A5DK.mjs.map → chunk-AQL352GI.mjs.map} +4 -4
  14. package/dist/lib/node-esm/index.mjs +11 -3
  15. package/dist/lib/node-esm/meta.json +1 -1
  16. package/dist/lib/node-esm/testing/index.mjs +1 -1
  17. package/dist/types/src/components/AttentionGlyph.d.ts +1 -1
  18. package/dist/types/src/components/AttentionGlyph.d.ts.map +1 -1
  19. package/dist/types/src/components/AttentionGlyph.stories.d.ts +3 -3
  20. package/dist/types/src/components/AttentionProvider.d.ts +2 -2
  21. package/dist/types/src/components/AttentionProvider.d.ts.map +1 -1
  22. package/dist/types/src/components/AttentionProvider.stories.d.ts +2 -3
  23. package/dist/types/src/components/AttentionProvider.stories.d.ts.map +1 -1
  24. package/dist/types/src/components/SelectionProvider.d.ts +18 -0
  25. package/dist/types/src/components/SelectionProvider.d.ts.map +1 -0
  26. package/dist/types/src/components/index.d.ts +1 -0
  27. package/dist/types/src/components/index.d.ts.map +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 +15 -0
  31. package/dist/types/src/selection.d.ts.map +1 -0
  32. package/package.json +12 -11
  33. package/src/components/SelectionProvider.tsx +75 -0
  34. package/src/components/index.ts +1 -0
  35. package/src/index.ts +1 -0
  36. package/src/selection.ts +60 -0
@@ -1 +1 @@
1
- {"inputs":{"packages/ui/react-ui-attention/src/attention.ts":{"bytes":16177,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx":{"bytes":10623,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx":{"bytes":20134,"imports":[{"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/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/attention.ts","kind":"import-statement","original":"../attention"}],"format":"esm"},"packages/ui/react-ui-attention/src/components/index.ts":{"bytes":644,"imports":[{"path":"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx","kind":"import-statement","original":"./AttentionGlyph"},{"path":"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx","kind":"import-statement","original":"./AttentionProvider"}],"format":"esm"},"packages/ui/react-ui-attention/src/index.ts":{"bytes":597,"imports":[{"path":"packages/ui/react-ui-attention/src/attention.ts","kind":"import-statement","original":"./attention"},{"path":"packages/ui/react-ui-attention/src/components/index.ts","kind":"import-statement","original":"./components"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts":{"bytes":1386,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/components/index.ts","kind":"import-statement","original":"../../components"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/decorators/index.ts":{"bytes":534,"imports":[{"path":"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts","kind":"import-statement","original":"./withAttention"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/index.ts":{"bytes":516,"imports":[{"path":"packages/ui/react-ui-attention/src/testing/decorators/index.ts","kind":"import-statement","original":"./decorators"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-attention/dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/ui/react-ui-attention/dist/lib/node-esm/index.mjs":{"imports":[{"path":"packages/ui/react-ui-attention/dist/lib/node-esm/chunk-ARQ2A5DK.mjs","kind":"import-statement"}],"exports":["ATTENABLE_ATTRIBUTE","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionGlyph","AttentionManager","AttentionProvider","AttentionSchema","RootAttentionProvider","Syncing","getAttendables","useAttendableAttributes","useAttended","useAttention","useAttentionContext","useAttentionPath"],"entryPoint":"packages/ui/react-ui-attention/src/index.ts","inputs":{"packages/ui/react-ui-attention/src/index.ts":{"bytesInOutput":0}},"bytes":831},"packages/ui/react-ui-attention/dist/lib/node-esm/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":698},"packages/ui/react-ui-attention/dist/lib/node-esm/testing/index.mjs":{"imports":[{"path":"packages/ui/react-ui-attention/dist/lib/node-esm/chunk-ARQ2A5DK.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true}],"exports":["withAttention"],"entryPoint":"packages/ui/react-ui-attention/src/testing/index.ts","inputs":{"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts":{"bytesInOutput":164},"packages/ui/react-ui-attention/src/testing/decorators/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-attention/src/testing/index.ts":{"bytesInOutput":0}},"bytes":459},"packages/ui/react-ui-attention/dist/lib/node-esm/chunk-ARQ2A5DK.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":23358},"packages/ui/react-ui-attention/dist/lib/node-esm/chunk-ARQ2A5DK.mjs":{"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","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/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"exports":["ATTENABLE_ATTRIBUTE","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionGlyph","AttentionManager","AttentionProvider","AttentionSchema","RootAttentionProvider","Syncing","getAttendables","useAttendableAttributes","useAttended","useAttention","useAttentionContext","useAttentionPath"],"inputs":{"packages/ui/react-ui-attention/src/attention.ts":{"bytesInOutput":3558},"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx":{"bytesInOutput":3212},"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx":{"bytesInOutput":3282},"packages/ui/react-ui-attention/src/components/index.ts":{"bytesInOutput":0}},"bytes":10720}}}
1
+ {"inputs":{"packages/ui/react-ui-attention/src/attention.ts":{"bytes":16177,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx":{"bytes":10623,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx":{"bytes":20134,"imports":[{"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/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/attention.ts","kind":"import-statement","original":"../attention"}],"format":"esm"},"packages/ui/react-ui-attention/src/selection.ts":{"bytes":5816,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx":{"bytes":7261,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/selection.ts","kind":"import-statement","original":"../selection"}],"format":"esm"},"packages/ui/react-ui-attention/src/components/index.ts":{"bytes":757,"imports":[{"path":"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx","kind":"import-statement","original":"./AttentionGlyph"},{"path":"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx","kind":"import-statement","original":"./AttentionProvider"},{"path":"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx","kind":"import-statement","original":"./SelectionProvider"}],"format":"esm"},"packages/ui/react-ui-attention/src/index.ts":{"bytes":690,"imports":[{"path":"packages/ui/react-ui-attention/src/attention.ts","kind":"import-statement","original":"./attention"},{"path":"packages/ui/react-ui-attention/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/ui/react-ui-attention/src/selection.ts","kind":"import-statement","original":"./selection"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts":{"bytes":1386,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-attention/src/components/index.ts","kind":"import-statement","original":"../../components"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/decorators/index.ts":{"bytes":534,"imports":[{"path":"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts","kind":"import-statement","original":"./withAttention"}],"format":"esm"},"packages/ui/react-ui-attention/src/testing/index.ts":{"bytes":516,"imports":[{"path":"packages/ui/react-ui-attention/src/testing/decorators/index.ts","kind":"import-statement","original":"./decorators"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-attention/dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/ui/react-ui-attention/dist/lib/node-esm/index.mjs":{"imports":[{"path":"packages/ui/react-ui-attention/dist/lib/node-esm/chunk-AQL352GI.mjs","kind":"import-statement"}],"exports":["ATTENABLE_ATTRIBUTE","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionGlyph","AttentionManager","AttentionProvider","AttentionSchema","RootAttentionProvider","SelectionManager","SelectionProvider","Syncing","getAttendables","useAttendableAttributes","useAttended","useAttention","useAttentionContext","useAttentionPath","useSelectedItems","useSelectionActions"],"entryPoint":"packages/ui/react-ui-attention/src/index.ts","inputs":{"packages/ui/react-ui-attention/src/index.ts":{"bytesInOutput":0}},"bytes":999},"packages/ui/react-ui-attention/dist/lib/node-esm/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":698},"packages/ui/react-ui-attention/dist/lib/node-esm/testing/index.mjs":{"imports":[{"path":"packages/ui/react-ui-attention/dist/lib/node-esm/chunk-AQL352GI.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true}],"exports":["withAttention"],"entryPoint":"packages/ui/react-ui-attention/src/testing/index.ts","inputs":{"packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts":{"bytesInOutput":164},"packages/ui/react-ui-attention/src/testing/decorators/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-attention/src/testing/index.ts":{"bytesInOutput":0}},"bytes":459},"packages/ui/react-ui-attention/dist/lib/node-esm/chunk-AQL352GI.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":29984},"packages/ui/react-ui-attention/dist/lib/node-esm/chunk-AQL352GI.mjs":{"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","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/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"exports":["ATTENABLE_ATTRIBUTE","ATTENTION_NAME","ATTENTION_SOURCE_ATTRIBUTE","AttendableContainer","AttentionGlyph","AttentionManager","AttentionProvider","AttentionSchema","RootAttentionProvider","SelectionManager","SelectionProvider","Syncing","getAttendables","useAttendableAttributes","useAttended","useAttention","useAttentionContext","useAttentionPath","useSelectedItems","useSelectionActions"],"inputs":{"packages/ui/react-ui-attention/src/attention.ts":{"bytesInOutput":3558},"packages/ui/react-ui-attention/src/components/AttentionGlyph.tsx":{"bytesInOutput":3212},"packages/ui/react-ui-attention/src/components/AttentionProvider.tsx":{"bytesInOutput":3282},"packages/ui/react-ui-attention/src/selection.ts":{"bytesInOutput":1199},"packages/ui/react-ui-attention/src/components/SelectionProvider.tsx":{"bytesInOutput":1541},"packages/ui/react-ui-attention/src/components/index.ts":{"bytesInOutput":0}},"bytes":13668}}}
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
  import {
3
3
  RootAttentionProvider
4
- } from "../chunk-ARQ2A5DK.mjs";
4
+ } from "../chunk-AQL352GI.mjs";
5
5
 
6
6
  // packages/ui/react-ui-attention/src/testing/decorators/withAttention.ts
7
7
  import { createElement } from "react";
@@ -1,7 +1,7 @@
1
1
  import { type Primitive } from '@radix-ui/react-primitive';
2
2
  import React, { type ComponentPropsWithRef } from 'react';
3
3
  import { type ThemedClassName } from '@dxos/react-ui';
4
- export declare const Syncing: () => React.JSX.Element;
4
+ export declare const Syncing: () => import("react/jsx-runtime").JSX.Element;
5
5
  export type AttentionGlyphProps = {
6
6
  attended?: boolean;
7
7
  containsAttended?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"AttentionGlyph.d.ts","sourceRoot":"","sources":["../../../../src/components/AttentionGlyph.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,EAAE,KAAK,qBAAqB,EAA2C,MAAM,OAAO,CAAC;AAEnG,OAAO,EAAQ,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AA2C5D,eAAO,MAAM,OAAO,yBAmBnB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;CACpC,GAAG,eAAe,CAAC,IAAI,CAAC,qBAAqB,CAAC,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;AAEpF,eAAO,MAAM,cAAc,0GAkB1B,CAAC"}
1
+ {"version":3,"file":"AttentionGlyph.d.ts","sourceRoot":"","sources":["../../../../src/components/AttentionGlyph.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,EAAE,KAAK,qBAAqB,EAA2C,MAAM,OAAO,CAAC;AAEnG,OAAO,EAAQ,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AA2C5D,eAAO,MAAM,OAAO,+CAmBnB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;CACpC,GAAG,eAAe,CAAC,IAAI,CAAC,qBAAqB,CAAC,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;AAEpF,eAAO,MAAM,cAAc,0GAkB1B,CAAC"}
@@ -4,8 +4,8 @@ import { type AttentionGlyphProps } from './AttentionGlyph';
4
4
  declare const _default: {
5
5
  title: string;
6
6
  component: React.ForwardRefExoticComponent<Omit<AttentionGlyphProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
7
- render: (props: AttentionGlyphProps) => React.JSX.Element;
8
- decorators: import("@storybook/react/*").Decorator[];
7
+ render: (props: AttentionGlyphProps) => import("react/jsx-runtime").JSX.Element;
8
+ decorators: import("@storybook/react").Decorator[];
9
9
  };
10
10
  export default _default;
11
11
  export declare const Default: {
@@ -22,6 +22,6 @@ export declare const Contains: {
22
22
  };
23
23
  };
24
24
  export declare const Syncing: {
25
- render: () => React.JSX.Element;
25
+ render: () => import("react/jsx-runtime").JSX.Element;
26
26
  };
27
27
  //# sourceMappingURL=AttentionGlyph.stories.d.ts.map
@@ -20,10 +20,10 @@ declare const useAttentionPath: () => string[];
20
20
  declare const RootAttentionProvider: ({ children, attention: propsAttention, onChange, }: PropsWithChildren<Partial<{
21
21
  attention: AttentionManager;
22
22
  onChange: (nextAttended: string[]) => void;
23
- }>>) => React.JSX.Element;
23
+ }>>) => import("react/jsx-runtime").JSX.Element;
24
24
  declare const AttentionProvider: ({ id, children }: PropsWithChildren<{
25
25
  id: string;
26
- }>) => React.JSX.Element;
26
+ }>) => import("react/jsx-runtime").JSX.Element;
27
27
  export type AttendableContainerProps = ThemedClassName<ComponentPropsWithRef<'div'> & {
28
28
  id: string;
29
29
  asChild?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"AttentionProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/AttentionProvider.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,EAA4B,KAAK,iBAAiB,EAAE,KAAK,qBAAqB,EAAc,MAAM,OAAO,CAAC;AAExH,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGvE,OAAO,EAAE,KAAK,SAAS,EAAE,gBAAgB,EAAkB,MAAM,cAAc,CAAC;AAEhF,QAAA,MAAM,cAAc,cAAc,CAAC;AACnC,QAAA,MAAM,mBAAmB,uBAAuB,CAAC;AACjD,QAAA,MAAM,0BAA0B,6BAA6B,CAAC;AAE9D,KAAK,qBAAqB,GAAG;IAC3B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,QAAA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
  declare const _default: {
4
3
  title: string;
5
- render: () => React.JSX.Element;
6
- decorators: import("@storybook/react/*").Decorator[];
4
+ render: () => import("react/jsx-runtime").JSX.Element;
5
+ decorators: import("@storybook/react").Decorator[];
7
6
  };
8
7
  export default _default;
9
8
  export declare const Default: {};
@@ -1 +1 @@
1
- {"version":3,"file":"AttentionProvider.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/AttentionProvider.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;AA4B1B,wBAIE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
1
+ {"version":3,"file":"AttentionProvider.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/AttentionProvider.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;;;;;;AA8BrB,wBAIE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { type PropsWithChildren } from 'react';
2
+ import { SelectionManager } from '../selection';
3
+ /**
4
+ * Manages selection state across the app for multiple contexts.
5
+ */
6
+ export declare const SelectionProvider: ({ children, selection: propsSelection, }: PropsWithChildren<{
7
+ selection?: SelectionManager;
8
+ }>) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const useSelectedItems: (contextId?: string) => Set<string>;
10
+ /**
11
+ * Provides functions to manage the selection state for multiple contexts.
12
+ */
13
+ export declare const useSelectionActions: (contextIds: string[]) => {
14
+ select: (ids: string[]) => void;
15
+ toggle: (id: string) => void;
16
+ clear: () => void;
17
+ };
18
+ //# sourceMappingURL=SelectionProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectionProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/SelectionProvider.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAK5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAYhD;;GAEG;AAGH,eAAO,MAAM,iBAAiB,6CAG3B,iBAAiB,CAAC;IAAE,SAAS,CAAC,EAAE,gBAAgB,CAAA;CAAE,CAAC,4CAGrD,CAAC;AAKF,eAAO,MAAM,gBAAgB,eAAgB,MAAM,KAAG,GAAG,CAAC,MAAM,CAG/D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,eAAgB,MAAM,EAAE;kBAI9C,MAAM,EAAE;iBAST,MAAM;;CAed,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from './AttentionGlyph';
2
2
  export * from './AttentionProvider';
3
+ export * from './SelectionProvider';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from './attention';
2
2
  export * from './components';
3
+ export * from './selection';
3
4
  //# 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"}
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"}
@@ -0,0 +1,15 @@
1
+ import { type ReactiveObject } from '@dxos/live-object';
2
+ /**
3
+ * Manages selection state for different contexts.
4
+ * Each context maintains its own list of selected IDs.
5
+ */
6
+ export declare class SelectionManager {
7
+ private readonly _state;
8
+ constructor(initial?: Record<string, Set<string>>);
9
+ get selections(): ReactiveObject<Record<string, Set<string>>>;
10
+ getSelection(contextId: string): Set<string>;
11
+ updateSelection(contextId: string, selectedIds: Set<string> | string[]): void;
12
+ clearSelection(contextId: string): void;
13
+ toggleSelection(contextId: string, id: string): void;
14
+ }
15
+ //# sourceMappingURL=selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../../src/selection.ts"],"names":[],"mappings":"AAMA,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEhE;;;GAGG;AAEH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2E;gBAEtF,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAM;IAQrD,IAAI,UAAU,IAAI,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAE5D;IAED,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IAS5C,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE;IAMtE,cAAc,CAAC,SAAS,EAAE,MAAM;IAMhC,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;CAU9C"}
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-attention",
3
- "version": "0.7.5-labs.e27f9b9",
3
+ "version": "0.7.5-labs.f400bbc",
4
4
  "description": "Signifier components and providers for attention system.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
7
  "license": "MIT",
8
8
  "author": "DXOS.org",
9
9
  "sideEffects": true,
10
+ "type": "module",
10
11
  "exports": {
11
12
  ".": {
12
13
  "types": "./dist/types/src/index.d.ts",
@@ -40,9 +41,9 @@
40
41
  "@radix-ui/react-primitive": "2.0.2",
41
42
  "@radix-ui/react-slot": "1.1.2",
42
43
  "@radix-ui/react-use-controllable-state": "1.1.0",
43
- "@dxos/echo-schema": "0.7.5-labs.e27f9b9",
44
- "@dxos/live-object": "0.7.5-labs.e27f9b9",
45
- "@dxos/util": "0.7.5-labs.e27f9b9"
44
+ "@dxos/echo-schema": "0.7.5-labs.f400bbc",
45
+ "@dxos/live-object": "0.7.5-labs.f400bbc",
46
+ "@dxos/util": "0.7.5-labs.f400bbc"
46
47
  },
47
48
  "devDependencies": {
48
49
  "@phosphor-icons/react": "^2.1.5",
@@ -51,18 +52,18 @@
51
52
  "react": "~18.2.0",
52
53
  "react-dom": "~18.2.0",
53
54
  "vite": "5.4.7",
54
- "@dxos/app-graph": "0.7.5-labs.e27f9b9",
55
- "@dxos/random": "0.7.5-labs.e27f9b9",
56
- "@dxos/react-ui": "0.7.5-labs.e27f9b9",
57
- "@dxos/react-ui-theme": "0.7.5-labs.e27f9b9",
58
- "@dxos/storybook-utils": "0.7.5-labs.e27f9b9"
55
+ "@dxos/random": "0.7.5-labs.f400bbc",
56
+ "@dxos/app-graph": "0.7.5-labs.f400bbc",
57
+ "@dxos/react-ui": "0.7.5-labs.f400bbc",
58
+ "@dxos/react-ui-theme": "0.7.5-labs.f400bbc",
59
+ "@dxos/storybook-utils": "0.7.5-labs.f400bbc"
59
60
  },
60
61
  "peerDependencies": {
61
62
  "@phosphor-icons/react": "^2.1.5",
62
63
  "react": "~18.2.0",
63
64
  "react-dom": "~18.2.0",
64
- "@dxos/react-ui": "0.7.5-labs.e27f9b9",
65
- "@dxos/react-ui-theme": "0.7.5-labs.e27f9b9"
65
+ "@dxos/react-ui-theme": "0.7.5-labs.f400bbc",
66
+ "@dxos/react-ui": "0.7.5-labs.f400bbc"
66
67
  },
67
68
  "publishConfig": {
68
69
  "access": "public"
@@ -0,0 +1,75 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { createContext } from '@radix-ui/react-context';
6
+ import { useCallback, type PropsWithChildren } from 'react';
7
+ import React from 'react';
8
+
9
+ import { useDefaultValue } from '@dxos/react-ui';
10
+
11
+ import { SelectionManager } from '../selection';
12
+
13
+ const SELECTION_NAME = 'Selection';
14
+
15
+ type SelectionContextValue = {
16
+ selection: SelectionManager;
17
+ };
18
+
19
+ const [SelectionContextProvider, useSelectionContext] = createContext<SelectionContextValue>(SELECTION_NAME, {
20
+ selection: new SelectionManager(),
21
+ });
22
+
23
+ /**
24
+ * Manages selection state across the app for multiple contexts.
25
+ */
26
+ // TODO(burdon): Review/remove this.
27
+ // TODO(burdon): When is the selection removed?
28
+ export const SelectionProvider = ({
29
+ children,
30
+ selection: propsSelection,
31
+ }: PropsWithChildren<{ selection?: SelectionManager }>) => {
32
+ const selection = useDefaultValue(propsSelection, () => new SelectionManager());
33
+ return <SelectionContextProvider selection={selection}>{children}</SelectionContextProvider>;
34
+ };
35
+
36
+ const emptySet = new Set<string>();
37
+
38
+ // TODO(burdon): Return array?
39
+ export const useSelectedItems = (contextId?: string): Set<string> => {
40
+ const { selection } = useSelectionContext(SELECTION_NAME);
41
+ return contextId ? selection.getSelection(contextId) : emptySet;
42
+ };
43
+
44
+ /**
45
+ * Provides functions to manage the selection state for multiple contexts.
46
+ */
47
+ export const useSelectionActions = (contextIds: string[]) => {
48
+ const { selection } = useSelectionContext(SELECTION_NAME);
49
+
50
+ const select = useCallback(
51
+ (ids: string[]) => {
52
+ for (const contextId of contextIds) {
53
+ selection.updateSelection(contextId, ids);
54
+ }
55
+ },
56
+ [selection, ...contextIds],
57
+ );
58
+
59
+ const toggle = useCallback(
60
+ (id: string) => {
61
+ for (const contextId of contextIds) {
62
+ selection.toggleSelection(contextId, id);
63
+ }
64
+ },
65
+ [selection, ...contextIds],
66
+ );
67
+
68
+ const clear = useCallback(() => {
69
+ for (const contextId of contextIds) {
70
+ selection.clearSelection(contextId);
71
+ }
72
+ }, [selection, ...contextIds]);
73
+
74
+ return { select, toggle, clear };
75
+ };
@@ -4,3 +4,4 @@
4
4
 
5
5
  export * from './AttentionGlyph';
6
6
  export * from './AttentionProvider';
7
+ export * from './SelectionProvider';
package/src/index.ts CHANGED
@@ -4,3 +4,4 @@
4
4
 
5
5
  export * from './attention';
6
6
  export * from './components';
7
+ export * from './selection';
@@ -0,0 +1,60 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { untracked } from '@preact/signals-core';
6
+
7
+ import { create, type ReactiveObject } from '@dxos/live-object';
8
+
9
+ /**
10
+ * Manages selection state for different contexts.
11
+ * Each context maintains its own list of selected IDs.
12
+ */
13
+ // TODO(burdon): Review/remove this abstraction. Selection should be managed by specific components.
14
+ export class SelectionManager {
15
+ private readonly _state = create<{ selections: Record<string, Set<string>> }>({ selections: {} });
16
+
17
+ constructor(initial: Record<string, Set<string>> = {}) {
18
+ if (Object.keys(initial).length > 0) {
19
+ untracked(() => {
20
+ this._state.selections = initial;
21
+ });
22
+ }
23
+ }
24
+
25
+ get selections(): ReactiveObject<Record<string, Set<string>>> {
26
+ return this._state.selections;
27
+ }
28
+
29
+ getSelection(contextId: string): Set<string> {
30
+ if (!this.selections[contextId]) {
31
+ untracked(() => {
32
+ this._state.selections[contextId] = new Set();
33
+ });
34
+ }
35
+ return this.selections[contextId];
36
+ }
37
+
38
+ updateSelection(contextId: string, selectedIds: Set<string> | string[]) {
39
+ untracked(() => {
40
+ this._state.selections[contextId] = selectedIds instanceof Set ? selectedIds : new Set(selectedIds);
41
+ });
42
+ }
43
+
44
+ clearSelection(contextId: string) {
45
+ untracked(() => {
46
+ this._state.selections[contextId] = new Set();
47
+ });
48
+ }
49
+
50
+ toggleSelection(contextId: string, id: string) {
51
+ untracked(() => {
52
+ const current = this.getSelection(contextId);
53
+ if (current.has(id)) {
54
+ current.delete(id);
55
+ } else {
56
+ current.add(id);
57
+ }
58
+ });
59
+ }
60
+ }