@dxos/react-ui-attention 0.8.4-main.dedc0f3 → 0.8.4-main.dfabb4ec29

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 (73) hide show
  1. package/dist/lib/browser/chunk-D2BLVJ6Z.mjs +421 -0
  2. package/dist/lib/browser/chunk-D2BLVJ6Z.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-I4VO2RQM.mjs +255 -0
  4. package/dist/lib/browser/chunk-I4VO2RQM.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +89 -23
  6. package/dist/lib/browser/index.mjs.map +4 -4
  7. package/dist/lib/browser/meta.json +1 -1
  8. package/dist/lib/browser/testing/index.mjs +22 -5
  9. package/dist/lib/browser/testing/index.mjs.map +3 -3
  10. package/dist/lib/browser/types/index.mjs +29 -0
  11. package/dist/lib/browser/types/index.mjs.map +7 -0
  12. package/dist/lib/node-esm/chunk-6INLBC62.mjs +423 -0
  13. package/dist/lib/node-esm/chunk-6INLBC62.mjs.map +7 -0
  14. package/dist/lib/node-esm/chunk-ZTUVSH4P.mjs +256 -0
  15. package/dist/lib/node-esm/chunk-ZTUVSH4P.mjs.map +7 -0
  16. package/dist/lib/node-esm/index.mjs +89 -23
  17. package/dist/lib/node-esm/index.mjs.map +4 -4
  18. package/dist/lib/node-esm/meta.json +1 -1
  19. package/dist/lib/node-esm/testing/index.mjs +22 -5
  20. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  21. package/dist/lib/node-esm/types/index.mjs +30 -0
  22. package/dist/lib/node-esm/types/index.mjs.map +7 -0
  23. package/dist/types/src/attention.d.ts +60 -20
  24. package/dist/types/src/attention.d.ts.map +1 -1
  25. package/dist/types/src/components/AttentionGlyph/AttentionGlyph.d.ts.map +1 -0
  26. package/dist/types/src/components/{AttentionGlyph.stories.d.ts → AttentionGlyph/AttentionGlyph.stories.d.ts} +0 -1
  27. package/dist/types/src/components/AttentionGlyph/AttentionGlyph.stories.d.ts.map +1 -0
  28. package/dist/types/src/components/AttentionGlyph/index.d.ts +2 -0
  29. package/dist/types/src/components/AttentionGlyph/index.d.ts.map +1 -0
  30. package/dist/types/src/components/AttentionProvider/AttentionProvider.d.ts +34 -0
  31. package/dist/types/src/components/AttentionProvider/AttentionProvider.d.ts.map +1 -0
  32. package/dist/types/src/components/{AttentionProvider.stories.d.ts → AttentionProvider/AttentionProvider.stories.d.ts} +0 -1
  33. package/dist/types/src/components/AttentionProvider/AttentionProvider.stories.d.ts.map +1 -0
  34. package/dist/types/src/components/AttentionProvider/index.d.ts +2 -0
  35. package/dist/types/src/components/AttentionProvider/index.d.ts.map +1 -0
  36. package/dist/types/src/components/{SelectionProvider.d.ts → SelectionProvider/SelectionProvider.d.ts} +7 -6
  37. package/dist/types/src/components/SelectionProvider/SelectionProvider.d.ts.map +1 -0
  38. package/dist/types/src/components/SelectionProvider/index.d.ts +2 -0
  39. package/dist/types/src/components/SelectionProvider/index.d.ts.map +1 -0
  40. package/dist/types/src/selection.d.ts +24 -4
  41. package/dist/types/src/selection.d.ts.map +1 -1
  42. package/dist/types/src/testing/decorators/withAttention.d.ts +5 -1
  43. package/dist/types/src/testing/decorators/withAttention.d.ts.map +1 -1
  44. package/dist/types/src/types/index.d.ts +3 -0
  45. package/dist/types/src/types/index.d.ts.map +1 -0
  46. package/dist/types/tsconfig.tsbuildinfo +1 -1
  47. package/package.json +33 -31
  48. package/src/attention.test.ts +188 -27
  49. package/src/attention.ts +179 -74
  50. package/src/components/{AttentionGlyph.stories.tsx → AttentionGlyph/AttentionGlyph.stories.tsx} +3 -5
  51. package/src/components/{AttentionGlyph.tsx → AttentionGlyph/AttentionGlyph.tsx} +13 -6
  52. package/src/components/AttentionGlyph/index.ts +5 -0
  53. package/src/components/{AttentionProvider.stories.tsx → AttentionProvider/AttentionProvider.stories.tsx} +4 -7
  54. package/src/components/AttentionProvider/AttentionProvider.tsx +176 -0
  55. package/src/components/AttentionProvider/index.ts +5 -0
  56. package/src/components/SelectionProvider/SelectionProvider.tsx +174 -0
  57. package/src/components/SelectionProvider/index.ts +5 -0
  58. package/src/selection.ts +123 -80
  59. package/src/testing/decorators/withAttention.ts +22 -4
  60. package/src/types/index.ts +9 -0
  61. package/dist/lib/browser/chunk-IEH7T3ZP.mjs +0 -674
  62. package/dist/lib/browser/chunk-IEH7T3ZP.mjs.map +0 -7
  63. package/dist/lib/node-esm/chunk-NFTXIHW4.mjs +0 -676
  64. package/dist/lib/node-esm/chunk-NFTXIHW4.mjs.map +0 -7
  65. package/dist/types/src/components/AttentionGlyph.d.ts.map +0 -1
  66. package/dist/types/src/components/AttentionGlyph.stories.d.ts.map +0 -1
  67. package/dist/types/src/components/AttentionProvider.d.ts +0 -38
  68. package/dist/types/src/components/AttentionProvider.d.ts.map +0 -1
  69. package/dist/types/src/components/AttentionProvider.stories.d.ts.map +0 -1
  70. package/dist/types/src/components/SelectionProvider.d.ts.map +0 -1
  71. package/src/components/AttentionProvider.tsx +0 -198
  72. package/src/components/SelectionProvider.tsx +0 -120
  73. /package/dist/types/src/components/{AttentionGlyph.d.ts → AttentionGlyph/AttentionGlyph.d.ts} +0 -0
