@dxos/react-ui-attention 0.8.4-main.c1de068 → 0.8.4-main.c85a9c8dae

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-PAZBZOO2.mjs +7 -0
  2. package/dist/lib/browser/chunk-PAZBZOO2.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-TAZUDNJI.mjs +705 -0
  4. package/dist/lib/browser/chunk-TAZUDNJI.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +75 -8
  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 +21 -5
  9. package/dist/lib/browser/testing/index.mjs.map +3 -3
  10. package/dist/lib/browser/types.mjs +7 -0
  11. package/dist/lib/browser/types.mjs.map +7 -0
  12. package/dist/lib/node-esm/chunk-FT553KKP.mjs +706 -0
  13. package/dist/lib/node-esm/chunk-FT553KKP.mjs.map +7 -0
  14. package/dist/lib/node-esm/chunk-PMGNPL4M.mjs +9 -0
  15. package/dist/lib/node-esm/chunk-PMGNPL4M.mjs.map +7 -0
  16. package/dist/lib/node-esm/index.mjs +75 -8
  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 +21 -5
  20. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  21. package/dist/lib/node-esm/types.mjs +8 -0
  22. package/dist/lib/node-esm/types.mjs.map +7 -0
  23. package/dist/types/src/attention.d.ts +22 -17
  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 +8 -7
  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 +24 -4
  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 +10 -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 +13 -8
  45. package/src/attention.ts +64 -41
  46. package/src/components/AttentionGlyph.stories.tsx +17 -14
  47. package/src/components/AttentionGlyph.tsx +14 -7
  48. package/src/components/AttentionProvider.stories.tsx +13 -9
  49. package/src/components/AttentionProvider.tsx +80 -70
  50. package/src/components/SelectionProvider.tsx +66 -19
  51. package/src/index.ts +1 -0
  52. package/src/selection.ts +113 -72
  53. package/src/testing/decorators/withAttention.ts +21 -4
  54. package/src/types.ts +16 -0
  55. package/dist/lib/browser/chunk-3K54PTHR.mjs +0 -650
  56. package/dist/lib/browser/chunk-3K54PTHR.mjs.map +0 -7
  57. package/dist/lib/node-esm/chunk-LVRGGYEI.mjs +0 -652
  58. package/dist/lib/node-esm/chunk-LVRGGYEI.mjs.map +0 -7
package/package.json CHANGED
@@ -1,20 +1,32 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-attention",
3
- "version": "0.8.4-main.c1de068",
3
+ "version": "0.8.4-main.c85a9c8dae",
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
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/dxos/dxos"
10
+ },
7
11
  "license": "MIT",
8
12
  "author": "DXOS.org",
9
- "sideEffects": true,
13
+ "sideEffects": false,
10
14
  "type": "module",
