@dxos/react-ui-attention 0.8.4-main.cb12b3f963 → 0.8.4-main.d05539e30a

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 (32) hide show
  1. package/LICENSE +102 -5
  2. package/dist/lib/browser/{chunk-XVH365AW.mjs → chunk-D2BLVJ6Z.mjs} +9 -255
  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 +14 -13
  7. package/dist/lib/browser/index.mjs.map +2 -2
  8. package/dist/lib/browser/meta.json +1 -1
  9. package/dist/lib/browser/testing/index.mjs +4 -2
  10. package/dist/lib/browser/testing/index.mjs.map +1 -1
  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-W73A7WMN.mjs → chunk-6INLBC62.mjs} +9 -255
  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 +14 -13
  18. package/dist/lib/node-esm/index.mjs.map +2 -2
  19. package/dist/lib/node-esm/meta.json +1 -1
  20. package/dist/lib/node-esm/testing/index.mjs +4 -2
  21. package/dist/lib/node-esm/testing/index.mjs.map +1 -1
  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/types/index.d.ts +3 -0
  25. package/dist/types/src/types/index.d.ts.map +1 -0
  26. package/dist/types/tsconfig.tsbuildinfo +1 -1
  27. package/package.json +20 -14
  28. package/src/components/AttentionGlyph/AttentionGlyph.tsx +4 -4
  29. package/src/components/AttentionProvider/AttentionProvider.tsx +1 -1
  30. package/src/types/index.ts +9 -0
  31. package/dist/lib/browser/chunk-XVH365AW.mjs.map +0 -7
  32. package/dist/lib/node-esm/chunk-W73A7WMN.mjs.map +0 -7
package/LICENSE CHANGED
@@ -1,8 +1,105 @@
1
- MIT License
2
- Copyright (c) 2024 DXOS
1
+ # Functional Source License, Version 1.1, ALv2 Future License
3
2
 
4
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3
+ ## Abbreviation
5
4
 
6
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+ FSL-1.1-Apache-2.0
7
6
 
8
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7
+ ## Notice
8
+
9
+ Copyright 2026 DXOS
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the Apache License, Version 2.0 that is effective on the second anniversary of
91
+ the date we make the Software available. On or after that date, you may use the
92
+ Software under the Apache License, Version 2.0, in which case the following
93
+ will apply:
94
+
95
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
96
+ this file except in compliance with the License.
97
+
98
+ You may obtain a copy of the License at
99
+
100
+ http://www.apache.org/licenses/LICENSE-2.0
101
+
102
+ Unless required by applicable law or agreed to in writing, software distributed
103
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
+ specific language governing permissions and limitations under the License.
@@ -180,125 +180,12 @@ var getSegmentId = (qualifiedId) => {
180
180
  return qualifiedId.split("/").pop() ?? qualifiedId;
181
181
  };
182
182
 
