@vuetify/nightly 3.7.4-next.2024-11-06 → 3.7.5-dev.2024-12-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.
Files changed (262) hide show
  1. package/dist/json/attributes.json +2853 -2845
  2. package/dist/json/importMap-labs.json +20 -20
  3. package/dist/json/importMap.json +150 -150
  4. package/dist/json/tags.json +2 -0
  5. package/dist/json/web-types.json +5324 -5306
  6. package/dist/vuetify-labs.css +25135 -23418
  7. package/dist/vuetify-labs.d.ts +202 -196
  8. package/dist/vuetify-labs.esm.js +107 -106
  9. package/dist/vuetify-labs.esm.js.map +1 -1
  10. package/dist/vuetify-labs.js +106 -105
  11. package/dist/vuetify-labs.min.css +4 -3
  12. package/dist/vuetify.css +23838 -22118
  13. package/dist/vuetify.d.ts +191 -185
  14. package/dist/vuetify.esm.js +96 -96
  15. package/dist/vuetify.esm.js.map +1 -1
  16. package/dist/vuetify.js +95 -95
  17. package/dist/vuetify.js.map +1 -1
  18. package/dist/vuetify.min.css +4 -3
  19. package/dist/vuetify.min.js +884 -889
  20. package/dist/vuetify.min.js.map +1 -1
  21. package/lib/components/VAlert/VAlert.css +215 -207
  22. package/lib/components/VApp/VApp.css +15 -16
  23. package/lib/components/VAppBar/VAppBar.css +12 -14
  24. package/lib/components/VAppBar/index.d.mts +6 -6
  25. package/lib/components/VAutocomplete/VAutocomplete.css +85 -86
  26. package/lib/components/VAutocomplete/VAutocomplete.mjs +4 -4
  27. package/lib/components/VAutocomplete/VAutocomplete.mjs.map +1 -1
  28. package/lib/components/VAutocomplete/index.d.mts +22 -22
  29. package/lib/components/VAvatar/VAvatar.css +106 -108
  30. package/lib/components/VBadge/VBadge.css +77 -73
  31. package/lib/components/VBadge/VBadge.sass +4 -0
  32. package/lib/components/VBanner/VBanner.css +166 -161
  33. package/lib/components/VBottomNavigation/VBottomNavigation.css +63 -64
  34. package/lib/components/VBottomSheet/VBottomSheet.css +31 -34
  35. package/lib/components/VBreadcrumbs/VBreadcrumbs.css +57 -54
  36. package/lib/components/VBtn/VBtn.css +408 -385
  37. package/lib/components/VBtn/VBtn.sass +4 -4
  38. package/lib/components/VBtn/index.d.mts +7 -7
  39. package/lib/components/VBtnGroup/VBtnGroup.css +64 -63
  40. package/lib/components/VBtnToggle/VBtnToggle.css +14 -16
  41. package/lib/components/VBtnToggle/index.d.mts +9 -9
  42. package/lib/components/VCard/VCard.css +302 -294
  43. package/lib/components/VCarousel/VCarousel.css +65 -63
  44. package/lib/components/VCarousel/VCarousel.mjs.map +1 -1
  45. package/lib/components/VCarousel/VCarousel.sass +1 -1
  46. package/lib/components/VCarousel/index.d.mts +9 -9
  47. package/lib/components/VCheckbox/VCheckbox.css +5 -7
  48. package/lib/components/VCheckbox/VCheckbox.mjs +3 -3
  49. package/lib/components/VCheckbox/VCheckbox.mjs.map +1 -1
  50. package/lib/components/VChip/VChip.css +411 -378
  51. package/lib/components/VChip/VChip.mjs +18 -10
  52. package/lib/components/VChip/VChip.mjs.map +1 -1
  53. package/lib/components/VChip/index.d.mts +13 -8
  54. package/lib/components/VChipGroup/VChipGroup.css +18 -19
  55. package/lib/components/VChipGroup/VChipGroup.mjs +2 -0
  56. package/lib/components/VChipGroup/VChipGroup.mjs.map +1 -1
  57. package/lib/components/VChipGroup/index.d.mts +20 -15
  58. package/lib/components/VCode/VCode.css +8 -10
  59. package/lib/components/VColorPicker/VColorPicker.css +22 -22
  60. package/lib/components/VColorPicker/VColorPickerCanvas.css +22 -24
  61. package/lib/components/VColorPicker/VColorPickerEdit.css +28 -29
  62. package/lib/components/VColorPicker/VColorPickerPreview.css +67 -69
  63. package/lib/components/VColorPicker/VColorPickerPreview.sass +2 -4
  64. package/lib/components/VColorPicker/VColorPickerSwatches.css +34 -34
  65. package/lib/components/VCombobox/VCombobox.css +85 -86
  66. package/lib/components/VCombobox/VCombobox.mjs +4 -4
  67. package/lib/components/VCombobox/VCombobox.mjs.map +1 -1
  68. package/lib/components/VCombobox/index.d.mts +22 -22
  69. package/lib/components/VConfirmEdit/VConfirmEdit.mjs +9 -7
  70. package/lib/components/VConfirmEdit/VConfirmEdit.mjs.map +1 -1
  71. package/lib/components/VConfirmEdit/__test__/VConfirmEdit.spec.browser.mjs +1 -1
  72. package/lib/components/VConfirmEdit/__test__/VConfirmEdit.spec.browser.mjs.map +1 -1
  73. package/lib/components/VConfirmEdit/index.d.mts +3 -7
  74. package/lib/components/VCounter/VCounter.css +5 -7
  75. package/lib/components/VDataTable/VDataTable.css +186 -189
  76. package/lib/components/VDataTable/VDataTable.sass +10 -20
  77. package/lib/components/VDataTable/VDataTableFooter.css +31 -33
  78. package/lib/components/VDatePicker/VDatePicker.css +6 -8
  79. package/lib/components/VDatePicker/VDatePickerControls.css +56 -54
  80. package/lib/components/VDatePicker/VDatePickerHeader.css +60 -56
  81. package/lib/components/VDatePicker/VDatePickerHeader.mjs +2 -1
  82. package/lib/components/VDatePicker/VDatePickerHeader.mjs.map +1 -1
  83. package/lib/components/VDatePicker/VDatePickerMonth.css +55 -51
  84. package/lib/components/VDatePicker/VDatePickerMonths.css +19 -20
  85. package/lib/components/VDatePicker/VDatePickerYears.css +15 -16
  86. package/lib/components/VDatePicker/index.d.mts +5 -5
  87. package/lib/components/VDialog/VDialog.css +95 -95
  88. package/lib/components/VDivider/VDivider.css +52 -52
  89. package/lib/components/VEmptyState/VEmptyState.css +67 -62
  90. package/lib/components/VExpansionPanel/VExpansionPanel.css +209 -203
  91. package/lib/components/VExpansionPanel/VExpansionPanel.sass +25 -27
  92. package/lib/components/VExpansionPanel/index.d.mts +7 -7
  93. package/lib/components/VFab/VFab.css +69 -74
  94. package/lib/components/VFab/VFab.sass +4 -5
  95. package/lib/components/VFab/index.d.mts +6 -6
  96. package/lib/components/VField/VField.css +579 -539
  97. package/lib/components/VField/VField.mjs +5 -4
  98. package/lib/components/VField/VField.mjs.map +1 -1
  99. package/lib/components/VFileInput/VFileInput.css +29 -31
  100. package/lib/components/VFooter/VFooter.css +36 -38
  101. package/lib/components/VGrid/VGrid.css +592 -565
  102. package/lib/components/VIcon/VIcon.css +52 -51
  103. package/lib/components/VImg/VImg.css +51 -50
  104. package/lib/components/VInfiniteScroll/VInfiniteScroll.css +37 -36
  105. package/lib/components/VInput/VInput.css +142 -131
  106. package/lib/components/VInput/VInput.mjs +3 -3
  107. package/lib/components/VInput/VInput.mjs.map +1 -1
  108. package/lib/components/VItemGroup/VItemGroup.css +5 -7
  109. package/lib/components/VItemGroup/VItemGroup.mjs.map +1 -1
  110. package/lib/components/VItemGroup/index.d.mts +9 -9
  111. package/lib/components/VKbd/VKbd.css +11 -13
  112. package/lib/components/VLabel/VLabel.css +15 -16
  113. package/lib/components/VLayout/VLayout.css +8 -10
  114. package/lib/components/VLayout/VLayoutItem.css +7 -8
  115. package/lib/components/VList/VList.css +108 -104
  116. package/lib/components/VList/VList.mjs +3 -2
  117. package/lib/components/VList/VList.mjs.map +1 -1
  118. package/lib/components/VList/VList.sass +1 -1
  119. package/lib/components/VList/VListItem.css +452 -440
  120. package/lib/components/VList/VListItem.mjs +3 -2
  121. package/lib/components/VList/VListItem.mjs.map +1 -1
  122. package/lib/components/VList/VListItem.sass +1 -2
  123. package/lib/components/VList/index.d.mts +10 -10
  124. package/lib/components/VLocaleProvider/VLocaleProvider.css +2 -4
  125. package/lib/components/VMain/VMain.css +30 -32
  126. package/lib/components/VMenu/VMenu.css +19 -21
  127. package/lib/components/VMenu/VMenu.mjs +3 -3
  128. package/lib/components/VMenu/VMenu.mjs.map +1 -1
  129. package/lib/components/VMenu/index.d.mts +6 -6
  130. package/lib/components/VMessages/VMessages.css +15 -17
  131. package/lib/components/VNavigationDrawer/VNavigationDrawer.css +108 -106
  132. package/lib/components/VOtpInput/VOtpInput.css +58 -56
  133. package/lib/components/VOverlay/VOverlay.css +63 -60
  134. package/lib/components/VOverlay/VOverlay.sass +13 -14
  135. package/lib/components/VPagination/VPagination.css +8 -10
  136. package/lib/components/VParallax/VParallax.css +6 -8
  137. package/lib/components/VProgressCircular/VProgressCircular.css +101 -95
  138. package/lib/components/VProgressLinear/VProgressLinear.css +222 -209
  139. package/lib/components/VRadioGroup/VRadioGroup.css +12 -14
  140. package/lib/components/VRadioGroup/VRadioGroup.mjs +3 -3
  141. package/lib/components/VRadioGroup/VRadioGroup.mjs.map +1 -1
  142. package/lib/components/VRating/VRating.css +53 -52
  143. package/lib/components/VRating/VRating.mjs +4 -3
  144. package/lib/components/VRating/VRating.mjs.map +1 -1
  145. package/lib/components/VResponsive/VResponsive.css +26 -25
  146. package/lib/components/VSelect/VSelect.css +52 -54
  147. package/lib/components/VSelect/VSelect.mjs +3 -3
  148. package/lib/components/VSelect/VSelect.mjs.map +1 -1
  149. package/lib/components/VSelect/index.d.mts +22 -22
  150. package/lib/components/VSelectionControl/VSelectionControl.css +102 -100
  151. package/lib/components/VSelectionControl/VSelectionControl.mjs +3 -3
  152. package/lib/components/VSelectionControl/VSelectionControl.mjs.map +1 -1
  153. package/lib/components/VSelectionControlGroup/VSelectionControlGroup.css +8 -10
  154. package/lib/components/VSelectionControlGroup/VSelectionControlGroup.mjs +3 -3
  155. package/lib/components/VSelectionControlGroup/VSelectionControlGroup.mjs.map +1 -1
  156. package/lib/components/VSheet/VSheet.css +36 -38
  157. package/lib/components/VSkeletonLoader/VSkeletonLoader.css +224 -225
  158. package/lib/components/VSlideGroup/VSlideGroup.css +55 -53
  159. package/lib/components/VSlideGroup/index.d.mts +10 -10
  160. package/lib/components/VSlider/VSlider.css +57 -53
  161. package/lib/components/VSlider/VSliderThumb.css +153 -142
  162. package/lib/components/VSlider/VSliderTrack.css +174 -155
  163. package/lib/components/VSnackbar/VSnackbar.css +140 -140
  164. package/lib/components/VSparkline/VBarline.mjs +3 -3
  165. package/lib/components/VSparkline/VBarline.mjs.map +1 -1
  166. package/lib/components/VSparkline/VTrendline.mjs +3 -3
  167. package/lib/components/VSparkline/VTrendline.mjs.map +1 -1
  168. package/lib/components/VSpeedDial/VSpeedDial.css +41 -43
  169. package/lib/components/VStepper/VStepper.css +56 -55
  170. package/lib/components/VStepper/VStepper.mjs +5 -4
  171. package/lib/components/VStepper/VStepper.mjs.map +1 -1
  172. package/lib/components/VStepper/VStepperItem.css +115 -112
  173. package/lib/components/VStepper/VStepperItem.mjs +5 -4
  174. package/lib/components/VStepper/VStepperItem.mjs.map +1 -1
  175. package/lib/components/VStepper/index.d.mts +51 -45
  176. package/lib/components/VSwitch/VSwitch.css +139 -129
  177. package/lib/components/VSwitch/VSwitch.mjs +3 -3
  178. package/lib/components/VSwitch/VSwitch.mjs.map +1 -1
  179. package/lib/components/VSystemBar/VSystemBar.css +43 -45
  180. package/lib/components/VTable/VTable.css +141 -140
  181. package/lib/components/VTable/VTable.sass +2 -4
  182. package/lib/components/VTabs/VTab.css +29 -30
  183. package/lib/components/VTabs/VTabs.css +65 -59
  184. package/lib/components/VTabs/index.d.mts +7 -7
  185. package/lib/components/VTextField/VTextField.css +68 -65
  186. package/lib/components/VTextarea/VTextarea.css +39 -47
  187. package/lib/components/VTextarea/VTextarea.sass +2 -4
  188. package/lib/components/VThemeProvider/VThemeProvider.css +3 -5
  189. package/lib/components/VTimeline/VTimeline.css +418 -379
  190. package/lib/components/VToolbar/VToolbar.css +143 -136
  191. package/lib/components/VTooltip/VTooltip.css +21 -25
  192. package/lib/components/VTooltip/VTooltip.mjs +3 -3
  193. package/lib/components/VTooltip/VTooltip.mjs.map +1 -1
  194. package/lib/components/VTooltip/VTooltip.sass +6 -8
  195. package/lib/components/VVirtualScroll/VVirtualScroll.css +9 -11
  196. package/lib/components/VWindow/VWindow.css +70 -73
  197. package/lib/components/VWindow/index.d.mts +7 -7
  198. package/lib/components/index.d.mts +138 -132
  199. package/lib/composables/form.mjs +7 -2
  200. package/lib/composables/form.mjs.map +1 -1
  201. package/lib/composables/group.mjs +3 -3
  202. package/lib/composables/group.mjs.map +1 -1
  203. package/lib/composables/layout.mjs +3 -3
  204. package/lib/composables/layout.mjs.map +1 -1
  205. package/lib/composables/nested/nested.mjs +2 -2
  206. package/lib/composables/nested/nested.mjs.map +1 -1
  207. package/lib/composables/theme.mjs +4 -4
  208. package/lib/composables/theme.mjs.map +1 -1
  209. package/lib/composables/validation.mjs +13 -15
  210. package/lib/composables/validation.mjs.map +1 -1
  211. package/lib/directives/ripple/VRipple.css +36 -38
  212. package/lib/entry-bundler.mjs +1 -1
  213. package/lib/entry-bundler.mjs.map +1 -1
  214. package/lib/framework.mjs +2 -3
  215. package/lib/framework.mjs.map +1 -1
  216. package/lib/index.d.mts +53 -53
  217. package/lib/labs/VCalendar/VCalendar.css +225 -219
  218. package/lib/labs/VCalendar/VCalendarDay.css +32 -33
  219. package/lib/labs/VCalendar/VCalendarHeader.css +13 -13
  220. package/lib/labs/VCalendar/VCalendarInterval.css +42 -43
  221. package/lib/labs/VCalendar/VCalendarIntervalEvent.css +5 -7
  222. package/lib/labs/VCalendar/VCalendarMonthDay.css +58 -61
  223. package/lib/labs/VCalendar/VCalendarMonthDay.sass +2 -3
  224. package/lib/labs/VDateInput/VDateInput.mjs +1 -1
  225. package/lib/labs/VDateInput/VDateInput.mjs.map +1 -1
  226. package/lib/labs/VNumberInput/VNumberInput.css +38 -40
  227. package/lib/labs/VNumberInput/VNumberInput.mjs +7 -5
  228. package/lib/labs/VNumberInput/VNumberInput.mjs.map +1 -1
  229. package/lib/labs/VPicker/VPicker.css +57 -53
  230. package/lib/labs/VStepperVertical/index.d.mts +44 -44
  231. package/lib/labs/VTimePicker/VTimePicker.css +7 -9
  232. package/lib/labs/VTimePicker/VTimePickerClock.css +129 -126
  233. package/lib/labs/VTimePicker/VTimePickerControls.css +103 -102
  234. package/lib/labs/VTreeview/VTreeviewItem.css +15 -17
  235. package/lib/labs/VTreeview/VTreeviewItem.mjs +3 -4
  236. package/lib/labs/VTreeview/VTreeviewItem.mjs.map +1 -1
  237. package/lib/labs/VTreeview/VTreeviewItem.sass +1 -2
  238. package/lib/labs/VTreeview/index.d.mts +20 -20
  239. package/lib/labs/components.d.mts +64 -64
  240. package/lib/locale/fr.mjs +1 -1
  241. package/lib/locale/fr.mjs.map +1 -1
  242. package/lib/styles/elements/_global.sass +1 -1
  243. package/lib/styles/generic/_colors.scss +3 -3
  244. package/lib/styles/generic/_layers.scss +1 -13
  245. package/lib/styles/generic/_transitions.scss +32 -32
  246. package/lib/styles/main.css +16139 -14666
  247. package/lib/styles/settings/_utilities.scss +5 -0
  248. package/lib/styles/settings/_variables.scss +2 -1
  249. package/lib/styles/tools/_bootable.sass +3 -0
  250. package/lib/styles/tools/_border.sass +4 -4
  251. package/lib/styles/tools/_display.sass +10 -0
  252. package/lib/styles/tools/_elevation.sass +2 -2
  253. package/lib/styles/tools/_index.sass +2 -0
  254. package/lib/styles/tools/_layer.scss +2 -4
  255. package/lib/styles/tools/_position.sass +2 -2
  256. package/lib/styles/tools/_radius.sass +10 -0
  257. package/lib/styles/tools/_rounded.sass +2 -2
  258. package/lib/styles/tools/_utilities.sass +5 -1
  259. package/lib/styles/utilities/_elevation.scss +1 -1
  260. package/lib/util/getCurrentInstance.mjs +1 -15
  261. package/lib/util/getCurrentInstance.mjs.map +1 -1
  262. package/package.json +1 -1
