@dxos/react-ui-attention 0.8.4-main.ead640a → 0.8.4-main.f466a3d56e
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/LICENSE +102 -5
- package/dist/lib/browser/chunk-D2BLVJ6Z.mjs +421 -0
- package/dist/lib/browser/chunk-D2BLVJ6Z.mjs.map +7 -0
- package/dist/lib/browser/chunk-I4VO2RQM.mjs +255 -0
- package/dist/lib/browser/chunk-I4VO2RQM.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +89 -23
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +22 -5
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/types/index.mjs +29 -0
- package/dist/lib/browser/types/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-6INLBC62.mjs +423 -0
- package/dist/lib/node-esm/chunk-6INLBC62.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ZTUVSH4P.mjs +256 -0
- package/dist/lib/node-esm/chunk-ZTUVSH4P.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +89 -23
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +22 -5
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/types/index.mjs +30 -0
- package/dist/lib/node-esm/types/index.mjs.map +7 -0
- package/dist/types/src/attention.d.ts +60 -20
- package/dist/types/src/attention.d.ts.map +1 -1
- package/dist/types/src/components/AttentionGlyph/AttentionGlyph.d.ts.map +1 -0
- package/dist/types/src/components/AttentionGlyph/AttentionGlyph.stories.d.ts.map +1 -0
- package/dist/types/src/components/AttentionGlyph/index.d.ts +2 -0
- package/dist/types/src/components/AttentionGlyph/index.d.ts.map +1 -0
- package/dist/types/src/components/AttentionProvider/AttentionProvider.d.ts +34 -0
- package/dist/types/src/components/AttentionProvider/AttentionProvider.d.ts.map +1 -0
- package/dist/types/src/components/AttentionProvider/AttentionProvider.stories.d.ts.map +1 -0
- package/dist/types/src/components/AttentionProvider/index.d.ts +2 -0
- package/dist/types/src/components/AttentionProvider/index.d.ts.map +1 -0
- package/dist/types/src/components/{SelectionProvider.d.ts → SelectionProvider/SelectionProvider.d.ts} +7 -6
- package/dist/types/src/components/SelectionProvider/SelectionProvider.d.ts.map +1 -0
- package/dist/types/src/components/SelectionProvider/index.d.ts +2 -0
- package/dist/types/src/components/SelectionProvider/index.d.ts.map +1 -0
- package/dist/types/src/selection.d.ts +23 -3
- package/dist/types/src/selection.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withAttention.d.ts +5 -1
- package/dist/types/src/testing/decorators/withAttention.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +3 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +34 -32
- package/src/attention.test.ts +188 -27
- package/src/attention.ts +179 -75
- package/src/components/{AttentionGlyph.stories.tsx → AttentionGlyph/AttentionGlyph.stories.tsx} +2 -2
- package/src/components/{AttentionGlyph.tsx → AttentionGlyph/AttentionGlyph.tsx} +13 -6
- package/src/components/AttentionGlyph/index.ts +5 -0
- package/src/components/{AttentionProvider.stories.tsx → AttentionProvider/AttentionProvider.stories.tsx} +3 -4
- package/src/components/AttentionProvider/AttentionProvider.tsx +176 -0
- package/src/components/AttentionProvider/index.ts +5 -0
- package/src/components/SelectionProvider/SelectionProvider.tsx +174 -0
- package/src/components/SelectionProvider/index.ts +5 -0
- package/src/selection.ts +121 -79
- package/src/testing/decorators/withAttention.ts +22 -4
- package/src/types/index.ts +9 -0
- package/dist/lib/browser/chunk-HELLA3BH.mjs +0 -675
- package/dist/lib/browser/chunk-HELLA3BH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FBZV7QG7.mjs +0 -677
- package/dist/lib/node-esm/chunk-FBZV7QG7.mjs.map +0 -7
- package/dist/types/src/components/AttentionGlyph.d.ts.map +0 -1
- package/dist/types/src/components/AttentionGlyph.stories.d.ts.map +0 -1
- package/dist/types/src/components/AttentionProvider.d.ts +0 -38
- package/dist/types/src/components/AttentionProvider.d.ts.map +0 -1
- package/dist/types/src/components/AttentionProvider.stories.d.ts.map +0 -1
- package/dist/types/src/components/SelectionProvider.d.ts.map +0 -1
- package/src/components/AttentionProvider.tsx +0 -201
- package/src/components/SelectionProvider.tsx +0 -120
- /package/dist/types/src/components/{AttentionGlyph.d.ts → AttentionGlyph/AttentionGlyph.d.ts} +0 -0
- /package/dist/types/src/components/{AttentionGlyph.stories.d.ts → AttentionGlyph/AttentionGlyph.stories.d.ts} +0 -0
- /package/dist/types/src/components/{AttentionProvider.stories.d.ts → AttentionProvider/AttentionProvider.stories.d.ts} +0 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
AttentionManager,
|
|
4
|
+
SelectionManager,
|
|
5
|
+
defaultSelection,
|
|
6
|
+
getAttendables
|
|
7
|
+
} from "./chunk-6INLBC62.mjs";
|
|
8
|
+
|
|
9
|
+
// src/components/AttentionProvider/AttentionProvider.tsx
|
|
10
|
+
import { RegistryContext } from "@effect-atom/atom-react";
|
|
11
|
+
import { createContext } from "@radix-ui/react-context";
|
|
12
|
+
import { Primitive } from "@radix-ui/react-primitive";
|
|
13
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
14
|
+
import React, { forwardRef, useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
15
|
+
import { log } from "@dxos/log";
|
|
16
|
+
import { useDefaultValue } from "@dxos/react-hooks";
|
|
17
|
+
import { mx } from "@dxos/ui-theme";
|
|
18
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-attention/src/components/AttentionProvider/AttentionProvider.tsx";
|
|
19
|
+
var ATTENTION_NAME = "Attention";
|
|
20
|
+
var ATTENDABLE_ATTRIBUTE = "data-attendable-id";
|
|
21
|
+
var ATTENTION_SOURCE_ATTRIBUTE = "data-w-attention-source";
|
|
22
|
+
var [AttentionContextProvider, useAttentionContext] = createContext(ATTENTION_NAME, {
|
|
23
|
+
attention: void 0
|
|
24
|
+
});
|
|
25
|
+
var UNKNOWN_ATTENDABLE = {
|
|
26
|
+
hasAttention: false,
|
|
27
|
+
isAncestor: false,
|
|
28
|
+
isRelated: false
|
|
29
|
+
};
|
|
30
|
+
var useAttention = (attendableId) => {
|
|
31
|
+
const { attention } = useAttentionContext(ATTENTION_NAME);
|
|
32
|
+
const [state, setState] = useState(UNKNOWN_ATTENDABLE);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!attendableId || !attention) {
|
|
35
|
+
setState(UNKNOWN_ATTENDABLE);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const currentState = attention.get(attendableId);
|
|
39
|
+
setState(currentState);
|
|
40
|
+
return attention.subscribe(attendableId, (newState) => {
|
|
41
|
+
setState(newState);
|
|
42
|
+
});
|
|
43
|
+
}, [
|
|
44
|
+
attention,
|
|
45
|
+
attendableId
|
|
46
|
+
]);
|
|
47
|
+
return state;
|
|
48
|
+
};
|
|
49
|
+
var useAttended = () => {
|
|
50
|
+
const { attention } = useAttentionContext(ATTENTION_NAME);
|
|
51
|
+
const [current, setCurrent] = useState([]);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (!attention) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
setCurrent(attention.getCurrent());
|
|
57
|
+
return attention.subscribeCurrent((newCurrent) => {
|
|
58
|
+
setCurrent(newCurrent);
|
|
59
|
+
});
|
|
60
|
+
}, [
|
|
61
|
+
attention
|
|
62
|
+
]);
|
|
63
|
+
return current;
|
|
64
|
+
};
|
|
65
|
+
var useAttentionAttributes = (attendableId) => {
|
|
66
|
+
const { hasAttention } = useAttention(attendableId);
|
|
67
|
+
return useMemo(() => {
|
|
68
|
+
const attributes = {
|
|
69
|
+
[ATTENDABLE_ATTRIBUTE]: attendableId
|
|
70
|
+
};
|
|
71
|
+
if (hasAttention) {
|
|
72
|
+
attributes[ATTENTION_SOURCE_ATTRIBUTE] = "true";
|
|
73
|
+
}
|
|
74
|
+
return attributes;
|
|
75
|
+
}, [
|
|
76
|
+
attendableId,
|
|
77
|
+
hasAttention
|
|
78
|
+
]);
|
|
79
|
+
};
|
|
80
|
+
var RootAttentionProvider = ({ children, attention: propsAttention, onChange }) => {
|
|
81
|
+
const registry = useContext(RegistryContext);
|
|
82
|
+
const attention = useDefaultValue(propsAttention, () => new AttentionManager(registry));
|
|
83
|
+
const handleFocus = useCallback((event) => {
|
|
84
|
+
log("focus", {
|
|
85
|
+
related: event.relatedTarget,
|
|
86
|
+
target: event.target
|
|
87
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 84, S: void 0 });
|
|
88
|
+
const selector = [
|
|
89
|
+
"[data-attendable-id]",
|
|
90
|
+
...Array.from(document.querySelectorAll("[aria-controls]")).map((el) => `[id="${el.getAttribute("aria-controls")}"]`)
|
|
91
|
+
].join(",");
|
|
92
|
+
const prev = attention.getCurrent();
|
|
93
|
+
const next = getAttendables(selector, event.target);
|
|
94
|
+
if (next.length > 0 && (prev.length !== next.length || !!prev.find((id, index) => next[index] !== id))) {
|
|
95
|
+
attention.update(next);
|
|
96
|
+
onChange?.(next);
|
|
97
|
+
}
|
|
98
|
+
}, [
|
|
99
|
+
attention,
|
|
100
|
+
onChange
|
|
101
|
+
]);
|
|
102
|
+
return /* @__PURE__ */ React.createElement(AttentionContextProvider, {
|
|
103
|
+
attention
|
|
104
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
105
|
+
className: "contents",
|
|
106
|
+
onFocusCapture: handleFocus
|
|
107
|
+
}, children));
|
|
108
|
+
};
|
|
109
|
+
var AttendableContainer = /* @__PURE__ */ forwardRef(({ id, classNames, children, asChild, ...props }, forwardedRef) => {
|
|
110
|
+
const attentionAttrs = useAttentionAttributes(id);
|
|
111
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
112
|
+
return /* @__PURE__ */ React.createElement(Comp, {
|
|
113
|
+
role: "none",
|
|
114
|
+
...props,
|
|
115
|
+
...attentionAttrs,
|
|
116
|
+
className: mx("dx-attention-surface", props.tabIndex === 0 && "dx-focus-ring-inset-over-all", classNames),
|
|
117
|
+
ref: forwardedRef
|
|
118
|
+
}, children);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// src/components/SelectionProvider/SelectionProvider.tsx
|
|
122
|
+
import { RegistryContext as RegistryContext2 } from "@effect-atom/atom-react";
|
|
123
|
+
import { createContext as createContext2 } from "@radix-ui/react-context";
|
|
124
|
+
import * as Match from "effect/Match";
|
|
125
|
+
import React2, { useCallback as useCallback2, useContext as useContext2, useEffect as useEffect2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
126
|
+
import { useDefaultValue as useDefaultValue2 } from "@dxos/react-hooks";
|
|
127
|
+
var SELECTION_NAME = "Selection";
|
|
128
|
+
var [SelectionContextProvider, useSelectionContext] = createContext2(SELECTION_NAME, {
|
|
129
|
+
selection: void 0
|
|
130
|
+
});
|
|
131
|
+
var SelectionProvider = ({ children, selection: selectionProp }) => {
|
|
132
|
+
const registry = useContext2(RegistryContext2);
|
|
133
|
+
const selection = useDefaultValue2(selectionProp, () => new SelectionManager(registry));
|
|
134
|
+
return /* @__PURE__ */ React2.createElement(SelectionContextProvider, {
|
|
135
|
+
selection
|
|
136
|
+
}, children);
|
|
137
|
+
};
|
|
138
|
+
var useSelectionManager = () => {
|
|
139
|
+
const { selection } = useSelectionContext(SELECTION_NAME);
|
|
140
|
+
return selection;
|
|
141
|
+
};
|
|
142
|
+
var getDefaultResult = (mode) => {
|
|
143
|
+
return Match.type().pipe(Match.when({
|
|
144
|
+
mode: "single"
|
|
145
|
+
}, (selection) => selection.id), Match.when({
|
|
146
|
+
mode: "multi"
|
|
147
|
+
}, (selection) => selection.ids), Match.when({
|
|
148
|
+
mode: "range"
|
|
149
|
+
}, (selection) => selection.from && selection.to ? {
|
|
150
|
+
from: selection.from,
|
|
151
|
+
to: selection.to
|
|
152
|
+
} : void 0), Match.when({
|
|
153
|
+
mode: "multi-range"
|
|
154
|
+
}, (selection) => selection.ranges), Match.exhaustive)(defaultSelection(mode));
|
|
155
|
+
};
|
|
156
|
+
var useSelected = (contextId, mode = "multi") => {
|
|
157
|
+
const { selection } = useSelectionContext(SELECTION_NAME);
|
|
158
|
+
const [state, setState] = useState2(() => contextId && selection ? selection.getSelected(contextId, mode) : getDefaultResult(mode));
|
|
159
|
+
useEffect2(() => {
|
|
160
|
+
if (!contextId || !selection) {
|
|
161
|
+
setState(getDefaultResult(mode));
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
setState(selection.getSelected(contextId, mode));
|
|
165
|
+
return selection.subscribe(() => {
|
|
166
|
+
setState(selection.getSelected(contextId, mode));
|
|
167
|
+
});
|
|
168
|
+
}, [
|
|
169
|
+
selection,
|
|
170
|
+
contextId,
|
|
171
|
+
mode
|
|
172
|
+
]);
|
|
173
|
+
return state;
|
|
174
|
+
};
|
|
175
|
+
var useSelectionActions = (contextIds) => {
|
|
176
|
+
const stableContextIds = useMemo2(() => contextIds, [
|
|
177
|
+
JSON.stringify(contextIds)
|
|
178
|
+
]);
|
|
179
|
+
const { selection } = useSelectionContext(SELECTION_NAME);
|
|
180
|
+
const singleSelect = useCallback2((id) => {
|
|
181
|
+
if (!selection) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
for (const contextId of stableContextIds) {
|
|
185
|
+
selection.updateSingle(contextId, id);
|
|
186
|
+
}
|
|
187
|
+
}, [
|
|
188
|
+
selection,
|
|
189
|
+
stableContextIds
|
|
190
|
+
]);
|
|
191
|
+
const multiSelect = useCallback2((ids) => {
|
|
192
|
+
if (!selection) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
for (const contextId of stableContextIds) {
|
|
196
|
+
selection.updateMulti(contextId, ids);
|
|
197
|
+
}
|
|
198
|
+
}, [
|
|
199
|
+
selection,
|
|
200
|
+
stableContextIds
|
|
201
|
+
]);
|
|
202
|
+
const rangeSelect = useCallback2((from, to) => {
|
|
203
|
+
if (!selection) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
for (const contextId of stableContextIds) {
|
|
207
|
+
selection.updateRange(contextId, from, to);
|
|
208
|
+
}
|
|
209
|
+
}, [
|
|
210
|
+
selection,
|
|
211
|
+
stableContextIds
|
|
212
|
+
]);
|
|
213
|
+
const toggle = useCallback2((id) => {
|
|
214
|
+
if (!selection) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
for (const contextId of stableContextIds) {
|
|
218
|
+
selection.toggleSelection(contextId, id);
|
|
219
|
+
}
|
|
220
|
+
}, [
|
|
221
|
+
selection,
|
|
222
|
+
stableContextIds
|
|
223
|
+
]);
|
|
224
|
+
const clear = useCallback2(() => {
|
|
225
|
+
if (!selection) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
for (const contextId of stableContextIds) {
|
|
229
|
+
selection.clearSelection(contextId);
|
|
230
|
+
}
|
|
231
|
+
}, [
|
|
232
|
+
selection,
|
|
233
|
+
stableContextIds
|
|
234
|
+
]);
|
|
235
|
+
return {
|
|
236
|
+
singleSelect,
|
|
237
|
+
multiSelect,
|
|
238
|
+
rangeSelect,
|
|
239
|
+
toggle,
|
|
240
|
+
clear
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export {
|
|
245
|
+
useAttentionContext,
|
|
246
|
+
useAttention,
|
|
247
|
+
useAttended,
|
|
248
|
+
useAttentionAttributes,
|
|
249
|
+
RootAttentionProvider,
|
|
250
|
+
AttendableContainer,
|
|
251
|
+
SelectionProvider,
|
|
252
|
+
useSelectionManager,
|
|
253
|
+
useSelected,
|
|
254
|
+
useSelectionActions
|
|
255
|
+
};
|
|
256
|
+
//# sourceMappingURL=chunk-ZTUVSH4P.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/AttentionProvider/AttentionProvider.tsx", "../../../src/components/SelectionProvider/SelectionProvider.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { RegistryContext } from '@effect-atom/atom-react';\nimport { createContext } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Slot } from '@radix-ui/react-slot';\nimport React, {\n type ComponentPropsWithRef,\n type FocusEvent,\n type PropsWithChildren,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react';\n\nimport { log } from '@dxos/log';\nimport { useDefaultValue } from '@dxos/react-hooks';\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\n\nimport { type Attention, AttentionManager, getAttendables } from '../../attention';\n\nconst ATTENTION_NAME = 'Attention';\nconst ATTENDABLE_ATTRIBUTE = 'data-attendable-id';\nconst ATTENTION_SOURCE_ATTRIBUTE = 'data-w-attention-source';\n\ntype AttentionContextValue = {\n attention: AttentionManager;\n};\n\nconst [AttentionContextProvider, useAttentionContext] = createContext<AttentionContextValue>(ATTENTION_NAME, {\n attention: undefined as unknown as AttentionManager,\n});\n\nconst UNKNOWN_ATTENDABLE = { hasAttention: false, isAncestor: false, isRelated: false } as Attention;\n\n/**\n * Subscribe to the attention state for a qualified graph ID.\n */\n// TODO(burdon): Unify with seleciton and change to contextId?\nconst useAttention = (attendableId?: string): Attention => {\n const { attention } = useAttentionContext(ATTENTION_NAME);\n const [state, setState] = useState<Attention>(UNKNOWN_ATTENDABLE);\n useEffect(() => {\n if (!attendableId || !attention) {\n setState(UNKNOWN_ATTENDABLE);\n return;\n }\n\n const currentState = attention.get(attendableId);\n setState(currentState);\n\n return attention.subscribe(attendableId, (newState) => {\n setState(newState);\n });\n }, [attention, attendableId]);\n\n return state;\n};\n\nconst useAttended = () => {\n const { attention } = useAttentionContext(ATTENTION_NAME);\n const [current, setCurrent] = useState<readonly string[]>([]);\n useEffect(() => {\n if (!attention) {\n return;\n }\n\n setCurrent(attention.getCurrent());\n\n return attention.subscribeCurrent((newCurrent) => {\n setCurrent(newCurrent);\n });\n }, [attention]);\n\n return current;\n};\n\n/**\n * Computes HTML element attributes to apply so the attention system can detect changes.\n */\nconst useAttentionAttributes = (attendableId?: string) => {\n const { hasAttention } = useAttention(attendableId);\n return useMemo(() => {\n const attributes: Record<string, string | undefined> = { [ATTENDABLE_ATTRIBUTE]: attendableId };\n if (hasAttention) {\n attributes[ATTENTION_SOURCE_ATTRIBUTE] = 'true';\n }\n\n return attributes;\n }, [attendableId, hasAttention]);\n};\n\ntype RootAttentionProviderProps = PropsWithChildren<{\n attention?: AttentionManager;\n onChange?: (nextAttended: string[]) => void;\n}>;\n\nconst RootAttentionProvider = ({ children, attention: propsAttention, onChange }: RootAttentionProviderProps) => {\n const registry = useContext(RegistryContext);\n const attention = useDefaultValue(propsAttention, () => new AttentionManager(registry));\n\n const handleFocus = useCallback(\n (event: FocusEvent) => {\n // NOTE(thure): Use the following to debug focus movement across the app:\n log('focus', { related: event.relatedTarget, target: event.target });\n\n const selector = [\n '[data-attendable-id]',\n ...Array.from(document.querySelectorAll('[aria-controls]')).map(\n (el) => `[id=\"${el.getAttribute('aria-controls')}\"]`,\n ),\n ].join(',');\n const prev = attention.getCurrent();\n const next = getAttendables(selector, event.target);\n // TODO(wittjosiah): Not allowing empty state means that the attended item is not strictly guaranteed to be in the DOM.\n // Currently this depends on the deck in order to ensure that when the attended item is removed something else is attended.\n // Only update state if the result is different and not empty.\n if (next.length > 0 && (prev.length !== next.length || !!prev.find((id, index) => next[index] !== id))) {\n attention.update(next);\n onChange?.(next);\n }\n },\n [attention, onChange],\n );\n\n return (\n <AttentionContextProvider attention={attention}>\n <div className='contents' onFocusCapture={handleFocus}>\n {children}\n </div>\n </AttentionContextProvider>\n );\n};\n\nexport type AttendableContainerProps = ThemedClassName<\n ComponentPropsWithRef<'div'> & { id: string; asChild?: boolean }\n>;\n\n/**\n * Note that DeckPlugin and StackPlugin both handle attention on their own,\n * and when rendering content in those cases it is not necessary to also render an `AttendableContainer`.\n * This component is primarily for Storybook stories and other testing scenarios,\n * or the rare cases where an attendable entity is rendered outside of either of those plugins.\n */\nconst AttendableContainer = forwardRef<HTMLDivElement, AttendableContainerProps>(\n ({ id, classNames, children, asChild, ...props }, forwardedRef) => {\n const attentionAttrs = useAttentionAttributes(id);\n const Comp = asChild ? Slot : Primitive.div;\n return (\n <Comp\n role='none'\n {...props}\n {...attentionAttrs}\n className={mx('dx-attention-surface', props.tabIndex === 0 && 'dx-focus-ring-inset-over-all', classNames)}\n ref={forwardedRef}\n >\n {children}\n </Comp>\n );\n },\n);\n\nexport {\n RootAttentionProvider,\n AttendableContainer,\n useAttentionContext,\n useAttention,\n useAttended,\n useAttentionAttributes,\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { RegistryContext } from '@effect-atom/atom-react';\nimport { createContext } from '@radix-ui/react-context';\nimport * as Match from 'effect/Match';\nimport React, { type PropsWithChildren, useCallback, useContext, useEffect, useMemo, useState } from 'react';\n\nimport { useDefaultValue } from '@dxos/react-hooks';\n\nimport {\n type Selection,\n SelectionManager,\n type SelectionMode,\n type SelectionResult,\n defaultSelection,\n} from '../../selection';\n\nconst SELECTION_NAME = 'Selection';\n\ntype SelectionContextValue = {\n selection: SelectionManager;\n};\n\n// Default value lets consumers like `useSelected` render outside a\n// `SelectionProvider` (e.g. isolated stories) without throwing —\n// `selection` reads as `undefined` and the hook falls back to the\n// per-mode default result. Without this default, Radix `createContext`\n// throws \"Selection must be used within Selection\" on every consumer.\nconst [SelectionContextProvider, useSelectionContext] = createContext<SelectionContextValue>(SELECTION_NAME, {\n selection: undefined as unknown as SelectionManager,\n});\n\n/**\n * Manages selection state across the app for multiple contexts.\n */\nexport const SelectionProvider = ({\n children,\n selection: selectionProp,\n}: PropsWithChildren<{ selection?: SelectionManager }>) => {\n const registry = useContext(RegistryContext);\n const selection = useDefaultValue(selectionProp, () => new SelectionManager(registry));\n\n return <SelectionContextProvider selection={selection}>{children}</SelectionContextProvider>;\n};\n\n/**\n * Get the selection contexts.\n */\nexport const useSelectionManager = (): SelectionManager => {\n const { selection } = useSelectionContext(SELECTION_NAME);\n return selection;\n};\n\nconst getDefaultResult = <T extends SelectionMode>(mode: T): SelectionResult<T> => {\n return Match.type<Selection>().pipe(\n Match.when({ mode: 'single' }, (selection) => selection.id),\n Match.when({ mode: 'multi' }, (selection) => selection.ids),\n Match.when({ mode: 'range' }, (selection) =>\n selection.from && selection.to ? { from: selection.from, to: selection.to } : undefined,\n ),\n Match.when({ mode: 'multi-range' }, (selection) => selection.ranges),\n Match.exhaustive,\n )(defaultSelection(mode)) as SelectionResult<T>;\n};\n\n/**\n * Get the selected objects for a given context.\n */\nexport const useSelected = <T extends SelectionMode>(\n contextId?: string,\n mode: T = 'multi' as T,\n): SelectionResult<T> => {\n const { selection } = useSelectionContext(SELECTION_NAME);\n const [state, setState] = useState<SelectionResult<T>>(() =>\n contextId && selection ? selection.getSelected(contextId, mode) : getDefaultResult(mode),\n );\n\n useEffect(() => {\n if (!contextId || !selection) {\n setState(getDefaultResult(mode));\n return;\n }\n\n // Set initial state.\n setState(selection.getSelected(contextId, mode));\n\n // Subscribe to changes.\n return selection.subscribe(() => {\n setState(selection.getSelected(contextId, mode));\n });\n }, [selection, contextId, mode]);\n\n return state;\n};\n\nexport type UseSelectionActions = {\n singleSelect: (id: string) => void;\n multiSelect: (ids: string[]) => void;\n rangeSelect: (from: string, to: string) => void;\n toggle: (id: string) => void;\n clear: () => void;\n};\n\n/**\n * Provides functions to manage the selection state for multiple contexts.\n */\nexport const useSelectionActions = (contextIds: string[]): UseSelectionActions => {\n const stableContextIds = useMemo(() => contextIds, [JSON.stringify(contextIds)]);\n const { selection } = useSelectionContext(SELECTION_NAME);\n\n // No-op when rendered outside a `SelectionProvider` (e.g. an isolated\n // story or a test harness) — `selection` is `undefined` from the\n // context default value. Matches the pre-co-locate behaviour.\n const singleSelect = useCallback(\n (id: string) => {\n if (!selection) {\n return;\n }\n for (const contextId of stableContextIds) {\n selection.updateSingle(contextId, id);\n }\n },\n [selection, stableContextIds],\n );\n\n const multiSelect = useCallback(\n (ids: string[]) => {\n if (!selection) {\n return;\n }\n for (const contextId of stableContextIds) {\n selection.updateMulti(contextId, ids);\n }\n },\n [selection, stableContextIds],\n );\n\n const rangeSelect = useCallback(\n (from: string, to: string) => {\n if (!selection) {\n return;\n }\n for (const contextId of stableContextIds) {\n selection.updateRange(contextId, from, to);\n }\n },\n [selection, stableContextIds],\n );\n\n const toggle = useCallback(\n (id: string) => {\n if (!selection) {\n return;\n }\n for (const contextId of stableContextIds) {\n selection.toggleSelection(contextId, id);\n }\n },\n [selection, stableContextIds],\n );\n\n const clear = useCallback(() => {\n if (!selection) {\n return;\n }\n for (const contextId of stableContextIds) {\n selection.clearSelection(contextId);\n }\n }, [selection, stableContextIds]);\n\n return { singleSelect, multiSelect, rangeSelect, toggle, clear };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAIA,SAASA,uBAAuB;AAChC,SAASC,qBAAqB;AAC9B,SAASC,iBAAiB;AAC1B,SAASC,YAAY;AACrB,OAAOC,SAILC,YACAC,aACAC,YACAC,WACAC,SACAC,gBACK;AAEP,SAASC,WAAW;AACpB,SAASC,uBAAuB;AAEhC,SAASC,UAAU;AAInB,IAAA,eAAMC;AAEN,IAAMC,iBAAAA;AAMN,IAAM,uBAACC;IACLC,6BAAWC;AACb,IAAA,CAAA,0BAAA,mBAAA,IAAA,cAAA,gBAAA;EAEA,WAAMC;;IAA4CC,qBAAY;EAAOC,cAAW;EAAM,YAAA;EAEtF,WAAA;;IAME,eAAcC,CAAAA,iBAAYC;AAC1BC,QAAAA,EAAAA,UAAU,IAAA,oBAAA,cAAA;QACR,CAAA,OAAKC,Q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sB,CAACC,eAAAA;AAClC,QAAMC,mBAAmBC,SAAQ,MAAMF,YAAY;IAACG,KAAKC,UAAUJ,UAAAA;GAAY;AAC/E,QAAM,EAAEjC,UAAS,IAAKF,oBAAoBF,cAAAA;AAK1C,QAAM0C,eAAeC,aACnB,CAACtB,OAAAA;AACC,QAAI,CAACjB,WAAW;AACd;IACF;AACA,eAAWyB,aAAaS,kBAAkB;AACxClC,gBAAUwC,aAAaf,WAAWR,EAAAA;IACpC;EACF,GACA;IAACjB;IAAWkC;GAAiB;AAG/B,QAAMO,cAAcF,aAClB,CAACrB,QAAAA;AACC,QAAI,CAAClB,WAAW;AACd;IACF;AACA,eAAWyB,aAAaS,kBAAkB;AACxClC,gBAAU0C,YAAYjB,WAAWP,GAAAA;IACnC;EACF,GACA;IAAClB;IAAWkC;GAAiB;AAG/B,QAAMS,cAAcJ,aAClB,CAACpB,MAAcC,OAAAA;AACb,QAAI,CAACpB,WAAW;AACd;IACF;AACA,eAAWyB,aAAaS,kBAAkB;AACxClC,gBAAU4C,YAAYnB,WAAWN,MAAMC,EAAAA;IACzC;EACF,GACA;IAACpB;IAAWkC;GAAiB;AAG/B,QAAMW,SAASN,aACb,CAACtB,OAAAA;AACC,QAAI,CAACjB,WAAW;AACd;IACF;AACA,eAAWyB,aAAaS,kBAAkB;AACxClC,gBAAU8C,gBAAgBrB,WAAWR,EAAAA;IACvC;EACF,GACA;IAACjB;IAAWkC;GAAiB;AAG/B,QAAMa,QAAQR,aAAY,MAAA;AACxB,QAAI,CAACvC,WAAW;AACd;IACF;AACA,eAAWyB,aAAaS,kBAAkB;AACxClC,gBAAUgD,eAAevB,SAAAA;IAC3B;EACF,GAAG;IAACzB;IAAWkC;GAAiB;AAEhC,SAAO;IAAEI;IAAcG;IAAaE;IAAaE;IAAQE;EAAM;AACjE;",
|
|
6
|
+
"names": ["RegistryContext", "createContext", "Primitive", "Slot", "React", "forwardRef", "useCallback", "useContext", "useEffect", "useMemo", "useState", "log", "useDefaultValue", "mx", "ATTENTION_NAME", "ATTENTION_SOURCE_ATTRIBUTE", "AttentionContextProvider", "attention", "undefined", "UNKNOWN_ATTENDABLE", "isAncestor", "isRelated", "setState", "useState", "useEffect", "attendableId", "subscribe", "newState", "useAttended", "setCurrent", "newCurrent", "attributes", "ATTENDABLE_ATTRIBUTE", "hasAttention", "useDefaultValue", "propsAttention", "AttentionManager", "registry", "handleFocus", "useCallback", "event", "log", "target", "selector", "join", "prev", "getCurrent", "next", "onChange", "div", "className", "onFocusCapture", "children", "Comp", "role", "attentionAttrs", "ref", "RootAttentionProvider", "RegistryContext", "createContext", "Match", "React", "useCallback", "useContext", "useEffect", "useMemo", "useState", "useDefaultValue", "SELECTION_NAME", "SelectionContextProvider", "useSelectionContext", "createContext", "selection", "undefined", "SelectionProvider", "children", "selectionProp", "registry", "useContext", "RegistryContext", "useDefaultValue", "SelectionManager", "React", "useSelectionManager", "getDefaultResult", "mode", "type", "pipe", "when", "id", "ids", "from", "to", "ranges", "exhaustive", "defaultSelection", "useSelected", "contextId", "state", "setState", "useState", "getSelected", "useEffect", "subscribe", "useSelectionActions", "contextIds", "stableContextIds", "useMemo", "JSON", "stringify", "singleSelect", "useCallback", "updateSingle", "multiSelect", "updateMulti", "rangeSelect", "updateRange", "toggle", "toggleSelection", "clear", "clearSelection"]
|
|
7
|
+
}
|
|
@@ -1,54 +1,120 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
ATTENABLE_ATTRIBUTE,
|
|
4
|
-
ATTENDABLE_PATH_SEPARATOR,
|
|
5
|
-
ATTENTION_NAME,
|
|
6
|
-
ATTENTION_SOURCE_ATTRIBUTE,
|
|
7
3
|
AttendableContainer,
|
|
8
|
-
AttentionGlyph,
|
|
9
|
-
AttentionManager,
|
|
10
|
-
AttentionProvider,
|
|
11
|
-
AttentionSchema,
|
|
12
4
|
RootAttentionProvider,
|
|
13
|
-
SelectionManager,
|
|
14
5
|
SelectionProvider,
|
|
15
|
-
SelectionSchema,
|
|
16
|
-
Syncing,
|
|
17
|
-
defaultSelection,
|
|
18
|
-
getAttendables,
|
|
19
|
-
getSelectionSet,
|
|
20
6
|
useAttended,
|
|
21
7
|
useAttention,
|
|
22
8
|
useAttentionAttributes,
|
|
23
9
|
useAttentionContext,
|
|
24
|
-
useAttentionPath,
|
|
25
10
|
useSelected,
|
|
26
11
|
useSelectionActions,
|
|
27
12
|
useSelectionManager
|
|
28
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ZTUVSH4P.mjs";
|
|
14
|
+
import {
|
|
15
|
+
AttentionManager,
|
|
16
|
+
SelectionManager,
|
|
17
|
+
SelectionSchema,
|
|
18
|
+
defaultSelection,
|
|
19
|
+
expandAttendableId,
|
|
20
|
+
getAttendables,
|
|
21
|
+
getLinkedVariant,
|
|
22
|
+
getParentId,
|
|
23
|
+
getSegmentId,
|
|
24
|
+
getSelectionSet,
|
|
25
|
+
isLinkedSegment,
|
|
26
|
+
linkedSegment
|
|
27
|
+
} from "./chunk-6INLBC62.mjs";
|
|
28
|
+
|
|
29
|
+
// src/components/AttentionGlyph/AttentionGlyph.tsx
|
|
30
|
+
import React, { forwardRef, useMemo } from "react";
|
|
31
|
+
import { Icon } from "@dxos/react-ui";
|
|
32
|
+
import { mx } from "@dxos/ui-theme";
|
|
33
|
+
var attentionGlyphStyles = mx("inline-block rounded-xs w-3 h-3 bg-transparent text-accent-text transition-colors", "[[data-contains-attended=true]_&]:bg-attention-contains", "[[data-attention=true]_&]:bg-accent-surface", "[[data-attention=true]_&]:text-accent-foreground", "[[aria-current][data-attention=true]_&]:bg-accent-surface", "[[aria-current][data-attention=true]_&]:text-accent-foreground", '[[aria-selected="true"][data-attention=true]_&]:bg-accent-surface', '[[aria-selected="true"][data-attention=true]_&]:text-accent-foreground');
|
|
34
|
+
var presenceIconStyles = mx("w-3 h-3");
|
|
35
|
+
var PresenceOne = () => {
|
|
36
|
+
return /* @__PURE__ */ React.createElement("svg", {
|
|
37
|
+
width: "12",
|
|
38
|
+
height: "12",
|
|
39
|
+
viewBox: "0 0 12 12",
|
|
40
|
+
className: presenceIconStyles,
|
|
41
|
+
fill: "none",
|
|
42
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
43
|
+
}, /* @__PURE__ */ React.createElement("circle", {
|
|
44
|
+
cx: "6",
|
|
45
|
+
cy: "6",
|
|
46
|
+
r: "2.5",
|
|
47
|
+
fill: "currentColor"
|
|
48
|
+
}));
|
|
49
|
+
};
|
|
50
|
+
var PresenceMany = () => {
|
|
51
|
+
return /* @__PURE__ */ React.createElement("svg", {
|
|
52
|
+
width: "12",
|
|
53
|
+
height: "12",
|
|
54
|
+
viewBox: "0 0 12 12",
|
|
55
|
+
className: presenceIconStyles,
|
|
56
|
+
fill: "none",
|
|
57
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
58
|
+
}, /* @__PURE__ */ React.createElement("path", {
|
|
59
|
+
d: "M6.75 8.27311C7.38815 7.72296 7.79212 6.90866 7.79212 6C7.79212 5.09134 7.38815 4.27704 6.75 3.72689C7.06722 3.58122 7.42019 3.5 7.79212 3.5C9.17283 3.5 10.2921 4.61929 10.2921 6C10.2921 7.38071 9.17283 8.5 7.79212 8.5C7.42019 8.5 7.06723 8.41878 6.75 8.27311Z",
|
|
60
|
+
fill: "currentColor"
|
|
61
|
+
}), /* @__PURE__ */ React.createElement("circle", {
|
|
62
|
+
cx: "4.25",
|
|
63
|
+
cy: "6",
|
|
64
|
+
r: "2.5",
|
|
65
|
+
fill: "currentColor"
|
|
66
|
+
}));
|
|
67
|
+
};
|
|
68
|
+
var Syncing = () => {
|
|
69
|
+
const animationProps = useMemo(() => ({
|
|
70
|
+
// Synchronize animations.
|
|
71
|
+
animationDelay: `-${Date.now() % 2e3}ms`
|
|
72
|
+
}), []);
|
|
73
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
74
|
+
role: "status",
|
|
75
|
+
className: "flex items-center"
|
|
76
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
77
|
+
icon: "ph--circle-notch--bold",
|
|
78
|
+
size: 3,
|
|
79
|
+
style: animationProps,
|
|
80
|
+
classNames: "text-subdued animate-[spin_2s_linear_infinite]"
|
|
81
|
+
}));
|
|
82
|
+
};
|
|
83
|
+
var AttentionGlyph = /* @__PURE__ */ forwardRef(({ presence, attended, syncing, containsAttended, classNames, ...props }, forwardedRef) => {
|
|
84
|
+
const icon = syncing ? /* @__PURE__ */ React.createElement(Syncing, null) : presence === "many" ? /* @__PURE__ */ React.createElement(PresenceMany, null) : presence === "one" ? /* @__PURE__ */ React.createElement(PresenceOne, null) : null;
|
|
85
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
86
|
+
className: "flex group",
|
|
87
|
+
"data-attention": attended,
|
|
88
|
+
"data-contains-attended": containsAttended
|
|
89
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
90
|
+
role: "none",
|
|
91
|
+
...props,
|
|
92
|
+
className: mx(attentionGlyphStyles, classNames),
|
|
93
|
+
ref: forwardedRef
|
|
94
|
+
}, icon));
|
|
95
|
+
});
|
|
29
96
|
export {
|
|
30
|
-
ATTENABLE_ATTRIBUTE,
|
|
31
|
-
ATTENDABLE_PATH_SEPARATOR,
|
|
32
|
-
ATTENTION_NAME,
|
|
33
|
-
ATTENTION_SOURCE_ATTRIBUTE,
|
|
34
97
|
AttendableContainer,
|
|
35
98
|
AttentionGlyph,
|
|
36
99
|
AttentionManager,
|
|
37
|
-
AttentionProvider,
|
|
38
|
-
AttentionSchema,
|
|
39
100
|
RootAttentionProvider,
|
|
40
101
|
SelectionManager,
|
|
41
102
|
SelectionProvider,
|
|
42
103
|
SelectionSchema,
|
|
43
104
|
Syncing,
|
|
44
105
|
defaultSelection,
|
|
106
|
+
expandAttendableId,
|
|
45
107
|
getAttendables,
|
|
108
|
+
getLinkedVariant,
|
|
109
|
+
getParentId,
|
|
110
|
+
getSegmentId,
|
|
46
111
|
getSelectionSet,
|
|
112
|
+
isLinkedSegment,
|
|
113
|
+
linkedSegment,
|
|
47
114
|
useAttended,
|
|
48
115
|
useAttention,
|
|
49
116
|
useAttentionAttributes,
|
|
50
117
|
useAttentionContext,
|
|
51
|
-
useAttentionPath,
|
|
52
118
|
useSelected,
|
|
53
119
|
useSelectionActions,
|
|
54
120
|
useSelectionManager
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
4
|
-
"sourcesContent": [],
|
|
5
|
-
"mappings": "",
|
|
6
|
-
"names": []
|
|
3
|
+
"sources": ["../../../src/components/AttentionGlyph/AttentionGlyph.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Primitive } from '@radix-ui/react-primitive';\nimport React, { type CSSProperties, type ComponentPropsWithRef, forwardRef, useMemo } from 'react';\n\nimport { Icon, type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\n\nconst attentionGlyphStyles = mx(\n 'inline-block rounded-xs w-3 h-3 bg-transparent text-accent-text transition-colors',\n '[[data-contains-attended=true]_&]:bg-attention-contains',\n '[[data-attention=true]_&]:bg-accent-surface',\n '[[data-attention=true]_&]:text-accent-foreground',\n '[[aria-current][data-attention=true]_&]:bg-accent-surface',\n '[[aria-current][data-attention=true]_&]:text-accent-foreground',\n '[[aria-selected=\"true\"][data-attention=true]_&]:bg-accent-surface',\n '[[aria-selected=\"true\"][data-attention=true]_&]:text-accent-foreground',\n);\n\nconst presenceIconStyles = mx('w-3 h-3');\n\nconst PresenceOne = () => {\n return (\n <svg\n width='12'\n height='12'\n viewBox='0 0 12 12'\n className={presenceIconStyles}\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <circle cx='6' cy='6' r='2.5' fill='currentColor' />\n </svg>\n );\n};\n\nconst PresenceMany = () => {\n return (\n <svg\n width='12'\n height='12'\n viewBox='0 0 12 12'\n className={presenceIconStyles}\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <path\n d='M6.75 8.27311C7.38815 7.72296 7.79212 6.90866 7.79212 6C7.79212 5.09134 7.38815 4.27704 6.75 3.72689C7.06722 3.58122 7.42019 3.5 7.79212 3.5C9.17283 3.5 10.2921 4.61929 10.2921 6C10.2921 7.38071 9.17283 8.5 7.79212 8.5C7.42019 8.5 7.06723 8.41878 6.75 8.27311Z'\n fill='currentColor'\n />\n <circle cx='4.25' cy='6' r='2.5' fill='currentColor' />\n </svg>\n );\n};\n\nexport const Syncing = () => {\n const animationProps = useMemo<CSSProperties>(\n () => ({\n // Synchronize animations.\n animationDelay: `-${Date.now() % 2_000}ms`,\n }),\n [],\n );\n\n return (\n <div role='status' className='flex items-center'>\n <Icon\n icon='ph--circle-notch--bold'\n size={3}\n style={animationProps}\n classNames='text-subdued animate-[spin_2s_linear_infinite]'\n />\n </div>\n );\n};\n\nexport type AttentionGlyphProps = {\n attended?: boolean;\n containsAttended?: boolean;\n syncing?: boolean;\n presence?: 'none' | 'one' | 'many';\n} & ThemedClassName<Omit<ComponentPropsWithRef<typeof Primitive.span>, 'children'>>;\n\nexport const AttentionGlyph = forwardRef<HTMLSpanElement, AttentionGlyphProps>(\n ({ presence, attended, syncing, containsAttended, classNames, ...props }, forwardedRef) => {\n const icon = syncing ? (\n <Syncing />\n ) : presence === 'many' ? (\n <PresenceMany />\n ) : presence === 'one' ? (\n <PresenceOne />\n ) : null;\n\n return (\n <div className='flex group' data-attention={attended} data-contains-attended={containsAttended}>\n <span role='none' {...props} className={mx(attentionGlyphStyles, classNames)} ref={forwardedRef}>\n {icon}\n </span>\n </div>\n );\n },\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,OAAOA,SAAyDC,YAAYC,eAAe;AAE3F,SAASC,YAAkC;AAC3C,SAASC,UAAU;AAEnB,IAAMC,uBAAuBD,GAC3B,qFACA,2DACA,+CACA,oDACA,6DACA,kEACA,qEACA,wE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2B,UAAAA;IAAaW,KAAKJ;KAChFV,IAAAA,CAAAA;AAIT,CAAA;",
|
|
6
|
+
"names": ["React", "forwardRef", "useMemo", "Icon", "mx", "attentionGlyphStyles", "presenceIconStyles", "PresenceOne", "svg", "width", "height", "viewBox", "className", "fill", "xmlns", "circle", "cx", "cy", "r", "PresenceMany", "path", "d", "Syncing", "animationProps", "animationDelay", "Date", "now", "div", "role", "icon", "size", "style", "classNames", "AttentionGlyph", "presence", "attended", "syncing", "containsAttended", "props", "forwardedRef", "data-attention", "data-contains-attended", "span", "ref"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/attention.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/attention.ts":{"bytes":25933,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true}],"format":"esm"},"src/components/AttentionGlyph/AttentionGlyph.tsx":{"bytes":9920,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/components/AttentionGlyph/index.ts":{"bytes":394,"imports":[{"path":"src/components/AttentionGlyph/AttentionGlyph.tsx","kind":"import-statement","original":"./AttentionGlyph"}],"format":"esm"},"src/components/AttentionProvider/AttentionProvider.tsx":{"bytes":18161,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"src/attention.ts","kind":"import-statement","original":"../../attention"}],"format":"esm"},"src/components/AttentionProvider/index.ts":{"bytes":401,"imports":[{"path":"src/components/AttentionProvider/AttentionProvider.tsx","kind":"import-statement","original":"./AttentionProvider"}],"format":"esm"},"src/selection.ts":{"bytes":27361,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Match","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/components/SelectionProvider/SelectionProvider.tsx":{"bytes":16598,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"effect/Match","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"src/selection.ts","kind":"import-statement","original":"../../selection"}],"format":"esm"},"src/components/SelectionProvider/index.ts":{"bytes":401,"imports":[{"path":"src/components/SelectionProvider/SelectionProvider.tsx","kind":"import-statement","original":"./SelectionProvider"}],"format":"esm"},"src/components/index.ts":{"bytes":616,"imports":[{"path":"src/components/AttentionGlyph/index.ts","kind":"import-statement","original":"./AttentionGlyph"},{"path":"src/components/AttentionProvider/index.ts","kind":"import-statement","original":"./AttentionProvider"},{"path":"src/components/SelectionProvider/index.ts","kind":"import-statement","original":"./SelectionProvider"}],"format":"esm"},"src/index.ts":{"bytes":560,"imports":[{"path":"src/attention.ts","kind":"import-statement","original":"./attention"},{"path":"src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"src/selection.ts","kind":"import-statement","original":"./selection"}],"format":"esm"},"src/testing/decorators/withAttention.ts":{"bytes":3505,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/attention.ts","kind":"import-statement","original":"../../attention"},{"path":"src/components/index.ts","kind":"import-statement","original":"../../components"}],"format":"esm"},"src/testing/decorators/index.ts":{"bytes":389,"imports":[{"path":"src/testing/decorators/withAttention.ts","kind":"import-statement","original":"./withAttention"}],"format":"esm"},"src/testing/index.ts":{"bytes":382,"imports":[{"path":"src/testing/decorators/index.ts","kind":"import-statement","original":"./decorators"}],"format":"esm"},"src/types/index.ts":{"bytes":1067,"imports":[{"path":"src/attention.ts","kind":"import-statement","original":"../attention"},{"path":"src/selection.ts","kind":"import-statement","original":"../selection"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5179},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-ZTUVSH4P.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-6INLBC62.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"exports":["AttendableContainer","AttentionGlyph","AttentionManager","RootAttentionProvider","SelectionManager","SelectionProvider","SelectionSchema","Syncing","defaultSelection","expandAttendableId","getAttendables","getLinkedVariant","getParentId","getSegmentId","getSelectionSet","isLinkedSegment","linkedSegment","useAttended","useAttention","useAttentionAttributes","useAttentionContext","useSelected","useSelectionActions","useSelectionManager"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0},"src/components/AttentionGlyph/AttentionGlyph.tsx":{"bytesInOutput":2968}},"bytes":4136},"dist/lib/node-esm/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1876},"dist/lib/node-esm/testing/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-ZTUVSH4P.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-6INLBC62.mjs","kind":"import-statement"},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["withAttention"],"entryPoint":"src/testing/index.ts","inputs":{"src/testing/decorators/withAttention.ts":{"bytesInOutput":610},"src/testing/index.ts":{"bytesInOutput":0}},"bytes":955},"dist/lib/node-esm/chunk-ZTUVSH4P.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":17647},"dist/lib/node-esm/chunk-ZTUVSH4P.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-6INLBC62.mjs","kind":"import-statement"},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"effect/Match","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true}],"exports":["AttendableContainer","RootAttentionProvider","SelectionProvider","useAttended","useAttention","useAttentionAttributes","useAttentionContext","useSelected","useSelectionActions","useSelectionManager"],"inputs":{"src/components/AttentionProvider/AttentionProvider.tsx":{"bytesInOutput":3786},"src/components/SelectionProvider/SelectionProvider.tsx":{"bytesInOutput":3529}},"bytes":7908},"dist/lib/node-esm/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/node-esm/types/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-6INLBC62.mjs","kind":"import-statement"}],"exports":["AttentionManager","SelectionManager","SelectionSchema","defaultSelection","expandAttendableId","getAttendables","getLinkedVariant","getParentId","getSegmentId","getSelectionSet","isLinkedSegment","linkedSegment"],"entryPoint":"src/types/index.ts","inputs":{"src/types/index.ts":{"bytesInOutput":0}},"bytes":628},"dist/lib/node-esm/chunk-6INLBC62.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":25346},"dist/lib/node-esm/chunk-6INLBC62.mjs":{"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Match","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"exports":["AttentionManager","SelectionManager","SelectionSchema","defaultSelection","expandAttendableId","getAttendables","getLinkedVariant","getParentId","getSegmentId","getSelectionSet","isLinkedSegment","linkedSegment"],"inputs":{"src/attention.ts":{"bytesInOutput":5433},"src/selection.ts":{"bytesInOutput":6966}},"bytes":12814}}}
|
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
RootAttentionProvider
|
|
4
|
-
|
|
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 {
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
5
|
-
"mappings": "
|
|
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
|