183
- // src/components/AttentionProvider/AttentionProvider.tsx
184
- import { RegistryContext } from "@effect-atom/atom-react";
185
- import { createContext } from "@radix-ui/react-context";
186
- import { Primitive } from "@radix-ui/react-primitive";
187
- import { Slot } from "@radix-ui/react-slot";
188
- import React, { forwardRef, useCallback, useContext, useEffect, useMemo, useState } from "react";
189
- import { log } from "@dxos/log";
190
- import { useDefaultValue } from "@dxos/react-hooks";
191
- import { mx } from "@dxos/ui-theme";
192
- var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-attention/src/components/AttentionProvider/AttentionProvider.tsx";
193
- var ATTENTION_NAME = "Attention";
194
- var ATTENDABLE_ATTRIBUTE = "data-attendable-id";
195
- var ATTENTION_SOURCE_ATTRIBUTE = "data-w-attention-source";
196
- var [AttentionContextProvider, useAttentionContext] = createContext(ATTENTION_NAME, {
197
- attention: void 0
198
- });
199
- var UNKNOWN_ATTENDABLE = {
200
- hasAttention: false,
201
- isAncestor: false,
202
- isRelated: false
203
- };
204
- var useAttention = (attendableId) => {
205
- const { attention } = useAttentionContext(ATTENTION_NAME);
206
- const [state, setState] = useState(UNKNOWN_ATTENDABLE);
207
- useEffect(() => {
208
- if (!attendableId || !attention) {
209
- setState(UNKNOWN_ATTENDABLE);
210
- return;
211
- }
212
- const currentState = attention.get(attendableId);
213
- setState(currentState);
214
- return attention.subscribe(attendableId, (newState) => {
215
- setState(newState);
216
- });
217
- }, [
218
- attention,
219
- attendableId
220
- ]);
221
- return state;
222
- };
223
- var useAttended = () => {
224
- const { attention } = useAttentionContext(ATTENTION_NAME);
225
- const [current, setCurrent] = useState([]);
226
- useEffect(() => {
227
- if (!attention) {
228
- return;
229
- }
230
- setCurrent(attention.getCurrent());
231
- return attention.subscribeCurrent((newCurrent) => {
232
- setCurrent(newCurrent);
233
- });
234
- }, [
235
- attention
236
- ]);
237
- return current;
238
- };
239
- var useAttentionAttributes = (attendableId) => {
240
- const { hasAttention } = useAttention(attendableId);
241
- return useMemo(() => {
242
- const attributes = {
243
- [ATTENDABLE_ATTRIBUTE]: attendableId
244
- };
245
- if (hasAttention) {
246
- attributes[ATTENTION_SOURCE_ATTRIBUTE] = "true";
247
- }
248
- return attributes;
249
- }, [
250
- attendableId,
251
- hasAttention
252
- ]);
253
- };
254
- var RootAttentionProvider = ({ children, attention: propsAttention, onChange }) => {
255
- const registry = useContext(RegistryContext);
256
- const attention = useDefaultValue(propsAttention, () => new AttentionManager(registry));
257
- const handleFocus = useCallback((event) => {
258
- log("focus", {
259
- related: event.relatedTarget,
260
- target: event.target
261
- }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 84, S: void 0 });
262
- const selector = [
263
- "[data-attendable-id]",
264
- ...Array.from(document.querySelectorAll("[aria-controls]")).map((el) => `[id="${el.getAttribute("aria-controls")}"]`)
265
- ].join(",");
266
- const prev = attention.getCurrent();
267
- const next = getAttendables(selector, event.target);
268
- if (next.length > 0 && (prev.length !== next.length || !!prev.find((id, index) => next[index] !== id))) {
269
- attention.update(next);
270
- onChange?.(next);
271
- }
272
- }, [
273
- attention,
274
- onChange
275
- ]);
276
- return /* @__PURE__ */ React.createElement(AttentionContextProvider, {
277
- attention
278
- }, /* @__PURE__ */ React.createElement("div", {
279
- role: "none",
280
- className: "contents",
281
- onFocusCapture: handleFocus
282
- }, children));
283
- };
284
- var AttendableContainer = /* @__PURE__ */ forwardRef(({ id, classNames, children, asChild, ...props }, forwardedRef) => {
285
- const attentionAttrs = useAttentionAttributes(id);
286
- const Comp = asChild ? Slot : Primitive.div;
287
- return /* @__PURE__ */ React.createElement(Comp, {
288
- role: "none",
289
- ...props,
290
- ...attentionAttrs,
291
- className: mx("dx-attention-surface", props.tabIndex === 0 && "dx-focus-ring-inset-over-all", classNames),
292
- ref: forwardedRef
293
- }, children);
294
- });
295
-
296
183
  // src/selection.ts
297
184
  import { Atom as Atom2 } from "@effect-atom/atom-react";
298
185
  import * as Match from "effect/Match";
299
186
  import * as Schema from "effect/Schema";
300
187
  import { invariant } from "@dxos/invariant";
