@dxos/react-ui-attention 0.8.4-main.fd6878d → 0.8.4-staging.60fe92afc8

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 (85) hide show
  1. package/LICENSE +102 -5
  2. package/dist/lib/browser/chunk-D2BLVJ6Z.mjs +421 -0
  3. package/dist/lib/browser/chunk-D2BLVJ6Z.mjs.map +7 -0
  4. package/dist/lib/browser/chunk-I4VO2RQM.mjs +255 -0
  5. package/dist/lib/browser/chunk-I4VO2RQM.mjs.map +7 -0
  6. package/dist/lib/browser/index.mjs +165 -23
  7. package/dist/lib/browser/index.mjs.map +4 -4
  8. package/dist/lib/browser/meta.json +1 -1
  9. package/dist/lib/browser/testing/index.mjs +22 -5
  10. package/dist/lib/browser/testing/index.mjs.map +3 -3
  11. package/dist/lib/browser/types/index.mjs +29 -0
  12. package/dist/lib/browser/types/index.mjs.map +7 -0
  13. package/dist/lib/node-esm/chunk-6INLBC62.mjs +423 -0
  14. package/dist/lib/node-esm/chunk-6INLBC62.mjs.map +7 -0
  15. package/dist/lib/node-esm/chunk-ZTUVSH4P.mjs +256 -0
  16. package/dist/lib/node-esm/chunk-ZTUVSH4P.mjs.map +7 -0
  17. package/dist/lib/node-esm/index.mjs +165 -23
  18. package/dist/lib/node-esm/index.mjs.map +4 -4
  19. package/dist/lib/node-esm/meta.json +1 -1
  20. package/dist/lib/node-esm/testing/index.mjs +22 -5
  21. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  22. package/dist/lib/node-esm/types/index.mjs +30 -0
  23. package/dist/lib/node-esm/types/index.mjs.map +7 -0
  24. package/dist/types/src/attention.d.ts +60 -20
  25. package/dist/types/src/attention.d.ts.map +1 -1
  26. package/dist/types/src/components/AttentionGlyph/AttentionGlyph.d.ts.map +1 -0
  27. package/dist/types/src/components/AttentionGlyph/AttentionGlyph.stories.d.ts +16 -0
  28. package/dist/types/src/components/AttentionGlyph/AttentionGlyph.stories.d.ts.map +1 -0
  29. package/dist/types/src/components/AttentionGlyph/index.d.ts +2 -0
  30. package/dist/types/src/components/AttentionGlyph/index.d.ts.map +1 -0
  31. package/dist/types/src/components/AttentionProvider/AttentionProvider.d.ts +34 -0
  32. package/dist/types/src/components/AttentionProvider/AttentionProvider.d.ts.map +1 -0
  33. package/dist/types/src/components/AttentionProvider/AttentionProvider.stories.d.ts +12 -0
  34. package/dist/types/src/components/AttentionProvider/AttentionProvider.stories.d.ts.map +1 -0
  35. package/dist/types/src/components/AttentionProvider/index.d.ts +2 -0
  36. package/dist/types/src/components/AttentionProvider/index.d.ts.map +1 -0
  37. package/dist/types/src/components/{SelectionProvider.d.ts → SelectionProvider/SelectionProvider.d.ts} +7 -6
  38. package/dist/types/src/components/SelectionProvider/SelectionProvider.d.ts.map +1 -0
  39. package/dist/types/src/components/SelectionProvider/index.d.ts +2 -0
  40. package/dist/types/src/components/SelectionProvider/index.d.ts.map +1 -0
  41. package/dist/types/src/index.d.ts +1 -0
  42. package/dist/types/src/index.d.ts.map +1 -1
  43. package/dist/types/src/selection.d.ts +24 -4
  44. package/dist/types/src/selection.d.ts.map +1 -1
  45. package/dist/types/src/testing/decorators/withAttention.d.ts +5 -1
  46. package/dist/types/src/testing/decorators/withAttention.d.ts.map +1 -1
  47. package/dist/types/src/types/index.d.ts +3 -0
  48. package/dist/types/src/types/index.d.ts.map +1 -0
  49. package/dist/types/src/useArticleKeyboardNavigation.d.ts +42 -0
  50. package/dist/types/src/useArticleKeyboardNavigation.d.ts.map +1 -0
  51. package/dist/types/src/useArticleKeyboardNavigation.test.d.ts +2 -0
  52. package/dist/types/src/useArticleKeyboardNavigation.test.d.ts.map +1 -0
  53. package/dist/types/tsconfig.tsbuildinfo +1 -1
  54. package/package.json +35 -32
  55. package/src/attention.test.ts +188 -27
  56. package/src/attention.ts +179 -74
  57. package/src/components/{AttentionGlyph.stories.tsx → AttentionGlyph/AttentionGlyph.stories.tsx} +17 -14
  58. package/src/components/{AttentionGlyph.tsx → AttentionGlyph/AttentionGlyph.tsx} +14 -7
  59. package/src/components/AttentionGlyph/index.ts +5 -0
  60. package/src/components/{AttentionProvider.stories.tsx → AttentionProvider/AttentionProvider.stories.tsx} +12 -10
  61. package/src/components/AttentionProvider/AttentionProvider.tsx +176 -0
  62. package/src/components/AttentionProvider/index.ts +5 -0
  63. package/src/components/SelectionProvider/SelectionProvider.tsx +174 -0
  64. package/src/components/SelectionProvider/index.ts +5 -0
  65. package/src/index.ts +1 -0
  66. package/src/selection.ts +123 -80
  67. package/src/testing/decorators/withAttention.ts +22 -4
  68. package/src/types/index.ts +9 -0
  69. package/src/useArticleKeyboardNavigation.test.ts +50 -0
  70. package/src/useArticleKeyboardNavigation.ts +116 -0
  71. package/dist/lib/browser/chunk-PXMGIYAQ.mjs +0 -650
  72. package/dist/lib/browser/chunk-PXMGIYAQ.mjs.map +0 -7
  73. package/dist/lib/node-esm/chunk-V2PNA7ZV.mjs +0 -652
  74. package/dist/lib/node-esm/chunk-V2PNA7ZV.mjs.map +0 -7
  75. package/dist/types/src/components/AttentionGlyph.d.ts.map +0 -1
  76. package/dist/types/src/components/AttentionGlyph.stories.d.ts +0 -27
  77. package/dist/types/src/components/AttentionGlyph.stories.d.ts.map +0 -1
  78. package/dist/types/src/components/AttentionProvider.d.ts +0 -38
  79. package/dist/types/src/components/AttentionProvider.d.ts.map +0 -1
  80. package/dist/types/src/components/AttentionProvider.stories.d.ts +0 -10
  81. package/dist/types/src/components/AttentionProvider.stories.d.ts.map +0 -1
  82. package/dist/types/src/components/SelectionProvider.d.ts.map +0 -1
  83. package/src/components/AttentionProvider.tsx +0 -198
  84. package/src/components/SelectionProvider.tsx +0 -120
  85. /package/dist/types/src/components/{AttentionGlyph.d.ts → AttentionGlyph/AttentionGlyph.d.ts} +0 -0
