@dxos/react-ui-attention 0.8.2-main.fbd8ed0 → 0.8.2-staging.42af850

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.
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_KMRU4W67_exports = {};
30
- __export(chunk_KMRU4W67_exports, {
29
+ var chunk_EGMHOB43_exports = {};
30
+ __export(chunk_EGMHOB43_exports, {
31
31
  ATTENABLE_ATTRIBUTE: () => ATTENABLE_ATTRIBUTE,
32
32
  ATTENDABLE_PATH_SEPARATOR: () => ATTENDABLE_PATH_SEPARATOR,
33
33
  ATTENTION_NAME: () => ATTENTION_NAME,
@@ -41,23 +41,26 @@ __export(chunk_KMRU4W67_exports, {
41
41
  SelectionManager: () => SelectionManager,
42
42
  SelectionProvider: () => SelectionProvider,
43
43
  Syncing: () => Syncing,
44
+ defaultSelection: () => defaultSelection,
44
45
  getAttendables: () => getAttendables,
45
46
  useAttendableAttributes: () => useAttendableAttributes,
46
47
  useAttended: () => useAttended,
47
48
  useAttention: () => useAttention,
48
49
  useAttentionContext: () => useAttentionContext,
49
50
  useAttentionPath: () => useAttentionPath,
50
- useSelectedItems: () => useSelectedItems,
51
+ useSelected: () => useSelected,
51
52
  useSelectionActions: () => useSelectionActions
52
53
  });
53
- module.exports = __toCommonJS(chunk_KMRU4W67_exports);
54
+ module.exports = __toCommonJS(chunk_EGMHOB43_exports);
54
55
  var import_signals_core = require("@preact/signals-core");
55
56
  var import_effect = require("effect");
56
57
  var import_live_object = require("@dxos/live-object");
57
58
  var import_util = require("@dxos/util");
59
+ var import_tracking = require("@preact-signals/safe-react/tracking");
58
60
  var import_react = __toESM(require("react"));
59
61
  var import_react_ui = require("@dxos/react-ui");
60
62
  var import_react_ui_theme = require("@dxos/react-ui-theme");
63
+ var import_tracking2 = require("@preact-signals/safe-react/tracking");
61
64
  var import_react_context = require("@radix-ui/react-context");
62
65
  var import_react_primitive = require("@radix-ui/react-primitive");
63
66
  var import_react_slot = require("@radix-ui/react-slot");
@@ -65,8 +68,12 @@ var import_react2 = __toESM(require("react"));
65
68
  var import_react_ui2 = require("@dxos/react-ui");
66
69
  var import_react_ui_theme2 = require("@dxos/react-ui-theme");
67
70
  var import_signals_core2 = require("@preact/signals-core");
71
+ var import_effect2 = require("effect");
72
+ var import_invariant = require("@dxos/invariant");
68
73
  var import_live_object2 = require("@dxos/live-object");
74
+ var import_tracking3 = require("@preact-signals/safe-react/tracking");
69
75
  var import_react_context2 = require("@radix-ui/react-context");
76
+ var import_effect3 = require("effect");
70
77
  var import_react3 = __toESM(require("react"));
71
78
  var import_react_ui3 = require("@dxos/react-ui");
72
79
  var ATTENDABLE_PATH_SEPARATOR = "~";
@@ -177,66 +184,86 @@ var getAttendables = (selector, cursor, acc = []) => {
177
184
  var attentionGlyphStyles = "inline-block rounded-sm is-3 bs-3 bg-transparent text-accentText transition-colors [[data-contains-attended=true]_&]:bg-attentionRelated [[data-attention=true]_&]:bg-accentSurface [[data-attention=true]_&]:text-accentSurfaceText [[aria-current][data-attention=true]_&]:bg-accentSurface [[aria-current][data-attention=true]_&]:text-accentSurfaceText";
178
185
  var presenceIconStyles = "is-3 bs-3 group-[[aria-current]_&:hover]/attentionGlyphButton:hidden group-[[aria-current]_&:focus]/attentionGlyphButton:hidden group-[[data-attention=true]_&:hover]/attentionGlyphButton:hidden group-[[data-attention=true]_&:focus]/attentionGlyphButton:hidden group-[[aria-current][data-attention=true]_&:hover]/attentionGlyphButton:hidden group-[[aria-current][data-attention=true]_&:focus]/attentionGlyphButton:hidden";
179
186
  var PresenceOne = () => {
180
- return /* @__PURE__ */ import_react.default.createElement("svg", {
181
- width: "12",
182
- height: "12",
183
- viewBox: "0 0 12 12",
184
- className: presenceIconStyles,
185
- fill: "none",
186
- xmlns: "http://www.w3.org/2000/svg"
187
- }, /* @__PURE__ */ import_react.default.createElement("circle", {
188
- cx: "6",
189
- cy: "6",
190
- r: "2.5",
191
- fill: "currentColor"
192
- }));
187
+ var _effect = (0, import_tracking.useSignals)();
188
+ try {
189
+ return /* @__PURE__ */ import_react.default.createElement("svg", {
190
+ width: "12",
191
+ height: "12",
192
+ viewBox: "0 0 12 12",
193
+ className: presenceIconStyles,
194
+ fill: "none",
195
+ xmlns: "http://www.w3.org/2000/svg"
196
+ }, /* @__PURE__ */ import_react.default.createElement("circle", {
197
+ cx: "6",
198
+ cy: "6",
199
+ r: "2.5",
200
+ fill: "currentColor"
201
+ }));
202
+ } finally {
203
+ _effect.f();
204
+ }
193
205
  };
194
206
  var PresenceMany = () => {
195
- return /* @__PURE__ */ import_react.default.createElement("svg", {
196
- width: "12",
197
- height: "12",
198
- viewBox: "0 0 12 12",
199
- className: presenceIconStyles,
200
- fill: "none",
201
- xmlns: "http://www.w3.org/2000/svg"
202
- }, /* @__PURE__ */ import_react.default.createElement("path", {
203
- 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",
204
- fill: "currentColor"
205
- }), /* @__PURE__ */ import_react.default.createElement("circle", {
206
- cx: "4.25",
207
- cy: "6",
208
- r: "2.5",
209
- fill: "currentColor"
210
- }));
207
+ var _effect = (0, import_tracking.useSignals)();
208
+ try {
209
+ return /* @__PURE__ */ import_react.default.createElement("svg", {
210
+ width: "12",
211
+ height: "12",
212
+ viewBox: "0 0 12 12",
213
+ className: presenceIconStyles,
214
+ fill: "none",
215
+ xmlns: "http://www.w3.org/2000/svg"
216
+ }, /* @__PURE__ */ import_react.default.createElement("path", {
217
+ 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",
218
+ fill: "currentColor"
219
+ }), /* @__PURE__ */ import_react.default.createElement("circle", {
220
+ cx: "4.25",
221
+ cy: "6",
222
+ r: "2.5",
223
+ fill: "currentColor"
224
+ }));
225
+ } finally {
226
+ _effect.f();
227
+ }
211
228
  };
212
229
  var Syncing = () => {
213
- const animationProps = (0, import_react.useMemo)(() => ({
214
- // Synchronize animations.
215
- animationDelay: `-${Date.now() % 2e3}ms`
216
- }), []);
217
- return /* @__PURE__ */ import_react.default.createElement("div", {
218
- role: "status",
219
- className: "flex items-center"
220
- }, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Icon, {
221
- icon: "ph--circle-notch--bold",
222
- size: 3,
223
- style: animationProps,
224
- classNames: "text-subdued animate-[spin_2s_linear_infinite]"
225
- }));
230
+ var _effect = (0, import_tracking.useSignals)();
231
+ try {
232
+ const animationProps = (0, import_react.useMemo)(() => ({
233
+ // Synchronize animations.
234
+ animationDelay: `-${Date.now() % 2e3}ms`
235
+ }), []);
236
+ return /* @__PURE__ */ import_react.default.createElement("div", {
237
+ role: "status",
238
+ className: "flex items-center"
239
+ }, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Icon, {
240
+ icon: "ph--circle-notch--bold",
241
+ size: 3,
242
+ style: animationProps,
243
+ classNames: "text-subdued animate-[spin_2s_linear_infinite]"
244
+ }));
245
+ } finally {
246
+ _effect.f();
247
+ }
226
248
  };
227
249
  var AttentionGlyph = /* @__PURE__ */ (0, import_react.forwardRef)(({ presence, attended, syncing, containsAttended, classNames, ...props }, forwardedRef) => {
228
- const icon = syncing ? /* @__PURE__ */ import_react.default.createElement(Syncing, null) : presence === "many" ? /* @__PURE__ */ import_react.default.createElement(PresenceMany, null) : presence === "one" ? /* @__PURE__ */ import_react.default.createElement(PresenceOne, null) : null;
229
- return /* @__PURE__ */ import_react.default.createElement("div", {
230
- role: "none",
231
- className: "flex",
232
- "data-attention": attended,
233
- "data-contains-attended": containsAttended
234
- }, /* @__PURE__ */ import_react.default.createElement("span", {
235
- role: "none",
236
- ...props,
237
- className: (0, import_react_ui_theme.mx)(attentionGlyphStyles, classNames),
238
- ref: forwardedRef
239
- }, icon));
250
+ var _effect = (0, import_tracking.useSignals)();
251
+ try {
252
+ const icon = syncing ? /* @__PURE__ */ import_react.default.createElement(Syncing, null) : presence === "many" ? /* @__PURE__ */ import_react.default.createElement(PresenceMany, null) : presence === "one" ? /* @__PURE__ */ import_react.default.createElement(PresenceOne, null) : null;
253
+ return /* @__PURE__ */ import_react.default.createElement("div", {
254
+ role: "none",
255
+ className: "flex",
256
+ "data-attention": attended,
257
+ "data-contains-attended": containsAttended
258
+ }, /* @__PURE__ */ import_react.default.createElement("span", {
259
+ role: "none",
260
+ ...props,
261
+ className: (0, import_react_ui_theme.mx)(attentionGlyphStyles, classNames),
262
+ ref: forwardedRef
263
+ }, icon));
264
+ } finally {
265
+ _effect.f();
266
+ }
240
267
  });
241
268
  var ATTENTION_NAME = "Attention";
242
269
  var ATTENABLE_ATTRIBUTE = "data-attendable-id";
@@ -285,53 +312,80 @@ var useAttentionPath = () => {
285
312
  return path;
286
313
  };
287
314
  var RootAttentionProvider = ({ children, attention: propsAttention, onChange }) => {
288
- const attention = (0, import_react_ui2.useDefaultValue)(propsAttention, () => new AttentionManager());
289
- const handleFocus = (event) => {
290
- const selector = [
291
- "[data-attendable-id]",
292
- ...Array.from(document.querySelectorAll("[aria-controls]")).map((el) => `[id="${el.getAttribute("aria-controls")}"]`)
293
- ].join(",");
294
- const prev = attention.current;
295
- const next = getAttendables(selector, event.target);
296
- if (next.length > 0 && (prev.length !== next.length || !!prev.find((id, index) => next[index] !== id))) {
297
- attention.update(next);
298
- onChange?.(next);
299
- }
300
- };
301
- return /* @__PURE__ */ import_react2.default.createElement(AttentionContextProvider, {
302
- attention,
303
- path: []
304
- }, /* @__PURE__ */ import_react2.default.createElement("div", {
305
- role: "none",
306
- className: "contents",
307
- onFocusCapture: handleFocus
308
- }, children));
315
+ var _effect = (0, import_tracking2.useSignals)();
316
+ try {
317
+ const attention = (0, import_react_ui2.useDefaultValue)(propsAttention, () => new AttentionManager());
318
+ const handleFocus = (event) => {
319
+ const selector = [
320
+ "[data-attendable-id]",
321
+ ...Array.from(document.querySelectorAll("[aria-controls]")).map((el) => `[id="${el.getAttribute("aria-controls")}"]`)
322
+ ].join(",");
323
+ const prev = attention.current;
324
+ const next = getAttendables(selector, event.target);
325
+ if (next.length > 0 && (prev.length !== next.length || !!prev.find((id, index) => next[index] !== id))) {
326
+ attention.update(next);
327
+ onChange?.(next);
328
+ }
329
+ };
330
+ return /* @__PURE__ */ import_react2.default.createElement(AttentionContextProvider, {
331
+ attention,
332
+ path: []
333
+ }, /* @__PURE__ */ import_react2.default.createElement("div", {
334
+ role: "none",
335
+ className: "contents",
336
+ onFocusCapture: handleFocus
337
+ }, children));
338
+ } finally {
339
+ _effect.f();
340
+ }
309
341
  };
310
342
  var AttentionProvider = ({ id, children }) => {
311
- const { attention, path } = useAttentionContext(ATTENTION_NAME);
312
- const nextPath = (0, import_react2.useMemo)(() => [
313
- id,
314
- ...path
315
- ], [
316
- id,
317
- path
318
- ]);
319
- return /* @__PURE__ */ import_react2.default.createElement(AttentionContextProvider, {
320
- attention,
321
- path: nextPath
322
- }, children);
343
+ var _effect = (0, import_tracking2.useSignals)();
344
+ try {
345
+ const { attention, path } = useAttentionContext(ATTENTION_NAME);
346
+ const nextPath = (0, import_react2.useMemo)(() => [
347
+ id,
348
+ ...path
349
+ ], [
350
+ id,
351
+ path
352
+ ]);
353
+ return /* @__PURE__ */ import_react2.default.createElement(AttentionContextProvider, {
354
+ attention,
355
+ path: nextPath
356
+ }, children);
357
+ } finally {
358
+ _effect.f();
359
+ }
323
360
  };
324
361
  var AttendableContainer = /* @__PURE__ */ (0, import_react2.forwardRef)(({ id, classNames, children, asChild, ...props }, forwardedRef) => {
325
- const attendableAttrs = useAttendableAttributes(id);
326
- const Root = asChild ? import_react_slot.Slot : import_react_primitive.Primitive.div;
327
- return /* @__PURE__ */ import_react2.default.createElement(Root, {
328
- role: "none",
329
- ...attendableAttrs,
330
- ...props,
331
- className: (0, import_react_ui_theme2.mx)("attention-surface", props.tabIndex === 0 && "dx-focus-ring-inset-over-all", classNames),
332
- ref: forwardedRef
333
- }, children);
362
+ var _effect = (0, import_tracking2.useSignals)();
363
+ try {
364
+ const attendableAttrs = useAttendableAttributes(id);
365
+ const Root = asChild ? import_react_slot.Slot : import_react_primitive.Primitive.div;
366
+ return /* @__PURE__ */ import_react2.default.createElement(Root, {
367
+ role: "none",
368
+ ...attendableAttrs,
369
+ ...props,
370
+ className: (0, import_react_ui_theme2.mx)("attention-surface", props.tabIndex === 0 && "dx-focus-ring-inset-over-all", classNames),
371
+ ref: forwardedRef
372
+ }, children);
373
+ } finally {
374
+ _effect.f();
375
+ }
334
376
  });
377
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-attention/src/selection.ts";
378
+ var defaultSelection = import_effect2.Match.type().pipe(import_effect2.Match.when("single", () => ({
379
+ mode: "single"
380
+ })), import_effect2.Match.when("multi", () => ({
381
+ mode: "multi",
382
+ ids: []
383
+ })), import_effect2.Match.when("range", () => ({
384
+ mode: "range"
385
+ })), import_effect2.Match.when("multi-range", () => ({
386
+ mode: "multi-range",
387
+ ranges: []
388
+ })), import_effect2.Match.exhaustive);
335
389
  var SelectionManager = class {
336
390
  constructor(initial = {}) {
337
391
  this._state = (0, import_live_object2.live)({
@@ -343,34 +397,126 @@ var SelectionManager = class {
343
397
  });
344
398
  }
345
399
  }
346
- get selections() {
347
- return this._state.selections;
400
+ getSelection(contextId, mode = void 0) {
401
+ const selection = (0, import_signals_core2.untracked)(() => this._state.selections[contextId]);
402
+ if (!mode || selection) {
403
+ return selection;
404
+ }
405
+ return (0, import_signals_core2.untracked)(() => {
406
+ this._state.selections[contextId] = defaultSelection(mode);
407
+ return this._state.selections[contextId];
408
+ });
348
409
  }
349
- getSelection(contextId) {
350
- if (!this.selections[contextId]) {
351
- (0, import_signals_core2.untracked)(() => {
352
- this._state.selections[contextId] = /* @__PURE__ */ new Set();
410
+ getSelected(contextId, mode = "multi") {
411
+ const selection = this.getSelection(contextId, mode);
412
+ (0, import_invariant.invariant)(selection?.mode === mode, "Selection mode mismatch", {
413
+ F: __dxlog_file,
414
+ L: 70,
415
+ S: this,
416
+ A: [
417
+ "selection?.mode === mode",
418
+ "'Selection mode mismatch'"
419
+ ]
420
+ });
421
+ return import_effect2.Match.type().pipe(import_effect2.Match.when({
422
+ mode: "single"
423
+ }, (s) => s.id), import_effect2.Match.when({
424
+ mode: "multi"
425
+ }, (s) => s.ids), import_effect2.Match.when({
426
+ mode: "range"
427
+ }, (s) => s.from && s.to ? {
428
+ from: s.from,
429
+ to: s.to
430
+ } : void 0), import_effect2.Match.when({
431
+ mode: "multi-range"
432
+ }, (s) => s.ranges), import_effect2.Match.exhaustive)(selection);
433
+ }
434
+ updateSingle(contextId, id) {
435
+ (0, import_signals_core2.untracked)(() => {
436
+ const selection = this.getSelection(contextId, "single");
437
+ (0, import_invariant.invariant)(selection?.mode === "single", "Selection mode is not single", {
438
+ F: __dxlog_file,
439
+ L: 83,
440
+ S: this,
441
+ A: [
442
+ "selection?.mode === 'single'",
443
+ "'Selection mode is not single'"
444
+ ]
353
445
  });
354
- }
355
- return this.selections[contextId];
446
+ selection.id = id;
447
+ });
356
448
  }
357
- updateSelection(contextId, selectedIds) {
449
+ updateMulti(contextId, ids) {
358
450
  (0, import_signals_core2.untracked)(() => {
359
- this._state.selections[contextId] = selectedIds instanceof Set ? selectedIds : new Set(selectedIds);
451
+ const selection = this.getSelection(contextId, "multi");
452
+ (0, import_invariant.invariant)(selection?.mode === "multi", "Selection mode is not multi", {
453
+ F: __dxlog_file,
454
+ L: 91,
455
+ S: this,
456
+ A: [
457
+ "selection?.mode === 'multi'",
458
+ "'Selection mode is not multi'"
459
+ ]
460
+ });
461
+ selection.ids = ids;
462
+ });
463
+ }
464
+ updateRange(contextId, from, to) {
465
+ (0, import_signals_core2.untracked)(() => {
466
+ const selection = this.getSelection(contextId, "range");
467
+ (0, import_invariant.invariant)(selection?.mode === "range", "Selection mode is not range", {
468
+ F: __dxlog_file,
469
+ L: 99,
470
+ S: this,
471
+ A: [
472
+ "selection?.mode === 'range'",
473
+ "'Selection mode is not range'"
474
+ ]
475
+ });
476
+ selection.from = from;
477
+ selection.to = to;
478
+ });
479
+ }
480
+ updateMultiRange(contextId, ranges) {
481
+ (0, import_signals_core2.untracked)(() => {
482
+ const selection = this.getSelection(contextId, "multi-range");
483
+ (0, import_invariant.invariant)(selection?.mode === "multi-range", "Selection mode is not multi-range", {
484
+ F: __dxlog_file,
485
+ L: 108,
486
+ S: this,
487
+ A: [
488
+ "selection?.mode === 'multi-range'",
489
+ "'Selection mode is not multi-range'"
490
+ ]
491
+ });
492
+ selection.ranges = ranges;
360
493
  });
361
494
  }
362
495
  clearSelection(contextId) {
363
496
  (0, import_signals_core2.untracked)(() => {
364
- this._state.selections[contextId] = /* @__PURE__ */ new Set();
497
+ const selection = this.getSelection(contextId);
498
+ if (selection) {
499
+ this._state.selections[contextId] = defaultSelection(selection.mode);
500
+ }
365
501
  });
366
502
  }
367
503
  toggleSelection(contextId, id) {
368
504
  (0, import_signals_core2.untracked)(() => {
369
- const current = this.getSelection(contextId);
370
- if (current.has(id)) {
371
- current.delete(id);
505
+ const selection = this.getSelection(contextId, "multi");
506
+ (0, import_invariant.invariant)(selection?.mode === "multi", "Selection mode is not multi", {
507
+ F: __dxlog_file,
508
+ L: 125,
509
+ S: this,
510
+ A: [
511
+ "selection?.mode === 'multi'",
512
+ "'Selection mode is not multi'"
513
+ ]
514
+ });
515
+ if (selection.ids.includes(id)) {
516
+ const index = selection.ids.indexOf(id);
517
+ selection.ids.splice(index, 1);
372
518
  } else {
373
- current.add(id);
519
+ selection.ids.push(id);
374
520
  }
375
521
  });
376
522
  }
@@ -380,24 +526,58 @@ var [SelectionContextProvider, useSelectionContext] = (0, import_react_context2.
380
526
  selection: new SelectionManager()
381
527
  });
382
528
  var SelectionProvider = ({ children, selection: propsSelection }) => {
383
- const selection = (0, import_react_ui3.useDefaultValue)(propsSelection, () => new SelectionManager());
384
- return /* @__PURE__ */ import_react3.default.createElement(SelectionContextProvider, {
385
- selection
386
- }, children);
529
+ var _effect = (0, import_tracking3.useSignals)();
530
+ try {
531
+ const selection = (0, import_react_ui3.useDefaultValue)(propsSelection, () => new SelectionManager());
532
+ return /* @__PURE__ */ import_react3.default.createElement(SelectionContextProvider, {
533
+ selection
534
+ }, children);
535
+ } finally {
536
+ _effect.f();
537
+ }
387
538
  };
388
- var emptySet = /* @__PURE__ */ new Set();
389
- var useSelectedItems = (contextId) => {
539
+ var useSelected = (contextId, mode = "multi") => {
390
540
  const { selection } = useSelectionContext(SELECTION_NAME);
391
- return contextId ? selection.getSelection(contextId) : emptySet;
541
+ if (contextId) {
542
+ return selection.getSelected(contextId, mode);
543
+ }
544
+ return import_effect3.Match.type().pipe(import_effect3.Match.when({
545
+ mode: "single"
546
+ }, (s) => s.id), import_effect3.Match.when({
547
+ mode: "multi"
548
+ }, (s) => s.ids), import_effect3.Match.when({
549
+ mode: "range"
550
+ }, (s) => s.from && s.to ? {
551
+ from: s.from,
552
+ to: s.to
553
+ } : void 0), import_effect3.Match.when({
554
+ mode: "multi-range"
555
+ }, (s) => s.ranges), import_effect3.Match.exhaustive)(defaultSelection(mode));
392
556
  };
393
- var useSelectionActions = (contextIds) => {
557
+ var useSelectionActions = (contextIds, mode = "multi") => {
394
558
  const stableContextIds = (0, import_react3.useMemo)(() => contextIds, [
395
559
  JSON.stringify(contextIds)
396
560
  ]);
397
561
  const { selection } = useSelectionContext(SELECTION_NAME);
398
- const select = (0, import_react3.useCallback)((ids) => {
562
+ const singleSelect = (0, import_react3.useCallback)((id) => {
563
+ for (const contextId of stableContextIds) {
564
+ selection.updateSingle(contextId, id);
565
+ }
566
+ }, [
567
+ selection,
568
+ stableContextIds
569
+ ]);
570
+ const multiSelect = (0, import_react3.useCallback)((ids) => {
571
+ for (const contextId of stableContextIds) {
572
+ selection.updateMulti(contextId, ids);
573
+ }
574
+ }, [
575
+ selection,
576
+ stableContextIds
577
+ ]);
578
+ const rangeSelect = (0, import_react3.useCallback)((from, to) => {
399
579
  for (const contextId of stableContextIds) {
400
- selection.updateSelection(contextId, ids);
580
+ selection.updateRange(contextId, from, to);
401
581
  }
402
582
  }, [
403
583
  selection,
@@ -420,7 +600,9 @@ var useSelectionActions = (contextIds) => {
420
600
  stableContextIds
421
601
  ]);
422
602
  return {
423
- select,
603
+ singleSelect,
604
+ multiSelect,
605
+ rangeSelect,
424
606
  toggle,
425
607
  clear
426
608
  };
@@ -440,13 +622,14 @@ var useSelectionActions = (contextIds) => {
440
622
  SelectionManager,
441
623
  SelectionProvider,
442
624
  Syncing,
625
+ defaultSelection,
443
626
  getAttendables,
444
627
  useAttendableAttributes,
445
628
  useAttended,
446
629
  useAttention,
447
630
  useAttentionContext,
448
631
  useAttentionPath,
449
- useSelectedItems,
632
+ useSelected,
450
633
  useSelectionActions
451
634
  });
452
- //# sourceMappingURL=chunk-KMRU4W67.cjs.map
635
+ //# sourceMappingURL=chunk-EGMHOB43.cjs.map