11
15
  "exports": {
12
16
  ".": {
17
+ "source": "./src/index.ts",
13
18
  "types": "./dist/types/src/index.d.ts",
14
19
  "browser": "./dist/lib/browser/index.mjs",
15
20
  "node": "./dist/lib/node-esm/index.mjs"
16
21
  },
22
+ "./types": {
23
+ "source": "./src/types.ts",
24
+ "types": "./dist/types/src/types.d.ts",
25
+ "browser": "./dist/lib/browser/types.mjs",
26
+ "node": "./dist/lib/node-esm/types.mjs"
27
+ },
17
28
  "./testing": {
29
+ "source": "./src/testing/index.ts",
18
30
  "types": "./dist/types/src/testing/index.d.ts",
19
31
  "browser": "./dist/lib/browser/testing/index.mjs",
20
32
  "node": "./dist/lib/node-esm/testing/index.mjs"
@@ -23,6 +35,9 @@
23
35
  "types": "dist/types/src/index.d.ts",
24
36
  "typesVersions": {
25
37
  "*": {
38
+ "types": [
39
+ "dist/types/src/types.d.ts"
40
+ ],
26
41
  "testing": [
27
42
  "dist/types/src/testing/index.d.ts"
28
43
  ]
@@ -33,8 +48,7 @@
33
48
  "src"
34
49
  ],
35
50
  "dependencies": {
36
- "@preact-signals/safe-react": "^0.9.0",
37
- "@preact/signals-core": "^1.9.0",
51
+ "@effect-atom/atom-react": "^0.5.0",
38
52
  "@radix-ui/primitive": "1.1.1",
39
53
  "@radix-ui/react-compose-refs": "1.1.1",
40
54
  "@radix-ui/react-context": "1.1.1",
@@ -42,30 +56,30 @@
42
56
  "@radix-ui/react-primitive": "2.0.2",
43
57
  "@radix-ui/react-slot": "1.1.2",
44
58
  "@radix-ui/react-use-controllable-state": "1.1.0",
45
- "effect": "3.17.0",
46
- "@dxos/echo-schema": "0.8.4-main.c1de068",
47
- "@dxos/invariant": "0.8.4-main.c1de068",
48
- "@dxos/log": "0.8.4-main.c1de068",
49
- "@dxos/util": "0.8.4-main.c1de068",
50
- "@dxos/live-object": "0.8.4-main.c1de068"
59
+ "effect": "3.19.16",
60
+ "@dxos/echo": "0.8.4-main.c85a9c8dae",
61
+ "@dxos/invariant": "0.8.4-main.c85a9c8dae",
62
+ "@dxos/log": "0.8.4-main.c85a9c8dae",
63
+ "@dxos/util": "0.8.4-main.c85a9c8dae",
64
+ "@dxos/react-hooks": "0.8.4-main.c85a9c8dae"
51
65
  },
52
66
  "devDependencies": {
53
- "@types/react": "~18.2.0",
54
- "@types/react-dom": "~18.2.0",
55
- "react": "~18.2.0",
56
- "react-dom": "~18.2.0",
57
- "vite": "5.4.7",
58
- "@dxos/random": "0.8.4-main.c1de068",
59
- "@dxos/react-ui": "0.8.4-main.c1de068",
60
- "@dxos/react-ui-theme": "0.8.4-main.c1de068",
61
- "@dxos/storybook-utils": "0.8.4-main.c1de068"
67
+ "@types/react": "~19.2.7",
68
+ "@types/react-dom": "~19.2.3",
69
+ "react": "~19.2.3",
70
+ "react-dom": "~19.2.3",
71
+ "vite": "^7.1.11",
72
+ "@dxos/react-ui": "0.8.4-main.c85a9c8dae",
73
+ "@dxos/storybook-utils": "0.8.4-main.c85a9c8dae",
74
+ "@dxos/random": "0.8.4-main.c85a9c8dae",
75
+ "@dxos/ui-theme": "0.8.4-main.c85a9c8dae"
62
76
  },
63
77
  "peerDependencies": {
64
- "effect": "^3.13.3",
65
- "react": "~18.2.0",
66
- "react-dom": "~18.2.0",
67
- "@dxos/react-ui": "0.8.4-main.c1de068",
68
- "@dxos/react-ui-theme": "0.8.4-main.c1de068"
78
+ "effect": "3.19.16",
79
+ "react": "~19.2.3",
80
+ "react-dom": "~19.2.3",
81
+ "@dxos/react-ui": "0.8.4-main.c85a9c8dae",
82
+ "@dxos/ui-theme": "0.8.4-main.c85a9c8dae"
69
83
  },
70
84
  "publishConfig": {
71
85
  "access": "public"
@@ -2,14 +2,16 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { describe, test, expect } from 'vitest';
5
+ import { Registry } from '@effect-atom/atom-react';
6
+ import { describe, expect, test } from 'vitest';
6
7
 
7
8
  import { AttentionManager } from './attention';
8
9
 
9
10
  describe('AttentionManager', () => {
10
11
  test('takes an initial attendable', () => {
11
- const attention = new AttentionManager(['a', 'b', 'c']);
12
- expect(attention.current).to.deep.equal(['a', 'b', 'c']);
12
+ const registry = Registry.make();
13
+ const attention = new AttentionManager(registry, ['a', 'b', 'c']);
14
+ expect(attention.getCurrent()).to.deep.equal(['a', 'b', 'c']);
13
15
  expect(attention.keys()).to.deep.equal([['a'], ['b', 'c'], ['c'], ['a', 'b', 'c']]);
14
16
  expect(attention.get(['a'])).to.deep.equal({ hasAttention: false, isAncestor: false, isRelated: true });
15
17
  expect(attention.get(['b', 'c'])).to.deep.equal({ hasAttention: false, isAncestor: true, isRelated: false });
@@ -19,15 +21,17 @@ describe('AttentionManager', () => {
19
21
  });
20
22
 
21
23
  test('current returns last updated key', () => {
22
- const attention = new AttentionManager();
23
- expect(attention.current).to.deep.equal([]);
24
+ const registry = Registry.make();
25
+ const attention = new AttentionManager(registry);
26
+ expect(attention.getCurrent()).to.deep.equal([]);
24
27
 
25
28
  attention.update(['a', 'b', 'c']);
26
- expect(attention.current).to.deep.equal(['a', 'b', 'c']);
29
+ expect(attention.getCurrent()).to.deep.equal(['a', 'b', 'c']);
27
30
  });
28
31
 
29
32
  test('keys returns all stored attendables', () => {
30
- const attention = new AttentionManager();
33
+ const registry = Registry.make();
34
+ const attention = new AttentionManager(registry);
31
35
  expect(attention.keys()).to.deep.equal([]);
32
36
 
33
37
  attention.update(['a']);
@@ -38,7 +42,8 @@ describe('AttentionManager', () => {
38
42
  });
39
43
 
40
44
  test('get returns attention object for a given key', () => {
41
- const attention = new AttentionManager();
45
+ const registry = Registry.make();
46
+ const attention = new AttentionManager(registry);
42
47
  expect(attention.get(['a'])).to.deep.equal({ hasAttention: false, isAncestor: false, isRelated: false });
43
48
 
44
49
  attention.update(['a']);
package/src/attention.ts CHANGED
@@ -2,24 +2,11 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { untracked } from '@preact/signals-core';
6
- import { Schema } from 'effect';
5
+ import { Atom, type Registry } from '@effect-atom/atom-react';
7
6
 
8
- import { live, type Live } from '@dxos/live-object';
9
7
  import { ComplexMap } from '@dxos/util';
10
8
 
11
- // NOTE: Chosen from RFC 1738’s `safe` characters: http://www.faqs.org/rfcs/rfc1738.html
12
- export const ATTENDABLE_PATH_SEPARATOR = '~';
13
-
14
- export const AttentionSchema = Schema.mutable(
15
- Schema.Struct({
16
- hasAttention: Schema.Boolean,
17
- isAncestor: Schema.Boolean,
18
- isRelated: Schema.Boolean,
19
- }),
20
- );
21
-
22
- export type Attention = Schema.Schema.Type<typeof AttentionSchema>;
9
+ import { ATTENDABLE_PATH_SEPARATOR, type Attention } from './types';
23
10
 
24
11
  // TODO(wittjosiah): Use mosaic path utility?
25
12
  const stringKey = (key: string[]) => key.join(',');
@@ -27,26 +14,44 @@ const stringKey = (key: string[]) => key.join(',');
27
14
  /**
28
15
  * Manages attention state for an application.
29
16
  */
30
- // TODO(wittjosiah): Write unit tests.
31
17
  export class AttentionManager {
32
- // Each attention path is associated with an attention object.
18
+ // Each attention path is associated with an attention atom.
33
19
  // The lookup is not a reactive object to ensure that attention for each path is subscribable independently.
34
- private readonly _map = new ComplexMap<string[], Live<Attention>>(stringKey);
35
- private readonly _state = live<{ current: string[] }>({ current: [] });
36
-
37
- constructor(initial: string[] = []) {
20
+ private readonly _map = new ComplexMap<string[], Atom.Writable<Attention>>(stringKey);
21
+ private readonly _currentAtom: Atom.Writable<string[]>;
22
+
23
+ constructor(
24
+ private readonly _registry: Registry.Registry,
25
+ initial: string[] = [],
26
+ ) {
27
+ this._currentAtom = Atom.make<string[]>([]);
38
28
  if (initial.length > 0) {
39
29
  this.update(initial);
40
30
  }
41
31
  }
42
32
 
43
33
  /**
44
- * Currently attended element.
45
- *
46
- * @reactive
34
+ * Atom for the currently attended element path.
35
+ */
36
+ get current(): Atom.Atom<string[]> {
37
+ return this._currentAtom;
38
+ }
39
+
40
+ /**
41
+ * Gets the currently attended element path.
42
+ */
43
+ getCurrent(): readonly string[] {
44
+ return this._registry.get(this._currentAtom);
45
+ }
46
+
47
+ /**
48
+ * Subscribe to changes in the current attention path.
47
49
  */
48
- get current(): Live<readonly string[]> {
49
- return this._state.current;
50
+ subscribeCurrent(cb: (current: readonly string[]) => void): () => void {
51
+ this._registry.get(this._currentAtom);
52
+ return this._registry.subscribe(this._currentAtom, () => {
53
+ cb(this._registry.get(this._currentAtom));
54
+ });
50
55
  }
51
56
 
52
57
  /**
@@ -59,15 +64,31 @@ export class AttentionManager {
59
64
  /**
60
65
  * Get the attention state for a given path.
61
66
  */
62
- get(key: string[]): Live<Attention> {
63
- const object = this._map.get(key);
64
- if (object) {
65
- return object;
67
+ get(key: string[]): Attention {
68
+ const atom = this._getAtom(key);
69
+ return this._registry.get(atom);
70
+ }
71
+
72
+ /**
73
+ * Subscribe to changes in the attention state for a given path.
74
+ */
75
+ subscribe(key: string[], cb: (attention: Attention) => void): () => void {
76
+ const atom = this._getAtom(key);
77
+ this._registry.get(atom);
78
+ return this._registry.subscribe(atom, () => {
79
+ cb(this._registry.get(atom));
80
+ });
81
+ }
82
+
83
+ private _getAtom(key: string[]): Atom.Writable<Attention> {
84
+ const existing = this._map.get(key);
85
+ if (existing) {
86
+ return existing;
66
87
  }
67
88
 
68
- const newObject = live(AttentionSchema, { hasAttention: false, isAncestor: false, isRelated: false });
69
- this._map.set(key, newObject);
70
- return newObject;
89
+ const newAtom = Atom.make<Attention>({ hasAttention: false, isAncestor: false, isRelated: false });
90
+ this._map.set(key, newAtom);
91
+ return newAtom;
71
92
  }
72
93
 
73
94
  /**
@@ -76,12 +97,12 @@ export class AttentionManager {
76
97
  * @internal
77
98
  */
78
99
  update(nextKey: string[]): void {
79
- const currentKey = untracked(() => this.current);
100
+ const currentKey = this.getCurrent();
80
101
  const currentRelatedTo = currentKey[0];
81
102
  const nextRelatedTo = nextKey[0];
82
103
 
83
104
  // Ensure related attention object is initialized.
84
- this.get([nextRelatedTo]);
105
+ this._getAtom([nextRelatedTo]);
85
106
 
86
107
  const currentRelatedKeys = this.keys().filter((key) => key[0] === currentRelatedTo);
87
108
  const nextRelatedKeys = this.keys().filter(
@@ -97,7 +118,7 @@ export class AttentionManager {
97
118
  (curr) => !nextAncestorKeys.find((next) => stringKey(curr) === stringKey(next)),
98
119
  );
99
120
 
100
- this._state.current = nextKey;
121
+ this._registry.set(this._currentAtom, nextKey);
101
122
  prevRelatedKeys.forEach((key) => this._set(key, {}));
102
123
  prevAncestorKeys.forEach((key) => this._set(key, {}));
103
124
  nextRelatedKeys.forEach((key) => this._set(key, { isRelated: true }));
@@ -106,15 +127,17 @@ export class AttentionManager {
106
127
  }
107
128
 
108
129
  private _set(key: string[], attention: Partial<Attention>): void {
109
- const object = this.get(key);
110
- object.hasAttention = attention.hasAttention ?? false;
111
- object.isAncestor = attention.isAncestor ?? false;
112
- object.isRelated = attention.isRelated ?? false;
130
+ const atom = this._getAtom(key);
131
+ this._registry.set(atom, {
132
+ hasAttention: attention.hasAttention ?? false,
133
+ isAncestor: attention.isAncestor ?? false,
134
+ isRelated: attention.isRelated ?? false,
135
+ });
113
136
  }
114
137
  }
115
138
 
116
139
  /**
117
- * Accumulates all attendable id’s between the element provided and the root, inclusive.
140
+ * Accumulates all attendable id's between the element provided and the root, inclusive.
118
141
  */
119
142
  export const getAttendables = (selector: string, cursor: Element, acc: string[] = []): string[] => {
120
143
  // Find the closest element with `data-attendable-id`, if any; start from cursor and move up the DOM tree.
@@ -2,19 +2,18 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
7
6
  import React, { useCallback, useEffect, useState } from 'react';
8
7
 
9
8
  import { Button } from '@dxos/react-ui';
10
- import { withTheme } from '@dxos/storybook-utils';
9
+ import { withTheme } from '@dxos/react-ui/testing';
11
10
  import { range } from '@dxos/util';
12
11
 
13
12
  import { AttentionGlyph, type AttentionGlyphProps } from './AttentionGlyph';
14
13
 
15
- const Story = (props: AttentionGlyphProps) => {
14
+ const DefaultStory = (props: AttentionGlyphProps) => {
16
15
  return (
17
- <ul className='flex gap-2 mbe-2'>
16
+ <ul className='flex gap-2 mb-2'>
18
17
  <li>
19
18
  <AttentionGlyph presence='none' {...props} />
20
19
  </li>
@@ -28,26 +27,30 @@ const Story = (props: AttentionGlyphProps) => {
28
27
  );
29
28
  };
30
29
 
31
- export default {
30
+ const meta = {
32
31
  title: 'ui/react-ui-attention/AttentionGlyph',
33
- component: AttentionGlyph,
34
- render: Story,
35
- decorators: [withTheme],
36
- };
32
+ component: AttentionGlyph as any,
33
+ render: DefaultStory,
34
+ decorators: [withTheme()],
35
+ } satisfies Meta<typeof DefaultStory>;
36
+
37
+ export default meta;
38
+
39
+ type Story = StoryObj<typeof meta>;
37
40
 
38
- export const Default = {
41
+ export const Default: Story = {
39
42
  args: {},
40
43
  };
41
44
 
42
- export const Attention = {
45
+ export const Attention: Story = {
43
46
  args: { attended: true },
44
47
  };
45
48
 
46
- export const Contains = {
49
+ export const Contains: Story = {
47
50
  args: { containsAttended: true },
48
51
  };
49
52
 
50
- export const Syncing = {
53
+ export const Syncing: Story = {
51
54
  render: () => {
52
55
  const [spaces, setSpaces] = useState(
53
56
  new Map<string, boolean>(range(8).map((i) => [`space-${i + 1}`, Math.random() > 0.5])),
@@ -3,16 +3,23 @@
3
3
  //
4
4
 
5
5
  import { type Primitive } from '@radix-ui/react-primitive';
6
- import React, { type ComponentPropsWithRef, type CSSProperties, forwardRef, useMemo } from 'react';
6
+ import React, { type CSSProperties, type ComponentPropsWithRef, forwardRef, useMemo } from 'react';
7
7
 
8
8
  import { Icon, type ThemedClassName } from '@dxos/react-ui';
9
- import { mx } from '@dxos/react-ui-theme';
9
+ import { mx } from '@dxos/ui-theme';
10
10
 
11
- const attentionGlyphStyles =
12
- 'inline-block rounded-sm is-3 bs-3 bg-transparent text-accentText transition-colors [[data-contains-attended=true]_&]:bg-attentionRelated [[data-attention=true]_&]:bg-accentSurface [[data-attention=true]_&]:text-accentSurfaceText [[aria-current][data-attention=true]_&]:bg-accentSurface [[aria-current][data-attention=true]_&]:text-accentSurfaceText';
11
+ const attentionGlyphStyles = mx(
12
+ 'inline-block rounded-xs w-3 h-3 bg-transparent text-accent-text transition-colors',
13
+ '[[data-contains-attended=true]_&]:bg-attention-surface-surface',
14
+ '[[data-attention=true]_&]:bg-accent-surface',
15
+ '[[data-attention=true]_&]:text-accent-surface-text',
16
+ '[[aria-current][data-attention=true]_&]:bg-accent-surface',
17
+ '[[aria-current][data-attention=true]_&]:text-accent-surface-text',
18
+ '[[aria-selected="true"][data-attention=true]_&]:bg-accent-surface',
19
+ '[[aria-selected="true"][data-attention=true]_&]:text-accent-surface-text',
20
+ );
13
21
 
14
- const presenceIconStyles =
15
- 'is-3 bs-3 group-[[aria-current]_&:hover]/attentionGlyphButton:hidden group-[[aria-current]_&:focus]/attentionGlyphButton:hidden group-[[data-attention=true]_&:hover]/attentionGlyphButton:hidden group-[[data-attention=true]_&:focus]/attentionGlyphButton:hidden group-[[aria-current][data-attention=true]_&:hover]/attentionGlyphButton:hidden group-[[aria-current][data-attention=true]_&:focus]/attentionGlyphButton:hidden';
22
+ const presenceIconStyles = mx('w-3 h-3');
16
23
 
17
24
  const PresenceOne = () => {
18
25
  return (
@@ -87,7 +94,7 @@ export const AttentionGlyph = forwardRef<HTMLSpanElement, AttentionGlyphProps>(
87
94
  ) : null;
88
95
 
89
96
  return (
90
- <div role='none' className='flex' data-attention={attended} data-contains-attended={containsAttended}>
97
+ <div role='none' className='flex group' data-attention={attended} data-contains-attended={containsAttended}>
91
98
  <span role='none' {...props} className={mx(attentionGlyphStyles, classNames)} ref={forwardedRef}>
92
99
  {icon}
93
100
  </span>
@@ -2,21 +2,21 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
7
6
  import React from 'react';
8
7
 
9
- import { withTheme } from '@dxos/storybook-utils';
8
+ import { withTheme } from '@dxos/react-ui/testing';
10
9
 
11
- import { useAttentionAttributes } from './AttentionProvider';
12
10
  import { withAttention } from '../testing';
13
11
 
12
+ import { useAttentionAttributes } from './AttentionProvider';
13
+
14
14
  const Attendable = ({ id }: { id: string }) => {
15
15
  const attentionAttrs = useAttentionAttributes(id);
16
16
 
17
17
  return (
18
18
  <div {...attentionAttrs}>
19
- <textarea className='attention-surface resize-none' placeholder={id} />
19
+ <textarea className='dx-attention-surface resize-none' placeholder={id} />
20
20
  </div>
21
21
  );
22
22
  };
@@ -32,10 +32,14 @@ const Story = () => {
32
32
  );
33
33
  };
34
34
 
35
- export default {
35
+ const meta = {
36
36
  title: 'ui/react-ui-attention/AttentionProvider',
37
37
  render: Story,
38
- decorators: [withTheme, withAttention],
39
- };
38
+ decorators: [withTheme(), withAttention()],
39
+ } satisfies Meta;
40
+
41
+ export default meta;
42
+
43
+ type Story = StoryObj<typeof meta>;
40
44
 
41
- export const Default = {};
45
+ export const Default: Story = {};