301
- var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-attention/src/selection.ts";
188
+ var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-attention/src/selection.ts";
302
189
  var SelectionSchema = Schema.Union(Schema.Struct({
303
190
  mode: Schema.Literal("single"),
304
191
  id: Schema.optional(Schema.String)
@@ -393,7 +280,7 @@ var SelectionManager = class {
393
280
  }
394
281
  getSelected(contextId, mode = "multi") {
395
282
  const selection = this.getSelection(contextId, mode);
396
- invariant(selection?.mode === mode, "Selection mode mismatch", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 103, S: this, A: ["selection?.mode === mode", "'Selection mode mismatch'"] });
283
+ invariant(selection?.mode === mode, "Selection mode mismatch", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 103, S: this, A: ["selection?.mode === mode", "'Selection mode mismatch'"] });
397
284
  return Match.type().pipe(Match.when({
398
285
  mode: "single"
399
286
  }, (s) => s.id), Match.when({
@@ -409,7 +296,7 @@ var SelectionManager = class {
409
296
  }
410
297
  updateSingle(contextId, id) {
411
298
  const selection = this.getSelection(contextId, "single");
412
- invariant(selection?.mode === "single", "Selection mode is not single", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 120, S: this, A: ["selection?.mode === 'single'", "'Selection mode is not single'"] });
299
+ invariant(selection?.mode === "single", "Selection mode is not single", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 120, S: this, A: ["selection?.mode === 'single'", "'Selection mode is not single'"] });
413
300
  this._registry.update(this._state, (state) => ({
414
301
  selections: {
415
302
  ...state.selections,
@@ -422,7 +309,7 @@ var SelectionManager = class {
422
309
  }
423
310
  updateMulti(contextId, ids) {
424
311
  const selection = this.getSelection(contextId, "multi");
425
- invariant(selection?.mode === "multi", "Selection mode is not multi", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 133, S: this, A: ["selection?.mode === 'multi'", "'Selection mode is not multi'"] });
312
+ invariant(selection?.mode === "multi", "Selection mode is not multi", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 133, S: this, A: ["selection?.mode === 'multi'", "'Selection mode is not multi'"] });
426
313
  this._registry.update(this._state, (state) => ({
427
314
  selections: {
428
315
  ...state.selections,
@@ -437,7 +324,7 @@ var SelectionManager = class {
437
324
  }
438
325
  updateRange(contextId, from, to) {
439
326
  const selection = this.getSelection(contextId, "range");
440
- invariant(selection?.mode === "range", "Selection mode is not range", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 148, S: this, A: ["selection?.mode === 'range'", "'Selection mode is not range'"] });
327
+ invariant(selection?.mode === "range", "Selection mode is not range", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 148, S: this, A: ["selection?.mode === 'range'", "'Selection mode is not range'"] });
441
328
  this._registry.update(this._state, (state) => ({
442
329
  selections: {
443
330
  ...state.selections,
@@ -451,7 +338,7 @@ var SelectionManager = class {
451
338
  }
452
339
  updateMultiRange(contextId, ranges) {
453
340
  const selection = this.getSelection(contextId, "multi-range");
454
- invariant(selection?.mode === "multi-range", "Selection mode is not multi-range", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 162, S: this, A: ["selection?.mode === 'multi-range'", "'Selection mode is not multi-range'"] });
341
+ invariant(selection?.mode === "multi-range", "Selection mode is not multi-range", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 162, S: this, A: ["selection?.mode === 'multi-range'", "'Selection mode is not multi-range'"] });
455
342
  this._registry.update(this._state, (state) => ({
456
343
  selections: {
457
344
  ...state.selections,
@@ -500,7 +387,7 @@ var SelectionManager = class {
500
387
  }
501
388
  toggleSelection(contextId, id) {
502
389
  const selection = this.getSelection(contextId, "multi");
503
- invariant(selection?.mode === "multi", "Selection mode is not multi", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 211, S: this, A: ["selection?.mode === 'multi'", "'Selection mode is not multi'"] });
390
+ invariant(selection?.mode === "multi", "Selection mode is not multi", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 211, S: this, A: ["selection?.mode === 'multi'", "'Selection mode is not multi'"] });
504
391
  const newIds = selection.ids.includes(id) ? selection.ids.filter((existingId) => existingId !== id) : [
505
392
  ...selection.ids,
506
393
  id
@@ -517,129 +404,6 @@ var SelectionManager = class {
517
404
  }
518
405
  };
519
406
 
520
- // src/components/SelectionProvider/SelectionProvider.tsx
521
- import { RegistryContext as RegistryContext2 } from "@effect-atom/atom-react";
522
- import { createContext as createContext2 } from "@radix-ui/react-context";
523
- import * as Match2 from "effect/Match";
524
- import React2, { useCallback as useCallback2, useContext as useContext2, useEffect as useEffect2, useMemo as useMemo2, useState as useState2 } from "react";
525
- import { useDefaultValue as useDefaultValue2 } from "@dxos/react-hooks";
526
- var SELECTION_NAME = "Selection";
527
- var [SelectionContextProvider, useSelectionContext] = createContext2(SELECTION_NAME, {
528
- selection: void 0
529
- });
530
- var SelectionProvider = ({ children, selection: selectionProp }) => {
531
- const registry = useContext2(RegistryContext2);
532
- const selection = useDefaultValue2(selectionProp, () => new SelectionManager(registry));
533
- return /* @__PURE__ */ React2.createElement(SelectionContextProvider, {
534
- selection
535
- }, children);
536
- };
537
- var useSelectionManager = () => {
538
- const { selection } = useSelectionContext(SELECTION_NAME);
539
- return selection;
540
- };
541
- var getDefaultResult = (mode) => {
542
- return Match2.type().pipe(Match2.when({
543
- mode: "single"
544
- }, (selection) => selection.id), Match2.when({
545
- mode: "multi"
546
- }, (selection) => selection.ids), Match2.when({
547
- mode: "range"
548
- }, (selection) => selection.from && selection.to ? {
549
- from: selection.from,
550
- to: selection.to
551
- } : void 0), Match2.when({
552
- mode: "multi-range"
553
- }, (selection) => selection.ranges), Match2.exhaustive)(defaultSelection(mode));
554
- };
555
- var useSelected = (contextId, mode = "multi") => {
556
- const { selection } = useSelectionContext(SELECTION_NAME);
557
- const [state, setState] = useState2(() => contextId && selection ? selection.getSelected(contextId, mode) : getDefaultResult(mode));
558
- useEffect2(() => {
559
- if (!contextId || !selection) {
560
- setState(getDefaultResult(mode));
561
- return;
562
- }
563
- setState(selection.getSelected(contextId, mode));
564
- return selection.subscribe(() => {
565
- setState(selection.getSelected(contextId, mode));
566
- });
567
- }, [
568
- selection,
569
- contextId,
570
- mode
571
- ]);
572
- return state;
573
- };
574
- var useSelectionActions = (contextIds) => {
575
- const stableContextIds = useMemo2(() => contextIds, [
576
- JSON.stringify(contextIds)
577
- ]);
578
- const { selection } = useSelectionContext(SELECTION_NAME);
579
- const singleSelect = useCallback2((id) => {
580
- if (!selection) {
581
- return;
582
- }
583
- for (const contextId of stableContextIds) {
584
- selection.updateSingle(contextId, id);
585
- }
586
- }, [
587
- selection,
588
- stableContextIds
589
- ]);
590
- const multiSelect = useCallback2((ids) => {
591
- if (!selection) {
592
- return;
593
- }
594
- for (const contextId of stableContextIds) {
595
- selection.updateMulti(contextId, ids);
596
- }
597
- }, [
598
- selection,
599
- stableContextIds
600
- ]);
601
- const rangeSelect = useCallback2((from, to) => {
602
- if (!selection) {
603
- return;
604
- }
605
- for (const contextId of stableContextIds) {
606
- selection.updateRange(contextId, from, to);
607
- }
608
- }, [
609
- selection,
610
- stableContextIds
611
- ]);
612
- const toggle = useCallback2((id) => {
613
- if (!selection) {
614
- return;
615
- }
616
- for (const contextId of stableContextIds) {
617
- selection.toggleSelection(contextId, id);
618
- }
619
- }, [
620
- selection,
621
- stableContextIds
622
- ]);
623
- const clear = useCallback2(() => {
624
- if (!selection) {
625
- return;
626
- }
627
- for (const contextId of stableContextIds) {
628
- selection.clearSelection(contextId);
629
- }
630
- }, [
631
- selection,
632
- stableContextIds
633
- ]);
634
- return {
635
- singleSelect,
636
- multiSelect,
637
- rangeSelect,
638
- toggle,
639
- clear
640
- };
641
- };
642
-
643
407
  export {
644
408
  AttentionManager,
645
409
  getAttendables,
@@ -649,19 +413,9 @@ export {
649
413
  getLinkedVariant,
650
414
  getParentId,
651
415
  getSegmentId,
652
- useAttentionContext,
653
- useAttention,
654
- useAttended,
655
- useAttentionAttributes,
656
- RootAttentionProvider,
657
- AttendableContainer,
658
416
  SelectionSchema,
659
417
  defaultSelection,
660
418
  getSelectionSet,
661
- SelectionManager,
662
- SelectionProvider,
663
- useSelectionManager,
664
- useSelected,
665
- useSelectionActions
419
+ SelectionManager
666
420
  };
667
- //# sourceMappingURL=chunk-XVH365AW.mjs.map
421
+ //# sourceMappingURL=chunk-D2BLVJ6Z.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/attention.ts", "../../../src/selection.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Atom, type Registry } from '@effect-atom/atom-react';\n\nexport type Attention = {\n hasAttention: boolean;\n isAncestor: boolean;\n isRelated: boolean;\n};\n\n/**\n * Manages attention state for an application.\n * Attention keys are slash-qualified graph IDs; ancestry is derived from progressive prefixes.\n */\nexport class AttentionManager {\n private readonly _map = new Map<string, Atom.Writable<Attention>>();\n private readonly _currentAtom: Atom.Writable<string[]>;\n\n constructor(\n private readonly _registry: Registry.Registry,\n initial: string[] = [],\n ) {\n this._currentAtom = Atom.make<string[]>([]).pipe(Atom.keepAlive);\n if (initial.length > 0) {\n this.update(initial);\n }\n }\n\n /**\n * Atom for the currently attended element IDs.\n */\n get current(): Atom.Atom<string[]> {\n return this._currentAtom;\n }\n\n /**\n * Gets the currently attended element IDs.\n */\n getCurrent(): readonly string[] {\n return this._registry.get(this._currentAtom);\n }\n\n /**\n * Subscribe to changes in the current attention IDs.\n */\n subscribeCurrent(cb: (current: readonly string[]) => void): () => void {\n this._registry.get(this._currentAtom);\n return this._registry.subscribe(this._currentAtom, () => {\n cb(this._registry.get(this._currentAtom));\n });\n }\n\n /**\n * All tracked qualified IDs.\n */\n keys(): string[] {\n return Array.from(this._map.keys());\n }\n\n /**\n * Get the attention state for a given qualified ID.\n */\n get(id: string): Attention {\n const atom = this._getAtom(id);\n return this._registry.get(atom);\n }\n\n /**\n * Subscribe to changes in the attention state for a given qualified ID.\n */\n subscribe(id: string, cb: (attention: Attention) => void): () => void {\n const atom = this._getAtom(id);\n this._registry.get(atom);\n return this._registry.subscribe(atom, () => {\n cb(this._registry.get(atom));\n });\n }\n\n private _getAtom(id: string): Atom.Writable<Attention> {\n const existing = this._map.get(id);\n if (existing) {\n return existing;\n }\n\n const newAtom = Atom.make<Attention>({ hasAttention: false, isAncestor: false, isRelated: false }).pipe(\n Atom.keepAlive,\n );\n this._map.set(id, newAtom);\n return newAtom;\n }\n\n /**\n * Update the currently attended element.\n * Takes the array of qualified IDs collected from the DOM; the first element is the primary attended item.\n * Ancestry is derived from the progressive prefixes of the primary ID.\n * Relatedness is derived from the segment ID: any tracked key whose last `/` segment matches the\n * attended ID's segment ID is marked `isRelated`. Additionally, if the primary ID is a linked segment\n * (starts with `~`), its immediate parent gets `isRelated` alongside `isAncestor`.\n *\n * @internal\n */\n update(nextIds: string[]): void {\n const primaryId = nextIds[0];\n if (!primaryId) {\n return;\n }\n\n const currentIds = this.getCurrent();\n const prevPrimaryId = currentIds[0];\n // Clear previous attention state: ancestors, primary, and related keys.\n if (prevPrimaryId) {\n const prevPrefixes = expandAttendableId(prevPrimaryId);\n for (const prefix of prevPrefixes) {\n this._set(prefix, {});\n }\n const prevSegmentId = getSegmentId(prevPrimaryId);\n for (const key of this.keys()) {\n if (getSegmentId(key) === prevSegmentId) {\n this._set(key, {});\n }\n }\n }\n\n this._registry.set(this._currentAtom, nextIds);\n\n // Set ancestors and primary.\n const prefixes = expandAttendableId(primaryId);\n const prefixSet = new Set(prefixes);\n const linkedParent = isLinkedSegment(primaryId) ? getParentId(primaryId) : undefined;\n\n for (const prefix of prefixes) {\n if (prefix === primaryId) {\n this._set(prefix, { hasAttention: true });\n } else if (prefix === linkedParent) {\n this._set(prefix, { isAncestor: true, isRelated: true });\n } else {\n this._set(prefix, { isAncestor: true });\n }\n }\n\n // Set related keys: any tracked key sharing the same segment ID.\n const segmentId = getSegmentId(primaryId);\n for (const key of this.keys()) {\n if (!prefixSet.has(key) && getSegmentId(key) === segmentId) {\n this._set(key, { isRelated: true });\n }\n }\n }\n\n private _set(id: string, attention: Partial<Attention>): void {\n const atom = this._getAtom(id);\n this._registry.set(atom, {\n hasAttention: attention.hasAttention ?? false,\n isAncestor: attention.isAncestor ?? false,\n isRelated: attention.isRelated ?? false,\n });\n }\n}\n\n/**\n * Accumulates all attendable IDs between the element provided and the root, inclusive.\n * Each `data-attendable-id` value is treated as a single qualified ID (no splitting).\n */\nexport const getAttendables = (selector: string, cursor: Element, acc: string[] = []): string[] => {\n // Find the closest element with `data-attendable-id`, if any; start from cursor and move up the DOM tree.\n const closestAttendable = cursor.closest(selector);\n if (closestAttendable) {\n const attendableId = closestAttendable.getAttribute('data-attendable-id');\n if (!attendableId) {\n // This has an id of an aria-controls elsewhere on the page, move cursor to that trigger.\n const trigger = document.querySelector(`[aria-controls=\"${closestAttendable.getAttribute('id')}\"]`);\n if (!trigger) {\n return acc;\n } else {\n return getAttendables(selector, trigger, acc);\n }\n } else {\n acc.push(attendableId);\n return !closestAttendable.parentElement ? acc : getAttendables(selector, closestAttendable.parentElement, acc);\n }\n }\n\n return [...new Set(acc)];\n};\n\nexport type AttendableId = { attendableId?: string };\n\nexport type Related = { related?: boolean };\n\n/**\n * Prefix for linked segments. A linked segment's attention state is shared with its parent:\n * when a linked node has attention, the parent is marked as both ancestor and related.\n */\nconst LINKED_PREFIX = '~';\n\n/**\n * Decompose a qualified graph ID into progressive prefixes for ancestry tracking.\n * e.g. `root/a/b/c` yields `['root', 'root/a', 'root/a/b', 'root/a/b/c']`.\n */\nexport const expandAttendableId = (qualifiedId: string): string[] => {\n const segments = qualifiedId.split('/');\n return segments.map((_, index) => segments.slice(0, index + 1).join('/'));\n};\n\n/**\n * Whether the last segment of a qualified ID is a linked segment (starts with `~`).\n * Linked segments share their attention state with the parent node.\n */\nexport const isLinkedSegment = (qualifiedId: string): boolean => {\n const lastSegment = qualifiedId.split('/').pop() ?? '';\n return lastSegment.startsWith(LINKED_PREFIX);\n};\n\n/**\n * Build a linked segment ID from a variant name (e.g., `'settings'` -> `'~settings'`).\n * Nodes identified by linked segments share their attention state with the parent node.\n */\nexport const linkedSegment = (variant: string): string => `${LINKED_PREFIX}${variant}`;\n\n/**\n * Extract the variant name from the last segment of a qualified ID, stripping the linked prefix.\n * e.g. `'root/space/obj/~settings'` -> `'settings'`.\n * If the segment is not linked (no `~` prefix), returns the segment as-is.\n */\nexport const getLinkedVariant = (qualifiedId: string): string => {\n const lastSegment = qualifiedId.split('/').pop() ?? '';\n return lastSegment.startsWith(LINKED_PREFIX) ? lastSegment.slice(LINKED_PREFIX.length) : lastSegment;\n};\n\n/**\n * Get the parent qualified ID (everything before the last `/` segment).\n */\nexport const getParentId = (qualifiedId: string | undefined): string | undefined => {\n if (!qualifiedId) {\n return undefined;\n }\n\n const lastSlash = qualifiedId.lastIndexOf('/');\n return lastSlash > 0 ? qualifiedId.slice(0, lastSlash) : undefined;\n};\n\n/**\n * Extract the segment ID (last segment) of a qualified ID.\n */\nexport const getSegmentId = (qualifiedId: string): string => {\n return qualifiedId.split('/').pop() ?? qualifiedId;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom, type Registry } from '@effect-atom/atom-react';\nimport * as Match from 'effect/Match';\nimport * as Schema from 'effect/Schema';\n\nimport { invariant } from '@dxos/invariant';\n\nexport type SelectionMode = 'single' | 'multi' | 'range' | 'multi-range';\n\nexport const SelectionSchema = Schema.Union(\n Schema.Struct({\n mode: Schema.Literal('single'),\n id: Schema.optional(Schema.String),\n }).pipe(Schema.mutable),\n Schema.Struct({\n mode: Schema.Literal('multi'),\n ids: Schema.Array(Schema.String).pipe(Schema.mutable),\n }).pipe(Schema.mutable),\n Schema.Struct({\n mode: Schema.Literal('range'),\n from: Schema.optional(Schema.String),\n to: Schema.optional(Schema.String),\n }).pipe(Schema.mutable),\n Schema.Struct({\n mode: Schema.Literal('multi-range'),\n ranges: Schema.Array(Schema.Struct({ from: Schema.String, to: Schema.String })).pipe(Schema.mutable),\n }).pipe(Schema.mutable),\n).pipe(Schema.mutable);\n\nexport type Selection = Schema.Schema.Type<typeof SelectionSchema>;\n\nexport const defaultSelection = Match.type<SelectionMode>().pipe(\n Match.withReturnType<Selection>(),\n Match.when('single', () => ({ mode: 'single' })),\n Match.when('multi', () => ({ mode: 'multi', ids: [] })),\n Match.when('range', () => ({ mode: 'range' })),\n Match.when('multi-range', () => ({ mode: 'multi-range', ranges: [] })),\n Match.exhaustive,\n);\n\nexport type SelectionResult<T extends SelectionMode> = T extends 'single'\n ? string | undefined\n : T extends 'multi'\n ? string[]\n : T extends 'range'\n ? { from: string; to: string } | undefined\n : T extends 'multi-range'\n ? { from: string; to: string }[]\n : never;\n\nexport const getSelectionSet = (selectionManager: SelectionManager, contextId?: string) => {\n const ids = new Set<string>(contextId ? [contextId] : []);\n for (const context of selectionManager.getSelectionContexts()) {\n const selection = selectionManager.getSelection(context);\n if (selection?.mode === 'multi') {\n for (const id of selection.ids) {\n ids.add(id);\n }\n }\n }\n\n return ids;\n};\n\n/**\n * Manages selection state for different contexts.\n * Each context maintains its own selection mode and state.\n */\nexport class SelectionManager {\n private readonly _state: Atom.Writable<{ selections: Record<string, Selection> }>;\n\n constructor(\n private readonly _registry: Registry.Registry,\n initial: Record<string, Selection> = {},\n ) {\n this._state = Atom.make<{ selections: Record<string, Selection> }>({\n selections: { ...initial },\n });\n }\n\n /**\n * Get the state atom for reactive access in the graph system.\n */\n get state(): Atom.Atom<{ selections: Record<string, Selection> }> {\n return this._state;\n }\n\n /**\n * Gets the current state.\n */\n getState(): { selections: Record<string, Selection> } {\n return this._registry.get(this._state);\n }\n\n /**\n * Subscribe to changes in the selection state.\n */\n subscribe(cb: (state: { selections: Record<string, Selection> }) => void): () => void {\n this._registry.get(this._state);\n return this._registry.subscribe(this._state, () => {\n cb(this._registry.get(this._state));\n });\n }\n\n getSelectionContexts(): string[] {\n return Object.keys(this._registry.get(this._state).selections);\n }\n\n getSelection(contextId: string): Selection | undefined;\n getSelection<T extends SelectionMode>(contextId: string, mode: T): Selection;\n getSelection<T extends SelectionMode | undefined>(\n contextId: string,\n mode: T = undefined as T,\n ): Selection | undefined {\n const state = this._registry.get(this._state);\n const selection = state.selections[contextId];\n if (!mode || selection) {\n return selection;\n }\n\n // Create new selection for the context.\n const newSelection = defaultSelection(mode);\n this._registry.update(this._state, (state) => ({\n selections: { ...state.selections, [contextId]: newSelection },\n }));\n\n return newSelection;\n }\n\n getSelected<T extends SelectionMode>(contextId: string, mode: T = 'multi' as T): SelectionResult<T> {\n const selection = this.getSelection(contextId, mode);\n invariant(selection?.mode === mode, 'Selection mode mismatch');\n\n // Cast required because TypeScript can't infer the relationship between T and the matched result.\n return Match.type<Selection>().pipe(\n Match.when({ mode: 'single' }, (s) => s.id),\n Match.when({ mode: 'multi' }, (s) => s.ids),\n Match.when({ mode: 'range' }, (s) => (s.from && s.to ? { from: s.from, to: s.to } : undefined)),\n Match.when({ mode: 'multi-range' }, (s) => s.ranges),\n Match.exhaustive,\n )(selection) as SelectionResult<T>;\n }\n\n updateSingle(contextId: string, id: string): void {\n const selection = this.getSelection(contextId, 'single');\n invariant(selection?.mode === 'single', 'Selection mode is not single');\n this._registry.update(this._state, (state) => ({\n selections: {\n ...state.selections,\n [contextId]: { ...selection, id },\n },\n }));\n }\n\n updateMulti(contextId: string, ids: string[]) {\n const selection = this.getSelection(contextId, 'multi');\n invariant(selection?.mode === 'multi', 'Selection mode is not multi');\n this._registry.update(this._state, (state) => ({\n selections: {\n ...state.selections,\n [contextId]: { ...selection, ids: [...ids] },\n },\n }));\n }\n\n updateRange(contextId: string, from: string, to: string) {\n const selection = this.getSelection(contextId, 'range');\n invariant(selection?.mode === 'range', 'Selection mode is not range');\n this._registry.update(this._state, (state) => ({\n selections: {\n ...state.selections,\n [contextId]: { ...selection, from, to },\n },\n }));\n }\n\n updateMultiRange(contextId: string, ranges: { from: string; to: string }[]) {\n const selection = this.getSelection(contextId, 'multi-range');\n invariant(selection?.mode === 'multi-range', 'Selection mode is not multi-range');\n this._registry.update(this._state, (state) => ({\n selections: {\n ...state.selections,\n [contextId]: { ...selection, ranges: [...ranges] },\n },\n }));\n }\n\n clearSelection(contextId: string): void {\n const selection = this.getSelection(contextId);\n if (!selection) {\n return;\n }\n\n const clearedSelection = Match.type<Selection>().pipe(\n Match.when({ mode: 'single' }, (s) => ({ ...s, id: undefined })),\n Match.when({ mode: 'multi' }, (s) => ({ ...s, ids: [] })),\n Match.when({ mode: 'range' }, (s) => ({ ...s, from: undefined, to: undefined })),\n Match.when({ mode: 'multi-range' }, (s) => ({ ...s, ranges: [] })),\n Match.exhaustive,\n )(selection);\n\n this._registry.update(this._state, (state) => ({\n selections: {\n ...state.selections,\n [contextId]: clearedSelection,\n },\n }));\n }\n\n toggleSelection(contextId: string, id: string): void {\n const selection = this.getSelection(contextId, 'multi');\n invariant(selection?.mode === 'multi', 'Selection mode is not multi');\n\n const newIds = selection.ids.includes(id)\n ? selection.ids.filter((existingId) => existingId !== id)\n : [...selection.ids, id];\n\n this._registry.update(this._state, (state) => ({\n selections: {\n ...state.selections,\n [contextId]: { ...selection, ids: new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YAASxB,KAAAA,aAAcyB,WACzBzB,OAAUF;cACNE,WAAa,SAAA,SAAA,+BAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,KAAA,GAAA,MAAA,GAAA,CAAA,+BAAA,+BAAA,EAAA,CAAA;UAAEf,SAAAA,UAAAA,IAAAA,SAAAA,EAAAA,IAAAA,UAAAA,IAAAA,OAAAA,CAAAA,eAAAA,eAAAA,EAAAA,IAAAA;MAAG,GAAA,UAAA;MAEtB;;mBAEG0B,OAAMR,KAAAA,QAAU,CAAA,WAAA;kBAClBJ;iBAAiBC;kBAAgBwB,GAAAA;UAAO,GAAA;UAC3C,KAAA;QACF;MACF;IACF,EAAA;;;",
6
+ "names": ["Atom", "AttentionManager", "_map", "Map", "_currentAtom", "_registry", "initial", "make", "pipe", "keepAlive", "length", "update", "current", "getCurrent", "get", "subscribeCurrent", "cb", "subscribe", "keys", "Array", "from", "id", "atom", "_getAtom", "existing", "newAtom", "hasAttention", "isAncestor", "isRelated", "set", "nextIds", "primaryId", "currentIds", "prevPrimaryId", "prevPrefixes", "expandAttendableId", "prefix", "_set", "prevSegmentId", "getSegmentId", "key", "prefixes", "prefixSet", "Set", "linkedParent", "isLinkedSegment", "getParentId", "undefined", "segmentId", "has", "attention", "getAttendables", "selector", "cursor", "acc", "closestAttendable", "closest", "attendableId", "getAttribute", "trigger", "document", "querySelector", "push", "parentElement", "LINKED_PREFIX", "qualifiedId", "segments", "split", "map", "_", "index", "slice", "join", "lastSegment", "pop", "startsWith", "linkedSegment", "variant", "getLinkedVariant", "lastSlash", "lastIndexOf", "Atom", "Match", "Schema", "invariant", "SelectionSchema", "id", "pipe", "mutable", "Struct", "mode", "String", "optional", "to", "Array", "defaultSelection", "when", "ranges", "getSelectionSet", "ids", "contextId", "selection", "_state", "make", "selections", "initial", "_registry", "cb", "get", "getSelectionContexts", "getSelection", "undefined", "state", "newSelection", "getSelected", "s", "from", "exhaustive", "updateSingle", "update", "updateMulti", "updateRange", "updateMultiRange", "clearSelection", "toggleSelection", "newIds", "includes"]
7
+ }