@dxos/react-ui-attention 0.9.1-main.c7dcc2e112 → 0.10.0
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.
- package/dist/lib/browser/{chunk-KCQFVRZ6.mjs → chunk-I4FDY4AZ.mjs} +6 -1
- package/dist/lib/browser/{chunk-KCQFVRZ6.mjs.map → chunk-I4FDY4AZ.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +10 -7
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node-esm/{chunk-5JUZQDCR.mjs → chunk-DLBZMHST.mjs} +6 -1
- package/dist/lib/node-esm/{chunk-5JUZQDCR.mjs.map → chunk-DLBZMHST.mjs.map} +3 -3
- package/dist/lib/node-esm/index.mjs +10 -7
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +1 -1
- package/dist/types/src/components/AttentionGlyph/AttentionGlyph.d.ts.map +1 -1
- package/dist/types/src/components/AttentionProvider/AttentionProvider.d.ts +1 -1
- package/dist/types/src/components/AttentionProvider/AttentionProvider.d.ts.map +1 -1
- package/dist/types/src/components/ViewStateProvider/ViewStateProvider.d.ts +2 -0
- package/dist/types/src/components/ViewStateProvider/ViewStateProvider.d.ts.map +1 -1
- package/dist/types/src/useArticleKeyboardNavigation.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -21
- package/src/components/AttentionGlyph/AttentionGlyph.tsx +1 -1
- package/src/components/AttentionProvider/AttentionProvider.tsx +3 -3
- package/src/components/ViewStateProvider/ViewStateProvider.tsx +6 -0
- package/src/useArticleKeyboardNavigation.ts +5 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-attention",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
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",
|
|
@@ -46,33 +46,33 @@
|
|
|
46
46
|
"@radix-ui/react-primitive": "2.0.2",
|
|
47
47
|
"@radix-ui/react-slot": "1.1.2",
|
|
48
48
|
"@radix-ui/react-use-controllable-state": "1.1.0",
|
|
49
|
-
"effect": "3.21.
|
|
50
|
-
"@dxos/echo": "0.
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/log": "0.
|
|
53
|
-
"@dxos/keyboard": "0.
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
49
|
+
"effect": "3.21.4",
|
|
50
|
+
"@dxos/echo": "0.10.0",
|
|
51
|
+
"@dxos/invariant": "0.10.0",
|
|
52
|
+
"@dxos/log": "0.10.0",
|
|
53
|
+
"@dxos/keyboard": "0.10.0",
|
|
54
|
+
"@dxos/react-hooks": "0.10.0",
|
|
55
|
+
"@dxos/util": "0.10.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@testing-library/jest-dom": "^6.9.1",
|
|
59
|
-
"@testing-library/react": "^16.3.
|
|
60
|
-
"@types/react": "~19.2.
|
|
59
|
+
"@testing-library/react": "^16.3.2",
|
|
60
|
+
"@types/react": "~19.2.17",
|
|
61
61
|
"@types/react-dom": "~19.2.3",
|
|
62
|
-
"react": "~19.2.
|
|
63
|
-
"react-dom": "~19.2.
|
|
62
|
+
"react": "~19.2.7",
|
|
63
|
+
"react-dom": "~19.2.7",
|
|
64
64
|
"vite": "^8.0.16",
|
|
65
|
-
"@dxos/random": "0.
|
|
66
|
-
"@dxos/react-ui": "0.
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/
|
|
65
|
+
"@dxos/random": "0.10.0",
|
|
66
|
+
"@dxos/react-ui": "0.10.0",
|
|
67
|
+
"@dxos/ui-theme": "0.10.0",
|
|
68
|
+
"@dxos/storybook-utils": "0.10.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"effect": "3.21.
|
|
72
|
-
"react": "~19.2.
|
|
73
|
-
"react-dom": "~19.2.
|
|
74
|
-
"@dxos/ui
|
|
75
|
-
"@dxos/
|
|
71
|
+
"effect": "3.21.4",
|
|
72
|
+
"react": "~19.2.7",
|
|
73
|
+
"react-dom": "~19.2.7",
|
|
74
|
+
"@dxos/react-ui": "0.10.0",
|
|
75
|
+
"@dxos/ui-theme": "0.10.0"
|
|
76
76
|
},
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"access": "public"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Primitive } from '@radix-ui/react-primitive';
|
|
6
|
-
import React, { type
|
|
6
|
+
import React, { type ComponentPropsWithRef, type CSSProperties, forwardRef, useMemo } from 'react';
|
|
7
7
|
|
|
8
8
|
import { Icon, type ThemedClassName } from '@dxos/react-ui';
|
|
9
9
|
import { mx } from '@dxos/ui-theme';
|
|
@@ -167,10 +167,10 @@ const AttendableContainer = forwardRef<HTMLDivElement, AttendableContainerProps>
|
|
|
167
167
|
);
|
|
168
168
|
|
|
169
169
|
export {
|
|
170
|
-
RootAttentionProvider,
|
|
171
170
|
AttendableContainer,
|
|
172
|
-
|
|
173
|
-
useAttention,
|
|
171
|
+
RootAttentionProvider,
|
|
174
172
|
useAttended,
|
|
173
|
+
useAttention,
|
|
175
174
|
useAttentionAttributes,
|
|
175
|
+
useAttentionContext,
|
|
176
176
|
};
|
|
@@ -48,6 +48,12 @@ export const useViewStateManager = (): ViewStateManager => {
|
|
|
48
48
|
return manager;
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
+
/** Access the ViewStateManager if a provider is present; `undefined` otherwise (e.g. isolated stories/tests). */
|
|
52
|
+
export const useViewStateManagerOptional = (): ViewStateManager | undefined => {
|
|
53
|
+
const { manager } = useViewStateContext(VIEW_STATE_NAME);
|
|
54
|
+
return manager;
|
|
55
|
+
};
|
|
56
|
+
|
|
51
57
|
/** Reactive read of an aspect value for a context; yields the aspect default when unset or unprovided. */
|
|
52
58
|
export const useViewState = <T,>(aspect: AspectDef<T>, contextId?: string): T => {
|
|
53
59
|
const { manager } = useViewStateContext(VIEW_STATE_NAME);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Keyboard } from '@dxos/keyboard';
|
|
7
|
+
import { Keyboard, nestKeyboardContext } from '@dxos/keyboard';
|
|
8
8
|
|
|
9
9
|
import { useAttention } from './components';
|
|
10
10
|
|
|
@@ -74,9 +74,10 @@ export const useArticleKeyboardNavigation: {
|
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
const
|
|
77
|
+
const contextPath = nestKeyboardContext(articleId);
|
|
78
|
+
const context = Keyboard.singleton.getContext(contextPath);
|
|
78
79
|
const prevContext = Keyboard.singleton.getCurrentContext();
|
|
79
|
-
Keyboard.singleton.setCurrentContext(
|
|
80
|
+
Keyboard.singleton.setCurrentContext(contextPath);
|
|
80
81
|
|
|
81
82
|
const nextBinding = {
|
|
82
83
|
shortcut: 'j',
|
|
@@ -108,7 +109,7 @@ export const useArticleKeyboardNavigation: {
|
|
|
108
109
|
context.unbind('j');
|
|
109
110
|
context.unbind('k');
|
|
110
111
|
// Restore the prior context if we were the ones who set it.
|
|
111
|
-
if (Keyboard.singleton.getCurrentContext() ===
|
|
112
|
+
if (Keyboard.singleton.getCurrentContext() === contextPath) {
|
|
112
113
|
Keyboard.singleton.setCurrentContext(prevContext);
|
|
113
114
|
}
|
|
114
115
|
};
|