@dxos/react-ui-attention 0.8.4-main.f9ba587 → 0.8.4-main.fcfe5033a5

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 (58) hide show
  1. package/dist/lib/browser/chunk-4SEURHOL.mjs +721 -0
  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 +87 -13
  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 +20 -7
  9. package/dist/lib/browser/testing/index.mjs.map +3 -3
  10. package/dist/lib/browser/types.mjs +2 -0
  11. package/dist/lib/browser/types.mjs.map +7 -0
  12. package/dist/lib/node-esm/chunk-6PQ4P7AL.mjs +723 -0
  13. package/dist/lib/node-esm/chunk-6PQ4P7AL.mjs.map +7 -0
  14. package/dist/lib/node-esm/chunk-UHVMYYIB.mjs +2 -0
  15. package/dist/lib/node-esm/chunk-UHVMYYIB.mjs.map +7 -0
  16. package/dist/lib/node-esm/index.mjs +87 -13
  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 +20 -7
  20. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  21. package/dist/lib/node-esm/types.mjs +3 -0
  22. package/dist/lib/node-esm/types.mjs.map +7 -0
  23. package/dist/types/src/attention.d.ts +56 -20
  24. package/dist/types/src/attention.d.ts.map +1 -1
  25. package/dist/types/src/components/AttentionGlyph.d.ts.map +1 -1
  26. package/dist/types/src/components/AttentionGlyph.stories.d.ts +9 -20
  27. package/dist/types/src/components/AttentionGlyph.stories.d.ts.map +1 -1
  28. package/dist/types/src/components/AttentionProvider.d.ts +15 -16
  29. package/dist/types/src/components/AttentionProvider.d.ts.map +1 -1
  30. package/dist/types/src/components/AttentionProvider.stories.d.ts +6 -4
  31. package/dist/types/src/components/AttentionProvider.stories.d.ts.map +1 -1
  32. package/dist/types/src/components/SelectionProvider.d.ts +6 -5
  33. package/dist/types/src/components/SelectionProvider.d.ts.map +1 -1
  34. package/dist/types/src/index.d.ts +1 -0
  35. package/dist/types/src/index.d.ts.map +1 -1
  36. package/dist/types/src/selection.d.ts +49 -17
  37. package/dist/types/src/selection.d.ts.map +1 -1
  38. package/dist/types/src/testing/decorators/withAttention.d.ts +5 -1
  39. package/dist/types/src/testing/decorators/withAttention.d.ts.map +1 -1
  40. package/dist/types/src/types.d.ts +9 -0
  41. package/dist/types/src/types.d.ts.map +1 -0
  42. package/dist/types/tsconfig.tsbuildinfo +1 -1
  43. package/package.json +38 -24
  44. package/src/attention.test.ts +188 -27
  45. package/src/attention.ts +175 -74
  46. package/src/components/AttentionGlyph.stories.tsx +17 -14
  47. package/src/components/AttentionGlyph.tsx +14 -7
  48. package/src/components/AttentionProvider.stories.tsx +12 -9
  49. package/src/components/AttentionProvider.tsx +80 -97
  50. package/src/components/SelectionProvider.tsx +66 -19
  51. package/src/index.ts +1 -0
  52. package/src/selection.ts +135 -65
  53. package/src/testing/decorators/withAttention.ts +21 -4
  54. package/src/types.ts +13 -0
  55. package/dist/lib/browser/chunk-QPEFFJ4E.mjs +0 -616
  56. package/dist/lib/browser/chunk-QPEFFJ4E.mjs.map +0 -7
  57. package/dist/lib/node-esm/chunk-F2JRKDYV.mjs +0 -618
  58. package/dist/lib/node-esm/chunk-F2JRKDYV.mjs.map +0 -7
@@ -1,38 +1,37 @@
1
- import React, { type PropsWithChildren, type ComponentPropsWithRef } from 'react';
1
+ import React, { type ComponentPropsWithRef, type PropsWithChildren } from 'react';
2
2
  import { type ThemedClassName } from '@dxos/react-ui';
