@vuetify/nightly 3.0.0-beta.10 → 3.0.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -2
- package/dist/json/attributes.json +37 -29
- package/dist/json/importMap.json +46 -46
- package/dist/json/tags.json +10 -8
- package/dist/json/web-types.json +101 -87
- package/dist/vuetify.css +545 -441
- package/dist/vuetify.d.ts +12095 -10059
- package/dist/vuetify.esm.js +401 -266
- package/dist/vuetify.esm.js.map +1 -1
- package/dist/vuetify.js +371 -236
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.css +3 -3
- package/dist/vuetify.min.js +496 -490
- package/dist/vuetify.min.js.map +1 -1
- package/lib/blueprints/index.d.ts +171 -0
- package/lib/blueprints/md1.d.ts +167 -0
- package/lib/blueprints/md2.d.ts +167 -0
- package/lib/blueprints/md3.d.ts +167 -0
- package/lib/components/VAlert/index.d.ts +185 -0
- package/lib/components/VApp/index.d.ts +83 -0
- package/lib/components/VAppBar/VAppBar.css +3 -0
- package/lib/components/VAppBar/VAppBar.sass +3 -0
- package/lib/components/VAppBar/index.d.ts +156 -0
- package/lib/components/VAutocomplete/VAutocomplete.mjs +1 -1
- package/lib/components/VAutocomplete/VAutocomplete.mjs.map +1 -1
- package/lib/components/VAutocomplete/index.d.ts +1569 -0
- package/lib/components/VAvatar/VAvatar.css +44 -2
- package/lib/components/VAvatar/VAvatar.mjs +16 -12
- package/lib/components/VAvatar/VAvatar.mjs.map +1 -1
- package/lib/components/VAvatar/VAvatar.sass +5 -1
- package/lib/components/VAvatar/_variables.scss +9 -4
- package/lib/components/VAvatar/index.d.ts +80 -0
- package/lib/components/VBadge/index.d.ts +123 -0
- package/lib/components/VBanner/index.d.ts +122 -0
- package/lib/components/VBottomNavigation/index.d.ts +143 -0
- package/lib/components/VBreadcrumbs/VBreadcrumbsItem.mjs +2 -2
- package/lib/components/VBreadcrumbs/VBreadcrumbsItem.mjs.map +1 -1
- package/lib/components/VBreadcrumbs/index.d.ts +301 -0
- package/lib/components/VBtn/VBtn.css +8 -3
- package/lib/components/VBtn/VBtn.mjs +16 -6
- package/lib/components/VBtn/VBtn.mjs.map +1 -1
- package/lib/components/VBtn/index.d.ts +210 -0
- package/lib/components/VBtnGroup/index.d.ts +65 -0
- package/lib/components/VBtnToggle/VBtnToggle.mjs +1 -3
- package/lib/components/VBtnToggle/VBtnToggle.mjs.map +1 -1
- package/lib/components/VBtnToggle/index.d.ts +175 -0
- package/lib/components/VCard/VCard.css +8 -3
- package/lib/components/VCard/index.d.ts +230 -0
- package/lib/components/VCarousel/VCarousel.mjs +3 -3
- package/lib/components/VCarousel/VCarousel.mjs.map +1 -1
- package/lib/components/VCarousel/index.d.ts +80 -0
- package/lib/components/VCheckbox/index.d.ts +291 -0
- package/lib/components/VChip/index.d.ts +195 -0
- package/lib/components/VChipGroup/index.d.ts +89 -0
- package/lib/components/VCode/index.d.ts +19 -0
- package/lib/components/VColorPicker/index.d.ts +116 -0
- package/lib/components/VCombobox/VCombobox.mjs +1 -1
- package/lib/components/VCombobox/VCombobox.mjs.map +1 -1
- package/lib/components/VCombobox/index.d.ts +1590 -0
- package/lib/components/VCounter/index.d.ts +223 -0
- package/lib/components/VDefaultsProvider/index.d.ts +26 -0
- package/lib/components/VDialog/VDialog.css +2 -0
- package/lib/components/VDialog/VDialog.mjs +17 -12
- package/lib/components/VDialog/VDialog.mjs.map +1 -1
- package/lib/components/VDialog/VDialog.sass +2 -0
- package/lib/components/VDialog/index.d.ts +859 -0
- package/lib/components/VDivider/index.d.ts +22 -0
- package/lib/components/VExpansionPanel/VExpansionPanel.css +8 -3
- package/lib/components/VExpansionPanel/index.d.ts +206 -0
- package/lib/components/VField/VField.css +27 -24
- package/lib/components/VField/VField.mjs +1 -1
- package/lib/components/VField/VField.mjs.map +1 -1
- package/lib/components/VField/VField.sass +23 -21
- package/lib/components/VField/index.d.ts +332 -0
- package/lib/components/VFileInput/VFileInput.mjs +3 -3
- package/lib/components/VFileInput/VFileInput.mjs.map +1 -1
- package/lib/components/VFileInput/index.d.ts +236 -0
- package/lib/components/VFooter/VFooter.css +7 -0
- package/lib/components/VFooter/VFooter.sass +1 -1
- package/lib/components/VFooter/_variables.scss +11 -0
- package/lib/components/VFooter/index.d.ts +76 -0
- package/lib/components/VForm/index.d.ts +72 -0
- package/lib/components/VGrid/index.d.ts +154 -0
- package/lib/components/VHover/index.d.ts +30 -0
- package/lib/components/VIcon/index.d.ts +124 -0
- package/lib/components/VImg/VImg.mjs +29 -27
- package/lib/components/VImg/VImg.mjs.map +1 -1
- package/lib/components/VImg/index.d.ts +89 -0
- package/lib/components/VInput/VInput.mjs +4 -4
- package/lib/components/VInput/VInput.mjs.map +1 -1
- package/lib/components/VInput/index.d.ts +325 -0
- package/lib/components/VItemGroup/index.d.ts +210 -0
- package/lib/components/VKbd/index.d.ts +19 -0
- package/lib/components/VLabel/VLabel.css +4 -1
- package/lib/components/VLabel/VLabel.mjs +4 -1
- package/lib/components/VLabel/VLabel.mjs.map +1 -1
- package/lib/components/VLabel/VLabel.sass +3 -1
- package/lib/components/VLabel/index.d.ts +16 -0
- package/lib/components/VLayout/index.d.ts +75 -0
- package/lib/components/VLazy/index.d.ts +85 -0
- package/lib/components/VList/VListItem.css +8 -3
- package/lib/components/VList/VListItem.mjs +4 -4
- package/lib/components/VList/VListItem.mjs.map +1 -1
- package/lib/components/VList/index.d.ts +1250 -0
- package/lib/components/VLocaleProvider/index.d.ts +23 -0
- package/lib/components/VMain/index.d.ts +26 -0
- package/lib/components/VMenu/VMenu.mjs +16 -3
- package/lib/components/VMenu/VMenu.mjs.map +1 -1
- package/lib/components/VMenu/index.d.ts +817 -0
- package/lib/components/VMessages/index.d.ts +234 -0
- package/lib/components/VNavigationDrawer/index.d.ts +148 -0
- package/lib/components/VNoSsr/index.d.ts +7 -0
- package/lib/components/VOverlay/VOverlay.mjs +4 -3
- package/lib/components/VOverlay/VOverlay.mjs.map +1 -1
- package/lib/components/VOverlay/index.d.ts +579 -0
- package/lib/components/VOverlay/useActivator.mjs +27 -1
- package/lib/components/VOverlay/useActivator.mjs.map +1 -1
- package/lib/components/VPagination/VPagination.mjs +6 -3
- package/lib/components/VPagination/VPagination.mjs.map +1 -1
- package/lib/components/VPagination/index.d.ts +247 -0
- package/lib/components/VParallax/VParallax.mjs +24 -10
- package/lib/components/VParallax/VParallax.mjs.map +1 -1
- package/lib/components/VParallax/index.d.ts +18 -0
- package/lib/components/VProgressCircular/index.d.ts +68 -0
- package/lib/components/VProgressLinear/index.d.ts +101 -0
- package/lib/components/VRadio/index.d.ts +103 -0
- package/lib/components/VRadioGroup/VRadioGroup.css +2 -3
- package/lib/components/VRadioGroup/VRadioGroup.mjs +2 -1
- package/lib/components/VRadioGroup/VRadioGroup.mjs.map +1 -1
- package/lib/components/VRadioGroup/VRadioGroup.sass +2 -2
- package/lib/components/VRadioGroup/_variables.scss +0 -1
- package/lib/components/VRadioGroup/index.d.ts +186 -0
- package/lib/components/VRangeSlider/VRangeSlider.mjs +12 -2
- package/lib/components/VRangeSlider/VRangeSlider.mjs.map +1 -1
- package/lib/components/VRangeSlider/index.d.ts +242 -0
- package/lib/components/VRating/index.d.ts +356 -0
- package/lib/components/VResponsive/index.d.ts +23 -0
- package/lib/components/VSelect/VSelect.mjs +1 -1
- package/lib/components/VSelect/VSelect.mjs.map +1 -1
- package/lib/components/VSelect/index.d.ts +1521 -0
- package/lib/components/VSelectionControl/VSelectionControl.mjs +2 -1
- package/lib/components/VSelectionControl/VSelectionControl.mjs.map +1 -1
- package/lib/components/VSelectionControl/index.d.ts +275 -0
- package/lib/components/VSelectionControlGroup/VSelectionControlGroup.css +5 -0
- package/lib/components/VSelectionControlGroup/VSelectionControlGroup.mjs +3 -1
- package/lib/components/VSelectionControlGroup/VSelectionControlGroup.mjs.map +1 -1
- package/lib/components/VSelectionControlGroup/VSelectionControlGroup.sass +5 -0
- package/lib/components/VSelectionControlGroup/index.d.ts +47 -0
- package/lib/components/VSheet/index.d.ts +68 -0
- package/lib/components/VSlideGroup/index.d.ts +151 -0
- package/lib/components/VSlider/VSlider.css +7 -2
- package/lib/components/VSlider/VSlider.mjs +14 -4
- package/lib/components/VSlider/VSlider.mjs.map +1 -1
- package/lib/components/VSlider/VSlider.sass +6 -2
- package/lib/components/VSlider/VSliderTrack.css +20 -20
- package/lib/components/VSlider/VSliderTrack.mjs +7 -3
- package/lib/components/VSlider/VSliderTrack.mjs.map +1 -1
- package/lib/components/VSlider/VSliderTrack.sass +14 -14
- package/lib/components/VSlider/_variables.scss +2 -2
- package/lib/components/VSlider/index.d.ts +239 -0
- package/lib/components/VSlider/slider.mjs +2 -2
- package/lib/components/VSlider/slider.mjs.map +1 -1
- package/lib/components/VSnackbar/VSnackbar.mjs +3 -2
- package/lib/components/VSnackbar/VSnackbar.mjs.map +1 -1
- package/lib/components/VSnackbar/index.d.ts +892 -0
- package/lib/components/VSwitch/index.d.ts +175 -0
- package/lib/components/VSystemBar/index.d.ts +61 -0
- package/lib/components/VTable/index.d.ts +39 -0
- package/lib/components/VTabs/VTab.mjs +1 -0
- package/lib/components/VTabs/VTab.mjs.map +1 -1
- package/lib/components/VTabs/index.d.ts +178 -0
- package/lib/components/VTextField/VTextField.css +2 -3
- package/lib/components/VTextField/VTextField.sass +2 -4
- package/lib/components/VTextField/index.d.ts +582 -0
- package/lib/components/VTextarea/VTextarea.css +5 -3
- package/lib/components/VTextarea/VTextarea.mjs +2 -1
- package/lib/components/VTextarea/VTextarea.mjs.map +1 -1
- package/lib/components/VTextarea/VTextarea.sass +5 -4
- package/lib/components/VTextarea/index.d.ts +218 -0
- package/lib/components/VThemeProvider/index.d.ts +24 -0
- package/lib/components/VTimeline/VTimeline.css +21 -6
- package/lib/components/VTimeline/VTimeline.mjs +6 -1
- package/lib/components/VTimeline/VTimeline.mjs.map +1 -1
- package/lib/components/VTimeline/VTimeline.sass +16 -2
- package/lib/components/VTimeline/_variables.scss +4 -3
- package/lib/components/VTimeline/index.d.ts +154 -0
- package/lib/components/VToolbar/VToolbar.css +0 -1
- package/lib/components/VToolbar/VToolbar.sass +0 -1
- package/lib/components/VToolbar/index.d.ts +414 -0
- package/lib/components/VTooltip/VTooltip.mjs.map +1 -1
- package/lib/components/VTooltip/index.d.ts +799 -0
- package/lib/components/VValidation/index.d.ts +61 -0
- package/lib/components/VWindow/index.d.ts +428 -0
- package/lib/components/index.d.ts +12037 -10009
- package/lib/components/transitions/index.d.ts +454 -0
- package/lib/composables/display.mjs +3 -3
- package/lib/composables/display.mjs.map +1 -1
- package/lib/composables/items.mjs.map +1 -1
- package/lib/composables/locale.mjs +10 -3
- package/lib/composables/locale.mjs.map +1 -1
- package/lib/composables/proxiedModel.mjs +28 -10
- package/lib/composables/proxiedModel.mjs.map +1 -1
- package/lib/composables/router.mjs +10 -2
- package/lib/composables/router.mjs.map +1 -1
- package/lib/composables/selectLink.mjs +4 -4
- package/lib/composables/selectLink.mjs.map +1 -1
- package/lib/composables/theme.mjs +37 -33
- package/lib/composables/theme.mjs.map +1 -1
- package/lib/composables/validation.mjs +1 -1
- package/lib/composables/validation.mjs.map +1 -1
- package/lib/entry-bundler.mjs +1 -1
- package/lib/framework.mjs +46 -51
- package/lib/framework.mjs.map +1 -1
- package/lib/index.d.ts +31 -22
- package/lib/locale/adapters/vue-i18n.d.ts +35 -0
- package/lib/locale/adapters/vue-intl.d.ts +42 -0
- package/lib/styles/main.css +73 -73
- package/lib/styles/settings/_colors.scss +84 -84
- package/lib/styles/tools/_states.sass +8 -3
- package/lib/util/getCurrentInstance.mjs +2 -3
- package/lib/util/getCurrentInstance.mjs.map +1 -1
- package/lib/util/helpers.mjs +6 -11
- package/lib/util/helpers.mjs.map +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { PropType } from 'vue';
|
|
3
|
+
|
|
4
|
+
declare const VDialogTransition: vue.DefineComponent<{
|
|
5
|
+
target: PropType<HTMLElement>;
|
|
6
|
+
}, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
7
|
+
target: PropType<HTMLElement>;
|
|
8
|
+
}>>, {}>;
|
|
9
|
+
|
|
10
|
+
declare const VFabTransition: vue.DefineComponent<{
|
|
11
|
+
group: BooleanConstructor;
|
|
12
|
+
hideOnLeave: BooleanConstructor;
|
|
13
|
+
leaveAbsolute: BooleanConstructor;
|
|
14
|
+
mode: {
|
|
15
|
+
type: StringConstructor;
|
|
16
|
+
default: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
origin: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
25
|
+
group: BooleanConstructor;
|
|
26
|
+
hideOnLeave: BooleanConstructor;
|
|
27
|
+
leaveAbsolute: BooleanConstructor;
|
|
28
|
+
mode: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
default: string | undefined;
|
|
31
|
+
};
|
|
32
|
+
origin: {
|
|
33
|
+
type: StringConstructor;
|
|
34
|
+
default: string;
|
|
35
|
+
};
|
|
36
|
+
}>>, {
|
|
37
|
+
origin: string;
|
|
38
|
+
group: boolean;
|
|
39
|
+
mode: string;
|
|
40
|
+
hideOnLeave: boolean;
|
|
41
|
+
leaveAbsolute: boolean;
|
|
42
|
+
}>;
|
|
43
|
+
declare const VDialogBottomTransition: vue.DefineComponent<{
|
|
44
|
+
group: BooleanConstructor;
|
|
45
|
+
hideOnLeave: BooleanConstructor;
|
|
46
|
+
leaveAbsolute: BooleanConstructor;
|
|
47
|
+
mode: {
|
|
48
|
+
type: StringConstructor;
|
|
49
|
+
default: string | undefined;
|
|
50
|
+
};
|
|
51
|
+
origin: {
|
|
52
|
+
type: StringConstructor;
|
|
53
|
+
default: string;
|
|
54
|
+
};
|
|
55
|
+
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
56
|
+
[key: string]: any;
|
|
57
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
58
|
+
group: BooleanConstructor;
|
|
59
|
+
hideOnLeave: BooleanConstructor;
|
|
60
|
+
leaveAbsolute: BooleanConstructor;
|
|
61
|
+
mode: {
|
|
62
|
+
type: StringConstructor;
|
|
63
|
+
default: string | undefined;
|
|
64
|
+
};
|
|
65
|
+
origin: {
|
|
66
|
+
type: StringConstructor;
|
|
67
|
+
default: string;
|
|
68
|
+
};
|
|
69
|
+
}>>, {
|
|
70
|
+
origin: string;
|
|
71
|
+
group: boolean;
|
|
72
|
+
mode: string;
|
|
73
|
+
hideOnLeave: boolean;
|
|
74
|
+
leaveAbsolute: boolean;
|
|
75
|
+
}>;
|
|
76
|
+
declare const VDialogTopTransition: vue.DefineComponent<{
|
|
77
|
+
group: BooleanConstructor;
|
|
78
|
+
hideOnLeave: BooleanConstructor;
|
|
79
|
+
leaveAbsolute: BooleanConstructor;
|
|
80
|
+
mode: {
|
|
81
|
+
type: StringConstructor;
|
|
82
|
+
default: string | undefined;
|
|
83
|
+
};
|
|
84
|
+
origin: {
|
|
85
|
+
type: StringConstructor;
|
|
86
|
+
default: string;
|
|
87
|
+
};
|
|
88
|
+
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
89
|
+
[key: string]: any;
|
|
90
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
91
|
+
group: BooleanConstructor;
|
|
92
|
+
hideOnLeave: BooleanConstructor;
|
|
93
|
+
leaveAbsolute: BooleanConstructor;
|
|
94
|
+
mode: {
|
|
95
|
+
type: StringConstructor;
|
|
96
|
+
default: string | undefined;
|
|
97
|
+
};
|
|
98
|
+
origin: {
|
|
99
|
+
type: StringConstructor;
|
|
100
|
+
default: string;
|
|
101
|
+
};
|
|
102
|
+
}>>, {
|
|
103
|
+
origin: string;
|
|
104
|
+
group: boolean;
|
|
105
|
+
mode: string;
|
|
106
|
+
hideOnLeave: boolean;
|
|
107
|
+
leaveAbsolute: boolean;
|
|
108
|
+
}>;
|
|
109
|
+
declare const VFadeTransition: vue.DefineComponent<{
|
|
110
|
+
group: BooleanConstructor;
|
|
111
|
+
hideOnLeave: BooleanConstructor;
|
|
112
|
+
leaveAbsolute: BooleanConstructor;
|
|
113
|
+
mode: {
|
|
114
|
+
type: StringConstructor;
|
|
115
|
+
default: string | undefined;
|
|
116
|
+
};
|
|
117
|
+
origin: {
|
|
118
|
+
type: StringConstructor;
|
|
119
|
+
default: string;
|
|
120
|
+
};
|
|
121
|
+
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
122
|
+
[key: string]: any;
|
|
123
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
124
|
+
group: BooleanConstructor;
|
|
125
|
+
hideOnLeave: BooleanConstructor;
|
|
126
|
+
leaveAbsolute: BooleanConstructor;
|
|
127
|
+
mode: {
|
|
128
|
+
type: StringConstructor;
|
|
129
|
+
default: string | undefined;
|
|
130
|
+
};
|
|
131
|
+
origin: {
|
|
132
|
+
type: StringConstructor;
|
|
133
|
+
default: string;
|
|
134
|
+
};
|
|
135
|
+
}>>, {
|
|
136
|
+
origin: string;
|
|
137
|
+
group: boolean;
|
|
138
|
+
mode: string;
|
|
139
|
+
hideOnLeave: boolean;
|
|
140
|
+
leaveAbsolute: boolean;
|
|
141
|
+
}>;
|
|
142
|
+
declare const VScaleTransition: vue.DefineComponent<{
|
|
143
|
+
group: BooleanConstructor;
|
|
144
|
+
hideOnLeave: BooleanConstructor;
|
|
145
|
+
leaveAbsolute: BooleanConstructor;
|
|
146
|
+
mode: {
|
|
147
|
+
type: StringConstructor;
|
|
148
|
+
default: string | undefined;
|
|
149
|
+
};
|
|
150
|
+
origin: {
|
|
151
|
+
type: StringConstructor;
|
|
152
|
+
default: string;
|
|
153
|
+
};
|
|
154
|
+
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
155
|
+
[key: string]: any;
|
|
156
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
157
|
+
group: BooleanConstructor;
|
|
158
|
+
hideOnLeave: BooleanConstructor;
|
|
159
|
+
leaveAbsolute: BooleanConstructor;
|
|
160
|
+
mode: {
|
|
161
|
+
type: StringConstructor;
|
|
162
|
+
default: string | undefined;
|
|
163
|
+
};
|
|
164
|
+
origin: {
|
|
165
|
+
type: StringConstructor;
|
|
166
|
+
default: string;
|
|
167
|
+
};
|
|
168
|
+
}>>, {
|
|
169
|
+
origin: string;
|
|
170
|
+
group: boolean;
|
|
171
|
+
mode: string;
|
|
172
|
+
hideOnLeave: boolean;
|
|
173
|
+
leaveAbsolute: boolean;
|
|
174
|
+
}>;
|
|
175
|
+
declare const VScrollXTransition: vue.DefineComponent<{
|
|
176
|
+
group: BooleanConstructor;
|
|
177
|
+
hideOnLeave: BooleanConstructor;
|
|
178
|
+
leaveAbsolute: BooleanConstructor;
|
|
179
|
+
mode: {
|
|
180
|
+
type: StringConstructor;
|
|
181
|
+
default: string | undefined;
|
|
182
|
+
};
|
|
183
|
+
origin: {
|
|
184
|
+
type: StringConstructor;
|
|
185
|
+
default: string;
|
|
186
|
+
};
|
|
187
|
+
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
188
|
+
[key: string]: any;
|
|
189
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
190
|
+
group: BooleanConstructor;
|
|
191
|
+
hideOnLeave: BooleanConstructor;
|
|
192
|
+
leaveAbsolute: BooleanConstructor;
|
|
193
|
+
mode: {
|
|
194
|
+
type: StringConstructor;
|
|
195
|
+
default: string | undefined;
|
|
196
|
+
};
|
|
197
|
+
origin: {
|
|
198
|
+
type: StringConstructor;
|
|
199
|
+
default: string;
|
|
200
|
+
};
|
|
201
|
+
}>>, {
|
|
202
|
+
origin: string;
|
|
203
|
+
group: boolean;
|
|
204
|
+
mode: string;
|
|
205
|
+
hideOnLeave: boolean;
|
|
206
|
+
leaveAbsolute: boolean;
|
|
207
|
+
}>;
|
|
208
|
+
declare const VScrollXReverseTransition: vue.DefineComponent<{
|
|
209
|
+
group: BooleanConstructor;
|
|
210
|
+
hideOnLeave: BooleanConstructor;
|
|
211
|
+
leaveAbsolute: BooleanConstructor;
|
|
212
|
+
mode: {
|
|
213
|
+
type: StringConstructor;
|
|
214
|
+
default: string | undefined;
|
|
215
|
+
};
|
|
216
|
+
origin: {
|
|
217
|
+
type: StringConstructor;
|
|
218
|
+
default: string;
|
|
219
|
+
};
|
|
220
|
+
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
221
|
+
[key: string]: any;
|
|
222
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
223
|
+
group: BooleanConstructor;
|
|
224
|
+
hideOnLeave: BooleanConstructor;
|
|
225
|
+
leaveAbsolute: BooleanConstructor;
|
|
226
|
+
mode: {
|
|
227
|
+
type: StringConstructor;
|
|
228
|
+
default: string | undefined;
|
|
229
|
+
};
|
|
230
|
+
origin: {
|
|
231
|
+
type: StringConstructor;
|
|
232
|
+
default: string;
|
|
233
|
+
};
|
|
234
|
+
}>>, {
|
|
235
|
+
origin: string;
|
|
236
|
+
group: boolean;
|
|
237
|
+
mode: string;
|
|
238
|
+
hideOnLeave: boolean;
|
|
239
|
+
leaveAbsolute: boolean;
|
|
240
|
+
}>;
|
|
241
|
+
declare const VScrollYTransition: vue.DefineComponent<{
|
|
242
|
+
group: BooleanConstructor;
|
|
243
|
+
hideOnLeave: BooleanConstructor;
|
|
244
|
+
leaveAbsolute: BooleanConstructor;
|
|
245
|
+
mode: {
|
|
246
|
+
type: StringConstructor;
|
|
247
|
+
default: string | undefined;
|
|
248
|
+
};
|
|
249
|
+
origin: {
|
|
250
|
+
type: StringConstructor;
|
|
251
|
+
default: string;
|
|
252
|
+
};
|
|
253
|
+
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
254
|
+
[key: string]: any;
|
|
255
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
256
|
+
group: BooleanConstructor;
|
|
257
|
+
hideOnLeave: BooleanConstructor;
|
|
258
|
+
leaveAbsolute: BooleanConstructor;
|
|
259
|
+
mode: {
|
|
260
|
+
type: StringConstructor;
|
|
261
|
+
default: string | undefined;
|
|
262
|
+
};
|
|
263
|
+
origin: {
|
|
264
|
+
type: StringConstructor;
|
|
265
|
+
default: string;
|
|
266
|
+
};
|
|
267
|
+
}>>, {
|
|
268
|
+
origin: string;
|
|
269
|
+
group: boolean;
|
|
270
|
+
mode: string;
|
|
271
|
+
hideOnLeave: boolean;
|
|
272
|
+
leaveAbsolute: boolean;
|
|
273
|
+
}>;
|
|
274
|
+
declare const VScrollYReverseTransition: vue.DefineComponent<{
|
|
275
|
+
group: BooleanConstructor;
|
|
276
|
+
hideOnLeave: BooleanConstructor;
|
|
277
|
+
leaveAbsolute: BooleanConstructor;
|
|
278
|
+
mode: {
|
|
279
|
+
type: StringConstructor;
|
|
280
|
+
default: string | undefined;
|
|
281
|
+
};
|
|
282
|
+
origin: {
|
|
283
|
+
type: StringConstructor;
|
|
284
|
+
default: string;
|
|
285
|
+
};
|
|
286
|
+
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
287
|
+
[key: string]: any;
|
|
288
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
289
|
+
group: BooleanConstructor;
|
|
290
|
+
hideOnLeave: BooleanConstructor;
|
|
291
|
+
leaveAbsolute: BooleanConstructor;
|
|
292
|
+
mode: {
|
|
293
|
+
type: StringConstructor;
|
|
294
|
+
default: string | undefined;
|
|
295
|
+
};
|
|
296
|
+
origin: {
|
|
297
|
+
type: StringConstructor;
|
|
298
|
+
default: string;
|
|
299
|
+
};
|
|
300
|
+
}>>, {
|
|
301
|
+
origin: string;
|
|
302
|
+
group: boolean;
|
|
303
|
+
mode: string;
|
|
304
|
+
hideOnLeave: boolean;
|
|
305
|
+
leaveAbsolute: boolean;
|
|
306
|
+
}>;
|
|
307
|
+
declare const VSlideXTransition: vue.DefineComponent<{
|
|
308
|
+
group: BooleanConstructor;
|
|
309
|
+
hideOnLeave: BooleanConstructor;
|
|
310
|
+
leaveAbsolute: BooleanConstructor;
|
|
311
|
+
mode: {
|
|
312
|
+
type: StringConstructor;
|
|
313
|
+
default: string | undefined;
|
|
314
|
+
};
|
|
315
|
+
origin: {
|
|
316
|
+
type: StringConstructor;
|
|
317
|
+
default: string;
|
|
318
|
+
};
|
|
319
|
+
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
320
|
+
[key: string]: any;
|
|
321
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
322
|
+
group: BooleanConstructor;
|
|
323
|
+
hideOnLeave: BooleanConstructor;
|
|
324
|
+
leaveAbsolute: BooleanConstructor;
|
|
325
|
+
mode: {
|
|
326
|
+
type: StringConstructor;
|
|
327
|
+
default: string | undefined;
|
|
328
|
+
};
|
|
329
|
+
origin: {
|
|
330
|
+
type: StringConstructor;
|
|
331
|
+
default: string;
|
|
332
|
+
};
|
|
333
|
+
}>>, {
|
|
334
|
+
origin: string;
|
|
335
|
+
group: boolean;
|
|
336
|
+
mode: string;
|
|
337
|
+
hideOnLeave: boolean;
|
|
338
|
+
leaveAbsolute: boolean;
|
|
339
|
+
}>;
|
|
340
|
+
declare const VSlideXReverseTransition: vue.DefineComponent<{
|
|
341
|
+
group: BooleanConstructor;
|
|
342
|
+
hideOnLeave: BooleanConstructor;
|
|
343
|
+
leaveAbsolute: BooleanConstructor;
|
|
344
|
+
mode: {
|
|
345
|
+
type: StringConstructor;
|
|
346
|
+
default: string | undefined;
|
|
347
|
+
};
|
|
348
|
+
origin: {
|
|
349
|
+
type: StringConstructor;
|
|
350
|
+
default: string;
|
|
351
|
+
};
|
|
352
|
+
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
353
|
+
[key: string]: any;
|
|
354
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
355
|
+
group: BooleanConstructor;
|
|
356
|
+
hideOnLeave: BooleanConstructor;
|
|
357
|
+
leaveAbsolute: BooleanConstructor;
|
|
358
|
+
mode: {
|
|
359
|
+
type: StringConstructor;
|
|
360
|
+
default: string | undefined;
|
|
361
|
+
};
|
|
362
|
+
origin: {
|
|
363
|
+
type: StringConstructor;
|
|
364
|
+
default: string;
|
|
365
|
+
};
|
|
366
|
+
}>>, {
|
|
367
|
+
origin: string;
|
|
368
|
+
group: boolean;
|
|
369
|
+
mode: string;
|
|
370
|
+
hideOnLeave: boolean;
|
|
371
|
+
leaveAbsolute: boolean;
|
|
372
|
+
}>;
|
|
373
|
+
declare const VSlideYTransition: vue.DefineComponent<{
|
|
374
|
+
group: BooleanConstructor;
|
|
375
|
+
hideOnLeave: BooleanConstructor;
|
|
376
|
+
leaveAbsolute: BooleanConstructor;
|
|
377
|
+
mode: {
|
|
378
|
+
type: StringConstructor;
|
|
379
|
+
default: string | undefined;
|
|
380
|
+
};
|
|
381
|
+
origin: {
|
|
382
|
+
type: StringConstructor;
|
|
383
|
+
default: string;
|
|
384
|
+
};
|
|
385
|
+
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
386
|
+
[key: string]: any;
|
|
387
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
388
|
+
group: BooleanConstructor;
|
|
389
|
+
hideOnLeave: BooleanConstructor;
|
|
390
|
+
leaveAbsolute: BooleanConstructor;
|
|
391
|
+
mode: {
|
|
392
|
+
type: StringConstructor;
|
|
393
|
+
default: string | undefined;
|
|
394
|
+
};
|
|
395
|
+
origin: {
|
|
396
|
+
type: StringConstructor;
|
|
397
|
+
default: string;
|
|
398
|
+
};
|
|
399
|
+
}>>, {
|
|
400
|
+
origin: string;
|
|
401
|
+
group: boolean;
|
|
402
|
+
mode: string;
|
|
403
|
+
hideOnLeave: boolean;
|
|
404
|
+
leaveAbsolute: boolean;
|
|
405
|
+
}>;
|
|
406
|
+
declare const VSlideYReverseTransition: vue.DefineComponent<{
|
|
407
|
+
group: BooleanConstructor;
|
|
408
|
+
hideOnLeave: BooleanConstructor;
|
|
409
|
+
leaveAbsolute: BooleanConstructor;
|
|
410
|
+
mode: {
|
|
411
|
+
type: StringConstructor;
|
|
412
|
+
default: string | undefined;
|
|
413
|
+
};
|
|
414
|
+
origin: {
|
|
415
|
+
type: StringConstructor;
|
|
416
|
+
default: string;
|
|
417
|
+
};
|
|
418
|
+
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
419
|
+
[key: string]: any;
|
|
420
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
421
|
+
group: BooleanConstructor;
|
|
422
|
+
hideOnLeave: BooleanConstructor;
|
|
423
|
+
leaveAbsolute: BooleanConstructor;
|
|
424
|
+
mode: {
|
|
425
|
+
type: StringConstructor;
|
|
426
|
+
default: string | undefined;
|
|
427
|
+
};
|
|
428
|
+
origin: {
|
|
429
|
+
type: StringConstructor;
|
|
430
|
+
default: string;
|
|
431
|
+
};
|
|
432
|
+
}>>, {
|
|
433
|
+
origin: string;
|
|
434
|
+
group: boolean;
|
|
435
|
+
mode: string;
|
|
436
|
+
hideOnLeave: boolean;
|
|
437
|
+
leaveAbsolute: boolean;
|
|
438
|
+
}>;
|
|
439
|
+
declare const VExpandTransition: vue.DefineComponent<{
|
|
440
|
+
mode: vue.Prop<"default" | "in-out" | "out-in", "default" | "in-out" | "out-in">;
|
|
441
|
+
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
442
|
+
[key: string]: any;
|
|
443
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
444
|
+
mode: vue.Prop<"default" | "in-out" | "out-in", "default" | "in-out" | "out-in">;
|
|
445
|
+
}>>, {}>;
|
|
446
|
+
declare const VExpandXTransition: vue.DefineComponent<{
|
|
447
|
+
mode: vue.Prop<"default" | "in-out" | "out-in", "default" | "in-out" | "out-in">;
|
|
448
|
+
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
449
|
+
[key: string]: any;
|
|
450
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
451
|
+
mode: vue.Prop<"default" | "in-out" | "out-in", "default" | "in-out" | "out-in">;
|
|
452
|
+
}>>, {}>;
|
|
453
|
+
|
|
454
|
+
export { VDialogBottomTransition, VDialogTopTransition, VDialogTransition, VExpandTransition, VExpandXTransition, VFabTransition, VFadeTransition, VScaleTransition, VScrollXReverseTransition, VScrollXTransition, VScrollYReverseTransition, VScrollYTransition, VSlideXReverseTransition, VSlideXTransition, VSlideYReverseTransition, VSlideYTransition };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Utilities
|
|
2
|
-
import { inject,
|
|
2
|
+
import { inject, reactive, ref, toRefs, watchEffect } from 'vue';
|
|
3
3
|
import { mergeDeep } from "../util/index.mjs"; // Globals
|
|
4
4
|
|
|
5
5
|
import { IN_BROWSER, SUPPORTS_TOUCH } from "../util/globals.mjs"; // Types
|
|
@@ -81,8 +81,8 @@ export function createDisplay(options, isHydrate) {
|
|
|
81
81
|
width.value = getClientWidth();
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
if (isHydrate) {
|
|
85
|
-
|
|
84
|
+
if (isHydrate && IN_BROWSER) {
|
|
85
|
+
requestAnimationFrame(() => onResize());
|
|
86
86
|
} // eslint-disable-next-line max-statements
|
|
87
87
|
|
|
88
88
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display.mjs","names":["inject","nextTick","reactive","ref","toRefs","watchEffect","mergeDeep","IN_BROWSER","SUPPORTS_TOUCH","DisplaySymbol","Symbol","for","defaultDisplayOptions","mobileBreakpoint","thresholds","xs","sm","md","lg","xl","xxl","parseDisplayOptions","options","getClientWidth","isHydrate","window","innerWidth","getClientHeight","innerHeight","getPlatform","userAgent","navigator","match","regexp","Boolean","android","ios","cordova","electron","chrome","edge","firefox","opera","win","mac","linux","ssr","touch","createDisplay","height","platform","state","width","onResize","value","name","breakpointValue","mobile","smAndUp","mdAndUp","lgAndUp","xlAndUp","smAndDown","mdAndDown","lgAndDown","xlAndDown","addEventListener","passive","useDisplay","display","Error"],"sources":["../../src/composables/display.ts"],"sourcesContent":["// Utilities\nimport { inject, nextTick, reactive, ref, toRefs, watchEffect } from 'vue'\nimport { mergeDeep } from '@/util'\n\n// Globals\nimport { IN_BROWSER, SUPPORTS_TOUCH } from '@/util/globals'\n\n// Types\nimport type { InjectionKey, ToRefs } from 'vue'\n\nexport type DisplayBreakpoint = keyof DisplayThresholds\n\nexport interface DisplayThresholds {\n xs: number\n sm: number\n md: number\n lg: number\n xl: number\n xxl: number\n}\n\nexport interface DisplayOptions {\n mobileBreakpoint?: number | DisplayBreakpoint\n thresholds?: Partial<DisplayThresholds>\n}\n\nexport interface InternalDisplayOptions {\n mobileBreakpoint: number | DisplayBreakpoint\n thresholds: DisplayThresholds\n}\n\nexport interface DisplayPlatform {\n android: boolean\n ios: boolean\n cordova: boolean\n electron: boolean\n chrome: boolean\n edge: boolean\n firefox: boolean\n opera: boolean\n win: boolean\n mac: boolean\n linux: boolean\n touch: boolean\n ssr: boolean\n}\n\nexport interface DisplayInstance {\n xs: boolean\n sm: boolean\n md: boolean\n lg: boolean\n xl: boolean\n xxl: boolean\n smAndUp: boolean\n mdAndUp: boolean\n lgAndUp: boolean\n xlAndUp: boolean\n smAndDown: boolean\n mdAndDown: boolean\n lgAndDown: boolean\n xlAndDown: boolean\n name: DisplayBreakpoint\n height: number\n width: number\n mobile: boolean\n mobileBreakpoint: number | DisplayBreakpoint\n platform: DisplayPlatform\n thresholds: DisplayThresholds\n}\n\nexport const DisplaySymbol: InjectionKey<ToRefs<DisplayInstance>> = Symbol.for('vuetify:display')\n\nconst defaultDisplayOptions: DisplayOptions = {\n mobileBreakpoint: 'lg',\n thresholds: {\n xs: 0,\n sm: 600,\n md: 960,\n lg: 1280,\n xl: 1920,\n xxl: 2560,\n },\n}\n\nconst parseDisplayOptions = (options: DisplayOptions = defaultDisplayOptions) => {\n return mergeDeep(defaultDisplayOptions, options) as InternalDisplayOptions\n}\n\nfunction getClientWidth (isHydrate?: boolean) {\n return IN_BROWSER && !isHydrate\n ? window.innerWidth\n : 0\n}\n\nfunction getClientHeight (isHydrate?: boolean) {\n return IN_BROWSER && !isHydrate\n ? window.innerHeight\n : 0\n}\n\nfunction getPlatform (): DisplayPlatform {\n const userAgent = IN_BROWSER ? window.navigator.userAgent : 'ssr'\n\n function match (regexp: RegExp) {\n return Boolean(userAgent.match(regexp))\n }\n\n const android = match(/android/i)\n const ios = match(/iphone|ipad|ipod/i)\n const cordova = match(/cordova/i)\n const electron = match(/electron/i)\n const chrome = match(/chrome/i)\n const edge = match(/edge/i)\n const firefox = match(/firefox/i)\n const opera = match(/opera/i)\n const win = match(/win/i)\n const mac = match(/mac/i)\n const linux = match(/linux/i)\n const ssr = match(/ssr/i)\n\n return {\n android,\n ios,\n cordova,\n electron,\n chrome,\n edge,\n firefox,\n opera,\n win,\n mac,\n linux,\n touch: SUPPORTS_TOUCH,\n ssr,\n }\n}\n\nexport function createDisplay (options?: DisplayOptions, isHydrate?: boolean): ToRefs<DisplayInstance> {\n const { thresholds, mobileBreakpoint } = parseDisplayOptions(options)\n\n const height = ref(getClientHeight(isHydrate))\n const platform = getPlatform()\n const state = reactive({} as DisplayInstance)\n const width = ref(getClientWidth(isHydrate))\n\n function onResize () {\n height.value = getClientHeight()\n width.value = getClientWidth()\n }\n\n if (isHydrate) {\n nextTick(() => onResize())\n }\n\n // eslint-disable-next-line max-statements\n watchEffect(() => {\n const xs = width.value < thresholds.sm\n const sm = width.value < thresholds.md && !xs\n const md = width.value < thresholds.lg && !(sm || xs)\n const lg = width.value < thresholds.xl && !(md || sm || xs)\n const xl = width.value < thresholds.xxl && !(lg || md || sm || xs)\n const xxl = width.value >= thresholds.xxl\n const name =\n xs ? 'xs'\n : sm ? 'sm'\n : md ? 'md'\n : lg ? 'lg'\n : xl ? 'xl'\n : 'xxl'\n const breakpointValue = typeof mobileBreakpoint === 'number' ? mobileBreakpoint : thresholds[mobileBreakpoint]\n const mobile = !platform.ssr\n ? width.value < breakpointValue\n : platform.android || platform.ios || platform.opera\n\n state.xs = xs\n state.sm = sm\n state.md = md\n state.lg = lg\n state.xl = xl\n state.xxl = xxl\n state.smAndUp = !xs\n state.mdAndUp = !(xs || sm)\n state.lgAndUp = !(xs || sm || md)\n state.xlAndUp = !(xs || sm || md || lg)\n state.smAndDown = !(md || lg || xl || xxl)\n state.mdAndDown = !(lg || xl || xxl)\n state.lgAndDown = !(xl || xxl)\n state.xlAndDown = !xxl\n state.name = name\n state.height = height.value\n state.width = width.value\n state.mobile = mobile\n state.mobileBreakpoint = mobileBreakpoint\n state.platform = platform\n state.thresholds = thresholds\n })\n\n if (IN_BROWSER) {\n window.addEventListener('resize', onResize, { passive: true })\n }\n\n return toRefs(state)\n}\n\nexport function useDisplay () {\n const display = inject(DisplaySymbol)\n\n if (!display) throw new Error('Could not find Vuetify display injection')\n\n return display\n}\n"],"mappings":"AAAA;AACA,SAASA,MAAT,EAAiBC,QAAjB,EAA2BC,QAA3B,EAAqCC,GAArC,EAA0CC,MAA1C,EAAkDC,WAAlD,QAAqE,KAArE;SACSC,S,6BAET;;SACSC,U,EAAYC,c,+BAErB;;AAgEA,OAAO,MAAMC,aAAoD,GAAGC,MAAM,CAACC,GAAP,CAAW,iBAAX,CAA7D;AAEP,MAAMC,qBAAqC,GAAG;EAC5CC,gBAAgB,EAAE,IAD0B;EAE5CC,UAAU,EAAE;IACVC,EAAE,EAAE,CADM;IAEVC,EAAE,EAAE,GAFM;IAG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E9C,EAAE,IAAIC,EAAN,IAAYC,EAAZ,IAAkBC,EAApB,CAAhB;IACAiC,KAAK,CAACW,SAAN,GAAkB,EAAE7C,EAAE,IAAIC,EAAN,IAAYC,EAAZ,IAAkBC,GAApB,CAAlB;IACA+B,KAAK,CAACY,SAAN,GAAkB,EAAE7C,EAAE,IAAIC,EAAN,IAAYC,GAAd,CAAlB;IACA+B,KAAK,CAACa,SAAN,GAAkB,EAAE7C,EAAE,IAAIC,GAAR,CAAlB;IACA+B,KAAK,CAACc,SAAN,GAAkB,CAAC7C,GAAnB;IACA+B,KAAK,CAACI,IAAN,GAAaA,IAAb;IACAJ,KAAK,CAACF,MAAN,GAAeA,MAAM,CAACK,KAAtB;IACAH,KAAK,CAACC,KAAN,GAAcA,KAAK,CAACE,KAApB;IACAH,KAAK,CAACM,MAAN,GAAeA,MAAf;IACAN,KAAK,CAACtC,gBAAN,GAAyBA,gBAAzB;IACAsC,KAAK,CAACD,QAAN,GAAiBA,QAAjB;IACAC,KAAK,CAACrC,UAAN,GAAmBA,UAAnB;EACD,CAxCU,CAAX;;EA0CA,IAAIP,UAAJ,EAAgB;IACdkB,MAAM,CAACyC,gBAAP,CAAwB,QAAxB,EAAkCb,QAAlC,EAA4C;MAAEc,OAAO,EAAE;IAAX,CAA5C;EACD;;EAED,OAAO/D,MAAM,CAAC+C,KAAD,CAAb;AACD;AAED,OAAO,SAASiB,UAAT,GAAuB;EAC5B,MAAMC,OAAO,GAAGrE,MAAM,CAACS,aAAD,CAAtB;EAEA,IAAI,CAAC4D,OAAL,EAAc,MAAM,IAAIC,KAAJ,CAAU,0CAAV,CAAN;EAEd,OAAOD,OAAP;AACD"}
|
|
1
|
+
{"version":3,"file":"display.mjs","names":["inject","reactive","ref","toRefs","watchEffect","mergeDeep","IN_BROWSER","SUPPORTS_TOUCH","DisplaySymbol","Symbol","for","defaultDisplayOptions","mobileBreakpoint","thresholds","xs","sm","md","lg","xl","xxl","parseDisplayOptions","options","getClientWidth","isHydrate","window","innerWidth","getClientHeight","innerHeight","getPlatform","userAgent","navigator","match","regexp","Boolean","android","ios","cordova","electron","chrome","edge","firefox","opera","win","mac","linux","ssr","touch","createDisplay","height","platform","state","width","onResize","value","requestAnimationFrame","name","breakpointValue","mobile","smAndUp","mdAndUp","lgAndUp","xlAndUp","smAndDown","mdAndDown","lgAndDown","xlAndDown","addEventListener","passive","useDisplay","display","Error"],"sources":["../../src/composables/display.ts"],"sourcesContent":["// Utilities\nimport { inject, reactive, ref, toRefs, watchEffect } from 'vue'\nimport { mergeDeep } from '@/util'\n\n// Globals\nimport { IN_BROWSER, SUPPORTS_TOUCH } from '@/util/globals'\n\n// Types\nimport type { InjectionKey, ToRefs } from 'vue'\n\nexport type DisplayBreakpoint = keyof DisplayThresholds\n\nexport interface DisplayThresholds {\n xs: number\n sm: number\n md: number\n lg: number\n xl: number\n xxl: number\n}\n\nexport interface DisplayOptions {\n mobileBreakpoint?: number | DisplayBreakpoint\n thresholds?: Partial<DisplayThresholds>\n}\n\nexport interface InternalDisplayOptions {\n mobileBreakpoint: number | DisplayBreakpoint\n thresholds: DisplayThresholds\n}\n\nexport interface DisplayPlatform {\n android: boolean\n ios: boolean\n cordova: boolean\n electron: boolean\n chrome: boolean\n edge: boolean\n firefox: boolean\n opera: boolean\n win: boolean\n mac: boolean\n linux: boolean\n touch: boolean\n ssr: boolean\n}\n\nexport interface DisplayInstance {\n xs: boolean\n sm: boolean\n md: boolean\n lg: boolean\n xl: boolean\n xxl: boolean\n smAndUp: boolean\n mdAndUp: boolean\n lgAndUp: boolean\n xlAndUp: boolean\n smAndDown: boolean\n mdAndDown: boolean\n lgAndDown: boolean\n xlAndDown: boolean\n name: DisplayBreakpoint\n height: number\n width: number\n mobile: boolean\n mobileBreakpoint: number | DisplayBreakpoint\n platform: DisplayPlatform\n thresholds: DisplayThresholds\n}\n\nexport const DisplaySymbol: InjectionKey<ToRefs<DisplayInstance>> = Symbol.for('vuetify:display')\n\nconst defaultDisplayOptions: DisplayOptions = {\n mobileBreakpoint: 'lg',\n thresholds: {\n xs: 0,\n sm: 600,\n md: 960,\n lg: 1280,\n xl: 1920,\n xxl: 2560,\n },\n}\n\nconst parseDisplayOptions = (options: DisplayOptions = defaultDisplayOptions) => {\n return mergeDeep(defaultDisplayOptions, options) as InternalDisplayOptions\n}\n\nfunction getClientWidth (isHydrate?: boolean) {\n return IN_BROWSER && !isHydrate\n ? window.innerWidth\n : 0\n}\n\nfunction getClientHeight (isHydrate?: boolean) {\n return IN_BROWSER && !isHydrate\n ? window.innerHeight\n : 0\n}\n\nfunction getPlatform (): DisplayPlatform {\n const userAgent = IN_BROWSER ? window.navigator.userAgent : 'ssr'\n\n function match (regexp: RegExp) {\n return Boolean(userAgent.match(regexp))\n }\n\n const android = match(/android/i)\n const ios = match(/iphone|ipad|ipod/i)\n const cordova = match(/cordova/i)\n const electron = match(/electron/i)\n const chrome = match(/chrome/i)\n const edge = match(/edge/i)\n const firefox = match(/firefox/i)\n const opera = match(/opera/i)\n const win = match(/win/i)\n const mac = match(/mac/i)\n const linux = match(/linux/i)\n const ssr = match(/ssr/i)\n\n return {\n android,\n ios,\n cordova,\n electron,\n chrome,\n edge,\n firefox,\n opera,\n win,\n mac,\n linux,\n touch: SUPPORTS_TOUCH,\n ssr,\n }\n}\n\nexport function createDisplay (options?: DisplayOptions, isHydrate?: boolean): ToRefs<DisplayInstance> {\n const { thresholds, mobileBreakpoint } = parseDisplayOptions(options)\n\n const height = ref(getClientHeight(isHydrate))\n const platform = getPlatform()\n const state = reactive({} as DisplayInstance)\n const width = ref(getClientWidth(isHydrate))\n\n function onResize () {\n height.value = getClientHeight()\n width.value = getClientWidth()\n }\n\n if (isHydrate && IN_BROWSER) {\n requestAnimationFrame(() => onResize())\n }\n\n // eslint-disable-next-line max-statements\n watchEffect(() => {\n const xs = width.value < thresholds.sm\n const sm = width.value < thresholds.md && !xs\n const md = width.value < thresholds.lg && !(sm || xs)\n const lg = width.value < thresholds.xl && !(md || sm || xs)\n const xl = width.value < thresholds.xxl && !(lg || md || sm || xs)\n const xxl = width.value >= thresholds.xxl\n const name =\n xs ? 'xs'\n : sm ? 'sm'\n : md ? 'md'\n : lg ? 'lg'\n : xl ? 'xl'\n : 'xxl'\n const breakpointValue = typeof mobileBreakpoint === 'number' ? mobileBreakpoint : thresholds[mobileBreakpoint]\n const mobile = !platform.ssr\n ? width.value < breakpointValue\n : platform.android || platform.ios || platform.opera\n\n state.xs = xs\n state.sm = sm\n state.md = md\n state.lg = lg\n state.xl = xl\n state.xxl = xxl\n state.smAndUp = !xs\n state.mdAndUp = !(xs || sm)\n state.lgAndUp = !(xs || sm || md)\n state.xlAndUp = !(xs || sm || md || lg)\n state.smAndDown = !(md || lg || xl || xxl)\n state.mdAndDown = !(lg || xl || xxl)\n state.lgAndDown = !(xl || xxl)\n state.xlAndDown = !xxl\n state.name = name\n state.height = height.value\n state.width = width.value\n state.mobile = mobile\n state.mobileBreakpoint = mobileBreakpoint\n state.platform = platform\n state.thresholds = thresholds\n })\n\n if (IN_BROWSER) {\n window.addEventListener('resize', onResize, { passive: true })\n }\n\n return toRefs(state)\n}\n\nexport function useDisplay () {\n const display = inject(DisplaySymbol)\n\n if (!display) throw new Error('Could not find Vuetify display injection')\n\n return display\n}\n"],"mappings":"AAAA;AACA,SAASA,MAAT,EAAiBC,QAAjB,EAA2BC,GAA3B,EAAgCC,MAAhC,EAAwCC,WAAxC,QAA2D,KAA3D;SACSC,S,6BAET;;SACSC,U,EAAYC,c,+BAErB;;AAgEA,OAAO,MAAMC,aAAoD,GAAGC,MAAM,CAACC,GAAP,CAAW,iBAAX,CAA7D;AAEP,MAAMC,qBAAqC,GAAG;EAC5CC,gBAAgB,EAAE,IAD0B;EAE5CC,UAAU,EAAE;IACVC,EAAE,EAAE,CADM;IAEVC,EAAE,EAAE,GAFM;IAGVC,EAAE,EAAE,GAHM;IAIVC,EAAE,EAAE,IAJM;IAKVC,EAAE,EAAE,IALM;IAMVC,GAAG,EAAE;EANK;AA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SAAN,GAAkB,EAAE9C,EAAE,IAAIC,EAAN,IAAYC,EAAZ,IAAkBC,GAApB,CAAlB;IACA+B,KAAK,CAACa,SAAN,GAAkB,EAAE9C,EAAE,IAAIC,EAAN,IAAYC,GAAd,CAAlB;IACA+B,KAAK,CAACc,SAAN,GAAkB,EAAE9C,EAAE,IAAIC,GAAR,CAAlB;IACA+B,KAAK,CAACe,SAAN,GAAkB,CAAC9C,GAAnB;IACA+B,KAAK,CAACK,IAAN,GAAaA,IAAb;IACAL,KAAK,CAACF,MAAN,GAAeA,MAAM,CAACK,KAAtB;IACAH,KAAK,CAACC,KAAN,GAAcA,KAAK,CAACE,KAApB;IACAH,KAAK,CAACO,MAAN,GAAeA,MAAf;IACAP,KAAK,CAACtC,gBAAN,GAAyBA,gBAAzB;IACAsC,KAAK,CAACD,QAAN,GAAiBA,QAAjB;IACAC,KAAK,CAACrC,UAAN,GAAmBA,UAAnB;EACD,CAxCU,CAAX;;EA0CA,IAAIP,UAAJ,EAAgB;IACdkB,MAAM,CAAC0C,gBAAP,CAAwB,QAAxB,EAAkCd,QAAlC,EAA4C;MAAEe,OAAO,EAAE;IAAX,CAA5C;EACD;;EAED,OAAOhE,MAAM,CAAC+C,KAAD,CAAb;AACD;AAED,OAAO,SAASkB,UAAT,GAAuB;EAC5B,MAAMC,OAAO,GAAGrE,MAAM,CAACQ,aAAD,CAAtB;EAEA,IAAI,CAAC6D,OAAL,EAAc,MAAM,IAAIC,KAAJ,CAAU,0CAAV,CAAN;EAEd,OAAOD,OAAP;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"items.mjs","names":["computed","getPropertyFromItem","pick","propsFactory","makeItemsProps","items","type","Array","default","itemTitle","String","Function","itemValue","itemChildren","Boolean","itemProps","returnObject","transformItem","props","item","title","value","children","isArray","undefined","_props","transformItems","raw","array","push","useItems","transformIn","map","transformOut"],"sources":["../../src/composables/items.ts"],"sourcesContent":["// Utilities\nimport { computed } from 'vue'\nimport { getPropertyFromItem, pick, propsFactory } from '@/util'\n\n// Types\nimport type { PropType } from 'vue'\nimport type { SelectItemKey } from '@/util'\n\nexport interface InternalItem {\n title: string\n value: any\n props: {\n [key: string]: any\n title: string\n value: any\n }\n children?: InternalItem[]\n raw:
|
|
1
|
+
{"version":3,"file":"items.mjs","names":["computed","getPropertyFromItem","pick","propsFactory","makeItemsProps","items","type","Array","default","itemTitle","String","Function","itemValue","itemChildren","Boolean","itemProps","returnObject","transformItem","props","item","title","value","children","isArray","undefined","_props","transformItems","raw","array","push","useItems","transformIn","map","transformOut"],"sources":["../../src/composables/items.ts"],"sourcesContent":["// Utilities\nimport { computed } from 'vue'\nimport { getPropertyFromItem, pick, propsFactory } from '@/util'\n\n// Types\nimport type { PropType } from 'vue'\nimport type { SelectItemKey } from '@/util'\n\nexport interface InternalItem<T = any> {\n title: string\n value: any\n props: {\n [key: string]: any\n title: string\n value: any\n }\n children?: InternalItem[]\n raw: T\n}\n\nexport interface ItemProps {\n items: any[]\n itemTitle: SelectItemKey\n itemValue: SelectItemKey\n itemChildren: SelectItemKey\n itemProps: SelectItemKey\n returnObject: boolean\n}\n\n// Composables\nexport const makeItemsProps = propsFactory({\n items: {\n type: Array as PropType<ItemProps['items']>,\n default: () => ([]),\n },\n itemTitle: {\n type: [String, Array, Function] as PropType<SelectItemKey>,\n default: 'title',\n },\n itemValue: {\n type: [String, Array, Function] as PropType<SelectItemKey>,\n default: 'value',\n },\n itemChildren: {\n type: [Boolean, String, Array, Function] as PropType<SelectItemKey>,\n default: 'children',\n },\n itemProps: {\n type: [Boolean, String, Array, Function] as PropType<SelectItemKey>,\n default: 'props',\n },\n returnObject: Boolean,\n}, 'item')\n\nexport function transformItem (props: Omit<ItemProps, 'items'>, item: any) {\n const title = getPropertyFromItem(item, props.itemTitle, item)\n const value = getPropertyFromItem(item, props.itemValue, title)\n const children = getPropertyFromItem(item, props.itemChildren)\n const itemProps = props.itemProps === true\n ? typeof item === 'object' && item != null && !Array.isArray(item)\n ? 'children' in item\n ? pick(item, ['children'])[1]\n : item\n : undefined\n : getPropertyFromItem(item, props.itemProps)\n\n const _props = {\n title,\n value,\n ...itemProps,\n }\n\n return {\n title: String(_props.title ?? ''),\n value: _props.value,\n props: _props,\n children: Array.isArray(children) ? transformItems(props, children) : undefined,\n raw: item,\n }\n}\n\nexport function transformItems (props: Omit<ItemProps, 'items'>, items: ItemProps['items']) {\n const array: InternalItem[] = []\n\n for (const item of items) {\n array.push(transformItem(props, item))\n }\n\n return array\n}\n\nexport function useItems (props: ItemProps) {\n const items = computed(() => transformItems(props, props.items))\n\n function transformIn (value: any[]): InternalItem[] {\n return value.map(item => transformItem(props, item))\n }\n\n function transformOut (value: InternalItem[]) {\n if (props.returnObject) return value.map(({ raw: item }) => item)\n return value.map(({ props }) => props.value)\n }\n\n return { items, transformIn, transformOut }\n}\n"],"mappings":"AAAA;AACA,SAASA,QAAT,QAAyB,KAAzB;SACSC,mB,EAAqBC,I,EAAMC,Y,6BAEpC;;AAyBA;AACA,OAAO,MAAMC,cAAc,GAAGD,YAAY,CAAC;EACzCE,KAAK,EAAE;IACLC,IAAI,EAAEC,KADD;IAELC,OAAO,EAAE,MAAO;EAFX,CADkC;EAKzCC,SAAS,EAAE;IACTH,IAAI,EAAE,CAACI,MAAD,EAASH,KAAT,EAAgBI,QAAhB,CADG;IAETH,OAAO,EAAE;EAFA,CAL8B;EASzCI,SAAS,EAAE;IACTN,IAAI,EAAE,CAACI,MAAD,EAASH,KAAT,EAAgBI,QAAhB,CADG;IAETH,OAAO,EAAE;EAFA,CAT8B;EAazCK,YAAY,EAAE;IACZP,IAAI,EAAE,CAACQ,OAAD,EAAUJ,MAAV,EAAkBH,KAAlB,EAAyBI,QAAzB,CADM;IAEZH,OAAO,EAAE;EAFG,CAb2B;EAiBzCO,SAAS,EAAE;IACTT,IAAI,EAAE,CAACQ,OAAD,EAAUJ,MAAV,EAAkBH,KAAlB,EAAyBI,QAAzB,CADG;IAETH,OAAO,EAAE;EA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;EAEA,KAAK,MAAMT,IAAX,IAAmBd,KAAnB,EAA0B;IACxBuB,KAAK,CAACC,IAAN,CAAWZ,aAAa,CAACC,KAAD,EAAQC,IAAR,CAAxB;EACD;;EAED,OAAOS,KAAP;AACD;AAED,OAAO,SAASE,QAAT,CAAmBZ,KAAnB,EAAqC;EAC1C,MAAMb,KAAK,GAAGL,QAAQ,CAAC,MAAM0B,cAAc,CAACR,KAAD,EAAQA,KAAK,CAACb,KAAd,CAArB,CAAtB;;EAEA,SAAS0B,WAAT,CAAsBV,KAAtB,EAAoD;IAClD,OAAOA,KAAK,CAACW,GAAN,CAAUb,IAAI,IAAIF,aAAa,CAACC,KAAD,EAAQC,IAAR,CAA/B,CAAP;EACD;;EAED,SAASc,YAAT,CAAuBZ,KAAvB,EAA8C;IAC5C,IAAIH,KAAK,CAACF,YAAV,EAAwB,OAAOK,KAAK,CAACW,GAAN,CAAU;MAAA,IAAC;QAAEL,GAAG,EAAER;MAAP,CAAD;MAAA,OAAmBA,IAAnB;IAAA,CAAV,CAAP;IACxB,OAAOE,KAAK,CAACW,GAAN,CAAU;MAAA,IAAC;QAAEd;MAAF,CAAD;MAAA,OAAeA,KAAK,CAACG,KAArB;IAAA,CAAV,CAAP;EACD;;EAED,OAAO;IAAEhB,KAAF;IAAS0B,WAAT;IAAsBE;EAAtB,CAAP;AACD"}
|
|
@@ -25,9 +25,16 @@ function isLocaleAdapter(x) {
|
|
|
25
25
|
|
|
26
26
|
export function createLocale(app, options) {
|
|
27
27
|
const adapter = isLocaleAdapter(options) ? options : createDefaultLocaleAdapter(options);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
|
|
29
|
+
function install(app) {
|
|
30
|
+
const instance = adapter.createRoot(app);
|
|
31
|
+
app.provide(RtlSymbol, createRtl(instance, options));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
adapter,
|
|
36
|
+
install
|
|
37
|
+
};
|
|
31
38
|
}
|
|
32
39
|
const LANG_PREFIX = '$vuetify.';
|
|
33
40
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale.mjs","names":["en","createRtl","RtlSymbol","computed","inject","provide","ref","consoleError","consoleWarn","getObjectValueByPath","LocaleAdapterSymbol","Symbol","for","VuetifyLocaleSymbol","provideLocale","props","adapter","Error","createScope","useLocale","getScope","isLocaleAdapter","x","hasOwnProperty","createLocale","app","options","createDefaultLocaleAdapter","instance","createRoot","LANG_PREFIX","replace","str","params","match","index","String","createTranslateFunction","current","fallback","messages","key","startsWith","shortKey","currentLocale","value","fallbackLocale","createNumberFunction","numberFormat","Intl","NumberFormat","format","t","n","rootScope","defaultLocale","currentScope","newScope","locale"],"sources":["../../src/composables/locale.ts"],"sourcesContent":["// Locales\nimport en from '@/locale/en'\n\n// Composables\nimport { createRtl, RtlSymbol } from '@/composables/rtl'\n\n// Utilities\nimport { computed, inject, provide, ref } from 'vue'\nimport { consoleError, consoleWarn, getObjectValueByPath } from '@/util'\n\n// Types\nimport type { RtlOptions } from '@/composables/rtl'\nimport type { App, InjectionKey, Ref } from 'vue'\nimport type { MaybeRef } from '@/util'\n\nexport interface LocaleMessages {\n [key: string]: LocaleMessages | string\n}\n\nexport interface LocaleOptions {\n defaultLocale?: string\n fallbackLocale?: string\n messages?: LocaleMessages\n}\n\nexport interface LocaleProps {\n locale?: string\n fallbackLocale?: string\n messages?: LocaleMessages\n}\n\nexport interface LocaleInstance {\n current: Ref<string>\n fallback: Ref<string>\n messages: Ref<LocaleMessages>\n t: (key: string, ...params: unknown[]) => string\n n: (value: number) => string\n}\n\nexport interface LocaleAdapter {\n createRoot: (app?: App) => LocaleInstance\n getScope: () => LocaleInstance\n createScope: (options?: LocaleProps) => LocaleInstance\n}\n\nexport const LocaleAdapterSymbol: InjectionKey<LocaleAdapter> = Symbol.for('vuetify:locale-adapter')\nexport const VuetifyLocaleSymbol: InjectionKey<LocaleInstance> = Symbol.for('vuetify:locale')\n\nexport function provideLocale (props?: LocaleProps) {\n const adapter = inject(LocaleAdapterSymbol)\n\n if (!adapter) throw new Error('[Vuetify] Could not find injected locale adapter')\n\n return adapter.createScope(props)\n}\n\nexport function useLocale () {\n const adapter = inject(LocaleAdapterSymbol)\n\n if (!adapter) throw new Error('[Vuetify] Could not find injected locale adapter')\n\n return adapter.getScope()\n}\n\nfunction isLocaleAdapter (x: any): x is LocaleAdapter {\n return !!x && x.hasOwnProperty('getScope') && x.hasOwnProperty('createScope') && x.hasOwnProperty('createRoot')\n}\n\nexport function createLocale (\n app: App,\n options?: (LocaleOptions & RtlOptions) | (LocaleAdapter & RtlOptions),\n) {\n const adapter = isLocaleAdapter(options) ? options : createDefaultLocaleAdapter(options)\n const instance = adapter.createRoot(app)\n\n app?.provide(RtlSymbol, createRtl(instance, options))\n\n return adapter\n}\n\nconst LANG_PREFIX = '$vuetify.'\n\nconst replace = (str: string, params: unknown[]) => {\n return str.replace(/\\{(\\d+)\\}/g, (match: string, index: string) => {\n /* istanbul ignore next */\n return String(params[+index])\n })\n}\n\nconst createTranslateFunction = (\n current: Ref<string>,\n fallback: Ref<string>,\n messages: Ref<LocaleMessages>,\n) => {\n return (key: string, ...params: unknown[]) => {\n if (!key.startsWith(LANG_PREFIX)) {\n return replace(key, params)\n }\n\n const shortKey = key.replace(LANG_PREFIX, '')\n const currentLocale = current.value && messages.value[current.value]\n const fallbackLocale = fallback.value && messages.value[fallback.value]\n\n let str: string = getObjectValueByPath(currentLocale, shortKey, null)\n\n if (!str) {\n consoleWarn(`Translation key \"${key}\" not found in \"${current.value}\", trying fallback locale`)\n str = getObjectValueByPath(fallbackLocale, shortKey, null)\n }\n\n if (!str) {\n consoleError(`Translation key \"${key}\" not found in fallback`)\n str = key\n }\n\n if (typeof str !== 'string') {\n consoleError(`Translation key \"${key}\" has a non-string value`)\n str = key\n }\n\n return replace(str, params)\n }\n}\n\nfunction createNumberFunction (current: Ref<string>, fallback: Ref<string>) {\n return (value: number, options?: Intl.NumberFormatOptions) => {\n const numberFormat = new Intl.NumberFormat([current.value, fallback.value], options)\n\n return numberFormat.format(value)\n }\n}\n\nexport function createDefaultLocaleAdapter (options?: LocaleOptions): LocaleAdapter {\n const createScope = (options: {\n current: MaybeRef<string>\n fallback: MaybeRef<string>\n messages: MaybeRef<LocaleMessages>\n }) => {\n const current = ref(options.current)\n const fallback = ref(options.fallback)\n const messages = ref(options.messages)\n\n return {\n current,\n fallback,\n messages,\n t: createTranslateFunction(current, fallback, messages),\n n: createNumberFunction(current, fallback),\n }\n }\n\n return {\n createRoot: app => {\n const rootScope = createScope({\n current: options?.defaultLocale ?? 'en',\n fallback: options?.fallbackLocale ?? 'en',\n messages: options?.messages ?? { en },\n })\n\n if (!app) throw new Error('[Vuetify] Could not find default app instance')\n\n app.provide(VuetifyLocaleSymbol, rootScope)\n\n return rootScope\n },\n getScope: () => {\n const currentScope = inject(VuetifyLocaleSymbol)\n\n if (!currentScope) throw new Error('[Vuetify] Could not find injected locale instance')\n\n return currentScope\n },\n createScope: options => {\n const currentScope = inject(VuetifyLocaleSymbol)\n\n if (!currentScope) throw new Error('[Vuetify] Could not find injected locale instance')\n\n const newScope = createScope({\n current: computed(() => options?.locale ?? currentScope.current.value),\n fallback: computed(() => options?.locale ?? currentScope.fallback.value),\n messages: computed(() => options?.messages ?? currentScope.messages.value),\n })\n\n provide(VuetifyLocaleSymbol, newScope)\n\n return newScope\n },\n }\n}\n"],"mappings":"AAAA;OACOA,E,0BAEP;;SACSC,S,EAAWC,S,qBAEpB;;AACA,SAASC,QAAT,EAAmBC,MAAnB,EAA2BC,OAA3B,EAAoCC,GAApC,QAA+C,KAA/C;SACSC,Y,EAAcC,W,EAAaC,oB,6BAEpC;;AAmCA,OAAO,MAAMC,mBAAgD,GAAGC,MAAM,CAACC,GAAP,CAAW,wBAAX,CAAzD;AACP,OAAO,MAAMC,mBAAiD,GAAGF,MAAM,CAACC,GAAP,CAAW,gBAAX,CAA1D;AAEP,OAAO,SAASE,aAAT,CAAwBC,K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iCyC,SAAjC;MAEA,OAAOA,SAAP;IACD,CAbI;IAcLlC,QAAQ,EAAE,MAAM;MACd,MAAMoC,YAAY,GAAGpD,MAAM,CAACS,mBAAD,CAA3B;MAEA,IAAI,CAAC2C,YAAL,EAAmB,MAAM,IAAIvC,KAAJ,CAAU,mDAAV,CAAN;MAEnB,OAAOuC,YAAP;IACD,CApBI;IAqBLtC,WAAW,EAAEQ,OAAO,IAAI;MACtB,MAAM8B,YAAY,GAAGpD,MAAM,CAACS,mBAAD,CAA3B;MAEA,IAAI,CAAC2C,YAAL,EAAmB,MAAM,IAAIvC,KAAJ,CAAU,mDAAV,CAAN;MAEnB,MAAMwC,QAAQ,GAAGvC,WAAW,CAAC;QAC3BoB,OAAO,EAAEnC,QAAQ,CAAC,MAAM,CAAAuB,OAAO,QAAP,YAAAA,OAAO,CAAEgC,MAAT,KAAmBF,YAAY,CAAClB,OAAb,CAAqBO,KAA/C,CADU;QAE3BN,QAAQ,EAAEpC,QAAQ,CAAC,MAAM,CAAAuB,OAAO,QAAP,YAAAA,OAAO,CAAEgC,MAAT,KAAmBF,YAAY,CAACjB,QAAb,CAAsBM,KAAhD,CAFS;QAG3BL,QAAQ,EAAErC,QAAQ,CAAC,MAAM,CAAAuB,OAAO,QAAP,YAAAA,OAAO,CAAEc,QAAT,KAAqBgB,YAAY,CAAChB,QAAb,CAAsBK,KAAlD;MAHS,CAAD,CAA5B;MAMAxC,OAAO,CAACQ,mBAAD,EAAsB4C,QAAtB,CAAP;MAEA,OAAOA,QAAP;IACD;EAnCI,CAAP;AAqCD"}
|
|
1
|
+
{"version":3,"file":"locale.mjs","names":["en","createRtl","RtlSymbol","computed","inject","provide","ref","consoleError","consoleWarn","getObjectValueByPath","LocaleAdapterSymbol","Symbol","for","VuetifyLocaleSymbol","provideLocale","props","adapter","Error","createScope","useLocale","getScope","isLocaleAdapter","x","hasOwnProperty","createLocale","app","options","createDefaultLocaleAdapter","install","instance","createRoot","LANG_PREFIX","replace","str","params","match","index","String","createTranslateFunction","current","fallback","messages","key","startsWith","shortKey","currentLocale","value","fallbackLocale","createNumberFunction","numberFormat","Intl","NumberFormat","format","t","n","rootScope","defaultLocale","currentScope","newScope","locale"],"sources":["../../src/composables/locale.ts"],"sourcesContent":["// Locales\nimport en from '@/locale/en'\n\n// Composables\nimport { createRtl, RtlSymbol } from '@/composables/rtl'\n\n// Utilities\nimport { computed, inject, provide, ref } from 'vue'\nimport { consoleError, consoleWarn, getObjectValueByPath } from '@/util'\n\n// Types\nimport type { RtlOptions } from '@/composables/rtl'\nimport type { App, InjectionKey, Ref } from 'vue'\nimport type { MaybeRef } from '@/util'\n\nexport interface LocaleMessages {\n [key: string]: LocaleMessages | string\n}\n\nexport interface LocaleOptions {\n defaultLocale?: string\n fallbackLocale?: string\n messages?: LocaleMessages\n}\n\nexport interface LocaleProps {\n locale?: string\n fallbackLocale?: string\n messages?: LocaleMessages\n}\n\nexport interface LocaleInstance {\n current: Ref<string>\n fallback: Ref<string>\n messages: Ref<LocaleMessages>\n t: (key: string, ...params: unknown[]) => string\n n: (value: number) => string\n}\n\nexport interface LocaleAdapter {\n createRoot: (app?: App) => LocaleInstance\n getScope: () => LocaleInstance\n createScope: (options?: LocaleProps) => LocaleInstance\n}\n\nexport const LocaleAdapterSymbol: InjectionKey<LocaleAdapter> = Symbol.for('vuetify:locale-adapter')\nexport const VuetifyLocaleSymbol: InjectionKey<LocaleInstance> = Symbol.for('vuetify:locale')\n\nexport function provideLocale (props?: LocaleProps) {\n const adapter = inject(LocaleAdapterSymbol)\n\n if (!adapter) throw new Error('[Vuetify] Could not find injected locale adapter')\n\n return adapter.createScope(props)\n}\n\nexport function useLocale () {\n const adapter = inject(LocaleAdapterSymbol)\n\n if (!adapter) throw new Error('[Vuetify] Could not find injected locale adapter')\n\n return adapter.getScope()\n}\n\nfunction isLocaleAdapter (x: any): x is LocaleAdapter {\n return !!x && x.hasOwnProperty('getScope') && x.hasOwnProperty('createScope') && x.hasOwnProperty('createRoot')\n}\n\nexport function createLocale (\n app: App,\n options?: (LocaleOptions & RtlOptions) | (LocaleAdapter & RtlOptions),\n) {\n const adapter = isLocaleAdapter(options) ? options : createDefaultLocaleAdapter(options)\n\n function install (app: App) {\n const instance = adapter.createRoot(app)\n app.provide(RtlSymbol, createRtl(instance, options))\n }\n\n return { adapter, install }\n}\n\nconst LANG_PREFIX = '$vuetify.'\n\nconst replace = (str: string, params: unknown[]) => {\n return str.replace(/\\{(\\d+)\\}/g, (match: string, index: string) => {\n /* istanbul ignore next */\n return String(params[+index])\n })\n}\n\nconst createTranslateFunction = (\n current: Ref<string>,\n fallback: Ref<string>,\n messages: Ref<LocaleMessages>,\n) => {\n return (key: string, ...params: unknown[]) => {\n if (!key.startsWith(LANG_PREFIX)) {\n return replace(key, params)\n }\n\n const shortKey = key.replace(LANG_PREFIX, '')\n const currentLocale = current.value && messages.value[current.value]\n const fallbackLocale = fallback.value && messages.value[fallback.value]\n\n let str: string = getObjectValueByPath(currentLocale, shortKey, null)\n\n if (!str) {\n consoleWarn(`Translation key \"${key}\" not found in \"${current.value}\", trying fallback locale`)\n str = getObjectValueByPath(fallbackLocale, shortKey, null)\n }\n\n if (!str) {\n consoleError(`Translation key \"${key}\" not found in fallback`)\n str = key\n }\n\n if (typeof str !== 'string') {\n consoleError(`Translation key \"${key}\" has a non-string value`)\n str = key\n }\n\n return replace(str, params)\n }\n}\n\nfunction createNumberFunction (current: Ref<string>, fallback: Ref<string>) {\n return (value: number, options?: Intl.NumberFormatOptions) => {\n const numberFormat = new Intl.NumberFormat([current.value, fallback.value], options)\n\n return numberFormat.format(value)\n }\n}\n\nexport function createDefaultLocaleAdapter (options?: LocaleOptions): LocaleAdapter {\n const createScope = (options: {\n current: MaybeRef<string>\n fallback: MaybeRef<string>\n messages: MaybeRef<LocaleMessages>\n }) => {\n const current = ref(options.current)\n const fallback = ref(options.fallback)\n const messages = ref(options.messages)\n\n return {\n current,\n fallback,\n messages,\n t: createTranslateFunction(current, fallback, messages),\n n: createNumberFunction(current, fallback),\n }\n }\n\n return {\n createRoot: app => {\n const rootScope = createScope({\n current: options?.defaultLocale ?? 'en',\n fallback: options?.fallbackLocale ?? 'en',\n messages: options?.messages ?? { en },\n })\n\n if (!app) throw new Error('[Vuetify] Could not find default app instance')\n\n app.provide(VuetifyLocaleSymbol, rootScope)\n\n return rootScope\n },\n getScope: () => {\n const currentScope = inject(VuetifyLocaleSymbol)\n\n if (!currentScope) throw new Error('[Vuetify] Could not find injected locale instance')\n\n return currentScope\n },\n createScope: options => {\n const currentScope = inject(VuetifyLocaleSymbol)\n\n if (!currentScope) throw new Error('[Vuetify] Could not find injected locale instance')\n\n const newScope = createScope({\n current: computed(() => options?.locale ?? currentScope.current.value),\n fallback: computed(() => options?.locale ?? currentScope.fallback.value),\n messages: computed(() => options?.messages ?? currentScope.messages.value),\n })\n\n provide(VuetifyLocaleSymbol, newScope)\n\n return newScope\n },\n }\n}\n"],"mappings":"AAAA;OACOA,E,0BAEP;;SACSC,S,EAAWC,S,qBAEpB;;AACA,SAASC,QAAT,EAAmBC,MAAnB,EAA2BC,OAA3B,EAAoCC,GAApC,QAA+C,KAA/C;SACSC,Y,EAAcC,W,EAAaC,oB,6BAEpC;;AAmCA,OAAO,MAAMC,mBAAgD,GAAGC,MAAM,CAACC,GAAP,CAAW,wBAAX,CAAzD;AACP,OAAO,MAAMC,mBAAiD,GAAGF,MAAM,CAACC,GAAP,CAAW,gBAAX,CAA1D;AAEP,OAAO,SAASE,aAAT,CAAwBC,KAAxB,EAA6C;EAClD,MAAMC,OAAO,GAAGZ,MAAM,CAACM,mBAAD,CAAtB;EAEA,IAAI,CAACM,OAAL,EAAc,MAAM,IAAIC,KAAJ,CAAU,kDAAV,CAAN;EAEd,OAAOD,OAAO,CAACE,WAAR,CAAoBH,KAApB,CAAP;AACD;AAED,OAAO,SAASI,SAAT,GAAsB;EAC3B,MAAMH,OAAO,GAAGZ,MAAM,CAACM,mBAAD,CAAtB;EAEA,IAAI,CAACM,OA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