@dxos/react-ui-attention 0.8.4-main.a4bbb77 → 0.8.4-main.abd8ff62ef

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 (62) hide show
  1. package/dist/lib/browser/chunk-XVH365AW.mjs +667 -0
  2. package/dist/lib/browser/chunk-XVH365AW.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +82 -17
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +20 -5
  7. package/dist/lib/browser/testing/index.mjs.map +3 -3
  8. package/dist/lib/node-esm/chunk-W73A7WMN.mjs +669 -0
  9. package/dist/lib/node-esm/chunk-W73A7WMN.mjs.map +7 -0
  10. package/dist/lib/node-esm/index.mjs +82 -17
  11. package/dist/lib/node-esm/index.mjs.map +4 -4
  12. package/dist/lib/node-esm/meta.json +1 -1
  13. package/dist/lib/node-esm/testing/index.mjs +20 -5
  14. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  15. package/dist/types/src/attention.d.ts +60 -20
  16. package/dist/types/src/attention.d.ts.map +1 -1
  17. package/dist/types/src/components/AttentionGlyph/AttentionGlyph.d.ts.map +1 -0
  18. package/dist/types/src/components/AttentionGlyph/AttentionGlyph.stories.d.ts.map +1 -0
  19. package/dist/types/src/components/AttentionGlyph/index.d.ts +2 -0
  20. package/dist/types/src/components/AttentionGlyph/index.d.ts.map +1 -0
  21. package/dist/types/src/components/AttentionProvider/AttentionProvider.d.ts +34 -0
  22. package/dist/types/src/components/AttentionProvider/AttentionProvider.d.ts.map +1 -0
  23. package/dist/types/src/components/AttentionProvider/AttentionProvider.stories.d.ts.map +1 -0
  24. package/dist/types/src/components/AttentionProvider/index.d.ts +2 -0
  25. package/dist/types/src/components/AttentionProvider/index.d.ts.map +1 -0
  26. package/dist/types/src/components/{SelectionProvider.d.ts → SelectionProvider/SelectionProvider.d.ts} +7 -6
  27. package/dist/types/src/components/SelectionProvider/SelectionProvider.d.ts.map +1 -0
  28. package/dist/types/src/components/SelectionProvider/index.d.ts +2 -0
  29. package/dist/types/src/components/SelectionProvider/index.d.ts.map +1 -0
  30. package/dist/types/src/selection.d.ts +24 -4
  31. package/dist/types/src/selection.d.ts.map +1 -1
  32. package/dist/types/src/testing/decorators/withAttention.d.ts +5 -1
  33. package/dist/types/src/testing/decorators/withAttention.d.ts.map +1 -1
  34. package/dist/types/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +27 -31
  36. package/src/attention.test.ts +188 -27
  37. package/src/attention.ts +179 -74
  38. package/src/components/{AttentionGlyph.stories.tsx → AttentionGlyph/AttentionGlyph.stories.tsx} +2 -2
  39. package/src/components/{AttentionGlyph.tsx → AttentionGlyph/AttentionGlyph.tsx} +13 -6
  40. package/src/components/AttentionGlyph/index.ts +5 -0
  41. package/src/components/{AttentionProvider.stories.tsx → AttentionProvider/AttentionProvider.stories.tsx} +3 -4
  42. package/src/components/AttentionProvider/AttentionProvider.tsx +176 -0
  43. package/src/components/AttentionProvider/index.ts +5 -0
  44. package/src/components/SelectionProvider/SelectionProvider.tsx +174 -0
  45. package/src/components/SelectionProvider/index.ts +5 -0
  46. package/src/selection.ts +123 -80
  47. package/src/testing/decorators/withAttention.ts +22 -4
  48. package/dist/lib/browser/chunk-IEH7T3ZP.mjs +0 -674
  49. package/dist/lib/browser/chunk-IEH7T3ZP.mjs.map +0 -7
  50. package/dist/lib/node-esm/chunk-NFTXIHW4.mjs +0 -676
  51. package/dist/lib/node-esm/chunk-NFTXIHW4.mjs.map +0 -7
  52. package/dist/types/src/components/AttentionGlyph.d.ts.map +0 -1
  53. package/dist/types/src/components/AttentionGlyph.stories.d.ts.map +0 -1
  54. package/dist/types/src/components/AttentionProvider.d.ts +0 -38
  55. package/dist/types/src/components/AttentionProvider.d.ts.map +0 -1
  56. package/dist/types/src/components/AttentionProvider.stories.d.ts.map +0 -1
  57. package/dist/types/src/components/SelectionProvider.d.ts.map +0 -1
  58. package/src/components/AttentionProvider.tsx +0 -198
  59. package/src/components/SelectionProvider.tsx +0 -120
  60. /package/dist/types/src/components/{AttentionGlyph.d.ts → AttentionGlyph/AttentionGlyph.d.ts} +0 -0
  61. /package/dist/types/src/components/{AttentionGlyph.stories.d.ts → AttentionGlyph/AttentionGlyph.stories.d.ts} +0 -0
  62. /package/dist/types/src/components/{AttentionProvider.stories.d.ts → AttentionProvider/AttentionProvider.stories.d.ts} +0 -0
@@ -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,EAAS,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGvC,OAAO,EAAE,KAAK,IAAI,EAAQ,MAAM,mBAAmB,CAAC;AAIpD,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,aAAa,CAAC;AAEzE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;MAcN,CAAC;AAEvB,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC,CAAC;AAEnE,eAAO,MAAM,gBAAgB;;;;;;;;;;CAO5B,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,aAAa,IAAI,CAAC,SAAS,QAAQ,GACrE,MAAM,GAAG,SAAS,GAClB,CAAC,SAAS,OAAO,GACf,MAAM,EAAE,GACR,CAAC,SAAS,OAAO,GACf;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GACxC,CAAC,SAAS,aAAa,GACrB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,GAC9B,KAAK,CAAC;AAGhB,eAAO,MAAM,eAAe,GAAI,kBAAkB,gBAAgB,EAAE,YAAY,MAAM,gBAYrF,CAAC;AAEF;;;GAGG;AACH,qBAAa,gBAAgB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;IAED,oBAAoB,IAAI,MAAM,EAAE,CAE/B;IAED,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;IACvD,YAAY,CAAC,CAAC,SAAS,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC;IAoB7E,WAAW,CAAC,CAAC,SAAS,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,GAAE,CAAgB,GAAG,eAAe,CAAC,CAAC,CAAC,CAYlG;IAED,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,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"}