3
- import { type Attention, AttentionManager } from '../attention';
3
+ import { AttentionManager } from '../attention';
4
+ import { type Attention } from '../types';
4
5
  declare const ATTENTION_NAME = "Attention";
5
- declare const ATTENABLE_ATTRIBUTE = "data-attendable-id";
6
- declare const ATTENTION_SOURCE_ATTRIBUTE = "data-is-attention-source";
6
+ declare const ATTENDABLE_ATTRIBUTE = "data-attendable-id";
7
+ declare const ATTENTION_SOURCE_ATTRIBUTE = "data-w-attention-source";
7
8
  type AttentionContextValue = {
8
9
  attention: AttentionManager;
9
- path: string[];
10
10
  };
11
11
  declare const useAttentionContext: (consumerName: string) => AttentionContextValue;
12
+ /**
13
+ * Subscribe to the attention state for a qualified graph ID.
14
+ */
12
15
  declare const useAttention: (attendableId?: string) => Attention;
13
- declare const useAttended: () => import("@dxos/live-object").Live<readonly string[]>;
16
+ declare const useAttended: () => readonly string[];
14
17
  /**
15
- * Computes HTML element attributes to apply so the attention system can detect changes
16
- * @param attendableId
18
+ * Computes HTML element attributes to apply so the attention system can detect changes.
17
19
  */
18
20
  declare const useAttentionAttributes: (attendableId?: string) => Record<string, string | undefined>;
19
- declare const useAttentionPath: () => string[];
20
21
  declare const RootAttentionProvider: ({ children, attention: propsAttention, onChange, }: PropsWithChildren<Partial<{
21
22
  attention: AttentionManager;
22
23
  onChange: (nextAttended: string[]) => void;
23
24
  }>>) => React.JSX.Element;
24
- declare const AttentionProvider: ({ id, children }: PropsWithChildren<{
25
- id: string;
26
- }>) => React.JSX.Element;
27
25
  export type AttendableContainerProps = ThemedClassName<ComponentPropsWithRef<'div'> & {
28
26
  id: string;
29
27
  asChild?: boolean;
30
28
  }>;
31
29
  /**
32
- * Note that DeckPlugin and StackPlugin both handle attention on their own, and when rendering content in those cases it
33
- * is not necessary to also render an `AttendableContainer`. This component is primarily for Storybook stories and other
34
- * testing scenarios, or the rare cases where an attendable entity is rendered outside of either of those plugins.
30
+ * Note that DeckPlugin and StackPlugin both handle attention on their own,
31
+ * and when rendering content in those cases it is not necessary to also render an `AttendableContainer`.
32
+ * This component is primarily for Storybook stories and other testing scenarios,
33
+ * or the rare cases where an attendable entity is rendered outside of either of those plugins.
35
34
  */
36
35
  declare const AttendableContainer: React.ForwardRefExoticComponent<Omit<AttendableContainerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
37
- export { RootAttentionProvider, AttentionProvider, AttendableContainer, useAttentionContext, useAttention, useAttended, useAttentionAttributes, useAttentionPath, ATTENTION_NAME, ATTENABLE_ATTRIBUTE, ATTENTION_SOURCE_ATTRIBUTE, };
36
+ export { RootAttentionProvider, AttendableContainer, useAttentionContext, useAttention, useAttended, useAttentionAttributes, ATTENTION_NAME, ATTENDABLE_ATTRIBUTE, ATTENTION_SOURCE_ATTRIBUTE, };
38
37
  //# sourceMappingURL=AttentionProvider.d.ts.map