@@ -1,12 +1,29 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
  import {
3
- RootAttentionProvider
4
- } from "../chunk-V2PNA7ZV.mjs";
3
+ RootAttentionProvider,
4
+ SelectionProvider
5
+ } from "../chunk-ZTUVSH4P.mjs";
6
+ import {
7
+ AttentionManager
8
+ } from "../chunk-6INLBC62.mjs";
5
9
 
6
10
  // src/testing/decorators/withAttention.ts
7
- import { createElement } from "react";
8
- var withAttention = (Story) => {
9
- return createElement(RootAttentionProvider, {}, createElement(Story));
11
+ import { Registry, RegistryContext } from "@effect-atom/atom-react";
12
+ import { createElement, useMemo } from "react";
13
+ var withAttention = (initialAttendedId) => {
14
+ return (Story) => {
15
+ const registry = useMemo(() => Registry.make(), []);
16
+ const attention = useMemo(() => initialAttendedId ? new AttentionManager(registry, [
17
+ initialAttendedId
18
+ ]) : void 0, [
19
+ registry
20
+ ]);
21
+ return createElement(RegistryContext.Provider, {
22
+ value: registry
23
+ }, createElement(RootAttentionProvider, {
24
+ attention
25
+ }, createElement(SelectionProvider, {}, createElement(Story))));
26
+ };
10
27
  };
11
28
  export {
12
29
  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 { type Decorator } from '@storybook/react';\nimport { createElement } from 'react';\n\nimport { RootAttentionProvider } from '../../components';\n\nexport const withAttention: Decorator = (Story) => {\n return createElement(RootAttentionProvider, {}, createElement(Story));\n};\n"],
5
- "mappings": ";;;;;;AAKA,SAASA,qBAAqB;AAIvB,IAAMC,gBAA2B,CAACC,UAAAA;AACvC,SAAOC,cAAcC,uBAAuB,CAAC,GAAGD,cAAcD,KAAAA,CAAAA;AAChE;",
6
- "names": ["createElement", "withAttention", "Story", "createElement", "RootAttentionProvider"]
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\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;AAGZ,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
  }
@@ -0,0 +1,30 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ AttentionManager,
4
+ SelectionManager,
5
+ SelectionSchema,
6
+ defaultSelection,
7
+ expandAttendableId,
8
+ getAttendables,
9
+ getLinkedVariant,
10
+ getParentId,
11
+ getSegmentId,
12
+ getSelectionSet,
13
+ isLinkedSegment,
14
+ linkedSegment
15
+ } from "../chunk-6INLBC62.mjs";
16
+ export {
17
+ AttentionManager,
18
+ SelectionManager,
19
+ SelectionSchema,
20
+ defaultSelection,
21
+ expandAttendableId,
22
+ getAttendables,
23
+ getLinkedVariant,
24
+ getParentId,
25
+ getSegmentId,
26
+ getSelectionSet,
27
+ isLinkedSegment,
28
+ linkedSegment
29
+ };
30
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -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;IA8CnC,OAAO,CAAC,IAAI;CAMb;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM,EAAE,QAAQ,OAAO,EAAE,MAAK,MAAM,EAAO,KAAG,MAAM,EAqB5F,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAErD,MAAM,MAAM,OAAO,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC"}
1
+ {"version":3,"file":"attention.d.ts","sourceRoot":"","sources":["../../../src/attention.ts"],"names":[],"mappings":"A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oryObj } from '@storybook/react-vite';
2
+ import React from 'react';
3
+ import { type AttentionGlyphProps } from './AttentionGlyph';
4
+ declare const meta: {
5
+ title: string;
6
+ component: any;
7
+ render: (props: AttentionGlyphProps) => React.JSX.Element;
8
+ decorators: import("@storybook/react").Decorator[];
9
+ };
10
+ export default meta;
11
+ type Story = StoryObj<typeof meta>;
12
+ export declare const Default: Story;
13
+ export declare const Attention: Story;
14
+ export declare const Contains: Story;
15
+ export declare const Syncing: Story;
16
+ //# sourceMappingURL=AttentionGlyph.stories.d.ts.map
@@ -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"}
@@ -0,0 +1,12 @@
1
+ import { type StoryObj } from '@storybook/react-vite';
2
+ import React from 'react';
3
+ declare const Story: () => React.JSX.Element;
4
+ declare const meta: {
5
+ title: string;
6
+ render: () => React.JSX.Element;
7
+ decorators: import("@storybook/react").Decorator[];
8
+ };
9
+ export default meta;
10
+ type Story = StoryObj<typeof meta>;
11
+ export declare const Default: Story;
12
+ //# sourceMappingURL=AttentionProvider.stories.d.ts.map
@@ -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,4 +1,5 @@
1
1
  export * from './attention';
2
2
  export * from './components';
3
3
  export * from './selection';
4
+ export * from './useArticleKeyboardNavigation';
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,gCAAgC,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,MAA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,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;KAAE,KAAK,IAAI,GAAG,MAAM,IAAI,CAKpF;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"}
@@ -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"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Compute the id to select after pressing 'j' (delta = 1) or 'k' (delta = -1).
3
+ * Clamps at the list ends — pressing 'j' on the last item keeps the last item
4
+ * selected (vim-style), and 'k' on the first item keeps the first.
5
+ *
6
+ * When no current selection exists, returns the first id (for delta = 1) or the
7
+ * last id (for delta = -1) so the user can enter the list with either key.
8
+ */
9
+ export declare const advance: ({ ids, currentId, delta, }: {
10
+ ids: readonly string[];
11
+ currentId: string | undefined;
12
+ delta: 1 | -1;
13
+ }) => string | undefined;
14
+ export type UseArticleKeyboardNavigationOptions<T> = {
15
+ /** Stable id for the article (used as the keyboard context path). */
16
+ articleId: string;
17
+ /** Ordered list of selectable items as they appear in the article. */
18
+ items: readonly T[];
19
+ /** Currently-selected id, if any. */
20
+ currentId: string | undefined;
21
+ /** Extracts the id from an item. Defaults to `item.id`. */
22
+ getId?: (item: T) => string;
23
+ /** Called with the id to select when the user presses 'j' or 'k'. */
24
+ onSelect: (id: string) => void;
25
+ };
26
+ /**
27
+ * Wire 'j' (next) and 'k' (previous) keyboard shortcuts for an article that
28
+ * navigates a list of items (e.g., messages, events). Bindings are scoped to
29
+ * the article's keyboard context so they only fire while the article has attention.
30
+ *
31
+ * Pass the items directly; ids are derived via `getId` (defaults to `item.id`).
32
+ * Clamps at list boundaries. Active only when the article is attended.
33
+ */
34
+ export declare const useArticleKeyboardNavigation: {
35
+ <T extends {
36
+ id: string;
37
+ }>(options: UseArticleKeyboardNavigationOptions<T>): void;
38
+ <T>(options: UseArticleKeyboardNavigationOptions<T> & {
39
+ getId: (item: T) => string;
40
+ }): void;
41
+ };
42
+ //# sourceMappingURL=useArticleKeyboardNavigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useArticleKeyboardNavigation.d.ts","sourceRoot":"","sources":["../../../src/useArticleKeyboardNavigation.ts"],"names":[],"mappings":"AAUA;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,+BAIjB;IACD,GAAG,EAAE,SAAS,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACf,KAAG,MAAM,GAAG,SAYZ,CAAC;AAEF,MAAM,MAAM,mCAAmC,CAAC,CAAC,IAAI;IACnD,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;IACpB,qCAAqC;IACrC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,2DAA2D;IAC3D,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IAC5B,qEAAqE;IACrE,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,EAAE;IACzC,CAAC,CAAC,SAAS;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,OAAO,EAAE,mCAAmC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAClF,CAAC,CAAC,EAAE,OAAO,EAAE,mCAAmC,CAAC,CAAC,CAAC,GAAG;QAAE,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAoD7F,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useArticleKeyboardNavigation.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useArticleKeyboardNavigation.test.d.ts","sourceRoot":"","sources":["../../../src/useArticleKeyboardNavigation.test.ts"],"names":[],"mappings":""}