sheer-ui 0.4.0 → 0.4.2

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 (55) hide show
  1. package/package.json +1 -1
  2. package/src/lib/components/accordion/components/accordion-item.svelte +3 -3
  3. package/src/lib/components/accordion/components/accordion.svelte +29 -13
  4. package/src/lib/components/accordion/types.ts +3 -3
  5. package/src/lib/components/checkbox/components/checkbox-group.svelte +7 -5
  6. package/src/lib/components/checkbox/components/checkbox.svelte +12 -8
  7. package/src/lib/components/combobox/components/combobox.svelte +2 -2
  8. package/src/lib/components/combobox/select/components/select.svelte +2 -2
  9. package/src/lib/components/context-menu/components/context-menu-trigger.svelte +1 -1
  10. package/src/lib/components/date-field/date-field.svelte.ts +2 -3
  11. package/src/lib/components/menu/components/menu-checkbox-group.svelte +6 -4
  12. package/src/lib/components/menu/components/menu-checkbox-item.svelte +11 -7
  13. package/src/lib/components/menu/menu.svelte.ts +9 -18
  14. package/src/lib/components/menubar/menubar.svelte.ts +7 -6
  15. package/src/lib/components/navigation-menu/components/navigation-menu-content.svelte +1 -1
  16. package/src/lib/components/navigation-menu/components/navigation-menu-indicator.svelte +2 -2
  17. package/src/lib/components/navigation-menu/components/navigation-menu-trigger.svelte +1 -1
  18. package/src/lib/components/navigation-menu/navigation-menu.svelte.ts +57 -60
  19. package/src/lib/components/pagination/components/pagination-next-button.svelte +12 -7
  20. package/src/lib/components/pagination/components/pagination-page.svelte +15 -8
  21. package/src/lib/components/pagination/components/pagination-prev-button.svelte +12 -7
  22. package/src/lib/components/pagination/components/pagination.svelte +31 -18
  23. package/src/lib/components/pagination/pagination.svelte.ts +48 -64
  24. package/src/lib/components/pin-input/pin-input.svelte.ts +7 -8
  25. package/src/lib/components/pin-input/usePasswordManager.svelte.ts +2 -2
  26. package/src/lib/components/scroll-area/scroll-area.svelte.ts +9 -10
  27. package/src/lib/components/slider/components/slider.svelte +2 -1
  28. package/src/lib/components/tabs/components/tabs-content.svelte +12 -7
  29. package/src/lib/components/tabs/components/tabs-list.svelte +9 -6
  30. package/src/lib/components/tabs/components/tabs-trigger.svelte +15 -8
  31. package/src/lib/components/tabs/components/tabs.svelte +28 -17
  32. package/src/lib/components/tabs/tabs.svelte.ts +51 -67
  33. package/src/lib/components/time-field/time-field.svelte.ts +2 -2
  34. package/src/lib/components/toggle-group/components/toggle-group-item.svelte +15 -8
  35. package/src/lib/components/toggle-group/components/toggle-group.svelte +28 -16
  36. package/src/lib/components/toggle-group/toggle-group.svelte.ts +33 -35
  37. package/src/lib/components/toolbar/components/toolbar-group-item.svelte +15 -8
  38. package/src/lib/components/toolbar/components/toolbar-group.svelte +19 -14
  39. package/src/lib/components/toolbar/toolbar.svelte.ts +28 -30
  40. package/src/lib/components/tooltip/tooltip.svelte.ts +6 -27
  41. package/src/lib/internal/dismissible-layer/use-dismissable-layer.svelte.ts +3 -4
  42. package/src/lib/internal/floating-layer/use-floating-layer.svelte.ts +26 -30
  43. package/src/lib/internal/{roving-focus-group.ts → roving-focus-group.svelte.ts} +17 -19
  44. package/src/lib/internal/roving-focus-item.svelte.ts +12 -17
  45. package/src/lib/internal/selection.svelte.ts +55 -41
  46. package/src/lib/internal/{state-machine.ts → state-machine.svelte.ts} +6 -8
  47. package/src/lib/internal/timeout-fn.svelte.ts +6 -4
  48. package/src/lib/internal/tools/box.svelte.ts +5 -114
  49. package/src/lib/internal/tools/index.ts +1 -11
  50. package/src/lib/internal/tools/types.ts +0 -3
  51. package/src/lib/internal/typeahead.svelte.ts +9 -13
  52. package/src/lib/internal/types.ts +6 -0
  53. package/src/lib/internal/vaul/use-drawer-content.svelte.ts +2 -2
  54. package/src/lib/internal/vaul/use-drawer-root.svelte.ts +12 -7
  55. package/src/lib/components/accordion/accordion.svelte.ts +0 -43