@@ -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,EAA6B,KAAK,SAAS,EAAE,gBAAgB,EAAkB,MAAM,cAAc,CAAC;AAE3G,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,MAAiC,mBAAmB,iDAGlD,CAAC;AAIH,QAAA,MAAM,YAAY,GAAI,eAAe,MAAM,KAAG,SAQ7C,CAAC;AAEF,QAAA,MAAM,WAAW,2DAGhB,CAAC;AAEF;;;GAGG;AACH,QAAA,MAAM,sBAAsB,GAAI,eAAe,MAAM,uCAUpD,CAAC;AAEF,QAAA,MAAM,gBAAgB,gBAGrB,CAAC;AAEF,QAAA,MAAM,q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,MAAiC,mBAAmB,iDAElD,CAAC;AAIH;;GAEG;AACH,QAAA,MAAM,YAAY,GAAI,eAAe,MAAM,KAAG,SAmB7C,CAAC;AAEF,QAAA,MAAM,WAAW,yBAiBhB,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,sBAAsB,GAAI,eAAe,MAAM,uCAUpD,CAAC;AAEF,QAAA,MAAM,qBAAqB,GAAI,oDAI5B,iBAAiB,CAClB,OAAO,CAAC;IACN,SAAS,EAAE,gBAAgB,CAAC;IAC5B,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC5C,CAAC,CACH,sBAgCA,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,EACtB,cAAc,EACd,oBAAoB,EACpB,0BAA0B,GAC3B,CAAC"}
@@ -1,10 +1,12 @@
1
- import '@dxos-theme';
1
+ import { type StoryObj } from '@storybook/react-vite';
2
2
  import React from 'react';
3
- declare const _default: {
3
+ declare const Story: () => React.JSX.Element;
4
+ declare const meta: {
4
5
  title: string;
5
6
  render: () => React.JSX.Element;
6
7
  decorators: import("@storybook/react").Decorator[];
7
8
  };
8
- export default _default;
9
- export declare const Default: {};
9
+ export default meta;
10
+ type Story = StoryObj<typeof meta>;
11
+ export declare const Default: Story;
10
12
  //# sourceMappingURL=AttentionProvider.stories.d.ts.map
@@ -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,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;AAEjB,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import React, { type PropsWithChildren } from 'react';
2
- import { SelectionManager, type SelectionResult, type SelectionMode } 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
  */
@@ -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[], mode?: SelectionMode) => UseSelectionActions;
27
28
  //# sourceMappingURL=SelectionProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/SelectionProvider.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,EAAwB,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI5E,OAAO,EAEL,gBAAgB,EAChB,KAAK,eAAe,EAEpB,KAAK,aAAa,EACnB,MAAM,cAAc,CAAC;AAYtB;;GAEG;AAEH,eAAO,MAAM,iBAAiB,GAAI,0CAG/B,iBAAiB,CAAC;IAAE,SAAS,CAAC,EAAE,gBAAgB,CAAA;CAAE,CAAC,sBAGrD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,wBAG/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,aAAa,EACjD,YAAY,MAAM,EAClB,OAAM,CAAgB,KACrB,eAAe,CAAC,CAAC,CAanB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,YAAY,MAAM,EAAE,EAAE,OAAM,aAAuB;uBAK9E,MAAM;uBASL,MAAM,EAAE;wBASP,MAAM,MAAM,MAAM;iBASpB,MAAM;;CAed,CAAC"}