@@ -1,37 +1,48 @@
1
- import { Schema } from 'effect';
2
- import { type Live } from '@dxos/live-object';
3
- export declare const ATTENDABLE_PATH_SEPARATOR = "~";
4
- export declare const AttentionSchema: Schema.mutable<Schema.Struct<{
5
- hasAttention: typeof Schema.Boolean;
6
- isAncestor: typeof Schema.Boolean;
7
- isRelated: typeof Schema.Boolean;
8
- }>>;
9
- export type Attention = Schema.Schema.Type<typeof AttentionSchema>;
1
+ import { Atom, type Registry } from '@effect-atom/atom-react';
2
+ export type Attention = {
3
+ hasAttention: boolean;
4
+ isAncestor: boolean;
5
+ isRelated: boolean;
6
+ };
10
7
  /**
11
8
  * Manages attention state for an application.
9
+ * Attention keys are slash-qualified graph IDs; ancestry is derived from progressive prefixes.
12
10
  */
13
11
  export declare class AttentionManager {
12
+ private readonly _registry;
14
13
  private readonly _map;
15
- private readonly _state;
16
- constructor(initial?: string[]);
14
+ private readonly _currentAtom;
15
+ constructor(_registry: Registry.Registry, initial?: string[]);
16
+ /**
17
+ * Atom for the currently attended element IDs.
18
+ */
19
+ get current(): Atom.Atom<string[]>;
20
+ /**
21
+ * Gets the currently attended element IDs.
22
+ */
23
+ getCurrent(): readonly string[];
17
24
  /**
18
- * Currently attended element.
19
- *
20
- * @reactive
25
+ * Subscribe to changes in the current attention IDs.
21
26
  */
22
- get current(): Live<readonly string[]>;
27
+ subscribeCurrent(cb: (current: readonly string[]) => void): () => void;
23
28
  /**
24
- * All attention paths.
29
+ * All tracked qualified IDs.
25
30
  */
26
- keys(): string[][];
31
+ keys(): string[];
27
32
  /**
28
- * Get the attention state for a given path.
33
+ * Get the attention state for a given qualified ID.
29
34
  */
30
- get(key: string[]): Live<Attention>;
35
+ get(id: string): Attention;
36
+ /**
37
+ * Subscribe to changes in the attention state for a given qualified ID.
38
+ */
39
+ subscribe(id: string, cb: (attention: Attention) => void): () => void;
40
+ private _getAtom;
31
41
  private _set;
32
42
  }
33
43
  /**
34
- * Accumulates all attendable id’s between the element provided and the root, inclusive.
44
+ * Accumulates all attendable IDs between the element provided and the root, inclusive.
45
+ * Each `data-attendable-id` value is treated as a single qualified ID (no splitting).
35
46
  */