@@ -4,20 +4,16 @@
4
4
  */
5
5
  import {
6
6
  type AnyFn,
7
- type ReadableBox,
8
7
  type ReadableBoxedValues,
9
8
  type WithRefProps,
10
- type WritableBox,
11
9
  type WritableBoxedValues,
12
10
  attachRef,
13
- boxAutoReset,
14
11
  DOMContext,
15
12
  getWindow,
16
- simpleBox,
17
13
  boxWith,
18
14
  } from '../../internal/tools/index.js';
19
15
  import { createEffectTimeout } from '../../internal/timeout-fn.svelte.js';
20
- import { createContext, tick, untrack, type Snippet } from 'svelte';
16
+ import { createContext, tick, untrack } from 'svelte';
21
17
  import { SvelteMap } from 'svelte/reactivity';
22
18
  import { type Direction, type Orientation } from '../../internal/index.js';
23
19
  import { createId } from '../../internal/create-id.js';
@@ -29,7 +25,7 @@ import { kbd } from '../../internal/kbd.js';
29
25
  import { on } from 'svelte/events';
30
26
  import { isElement } from '../../internal/tools/utils/dom.js';
31
27
  import type { FocusEventHandler, KeyboardEventHandler, MouseEventHandler, PointerEventHandler } from 'svelte/elements';
32
- import { RovingFocusGroup } from '../../internal/roving-focus-group.js';
28
+ import { RovingFocusGroup } from '../../internal/roving-focus-group.svelte.js';
33
29
  import { observeResizeMany } from '../../internal/svelte-resize-observer.svelte.js';
34
30
 