1
+ {"version":3,"file":"SelectionProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/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,cAAc,CAAC;AAYtB;;GAEG;AAEH,eAAO,MAAM,iBAAiB,GAAI,0CAG/B,iBAAiB,CAAC;IAAE,SAAS,CAAC,EAAE,gBAAgB,CAAA;CAAE,CAAC,sBAIrD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,wBAG/B,CAAC;AAcF;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,aAAa,EACjD,YAAY,MAAM,EAClB,OAAM,CAAgB,KACrB,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;AAEH,eAAO,MAAM,mBAAmB,GAAI,YAAY,MAAM,EAAE,EAAE,OAAM,aAAuB,KAAG,mBA8DzF,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from './attention';
2
2
  export * from './components';
3
3
  export * from './selection';
4
+ export * from './types';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
@@ -1,23 +1,35 @@
1
- import { type Live } from '@dxos/live-object';
1
+ import { Atom, type Registry } from '@effect-atom/atom-react';
2
+ import * as Schema from 'effect/Schema';
2
3
  export type SelectionMode = 'single' | 'multi' | 'range' | 'multi-range';
3
- export type Selection = {
4
- mode: 'single';
5
- id?: string;
4
+ export declare const SelectionSchema: Schema.mutable<Schema.Union<[Schema.mutable<Schema.Struct<{
5
+ mode: Schema.Literal<["single"]>;
6
+ id: Schema.optional<typeof Schema.String>;
7
+ }>>, Schema.mutable<Schema.Struct<{
8
+ mode: Schema.Literal<["multi"]>;
9
+ ids: Schema.mutable<Schema.Array$<typeof Schema.String>>;
10
+ }>>, Schema.mutable<Schema.Struct<{
11
+ mode: Schema.Literal<["range"]>;
12
+ from: Schema.optional<typeof Schema.String>;
13
+ to: Schema.optional<typeof Schema.String>;
14
+ }>>, Schema.mutable<Schema.Struct<{
15
+ mode: Schema.Literal<["multi-range"]>;
16
+ ranges: Schema.mutable<Schema.Array$<Schema.Struct<{
17
+ from: typeof Schema.String;
18
+ to: typeof Schema.String;
19
+ }>>>;
20
+ }>>]>>;
21
+ export type Selection = Schema.Schema.Type<typeof SelectionSchema>;
22
+ export declare const defaultSelection: (u: SelectionMode) => {
23
+ mode: "single";
6
24
  } | {
7
- mode: 'multi';
8
- ids: string[];
25
+ mode: "multi";
26
+ ids: never[];
9
27
  } | {
10
- mode: 'range';
11
- from?: string;
12
- to?: string;
28
+ mode: "range";
13
29
  } | {
14
- mode: 'multi-range';
15
- ranges: {
16
- from: string;
17
- to: string;
18
- }[];
30
+ mode: "multi-range";
31
+ ranges: never[];
19
32
  };
20
- export declare const defaultSelection: (u: SelectionMode) => Selection;
21
33
  export type SelectionResult<T extends SelectionMode> = T extends 'single' ? string | undefined : T extends 'multi' ? string[] : T extends 'range' ? {
22
34
  from: string;
23
35
  to: string;
@@ -31,10 +43,30 @@ export declare const getSelectionSet: (selectionManager: SelectionManager, conte
31
43
  * Each context maintains its own selection mode and state.
32
44
  */
33
45
  export declare class SelectionManager {
46
+ private readonly _registry;
34
47
  private readonly _state;
35
- 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;
36
67
  getSelectionContexts(): string[];
37
- 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;
38
70
  getSelected<T extends SelectionMode>(contextId: string, mode?: T): SelectionResult<T>;
39
71
  updateSingle(contextId: string, id: string): void;
40
72
  updateMulti(contextId: string, ids: string[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../../src/selection.ts"],"names":[],"mappings":"AAQA,OAAO,EAAQ,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIpD,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,aAAa,CAAC;AAEzE,MAAM,MAAM,SAAS,GACjB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,EAAE,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,CAAC;AAEpE,eAAO,MAAM,gBAAgB,iCAM5B,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,aAAa,IAAI,CAAC,SAAS,QAAQ,GACrE,MAAM,GAAG,SAAS,GAClB,CAAC,SAAS,OAAO,GACf,MA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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,GAAI,oBAAoB,MAAM,KAAG,SAa1D,CAAC"}
@@ -0,0 +1,9 @@
1
+ export type Attention = {
2
+ hasAttention: boolean;
3
+ isAncestor: boolean;
4
+ isRelated: boolean;
5
+ };
6
+ export type CurrentState = {
7
+ current: string[];
8
+ };
9
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,SAAS,GAAG;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC"}