36
47
  export declare const getAttendables: (selector: string, cursor: Element, acc?: string[]) => string[];
37
48
  export type AttendableId = {
@@ -40,4 +51,33 @@ export type AttendableId = {
40
51
  export type Related = {
41
52
  related?: boolean;
42
53
  };
54
+ /**
55
+ * Decompose a qualified graph ID into progressive prefixes for ancestry tracking.
56
+ * e.g. `root/a/b/c` yields `['root', 'root/a', 'root/a/b', 'root/a/b/c']`.
57
+ */
58
+ export declare const expandAttendableId: (qualifiedId: string) => string[];
59
+ /**
60
+ * Whether the last segment of a qualified ID is a linked segment (starts with `~`).
61
+ * Linked segments share their attention state with the parent node.
62
+ */
63
+ export declare const isLinkedSegment: (qualifiedId: string) => boolean;
64
+ /**
65
+ * Build a linked segment ID from a variant name (e.g., `'settings'` -> `'~settings'`).
66
+ * Nodes identified by linked segments share their attention state with the parent node.
67
+ */
68
+ export declare const linkedSegment: (variant: string) => string;
69
+ /**
70
+ * Extract the variant name from the last segment of a qualified ID, stripping the linked prefix.
71
+ * e.g. `'root/space/obj/~settings'` -> `'settings'`.
72
+ * If the segment is not linked (no `~` prefix), returns the segment as-is.
73
+ */
74
+ export declare const getLinkedVariant: (qualifiedId: string) => string;
75
+ /**
76
+ * Get the parent qualified ID (everything before the last `/` segment).
77
+ */
78
+ export declare const getParentId: (qualifiedId: string | undefined) => string | undefined;
79
+ /**
80
+ * Extract the segment ID (last segment) of a qualified ID.
81
+ */
82
+ export declare const getSegmentId: (qualifiedId: string) => string;
43
83
  //# sourceMappingURL=attention.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"attention.d.ts","sourceRoot":"","sources":["../../../src/attention.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,KAAK,IAAI,EAAQ,MAAM,mBAAmB,CAAC;AAIpD,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,eAAO,MAAM,eAAe;;;;GAM3B,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC,CAAC;AAKnE;;GAEG;AAEH,qBAAa,gBAAgB;IAG3B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAwD;IAC7E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgD;gBAE3D,OAAO,GAAE,MAAM,EAAO;IAMlC;;;;OAIG;IACH,IAAI,OAAO,IAAI,IAAI,CAAC,SAAS,MAAM,EAAE,CAAC,CAErC;IAED;;OAEG;IACH,IAAI,IAAI,MAAM,EAAE,EAAE;IAIlB;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;IA8C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M,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,4 +1,3 @@
1
- import '@dxos-theme';
2
1
  import { type StoryObj } from '@storybook/react-vite';
3
2
  import React from 'react';
4
3
  import { type AttentionGlyphProps } from './AttentionGlyph';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AttentionGlyph.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/AttentionGlyph/AttentionGlyph.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAA2C,MAAM,OAAO,CAAC;AAMhE,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAkB5E,QAAA,MAAM,IAAI;;eAEqB,GAAG;oBAlBL,mBAAmB;;CAqBX,CAAC;eAEvB,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAErB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAEvB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAEtB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAqCrB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './AttentionGlyph';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/AttentionGlyph/index.ts"],"names":[],"mappings":"AAIA,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,34 @@
1
+ import React, { type ComponentPropsWithRef, type PropsWithChildren } from 'react';
2
+ import { type ThemedClassName } from '@dxos/react-ui';
3
+ import { type Attention, AttentionManager } from '../../attention';
4
+ type AttentionContextValue = {
5
+ attention: AttentionManager;
6
+ };
7
+ declare const useAttentionContext: (consumerName: string) => AttentionContextValue;
8
+ /**
9
+ * Subscribe to the attention state for a qualified graph ID.
10
+ */
11
+ declare const useAttention: (attendableId?: string) => Attention;
12
+ declare const useAttended: () => readonly string[];
13
+ /**
14
+ * Computes HTML element attributes to apply so the attention system can detect changes.
15
+ */
16
+ declare const useAttentionAttributes: (attendableId?: string) => Record<string, string | undefined>;
17
+ type RootAttentionProviderProps = PropsWithChildren<{
18
+ attention?: AttentionManager;
19
+ onChange?: (nextAttended: string[]) => void;
20
+ }>;
21
+ declare const RootAttentionProvider: ({ children, attention: propsAttention, onChange }: RootAttentionProviderProps) => React.JSX.Element;
22
+ export type AttendableContainerProps = ThemedClassName<ComponentPropsWithRef<'div'> & {
23
+ id: string;
24
+ asChild?: boolean;
25
+ }>;
26
+ /**
27
+ * Note that DeckPlugin and StackPlugin both handle attention on their own,
28
+ * and when rendering content in those cases it is not necessary to also render an `AttendableContainer`.
29
+ * This component is primarily for Storybook stories and other testing scenarios,
30
+ * or the rare cases where an attendable entity is rendered outside of either of those plugins.
31
+ */
32
+ declare const AttendableContainer: React.ForwardRefExoticComponent<Omit<AttendableContainerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
33
+ export { RootAttentionProvider, AttendableContainer, useAttentionContext, useAttention, useAttended, useAttentionAttributes, };
34
+ //# sourceMappingURL=AttentionProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AttentionProvider.d.ts","sourceRoot":"","sources":["../../../../../src/components/AttentionProvider/AttentionProvider.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,EACZ,KAAK,qBAAqB,EAE1B,KAAK,iBAAiB,EAOvB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,OAAO,EAAE,KAAK,SAAS,EAAE,gBAAgB,EAAkB,MAAM,iBAAiB,CAAC;AAMnF,KAAK,qBAAqB,GAAG;IAC3B,SAAS,EAAE,gBAAgB,CAAC;CAC7B,CAAC;AAEF,QAAA,MAAiC,mBAAmB,iDAElD,CAAC;AAIH;;GAEG;AAEH,QAAA,MAAM,YAAY,kBAAmB,MAAM,KAAG,SAkB7C,CAAC;AAEF,QAAA,MAAM,WAAW,yBAgBhB,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,sBAAsB,kBAAmB,MAAM,uCAUpD,CAAC;AAEF,KAAK,0BAA0B,GAAG,iBAAiB,CAAC;IAClD,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,QAAQ,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC7C,CAAC,CAAC;AAEH,QAAA,MAAM,qBAAqB,sDAAuD,0BAA0B,sBAmC3G,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,eAAe,CACpD,qBAAqB,CAAC,KAAK,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CACjE,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,mBAAmB,8GAgBxB,CAAC;AAEF,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,WAAW,EACX,sBAAsB,GACvB,CAAC"}
@@ -1,4 +1,3 @@
1
- import '@dxos-theme';
2
1
  import { type StoryObj } from '@storybook/react-vite';
3
2
  import React from 'react';
4
3
  declare const Story: () => React.JSX.Element;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AttentionProvider.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/AttentionProvider/AttentionProvider.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAiB1B,QAAA,MAAM,KAAK,yBASV,CAAC;AAEF,QAAA,MAAM,IAAI;;;;CAIM,CAAC;eAEF,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './AttentionProvider';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/AttentionProvider/index.ts"],"names":[],"mappings":"AAIA,cAAc,qBAAqB,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import React, { type PropsWithChildren } from 'react';
2
- import { SelectionManager, type SelectionMode, type SelectionResult } from '../selection';
2
+ import { SelectionManager, type SelectionMode, type SelectionResult } from '../../selection';
3
3
  /**
4
4
  * Manages selection state across the app for multiple contexts.
5
5
  */
6
- export declare const SelectionProvider: ({ children, selection: propsSelection, }: PropsWithChildren<{
6
+ export declare const SelectionProvider: ({ children, selection: selectionProp, }: PropsWithChildren<{
7
7
  selection?: SelectionManager;
8
8
  }>) => React.JSX.Element;
9
9
  /**
@@ -14,14 +14,15 @@ export declare const useSelectionManager: () => SelectionManager;
14
14
  * Get the selected objects for a given context.
15
15
  */
16
16
  export declare const useSelected: <T extends SelectionMode>(contextId?: string, mode?: T) => SelectionResult<T>;
17
- /**
18
- * Provides functions to manage the selection state for multiple contexts.
19
- */
20
- export declare const useSelectionActions: (contextIds: string[], mode?: SelectionMode) => {
17
+ export type UseSelectionActions = {
21
18
  singleSelect: (id: string) => void;
22
19
  multiSelect: (ids: string[]) => void;
23
20
  rangeSelect: (from: string, to: string) => void;
24
21
  toggle: (id: string) => void;
25
22
  clear: () => void;
26
23
  };
24
+ /**
25
+ * Provides functions to manage the selection state for multiple contexts.
26
+ */
27
+ export declare const useSelectionActions: (contextIds: string[]) => UseSelectionActions;
27
28
  //# sourceMappingURL=SelectionProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectionProvider.d.ts","sourceRoot":"","sources":["../../../../../src/components/SelectionProvider/SelectionProvider.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAyD,MAAM,OAAO,CAAC;AAI7G,OAAO,EAEL,gBAAgB,EAChB,KAAK,aAAa,EAClB,KAAK,eAAe,EAErB,MAAM,iBAAiB,CAAC;AAiBzB;;GAEG;AACH,eAAO,MAAM,iBAAiB,4CAG3B,iBAAiB,CAAC;IAAE,SAAS,CAAC,EAAE,gBAAgB,CAAA;CAAE,CAAC,sBAKrD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,QAAO,gBAGtC,CAAC;AAcF;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,aAAa,cACrC,MAAM,SACZ,CAAC,KACN,eAAe,CAAC,CAAC,CAsBnB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACrC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,eAAgB,MAAM,EAAE,KAAG,mBAiE1D,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './SelectionProvider';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/SelectionProvider/index.ts"],"names":[],"mappings":"AAIA,cAAc,qBAAqB,CAAC"}
@@ -1,5 +1,5 @@
1
- import { Schema } from 'effect';
2
- import { type Live } from '@dxos/live-object';
1
+ import { Atom, type Registry } from '@effect-atom/atom-react';
2
+ import * as Schema from 'effect/Schema';
3
3
  export type SelectionMode = 'single' | 'multi' | 'range' | 'multi-range';
4
4
  export declare const SelectionSchema: Schema.mutable<Schema.Union<[Schema.mutable<Schema.Struct<{
5
5
  mode: Schema.Literal<["single"]>;
@@ -43,10 +43,30 @@ export declare const getSelectionSet: (selectionManager: SelectionManager, conte
43
43
  * Each context maintains its own selection mode and state.
44
44
  */
45
45
  export declare class SelectionManager {
46
+ private readonly _registry;
46
47
  private readonly _state;
47
- constructor(initial?: Record<string, Selection>);
48
+ constructor(_registry: Registry.Registry, initial?: Record<string, Selection>);
49
+ /**
50
+ * Get the state atom for reactive access in the graph system.
51
+ */
52
+ get state(): Atom.Atom<{
53
+ selections: Record<string, Selection>;
54
+ }>;
55
+ /**
56
+ * Gets the current state.
57
+ */
58
+ getState(): {
59
+ selections: Record<string, Selection>;
60
+ };
61
+ /**
62
+ * Subscribe to changes in the selection state.
63
+ */
64
+ subscribe(cb: (state: {
65
+ selections: Record<string, Selection>;
66
+ }) => void): () => void;
48
67
  getSelectionContexts(): string[];
49
- getSelection<T extends SelectionMode | undefined>(contextId: string, mode?: T): T extends undefined ? Live<Selection> | undefined : Live<Selection>;
68
+ getSelection(contextId: string): Selection | undefined;
69
+ getSelection<T extends SelectionMode>(contextId: string, mode: T): Selection;
50
70
  getSelected<T extends SelectionMode>(contextId: string, mode?: T): SelectionResult<T>;
51
71
  updateSingle(contextId: string, id: string): void;
52
72
  updateMulti(contextId: string, ids: string[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../../src/selection.ts"],"names":[],"mappings":"AAKA,OAAO,EA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EAAE,MAAM,GAAG,IAAI,CAShD;IAED,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAS3C;IAED,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAStD;IAED,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,QASzE;IAED,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAoBtC;IAED,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAcnD;CACF"}
@@ -1,3 +1,7 @@
1
1
  import { type Decorator } from '@storybook/react';
2
- export declare const withAttention: Decorator;
2
+ /**
3
+ * Storybook decorator that provides attention context.
4
+ * @param initialAttendedId Optional ID to set as initially attended.
5
+ */
6
+ export declare const withAttention: (initialAttendedId?: string) => Decorator;
3
7
  //# sourceMappingURL=withAttention.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"withAttention.d.ts","sourceRoot":"","sources":["../../../../../src/testing/decorators/withAttention.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAKlD,eAAO,MAAM,aAAa,EAAE,SAE3B,CAAC"}
1
+ {"version":3,"file":"withAttention.d.ts","sourceRoot":"","sources":["../../../../../src/testing/decorators/withAttention.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAMlD;;;GAGG;AACH,eAAO,MAAM,aAAa,uBAAwB,MAAM,KAAG,SAc1D,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from '../attention';
2
+ export * from '../selection';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAOA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}