@@ -123,7 +123,12 @@ export function createForm(props) {
123
123
  resetValidation
124
124
  };
125
125
  }
126
- export function useForm() {
127
- return inject(FormKey, null);
126
+ export function useForm(props) {
127
+ const form = inject(FormKey, null);
128
+ return {
129
+ ...form,
130
+ isReadonly: computed(() => !!(props?.readonly ?? form?.isReadonly.value)),
131
+ isDisabled: computed(() => !!(props?.disabled ?? form?.isDisabled.value))
132
+ };
128
133
  }
129
134
  //# sourceMappingURL=form.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"form.mjs","names":["useProxiedModel","computed","inject","markRaw","provide","ref","shallowRef","toRef","watch","consoleWarn","propsFactory","FormKey","Symbol","for","makeFormProps","disabled","Boolean","fastFail","readonly","modelValue","type","default","validateOn","String","createForm","props","model","isDisabled","isReadonly","isValidating","items","errors","validate","results","valid","value","item","itemErrorMessages","length","push","id","errorMessages","reset","forEach","resetValidation","invalid","isValid","deep","flush","register","_ref","vm","some","unregister","filter","update","found","find","useForm"],"sources":["../../src/composables/form.ts"],"sourcesContent":["// Composables\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, inject, markRaw, provide, ref, shallowRef, toRef, watch } from 'vue'\nimport { consoleWarn, propsFactory } from '@/util'\n\n// Types\nimport type { ComponentInternalInstance, ComputedRef, InjectionKey, PropType, Raw, Ref } from 'vue'\nimport type { ValidationProps } from './validation'\nimport type { EventProp } from '@/util'\n\nexport interface FormProvide {\n register: (item: {\n id: number | string\n vm: ComponentInternalInstance\n validate: () => Promise<string[]>\n reset: () => Promise<void>\n resetValidation: () => Promise<void>\n }) => void\n unregister: (id: number | string) => void\n update: (id: number | string, isValid: boolean | null, errorMessages: string[]) => void\n items: Ref<FormField[]>\n isDisabled: ComputedRef<boolean>\n isReadonly: ComputedRef<boolean>\n isValidating: Ref<boolean>\n isValid: Ref<boolean | null>\n validateOn: Ref<FormProps['validateOn']>\n}\n\nexport interface FormField {\n id: number | string\n validate: () => Promise<string[]>\n reset: () => Promise<void>\n resetValidation: () => Promise<void>\n vm: Raw<ComponentInternalInstance>\n isValid: boolean | null\n errorMessages: string[]\n}\n\nexport interface FieldValidationResult {\n id: number | string\n errorMessages: string[]\n}\n\nexport interface FormValidationResult {\n valid: boolean\n errors: FieldValidationResult[]\n}\n\nexport interface SubmitEventPromise extends SubmitEvent, Promise<FormValidationResult> {}\n\nexport const FormKey: InjectionKey<FormProvide> = Symbol.for('vuetify:form')\n\nexport interface FormProps {\n disabled: boolean\n fastFail: boolean\n readonly: boolean\n modelValue: boolean | null\n 'onUpdate:modelValue': EventProp<[boolean | null]> | undefined\n validateOn: ValidationProps['validateOn']\n}\n\nexport const makeFormProps = propsFactory({\n disabled: Boolean,\n fastFail: Boolean,\n readonly: Boolean,\n modelValue: {\n type: Boolean as PropType<boolean | null>,\n default: null,\n },\n validateOn: {\n type: String as PropType<FormProps['validateOn']>,\n default: 'input',\n },\n}, 'form')\n\nexport function createForm (props: FormProps) {\n const model = useProxiedModel(props, 'modelValue')\n\n const isDisabled = computed(() => props.disabled)\n const isReadonly = computed(() => props.readonly)\n const isValidating = shallowRef(false)\n const items = ref<FormField[]>([])\n const errors = ref<FieldValidationResult[]>([])\n\n async function validate () {\n const results = []\n let valid = true\n\n errors.value = []\n isValidating.value = true\n\n for (const item of items.value) {\n const itemErrorMessages = await item.validate()\n\n if (itemErrorMessages.length > 0) {\n valid = false\n\n results.push({\n id: item.id,\n errorMessages: itemErrorMessages,\n })\n }\n\n if (!valid && props.fastFail) break\n }\n\n errors.value = results\n isValidating.value = false\n\n return { valid, errors: errors.value }\n }\n\n function reset () {\n items.value.forEach(item => item.reset())\n }\n\n function resetValidation () {\n items.value.forEach(item => item.resetValidation())\n }\n\n watch(items, () => {\n let valid = 0\n let invalid = 0\n const results = []\n\n for (const item of items.value) {\n if (item.isValid === false) {\n invalid++\n results.push({\n id: item.id,\n errorMessages: item.errorMessages,\n })\n } else if (item.isValid === true) valid++\n }\n\n errors.value = results\n model.value =\n invalid > 0 ? false\n : valid === items.value.length ? true\n : null\n }, { deep: true, flush: 'post' })\n\n provide(FormKey, {\n register: ({ id, vm, validate, reset, resetValidation }) => {\n if (items.value.some(item => item.id === id)) {\n consoleWarn(`Duplicate input name \"${id}\"`)\n }\n\n items.value.push({\n id,\n validate,\n reset,\n resetValidation,\n vm: markRaw(vm),\n isValid: null,\n errorMessages: [],\n })\n },\n unregister: id => {\n items.value = items.value.filter(item => {\n return item.id !== id\n })\n },\n update: (id, isValid, errorMessages) => {\n const found = items.value.find(item => item.id === id)\n\n if (!found) return\n\n found.isValid = isValid\n found.errorMessages = errorMessages\n },\n isDisabled,\n isReadonly,\n isValidating,\n isValid: model,\n items,\n validateOn: toRef(props, 'validateOn'),\n })\n\n return {\n errors,\n isDisabled,\n isReadonly,\n isValidating,\n isValid: model,\n items,\n validate,\n reset,\n resetValidation,\n }\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OAAO,GAAGA,OAAO;MACvBU,KAAK,CAACf,aAAa,GAAGA,aAAa;IACrC,CAAC;IACDd,UAAU;IACVC,UAAU;IACVC,YAAY;IACZiB,OAAO,EAAEpB,KAAK;IACdI,KAAK;IACLR,UAAU,EAAEf,KAAK,CAACkB,KAAK,EAAE,YAAY;EACvC,CAAC,CAAC;EAEF,OAAO;IACLM,MAAM;IACNJ,UAAU;IACVC,UAAU;IACVC,YAAY;IACZiB,OAAO,EAAEpB,KAAK;IACdI,KAAK;IACLE,QAAQ;IACRU,KAAK;IACLE;EACF,CAAC;AACH;AAEA,OAAO,SAASc,OAAOA,CAAA,EAAI;EACzB,OAAOxD,MAAM,CAACS,OAAO,EAAE,IAAI,CAAC;AAC9B","ignoreList":[]}
1
+ {"version":3,"file":"form.mjs","names":["useProxiedModel","computed","inject","markRaw","provide","ref","shallowRef","toRef","watch","consoleWarn","propsFactory","FormKey","Symbol","for","makeFormProps","disabled","Boolean","fastFail","readonly","modelValue","type","default","validateOn","String","createForm","props","model","isDisabled","isReadonly","isValidating","items","errors","validate","results","valid","value","item","itemErrorMessages","length","push","id","errorMessages","reset","forEach","resetValidation","invalid","isValid","deep","flush","register","_ref","vm","some","unregister","filter","update","found","find","useForm","form"],"sources":["../../src/composables/form.ts"],"sourcesContent":["// Composables\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, inject, markRaw, provide, ref, shallowRef, toRef, watch } from 'vue'\nimport { consoleWarn, propsFactory } from '@/util'\n\n// Types\nimport type { ComponentInternalInstance, ComputedRef, InjectionKey, PropType, Raw, Ref } from 'vue'\nimport type { ValidationProps } from './validation'\nimport type { EventProp } from '@/util'\n\nexport interface FormProvide {\n register: (item: {\n id: number | string\n vm: ComponentInternalInstance\n validate: () => Promise<string[]>\n reset: () => Promise<void>\n resetValidation: () => Promise<void>\n }) => void\n unregister: (id: number | string) => void\n update: (id: number | string, isValid: boolean | null, errorMessages: string[]) => void\n items: Ref<FormField[]>\n isDisabled: ComputedRef<boolean>\n isReadonly: ComputedRef<boolean>\n isValidating: Ref<boolean>\n isValid: Ref<boolean | null>\n validateOn: Ref<FormProps['validateOn']>\n}\n\nexport interface FormField {\n id: number | string\n validate: () => Promise<string[]>\n reset: () => Promise<void>\n resetValidation: () => Promise<void>\n vm: Raw<ComponentInternalInstance>\n isValid: boolean | null\n errorMessages: string[]\n}\n\nexport interface FieldValidationResult {\n id: number | string\n errorMessages: string[]\n}\n\nexport interface FormValidationResult {\n valid: boolean\n errors: FieldValidationResult[]\n}\n\nexport interface SubmitEventPromise extends SubmitEvent, Promise<FormValidationResult> {}\n\nexport const FormKey: InjectionKey<FormProvide> = Symbol.for('vuetify:form')\n\nexport interface FormProps {\n disabled: boolean\n fastFail: boolean\n readonly: boolean\n modelValue: boolean | null\n 'onUpdate:modelValue': EventProp<[boolean | null]> | undefined\n validateOn: ValidationProps['validateOn']\n}\n\nexport const makeFormProps = propsFactory({\n disabled: Boolean,\n fastFail: Boolean,\n readonly: Boolean,\n modelValue: {\n type: Boolean as PropType<boolean | null>,\n default: null,\n },\n validateOn: {\n type: String as PropType<FormProps['validateOn']>,\n default: 'input',\n },\n}, 'form')\n\nexport function createForm (props: FormProps) {\n const model = useProxiedModel(props, 'modelValue')\n\n const isDisabled = computed(() => props.disabled)\n const isReadonly = computed(() => props.readonly)\n const isValidating = shallowRef(false)\n const items = ref<FormField[]>([])\n const errors = ref<FieldValidationResult[]>([])\n\n async function validate () {\n const results = []\n let valid = true\n\n errors.value = []\n isValidating.value = true\n\n for (const item of items.value) {\n const itemErrorMessages = await item.validate()\n\n if (itemErrorMessages.length > 0) {\n valid = false\n\n results.push({\n id: item.id,\n errorMessages: itemErrorMessages,\n })\n }\n\n if (!valid && props.fastFail) break\n }\n\n errors.value = results\n isValidating.value = false\n\n return { valid, errors: errors.value }\n }\n\n function reset () {\n items.value.forEach(item => item.reset())\n }\n\n function resetValidation () {\n items.value.forEach(item => item.resetValidation())\n }\n\n watch(items, () => {\n let valid = 0\n let invalid = 0\n const results = []\n\n for (const item of items.value) {\n if (item.isValid === false) {\n invalid++\n results.push({\n id: item.id,\n errorMessages: item.errorMessages,\n })\n } else if (item.isValid === true) valid++\n }\n\n errors.value = results\n model.value =\n invalid > 0 ? false\n : valid === items.value.length ? true\n : null\n }, { deep: true, flush: 'post' })\n\n provide(FormKey, {\n register: ({ id, vm, validate, reset, resetValidation }) => {\n if (items.value.some(item => item.id === id)) {\n consoleWarn(`Duplicate input name \"${id}\"`)\n }\n\n items.value.push({\n id,\n validate,\n reset,\n resetValidation,\n vm: markRaw(vm),\n isValid: null,\n errorMessages: [],\n })\n },\n unregister: id => {\n items.value = items.value.filter(item => {\n return item.id !== id\n })\n },\n update: (id, isValid, errorMessages) => {\n const found = items.value.find(item => item.id === id)\n\n if (!found) return\n\n found.isValid = isValid\n found.errorMessages = errorMessages\n },\n isDisabled,\n isReadonly,\n isValidating,\n isValid: model,\n items,\n validateOn: toRef(props, 'validateOn'),\n })\n\n return {\n errors,\n isDisabled,\n isReadonly,\n isValidating,\n isValid: model,\n items,\n validate,\n reset,\n resetValidation,\n }\n}\n\nexport function useForm (props?: { readonly: boolean | null, disabled: boolean | null }) {\n const form = inject(FormKey, null)\n return {\n ...form,\n isReadonly: computed(() => !!(props?.readonly ?? form?.isReadonly.value)),\n isDisabled: computed(() => !!(props?.disabled ?? form?.isDisabled.value)),\n }\n}\n"],"mappings":"AAAA;AAAA,SACSA,eAAe,8BAExB;AACA,SAASC,QAAQ,EAAEC,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAEC,GAAG,EAAEC,UAAU,EAAEC,KAAK,EAAEC,KAAK,QAAQ,KAAK;AAAA,SAC9EC,WAAW,EAAEC,YAAY,6BAElC;AA6CA,OAAO,MAAMC,OAAkC,GAAGC,MAAM,CAACC,GAAG,CAAC,cAAc,CAAC;AAW5E,OAAO,MAAMC,aAAa,GAAGJ,YAAY,CAAC;EACxCK,QAAQ,EAAEC,OAAO;EACjBC,QAAQ,EAA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;EACvF,MAAMkC,IAAI,GAAGzD,MAAM,CAACS,OAAO,EAAE,IAAI,CAAC;EAClC,OAAO;IACL,GAAGgD,IAAI;IACP/B,UAAU,EAAE3B,QAAQ,CAAC,MAAM,CAAC,EAAEwB,KAAK,EAAEP,QAAQ,IAAIyC,IAAI,EAAE/B,UAAU,CAACO,KAAK,CAAC,CAAC;IACzER,UAAU,EAAE1B,QAAQ,CAAC,MAAM,CAAC,EAAEwB,KAAK,EAAEV,QAAQ,IAAI4C,IAAI,EAAEhC,UAAU,CAACQ,KAAK,CAAC;EAC1E,CAAC;AACH","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  // Composables
2
2
  import { useProxiedModel } from "./proxiedModel.mjs"; // Utilities
3
- import { computed, inject, onBeforeUnmount, onMounted, onUpdated, provide, reactive, toRef, unref, watch } from 'vue';
4
- import { consoleWarn, deepEqual, findChildrenWithProvide, getCurrentInstance, getUid, propsFactory, wrapInArray } from "../util/index.mjs"; // Types
3
+ import { computed, inject, onBeforeUnmount, onMounted, onUpdated, provide, reactive, toRef, unref, useId, watch } from 'vue';
4
+ import { consoleWarn, deepEqual, findChildrenWithProvide, getCurrentInstance, propsFactory, wrapInArray } from "../util/index.mjs"; // Types
5
5
  export const makeGroupProps = propsFactory({
6
6
  modelValue: {
7
7
  type: null,
@@ -27,7 +27,7 @@ export function useGroupItem(props, injectKey) {
27
27
  if (!vm) {
28
28
  throw new Error('[Vuetify] useGroupItem composable must be used inside a component setup function');
29
29
  }
30
- const id = getUid();
30
+ const id = useId();
31
31
  provide(Symbol.for(`${injectKey.description}:id`), id);
32
32
  const group = inject(injectKey, null);
33
33
  if (!group) {
@@ -1 +1 @@
1
- {"version":3,"file":"group.mjs","names":["useProxiedModel","computed","inject","onBeforeUnmount","onMounted","onUpdated","provide","reactive","toRef","unref","watch","consoleWarn","deepEqual","findChildrenWithProvide","getCurrentInstance","getUid","propsFactory","wrapInArray","makeGroupProps","modelValue","type","default","undefined","multiple","Boolean","mandatory","String","max","Number","selectedClass","disabled","makeGroupItemProps","value","useGroupItem","props","injectKey","required","arguments","length","vm","Error","id","Symbol","for","description","group","register","unregister","isSelected","isFirst","items","isLast","emit","flush","toggle","select","useGroup","isUnmounted","selected","v","getIds","arr","getValues","groupVm","item","unwrapped","key","children","vnode","index","indexOf","useIndexAsValue","splice","push","forceMandatoryValue","findIndex","find","i","internalValue","slice","includes","step","offset","currentId","currentIndex","newIndex","newItem","state","prev","next","getItemIndex","ids","forEach","itemByIndex","values","itemIndex"],"sources":["../../src/composables/group.ts"],"sourcesContent":["// Composables\nimport { useProxiedModel } from './proxiedModel'\n\n// Utilities\nimport { computed, inject, onBeforeUnmount, onMounted, onUpdated, provide, reactive, toRef, unref, watch } from 'vue'\nimport { consoleWarn, deepEqual, findChildrenWithProvide, getCurrentInstance, getUid, propsFactory, wrapInArray } from '@/util'\n\n// Types\nimport type { ComponentInternalInstance, ComputedRef, ExtractPropTypes, InjectionKey, PropType, Ref, UnwrapRef } from 'vue'\nimport type { EventProp } from '@/util'\n\nexport interface GroupItem {\n id: number\n value: Ref<unknown>\n disabled: Ref<boolean | undefined>\n useIndexAsValue?: boolean\n}\n\nexport interface GroupProps {\n disabled: boolean\n modelValue: unknown\n multiple?: boolean\n mandatory?: boolean | 'force' | undefined\n max?: number | undefined\n selectedClass: string | undefined\n 'onUpdate:modelValue': EventProp<[unknown]> | undefined\n}\n\nexport interface GroupProvide {\n register: (item: GroupItem, cmp: ComponentInternalInstance) => void\n unregister: (id: number) => void\n select: (id: number, value: boolean) => void\n selected: Ref<Readonly<number[]>>\n isSelected: (id: number) => boolean\n prev: () => void\n next: () => void\n selectedClass: Ref<string | undefined>\n items: ComputedRef<{\n id: number\n value: unknown\n disabled: boolean | undefined\n }[]>\n disabled: Ref<boolean | undefined>\n getItemIndex: (value: unknown) => number\n}\n\nexport interface GroupItemProvide {\n id: number\n isSelected: Ref<boolean>\n isFirst: Ref<boolean>\n isLast: Ref<boolean>\n toggle: () => void\n select: (value: boolean) => void\n selectedClass: Ref<(string | undefined)[] | false>\n value: Ref<unknown>\n disabled: Ref<boolean | undefined>\n group: GroupProvide\n}\n\nexport const makeGroupProps = propsFactory({\n modelValue: {\n type: null,\n default: undefined,\n },\n multiple: Boolean,\n mandatory: [Boolean, String] as PropType<boolean | 'force'>,\n max: Number,\n selectedClass: String,\n disabled: Boolean,\n}, 'group')\n\nexport const makeGroupItemProps = propsFactory({\n value: null,\n disabled: Boolean,\n selectedClass: String,\n}, 'group-item')\n\nexport interface GroupItemProps extends ExtractPropTypes<ReturnType<typeof makeGroupItemProps>> {\n 'onGroup:selected': EventProp<[{ value: boolean }]> | undefined\n}\n\n// Composables\nexport function useGroupItem (\n props: GroupItemProps,\n injectKey: InjectionKey<GroupProvide>,\n required?: true,\n): GroupItemProvide\nexport function useGroupItem (\n props: GroupItemProps,\n injectKey: InjectionKey<GroupProvide>,\n required: false,\n): GroupItemProvide | null\nexport function useGroupItem (\n props: GroupItemProps,\n injectKey: InjectionKey<GroupProvide>,\n required = true,\n): GroupItemProvide | null {\n const vm = getCurrentInstance('useGroupItem')\n\n if (!vm) {\n throw new Error(\n '[Vuetify] useGroupItem composable must be used inside a component setup function'\n )\n }\n\n const id = getUid()\n\n provide(Symbol.for(`${injectKey.description}:id`), id)\n\n const group = inject(injectKey, null)\n\n if (!group) {\n if (!required) return group\n\n throw new Error(`[Vuetify] Could not find useGroup injection with symbol ${injectKey.description}`)\n }\n\n const value = toRef(props, 'value')\n const disabled = computed(() => !!(group.disabled.value || props.disabled))\n\n group.register({\n id,\n value,\n disabled,\n }, vm)\n\n onBeforeUnmount(() => {\n group.unregister(id)\n })\n\n const isSelected = computed(() => {\n return group.isSelected(id)\n })\n const isFirst = computed(() => {\n return group.items.value[0].id === id\n })\n const isLast = computed(() => {\n return group.items.value[group.items.value.length - 1].id === id\n })\n\n const selectedClass = computed(() => isSelected.value && [group.selectedClass.value, props.selectedClass])\n\n watch(isSelected, value => {\n vm.emit('group:selected', { value })\n }, { flush: 'sync' })\n\n return {\n id,\n isSelected,\n isFirst,\n isLast,\n toggle: () => group.select(id, !isSelected.value),\n select: (value: boolean) => group.select(id, value),\n selectedClass,\n value,\n disabled,\n group,\n }\n}\n\nexport function useGroup (\n props: GroupProps,\n injectKey: InjectionKey<GroupProvide>\n) {\n let isUnmounted = false\n const items = reactive<GroupItem[]>([])\n const selected = useProxiedModel(\n props,\n 'modelValue',\n [],\n v => {\n if (v == null) return []\n\n return getIds(items, wrapInArray(v))\n },\n v => {\n const arr = getValues(items, v)\n\n return props.multiple ? arr : arr[0]\n }\n )\n\n const groupVm = getCurrentInstance('useGroup')\n\n function register (item: GroupItem, vm: ComponentInternalInstance) {\n // Is there a better way to fix this typing?\n const unwrapped = item as unknown as UnwrapRef<GroupItem>\n\n const key = Symbol.for(`${injectKey.description}:id`)\n const children = findChildrenWithProvide(key, groupVm?.vnode)\n const index = children.indexOf(vm)\n\n if (unref(unwrapped.value) == null) {\n unwrapped.value = index\n unwrapped.useIndexAsValue = true\n }\n\n if (index > -1) {\n items.splice(index, 0, unwrapped)\n } else {\n items.push(unwrapped)\n }\n }\n\n function unregister (id: number) {\n if (isUnmounted) return\n\n // TODO: re-evaluate this line's importance in the future\n // should we only modify the model if mandatory is set.\n // selected.value = selected.value.filter(v => v !== id)\n\n forceMandatoryValue()\n\n const index = items.findIndex(item => item.id === id)\n items.splice(index, 1)\n }\n\n // If mandatory and nothing is selected, then select first non-disabled item\n function forceMandatoryValue () {\n const item = items.find(item => !item.disabled)\n if (item && props.mandatory === 'force' && !selected.value.length) {\n selected.value = [item.id]\n }\n }\n\n onMounted(() => {\n forceMandatoryValue()\n })\n\n onBeforeUnmount(() => {\n isUnmounted = true\n })\n\n onUpdated(() => {\n // #19655 update the items that use the index as the value.\n for (let i = 0; i < items.length; i++) {\n if (items[i].useIndexAsValue) {\n items[i].value = i\n }\n }\n })\n\n function select (id: number, value?: boolean) {\n const item = items.find(item => item.id === id)\n if (value && item?.disabled) return\n\n if (props.multiple) {\n const internalValue = selected.value.slice()\n const index = internalValue.findIndex(v => v === id)\n const isSelected = ~index\n value = value ?? !isSelected\n\n // We can't remove value if group is\n // mandatory, value already exists,\n // and it is the only value\n if (\n isSelected &&\n props.mandatory &&\n internalValue.length <= 1\n ) return\n\n // We can't add value if it would\n // cause max limit to be exceeded\n if (\n !isSelected &&\n props.max != null &&\n internalValue.length + 1 > props.max\n ) return\n\n if (index < 0 && value) internalValue.push(id)\n else if (index >= 0 && !value) internalValue.splice(index, 1)\n\n selected.value = internalValue\n } else {\n const isSelected = selected.value.includes(id)\n if (props.mandatory && isSelected) return\n\n selected.value = (value ?? !isSelected) ? [id] : []\n }\n }\n\n function step (offset: number) {\n // getting an offset from selected value obviously won't work with multiple values\n if (props.multiple) consoleWarn('This method is not supported when using \"multiple\" prop')\n\n if (!selected.value.length) {\n const item = items.find(item => !item.disabled)\n item && (selected.value = [item.id])\n } else {\n const currentId = selected.value[0]\n const currentIndex = items.findIndex(i => i.id === currentId)\n\n let newIndex = (currentIndex + offset) % items.length\n let newItem = items[newIndex]\n\n while (newItem.disabled && newIndex !== currentIndex) {\n newIndex = (newIndex + offset) % items.length\n newItem = items[newIndex]\n }\n\n if (newItem.disabled) return\n\n selected.value = [items[newIndex].id]\n }\n }\n\n const state: GroupProvide = {\n register,\n unregister,\n selected,\n select,\n disabled: toRef(props, 'disabled'),\n prev: () => step(items.length - 1),\n next: () => step(1),\n isSelected: (id: number) => selected.value.includes(id),\n selectedClass: computed(() => props.selectedClass),\n items: computed(() => items),\n getItemIndex: (value: unknown) => getItemIndex(items, value),\n }\n\n provide(injectKey, state)\n\n return state\n}\n\nfunction getItemIndex (items: UnwrapRef<GroupItem[]>, value: unknown) {\n const ids = getIds(items, [value])\n\n if (!ids.length) return -1\n\n return items.findIndex(item => item.id === ids[0])\n}\n\nfunction getIds (items: UnwrapRef<GroupItem[]>, modelValue: any[]) {\n const ids: number[] = []\n\n modelValue.forEach(value => {\n const item = items.find(item => deepEqual(value, item.value))\n const itemByIndex = items[value]\n\n if (item?.value != null) {\n ids.push(item.id)\n } else if (itemByIndex != null) {\n ids.push(itemByIndex.id)\n }\n })\n\n return ids\n}\n\nfunction getValues (items: UnwrapRef<GroupItem[]>, ids: any[]) {\n const values: unknown[] = []\n\n ids.forEach(id => {\n const itemIndex = items.findIndex(item => item.id === id)\n if (~itemIndex) {\n const item = items[itemIndex]\n values.push(item.value != null ? item.value : itemIndex)\n }\n })\n\n return values\n}\n"],"mappings":"AAAA;AAAA,SACSA,eAAe,8BAExB;AACA,SAASC,QAAQ,EAAEC,MAAM,EAAEC,eAAe,EAAEC,SAAS,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,KAAK,EAAEC,KAAK,QAAQ,KAAK;AAAA,SAC5GC,WAAW,EAAEC,SAAS,EAAEC,uBAAuB,EAAEC,kBAAkB,EAAEC,MAAM,EAAEC,YAAY,EAAEC,WAAW,6BAE/G;AAoDA,OAAO,MAAMC,cAAc,GAAGF,YAAY,CAAC;EACzCG,UAAU,EAAE;IACVC,IAAI,EAAE,IAAI;IACVC,OAAO,EAAEC;EACX,CAAC;EACDC,QAAQ,EAAEC,OAAO;EACjBC,SAAS,EAAE,CAACD,OAAO,EAAEE,MAAM,CAAgC;EAC3DC,GAAG,EAAEC,MAAM;EACXC,aAAa,EAAEH,MAAM;EACrBI,QAAQ,EAAEN;AACZ,CAAC,EAAE,OAAO,CAAC;AAEX,OAAO,MAAMO,kBAAkB,GAAGf,YAAY,CAAC;EAC7CgB,KAAK,EAAE,IAAI;EACXF,QAAQ,EAAEN,OAAO;EACjBK,aAAa,EAAEH;AACjB,CAAC,EAAE,YAAY,CAAC;;AAMhB;;AAWA,OAAO,SAASO,YAAYA,CAC1BC,KAAqB,EACrBC,SAAqC,EAEZ;EAAA,IADzBC,QAAQ,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAf,SAAA,GAAAe,SAAA,MAAG,IAAI;EAEf,MAAME,EA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F,CAAC,CAAC;EAEF,OAAOD,MAAM;AACf","ignoreList":[]}
1
+ {"version":3,"file":"group.mjs","names":["useProxiedModel","computed","inject","onBeforeUnmount","onMounted","onUpdated","provide","reactive","toRef","unref","useId","watch","consoleWarn","deepEqual","findChildrenWithProvide","getCurrentInstance","propsFactory","wrapInArray","makeGroupProps","modelValue","type","default","undefined","multiple","Boolean","mandatory","String","max","Number","selectedClass","disabled","makeGroupItemProps","value","useGroupItem","props","injectKey","required","arguments","length","vm","Error","id","Symbol","for","description","group","register","unregister","isSelected","isFirst","items","isLast","emit","flush","toggle","select","useGroup","isUnmounted","selected","v","getIds","arr","getValues","groupVm","item","unwrapped","key","children","vnode","index","indexOf","useIndexAsValue","splice","push","forceMandatoryValue","findIndex","find","i","internalValue","slice","includes","step","offset","currentId","currentIndex","newIndex","newItem","state","prev","next","getItemIndex","ids","forEach","itemByIndex","values","itemIndex"],"sources":["../../src/composables/group.ts"],"sourcesContent":["// Composables\nimport { useProxiedModel } from './proxiedModel'\n\n// Utilities\nimport { computed, inject, onBeforeUnmount, onMounted, onUpdated, provide, reactive, toRef, unref, useId, watch } from 'vue'\nimport { consoleWarn, deepEqual, findChildrenWithProvide, getCurrentInstance, propsFactory, wrapInArray } from '@/util'\n\n// Types\nimport type { ComponentInternalInstance, ComputedRef, ExtractPropTypes, InjectionKey, PropType, Ref, UnwrapRef } from 'vue'\nimport type { EventProp } from '@/util'\n\nexport interface GroupItem {\n id: string\n value: Ref<unknown>\n disabled: Ref<boolean | undefined>\n useIndexAsValue?: boolean\n}\n\nexport interface GroupProps {\n disabled: boolean\n modelValue: unknown\n multiple?: boolean\n mandatory?: boolean | 'force' | undefined\n max?: number | undefined\n selectedClass: string | undefined\n 'onUpdate:modelValue': EventProp<[unknown]> | undefined\n}\n\nexport interface GroupProvide {\n register: (item: GroupItem, cmp: ComponentInternalInstance) => void\n unregister: (id: string) => void\n select: (id: string, value: boolean) => void\n selected: Ref<Readonly<string[]>>\n isSelected: (id: string) => boolean\n prev: () => void\n next: () => void\n selectedClass: Ref<string | undefined>\n items: ComputedRef<{\n id: string\n value: unknown\n disabled: boolean | undefined\n }[]>\n disabled: Ref<boolean | undefined>\n getItemIndex: (value: unknown) => number\n}\n\nexport interface GroupItemProvide {\n id: string\n isSelected: Ref<boolean>\n isFirst: Ref<boolean>\n isLast: Ref<boolean>\n toggle: () => void\n select: (value: boolean) => void\n selectedClass: Ref<(string | undefined)[] | false>\n value: Ref<unknown>\n disabled: Ref<boolean | undefined>\n group: GroupProvide\n}\n\nexport const makeGroupProps = propsFactory({\n modelValue: {\n type: null,\n default: undefined,\n },\n multiple: Boolean,\n mandatory: [Boolean, String] as PropType<boolean | 'force'>,\n max: Number,\n selectedClass: String,\n disabled: Boolean,\n}, 'group')\n\nexport const makeGroupItemProps = propsFactory({\n value: null,\n disabled: Boolean,\n selectedClass: String,\n}, 'group-item')\n\nexport interface GroupItemProps extends ExtractPropTypes<ReturnType<typeof makeGroupItemProps>> {\n 'onGroup:selected': EventProp<[{ value: boolean }]> | undefined\n}\n\n// Composables\nexport function useGroupItem (\n props: GroupItemProps,\n injectKey: InjectionKey<GroupProvide>,\n required?: true,\n): GroupItemProvide\nexport function useGroupItem (\n props: GroupItemProps,\n injectKey: InjectionKey<GroupProvide>,\n required: false,\n): GroupItemProvide | null\nexport function useGroupItem (\n props: GroupItemProps,\n injectKey: InjectionKey<GroupProvide>,\n required = true,\n): GroupItemProvide | null {\n const vm = getCurrentInstance('useGroupItem')\n\n if (!vm) {\n throw new Error(\n '[Vuetify] useGroupItem composable must be used inside a component setup function'\n )\n }\n\n const id = useId()\n\n provide(Symbol.for(`${injectKey.description}:id`), id)\n\n const group = inject(injectKey, null)\n\n if (!group) {\n if (!required) return group\n\n throw new Error(`[Vuetify] Could not find useGroup injection with symbol ${injectKey.description}`)\n }\n\n const value = toRef(props, 'value')\n const disabled = computed(() => !!(group.disabled.value || props.disabled))\n\n group.register({\n id,\n value,\n disabled,\n }, vm)\n\n onBeforeUnmount(() => {\n group.unregister(id)\n })\n\n const isSelected = computed(() => {\n return group.isSelected(id)\n })\n const isFirst = computed(() => {\n return group.items.value[0].id === id\n })\n const isLast = computed(() => {\n return group.items.value[group.items.value.length - 1].id === id\n })\n\n const selectedClass = computed(() => isSelected.value && [group.selectedClass.value, props.selectedClass])\n\n watch(isSelected, value => {\n vm.emit('group:selected', { value })\n }, { flush: 'sync' })\n\n return {\n id,\n isSelected,\n isFirst,\n isLast,\n toggle: () => group.select(id, !isSelected.value),\n select: (value: boolean) => group.select(id, value),\n selectedClass,\n value,\n disabled,\n group,\n }\n}\n\nexport function useGroup (\n props: GroupProps,\n injectKey: InjectionKey<GroupProvide>\n) {\n let isUnmounted = false\n const items = reactive<GroupItem[]>([])\n const selected = useProxiedModel(\n props,\n 'modelValue',\n [],\n v => {\n if (v == null) return []\n\n return getIds(items, wrapInArray(v))\n },\n v => {\n const arr = getValues(items, v)\n\n return props.multiple ? arr : arr[0]\n }\n )\n\n const groupVm = getCurrentInstance('useGroup')\n\n function register (item: GroupItem, vm: ComponentInternalInstance) {\n // Is there a better way to fix this typing?\n const unwrapped = item as unknown as UnwrapRef<GroupItem>\n\n const key = Symbol.for(`${injectKey.description}:id`)\n const children = findChildrenWithProvide(key, groupVm?.vnode)\n const index = children.indexOf(vm)\n\n if (unref(unwrapped.value) == null) {\n unwrapped.value = index\n unwrapped.useIndexAsValue = true\n }\n\n if (index > -1) {\n items.splice(index, 0, unwrapped)\n } else {\n items.push(unwrapped)\n }\n }\n\n function unregister (id: string) {\n if (isUnmounted) return\n\n // TODO: re-evaluate this line's importance in the future\n // should we only modify the model if mandatory is set.\n // selected.value = selected.value.filter(v => v !== id)\n\n forceMandatoryValue()\n\n const index = items.findIndex(item => item.id === id)\n items.splice(index, 1)\n }\n\n // If mandatory and nothing is selected, then select first non-disabled item\n function forceMandatoryValue () {\n const item = items.find(item => !item.disabled)\n if (item && props.mandatory === 'force' && !selected.value.length) {\n selected.value = [item.id]\n }\n }\n\n onMounted(() => {\n forceMandatoryValue()\n })\n\n onBeforeUnmount(() => {\n isUnmounted = true\n })\n\n onUpdated(() => {\n // #19655 update the items that use the index as the value.\n for (let i = 0; i < items.length; i++) {\n if (items[i].useIndexAsValue) {\n items[i].value = i\n }\n }\n })\n\n function select (id: string, value?: boolean) {\n const item = items.find(item => item.id === id)\n if (value && item?.disabled) return\n\n if (props.multiple) {\n const internalValue = selected.value.slice()\n const index = internalValue.findIndex(v => v === id)\n const isSelected = ~index\n value = value ?? !isSelected\n\n // We can't remove value if group is\n // mandatory, value already exists,\n // and it is the only value\n if (\n isSelected &&\n props.mandatory &&\n internalValue.length <= 1\n ) return\n\n // We can't add value if it would\n // cause max limit to be exceeded\n if (\n !isSelected &&\n props.max != null &&\n internalValue.length + 1 > props.max\n ) return\n\n if (index < 0 && value) internalValue.push(id)\n else if (index >= 0 && !value) internalValue.splice(index, 1)\n\n selected.value = internalValue\n } else {\n const isSelected = selected.value.includes(id)\n if (props.mandatory && isSelected) return\n\n selected.value = (value ?? !isSelected) ? [id] : []\n }\n }\n\n function step (offset: number) {\n // getting an offset from selected value obviously won't work with multiple values\n if (props.multiple) consoleWarn('This method is not supported when using \"multiple\" prop')\n\n if (!selected.value.length) {\n const item = items.find(item => !item.disabled)\n item && (selected.value = [item.id])\n } else {\n const currentId = selected.value[0]\n const currentIndex = items.findIndex(i => i.id === currentId)\n\n let newIndex = (currentIndex + offset) % items.length\n let newItem = items[newIndex]\n\n while (newItem.disabled && newIndex !== currentIndex) {\n newIndex = (newIndex + offset) % items.length\n newItem = items[newIndex]\n }\n\n if (newItem.disabled) return\n\n selected.value = [items[newIndex].id]\n }\n }\n\n const state: GroupProvide = {\n register,\n unregister,\n selected,\n select,\n disabled: toRef(props, 'disabled'),\n prev: () => step(items.length - 1),\n next: () => step(1),\n isSelected: (id: string) => selected.value.includes(id),\n selectedClass: computed(() => props.selectedClass),\n items: computed(() => items),\n getItemIndex: (value: unknown) => getItemIndex(items, value),\n }\n\n provide(injectKey, state)\n\n return state\n}\n\nfunction getItemIndex (items: UnwrapRef<GroupItem[]>, value: unknown) {\n const ids = getIds(items, [value])\n\n if (!ids.length) return -1\n\n return items.findIndex(item => item.id === ids[0])\n}\n\nfunction getIds (items: UnwrapRef<GroupItem[]>, modelValue: any[]) {\n const ids: string[] = []\n\n modelValue.forEach(value => {\n const item = items.find(item => deepEqual(value, item.value))\n const itemByIndex = items[value]\n\n if (item?.value != null) {\n ids.push(item.id)\n } else if (itemByIndex != null) {\n ids.push(itemByIndex.id)\n }\n })\n\n return ids\n}\n\nfunction getValues (items: UnwrapRef<GroupItem[]>, ids: any[]) {\n const values: unknown[] = []\n\n ids.forEach(id => {\n const itemIndex = items.findIndex(item => item.id === id)\n if (~itemIndex) {\n const item = items[itemIndex]\n values.push(item.value != null ? item.value : itemIndex)\n }\n })\n\n return values\n}\n"],"mappings":"AAAA;AAAA,SACSA,eAAe,8BAExB;AACA,SAASC,QAAQ,EAAEC,MAAM,EAAEC,eAAe,EAAEC,SAAS,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,KAAK,EAAEC,KAAK,EAAEC,KAAK,QAAQ,KAAK;AAAA,SACnHC,WAAW,EAAEC,SAAS,EAAEC,uBAAuB,EAAEC,kBAAkB,EAAEC,YAAY,EAAEC,WAAW,6BAEvG;AAoDA,OAAO,MAAMC,cAAc,GAAGF,YAAY,CAAC;EACzCG,UAAU,EAAE;IACVC,IAAI,EAAE,IAAI;IACVC,OAAO,EAAEC;EACX,CAAC;EACDC,QAAQ,EAAEC,OAAO;EACjBC,SAAS,EAAE,CAACD,OAAO,EAAEE,MAAM,CAAgC;EAC3DC,GAAG,EAAEC,MAAM;EACXC,aAAa,EAAEH,MAAM;EACrBI,QAAQ,EAAEN;AACZ,CAAC,EAAE,OAAO,CAAC;AAEX,OAAO,MAAMO,kBAAkB,GAAGf,YAAY,CAAC;EAC7CgB,KAAK,EAAE,IAAI;EACXF,QAAQ,EAAEN,OA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AACvB,EAAE,KAAKA,EAAE,CAAC;IACzD,IAAI,CAACsD,SAAS,EAAE;MACd,MAAM/B,IAAI,GAAGd,KAAK,CAAC6C,SAAS,CAAC;MAC7BD,MAAM,CAACrB,IAAI,CAACT,IAAI,CAAChC,KAAK,IAAI,IAAI,GAAGgC,IAAI,CAAChC,KAAK,GAAG+D,SAAS,CAAC;IAC1D;EACF,CAAC,CAAC;EAEF,OAAOD,MAAM;AACf","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  // Composables
2
2
  import { useResizeObserver } from "./resizeObserver.mjs"; // Utilities
3
- import { computed, inject, onActivated, onBeforeUnmount, onDeactivated, onMounted, provide, reactive, ref, shallowRef } from 'vue';
4
- import { convertToUnit, findChildrenWithProvide, getCurrentInstance, getUid, propsFactory } from "../util/index.mjs"; // Types
3
+ import { computed, inject, onActivated, onBeforeUnmount, onDeactivated, onMounted, provide, reactive, ref, shallowRef, useId } from 'vue';
4
+ import { convertToUnit, findChildrenWithProvide, getCurrentInstance, propsFactory } from "../util/index.mjs"; // Types
5
5
  export const VuetifyLayoutKey = Symbol.for('vuetify:layout');
6
6
  export const VuetifyLayoutItemKey = Symbol.for('vuetify:layout-item');
7
7
  const ROOT_ZINDEX = 1000;
@@ -36,7 +36,7 @@ export function useLayout() {
36
36
  export function useLayoutItem(options) {
37
37
  const layout = inject(VuetifyLayoutKey);
38
38
  if (!layout) throw new Error('[Vuetify] Could not find injected layout');
39
- const id = options.id ?? `layout-item-${getUid()}`;
39
+ const id = options.id ?? `layout-item-${useId()}`;
40
40
  const vm = getCurrentInstance('useLayoutItem');
41
41
  provide(VuetifyLayoutItemKey, {
42
42
  id
@@ -1 +1 @@
1
- {"version":3,"file":"layout.mjs","names":["useResizeObserver","computed","inject","onActivated","onBeforeUnmount","onDeactivated","onMounted","provide","reactive","ref","shallowRef","convertToUnit","findChildrenWithProvide","getCurrentInstance","getUid","propsFactory","VuetifyLayoutKey","Symbol","for","VuetifyLayoutItemKey","ROOT_ZINDEX","makeLayoutProps","overlaps","type","Array","default","fullHeight","Boolean","makeLayoutItemProps","name","String","order","Number","absolute","useLayout","layout","Error","getLayoutItem","mainRect","mainStyles","useLayoutItem","options","id","vm","isKeptAlive","value","layoutItemStyles","layoutItemScrimStyles","register","active","unregister","layoutRect","generateLayers","positions","layoutSizes","activeItems","previousLayer","top","left","right","bottom","layers","layer","position","get","amount","parseInt","push","createLayout","props","parentLayout","rootZIndex","registered","Map","priorities","disabledTransitions","resizeRef","contentRect","computedOverlaps","map","overlap","filter","item","includes","split","topPosition","bottomPosition","topAmount","bottomAmount","set","uniquePriorities","Set","values","p","sort","a","b","items","transitionsEnabled","from","some","length","undefined","transition","slice","_ref","index","size","find","rootVm","isMounted","_ref2","layoutSize","elementSize","disableTransitions","instances","vnode","instanceIndex","indexOf","splice","findIndex","i","zIndex","isHorizontal","isOppositeHorizontal","isOppositeVertical","unit","styles","transform","height","width","delete","v","layoutClasses","layoutStyles","overflow","layoutRef"],"sources":["../../src/composables/layout.ts"],"sourcesContent":["// Composables\nimport { useResizeObserver } from '@/composables/resizeObserver'\n\n// Utilities\nimport {\n computed,\n inject,\n onActivated,\n onBeforeUnmount,\n onDeactivated,\n onMounted,\n provide,\n reactive,\n ref,\n shallowRef,\n} from 'vue'\nimport { convertToUnit, findChildrenWithProvide, getCurrentInstance, getUid, propsFactory } from '@/util'\n\n// Types\nimport type { ComponentInternalInstance, CSSProperties, InjectionKey, Prop, Ref } from 'vue'\n\nexport type Position = 'top' | 'left' | 'right' | 'bottom'\n\ninterface Layer {\n top: number\n bottom: number\n left: number\n right: number\n}\n\ninterface LayoutItem extends Layer {\n id: string\n size: number\n position: Position\n}\n\ninterface LayoutProvide {\n register: (\n vm: ComponentInternalInstance,\n options: {\n id: string\n order: Ref<number>\n position: Ref<Position>\n layoutSize: Ref<number | string>\n elementSize: Ref<number | string | undefined>\n active: Ref<boolean>\n disableTransitions?: Ref<boolean>\n absolute: Ref<boolean | undefined>\n }\n ) => {\n layoutItemStyles: Ref<CSSProperties>\n layoutItemScrimStyles: Ref<CSSProperties>\n zIndex: Ref<number>\n }\n unregister: (id: string) => void\n mainRect: Ref<Layer>\n mainStyles: Ref<CSSProperties>\n getLayoutItem: (id: string) => LayoutItem | undefined\n items: Ref<LayoutItem[]>\n layoutRect: Ref<DOMRectReadOnly | undefined>\n rootZIndex: Ref<number>\n}\n\nexport const VuetifyLayoutKey: InjectionKey<LayoutProvide> = Symbol.for('vuetify:layout')\nexport const VuetifyLayoutItemKey: InjectionKey<{ id: string }> = Symbol.for('vuetify:layout-item')\n\nconst ROOT_ZINDEX = 1000\n\nexport const makeLayoutProps = propsFactory({\n overlaps: {\n type: Array,\n default: () => ([]),\n } as Prop<string[]>,\n fullHeight: Boolean,\n}, 'layout')\n\n// Composables\nexport const makeLayoutItemProps = propsFactory({\n name: {\n type: String,\n },\n order: {\n type: [Number, String],\n default: 0,\n },\n absolute: Boolean,\n}, 'layout-item')\n\nexport function useLayout () {\n const layout = inject(VuetifyLayoutKey)\n\n if (!layout) throw new Error('[Vuetify] Could not find injected layout')\n\n return {\n getLayoutItem: layout.getLayoutItem,\n mainRect: layout.mainRect,\n mainStyles: layout.mainStyles,\n }\n}\n\nexport function useLayoutItem (options: {\n id: string | undefined\n order: Ref<number>\n position: Ref<Position>\n layoutSize: Ref<number | string>\n elementSize: Ref<number | string | undefined>\n active: Ref<boolean>\n disableTransitions?: Ref<boolean>\n absolute: Ref<boolean | undefined>\n}) {\n const layout = inject(VuetifyLayoutKey)\n\n if (!layout) throw new Error('[Vuetify] Could not find injected layout')\n\n const id = options.id ?? `layout-item-${getUid()}`\n\n const vm = getCurrentInstance('useLayoutItem')\n\n provide(VuetifyLayoutItemKey, { id })\n\n const isKeptAlive = shallowRef(false)\n onDeactivated(() => isKeptAlive.value = true)\n onActivated(() => isKeptAlive.value = false)\n\n const {\n layoutItemStyles,\n layoutItemScrimStyles,\n } = layout.register(vm, {\n ...options,\n active: computed(() => isKeptAlive.value ? false : options.active.value),\n id,\n })\n\n onBeforeUnmount(() => layout.unregister(id))\n\n return { layoutItemStyles, layoutRect: layout.layoutRect, layoutItemScrimStyles }\n}\n\nconst generateLayers = (\n layout: string[],\n positions: Map<string, Ref<Position>>,\n layoutSizes: Map<string, Ref<number | string>>,\n activeItems: Map<string, Ref<boolean>>,\n): { id: string, layer: Layer }[] => {\n let previousLayer: Layer = { top: 0, left: 0, right: 0, bottom: 0 }\n const layers = [{ id: '', layer: { ...previousLayer } }]\n for (const id of layout) {\n const position = positions.get(id)\n const amount = layoutSizes.get(id)\n const active = activeItems.get(id)\n if (!position || !amount || !active) continue\n\n const layer = {\n ...previousLayer,\n [position.value]: parseInt(previousLayer[position.value], 10) + (active.value ? parseInt(amount.value, 10) : 0),\n }\n\n layers.push({\n id,\n layer,\n })\n\n previousLayer = layer\n }\n\n return layers\n}\n\nexport function createLayout (props: { overlaps?: string[], fullHeight?: boolean }) {\n const parentLayout = inject(VuetifyLayoutKey, null)\n const rootZIndex = computed(() => parentLayout ? parentLayout.rootZIndex.value - 100 : ROOT_ZINDEX)\n const registered = ref<string[]>([])\n const positions = reactive(new Map<string, Ref<Position>>())\n const layoutSizes = reactive(new Map<string, Ref<number | string>>())\n const priorities = reactive(new Map<string, Ref<number>>())\n const activeItems = reactive(new Map<string, Ref<boolean>>())\n const disabledTransitions = reactive(new Map<string, Ref<boolean>>())\n const { resizeRef, contentRect: layoutRect } = useResizeObserver()\n\n const computedOverlaps = computed(() => {\n const map = new Map<string, { position: Position, amount: number }>()\n const overlaps = props.overlaps ?? []\n for (const overlap of overlaps.filter(item => item.includes(':'))) {\n const [top, bottom] = overlap.split(':')\n if (!registered.value.includes(top) || !registered.value.includes(bottom)) continue\n\n const topPosition = positions.get(top)\n const bottomPosition = positions.get(bottom)\n const topAmount = layoutSizes.get(top)\n const bottomAmount = layoutSizes.get(bottom)\n\n if (!topPosition || !bottomPosition || !topAmount || !bottomAmount) continue\n\n map.set(bottom, { position: topPosition.value, amount: parseInt(topAmount.value, 10) })\n map.set(top, { position: bottomPosition.value, amount: -parseInt(bottomAmount.value, 10) })\n }\n\n return map\n })\n\n const layers = computed(() => {\n const uniquePriorities = [...new Set([...priorities.values()].map(p => p.value))].sort((a, b) => a - b)\n const layout = []\n for (const p of uniquePriorities) {\n const items = registered.value.filter(id => priorities.get(id)?.value === p)\n layout.push(...items)\n }\n return generateLayers(layout, positions, layoutSizes, activeItems)\n })\n\n const transitionsEnabled = computed(() => {\n return !Array.from(disabledTransitions.values()).some(ref => ref.value)\n })\n\n const mainRect = computed(() => {\n return layers.value[layers.value.length - 1].layer\n })\n\n const mainStyles = computed<CSSProperties>(() => {\n return {\n '--v-layout-left': convertToUnit(mainRect.value.left),\n '--v-layout-right': convertToUnit(mainRect.value.right),\n '--v-layout-top': convertToUnit(mainRect.value.top),\n '--v-layout-bottom': convertToUnit(mainRect.value.bottom),\n ...(transitionsEnabled.value ? undefined : { transition: 'none' }),\n }\n })\n\n const items = computed(() => {\n return layers.value.slice(1).map(({ id }, index) => {\n const { layer } = layers.value[index]\n const size = layoutSizes.get(id)\n const position = positions.get(id)\n\n return {\n id,\n ...layer,\n size: Number(size!.value),\n position: position!.value,\n }\n })\n })\n\n const getLayoutItem = (id: string) => {\n return items.value.find(item => item.id === id)\n }\n\n const rootVm = getCurrentInstance('createLayout')\n\n const isMounted = shallowRef(false)\n onMounted(() => {\n isMounted.value = true\n })\n\n provide(VuetifyLayoutKey, {\n register: (\n vm: ComponentInternalInstance,\n {\n id,\n order,\n position,\n layoutSize,\n elementSize,\n active,\n disableTransitions,\n absolute,\n }\n ) => {\n priorities.set(id, order)\n positions.set(id, position)\n layoutSizes.set(id, layoutSize)\n activeItems.set(id, active)\n disableTransitions && disabledTransitions.set(id, disableTransitions)\n\n const instances = findChildrenWithProvide(VuetifyLayoutItemKey, rootVm?.vnode)\n const instanceIndex = instances.indexOf(vm)\n\n if (instanceIndex > -1) registered.value.splice(instanceIndex, 0, id)\n else registered.value.push(id)\n\n const index = computed(() => items.value.findIndex(i => i.id === id))\n const zIndex = computed(() => rootZIndex.value + (layers.value.length * 2) - (index.value * 2))\n\n const layoutItemStyles = computed<CSSProperties>(() => {\n const isHorizontal = position.value === 'left' || position.value === 'right'\n const isOppositeHorizontal = position.value === 'right'\n const isOppositeVertical = position.value === 'bottom'\n const size = elementSize.value ?? layoutSize.value\n const unit = size === 0 ? '%' : 'px'\n\n const styles = {\n [position.value]: 0,\n zIndex: zIndex.value,\n transform: `translate${isHorizontal ? 'X' : 'Y'}(${(active.value ? 0 : -(size === 0 ? 100 : size)) * (isOppositeHorizontal || isOppositeVertical ? -1 : 1)}${unit})`,\n position: absolute.value || rootZIndex.value !== ROOT_ZINDEX ? 'absolute' : 'fixed',\n ...(transitionsEnabled.value ? undefined : { transition: 'none' }),\n } as const\n\n if (!isMounted.value) return styles\n\n const item = items.value[index.value]\n\n if (!item) throw new Error(`[Vuetify] Could not find layout item \"${id}\"`)\n\n const overlap = computedOverlaps.value.get(id)\n if (overlap) {\n item[overlap.position] += overlap.amount\n }\n\n return {\n ...styles,\n height:\n isHorizontal ? `calc(100% - ${item.top}px - ${item.bottom}px)`\n : elementSize.value ? `${elementSize.value}px`\n : undefined,\n left: isOppositeHorizontal ? undefined : `${item.left}px`,\n right: isOppositeHorizontal ? `${item.right}px` : undefined,\n top: position.value !== 'bottom' ? `${item.top}px` : undefined,\n bottom: position.value !== 'top' ? `${item.bottom}px` : undefined,\n width:\n !isHorizontal ? `calc(100% - ${item.left}px - ${item.right}px)`\n : elementSize.value ? `${elementSize.value}px`\n : undefined,\n }\n })\n\n const layoutItemScrimStyles = computed<CSSProperties>(() => ({\n zIndex: zIndex.value - 1,\n }))\n\n return { layoutItemStyles, layoutItemScrimStyles, zIndex }\n },\n unregister: (id: string) => {\n priorities.delete(id)\n positions.delete(id)\n layoutSizes.delete(id)\n activeItems.delete(id)\n disabledTransitions.delete(id)\n registered.value = registered.value.filter(v => v !== id)\n },\n mainRect,\n mainStyles,\n getLayoutItem,\n items,\n layoutRect,\n rootZIndex,\n })\n\n const layoutClasses = computed(() => [\n 'v-layout',\n { 'v-layout--full-height': props.fullHeight },\n ])\n\n const layoutStyles = computed(() => ({\n zIndex: parentLayout ? rootZIndex.value : undefined,\n position: parentLayout ? 'relative' as const : undefined,\n overflow: parentLayout ? 'hidden' : undefined,\n }))\n\n return {\n layoutClasses,\n layoutStyles,\n getLayoutItem,\n items,\n layoutRect,\n layoutRef: resizeRef,\n }\n}\n"],"mappings":"AAAA;AAAA,SACSA,iBAAiB,gCAE1B;AACA,SACEC,QAAQ,EACRC,MAAM,EACNC,WAAW,EACXC,eAAe,EACfC,aAAa,EACbC,SAAS,EACTC,OAAO,EACPC,QAAQ,EACRC,GAAG,EACHC,UAAU,QACL,KAAK;AAAA,SACHC,aAAa,EAAEC,uBAAuB,EAAEC,kBAAkB,EAAEC,MAAM,EAAEC,YAAY,6BAEzF;AA6CA,OAAO,MAAMC,gBAA6C,GAAGC,MAAM,CAACC,GAAG,CAAC,gBAAgB,CAAC;AACzF,OAAO,MAAMC,oBAAkD,GAAGF,MAAM,CAACC,GAAG,CAAC,qBAAqB,CAAC;AAEnG,MAAME,WAAW,GAAG,IAAI;AAExB,OAAO,MAAMC,eAAe,GAAGN,YAAY,CAAC;EAC1CO,QAAQ,EAAE;IACRC,IAAI,EAAEC,KAAK;IACXC,OAAO,EAAEA,CAAA,KAAO;EAClB,CAAmB;EACnBC,UAAU,EAAEC;AACd,CAAC,EAAE,QAAQ,CAAC;;AAEZ;AACA,OAAO,MAAMC,mBAAmB,GAAGb,YAAY,CAAC;EAC9Cc,IAAI,EAAE;IACJN,IAAI,EAAEO;EACR,CAAC;EACDC,KAAK,EAAE;IACLR,IAAI,EAAE,CAACS,MAAM,EAAEF,MAAM,CAAC;IACtBL,OAAO,EAAE;EACX,CAAC;EACDQ,QAAQ,EAAEN;AACZ,CAAC,EAAE,aAAa,CAAC;AAEjB,OAAO,SAASO,SAASA,CAAA,EAAI;EAC3B,MAAMC,MAAM,G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C,CAC9C,CAAC;EAEF,MAAM4G,YAAY,GAAGrI,QAAQ,CAAC,OAAO;IACnCyH,MAAM,EAAEpD,YAAY,GAAGC,UAAU,CAAC1B,KAAK,GAAGyD,SAAS;IACnDvC,QAAQ,EAAEO,YAAY,GAAG,UAAU,GAAYgC,SAAS;IACxDiC,QAAQ,EAAEjE,YAAY,GAAG,QAAQ,GAAGgC;EACtC,CAAC,CAAC,CAAC;EAEH,OAAO;IACL+B,aAAa;IACbC,YAAY;IACZjG,aAAa;IACb4D,KAAK;IACL9C,UAAU;IACVqF,SAAS,EAAE5D;EACb,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"layout.mjs","names":["useResizeObserver","computed","inject","onActivated","onBeforeUnmount","onDeactivated","onMounted","provide","reactive","ref","shallowRef","useId","convertToUnit","findChildrenWithProvide","getCurrentInstance","propsFactory","VuetifyLayoutKey","Symbol","for","VuetifyLayoutItemKey","ROOT_ZINDEX","makeLayoutProps","overlaps","type","Array","default","fullHeight","Boolean","makeLayoutItemProps","name","String","order","Number","absolute","useLayout","layout","Error","getLayoutItem","mainRect","mainStyles","useLayoutItem","options","id","vm","isKeptAlive","value","layoutItemStyles","layoutItemScrimStyles","register","active","unregister","layoutRect","generateLayers","positions","layoutSizes","activeItems","previousLayer","top","left","right","bottom","layers","layer","position","get","amount","parseInt","push","createLayout","props","parentLayout","rootZIndex","registered","Map","priorities","disabledTransitions","resizeRef","contentRect","computedOverlaps","map","overlap","filter","item","includes","split","topPosition","bottomPosition","topAmount","bottomAmount","set","uniquePriorities","Set","values","p","sort","a","b","items","transitionsEnabled","from","some","length","undefined","transition","slice","_ref","index","size","find","rootVm","isMounted","_ref2","layoutSize","elementSize","disableTransitions","instances","vnode","instanceIndex","indexOf","splice","findIndex","i","zIndex","isHorizontal","isOppositeHorizontal","isOppositeVertical","unit","styles","transform","height","width","delete","v","layoutClasses","layoutStyles","overflow","layoutRef"],"sources":["../../src/composables/layout.ts"],"sourcesContent":["// Composables\nimport { useResizeObserver } from '@/composables/resizeObserver'\n\n// Utilities\nimport {\n computed,\n inject,\n onActivated,\n onBeforeUnmount,\n onDeactivated,\n onMounted,\n provide,\n reactive,\n ref,\n shallowRef,\n useId,\n} from 'vue'\nimport { convertToUnit, findChildrenWithProvide, getCurrentInstance, propsFactory } from '@/util'\n\n// Types\nimport type { ComponentInternalInstance, CSSProperties, InjectionKey, Prop, Ref } from 'vue'\n\nexport type Position = 'top' | 'left' | 'right' | 'bottom'\n\ninterface Layer {\n top: number\n bottom: number\n left: number\n right: number\n}\n\ninterface LayoutItem extends Layer {\n id: string\n size: number\n position: Position\n}\n\ninterface LayoutProvide {\n register: (\n vm: ComponentInternalInstance,\n options: {\n id: string\n order: Ref<number>\n position: Ref<Position>\n layoutSize: Ref<number | string>\n elementSize: Ref<number | string | undefined>\n active: Ref<boolean>\n disableTransitions?: Ref<boolean>\n absolute: Ref<boolean | undefined>\n }\n ) => {\n layoutItemStyles: Ref<CSSProperties>\n layoutItemScrimStyles: Ref<CSSProperties>\n zIndex: Ref<number>\n }\n unregister: (id: string) => void\n mainRect: Ref<Layer>\n mainStyles: Ref<CSSProperties>\n getLayoutItem: (id: string) => LayoutItem | undefined\n items: Ref<LayoutItem[]>\n layoutRect: Ref<DOMRectReadOnly | undefined>\n rootZIndex: Ref<number>\n}\n\nexport const VuetifyLayoutKey: InjectionKey<LayoutProvide> = Symbol.for('vuetify:layout')\nexport const VuetifyLayoutItemKey: InjectionKey<{ id: string }> = Symbol.for('vuetify:layout-item')\n\nconst ROOT_ZINDEX = 1000\n\nexport const makeLayoutProps = propsFactory({\n overlaps: {\n type: Array,\n default: () => ([]),\n } as Prop<string[]>,\n fullHeight: Boolean,\n}, 'layout')\n\n// Composables\nexport const makeLayoutItemProps = propsFactory({\n name: {\n type: String,\n },\n order: {\n type: [Number, String],\n default: 0,\n },\n absolute: Boolean,\n}, 'layout-item')\n\nexport function useLayout () {\n const layout = inject(VuetifyLayoutKey)\n\n if (!layout) throw new Error('[Vuetify] Could not find injected layout')\n\n return {\n getLayoutItem: layout.getLayoutItem,\n mainRect: layout.mainRect,\n mainStyles: layout.mainStyles,\n }\n}\n\nexport function useLayoutItem (options: {\n id: string | undefined\n order: Ref<number>\n position: Ref<Position>\n layoutSize: Ref<number | string>\n elementSize: Ref<number | string | undefined>\n active: Ref<boolean>\n disableTransitions?: Ref<boolean>\n absolute: Ref<boolean | undefined>\n}) {\n const layout = inject(VuetifyLayoutKey)\n\n if (!layout) throw new Error('[Vuetify] Could not find injected layout')\n\n const id = options.id ?? `layout-item-${useId()}`\n\n const vm = getCurrentInstance('useLayoutItem')\n\n provide(VuetifyLayoutItemKey, { id })\n\n const isKeptAlive = shallowRef(false)\n onDeactivated(() => isKeptAlive.value = true)\n onActivated(() => isKeptAlive.value = false)\n\n const {\n layoutItemStyles,\n layoutItemScrimStyles,\n } = layout.register(vm, {\n ...options,\n active: computed(() => isKeptAlive.value ? false : options.active.value),\n id,\n })\n\n onBeforeUnmount(() => layout.unregister(id))\n\n return { layoutItemStyles, layoutRect: layout.layoutRect, layoutItemScrimStyles }\n}\n\nconst generateLayers = (\n layout: string[],\n positions: Map<string, Ref<Position>>,\n layoutSizes: Map<string, Ref<number | string>>,\n activeItems: Map<string, Ref<boolean>>,\n): { id: string, layer: Layer }[] => {\n let previousLayer: Layer = { top: 0, left: 0, right: 0, bottom: 0 }\n const layers = [{ id: '', layer: { ...previousLayer } }]\n for (const id of layout) {\n const position = positions.get(id)\n const amount = layoutSizes.get(id)\n const active = activeItems.get(id)\n if (!position || !amount || !active) continue\n\n const layer = {\n ...previousLayer,\n [position.value]: parseInt(previousLayer[position.value], 10) + (active.value ? parseInt(amount.value, 10) : 0),\n }\n\n layers.push({\n id,\n layer,\n })\n\n previousLayer = layer\n }\n\n return layers\n}\n\nexport function createLayout (props: { overlaps?: string[], fullHeight?: boolean }) {\n const parentLayout = inject(VuetifyLayoutKey, null)\n const rootZIndex = computed(() => parentLayout ? parentLayout.rootZIndex.value - 100 : ROOT_ZINDEX)\n const registered = ref<string[]>([])\n const positions = reactive(new Map<string, Ref<Position>>())\n const layoutSizes = reactive(new Map<string, Ref<number | string>>())\n const priorities = reactive(new Map<string, Ref<number>>())\n const activeItems = reactive(new Map<string, Ref<boolean>>())\n const disabledTransitions = reactive(new Map<string, Ref<boolean>>())\n const { resizeRef, contentRect: layoutRect } = useResizeObserver()\n\n const computedOverlaps = computed(() => {\n const map = new Map<string, { position: Position, amount: number }>()\n const overlaps = props.overlaps ?? []\n for (const overlap of overlaps.filter(item => item.includes(':'))) {\n const [top, bottom] = overlap.split(':')\n if (!registered.value.includes(top) || !registered.value.includes(bottom)) continue\n\n const topPosition = positions.get(top)\n const bottomPosition = positions.get(bottom)\n const topAmount = layoutSizes.get(top)\n const bottomAmount = layoutSizes.get(bottom)\n\n if (!topPosition || !bottomPosition || !topAmount || !bottomAmount) continue\n\n map.set(bottom, { position: topPosition.value, amount: parseInt(topAmount.value, 10) })\n map.set(top, { position: bottomPosition.value, amount: -parseInt(bottomAmount.value, 10) })\n }\n\n return map\n })\n\n const layers = computed(() => {\n const uniquePriorities = [...new Set([...priorities.values()].map(p => p.value))].sort((a, b) => a - b)\n const layout = []\n for (const p of uniquePriorities) {\n const items = registered.value.filter(id => priorities.get(id)?.value === p)\n layout.push(...items)\n }\n return generateLayers(layout, positions, layoutSizes, activeItems)\n })\n\n const transitionsEnabled = computed(() => {\n return !Array.from(disabledTransitions.values()).some(ref => ref.value)\n })\n\n const mainRect = computed(() => {\n return layers.value[layers.value.length - 1].layer\n })\n\n const mainStyles = computed<CSSProperties>(() => {\n return {\n '--v-layout-left': convertToUnit(mainRect.value.left),\n '--v-layout-right': convertToUnit(mainRect.value.right),\n '--v-layout-top': convertToUnit(mainRect.value.top),\n '--v-layout-bottom': convertToUnit(mainRect.value.bottom),\n ...(transitionsEnabled.value ? undefined : { transition: 'none' }),\n }\n })\n\n const items = computed(() => {\n return layers.value.slice(1).map(({ id }, index) => {\n const { layer } = layers.value[index]\n const size = layoutSizes.get(id)\n const position = positions.get(id)\n\n return {\n id,\n ...layer,\n size: Number(size!.value),\n position: position!.value,\n }\n })\n })\n\n const getLayoutItem = (id: string) => {\n return items.value.find(item => item.id === id)\n }\n\n const rootVm = getCurrentInstance('createLayout')\n\n const isMounted = shallowRef(false)\n onMounted(() => {\n isMounted.value = true\n })\n\n provide(VuetifyLayoutKey, {\n register: (\n vm: ComponentInternalInstance,\n {\n id,\n order,\n position,\n layoutSize,\n elementSize,\n active,\n disableTransitions,\n absolute,\n }\n ) => {\n priorities.set(id, order)\n positions.set(id, position)\n layoutSizes.set(id, layoutSize)\n activeItems.set(id, active)\n disableTransitions && disabledTransitions.set(id, disableTransitions)\n\n const instances = findChildrenWithProvide(VuetifyLayoutItemKey, rootVm?.vnode)\n const instanceIndex = instances.indexOf(vm)\n\n if (instanceIndex > -1) registered.value.splice(instanceIndex, 0, id)\n else registered.value.push(id)\n\n const index = computed(() => items.value.findIndex(i => i.id === id))\n const zIndex = computed(() => rootZIndex.value + (layers.value.length * 2) - (index.value * 2))\n\n const layoutItemStyles = computed<CSSProperties>(() => {\n const isHorizontal = position.value === 'left' || position.value === 'right'\n const isOppositeHorizontal = position.value === 'right'\n const isOppositeVertical = position.value === 'bottom'\n const size = elementSize.value ?? layoutSize.value\n const unit = size === 0 ? '%' : 'px'\n\n const styles = {\n [position.value]: 0,\n zIndex: zIndex.value,\n transform: `translate${isHorizontal ? 'X' : 'Y'}(${(active.value ? 0 : -(size === 0 ? 100 : size)) * (isOppositeHorizontal || isOppositeVertical ? -1 : 1)}${unit})`,\n position: absolute.value || rootZIndex.value !== ROOT_ZINDEX ? 'absolute' : 'fixed',\n ...(transitionsEnabled.value ? undefined : { transition: 'none' }),\n } as const\n\n if (!isMounted.value) return styles\n\n const item = items.value[index.value]\n\n if (!item) throw new Error(`[Vuetify] Could not find layout item \"${id}\"`)\n\n const overlap = computedOverlaps.value.get(id)\n if (overlap) {\n item[overlap.position] += overlap.amount\n }\n\n return {\n ...styles,\n height:\n isHorizontal ? `calc(100% - ${item.top}px - ${item.bottom}px)`\n : elementSize.value ? `${elementSize.value}px`\n : undefined,\n left: isOppositeHorizontal ? undefined : `${item.left}px`,\n right: isOppositeHorizontal ? `${item.right}px` : undefined,\n top: position.value !== 'bottom' ? `${item.top}px` : undefined,\n bottom: position.value !== 'top' ? `${item.bottom}px` : undefined,\n width:\n !isHorizontal ? `calc(100% - ${item.left}px - ${item.right}px)`\n : elementSize.value ? `${elementSize.value}px`\n : undefined,\n }\n })\n\n const layoutItemScrimStyles = computed<CSSProperties>(() => ({\n zIndex: zIndex.value - 1,\n }))\n\n return { layoutItemStyles, layoutItemScrimStyles, zIndex }\n },\n unregister: (id: string) => {\n priorities.delete(id)\n positions.delete(id)\n layoutSizes.delete(id)\n activeItems.delete(id)\n disabledTransitions.delete(id)\n registered.value = registered.value.filter(v => v !== id)\n },\n mainRect,\n mainStyles,\n getLayoutItem,\n items,\n layoutRect,\n rootZIndex,\n })\n\n const layoutClasses = computed(() => [\n 'v-layout',\n { 'v-layout--full-height': props.fullHeight },\n ])\n\n const layoutStyles = computed(() => ({\n zIndex: parentLayout ? rootZIndex.value : undefined,\n position: parentLayout ? 'relative' as const : undefined,\n overflow: parentLayout ? 'hidden' : undefined,\n }))\n\n return {\n layoutClasses,\n layoutStyles,\n getLayoutItem,\n items,\n layoutRect,\n layoutRef: resizeRef,\n }\n}\n"],"mappings":"AAAA;AAAA,SACSA,iBAAiB,gCAE1B;AACA,SACEC,QAAQ,EACRC,MAAM,EACNC,WAAW,EACXC,eAAe,EACfC,aAAa,EACbC,SAAS,EACTC,OAAO,EACPC,QAAQ,EACRC,GAAG,EACHC,UAAU,EACVC,KAAK,QACA,KAAK;AAAA,SACHC,aAAa,EAAEC,uBAAuB,EAAEC,kBAAkB,EAAEC,YAAY,6BAEjF;AA6CA,OAAO,MAAMC,gBAA6C,GAAGC,MAAM,CAACC,GAAG,CAAC,gBAAgB,CAAC;AACzF,OAAO,MAAMC,oBA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EAAU,IAAK;MAC1BgC,UAAU,CAACyD,MAAM,CAACzF,EAAE,CAAC;MACrBW,SAAS,CAAC8E,MAAM,CAACzF,EAAE,CAAC;MACpBY,WAAW,CAAC6E,MAAM,CAACzF,EAAE,CAAC;MACtBa,WAAW,CAAC4E,MAAM,CAACzF,EAAE,CAAC;MACtBiC,mBAAmB,CAACwD,MAAM,CAACzF,EAAE,CAAC;MAC9B8B,UAAU,CAAC3B,KAAK,GAAG2B,UAAU,CAAC3B,KAAK,CAACoC,MAAM,CAACmD,CAAC,IAAIA,CAAC,KAAK1F,EAAE,CAAC;IAC3D,CAAC;IACDJ,QAAQ;IACRC,UAAU;IACVF,aAAa;IACb4D,KAAK;IACL9C,UAAU;IACVoB;EACF,CAAC,CAAC;EAEF,MAAM8D,aAAa,GAAGpI,QAAQ,CAAC,MAAM,CACnC,UAAU,EACV;IAAE,uBAAuB,EAAEoE,KAAK,CAAC3C;EAAW,CAAC,CAC9C,CAAC;EAEF,MAAM4G,YAAY,GAAGrI,QAAQ,CAAC,OAAO;IACnCyH,MAAM,EAAEpD,YAAY,GAAGC,UAAU,CAAC1B,KAAK,GAAGyD,SAAS;IACnDvC,QAAQ,EAAEO,YAAY,GAAG,UAAU,GAAYgC,SAAS;IACxDiC,QAAQ,EAAEjE,YAAY,GAAG,QAAQ,GAAGgC;EACtC,CAAC,CAAC,CAAC;EAEH,OAAO;IACL+B,aAAa;IACbC,YAAY;IACZjG,aAAa;IACb4D,KAAK;IACL9C,UAAU;IACVqF,SAAS,EAAE5D;EACb,CAAC;AACH","ignoreList":[]}
@@ -4,7 +4,7 @@ import { computed, inject, onBeforeUnmount, provide, ref, shallowRef, toRaw, toR
4
4
  import { independentActiveStrategy, independentSingleActiveStrategy, leafActiveStrategy, leafSingleActiveStrategy } from "./activeStrategies.mjs";
5
5
  import { listOpenStrategy, multipleOpenStrategy, singleOpenStrategy } from "./openStrategies.mjs";
6
6
  import { classicSelectStrategy, independentSelectStrategy, independentSingleSelectStrategy, leafSelectStrategy, leafSingleSelectStrategy } from "./selectStrategies.mjs";
7
- import { consoleError, getCurrentInstance, getUid, propsFactory } from "../../util/index.mjs"; // Types
7
+ import { consoleError, getCurrentInstance, propsFactory } from "../../util/index.mjs"; // Types
8
8
  export const VNestedSymbol = Symbol.for('vuetify:nested');
9
9
  export const emptyNested = {
10
10
  id: shallowRef(),
@@ -220,7 +220,7 @@ export const useNested = props => {
220
220
  };
221
221
  export const useNestedItem = (id, isGroup) => {
222
222
  const parent = inject(VNestedSymbol, emptyNested);
223
- const uidSymbol = Symbol(getUid());
223
+ const uidSymbol = Symbol('nested item');
224
224
  const computedId = computed(() => id.value !== undefined ? id.value : uidSymbol);
225
225
  const item = {
226
226
  ...parent,
@@ -1 +1 @@
1
- {"version":3,"file":"nested.mjs","names":["useProxiedModel","computed","inject","onBeforeUnmount","provide","ref","shallowRef","toRaw","toRef","independentActiveStrategy","independentSingleActiveStrategy","leafActiveStrategy","leafSingleActiveStrategy","listOpenStrategy","multipleOpenStrategy","singleOpenStrategy","classicSelectStrategy","independentSelectStrategy","independentSingleSelectStrategy","leafSelectStrategy","leafSingleSelectStrategy","consoleError","getCurrentInstance","getUid","propsFactory","VNestedSymbol","Symbol","for","emptyNested","id","root","register","unregister","parents","Map","children","open","openOnSelect","activate","select","activatable","selectable","opened","Set","activated","selected","selectedValues","getPath","makeNestedProps","Boolean","activeStrategy","String","Function","Object","selectStrategy","openStrategy","mandatory","useNested","props","isUnmounted","v","values","value","in","out","path","parent","unshift","get","vm","nodeIds","nested","arr","key","entries","push","parentId","isGroup","has","map","join","newPath","concat","add","set","delete","list","filter","child","event","emit","newOpened","newSelected","newActivated","useNestedItem","uidSymbol","computedId","undefined","item","e","isOpen","isActivated","isSelected","isIndeterminate","isLeaf","isGroupActivator","useNestedGroupActivator"],"sources":["../../../src/composables/nested/nested.ts"],"sourcesContent":["// Composables\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, inject, onBeforeUnmount, provide, ref, shallowRef, toRaw, toRef } from 'vue'\nimport {\n independentActiveStrategy,\n independentSingleActiveStrategy,\n leafActiveStrategy,\n leafSingleActiveStrategy,\n} from './activeStrategies'\nimport { listOpenStrategy, multipleOpenStrategy, singleOpenStrategy } from './openStrategies'\nimport {\n classicSelectStrategy,\n independentSelectStrategy,\n independentSingleSelectStrategy,\n leafSelectStrategy,\n leafSingleSelectStrategy,\n} from './selectStrategies'\nimport { consoleError, getCurrentInstance, getUid, propsFactory } from '@/util'\n\n// Types\nimport type { InjectionKey, PropType, Ref } from 'vue'\nimport type { ActiveStrategy } from './activeStrategies'\nimport type { OpenStrategy } from './openStrategies'\nimport type { SelectStrategy } from './selectStrategies'\nimport type { EventProp } from '@/util'\n\nexport type ActiveStrategyProp =\n | 'single-leaf'\n | 'leaf'\n | 'independent'\n | 'single-independent'\n | ActiveStrategy\n | ((mandatory: boolean) => ActiveStrategy)\nexport type SelectStrategyProp =\n | 'single-leaf'\n | 'leaf'\n | 'independent'\n | 'single-independent'\n | 'classic'\n | SelectStrategy\n | ((mandatory: boolean) => SelectStrategy)\nexport type OpenStrategyProp = 'single' | 'multiple' | 'list' | OpenStrategy\n\nexport interface NestedProps {\n activatable: boolean\n selectable: boolean\n activeStrategy: ActiveStrategyProp | undefined\n selectStrategy: SelectStrategyProp | undefined\n openStrategy: OpenStrategyProp | undefined\n activated: any\n selected: any\n opened: any\n mandatory: boolean\n 'onUpdate:activated': EventProp<[any]> | undefined\n 'onUpdate:selected': EventProp<[any]> | undefined\n 'onUpdate:opened': EventProp<[any]> | undefined\n}\n\ntype NestedProvide = {\n id: Ref<unknown>\n isGroupActivator?: boolean\n root: {\n children: Ref<Map<unknown, unknown[]>>\n parents: Ref<Map<unknown, unknown>>\n activatable: Ref<boolean>\n selectable: Ref<boolean>\n opened: Ref<Set<unknown>>\n activated: Ref<Set<unknown>>\n selected: Ref<Map<unknown, 'on' | 'off' | 'indeterminate'>>\n selectedValues: Ref<unknown[]>\n register: (id: unknown, parentId: unknown, isGroup?: boolean) => void\n unregister: (id: unknown) => void\n open: (id: unknown, value: boolean, event?: Event) => void\n activate: (id: unknown, value: boolean, event?: Event) => void\n select: (id: unknown, value: boolean, event?: Event) => void\n openOnSelect: (id: unknown, value: boolean, event?: Event) => void\n getPath: (id: unknown) => unknown[]\n }\n}\n\nexport const VNestedSymbol: InjectionKey<NestedProvide> = Symbol.for('vuetify:nested')\n\nexport const emptyNested: NestedProvide = {\n id: shallowRef(),\n root: {\n register: () => null,\n unregister: () => null,\n parents: ref(new Map()),\n children: ref(new Map()),\n open: () => null,\n openOnSelect: () => null,\n activate: () => null,\n select: () => null,\n activatable: ref(false),\n selectable: ref(false),\n opened: ref(new Set()),\n activated: ref(new Set()),\n selected: ref(new Map()),\n selectedValues: ref([]),\n getPath: () => [],\n },\n}\n\nexport const makeNestedProps = propsFactory({\n activatable: Boolean,\n selectable: Boolean,\n activeStrategy: [String, Function, Object] as PropType<ActiveStrategyProp>,\n selectStrategy: [String, Function, Object] as PropType<SelectStrategyProp>,\n openStrategy: [String, Object] as PropType<OpenStrategyProp>,\n opened: null,\n activated: null,\n selected: null,\n mandatory: Boolean,\n}, 'nested')\n\nexport const useNested = (props: NestedProps) => {\n let isUnmounted = false\n const children = ref(new Map<unknown, unknown[]>())\n const parents = ref(new Map<unknown, unknown>())\n\n const opened = useProxiedModel(props, 'opened', props.opened, v => new Set(v), v => [...v.values()])\n\n const activeStrategy = computed(() => {\n if (typeof props.activeStrategy === 'object') return props.activeStrategy\n if (typeof props.activeStrategy === 'function') return props.activeStrategy(props.mandatory)\n\n switch (props.activeStrategy) {\n case 'leaf': return leafActiveStrategy(props.mandatory)\n case 'single-leaf': return leafSingleActiveStrategy(props.mandatory)\n case 'independent': return independentActiveStrategy(props.mandatory)\n case 'single-independent':\n default: return independentSingleActiveStrategy(props.mandatory)\n }\n })\n\n const selectStrategy = computed(() => {\n if (typeof props.selectStrategy === 'object') return props.selectStrategy\n if (typeof props.selectStrategy === 'function') return props.selectStrategy(props.mandatory)\n\n switch (props.selectStrategy) {\n case 'single-leaf': return leafSingleSelectStrategy(props.mandatory)\n case 'leaf': return leafSelectStrategy(props.mandatory)\n case 'independent': return independentSelectStrategy(props.mandatory)\n case 'single-independent': return independentSingleSelectStrategy(props.mandatory)\n case 'classic':\n default: return classicSelectStrategy(props.mandatory)\n }\n })\n\n const openStrategy = computed(() => {\n if (typeof props.openStrategy === 'object') return props.openStrategy\n\n switch (props.openStrategy) {\n case 'list': return listOpenStrategy\n case 'single': return singleOpenStrategy\n case 'multiple':\n default: return multipleOpenStrategy\n }\n })\n\n const activated = useProxiedModel(\n props,\n 'activated',\n props.activated,\n v => activeStrategy.value.in(v, children.value, parents.value),\n v => activeStrategy.value.out(v, children.value, parents.value),\n )\n const selected = useProxiedModel(\n props,\n 'selected',\n props.selected,\n v => selectStrategy.value.in(v, children.value, parents.value),\n v => selectStrategy.value.out(v, children.value, parents.value),\n )\n\n onBeforeUnmount(() => {\n isUnmounted = true\n })\n\n function getPath (id: unknown) {\n const path: unknown[] = []\n let parent: unknown = id\n\n while (parent != null) {\n path.unshift(parent)\n parent = parents.value.get(parent)\n }\n\n return path\n }\n\n const vm = getCurrentInstance('nested')\n\n const nodeIds = new Set<unknown>()\n\n const nested: NestedProvide = {\n id: shallowRef(),\n root: {\n opened,\n activatable: toRef(props, 'activatable'),\n selectable: toRef(props, 'selectable'),\n activated,\n selected,\n selectedValues: computed(() => {\n const arr = []\n\n for (const [key, value] of selected.value.entries()) {\n if (value === 'on') arr.push(key)\n }\n\n return arr\n }),\n register: (id, parentId, isGroup) => {\n if (nodeIds.has(id)) {\n const path = getPath(id).map(String).join(' -> ')\n const newPath = getPath(parentId).concat(id).map(String).join(' -> ')\n consoleError(`Multiple nodes with the same ID\\n\\t${path}\\n\\t${newPath}`)\n return\n } else {\n nodeIds.add(id)\n }\n\n parentId && id !== parentId && parents.value.set(id, parentId)\n\n isGroup && children.value.set(id, [])\n\n if (parentId != null) {\n children.value.set(parentId, [...children.value.get(parentId) || [], id])\n }\n },\n unregister: id => {\n if (isUnmounted) return\n\n nodeIds.delete(id)\n children.value.delete(id)\n const parent = parents.value.get(id)\n if (parent) {\n const list = children.value.get(parent) ?? []\n children.value.set(parent, list.filter(child => child !== id))\n }\n parents.value.delete(id)\n },\n open: (id, value, event) => {\n vm.emit('click:open', { id, value, path: getPath(id), event })\n\n const newOpened = openStrategy.value.open({\n id,\n value,\n opened: new Set(opened.value),\n children: children.value,\n parents: parents.value,\n event,\n })\n\n newOpened && (opened.value = newOpened)\n },\n openOnSelect: (id, value, event) => {\n const newOpened = openStrategy.value.select({\n id,\n value,\n selected: new Map(selected.value),\n opened: new Set(opened.value),\n children: children.value,\n parents: parents.value,\n event,\n })\n newOpened && (opened.value = newOpened)\n },\n select: (id, value, event) => {\n vm.emit('click:select', { id, value, path: getPath(id), event })\n\n const newSelected = selectStrategy.value.select({\n id,\n value,\n selected: new Map(selected.value),\n children: children.value,\n parents: parents.value,\n event,\n })\n newSelected && (selected.value = newSelected)\n\n nested.root.openOnSelect(id, value, event)\n },\n activate: (id, value, event) => {\n if (!props.activatable) {\n return nested.root.select(id, true, event)\n }\n\n vm.emit('click:activate', { id, value, path: getPath(id), event })\n\n const newActivated = activeStrategy.value.activate({\n id,\n value,\n activated: new Set(activated.value),\n children: children.value,\n parents: parents.value,\n event,\n })\n\n newActivated && (activated.value = newActivated)\n },\n children,\n parents,\n getPath,\n },\n }\n\n provide(VNestedSymbol, nested)\n\n return nested.root\n}\n\nexport const useNestedItem = (id: Ref<unknown>, isGroup: boolean) => {\n const parent = inject(VNestedSymbol, emptyNested)\n\n const uidSymbol = Symbol(getUid())\n const computedId = computed(() => id.value !== undefined ? id.value : uidSymbol)\n\n const item = {\n ...parent,\n id: computedId,\n open: (open: boolean, e: Event) => parent.root.open(computedId.value, open, e),\n openOnSelect: (open: boolean, e?: Event) => parent.root.openOnSelect(computedId.value, open, e),\n isOpen: computed(() => parent.root.opened.value.has(computedId.value)),\n parent: computed(() => parent.root.parents.value.get(computedId.value)),\n activate: (activated: boolean, e?: Event) => parent.root.activate(computedId.value, activated, e),\n isActivated: computed(() => parent.root.activated.value.has(toRaw(computedId.value))),\n select: (selected: boolean, e?: Event) => parent.root.select(computedId.value, selected, e),\n isSelected: computed(() => parent.root.selected.value.get(toRaw(computedId.value)) === 'on'),\n isIndeterminate: computed(() => parent.root.selected.value.get(computedId.value) === 'indeterminate'),\n isLeaf: computed(() => !parent.root.children.value.get(computedId.value)),\n isGroupActivator: parent.isGroupActivator,\n }\n\n !parent.isGroupActivator && parent.root.register(computedId.value, parent.id.value, isGroup)\n\n onBeforeUnmount(() => {\n !parent.isGroupActivator && parent.root.unregister(computedId.value)\n })\n\n isGroup && provide(VNestedSymbol, item)\n\n return item\n}\n\nexport const useNestedGroupActivator = () => {\n const parent = inject(VNestedSymbol, emptyNested)\n\n provide(VNestedSymbol, { ...parent, isGroupActivator: true })\n}\n"],"mappings":"AAAA;AAAA,SACSA,eAAe,+BAExB;AACA,SAASC,QAAQ,EAAEC,MAAM,EAAEC,eAAe,EAAEC,OAAO,EAAEC,GAAG,EAAEC,UAAU,EAAEC,KAAK,EAAEC,KAAK,QAAQ,KAAK;AAAA,SAE7FC,yBAAyB,EACzBC,+BAA+B,EAC/BC,kBAAkB,EAClBC,wBAAwB;AAAA,SAEjBC,gBAAgB,EAAEC,oBAAoB,EAAEC,kBAAkB;AAAA,SAEjEC,qBAAqB,EACrBC,yBAAyB,EACzBC,+BAA+B,EAC/BC,kBAAkB,EAClBC,wBAAwB;AAAA,SAEjBC,YAAY,EAAEC,kBAAkB,EAAEC,MAAM,EAAEC,YAAY,gCAE/D;AA6DA,OAAO,MAAMC,aAA0C,GAAGC,MAAM,CAACC,GAAG,CAAC,gBAAgB,CAAC;AAEtF,OAAO,MAAMC,WAA0B,GAAG;EACxCC,EAAE,EAAEvB,UAAU,CAAC,CAAC;EAChBwB,IAAI,EAAE;IACJC,QAAQ,EAAEA,CAAA,KAAM,IAAI;I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O,CAAC;EAE5F1E,eAAe,CAAC,MAAM;IACpB,CAAC+D,MAAM,CAACuC,gBAAgB,IAAIvC,MAAM,CAACpC,IAAI,CAACE,UAAU,CAACgE,UAAU,CAAClC,KAAK,CAAC;EACtE,CAAC,CAAC;EAEFe,OAAO,IAAIzE,OAAO,CAACqB,aAAa,EAAEyE,IAAI,CAAC;EAEvC,OAAOA,IAAI;AACb,CAAC;AAED,OAAO,MAAMQ,uBAAuB,GAAGA,CAAA,KAAM;EAC3C,MAAMxC,MAAM,GAAGhE,MAAM,CAACuB,aAAa,EAAEG,WAAW,CAAC;EAEjDxB,OAAO,CAACqB,aAAa,EAAE;IAAE,GAAGyC,MAAM;IAAEuC,gBAAgB,EAAE;EAAK,CAAC,CAAC;AAC/D,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"nested.mjs","names":["useProxiedModel","computed","inject","onBeforeUnmount","provide","ref","shallowRef","toRaw","toRef","independentActiveStrategy","independentSingleActiveStrategy","leafActiveStrategy","leafSingleActiveStrategy","listOpenStrategy","multipleOpenStrategy","singleOpenStrategy","classicSelectStrategy","independentSelectStrategy","independentSingleSelectStrategy","leafSelectStrategy","leafSingleSelectStrategy","consoleError","getCurrentInstance","propsFactory","VNestedSymbol","Symbol","for","emptyNested","id","root","register","unregister","parents","Map","children","open","openOnSelect","activate","select","activatable","selectable","opened","Set","activated","selected","selectedValues","getPath","makeNestedProps","Boolean","activeStrategy","String","Function","Object","selectStrategy","openStrategy","mandatory","useNested","props","isUnmounted","v","values","value","in","out","path","parent","unshift","get","vm","nodeIds","nested","arr","key","entries","push","parentId","isGroup","has","map","join","newPath","concat","add","set","delete","list","filter","child","event","emit","newOpened","newSelected","newActivated","useNestedItem","uidSymbol","computedId","undefined","item","e","isOpen","isActivated","isSelected","isIndeterminate","isLeaf","isGroupActivator","useNestedGroupActivator"],"sources":["../../../src/composables/nested/nested.ts"],"sourcesContent":["// Composables\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, inject, onBeforeUnmount, provide, ref, shallowRef, toRaw, toRef } from 'vue'\nimport {\n independentActiveStrategy,\n independentSingleActiveStrategy,\n leafActiveStrategy,\n leafSingleActiveStrategy,\n} from './activeStrategies'\nimport { listOpenStrategy, multipleOpenStrategy, singleOpenStrategy } from './openStrategies'\nimport {\n classicSelectStrategy,\n independentSelectStrategy,\n independentSingleSelectStrategy,\n leafSelectStrategy,\n leafSingleSelectStrategy,\n} from './selectStrategies'\nimport { consoleError, getCurrentInstance, propsFactory } from '@/util'\n\n// Types\nimport type { InjectionKey, PropType, Ref } from 'vue'\nimport type { ActiveStrategy } from './activeStrategies'\nimport type { OpenStrategy } from './openStrategies'\nimport type { SelectStrategy } from './selectStrategies'\nimport type { EventProp } from '@/util'\n\nexport type ActiveStrategyProp =\n | 'single-leaf'\n | 'leaf'\n | 'independent'\n | 'single-independent'\n | ActiveStrategy\n | ((mandatory: boolean) => ActiveStrategy)\nexport type SelectStrategyProp =\n | 'single-leaf'\n | 'leaf'\n | 'independent'\n | 'single-independent'\n | 'classic'\n | SelectStrategy\n | ((mandatory: boolean) => SelectStrategy)\nexport type OpenStrategyProp = 'single' | 'multiple' | 'list' | OpenStrategy\n\nexport interface NestedProps {\n activatable: boolean\n selectable: boolean\n activeStrategy: ActiveStrategyProp | undefined\n selectStrategy: SelectStrategyProp | undefined\n openStrategy: OpenStrategyProp | undefined\n activated: any\n selected: any\n opened: any\n mandatory: boolean\n 'onUpdate:activated': EventProp<[any]> | undefined\n 'onUpdate:selected': EventProp<[any]> | undefined\n 'onUpdate:opened': EventProp<[any]> | undefined\n}\n\ntype NestedProvide = {\n id: Ref<unknown>\n isGroupActivator?: boolean\n root: {\n children: Ref<Map<unknown, unknown[]>>\n parents: Ref<Map<unknown, unknown>>\n activatable: Ref<boolean>\n selectable: Ref<boolean>\n opened: Ref<Set<unknown>>\n activated: Ref<Set<unknown>>\n selected: Ref<Map<unknown, 'on' | 'off' | 'indeterminate'>>\n selectedValues: Ref<unknown[]>\n register: (id: unknown, parentId: unknown, isGroup?: boolean) => void\n unregister: (id: unknown) => void\n open: (id: unknown, value: boolean, event?: Event) => void\n activate: (id: unknown, value: boolean, event?: Event) => void\n select: (id: unknown, value: boolean, event?: Event) => void\n openOnSelect: (id: unknown, value: boolean, event?: Event) => void\n getPath: (id: unknown) => unknown[]\n }\n}\n\nexport const VNestedSymbol: InjectionKey<NestedProvide> = Symbol.for('vuetify:nested')\n\nexport const emptyNested: NestedProvide = {\n id: shallowRef(),\n root: {\n register: () => null,\n unregister: () => null,\n parents: ref(new Map()),\n children: ref(new Map()),\n open: () => null,\n openOnSelect: () => null,\n activate: () => null,\n select: () => null,\n activatable: ref(false),\n selectable: ref(false),\n opened: ref(new Set()),\n activated: ref(new Set()),\n selected: ref(new Map()),\n selectedValues: ref([]),\n getPath: () => [],\n },\n}\n\nexport const makeNestedProps = propsFactory({\n activatable: Boolean,\n selectable: Boolean,\n activeStrategy: [String, Function, Object] as PropType<ActiveStrategyProp>,\n selectStrategy: [String, Function, Object] as PropType<SelectStrategyProp>,\n openStrategy: [String, Object] as PropType<OpenStrategyProp>,\n opened: null,\n activated: null,\n selected: null,\n mandatory: Boolean,\n}, 'nested')\n\nexport const useNested = (props: NestedProps) => {\n let isUnmounted = false\n const children = ref(new Map<unknown, unknown[]>())\n const parents = ref(new Map<unknown, unknown>())\n\n const opened = useProxiedModel(props, 'opened', props.opened, v => new Set(v), v => [...v.values()])\n\n const activeStrategy = computed(() => {\n if (typeof props.activeStrategy === 'object') return props.activeStrategy\n if (typeof props.activeStrategy === 'function') return props.activeStrategy(props.mandatory)\n\n switch (props.activeStrategy) {\n case 'leaf': return leafActiveStrategy(props.mandatory)\n case 'single-leaf': return leafSingleActiveStrategy(props.mandatory)\n case 'independent': return independentActiveStrategy(props.mandatory)\n case 'single-independent':\n default: return independentSingleActiveStrategy(props.mandatory)\n }\n })\n\n const selectStrategy = computed(() => {\n if (typeof props.selectStrategy === 'object') return props.selectStrategy\n if (typeof props.selectStrategy === 'function') return props.selectStrategy(props.mandatory)\n\n switch (props.selectStrategy) {\n case 'single-leaf': return leafSingleSelectStrategy(props.mandatory)\n case 'leaf': return leafSelectStrategy(props.mandatory)\n case 'independent': return independentSelectStrategy(props.mandatory)\n case 'single-independent': return independentSingleSelectStrategy(props.mandatory)\n case 'classic':\n default: return classicSelectStrategy(props.mandatory)\n }\n })\n\n const openStrategy = computed(() => {\n if (typeof props.openStrategy === 'object') return props.openStrategy\n\n switch (props.openStrategy) {\n case 'list': return listOpenStrategy\n case 'single': return singleOpenStrategy\n case 'multiple':\n default: return multipleOpenStrategy\n }\n })\n\n const activated = useProxiedModel(\n props,\n 'activated',\n props.activated,\n v => activeStrategy.value.in(v, children.value, parents.value),\n v => activeStrategy.value.out(v, children.value, parents.value),\n )\n const selected = useProxiedModel(\n props,\n 'selected',\n props.selected,\n v => selectStrategy.value.in(v, children.value, parents.value),\n v => selectStrategy.value.out(v, children.value, parents.value),\n )\n\n onBeforeUnmount(() => {\n isUnmounted = true\n })\n\n function getPath (id: unknown) {\n const path: unknown[] = []\n let parent: unknown = id\n\n while (parent != null) {\n path.unshift(parent)\n parent = parents.value.get(parent)\n }\n\n return path\n }\n\n const vm = getCurrentInstance('nested')\n\n const nodeIds = new Set<unknown>()\n\n const nested: NestedProvide = {\n id: shallowRef(),\n root: {\n opened,\n activatable: toRef(props, 'activatable'),\n selectable: toRef(props, 'selectable'),\n activated,\n selected,\n selectedValues: computed(() => {\n const arr = []\n\n for (const [key, value] of selected.value.entries()) {\n if (value === 'on') arr.push(key)\n }\n\n return arr\n }),\n register: (id, parentId, isGroup) => {\n if (nodeIds.has(id)) {\n const path = getPath(id).map(String).join(' -> ')\n const newPath = getPath(parentId).concat(id).map(String).join(' -> ')\n consoleError(`Multiple nodes with the same ID\\n\\t${path}\\n\\t${newPath}`)\n return\n } else {\n nodeIds.add(id)\n }\n\n parentId && id !== parentId && parents.value.set(id, parentId)\n\n isGroup && children.value.set(id, [])\n\n if (parentId != null) {\n children.value.set(parentId, [...children.value.get(parentId) || [], id])\n }\n },\n unregister: id => {\n if (isUnmounted) return\n\n nodeIds.delete(id)\n children.value.delete(id)\n const parent = parents.value.get(id)\n if (parent) {\n const list = children.value.get(parent) ?? []\n children.value.set(parent, list.filter(child => child !== id))\n }\n parents.value.delete(id)\n },\n open: (id, value, event) => {\n vm.emit('click:open', { id, value, path: getPath(id), event })\n\n const newOpened = openStrategy.value.open({\n id,\n value,\n opened: new Set(opened.value),\n children: children.value,\n parents: parents.value,\n event,\n })\n\n newOpened && (opened.value = newOpened)\n },\n openOnSelect: (id, value, event) => {\n const newOpened = openStrategy.value.select({\n id,\n value,\n selected: new Map(selected.value),\n opened: new Set(opened.value),\n children: children.value,\n parents: parents.value,\n event,\n })\n newOpened && (opened.value = newOpened)\n },\n select: (id, value, event) => {\n vm.emit('click:select', { id, value, path: getPath(id), event })\n\n const newSelected = selectStrategy.value.select({\n id,\n value,\n selected: new Map(selected.value),\n children: children.value,\n parents: parents.value,\n event,\n })\n newSelected && (selected.value = newSelected)\n\n nested.root.openOnSelect(id, value, event)\n },\n activate: (id, value, event) => {\n if (!props.activatable) {\n return nested.root.select(id, true, event)\n }\n\n vm.emit('click:activate', { id, value, path: getPath(id), event })\n\n const newActivated = activeStrategy.value.activate({\n id,\n value,\n activated: new Set(activated.value),\n children: children.value,\n parents: parents.value,\n event,\n })\n\n newActivated && (activated.value = newActivated)\n },\n children,\n parents,\n getPath,\n },\n }\n\n provide(VNestedSymbol, nested)\n\n return nested.root\n}\n\nexport const useNestedItem = (id: Ref<unknown>, isGroup: boolean) => {\n const parent = inject(VNestedSymbol, emptyNested)\n\n const uidSymbol = Symbol('nested item')\n const computedId = computed(() => id.value !== undefined ? id.value : uidSymbol)\n\n const item = {\n ...parent,\n id: computedId,\n open: (open: boolean, e: Event) => parent.root.open(computedId.value, open, e),\n openOnSelect: (open: boolean, e?: Event) => parent.root.openOnSelect(computedId.value, open, e),\n isOpen: computed(() => parent.root.opened.value.has(computedId.value)),\n parent: computed(() => parent.root.parents.value.get(computedId.value)),\n activate: (activated: boolean, e?: Event) => parent.root.activate(computedId.value, activated, e),\n isActivated: computed(() => parent.root.activated.value.has(toRaw(computedId.value))),\n select: (selected: boolean, e?: Event) => parent.root.select(computedId.value, selected, e),\n isSelected: computed(() => parent.root.selected.value.get(toRaw(computedId.value)) === 'on'),\n isIndeterminate: computed(() => parent.root.selected.value.get(computedId.value) === 'indeterminate'),\n isLeaf: computed(() => !parent.root.children.value.get(computedId.value)),\n isGroupActivator: parent.isGroupActivator,\n }\n\n !parent.isGroupActivator && parent.root.register(computedId.value, parent.id.value, isGroup)\n\n onBeforeUnmount(() => {\n !parent.isGroupActivator && parent.root.unregister(computedId.value)\n })\n\n isGroup && provide(VNestedSymbol, item)\n\n return item\n}\n\nexport const useNestedGroupActivator = () => {\n const parent = inject(VNestedSymbol, emptyNested)\n\n provide(VNestedSymbol, { ...parent, isGroupActivator: true })\n}\n"],"mappings":"AAAA;AAAA,SACSA,eAAe,+BAExB;AACA,SAASC,QAAQ,EAAEC,MAAM,EAAEC,eAAe,EAAEC,OAAO,EAAEC,GAAG,EAAEC,UAAU,EAAEC,KAAK,EAAEC,KAAK,QAAQ,KAAK;AAAA,SAE7FC,yBAAyB,EACzBC,+BAA+B,EAC/BC,kBAAkB,EAClBC,wBAAwB;AAAA,SAEjBC,gBAAgB,EAAEC,oBAAoB,EAAEC,kBAAkB;AAAA,SAEjEC,qBAAqB,EACrBC,yBAAyB,EACzBC,+BAA+B,EAC/BC,kBAAkB,EAClBC,wBAAwB;AAAA,SAEjBC,YAAY,EAAEC,kBAAkB,EAAEC,YAAY,gCAEvD;AA6DA,OAAO,MAAMC,aAA0C,GAAGC,MAAM,CAACC,GAAG,CAAC,gBAAgB,CAAC;AAEtF,OAAO,MAAMC,WAA0B,GAAG;EACxCC,EAAE,EAAEtB,UAAU,CAAC,CAAC;EAChBuB,IAAI,EAAE;IACJC,QAAQ,EAAEA,CAAA,KAAM,IAA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5FzE,eAAe,CAAC,MAAM;IACpB,CAAC8D,MAAM,CAACuC,gBAAgB,IAAIvC,MAAM,CAACpC,IAAI,CAACE,UAAU,CAACgE,UAAU,CAAClC,KAAK,CAAC;EACtE,CAAC,CAAC;EAEFe,OAAO,IAAIxE,OAAO,CAACoB,aAAa,EAAEyE,IAAI,CAAC;EAEvC,OAAOA,IAAI;AACb,CAAC;AAED,OAAO,MAAMQ,uBAAuB,GAAGA,CAAA,KAAM;EAC3C,MAAMxC,MAAM,GAAG/D,MAAM,CAACsB,aAAa,EAAEG,WAAW,CAAC;EAEjDvB,OAAO,CAACoB,aAAa,EAAE;IAAE,GAAGyC,MAAM;IAAEuC,gBAAgB,EAAE;EAAK,CAAC,CAAC;AAC/D,CAAC","ignoreList":[]}
@@ -159,15 +159,15 @@ export function createTheme(options) {
159
159
  const colors = new Set(Object.values(computedThemes.value).flatMap(theme => Object.keys(theme.colors)));
160
160
  for (const key of colors) {
161
161
  if (/^on-[a-z]/.test(key)) {
162
- createCssClass(fgLines, `.${key}`, [`color: rgb(var(--v-theme-${key}))`]);
162
+ createCssClass(fgLines, `.${key}`, [`color: rgb(var(--v-theme-${key})) !important`]);
163
163
  } else {
164
- createCssClass(bgLines, `.bg-${key}`, [`--v-theme-overlay-multiplier: var(--v-theme-${key}-overlay-multiplier)`, `background-color: rgb(var(--v-theme-${key}))`, `color: rgb(var(--v-theme-on-${key}))`]);
165
- createCssClass(fgLines, `.text-${key}`, [`color: rgb(var(--v-theme-${key}))`]);
164
+ createCssClass(bgLines, `.bg-${key}`, [`--v-theme-overlay-multiplier: var(--v-theme-${key}-overlay-multiplier)`, `background-color: rgb(var(--v-theme-${key})) !important`, `color: rgb(var(--v-theme-on-${key})) !important`]);
165
+ createCssClass(fgLines, `.text-${key}`, [`color: rgb(var(--v-theme-${key})) !important`]);
166
166
  createCssClass(fgLines, `.border-${key}`, [`--v-border-color: var(--v-theme-${key})`]);
167
167
  }
168
168
  }
169
169
  lines.push(...bgLines, ...fgLines);
170
- return '@layer vuetify.theme {\n' + lines.map(v => ` ${v}`).join('') + '\n}';
170
+ return lines.map((str, i) => i === 0 ? str : ` ${str}`).join('');
171
171
  });
172
172
  function getHead() {
173
173
  return {