@vuetify/v0 0.0.14 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js +6116 -4527
- package/dist/components/index.d.mts +4 -4
- package/dist/components/index.mjs +5 -5
- package/dist/components-Dk00OFL2.mjs +1445 -0
- package/dist/composables/index.d.mts +4 -4
- package/dist/composables/index.mjs +5 -4
- package/dist/composables-YOUVfUsn.mjs +2765 -0
- package/dist/constants/index.d.mts +1 -1
- package/dist/constants/index.mjs +2 -2
- package/dist/{globals-D7kNBw5Q.mjs → globals-Rnihe4SF.mjs} +1 -1
- package/dist/index-BXN7M6o_.d.mts +71 -0
- package/dist/index-BeJMYhId.d.mts +1726 -0
- package/dist/{index-D-EP6KrS.d.mts → index-BulceeMA.d.mts} +575 -56
- package/dist/{index-CQjOW_w5.d.mts → index-BzW68rBC.d.mts} +764 -481
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +7 -6
- package/dist/types/index.d.mts +1 -1
- package/dist/useStep-Bqhi_DDs.mjs +3159 -0
- package/dist/utilities/index.d.mts +3 -3
- package/dist/utilities/index.mjs +2 -2
- package/dist/utilities-DQWf_4V_.mjs +139 -0
- package/package.json +1 -1
- package/dist/components-CziOUEkN.mjs +0 -947
- package/dist/composables-CGvbvF3U.mjs +0 -4902
- package/dist/index-CSdGoUCI.d.mts +0 -17
- package/dist/index-CUnI4hGb.d.mts +0 -815
- package/dist/utilities-C26nB74O.mjs +0 -63
- /package/dist/{constants-Xfszzyok.mjs → constants-BWV0uYsM.mjs} +0 -0
- /package/dist/{index-8AIxAM2d.d.mts → index-B6lIRI3i.d.mts} +0 -0
- /package/dist/{index-DY7-T630.d.mts → index-Bd3J4RNS.d.mts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as ID } from "./index-
|
|
2
|
-
import { App, ComputedRef,
|
|
1
|
+
import { i as ID } from "./index-Bd3J4RNS.mjs";
|
|
2
|
+
import { App, ComputedRef, MaybeRef, MaybeRefOrGetter, Reactive, Ref, ShallowRef } from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/composables/createTrinity/index.d.ts
|
|
5
5
|
|
|
@@ -46,7 +46,7 @@ type ContextTrinity<Z = unknown> = readonly [() => Z, (context?: Z, app?: App) =
|
|
|
46
46
|
declare function createTrinity<Z = unknown>(useContext: () => Z, provideContext: (_context?: Z, app?: App) => Z, context: Z): ContextTrinity<Z>;
|
|
47
47
|
//#endregion
|
|
48
48
|
//#region src/composables/useRegistry/index.d.ts
|
|
49
|
-
interface RegistryTicket {
|
|
49
|
+
interface RegistryTicket<V = unknown> {
|
|
50
50
|
/** The unique identifier. Is randomly generated if not provided. */
|
|
51
51
|
id: ID;
|
|
52
52
|
/**
|
|
@@ -56,7 +56,7 @@ interface RegistryTicket {
|
|
|
56
56
|
*/
|
|
57
57
|
index: number;
|
|
58
58
|
/** The value associated with the ticket. If not provided, it defaults to the index. */
|
|
59
|
-
value:
|
|
59
|
+
value: V;
|
|
60
60
|
/**
|
|
61
61
|
* Whether the value is derived from index.
|
|
62
62
|
*
|
|
@@ -485,6 +485,32 @@ interface RegistryContext<Z extends RegistryTicket = RegistryTicket> {
|
|
|
485
485
|
* ```
|
|
486
486
|
*/
|
|
487
487
|
onboard: (registrations: Partial<Z>[]) => Z[];
|
|
488
|
+
/**
|
|
489
|
+
* Offboard multiple tickets at once
|
|
490
|
+
*
|
|
491
|
+
* @param ids An array of ticket IDs to unregister.
|
|
492
|
+
* @remarks Unregisters multiple tickets in a single operation with optimized reindexing.
|
|
493
|
+
*
|
|
494
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#offboard
|
|
495
|
+
*
|
|
496
|
+
* @example
|
|
497
|
+
* ```ts
|
|
498
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
499
|
+
*
|
|
500
|
+
* const registry = useRegistry()
|
|
501
|
+
*
|
|
502
|
+
* registry.onboard([
|
|
503
|
+
* { id: 'ticket-1', value: 'value-1' },
|
|
504
|
+
* { id: 'ticket-2', value: 'value-2' },
|
|
505
|
+
* { id: 'ticket-3', value: 'value-3' },
|
|
506
|
+
* ])
|
|
507
|
+
*
|
|
508
|
+
* registry.offboard(['ticket-1', 'ticket-3'])
|
|
509
|
+
*
|
|
510
|
+
* console.log(registry.size) // 1
|
|
511
|
+
* ```
|
|
512
|
+
*/
|
|
513
|
+
offboard: (ids: ID[]) => void;
|
|
488
514
|
/**
|
|
489
515
|
* The number of tickets in the registry
|
|
490
516
|
*
|
|
@@ -529,7 +555,7 @@ interface RegistryOptions {
|
|
|
529
555
|
events?: boolean;
|
|
530
556
|
}
|
|
531
557
|
interface RegistryContextOptions extends RegistryOptions {
|
|
532
|
-
namespace
|
|
558
|
+
namespace?: string;
|
|
533
559
|
}
|
|
534
560
|
/**
|
|
535
561
|
* Creates a new registry instance.
|
|
@@ -570,7 +596,11 @@ declare function useRegistry<Z extends RegistryTicket = RegistryTicket, E extend
|
|
|
570
596
|
* ```ts
|
|
571
597
|
* import { createRegistryContext } from '@vuetify/v0'
|
|
572
598
|
*
|
|
573
|
-
*
|
|
599
|
+
* // With default namespace 'v0:registry'
|
|
600
|
+
* export const [useItems, provideItems, items] = createRegistryContext()
|
|
601
|
+
*
|
|
602
|
+
* // Or with custom namespace
|
|
603
|
+
* export const [useItems, provideItems, items] = createRegistryContext({ namespace: 'my-items' })
|
|
574
604
|
*
|
|
575
605
|
* // In a parent component:
|
|
576
606
|
* provideItems()
|
|
@@ -580,10 +610,10 @@ declare function useRegistry<Z extends RegistryTicket = RegistryTicket, E extend
|
|
|
580
610
|
* items.register({ id: 'item-1', value: 'Value 1' })
|
|
581
611
|
* ```
|
|
582
612
|
*/
|
|
583
|
-
declare function createRegistryContext<Z extends RegistryTicket = RegistryTicket, E extends RegistryContext<Z> = RegistryContext<Z>>(_options
|
|
613
|
+
declare function createRegistryContext<Z extends RegistryTicket = RegistryTicket, E extends RegistryContext<Z> = RegistryContext<Z>>(_options?: RegistryContextOptions): ContextTrinity<E>;
|
|
584
614
|
//#endregion
|
|
585
615
|
//#region src/composables/useSelection/index.d.ts
|
|
586
|
-
interface SelectionTicket extends RegistryTicket {
|
|
616
|
+
interface SelectionTicket<V = unknown> extends RegistryTicket<V> {
|
|
587
617
|
/** Disabled state of the ticket */
|
|
588
618
|
disabled: MaybeRef<boolean>;
|
|
589
619
|
/** Whether the ticket is currently selected */
|
|
@@ -636,7 +666,7 @@ interface SelectionOptions extends RegistryOptions {
|
|
|
636
666
|
multiple?: boolean;
|
|
637
667
|
}
|
|
638
668
|
interface SelectionContextOptions extends SelectionOptions {
|
|
639
|
-
namespace
|
|
669
|
+
namespace?: string;
|
|
640
670
|
}
|
|
641
671
|
/**
|
|
642
672
|
* Creates a new selection instance for managing multiple selected items.
|
|
@@ -688,7 +718,6 @@ declare function createSelection<Z extends SelectionTicket = SelectionTicket, E
|
|
|
688
718
|
/**
|
|
689
719
|
* Creates a new selection context.
|
|
690
720
|
*
|
|
691
|
-
* @param namespace The namespace for the selection context.
|
|
692
721
|
* @param options The options for the selection context.
|
|
693
722
|
* @template Z The type of the selection ticket.
|
|
694
723
|
* @template E The type of the selection context.
|
|
@@ -700,7 +729,11 @@ declare function createSelection<Z extends SelectionTicket = SelectionTicket, E
|
|
|
700
729
|
* ```ts
|
|
701
730
|
* import { createSelectionContext } from '@vuetify/v0'
|
|
702
731
|
*
|
|
703
|
-
*
|
|
732
|
+
* // With default namespace 'v0:selection'
|
|
733
|
+
* export const [useCheckboxes, provideCheckboxes, checkboxes] = createSelectionContext()
|
|
734
|
+
*
|
|
735
|
+
* // Or with custom namespace
|
|
736
|
+
* export const [useCheckboxes, provideCheckboxes, checkboxes] = createSelectionContext({ namespace: 'checkboxes' })
|
|
704
737
|
*
|
|
705
738
|
* // In a parent component:
|
|
706
739
|
* provideCheckboxes()
|
|
@@ -710,7 +743,7 @@ declare function createSelection<Z extends SelectionTicket = SelectionTicket, E
|
|
|
710
743
|
* checkboxes.select('checkbox-1')
|
|
711
744
|
* ```
|
|
712
745
|
*/
|
|
713
|
-
declare function createSelectionContext<Z extends SelectionTicket = SelectionTicket, E extends SelectionContext<Z> = SelectionContext<Z>>(_options
|
|
746
|
+
declare function createSelectionContext<Z extends SelectionTicket = SelectionTicket, E extends SelectionContext<Z> = SelectionContext<Z>>(_options?: SelectionContextOptions): ContextTrinity<E>;
|
|
714
747
|
/**
|
|
715
748
|
* Returns the current selection instance.
|
|
716
749
|
*
|
|
@@ -736,77 +769,563 @@ declare function createSelectionContext<Z extends SelectionTicket = SelectionTic
|
|
|
736
769
|
*/
|
|
737
770
|
declare function useSelection<Z extends SelectionTicket = SelectionTicket, E extends SelectionContext<Z> = SelectionContext<Z>>(namespace?: string): E;
|
|
738
771
|
//#endregion
|
|
739
|
-
//#region src/composables/
|
|
740
|
-
|
|
772
|
+
//#region src/composables/useGroup/index.d.ts
|
|
773
|
+
interface GroupTicket<V = unknown> extends SelectionTicket<V> {
|
|
774
|
+
/** Whether the ticket should start in mixed/indeterminate state */
|
|
775
|
+
indeterminate?: MaybeRef<boolean>;
|
|
776
|
+
/** Whether the ticket is in a mixed/indeterminate state */
|
|
777
|
+
isMixed: Readonly<Ref<boolean>>;
|
|
778
|
+
/** Set self to mixed/indeterminate state */
|
|
779
|
+
mix: () => void;
|
|
780
|
+
/** Clear mixed/indeterminate state from self */
|
|
781
|
+
unmix: () => void;
|
|
782
|
+
}
|
|
783
|
+
interface GroupContext<Z extends GroupTicket> extends SelectionContext<Z> {
|
|
784
|
+
selectedIndexes: ComputedRef<Set<number>>;
|
|
785
|
+
/** Select one or more Tickets by ID */
|
|
786
|
+
select: (ids: ID | ID[]) => void;
|
|
787
|
+
/** Unselect one or more Tickets by ID */
|
|
788
|
+
unselect: (ids: ID | ID[]) => void;
|
|
789
|
+
/** Toggle one or more Tickets ON and OFF by ID */
|
|
790
|
+
toggle: (ids: ID | ID[]) => void;
|
|
791
|
+
/** Set of mixed/indeterminate ticket IDs */
|
|
792
|
+
mixedIds: Reactive<Set<ID>>;
|
|
793
|
+
/** Set of mixed/indeterminate ticket instances */
|
|
794
|
+
mixedItems: ComputedRef<Set<Z>>;
|
|
795
|
+
/** Set one or more Tickets to mixed/indeterminate state by ID */
|
|
796
|
+
mix: (ids: ID | ID[]) => void;
|
|
797
|
+
/** Clear mixed/indeterminate state from one or more Tickets by ID */
|
|
798
|
+
unmix: (ids: ID | ID[]) => void;
|
|
799
|
+
/** Check if a ticket is in mixed/indeterminate state by ID */
|
|
800
|
+
mixed: (id: ID) => boolean;
|
|
801
|
+
/** Whether no items are currently selected */
|
|
802
|
+
isNoneSelected: ComputedRef<boolean>;
|
|
803
|
+
/** Whether all selectable (non-disabled) items are selected */
|
|
804
|
+
isAllSelected: ComputedRef<boolean>;
|
|
805
|
+
/** Whether some but not all selectable items are selected */
|
|
806
|
+
isMixed: ComputedRef<boolean>;
|
|
807
|
+
/** Select all selectable (non-disabled) items */
|
|
808
|
+
selectAll: () => void;
|
|
809
|
+
/** Unselect all items (respects mandatory option) */
|
|
810
|
+
unselectAll: () => void;
|
|
811
|
+
/** Toggle between all selected and none selected */
|
|
812
|
+
toggleAll: () => void;
|
|
813
|
+
}
|
|
814
|
+
interface GroupOptions extends SelectionOptions {}
|
|
815
|
+
interface GroupContextOptions extends SelectionContextOptions {}
|
|
741
816
|
/**
|
|
742
|
-
*
|
|
817
|
+
* Creates a new group instance with batch selection and tri-state support.
|
|
743
818
|
*
|
|
744
|
-
*
|
|
745
|
-
*
|
|
746
|
-
*
|
|
747
|
-
*
|
|
748
|
-
* @
|
|
819
|
+
* Extends `createSelection` to support selecting, unselecting, and toggling multiple items
|
|
820
|
+
* at once by passing an array of IDs. Adds tri-state (mixed/indeterminate) support for
|
|
821
|
+
* checkbox trees and similar use cases.
|
|
822
|
+
*
|
|
823
|
+
* @param options The options for the group instance.
|
|
824
|
+
* @template Z The type of the group ticket.
|
|
825
|
+
* @template E The type of the group context.
|
|
826
|
+
* @returns A new group instance with batch selection and tri-state support.
|
|
827
|
+
*
|
|
828
|
+
* @remarks
|
|
829
|
+
* **Key Differences from `createSelection`:**
|
|
830
|
+
* - `select()` accepts `ID | ID[]` for batch operations
|
|
831
|
+
* - `unselect()` accepts `ID | ID[]` for batch operations
|
|
832
|
+
* - `toggle()` accepts `ID | ID[]` for batch operations
|
|
833
|
+
* - Adds `selectedIndexes` computed Set for getting selected item indexes
|
|
834
|
+
* - Adds tri-state support via `mix()`, `unmix()`, `mixed()`, `mixedIds`, `mixedItems`
|
|
835
|
+
* - Perfect for checkbox trees, multi-select dropdowns, and bulk operations
|
|
749
836
|
*
|
|
750
|
-
*
|
|
751
|
-
*
|
|
837
|
+
* **Tri-State Support:**
|
|
838
|
+
* - Items can be in one of three states: selected, mixed (indeterminate), or unselected
|
|
839
|
+
* - `mix(id)` sets item to mixed state (clears selected if set)
|
|
840
|
+
* - `unmix(id)` clears mixed state
|
|
841
|
+
* - `select(id)` clears mixed state before selecting
|
|
842
|
+
* - `toggle(id)` on a mixed item selects it (resolves the indeterminate state positively)
|
|
843
|
+
* - Mixed state works on disabled items (it's a computed state, not user action)
|
|
844
|
+
*
|
|
845
|
+
* **Batch Operations:**
|
|
846
|
+
* - Single ID: `group.select('item-1')`
|
|
847
|
+
* - Array of IDs: `group.select(['item-1', 'item-2', 'item-3'])`
|
|
848
|
+
* - Uses `toArray()` utility internally to normalize input
|
|
849
|
+
* - Disabled items are automatically skipped in select operations
|
|
850
|
+
* - Non-existent IDs are silently ignored
|
|
851
|
+
*
|
|
852
|
+
* **Inheritance Chain:**
|
|
853
|
+
* `useRegistry` → `createSelection` → `createGroup`
|
|
854
|
+
*
|
|
855
|
+
* **Used By:**
|
|
856
|
+
* - `createFeatures` for feature flag management with multiple selections
|
|
857
|
+
*
|
|
858
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-group
|
|
752
859
|
*
|
|
753
860
|
* @example
|
|
754
861
|
* ```ts
|
|
755
|
-
*
|
|
756
|
-
*
|
|
862
|
+
* import { createGroup } from '@vuetify/v0'
|
|
863
|
+
*
|
|
864
|
+
* const checkboxes = createGroup()
|
|
757
865
|
*
|
|
758
|
-
*
|
|
759
|
-
*
|
|
866
|
+
* checkboxes.onboard([
|
|
867
|
+
* { id: 'option-a', value: 'Option A' },
|
|
868
|
+
* { id: 'option-b', value: 'Option B' },
|
|
869
|
+
* { id: 'option-c', value: 'Option C' },
|
|
870
|
+
* ])
|
|
871
|
+
*
|
|
872
|
+
* // Select multiple items at once
|
|
873
|
+
* checkboxes.select(['option-a', 'option-c'])
|
|
874
|
+
*
|
|
875
|
+
* console.log(checkboxes.selectedIds) // Set { 'option-a', 'option-c' }
|
|
876
|
+
* console.log(Array.from(checkboxes.selectedIndexes.value)) // [0, 2]
|
|
877
|
+
*
|
|
878
|
+
* // Set item to mixed/indeterminate state
|
|
879
|
+
* checkboxes.mix('option-a')
|
|
880
|
+
* console.log(checkboxes.mixedIds) // Set { 'option-a' }
|
|
881
|
+
* console.log(checkboxes.selectedIds) // Set { 'option-c' } (option-a removed)
|
|
882
|
+
*
|
|
883
|
+
* // Toggle a mixed item selects it
|
|
884
|
+
* checkboxes.toggle('option-a')
|
|
885
|
+
* console.log(checkboxes.selectedIds) // Set { 'option-a', 'option-c' }
|
|
886
|
+
* console.log(checkboxes.mixedIds) // Set {} (cleared)
|
|
760
887
|
* ```
|
|
761
888
|
*/
|
|
762
|
-
declare function
|
|
889
|
+
declare function createGroup<Z extends GroupTicket = GroupTicket, E extends GroupContext<Z> = GroupContext<Z>>(_options?: GroupOptions): E;
|
|
763
890
|
/**
|
|
764
|
-
*
|
|
891
|
+
* Creates a new group context.
|
|
765
892
|
*
|
|
766
|
-
* @param
|
|
767
|
-
* @
|
|
768
|
-
* @
|
|
769
|
-
* @
|
|
770
|
-
*
|
|
893
|
+
* @param options The options for the group context.
|
|
894
|
+
* @template Z The type of the group ticket.
|
|
895
|
+
* @template E The type of the group context.
|
|
896
|
+
* @returns A new group context.
|
|
897
|
+
*
|
|
898
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-group
|
|
899
|
+
*
|
|
900
|
+
* @example
|
|
901
|
+
* ```ts
|
|
902
|
+
* import { createGroupContext } from '@vuetify/v0'
|
|
903
|
+
*
|
|
904
|
+
* // With default namespace 'v0:group'
|
|
905
|
+
* export const [useMyGroup, provideMyGroup, myGroup] = createGroupContext()
|
|
906
|
+
*
|
|
907
|
+
* // Or with custom namespace
|
|
908
|
+
* export const [useMyGroup, provideMyGroup, myGroup] = createGroupContext({ namespace: 'my-group' })
|
|
909
|
+
*
|
|
910
|
+
* // In a parent component:
|
|
911
|
+
* provideMyGroup()
|
|
912
|
+
*
|
|
913
|
+
* // In a child component:
|
|
914
|
+
* const group = useMyGroup()
|
|
915
|
+
* ```
|
|
916
|
+
*/
|
|
917
|
+
declare function createGroupContext<Z extends GroupTicket = GroupTicket, E extends GroupContext<Z> = GroupContext<Z>>(_options?: GroupContextOptions): ContextTrinity<E>;
|
|
918
|
+
/**
|
|
919
|
+
* Returns the current group instance.
|
|
920
|
+
*
|
|
921
|
+
* @param namespace The namespace for the group context. Defaults to `'v0:group'`.
|
|
922
|
+
* @returns The current group instance.
|
|
923
|
+
*
|
|
924
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-group
|
|
925
|
+
*
|
|
926
|
+
* @example
|
|
927
|
+
* ```vue
|
|
928
|
+
* <script setup lang="ts">
|
|
929
|
+
* import { useGroup } from '@vuetify/v0'
|
|
930
|
+
*
|
|
931
|
+
* const group = useGroup()
|
|
932
|
+
* </script>
|
|
933
|
+
*
|
|
934
|
+
* <template>
|
|
935
|
+
* <div>
|
|
936
|
+
* <p>Selected: {{ group.selectedIds.size }}</p>
|
|
937
|
+
* </div>
|
|
938
|
+
* </template>
|
|
939
|
+
* ```
|
|
940
|
+
*/
|
|
941
|
+
declare function useGroup<Z extends GroupTicket = GroupTicket, E extends GroupContext<Z> = GroupContext<Z>>(namespace?: string): E;
|
|
942
|
+
//#endregion
|
|
943
|
+
//#region src/composables/usePagination/index.d.ts
|
|
944
|
+
interface PaginationItem {
|
|
945
|
+
type: 'page' | 'ellipsis';
|
|
946
|
+
value: number | string;
|
|
947
|
+
}
|
|
948
|
+
interface PaginationContext<Z extends PaginationItem = PaginationItem> {
|
|
949
|
+
/** Current page (1-indexed) */
|
|
950
|
+
page: ShallowRef<number>;
|
|
951
|
+
/** Items per page */
|
|
952
|
+
itemsPerPage: number;
|
|
953
|
+
/** Total number of items */
|
|
954
|
+
size: number;
|
|
955
|
+
/** Total number of pages (computed from size / itemsPerPage) */
|
|
956
|
+
pages: number;
|
|
957
|
+
/** Ellipsis character, or false if disabled */
|
|
958
|
+
ellipsis: string | false;
|
|
959
|
+
/** Visible page numbers and ellipsis for rendering */
|
|
960
|
+
items: ComputedRef<Z[]>;
|
|
961
|
+
/** Start index of items on current page (0-indexed) */
|
|
962
|
+
pageStart: ComputedRef<number>;
|
|
963
|
+
/** End index of items on current page (exclusive, 0-indexed) */
|
|
964
|
+
pageStop: ComputedRef<number>;
|
|
965
|
+
/** Whether current page is the first page */
|
|
966
|
+
isFirst: ComputedRef<boolean>;
|
|
967
|
+
/** Whether current page is the last page */
|
|
968
|
+
isLast: ComputedRef<boolean>;
|
|
969
|
+
/** Go to first page */
|
|
970
|
+
first: () => void;
|
|
971
|
+
/** Go to last page */
|
|
972
|
+
last: () => void;
|
|
973
|
+
/** Go to next page */
|
|
974
|
+
next: () => void;
|
|
975
|
+
/** Go to previous page */
|
|
976
|
+
prev: () => void;
|
|
977
|
+
/** Go to specific page */
|
|
978
|
+
select: (value: number) => void;
|
|
979
|
+
}
|
|
980
|
+
interface PaginationOptions {
|
|
981
|
+
/** Initial page or ref for v-model (1-indexed). @default 1 */
|
|
982
|
+
page?: number | ShallowRef<number>;
|
|
983
|
+
/** Items per page. @default 10 */
|
|
984
|
+
itemsPerPage?: MaybeRefOrGetter<number>;
|
|
985
|
+
/** Total number of items. @default 0 */
|
|
986
|
+
size?: MaybeRefOrGetter<number>;
|
|
987
|
+
/** Maximum visible page buttons. @default 5 */
|
|
988
|
+
visible?: MaybeRefOrGetter<number>;
|
|
989
|
+
/** Ellipsis character. @default '…' */
|
|
990
|
+
ellipsis?: string | false;
|
|
991
|
+
}
|
|
992
|
+
interface PaginationContextOptions extends PaginationOptions {
|
|
993
|
+
/** Namespace for dependency injection */
|
|
994
|
+
namespace?: string;
|
|
995
|
+
}
|
|
996
|
+
/**
|
|
997
|
+
* Creates a pagination instance.
|
|
998
|
+
*
|
|
999
|
+
* @param options The options for the pagination instance.
|
|
1000
|
+
* @returns A pagination context with navigation methods.
|
|
1001
|
+
*
|
|
1002
|
+
* @example
|
|
1003
|
+
* ```ts
|
|
1004
|
+
* import { createPagination } from '@vuetify/v0'
|
|
1005
|
+
*
|
|
1006
|
+
* // Basic usage
|
|
1007
|
+
* const pagination = createPagination({ size: 100 })
|
|
1008
|
+
* pagination.next()
|
|
1009
|
+
* pagination.items.value // [{ type: 'page', value: 1 }, { type: 'page', value: 2 }, ...]
|
|
1010
|
+
*
|
|
1011
|
+
* // With v-model (pass a ref)
|
|
1012
|
+
* const page = ref(1)
|
|
1013
|
+
* const pagination = createPagination({ page, size: 100 })
|
|
1014
|
+
* // Mutating pagination.page or the passed ref syncs both
|
|
1015
|
+
* ```
|
|
1016
|
+
*/
|
|
1017
|
+
declare function createPagination<Z extends PaginationItem = PaginationItem, E extends PaginationContext<Z> = PaginationContext<Z>>(_options?: PaginationOptions): E;
|
|
1018
|
+
/**
|
|
1019
|
+
* Creates a pagination context for dependency injection.
|
|
1020
|
+
*
|
|
1021
|
+
* @param options The options including namespace.
|
|
1022
|
+
* @returns A trinity: [usePagination, providePagination, defaultContext]
|
|
1023
|
+
*
|
|
1024
|
+
* @example
|
|
1025
|
+
* ```ts
|
|
1026
|
+
* // With default namespace 'v0:pagination'
|
|
1027
|
+
* const [usePagination, providePaginationContext] = createPaginationContext({ size: 50 })
|
|
1028
|
+
*
|
|
1029
|
+
* // Or with custom namespace
|
|
1030
|
+
* const [usePagination, providePaginationContext] = createPaginationContext({
|
|
1031
|
+
* namespace: 'my-pagination',
|
|
1032
|
+
* size: 50,
|
|
1033
|
+
* })
|
|
1034
|
+
*
|
|
1035
|
+
* // Parent component
|
|
1036
|
+
* providePaginationContext()
|
|
1037
|
+
*
|
|
1038
|
+
* // Child component
|
|
1039
|
+
* const pagination = usePagination()
|
|
1040
|
+
* pagination.next()
|
|
1041
|
+
* ```
|
|
1042
|
+
*/
|
|
1043
|
+
declare function createPaginationContext<Z extends PaginationItem = PaginationItem, E extends PaginationContext<Z> = PaginationContext<Z>>(_options?: PaginationContextOptions): ContextTrinity<E>;
|
|
1044
|
+
/**
|
|
1045
|
+
* Returns the current pagination instance from context.
|
|
1046
|
+
*
|
|
1047
|
+
* @param namespace The namespace. @default 'v0:pagination'
|
|
1048
|
+
* @returns The pagination context.
|
|
1049
|
+
*
|
|
1050
|
+
* @example
|
|
1051
|
+
* ```vue
|
|
1052
|
+
* <script setup>
|
|
1053
|
+
* import { usePagination } from '@vuetify/v0'
|
|
1054
|
+
*
|
|
1055
|
+
* const pagination = usePagination()
|
|
1056
|
+
* </script>
|
|
1057
|
+
*
|
|
1058
|
+
* <template>
|
|
1059
|
+
* <button @click="pagination.prev()" :disabled="pagination.isFirst.value">Prev</button>
|
|
1060
|
+
* <button @click="pagination.next()" :disabled="pagination.isLast.value">Next</button>
|
|
1061
|
+
* </template>
|
|
1062
|
+
* ```
|
|
1063
|
+
*/
|
|
1064
|
+
declare function usePagination<Z extends PaginationItem = PaginationItem, E extends PaginationContext<Z> = PaginationContext<Z>>(namespace?: string): E;
|
|
1065
|
+
//#endregion
|
|
1066
|
+
//#region src/composables/useSingle/index.d.ts
|
|
1067
|
+
interface SingleTicket<V = unknown> extends SelectionTicket<V> {}
|
|
1068
|
+
interface SingleContext<Z extends SingleTicket> extends SelectionContext<Z> {
|
|
1069
|
+
selectedId: ComputedRef<ID | undefined>;
|
|
1070
|
+
selectedIndex: ComputedRef<number>;
|
|
1071
|
+
selectedItem: ComputedRef<Z | undefined>;
|
|
1072
|
+
selectedValue: ComputedRef<Z['value'] | undefined>;
|
|
1073
|
+
}
|
|
1074
|
+
interface SingleOptions extends SelectionOptions {}
|
|
1075
|
+
interface SingleContextOptions extends SelectionContextOptions {}
|
|
1076
|
+
/**
|
|
1077
|
+
* Creates a new single selection instance that enforces only one selected item at a time.
|
|
1078
|
+
*
|
|
1079
|
+
* Extends `createSelection` by automatically clearing previous selections when a new item is selected.
|
|
1080
|
+
* Adds computed singular properties: `selectedId`, `selectedItem`, `selectedIndex`, `selectedValue`.
|
|
1081
|
+
*
|
|
1082
|
+
* @param options The options for the single selection instance.
|
|
1083
|
+
* @template Z The type of the single selection ticket.
|
|
1084
|
+
* @template E The type of the single selection context.
|
|
1085
|
+
* @returns A new single selection instance with single-selection enforcement.
|
|
771
1086
|
*
|
|
772
1087
|
* @remarks
|
|
773
|
-
*
|
|
774
|
-
*
|
|
1088
|
+
* **Key Differences from `createSelection`:**
|
|
1089
|
+
* - Automatically clears `selectedIds` before selecting a new item (enforces single selection)
|
|
1090
|
+
* - Provides singular computed properties instead of plural sets
|
|
1091
|
+
* - Perfect for tabs, radio buttons, theme selectors, and other single-choice UI components
|
|
1092
|
+
*
|
|
1093
|
+
* **Computed Properties:**
|
|
1094
|
+
* - `selectedId`: The ID of the selected item (undefined if none selected)
|
|
1095
|
+
* - `selectedItem`: The selected ticket object (undefined if none selected)
|
|
1096
|
+
* - `selectedIndex`: The index of the selected item (-1 if none selected)
|
|
1097
|
+
* - `selectedValue`: The value of the selected item (undefined if none selected)
|
|
775
1098
|
*
|
|
776
|
-
*
|
|
777
|
-
*
|
|
1099
|
+
* **Inheritance Chain:**
|
|
1100
|
+
* `useRegistry` → `createSelection` → `createSingle` → `createStep`
|
|
1101
|
+
*
|
|
1102
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-single
|
|
778
1103
|
*
|
|
779
1104
|
* @example
|
|
780
1105
|
* ```ts
|
|
781
|
-
*
|
|
782
|
-
*
|
|
1106
|
+
* import { createSingle } from '@vuetify/v0'
|
|
1107
|
+
*
|
|
1108
|
+
* const tabs = createSingle({ mandatory: true })
|
|
783
1109
|
*
|
|
784
|
-
*
|
|
785
|
-
*
|
|
786
|
-
*
|
|
1110
|
+
* tabs.onboard([
|
|
1111
|
+
* { id: 'home', value: 'Home' },
|
|
1112
|
+
* { id: 'about', value: 'About' },
|
|
1113
|
+
* { id: 'contact', value: 'Contact' },
|
|
1114
|
+
* ])
|
|
1115
|
+
*
|
|
1116
|
+
* tabs.first() // Select first tab
|
|
1117
|
+
*
|
|
1118
|
+
* console.log(tabs.selectedId.value) // 'home'
|
|
1119
|
+
* console.log(tabs.selectedIndex.value) // 0
|
|
1120
|
+
*
|
|
1121
|
+
* tabs.select('about') // Switch to about tab
|
|
1122
|
+
* console.log(tabs.selectedId.value) // 'about'
|
|
1123
|
+
* console.log(tabs.selectedIds.size) // 1 (always enforces single selection)
|
|
787
1124
|
* ```
|
|
788
1125
|
*/
|
|
789
|
-
declare function
|
|
1126
|
+
declare function createSingle<Z extends SingleTicket = SingleTicket, E extends SingleContext<Z> = SingleContext<Z>>(_options?: SingleOptions): E;
|
|
790
1127
|
/**
|
|
791
|
-
* Creates a new
|
|
1128
|
+
* Creates a new single selection context.
|
|
792
1129
|
*
|
|
793
|
-
* @param
|
|
794
|
-
* @
|
|
795
|
-
* @template
|
|
796
|
-
* @returns A
|
|
1130
|
+
* @param options The options for the single selection context.
|
|
1131
|
+
* @template Z The type of the single selection ticket.
|
|
1132
|
+
* @template E The type of the single selection context.
|
|
1133
|
+
* @returns A new single selection context.
|
|
1134
|
+
*
|
|
1135
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-single
|
|
1136
|
+
*
|
|
1137
|
+
* @example
|
|
1138
|
+
* ```ts
|
|
1139
|
+
* import { createSingleContext } from '@vuetify/v0'
|
|
1140
|
+
*
|
|
1141
|
+
* // With default namespace 'v0:single'
|
|
1142
|
+
* export const [useSingle, provideSingle, context] = createSingleContext()
|
|
1143
|
+
*
|
|
1144
|
+
* // In a parent component:
|
|
1145
|
+
* provideSingle()
|
|
1146
|
+
*
|
|
1147
|
+
* // In a child component:
|
|
1148
|
+
* const single = useSingle()
|
|
1149
|
+
* single.select('tab-1')
|
|
1150
|
+
* ```
|
|
1151
|
+
*/
|
|
1152
|
+
declare function createSingleContext<Z extends SingleTicket = SingleTicket, E extends SingleContext<Z> = SingleContext<Z>>(_options?: SingleContextOptions): ContextTrinity<E>;
|
|
1153
|
+
/**
|
|
1154
|
+
* Returns the current single selection instance.
|
|
1155
|
+
*
|
|
1156
|
+
* @param namespace The namespace for the single selection context. Defaults to `'v0:single'`.
|
|
1157
|
+
* @returns The current single selection instance.
|
|
1158
|
+
*
|
|
1159
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-single
|
|
1160
|
+
*
|
|
1161
|
+
* @example
|
|
1162
|
+
* ```vue
|
|
1163
|
+
* <script setup lang="ts">
|
|
1164
|
+
* import { useSingle } from '@vuetify/v0'
|
|
1165
|
+
*
|
|
1166
|
+
* const tabs = useSingle()
|
|
1167
|
+
* </script>
|
|
1168
|
+
*
|
|
1169
|
+
* <template>
|
|
1170
|
+
* <div>
|
|
1171
|
+
* <p>Selected: {{ tabs.selectedId }}</p>
|
|
1172
|
+
* </div>
|
|
1173
|
+
* </template>
|
|
1174
|
+
* ```
|
|
1175
|
+
*/
|
|
1176
|
+
declare function useSingle<Z extends SingleTicket = SingleTicket, E extends SingleContext<Z> = SingleContext<Z>>(namespace?: string): E;
|
|
1177
|
+
//#endregion
|
|
1178
|
+
//#region src/composables/useStep/index.d.ts
|
|
1179
|
+
interface StepTicket<V = unknown> extends SingleTicket<V> {}
|
|
1180
|
+
interface StepContext<Z extends StepTicket> extends SingleContext<Z> {
|
|
1181
|
+
/** Select the first Ticket in the collection */
|
|
1182
|
+
first: () => void;
|
|
1183
|
+
/** Select the last Ticket in the collection */
|
|
1184
|
+
last: () => void;
|
|
1185
|
+
/** Select the next Ticket based on current index */
|
|
1186
|
+
next: () => void;
|
|
1187
|
+
/** Select the previous Ticket based on current index */
|
|
1188
|
+
prev: () => void;
|
|
1189
|
+
/** Step through the collection by a given count */
|
|
1190
|
+
step: (count: number) => void;
|
|
1191
|
+
}
|
|
1192
|
+
interface StepOptions extends SingleOptions {
|
|
1193
|
+
/**
|
|
1194
|
+
* Enable circular navigation (wrapping at boundaries).
|
|
1195
|
+
* - true: Navigation wraps around (carousel behavior)
|
|
1196
|
+
* - false: Navigation stops at boundaries (pagination behavior)
|
|
1197
|
+
* @default false
|
|
1198
|
+
*/
|
|
1199
|
+
circular?: boolean;
|
|
1200
|
+
}
|
|
1201
|
+
interface StepContextOptions extends SingleContextOptions {
|
|
1202
|
+
/**
|
|
1203
|
+
* Enable circular navigation (wrapping at boundaries).
|
|
1204
|
+
* - true: Navigation wraps around (carousel behavior)
|
|
1205
|
+
* - false: Navigation stops at boundaries (pagination behavior)
|
|
1206
|
+
* @default false
|
|
1207
|
+
*/
|
|
1208
|
+
circular?: boolean;
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Creates a new step instance with navigation through items.
|
|
1212
|
+
*
|
|
1213
|
+
* Extends `createSingle` with `first()`, `last()`, `next()`, `prev()`, and `step(count)` methods
|
|
1214
|
+
* for sequential navigation. Supports both circular (wrapping) and bounded (stopping at edges) modes.
|
|
1215
|
+
*
|
|
1216
|
+
* @param options The options for the step instance.
|
|
1217
|
+
* @template Z The type of the step ticket.
|
|
1218
|
+
* @template E The type of the step context.
|
|
1219
|
+
* @returns A new step instance with navigation methods.
|
|
1220
|
+
*
|
|
1221
|
+
* @remarks
|
|
1222
|
+
* **Key Features:**
|
|
1223
|
+
* - **Configurable Navigation**: `circular: true` for wrapping, `false` for bounded (default: false)
|
|
1224
|
+
* - **Disabled Item Skipping**: Automatically skips disabled items during navigation
|
|
1225
|
+
* - **Bidirectional**: Forward (`next`, positive `step`) and backward (`prev`, negative `step`)
|
|
1226
|
+
* - **Safe Edge Cases**: Handles empty registries and all-disabled scenarios gracefully
|
|
1227
|
+
*
|
|
1228
|
+
* **Navigation Methods:**
|
|
1229
|
+
* - `first()`: Select first non-disabled item
|
|
1230
|
+
* - `last()`: Select last non-disabled item
|
|
1231
|
+
* - `next()`: Move to next item (wraps if circular, stops at end if bounded)
|
|
1232
|
+
* - `prev()`: Move to previous item (wraps if circular, stops at start if bounded)
|
|
1233
|
+
* - `step(count)`: Move by `count` positions (negative for backward)
|
|
797
1234
|
*
|
|
798
|
-
*
|
|
799
|
-
*
|
|
1235
|
+
* **Circular Mode (`circular: true`):**
|
|
1236
|
+
* - Uses modulo arithmetic for wrapping: `((index % length) + length) % length`
|
|
1237
|
+
* - Works correctly with negative indexes and large step counts
|
|
1238
|
+
* - Perfect for carousels, theme switchers, infinite scrolling
|
|
1239
|
+
*
|
|
1240
|
+
* **Bounded Mode (`circular: false`, default):**
|
|
1241
|
+
* - Navigation stops at boundaries (no wrapping)
|
|
1242
|
+
* - `next()` on last item does nothing
|
|
1243
|
+
* - `prev()` on first item does nothing
|
|
1244
|
+
* - Perfect for pagination, wizards with explicit completion, forms
|
|
1245
|
+
*
|
|
1246
|
+
* **Inheritance Chain:**
|
|
1247
|
+
* `useRegistry` → `createSelection` → `createSingle` → `createStep`
|
|
1248
|
+
*
|
|
1249
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-step
|
|
800
1250
|
*
|
|
801
1251
|
* @example
|
|
802
1252
|
* ```ts
|
|
803
|
-
*
|
|
804
|
-
*
|
|
1253
|
+
* import { createStep } from '@vuetify/v0'
|
|
1254
|
+
*
|
|
1255
|
+
* // Bounded navigation (default) - for pagination
|
|
1256
|
+
* const pagination = createStep({ circular: false })
|
|
1257
|
+
* pagination.onboard([
|
|
1258
|
+
* { id: 'page-1', value: 1 },
|
|
1259
|
+
* { id: 'page-2', value: 2 },
|
|
1260
|
+
* { id: 'page-3', value: 3 },
|
|
1261
|
+
* ])
|
|
1262
|
+
* pagination.first() // Select page 1
|
|
1263
|
+
* pagination.prev() // Does nothing (already at first)
|
|
1264
|
+
* pagination.next() // Select page 2
|
|
1265
|
+
*
|
|
1266
|
+
* // Circular navigation - for carousels
|
|
1267
|
+
* const carousel = createStep({ circular: true })
|
|
1268
|
+
* carousel.onboard([
|
|
1269
|
+
* { id: 'slide-1', value: 'First' },
|
|
1270
|
+
* { id: 'slide-2', value: 'Second' },
|
|
1271
|
+
* { id: 'slide-3', value: 'Third' },
|
|
1272
|
+
* ])
|
|
1273
|
+
* carousel.first()
|
|
1274
|
+
* carousel.prev() // Wraps to 'slide-3'
|
|
1275
|
+
* carousel.next() // Wraps to 'slide-1'
|
|
1276
|
+
* ```
|
|
1277
|
+
*/
|
|
1278
|
+
declare function createStep<Z extends StepTicket = StepTicket, E extends StepContext<Z> = StepContext<Z>>(_options?: StepOptions): E;
|
|
1279
|
+
/**
|
|
1280
|
+
* Creates a new step context.
|
|
1281
|
+
*
|
|
1282
|
+
* @param options The options for the step context.
|
|
1283
|
+
* @template Z The type of the step ticket.
|
|
1284
|
+
* @template E The type of the step context.
|
|
1285
|
+
* @returns A new step context.
|
|
805
1286
|
*
|
|
806
|
-
*
|
|
807
|
-
*
|
|
1287
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-step
|
|
1288
|
+
*
|
|
1289
|
+
* @example
|
|
1290
|
+
* ```ts
|
|
1291
|
+
* import { createStepContext } from '@vuetify/v0'
|
|
1292
|
+
*
|
|
1293
|
+
* // With default namespace 'v0:step'
|
|
1294
|
+
* export const [useStep, provideStep, context] = createStepContext()
|
|
1295
|
+
*
|
|
1296
|
+
* // In a parent component:
|
|
1297
|
+
* provideStep()
|
|
1298
|
+
*
|
|
1299
|
+
* // In a child component:
|
|
1300
|
+
* const context = useStep()
|
|
1301
|
+
* context.next() // Progress to next step
|
|
1302
|
+
* ```
|
|
1303
|
+
*/
|
|
1304
|
+
declare function createStepContext<Z extends StepTicket = StepTicket, E extends StepContext<Z> = StepContext<Z>>(_options?: StepContextOptions): ContextTrinity<E>;
|
|
1305
|
+
/**
|
|
1306
|
+
* Returns the current step instance.
|
|
1307
|
+
*
|
|
1308
|
+
* @param namespace The namespace for the step context. Defaults to `'v0:step'`.
|
|
1309
|
+
* @returns The current step instance.
|
|
1310
|
+
*
|
|
1311
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-step
|
|
1312
|
+
*
|
|
1313
|
+
* @example
|
|
1314
|
+
* ```vue
|
|
1315
|
+
* <script setup lang="ts">
|
|
1316
|
+
* import { useStep } from '@vuetify/v0'
|
|
1317
|
+
*
|
|
1318
|
+
* const wizard = useStep()
|
|
1319
|
+
* </script>
|
|
1320
|
+
*
|
|
1321
|
+
* <template>
|
|
1322
|
+
* <div>
|
|
1323
|
+
* <p>Current step: {{ wizard.selectedIndex }}</p>
|
|
1324
|
+
* <button @click="wizard.next()">Next</button>
|
|
1325
|
+
* </div>
|
|
1326
|
+
* </template>
|
|
808
1327
|
* ```
|
|
809
1328
|
*/
|
|
810
|
-
declare function
|
|
1329
|
+
declare function useStep<Z extends StepTicket = StepTicket, E extends StepContext<Z> = StepContext<Z>>(namespace?: string): E;
|
|
811
1330
|
//#endregion
|
|
812
|
-
export { useRegistry as _,
|
|
1331
|
+
export { SelectionContextOptions as A, createRegistryContext as B, GroupContextOptions as C, createGroupContext as D, createGroup as E, useSelection as F, ContextTrinity as H, RegistryContext as I, RegistryContextOptions as L, SelectionTicket as M, createSelection as N, useGroup as O, createSelectionContext as P, RegistryOptions as R, GroupContext as S, GroupTicket as T, createTrinity as U, useRegistry as V, PaginationItem as _, createStep as a, createPaginationContext as b, SingleContext as c, SingleTicket as d, createSingle as f, PaginationContextOptions as g, PaginationContext as h, StepTicket as i, SelectionOptions as j, SelectionContext as k, SingleContextOptions as l, useSingle as m, StepContextOptions as n, createStepContext as o, createSingleContext as p, StepOptions as r, useStep as s, StepContext as t, SingleOptions as u, PaginationOptions as v, GroupOptions as w, usePagination as x, createPagination as y, RegistryTicket as z };
|