35
31
  const navigationMenuAttrs = createBitsAttrs({
@@ -79,8 +75,8 @@ class NavigationMenuProviderState {
79
75
  return setNavigationMenuProvider(new NavigationMenuProviderState(opts));
80
76
  }
81
77
  readonly opts: NavigationMenuProviderStateOpts;
82
- indicatorTrackRef = simpleBox<HTMLElement | null>(null);
83
- viewportRef = simpleBox<HTMLElement | null>(null);
78
+ indicatorTrackRef = $state.raw<HTMLElement | null>(null);
79
+ viewportRef = $state.raw<HTMLElement | null>(null);
84
80
  viewportContent = new SvelteMap<string, NavigationMenuItemState>();
85
81
  onTriggerEnter: NavigationMenuProviderStateOpts['onTriggerEnter'];
86
82
  onTriggerLeave: () => void = () => {};
@@ -126,29 +122,27 @@ export class NavigationMenuRootState {
126
122
  readonly opts: NavigationMenuRootStateOpts;
127
123
  readonly attachment: RefAttachment;
128
124
  provider: NavigationMenuProviderState;
129
- previousValue = simpleBox('');
130
- isDelaySkipped: WritableBox<boolean>;
125
+ previousValue = $state.raw('');
126
+ // False from an open until skipDelayDuration after the close: a hover in that window skips delayDuration.
127
+ #isOpenDelayed = $state(true);
128
+ readonly #skipDelayTimer: ReturnType<typeof createEffectTimeout<() => void>>;
131
129
  readonly #derivedDelay = $derived.by(() => {
132
130
  const isOpen = this.opts?.value?.current !== '';
133
- if (isOpen || this.isDelaySkipped.current) {
134
- // 150 for user to switch trigger or move into content view
135
- return 150;
136
- } else {
137
- return this.opts.delayDuration.current;
138
- }
131
+ // 150ms while open or in the skip window: room to switch trigger or move into the content.
132
+ return isOpen || !this.#isOpenDelayed ? 150 : this.opts.delayDuration.current;
139
133
  });
140
134
 
141
135
  constructor(opts: NavigationMenuRootStateOpts) {
142
136
  this.opts = opts;
143
137
  this.attachment = attachRef(this.opts.ref);
144
- this.isDelaySkipped = boxAutoReset(false, {
145
- afterMs: this.opts.skipDelayDuration.current,
146
- getWindow: () => getWindow(opts.ref.current),
147
- });
138
+ this.#skipDelayTimer = createEffectTimeout(
139
+ () => (this.#isOpenDelayed = true),
140
+ () => this.opts.skipDelayDuration.current,
141
+ );
148
142
 
149
143
  this.provider = NavigationMenuProviderState.create({
150
144
  value: this.opts.value,
151
- previousValue: this.previousValue,
145
+ previousValue: boxWith(() => this.previousValue, (v) => (this.previousValue = v)),
152
146
  dir: this.opts.dir,
153
147
  orientation: this.opts.orientation,
154
148
  rootNavigationMenuRef: this.opts.ref,
@@ -179,7 +173,6 @@ export class NavigationMenuRootState {
179
173
  };
180
174
 
181
175
  #onTriggerLeave = () => {
182
- this.isDelaySkipped.current = false;
183
176
  this.#debouncedFn.start('', null);
184
177
  };
185
178
 
@@ -203,14 +196,19 @@ export class NavigationMenuRootState {
203
196
  };
204
197
 
205
198
  setValue = (newValue: string, itemState: NavigationMenuItemState | null) => {
206
- this.previousValue.current = this.opts.value.current;
199
+ this.previousValue = this.opts.value.current;
207
200
  this.opts.value.current = newValue;
208
201
  this.provider.setActiveItem(itemState);
209
202
 
210
203
  // When all menus are closed, we want to reset previousValue to prevent
211
204
  // weird transitions from old positions when opening fresh
212
205
  if (newValue === '') {
213
- this.previousValue.current = '';
206
+ this.previousValue = '';
207
+ if (this.opts.skipDelayDuration.current === 0) this.#isOpenDelayed = true;
208
+ else this.#skipDelayTimer.start();
209
+ } else {
210
+ this.#skipDelayTimer.stop();
211
+ this.#isOpenDelayed = false;
214
212
  }
215
213
  };
216
214
 
@@ -243,7 +241,7 @@ export class NavigationMenuSubState {
243
241
  }
244
242
  readonly opts: NavigationMenuSubStateOpts;
245
243
  readonly context: NavigationMenuProviderState;
246
- previousValue = simpleBox('');
244
+ previousValue = $state.raw('');
247
245
  readonly subProvider: NavigationMenuProviderState;
248
246
  readonly attachment: RefAttachment;
249
247
 
@@ -261,19 +259,19 @@ export class NavigationMenuSubState {
261
259
  onTriggerEnter: this.setValue,
262
260
  onItemSelect: this.setValue,
263
261
  onItemDismiss: () => this.setValue('', null),
264
- previousValue: this.previousValue,
262
+ previousValue: boxWith(() => this.previousValue, (v) => (this.previousValue = v)),
265
263
  });
266
264
  }
267
265
 
268
266
  setValue = (newValue: string, itemState: NavigationMenuItemState | null) => {
269
- this.previousValue.current = this.opts.value.current;
267
+ this.previousValue = this.opts.value.current;
270
268
  this.opts.value.current = newValue;
271
269
  this.subProvider.setActiveItem(itemState);
272
270
 
273
271
  // When all menus are closed, we want to reset previousValue to prevent
274
272
  // weird transitions from old positions when opening fresh
275
273
  if (newValue === '') {
276
- this.previousValue.current = '';
274
+ this.previousValue = '';
277
275
  }
278
276
  };
279
277
 
@@ -295,12 +293,11 @@ export class NavigationMenuListState {
295
293
  static create(opts: NavigationMenuListStateOpts) {
296
294
  return setNavigationMenuList(new NavigationMenuListState(opts, getNavigationMenuProvider()));
297
295
  }
298
- wrapperId = simpleBox('');
299
- wrapperRef = simpleBox<HTMLElement | null>(null);
296
+ readonly wrapperId: string;
300
297
  readonly opts: NavigationMenuListStateOpts;
301
298
  readonly context: NavigationMenuProviderState;
302
299
  readonly attachment: RefAttachment;
303
- readonly wrapperAttachment: RefAttachment = attachRef(this.wrapperRef, (v) => (this.context.indicatorTrackRef.current = v));
300
+ readonly wrapperAttachment: RefAttachment = attachRef((v) => (this.context.indicatorTrackRef = v));
304
301
  listTriggers = $state.raw<HTMLElement[]>([]);
305
302
  readonly rovingFocusGroup: RovingFocusGroup;
306
303
  wrapperMounted = $state(false);
@@ -308,13 +305,13 @@ export class NavigationMenuListState {
308
305
  constructor(opts: NavigationMenuListStateOpts, context: NavigationMenuProviderState) {
309
306
  this.opts = opts;
310
307
  this.context = context;
311
- this.wrapperId.current = createId('wrapper', opts.id.current);
308
+ this.wrapperId = createId('wrapper', opts.id.current);
312
309
  this.attachment = attachRef(this.opts.ref);
313
310
  this.rovingFocusGroup = new RovingFocusGroup({
314
- rootNode: opts.ref,
311
+ rootNode: () => opts.ref.current,
315
312
  candidateSelector: `${navigationMenuAttrs.selector('trigger')}:not([data-disabled]), ${navigationMenuAttrs.selector('link')}:not([data-disabled])`,
316
- loop: boxWith(() => false),
317
- orientation: this.context.opts.orientation,
313
+ loop: () => false,
314
+ orientation: () => this.context.opts.orientation.current,
318
315
  });
319
316
  }
320
317
 
@@ -328,7 +325,7 @@ export class NavigationMenuListState {
328
325
  readonly wrapperProps = $derived.by(
329
326
  () =>
330
327
  ({
331
- id: this.wrapperId.current,
328
+ id: this.wrapperId,
332
329
  ...this.wrapperAttachment,
333
330
  }) as const,
334
331
  );
@@ -366,9 +363,6 @@ export class NavigationMenuItemState {
366
363
  wasEscapeClose = false;
367
364
  readonly contentId = $derived.by(() => this.contentNode?.id);
368
365
  readonly triggerId = $derived.by(() => this.triggerNode?.id);
369
- contentChildren: ReadableBox<Snippet | undefined> = simpleBox(undefined);
370
- contentChild: ReadableBox<Snippet<[{ props: Record<string, unknown> }]> | undefined> = simpleBox(undefined);
371
- contentProps: ReadableBox<Record<string, unknown>> = simpleBox({});
372
366
  domContext: DOMContext;
373
367
  constructor(opts: NavigationMenuItemStateOpts, listContext: NavigationMenuListState) {
374
368
  this.opts = opts;
@@ -423,13 +417,13 @@ export class NavigationMenuTriggerState {
423
417
  }
424
418
  readonly opts: NavigationMenuTriggerStateOpts;
425
419
  readonly attachment: RefAttachment;
426
- focusProxyId = simpleBox('');
427
- focusProxyRef = simpleBox<HTMLElement | null>(null);
428
- readonly focusProxyAttachment: RefAttachment = attachRef(this.focusProxyRef, (v) => (this.itemContext.focusProxyNode = v));
420
+ readonly focusProxyId: string;
421
+ readonly focusProxyAttachment: RefAttachment = attachRef((v) => (this.itemContext.focusProxyNode = v));
429
422
  context: NavigationMenuProviderState;
430
423
  itemContext: NavigationMenuItemState;
431
424
  listContext: NavigationMenuListState;
432
- hasPointerMoveOpened = simpleBox(false);
425
+ #hasPointerMoveOpened = false;
426
+ readonly #pointerMoveResetTimer: ReturnType<typeof createEffectTimeout<() => void>>;
433
427
  wasClickClose = false;
434
428
  focusProxyMounted = $state(false);
435
429
  readonly open = $derived.by(() => this.itemContext.opts.value.current === this.context.opts.value.current);
@@ -444,12 +438,13 @@ export class NavigationMenuTriggerState {
444
438
  },
445
439
  ) {
446
440
  this.opts = opts;
447
- this.focusProxyId.current = createId('focus-proxy', opts.id.current);
441
+ this.focusProxyId = createId('focus-proxy', opts.id.current);
448
442
  this.attachment = attachRef(this.opts.ref, (v) => (this.itemContext.triggerNode = v));
449
- this.hasPointerMoveOpened = boxAutoReset(false, {
450
- afterMs: 300,
451
- getWindow: () => getWindow(opts.ref.current),
452
- });
443
+ this.#pointerMoveResetTimer = createEffectTimeout(
444
+ () => (this.#hasPointerMoveOpened = false),
445
+ () => 300,
446
+ () => getWindow(opts.ref.current),
447
+ );
453
448
  this.context = context.provider;
454
449
  this.itemContext = context.item;
455
450
  this.listContext = context.list;
@@ -474,24 +469,26 @@ export class NavigationMenuTriggerState {
474
469
  this.opts.disabled.current ||
475
470
  this.wasClickClose ||
476
471
  this.itemContext.wasEscapeClose ||
477
- this.hasPointerMoveOpened.current ||
472
+ this.#hasPointerMoveOpened ||
478
473
  !this.itemContext.opts.openOnHover.current
479
474
  ) {
480
475
  return;
481
476
  }
482
477
  this.context.onTriggerEnter(this.itemContext.opts.value.current, this.itemContext);
483
- this.hasPointerMoveOpened.current = true;
478
+ this.#hasPointerMoveOpened = true;
479
+ this.#pointerMoveResetTimer.start();
484
480
  });
485
481
 
486
482
  onpointerleave = whenMouse(() => {
487
483
  if (this.opts.disabled.current || !this.itemContext.opts.openOnHover.current) return;
488
484
  this.context.onTriggerLeave();
489
- this.hasPointerMoveOpened.current = false;
485
+ this.#hasPointerMoveOpened = false;
486
+ this.#pointerMoveResetTimer.stop();
490
487
  });
491
488
 
492
489
  onclick: MouseEventHandler<HTMLButtonElement> = () => {
493
490
  // if opened via pointer move, we prevent the click event
494
- if (this.hasPointerMoveOpened.current) return;
491
+ if (this.#hasPointerMoveOpened) return;
495
492
  const shouldClose = this.open && (!this.itemContext.opts.openOnHover.current || this.context.opts.isRootMenu);
496
493
  if (shouldClose) {
497
494
  this.context.onItemSelect('', null);
@@ -547,7 +544,7 @@ export class NavigationMenuTriggerState {
547
544
  readonly focusProxyProps = $derived.by(
548
545
  () =>
549
546
  ({
550
- id: this.focusProxyId.current,
547
+ id: this.focusProxyId,
551
548
  tabindex: 0,
552
549
  onfocus: this.focusProxyOnFocus,
553
550
  ...this.focusProxyAttachment,
@@ -692,7 +689,7 @@ export class NavigationMenuIndicatorImplState {
692
689
  this.listContext = context.list;
693
690
  this.attachment = attachRef(this.opts.ref);
694
691
 
695
- observeResizeMany(() => [this.activeTrigger, this.context.indicatorTrackRef.current], this.handlePositionChange);
692
+ observeResizeMany(() => [this.activeTrigger, this.context.indicatorTrackRef], this.handlePositionChange);
696
693
  }
697
694
 
698
695
  handlePositionChange = () => {
@@ -846,10 +843,10 @@ export class NavigationMenuContentImplState {
846
843
  this.context = itemContext.listContext.context;
847
844
  this.domContext = new DOMContext(opts.ref);
848
845
  this.rovingFocusGroup = new RovingFocusGroup({
849
- rootNode: this.opts.ref,
846
+ rootNode: () => this.opts.ref.current,
850
847
  candidateNodes: getTabbableCandidates,
851
- loop: boxWith(() => false),
852
- orientation: this.context.opts.orientation,
848
+ loop: () => false,
849
+ orientation: () => this.context.opts.orientation.current,
853
850
  });
854
851
 
855
852
  $effect(() => {
@@ -886,7 +883,7 @@ export class NavigationMenuContentImplState {
886
883
  onInteractOutside = (e: PointerEvent) => {
887
884
  const target = e.target as HTMLElement;
888
885
  const isTrigger = this.listContext.listTriggers.some((trigger) => trigger.contains(target));
889
- const isRootViewport = this.context.opts.isRootMenu && this.context.viewportRef.current?.contains(target);
886
+ const isRootViewport = this.context.opts.isRootMenu && this.context.viewportRef?.contains(target);
890
887
  if (!this.context.opts.isRootMenu && !isTrigger) {
891
888
  this.context.onItemDismiss();
892
889
  return;
@@ -988,14 +985,14 @@ export class NavigationMenuViewportState {
988
985
  constructor(opts: NavigationMenuViewportStateOpts, context: NavigationMenuProviderState) {
989
986
  this.opts = opts;
990
987
  this.context = context;
991
- this.attachment = attachRef(this.opts.ref, (v) => (this.context.viewportRef.current = v));
988
+ this.attachment = attachRef(this.opts.ref, (v) => (this.context.viewportRef = v));
992
989
 
993
990
  $effect(() => {
994
991
  const _activeContentValue = this.activeContentValue;
995
992
  const _open = this.open;
996
993
  untrack(() => {
997
994
  tick().then(() => {
998
- const currNode = this.context.viewportRef.current;
995
+ const currNode = this.context.viewportRef;
999
996
  if (!currNode) return;
1000
997
  const el = (currNode.querySelector<HTMLElement>('[data-state=open]')?.children?.[0] as HTMLElement | null) ?? null;
1001
998
 
@@ -1,5 +1,4 @@
1
1
  <script lang="ts">
2
- import { boxWith } from '../../../internal/tools/index.js';
3
2
  import { mergeProps } from '../../../internal/merge-props.js';
4
3
  import type { PaginationNextButtonProps } from '../types.js';
5
4
  import { PaginationButtonState } from '../pagination.svelte.js';
@@ -21,12 +20,18 @@
21
20
 
22
21
  const nextButtonState = PaginationButtonState.create({
23
22
  type: 'next',
24
- id: boxWith(() => id),
25
- ref: boxWith(
26
- () => ref,
27
- (v) => (ref = v),
28
- ),
29
- disabled: boxWith(() => Boolean(disabled)),
23
+ get id() {
24
+ return id;
25
+ },
26
+ get disabled() {
27
+ return Boolean(disabled);
28
+ },
29
+ get ref() {
30
+ return ref;
31
+ },
32
+ set ref(v) {
33
+ ref = v;
34
+ },
30
35
  });
31
36
 
32
37
  const mergedProps = $derived(
@@ -1,5 +1,4 @@
1
1
  <script lang="ts">
2
- import { boxWith } from '../../../internal/tools/index.js';
3
2
  import { mergeProps } from '../../../internal/merge-props.js';
4
3
  import type { PaginationPageProps } from '../types.js';
5
4
  import { PaginationPageState } from '../pagination.svelte.js';
@@ -25,13 +24,21 @@
25
24
  } = $props();
26
25
 
27
26
  const pageState = PaginationPageState.create({
28
- id: boxWith(() => id),
29
- page: boxWith(() => page),
30
- ref: boxWith(
31
- () => ref,
32
- (v) => (ref = v),
33
- ),
34
- disabled: boxWith(() => Boolean(disabled)),
27
+ get id() {
28
+ return id;
29
+ },
30
+ get page() {
31
+ return page;
32
+ },
33
+ get disabled() {
34
+ return Boolean(disabled);
35
+ },
36
+ get ref() {
37
+ return ref;
38
+ },
39
+ set ref(v) {
40
+ ref = v;
41
+ },
35
42
  });
36
43
 
37
44
  const mergedProps = $derived(
@@ -1,5 +1,4 @@
1
1
  <script lang="ts">
2
- import { boxWith } from '../../../internal/tools/index.js';
3
2
  import { mergeProps } from '../../../internal/merge-props.js';
4
3
  import type { PaginationPrevButtonProps } from '../types.js';
5
4
  import { PaginationButtonState } from '../pagination.svelte.js';
@@ -21,12 +20,18 @@
21
20
 
22
21
  const prevButtonState = PaginationButtonState.create({
23
22
  type: 'prev',
24
- id: boxWith(() => id),
25
- ref: boxWith(
26
- () => ref,
27
- (v) => (ref = v),
28
- ),
29
- disabled: boxWith(() => Boolean(disabled)),
23
+ get id() {
24
+ return id;
25
+ },
26
+ get disabled() {
27
+ return Boolean(disabled);
28
+ },
29
+ get ref() {
30
+ return ref;
31
+ },
32
+ set ref(v) {
33
+ ref = v;
34
+ },
30
35
  });
31
36
 
32
37
  const mergedProps = $derived(
@@ -1,5 +1,4 @@
1
1
  <script lang="ts">
2
- import { boxWith } from '../../../internal/tools/index.js';
3
2
  import { mergeProps } from '../../../internal/merge-props.js';
4
3
  import type { PaginationRootProps } from '../types.js';
5
4
  import { PaginationRootState } from '../pagination.svelte.js';
@@ -23,23 +22,37 @@
23
22
  }: PaginationRootProps = $props();
24
23
 
25
24
  const rootState = PaginationRootState.create({
26
- id: boxWith(() => id),
27
- count: boxWith(() => count),
28
- perPage: boxWith(() => perPage),
29
- page: boxWith(
30
- () => page,
31
- (v) => {
32
- page = v;
33
- onPageChange?.(v);
34
- },
35
- ),
36
- loop: boxWith(() => loop),
37
- siblingCount: boxWith(() => siblingCount),
38
- orientation: boxWith(() => orientation),
39
- ref: boxWith(
40
- () => ref,
41
- (v) => (ref = v),
42
- ),
25
+ get id() {
26
+ return id;
27
+ },
28
+ get count() {
29
+ return count;
30
+ },
31
+ get perPage() {
32
+ return perPage;
33
+ },
34
+ get page() {
35
+ return page;
36
+ },
37
+ set page(v) {
38
+ page = v;
39
+ onPageChange?.(v);
40
+ },
41
+ get loop() {
42
+ return loop;
43
+ },
44
+ get siblingCount() {
45
+ return siblingCount;
46
+ },
47
+ get orientation() {
48
+ return orientation;
49
+ },
50
+ get ref() {
51
+ return ref;
52
+ },
53
+ set ref(v) {
54
+ ref = v;
55
+ },
43
56
  });
44
57
 
45
58
  const mergedProps = $derived(