yuyeon 0.3.1-rc.4 → 0.3.1-rc.5
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/LICENSE +191 -191
- package/README.md +15 -15
- package/dist/yuyeon.js +1751 -1687
- package/dist/yuyeon.umd.cjs +3 -3
- package/lib/abstract/items.mjs.map +1 -1
- package/lib/components/alert/YAlert.mjs +2 -2
- package/lib/components/alert/YAlert.mjs.map +1 -1
- package/lib/components/alert/YAlert.scss +77 -77
- package/lib/components/app/YApp.mjs +2 -2
- package/lib/components/app/YApp.mjs.map +1 -1
- package/lib/components/bench/YBench.mjs +2 -2
- package/lib/components/bench/YBench.mjs.map +1 -1
- package/lib/components/button/YButton.scss +137 -137
- package/lib/components/card/YCard.mjs.map +1 -1
- package/lib/components/card/YCard.scss +45 -45
- package/lib/components/card/YCardBody.mjs.map +1 -1
- package/lib/components/card/YCardFooter.mjs.map +1 -1
- package/lib/components/card/YCardHeader.mjs.map +1 -1
- package/lib/components/checkbox/YCheckbox.mjs.map +1 -1
- package/lib/components/checkbox/YInputCheckbox.mjs.map +1 -1
- package/lib/components/checkbox/YInputCheckbox.scss +84 -84
- package/lib/components/checkbox/index.mjs.map +1 -1
- package/lib/components/chip/YChip.scss +36 -36
- package/lib/components/date-picker/YDateCalendar.mjs.map +1 -1
- package/lib/components/date-picker/YDateCalendar.scss +84 -84
- package/lib/components/date-picker/YDatePicker.mjs.map +1 -1
- package/lib/components/date-picker/YDatePickerControl.mjs.map +1 -1
- package/lib/components/date-picker/YMonthPicker.mjs.map +1 -1
- package/lib/components/date-picker/YYearPicker.mjs.map +1 -1
- package/lib/components/dialog/index.mjs.map +1 -1
- package/lib/components/divider/YDivider.mjs.map +1 -1
- package/lib/components/divider/YDivider.scss +2 -2
- package/lib/components/draggable/YDraggable.mjs +2 -2
- package/lib/components/draggable/YDraggable.mjs.map +1 -1
- package/lib/components/dropdown/YDropdown.mjs.map +1 -1
- package/lib/components/dropdown/YDropdown.scss +27 -27
- package/lib/components/field-input/index.mjs.map +1 -1
- package/lib/components/form/YForm.mjs.map +1 -1
- package/lib/components/hover/YHover.mjs +1 -1
- package/lib/components/hover/YHover.mjs.map +1 -1
- package/lib/components/icon/YIcon.mjs.map +1 -1
- package/lib/components/icon/YIcon.scss +18 -18
- package/lib/components/icon/poly.mjs +57 -0
- package/lib/components/icon/poly.mjs.map +1 -0
- package/lib/components/icons/YIconCheckbox.mjs.map +1 -1
- package/lib/components/icons/YIconClear.mjs.map +1 -1
- package/lib/components/icons/YIconDropdown.mjs.map +1 -1
- package/lib/components/icons/YIconExpand.mjs.map +1 -1
- package/lib/components/icons/YIconPageControl.mjs.map +1 -1
- package/lib/components/icons/YIconSort.mjs.map +1 -1
- package/lib/components/icons/YIconSort.scss +24 -24
- package/lib/components/icons/index.mjs.map +1 -1
- package/lib/components/img/YImg.mjs +4 -4
- package/lib/components/img/YImg.mjs.map +1 -1
- package/lib/components/index.mjs.map +1 -1
- package/lib/components/input/YInput.mjs.map +1 -1
- package/lib/components/input/YInput.scss +258 -258
- package/lib/components/ip-field/YIpv4Field.mjs.map +1 -1
- package/lib/components/layer/YLayer.mjs.map +1 -1
- package/lib/components/layer/active-stack.mjs.map +1 -1
- package/lib/components/layer/base.mjs.map +1 -1
- package/lib/components/layer/content.mjs.map +1 -1
- package/lib/components/layer/scroll-strategies.mjs.map +1 -1
- package/lib/components/list/YList.mjs.map +1 -1
- package/lib/components/list/YListItem.mjs.map +1 -1
- package/lib/components/loading/YSpinnerRing.mjs.map +1 -1
- package/lib/components/menu/YMenu.mjs +2 -2
- package/lib/components/menu/YMenu.mjs.map +1 -1
- package/lib/components/menu/YMenu.scss +25 -25
- package/lib/components/navigation/YNavigation.mjs.map +1 -1
- package/lib/components/pagination/YPagination.mjs.map +1 -1
- package/lib/components/pagination/YPagination.scss +52 -52
- package/lib/components/panel/YDividePanel.mjs.map +1 -1
- package/lib/components/plate/YPlate.mjs +2 -2
- package/lib/components/plate/YPlate.mjs.map +1 -1
- package/lib/components/progress-bar/YProgressBar.mjs.map +1 -1
- package/lib/components/progress-bar/YProgressBar.scss +120 -120
- package/lib/components/progress-ring/YProgressRing.mjs +2 -2
- package/lib/components/progress-ring/YProgressRing.mjs.map +1 -1
- package/lib/components/progress-ring/YProgressRing.scss +38 -38
- package/lib/components/progress-ring/index.mjs.map +1 -1
- package/lib/components/select/YSelect.mjs.map +1 -1
- package/lib/components/slider/YSlider.mjs.map +1 -1
- package/lib/components/snackbar/YSnackbar.mjs +5 -5
- package/lib/components/snackbar/YSnackbar.mjs.map +1 -1
- package/lib/components/switch/YSwitch.mjs.map +1 -1
- package/lib/components/switch/YSwitch.scss +211 -211
- package/lib/components/tab/YTab.mjs.map +1 -1
- package/lib/components/tab/YTab.scss +73 -73
- package/lib/components/tab/YTabs.mjs.map +1 -1
- package/lib/components/tab/YTabs.scss +8 -8
- package/lib/components/tab/index.mjs.map +1 -1
- package/lib/components/tab/types.mjs.map +1 -1
- package/lib/components/table/YDataTableBody.mjs.map +1 -1
- package/lib/components/table/YDataTableCell.mjs.map +1 -1
- package/lib/components/table/YDataTableHead.mjs.map +1 -1
- package/lib/components/table/YDataTableLayer.mjs.map +1 -1
- package/lib/components/table/YDataTableRow.mjs.map +1 -1
- package/lib/components/table/YTable.mjs.map +1 -1
- package/lib/components/table/YTable.scss +157 -157
- package/lib/components/table/composibles/header.mjs.map +1 -1
- package/lib/components/table/composibles/items.mjs.map +1 -1
- package/lib/components/table/composibles/options.mjs.map +1 -1
- package/lib/components/table/composibles/pagination.mjs.map +1 -1
- package/lib/components/table/composibles/selection.mjs.map +1 -1
- package/lib/components/table/composibles/sorted-items.mjs.map +1 -1
- package/lib/components/table/composibles/sorting.mjs.map +1 -1
- package/lib/components/table/types/header.mjs.map +1 -1
- package/lib/components/table/types/index.mjs.map +1 -1
- package/lib/components/table/types/row.mjs.map +1 -1
- package/lib/components/text-ellipsis/YTextEllipsis.mjs.map +1 -1
- package/lib/components/text-ellipsis/YTextEllipsis.scss +43 -43
- package/lib/components/text-highlighter/YTextHighlighter.mjs.map +1 -1
- package/lib/components/text-interpolation/YTi.mjs.map +1 -1
- package/lib/components/textarea/YTextarea.mjs.map +1 -1
- package/lib/components/toggle-button/YToggleButton.mjs.map +1 -1
- package/lib/components/tooltip/YTooltip.mjs +2 -2
- package/lib/components/tooltip/YTooltip.mjs.map +1 -1
- package/lib/components/tree-view/YTreeView.scss +81 -81
- package/lib/components/tree-view/types.mjs.map +1 -1
- package/lib/components/tree-view/util.mjs.map +1 -1
- package/lib/composables/choice.mjs.map +1 -1
- package/lib/composables/communication.mjs.map +1 -1
- package/lib/composables/component.mjs.map +1 -1
- package/lib/composables/coordinate/arrangement.mjs.map +1 -1
- package/lib/composables/coordinate/index.mjs.map +1 -1
- package/lib/composables/coordinate/levitation.mjs +2 -2
- package/lib/composables/coordinate/levitation.mjs.map +1 -1
- package/lib/composables/coordinate/types.mjs.map +1 -1
- package/lib/composables/coordinate/utils/point.mjs.map +1 -1
- package/lib/composables/date/factory.mjs.map +1 -1
- package/lib/composables/date/index.mjs.map +1 -1
- package/lib/composables/date/setting.mjs.map +1 -1
- package/lib/composables/date/types.mjs.map +1 -1
- package/lib/composables/defaults/index.mjs.map +1 -1
- package/lib/composables/defaults/share.mjs.map +1 -1
- package/lib/composables/defaults/types.mjs.map +1 -1
- package/lib/composables/dimension.mjs.map +1 -1
- package/lib/composables/focus.mjs.map +1 -1
- package/lib/composables/form.mjs.map +1 -1
- package/lib/composables/group.mjs +194 -0
- package/lib/composables/group.mjs.map +1 -0
- package/lib/composables/i18n/index.mjs.map +1 -1
- package/lib/composables/i18n/locale.mjs.map +1 -1
- package/lib/composables/i18n/rtl.mjs.map +1 -1
- package/lib/composables/i18n/share.mjs.map +1 -1
- package/lib/composables/icon.mjs.map +1 -1
- package/lib/composables/index.mjs.map +1 -1
- package/lib/composables/layer-group.mjs.map +1 -1
- package/lib/composables/layout.mjs.map +1 -1
- package/lib/composables/list-items.mjs.map +1 -1
- package/lib/composables/progress.mjs.map +1 -1
- package/lib/composables/ref.mjs.map +1 -1
- package/lib/composables/resize-observer.mjs.map +1 -1
- package/lib/composables/scope.mjs.map +1 -1
- package/lib/composables/theme/factory.mjs.map +1 -1
- package/lib/composables/theme/index.mjs.map +1 -1
- package/lib/composables/theme/setting.mjs.map +1 -1
- package/lib/composables/theme/types.mjs.map +1 -1
- package/lib/composables/timing.mjs.map +1 -1
- package/lib/composables/transition.mjs.map +1 -1
- package/lib/composables/validation.mjs.map +1 -1
- package/lib/composables/vue-router.mjs.map +1 -1
- package/lib/directives/plate-wave/index.mjs +2 -2
- package/lib/directives/plate-wave/index.mjs.map +1 -1
- package/lib/etc/index.mjs.map +1 -1
- package/lib/i18n/built-in.mjs.map +1 -1
- package/lib/i18n/config.mjs.map +1 -1
- package/lib/i18n/types.mjs.map +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/locales/en.mjs.map +1 -1
- package/lib/locales/index.mjs.map +1 -1
- package/lib/locales/ko.mjs.map +1 -1
- package/lib/styles/_elevation.scss +16 -16
- package/lib/styles/_palette.scss +1 -1
- package/lib/styles/base.scss +130 -130
- package/lib/styles/settings/_elevation.scss +20 -20
- package/lib/styles/settings/_variables.scss +14 -14
- package/lib/styles/theme/dark.scss +11 -11
- package/lib/styles/theme/light.scss +11 -11
- package/lib/styles/util/_mixin.scss +33 -33
- package/lib/styles/util/_var.scss +18 -18
- package/lib/util/anchor.mjs.map +1 -1
- package/lib/util/collection.mjs.map +1 -1
- package/lib/util/color/const.mjs.map +1 -1
- package/lib/util/color/index.mjs +12 -12
- package/lib/util/color/index.mjs.map +1 -1
- package/lib/util/color/types.mjs.map +1 -1
- package/lib/util/color/utils/math-utils.mjs +62 -62
- package/lib/util/color/utils/math-utils.mjs.map +1 -1
- package/lib/util/component/component.mjs.map +1 -1
- package/lib/util/component/index.mjs.map +1 -1
- package/lib/util/component/inject-self.mjs.map +1 -1
- package/lib/util/component/props.mjs.map +1 -1
- package/lib/util/component/types.mjs.map +1 -1
- package/lib/util/date/index.mjs.map +1 -1
- package/lib/util/date/types.mjs.map +1 -1
- package/lib/util/debounce.mjs.map +1 -1
- package/lib/util/environments.mjs.map +1 -1
- package/lib/util/index.mjs.map +1 -1
- package/lib/util/parser.mjs +31 -0
- package/lib/util/parser.mjs.map +1 -0
- package/lib/util/reactivity.mjs +3 -3
- package/lib/util/reactivity.mjs.map +1 -1
- package/lib/util/rect.mjs.map +1 -1
- package/lib/util/validation.mjs.map +1 -1
- package/lib/util/vue-component/index.mjs +63 -0
- package/lib/util/vue-component/index.mjs.map +1 -0
- package/lib/util/vue-component/props.mjs +37 -0
- package/lib/util/vue-component/props.mjs.map +1 -0
- package/lib/util/vue-component/types.mjs +2 -0
- package/lib/util/vue-component/types.mjs.map +1 -0
- package/lib/util/vue-component.mjs +102 -0
- package/lib/util/vue-component.mjs.map +1 -0
- package/package.json +120 -120
- package/types/components/select/YSelect.d.ts +7062 -0
- package/types/components/table/pagination.d.ts +78 -0
- package/types/components/tooltip/YTooltip.d.ts +3711 -0
- package/types/globals.d.ts +20 -20
- package/types/shims.d.ts +55 -55
- package/types/util/color/hct/hct_solver.d.ts +146 -0
- package/types/util/color/hct/viewing_conditions.d.ts +74 -0
- package/types/util/color/palettes/tonal_palette.d.ts +55 -0
- package/types/util/color/utils/math_utils.d.ts +82 -0
- package/types/util/parser.d.ts +4 -0
- package/types/util/vue-component/index.d.ts +10 -0
- package/types/util/vue-component/props.d.ts +31 -0
- package/types/util/vue-component/types.d.ts +4 -0
- package/types/util/vue-component.d.ts +39 -0
- /package/types/util/{rect.d.ts → Rect.d.ts} +0 -0
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2021 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* Utility methods for mathematical operations.
|
|
18
|
+
/**
|
|
19
|
+
* Utility methods for mathematical operations.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* The signum function.
|
|
24
|
-
*
|
|
25
|
-
* @return 1 if num > 0, -1 if num < 0, and 0 if num = 0
|
|
22
|
+
/**
|
|
23
|
+
* The signum function.
|
|
24
|
+
*
|
|
25
|
+
* @return 1 if num > 0, -1 if num < 0, and 0 if num = 0
|
|
26
26
|
*/
|
|
27
27
|
export function signum(num) {
|
|
28
28
|
if (num < 0) {
|
|
@@ -34,20 +34,20 @@ export function signum(num) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
/**
|
|
38
|
-
* The linear interpolation function.
|
|
39
|
-
*
|
|
40
|
-
* @return start if amount = 0 and stop if amount = 1
|
|
37
|
+
/**
|
|
38
|
+
* The linear interpolation function.
|
|
39
|
+
*
|
|
40
|
+
* @return start if amount = 0 and stop if amount = 1
|
|
41
41
|
*/
|
|
42
42
|
export function lerp(start, stop, amount) {
|
|
43
43
|
return (1.0 - amount) * start + amount * stop;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
/**
|
|
47
|
-
* Clamps an integer between two integers.
|
|
48
|
-
*
|
|
49
|
-
* @return input when min <= input <= max, and either min or max
|
|
50
|
-
* otherwise.
|
|
46
|
+
/**
|
|
47
|
+
* Clamps an integer between two integers.
|
|
48
|
+
*
|
|
49
|
+
* @return input when min <= input <= max, and either min or max
|
|
50
|
+
* otherwise.
|
|
51
51
|
*/
|
|
52
52
|
export function clampInt(min, max, input) {
|
|
53
53
|
if (input < min) {
|
|
@@ -58,11 +58,11 @@ export function clampInt(min, max, input) {
|
|
|
58
58
|
return input;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
/**
|
|
62
|
-
* Clamps an integer between two floating-point numbers.
|
|
63
|
-
*
|
|
64
|
-
* @return input when min <= input <= max, and either min or max
|
|
65
|
-
* otherwise.
|
|
61
|
+
/**
|
|
62
|
+
* Clamps an integer between two floating-point numbers.
|
|
63
|
+
*
|
|
64
|
+
* @return input when min <= input <= max, and either min or max
|
|
65
|
+
* otherwise.
|
|
66
66
|
*/
|
|
67
67
|
export function clampDouble(min, max, input) {
|
|
68
68
|
if (input < min) {
|
|
@@ -73,11 +73,11 @@ export function clampDouble(min, max, input) {
|
|
|
73
73
|
return input;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
/**
|
|
77
|
-
* Sanitizes a degree measure as an integer.
|
|
78
|
-
*
|
|
79
|
-
* @return a degree measure between 0 (inclusive) and 360
|
|
80
|
-
* (exclusive).
|
|
76
|
+
/**
|
|
77
|
+
* Sanitizes a degree measure as an integer.
|
|
78
|
+
*
|
|
79
|
+
* @return a degree measure between 0 (inclusive) and 360
|
|
80
|
+
* (exclusive).
|
|
81
81
|
*/
|
|
82
82
|
export function sanitizeDegreesInt(degrees) {
|
|
83
83
|
degrees = degrees % 360;
|
|
@@ -87,11 +87,11 @@ export function sanitizeDegreesInt(degrees) {
|
|
|
87
87
|
return degrees;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
/**
|
|
91
|
-
* Sanitizes a degree measure as a floating-point number.
|
|
92
|
-
*
|
|
93
|
-
* @return a degree measure between 0.0 (inclusive) and 360.0
|
|
94
|
-
* (exclusive).
|
|
90
|
+
/**
|
|
91
|
+
* Sanitizes a degree measure as a floating-point number.
|
|
92
|
+
*
|
|
93
|
+
* @return a degree measure between 0.0 (inclusive) and 360.0
|
|
94
|
+
* (exclusive).
|
|
95
95
|
*/
|
|
96
96
|
export function sanitizeDegreesDouble(degrees) {
|
|
97
97
|
degrees = degrees % 360.0;
|
|
@@ -101,34 +101,34 @@ export function sanitizeDegreesDouble(degrees) {
|
|
|
101
101
|
return degrees;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
/**
|
|
105
|
-
* Sign of direction change needed to travel from one angle to
|
|
106
|
-
* another.
|
|
107
|
-
*
|
|
108
|
-
* For angles that are 180 degrees apart from each other, both
|
|
109
|
-
* directions have the same travel distance, so either direction is
|
|
110
|
-
* shortest. The value 1.0 is returned in this case.
|
|
111
|
-
*
|
|
112
|
-
* @param from The angle travel starts from, in degrees.
|
|
113
|
-
* @param to The angle travel ends at, in degrees.
|
|
114
|
-
* @return -1 if decreasing from leads to the shortest travel
|
|
115
|
-
* distance, 1 if increasing from leads to the shortest travel
|
|
116
|
-
* distance.
|
|
104
|
+
/**
|
|
105
|
+
* Sign of direction change needed to travel from one angle to
|
|
106
|
+
* another.
|
|
107
|
+
*
|
|
108
|
+
* For angles that are 180 degrees apart from each other, both
|
|
109
|
+
* directions have the same travel distance, so either direction is
|
|
110
|
+
* shortest. The value 1.0 is returned in this case.
|
|
111
|
+
*
|
|
112
|
+
* @param from The angle travel starts from, in degrees.
|
|
113
|
+
* @param to The angle travel ends at, in degrees.
|
|
114
|
+
* @return -1 if decreasing from leads to the shortest travel
|
|
115
|
+
* distance, 1 if increasing from leads to the shortest travel
|
|
116
|
+
* distance.
|
|
117
117
|
*/
|
|
118
118
|
export function rotationDirection(from, to) {
|
|
119
119
|
const increasingDifference = sanitizeDegreesDouble(to - from);
|
|
120
120
|
return increasingDifference <= 180.0 ? 1.0 : -1.0;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
/**
|
|
124
|
-
* Distance of two points on a circle, represented using degrees.
|
|
123
|
+
/**
|
|
124
|
+
* Distance of two points on a circle, represented using degrees.
|
|
125
125
|
*/
|
|
126
126
|
export function differenceDegrees(a, b) {
|
|
127
127
|
return 180.0 - Math.abs(Math.abs(a - b) - 180.0);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
/**
|
|
131
|
-
* Multiplies a 1x3 row vector with a 3x3 matrix.
|
|
130
|
+
/**
|
|
131
|
+
* Multiplies a 1x3 row vector with a 3x3 matrix.
|
|
132
132
|
*/
|
|
133
133
|
export function matrixMultiply(row, matrix) {
|
|
134
134
|
const a = row[0] * matrix[0][0] + row[1] * matrix[0][1] + row[2] * matrix[0][2];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math-utils.mjs","names":["signum","num","lerp","start","stop","amount","clampInt","min","max","input","clampDouble","sanitizeDegreesInt","degrees","sanitizeDegreesDouble","rotationDirection","from","to","increasingDifference","differenceDegrees","a","b","Math","abs","matrixMultiply","row","matrix","c"],"sources":["../../../../src/util/color/utils/math-utils.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Utility methods for mathematical operations.\n */\n\n/**\n * The signum function.\n *\n * @return 1 if num > 0, -1 if num < 0, and 0 if num = 0\n */\nexport function signum(num: number): number {\n if (num < 0) {\n return -1;\n } else if (num === 0) {\n return 0;\n } else {\n return 1;\n }\n}\n\n/**\n * The linear interpolation function.\n *\n * @return start if amount = 0 and stop if amount = 1\n */\nexport function lerp(start: number, stop: number, amount: number): number {\n return (1.0 - amount) * start + amount * stop;\n}\n\n/**\n * Clamps an integer between two integers.\n *\n * @return input when min <= input <= max, and either min or max\n * otherwise.\n */\nexport function clampInt(min: number, max: number, input: number): number {\n if (input < min) {\n return min;\n } else if (input > max) {\n return max;\n }\n\n return input;\n}\n\n/**\n * Clamps an integer between two floating-point numbers.\n *\n * @return input when min <= input <= max, and either min or max\n * otherwise.\n */\nexport function clampDouble(min: number, max: number, input: number): number {\n if (input < min) {\n return min;\n } else if (input > max) {\n return max;\n }\n\n return input;\n}\n\n/**\n * Sanitizes a degree measure as an integer.\n *\n * @return a degree measure between 0 (inclusive) and 360\n * (exclusive).\n */\nexport function sanitizeDegreesInt(degrees: number): number {\n degrees = degrees % 360;\n if (degrees < 0) {\n degrees = degrees + 360;\n }\n return degrees;\n}\n\n/**\n * Sanitizes a degree measure as a floating-point number.\n *\n * @return a degree measure between 0.0 (inclusive) and 360.0\n * (exclusive).\n */\nexport function sanitizeDegreesDouble(degrees: number): number {\n degrees = degrees % 360.0;\n if (degrees < 0) {\n degrees = degrees + 360.0;\n }\n return degrees;\n}\n\n/**\n * Sign of direction change needed to travel from one angle to\n * another.\n *\n * For angles that are 180 degrees apart from each other, both\n * directions have the same travel distance, so either direction is\n * shortest. The value 1.0 is returned in this case.\n *\n * @param from The angle travel starts from, in degrees.\n * @param to The angle travel ends at, in degrees.\n * @return -1 if decreasing from leads to the shortest travel\n * distance, 1 if increasing from leads to the shortest travel\n * distance.\n */\nexport function rotationDirection(from: number, to: number): number {\n const increasingDifference = sanitizeDegreesDouble(to - from);\n return increasingDifference <= 180.0 ? 1.0 : -1.0;\n}\n\n/**\n * Distance of two points on a circle, represented using degrees.\n */\nexport function differenceDegrees(a: number, b: number): number {\n return 180.0 - Math.abs(Math.abs(a - b) - 180.0);\n}\n\n/**\n * Multiplies a 1x3 row vector with a 3x3 matrix.\n */\nexport function matrixMultiply(row: number[], matrix: number[][]): number[] {\n const a =\n row[0] * matrix[0][0] + row[1] * matrix[0][1] + row[2] * matrix[0][2];\n const b =\n row[0] * matrix[1][0] + row[1] * matrix[1][1] + row[2] * matrix[1][2];\n const c =\n row[0] * matrix[2][0] + row[1] * matrix[2][1] + row[2] * matrix[2][2];\n return [a, b, c];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,MAAMA,CAACC,GAAW,EAAU;EAC1C,IAAIA,GAAG,GAAG,CAAC,EAAE;IACX,OAAO,CAAC,CAAC;EACX,CAAC,MAAM,IAAIA,GAAG,KAAK,CAAC,EAAE;IACpB,OAAO,CAAC;EACV,CAAC,MAAM;IACL,OAAO,CAAC;EACV;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,IAAIA,CAACC,KAAa,EAAEC,IAAY,EAAEC,MAAc,EAAU;EACxE,OAAO,CAAC,GAAG,GAAGA,MAAM,IAAIF,KAAK,GAAGE,MAAM,GAAGD,IAAI;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,QAAQA,CAACC,GAAW,EAAEC,GAAW,EAAEC,KAAa,EAAU;EACxE,IAAIA,KAAK,GAAGF,GAAG,EAAE;IACf,OAAOA,GAAG;EACZ,CAAC,MAAM,IAAIE,KAAK,GAAGD,GAAG,EAAE;IACtB,OAAOA,GA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,cAAcA,CAACC,GAAa,EAAEC,MAAkB,EAAY;EAC1E,MAAMN,CAAC,GACLK,GAAG,CAAC,CAAC,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;EACvE,MAAML,CAAC,GACLI,GAAG,CAAC,CAAC,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;EACvE,MAAMC,CAAC,GACLF,GAAG,CAAC,CAAC,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;EACvE,OAAO,CAACN,CAAC,EAAEC,CAAC,EAAEM,CAAC,CAAC;AAClB"}
|
|
1
|
+
{"version":3,"file":"math-utils.mjs","names":["signum","num","lerp","start","stop","amount","clampInt","min","max","input","clampDouble","sanitizeDegreesInt","degrees","sanitizeDegreesDouble","rotationDirection","from","to","increasingDifference","differenceDegrees","a","b","Math","abs","matrixMultiply","row","matrix","c"],"sources":["../../../../src/util/color/utils/math-utils.ts"],"sourcesContent":["/**\r\n * @license\r\n * Copyright 2021 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Utility methods for mathematical operations.\r\n */\r\n\r\n/**\r\n * The signum function.\r\n *\r\n * @return 1 if num > 0, -1 if num < 0, and 0 if num = 0\r\n */\r\nexport function signum(num: number): number {\r\n if (num < 0) {\r\n return -1;\r\n } else if (num === 0) {\r\n return 0;\r\n } else {\r\n return 1;\r\n }\r\n}\r\n\r\n/**\r\n * The linear interpolation function.\r\n *\r\n * @return start if amount = 0 and stop if amount = 1\r\n */\r\nexport function lerp(start: number, stop: number, amount: number): number {\r\n return (1.0 - amount) * start + amount * stop;\r\n}\r\n\r\n/**\r\n * Clamps an integer between two integers.\r\n *\r\n * @return input when min <= input <= max, and either min or max\r\n * otherwise.\r\n */\r\nexport function clampInt(min: number, max: number, input: number): number {\r\n if (input < min) {\r\n return min;\r\n } else if (input > max) {\r\n return max;\r\n }\r\n\r\n return input;\r\n}\r\n\r\n/**\r\n * Clamps an integer between two floating-point numbers.\r\n *\r\n * @return input when min <= input <= max, and either min or max\r\n * otherwise.\r\n */\r\nexport function clampDouble(min: number, max: number, input: number): number {\r\n if (input < min) {\r\n return min;\r\n } else if (input > max) {\r\n return max;\r\n }\r\n\r\n return input;\r\n}\r\n\r\n/**\r\n * Sanitizes a degree measure as an integer.\r\n *\r\n * @return a degree measure between 0 (inclusive) and 360\r\n * (exclusive).\r\n */\r\nexport function sanitizeDegreesInt(degrees: number): number {\r\n degrees = degrees % 360;\r\n if (degrees < 0) {\r\n degrees = degrees + 360;\r\n }\r\n return degrees;\r\n}\r\n\r\n/**\r\n * Sanitizes a degree measure as a floating-point number.\r\n *\r\n * @return a degree measure between 0.0 (inclusive) and 360.0\r\n * (exclusive).\r\n */\r\nexport function sanitizeDegreesDouble(degrees: number): number {\r\n degrees = degrees % 360.0;\r\n if (degrees < 0) {\r\n degrees = degrees + 360.0;\r\n }\r\n return degrees;\r\n}\r\n\r\n/**\r\n * Sign of direction change needed to travel from one angle to\r\n * another.\r\n *\r\n * For angles that are 180 degrees apart from each other, both\r\n * directions have the same travel distance, so either direction is\r\n * shortest. The value 1.0 is returned in this case.\r\n *\r\n * @param from The angle travel starts from, in degrees.\r\n * @param to The angle travel ends at, in degrees.\r\n * @return -1 if decreasing from leads to the shortest travel\r\n * distance, 1 if increasing from leads to the shortest travel\r\n * distance.\r\n */\r\nexport function rotationDirection(from: number, to: number): number {\r\n const increasingDifference = sanitizeDegreesDouble(to - from);\r\n return increasingDifference <= 180.0 ? 1.0 : -1.0;\r\n}\r\n\r\n/**\r\n * Distance of two points on a circle, represented using degrees.\r\n */\r\nexport function differenceDegrees(a: number, b: number): number {\r\n return 180.0 - Math.abs(Math.abs(a - b) - 180.0);\r\n}\r\n\r\n/**\r\n * Multiplies a 1x3 row vector with a 3x3 matrix.\r\n */\r\nexport function matrixMultiply(row: number[], matrix: number[][]): number[] {\r\n const a =\r\n row[0] * matrix[0][0] + row[1] * matrix[0][1] + row[2] * matrix[0][2];\r\n const b =\r\n row[0] * matrix[1][0] + row[1] * matrix[1][1] + row[2] * matrix[1][2];\r\n const c =\r\n row[0] * matrix[2][0] + row[1] * matrix[2][1] + row[2] * matrix[2][2];\r\n return [a, b, c];\r\n}\r\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,MAAMA,CAACC,GAAW,EAAU;EAC1C,IAAIA,GAAG,GAAG,CAAC,EAAE;IACX,OAAO,CAAC,CAAC;EACX,CAAC,MAAM,IAAIA,GAAG,KAAK,CAAC,EAAE;IACpB,OAAO,CAAC;EACV,CAAC,MAAM;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AAC,CAAC,CAAC;EACvE,OAAO,CAACN,CAAC,EAAEC,CAAC,EAAEM,CAAC,CAAC;AAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.mjs","names":["useDefaultsModule","useSuperDefaults","redefineComponent","options","_setup","setup","props","ctx","defaults","value","_props","provideSubDefaults","name","setupBindings","defineFunctionalComponent","context","defineComponent"],"sources":["../../../src/util/component/component.ts"],"sourcesContent":["import {\n ComponentObjectPropsOptions,\n ComponentOptionsWithoutProps,\n ExtractDefaultPropTypes,\n ExtractPropTypes,\n FunctionalComponent,\n defineComponent,\n} from 'vue';\nimport type {\n Component,\n ComponentInjectOptions,\n ComponentOptions,\n ComponentOptionsMixin,\n ComponentPropsOptions,\n ComponentProvideOptions,\n ComputedOptions,\n DefineComponent,\n Directive,\n EmitsOptions,\n MethodOptions,\n SlotsType,\n} from 'vue';\n\nimport {\n useDefaultsModule,\n useSuperDefaults,\n} from '../../composables/defaults';\nimport { EmitsToProps } from './types';\nimport { ComponentOptionsWithObjectProps } from '@vue/runtime-core';\n\ntype ToResolvedProps<Props, Emits extends EmitsOptions> = Readonly<Props> &\n Readonly<EmitsToProps<Emits>>;\n\n// overload 1: no props from options\nfunction redefineComponent<\n // props\n PropsOptions = {},\n //\n RawBindings = {},\n // emits\n E extends EmitsOptions = {},\n EE extends string = string,\n // other options\n Data = {},\n SetupBindings = {},\n Computed extends ComputedOptions = {},\n Methods extends MethodOptions = {},\n Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,\n Extends extends ComponentOptionsMixin = ComponentOptionsMixin,\n InjectOptions extends ComponentInjectOptions = {},\n InjectKeys extends string = string,\n Slots extends SlotsType = {},\n LocalComponents extends Record<string, Component> = {},\n Directives extends Record<string, Directive> = {},\n Exposed extends string = string,\n Provide extends ComponentProvideOptions = ComponentProvideOptions,\n>(\n options: ComponentOptionsWithoutProps<\n PropsOptions,\n RawBindings,\n Data,\n Computed,\n Methods,\n Mixin,\n Extends,\n E,\n EE,\n InjectOptions,\n InjectKeys,\n Slots\n >,\n): DefineComponent<\n PropsOptions,\n RawBindings,\n Data,\n Computed,\n Methods,\n Mixin,\n Extends,\n E,\n EE\n>;\n\n// overload 2: defineComponent with options object, infer props from options\nfunction redefineComponent<\n // props\n PropsOptions = ComponentObjectPropsOptions,\n RawBindings = {},\n // emits\n E extends EmitsOptions = {},\n EE extends string = string,\n // other options\n Data = {},\n SetupBindings = {},\n Computed extends ComputedOptions = {},\n Methods extends MethodOptions = {},\n Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,\n Extends extends ComponentOptionsMixin = ComponentOptionsMixin,\n Defaults = ExtractDefaultPropTypes<PropsOptions>,\n InjectOptions extends {} = {},\n InjectKeys extends string = string,\n Slots extends SlotsType = {},\n LocalComponents extends Record<string, Component> = {},\n Directives extends Record<string, Directive> = {},\n Exposed extends string = string,\n Provide extends ComponentProvideOptions = ComponentProvideOptions,\n>(\n options: ComponentOptionsWithObjectProps<\n PropsOptions,\n RawBindings,\n Data,\n Computed,\n Methods,\n Mixin,\n Extends,\n E,\n EE,\n InjectOptions,\n InjectKeys,\n Slots\n >,\n): DefineComponent<\n PropsOptions,\n RawBindings,\n Data,\n Computed,\n Methods,\n Mixin,\n Extends,\n E,\n EE\n>;\n\nfunction redefineComponent(options: ComponentOptions) {\n options._setup = options._setup ?? options.setup;\n\n if (options._setup) {\n options.setup = function (props, ctx) {\n const defaults = useDefaultsModule();\n // Skip props proxy if defaults are not provided\n if (!defaults.value) return options._setup(props, ctx);\n\n const { props: _props, provideSubDefaults } = useSuperDefaults(\n props,\n options.name,\n defaults,\n );\n\n const setupBindings = options._setup(_props, ctx);\n\n provideSubDefaults();\n\n return setupBindings;\n };\n }\n\n return options;\n}\n\nfunction defineFunctionalComponent<\n T extends FunctionalComponent<Props>,\n PropsOptions = ComponentObjectPropsOptions,\n Defaults = ExtractDefaultPropTypes<PropsOptions>,\n Props = Readonly<ExtractPropTypes<PropsOptions>>,\n>(\n props: PropsOptions,\n context: T,\n): FunctionalComponent<Partial<Defaults> & Omit<Props, keyof Defaults>> {\n context.props = props as any;\n return context as any;\n}\n\nexport { redefineComponent as defineComponent };\n"],"mappings":"SAwBEA,iBAAiB,EACjBC,gBAAgB,gDAQlB;AAkDA;AAkDA,SAASC,iBAAiBA,CAACC,OAAyB,EAAE;EACpDA,OAAO,CAACC,MAAM,GAAGD,OAAO,CAACC,MAAM,IAAID,OAAO,CAACE,KAAK;EAEhD,IAAIF,OAAO,CAACC,MAAM,EAAE;IAClBD,OAAO,CAACE,KAAK,GAAG,UAAUC,KAAK,EAAEC,GAAG,EAAE;MACpC,MAAMC,QAAQ,GAAGR,iBAAiB,CAAC,CAAC;MACpC;MACA,IAAI,CAACQ,QAAQ,CAACC,KAAK,EAAE,OAAON,OAAO,CAACC,MAAM,CAACE,KAAK,EAAEC,GAAG,CAAC;MAEtD,MAAM;QAAED,KAAK,EAAEI,MAAM;QAAEC;MAAmB,CAAC,GAAGV,gBAAgB,CAC5DK,KAAK,EACLH,OAAO,CAACS,IAAI,EACZJ,QACF,CAAC;MAED,MAAMK,aAAa,GAAGV,OAAO,CAACC,MAAM,CAACM,MAAM,EAAEH,GAAG,CAAC;MAEjDI,kBAAkB,CAAC,CAAC;MAEpB,OAAOE,aAAa;IACtB,CAAC;EACH;EAEA,OAAOV,OAAO;AAChB;AAEA,SAASW,yBAAyBA,CAMhCR,KAAmB,EACnBS,OAAU,EAC4D;EACtEA,OAAO,CAACT,KAAK,GAAGA,KAAY;EAC5B,OAAOS,OAAO;AAChB;AAEA,SAASb,iBAAiB,IAAIc,eAAe"}
|
|
1
|
+
{"version":3,"file":"component.mjs","names":["useDefaultsModule","useSuperDefaults","redefineComponent","options","_setup","setup","props","ctx","defaults","value","_props","provideSubDefaults","name","setupBindings","defineFunctionalComponent","context","defineComponent"],"sources":["../../../src/util/component/component.ts"],"sourcesContent":["import {\r\n ComponentObjectPropsOptions,\r\n ComponentOptionsWithoutProps,\r\n ExtractDefaultPropTypes,\r\n ExtractPropTypes,\r\n FunctionalComponent,\r\n defineComponent,\r\n} from 'vue';\r\nimport type {\r\n Component,\r\n ComponentInjectOptions,\r\n ComponentOptions,\r\n ComponentOptionsMixin,\r\n ComponentPropsOptions,\r\n ComponentProvideOptions,\r\n ComputedOptions,\r\n DefineComponent,\r\n Directive,\r\n EmitsOptions,\r\n MethodOptions,\r\n SlotsType,\r\n} from 'vue';\r\n\r\nimport {\r\n useDefaultsModule,\r\n useSuperDefaults,\r\n} from '../../composables/defaults';\r\nimport { EmitsToProps } from './types';\r\nimport { ComponentOptionsWithObjectProps } from '@vue/runtime-core';\r\n\r\ntype ToResolvedProps<Props, Emits extends EmitsOptions> = Readonly<Props> &\r\n Readonly<EmitsToProps<Emits>>;\r\n\r\n// overload 1: no props from options\r\nfunction redefineComponent<\r\n // props\r\n PropsOptions = {},\r\n //\r\n RawBindings = {},\r\n // emits\r\n E extends EmitsOptions = {},\r\n EE extends string = string,\r\n // other options\r\n Data = {},\r\n SetupBindings = {},\r\n Computed extends ComputedOptions = {},\r\n Methods extends MethodOptions = {},\r\n Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,\r\n Extends extends ComponentOptionsMixin = ComponentOptionsMixin,\r\n InjectOptions extends ComponentInjectOptions = {},\r\n InjectKeys extends string = string,\r\n Slots extends SlotsType = {},\r\n LocalComponents extends Record<string, Component> = {},\r\n Directives extends Record<string, Directive> = {},\r\n Exposed extends string = string,\r\n Provide extends ComponentProvideOptions = ComponentProvideOptions,\r\n>(\r\n options: ComponentOptionsWithoutProps<\r\n PropsOptions,\r\n RawBindings,\r\n Data,\r\n Computed,\r\n Methods,\r\n Mixin,\r\n Extends,\r\n E,\r\n EE,\r\n InjectOptions,\r\n InjectKeys,\r\n Slots\r\n >,\r\n): DefineComponent<\r\n PropsOptions,\r\n RawBindings,\r\n Data,\r\n Computed,\r\n Methods,\r\n Mixin,\r\n Extends,\r\n E,\r\n EE\r\n>;\r\n\r\n// overload 2: defineComponent with options object, infer props from options\r\nfunction redefineComponent<\r\n // props\r\n PropsOptions = ComponentObjectPropsOptions,\r\n RawBindings = {},\r\n // emits\r\n E extends EmitsOptions = {},\r\n EE extends string = string,\r\n // other options\r\n Data = {},\r\n SetupBindings = {},\r\n Computed extends ComputedOptions = {},\r\n Methods extends MethodOptions = {},\r\n Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,\r\n Extends extends ComponentOptionsMixin = ComponentOptionsMixin,\r\n Defaults = ExtractDefaultPropTypes<PropsOptions>,\r\n InjectOptions extends {} = {},\r\n InjectKeys extends string = string,\r\n Slots extends SlotsType = {},\r\n LocalComponents extends Record<string, Component> = {},\r\n Directives extends Record<string, Directive> = {},\r\n Exposed extends string = string,\r\n Provide extends ComponentProvideOptions = ComponentProvideOptions,\r\n>(\r\n options: ComponentOptionsWithObjectProps<\r\n PropsOptions,\r\n RawBindings,\r\n Data,\r\n Computed,\r\n Methods,\r\n Mixin,\r\n Extends,\r\n E,\r\n EE,\r\n InjectOptions,\r\n InjectKeys,\r\n Slots\r\n >,\r\n): DefineComponent<\r\n PropsOptions,\r\n RawBindings,\r\n Data,\r\n Computed,\r\n Methods,\r\n Mixin,\r\n Extends,\r\n E,\r\n EE\r\n>;\r\n\r\nfunction redefineComponent(options: ComponentOptions) {\r\n options._setup = options._setup ?? options.setup;\r\n\r\n if (options._setup) {\r\n options.setup = function (props, ctx) {\r\n const defaults = useDefaultsModule();\r\n // Skip props proxy if defaults are not provided\r\n if (!defaults.value) return options._setup(props, ctx);\r\n\r\n const { props: _props, provideSubDefaults } = useSuperDefaults(\r\n props,\r\n options.name,\r\n defaults,\r\n );\r\n\r\n const setupBindings = options._setup(_props, ctx);\r\n\r\n provideSubDefaults();\r\n\r\n return setupBindings;\r\n };\r\n }\r\n\r\n return options;\r\n}\r\n\r\nfunction defineFunctionalComponent<\r\n T extends FunctionalComponent<Props>,\r\n PropsOptions = ComponentObjectPropsOptions,\r\n Defaults = ExtractDefaultPropTypes<PropsOptions>,\r\n Props = Readonly<ExtractPropTypes<PropsOptions>>,\r\n>(\r\n props: PropsOptions,\r\n context: T,\r\n): FunctionalComponent<Partial<Defaults> & Omit<Props, keyof Defaults>> {\r\n context.props = props as any;\r\n return context as any;\r\n}\r\n\r\nexport { redefineComponent as defineComponent };\r\n"],"mappings":"SAwBEA,iBAAiB,EACjBC,gBAAgB,gDAQlB;AAkDA;AAkDA,SAASC,iBAAiBA,CAACC,OAAyB,EAAE;EACpDA,OAAO,CAACC,MAAM,GAAGD,OAAO,CAACC,MAAM,IAAID,OAAO,CAACE,KAAK;EAEhD,IAAIF,OAAO,CAACC,MAAM,EAAE;IAClBD,OAAO,CAACE,KAAK,GAAG,UAAUC,KAAK,EAAEC,GAAG,EAAE;MACpC,MAAMC,QAAQ,GAAGR,iBAAiB,CAAC,CAAC;MACpC;MACA,IAAI,CAACQ,QAAQ,CAACC,KAAK,EAAE,OAAON,OAAO,CAACC,MAAM,CAACE,KAAK,EAAEC,GAAG,CAAC;MAEtD,MAAM;QAAED,KAAK,EAAEI,MAAM;QAAEC;MAAmB,CAAC,GAAGV,gBAAgB,CAC5DK,KAAK,EACLH,OAAO,CAACS,IAAI,EACZJ,QACF,CAAC;MAED,MAAMK,aAAa,GAAGV,OAAO,CAACC,MAAM,CAACM,MAAM,EAAEH,GAAG,CAAC;MAEjDI,kBAAkB,CAAC,CAAC;MAEpB,OAAOE,aAAa;IACtB,CAAC;EACH;EAEA,OAAOV,OAAO;AAChB;AAEA,SAASW,yBAAyBA,CAMhCR,KAAmB,EACnBS,OAAU,EAC4D;EACtEA,OAAO,CAACT,KAAK,GAAGA,KAAY;EAC5B,OAAOS,OAAO;AAChB;AAEA,SAASb,iBAAiB,IAAIc,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["getCurrentInstance","defineComponent","getSlot","vm","name","arguments","length","undefined","data","optional","$slots","slot","Function","filter","node","el","nodeType","getUid","uid","bindClasses","classes","boundClasses","Array","isArray","reduce","acc","clas","Object","keys","getHtmlElement","$el","Node","TEXT_NODE","nextElementSibling","findChildrenWithProvide","key","vnode","map","child","flat","children","component","getOwnPropertySymbols","provides","includes","subTree"],"sources":["../../../src/util/component/index.ts"],"sourcesContent":["import type {\n ComponentInternalInstance,\n ComponentPublicInstance,\n InjectionKey,\n VNode,\n VNodeChild,\n} from 'vue';\nimport { getCurrentInstance } from 'vue';\n\nimport { defineComponent } from './component';\n\nexport type { EventProp } from './types';\nexport * from './props';\n\nexport { defineComponent };\n\nexport function getSlot(\n vm: ComponentPublicInstance | any,\n // eslint-disable-next-line default-param-last\n name = 'default',\n data?: any | (() => any),\n optional = false,\n): VNode[] | undefined {\n if (vm.$slots?.[name]) {\n const slot = vm.$slots[name]!(data instanceof Function ? data() : data);\n return slot.filter((node: VNode) => {\n return node.el?.nodeType !== 8;\n });\n }\n return undefined;\n}\n\nexport function getUid() {\n const vm = getCurrentInstance();\n return vm?.uid;\n}\n\nexport function bindClasses(\n classes: string | string[] | Record<string, any> | undefined,\n) {\n const boundClasses = {} as Record<string, boolean>;\n if (typeof classes === 'string') {\n boundClasses[classes] = true;\n } else if (Array.isArray(classes)) {\n (classes as string[]).reduce((acc, clas) => {\n acc[clas] = true;\n return acc;\n }, boundClasses);\n } else if (typeof classes === 'object') {\n Object.keys(classes).reduce((acc, clas) => {\n acc[clas] = !!classes[clas];\n return acc;\n }, boundClasses);\n }\n return boundClasses;\n}\n\nexport function getHtmlElement<N extends object | undefined>(\n node: N,\n): Exclude<N, ComponentPublicInstance> | HTMLElement {\n if (node && '$el' in node) {\n const el = (node as ComponentPublicInstance).$el as HTMLElement;\n if (el.nodeType === Node.TEXT_NODE) {\n return el.nextElementSibling as HTMLElement;\n }\n return el;\n }\n return node as HTMLElement;\n}\n\nexport function findChildrenWithProvide(\n key: InjectionKey<any> | symbol,\n vnode?: VNodeChild,\n): ComponentInternalInstance[] {\n if (!vnode || typeof vnode !== 'object') {\n return [];\n }\n\n if (Array.isArray(vnode)) {\n return vnode.map((child) => findChildrenWithProvide(key, child)).flat(1);\n } else if (Array.isArray(vnode.children)) {\n return vnode.children\n .map((child) => findChildrenWithProvide(key, child))\n .flat(1);\n } else if (vnode.component) {\n if (\n Object.getOwnPropertySymbols((vnode.component as any).provides).includes(\n key as symbol,\n )\n ) {\n return [vnode.component];\n } else if (vnode.component.subTree) {\n return findChildrenWithProvide(key, vnode.component.subTree).flat(1);\n }\n }\n\n return [];\n}\n"],"mappings":"AAOA,SAASA,kBAAkB,QAAQ,KAAK;AAAC,SAEhCC,eAAe;AAAA;AAKxB,SAASA,eAAe;AAExB,OAAO,SAASC,OAAOA,CACrBC,EAAiC,EAKZ;EAAA,IAHrBC,IAAI,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,SAAS;EAAA,IAChBG,IAAwB,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAAA,IACxBE,QAAQ,GAAAJ,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAEhB,IAAIF,EAAE,CAACO,MAAM,GAAGN,IAAI,CAAC,EAAE;IACrB,MAAMO,IAAI,GAAGR,EAAE,CAACO,MAAM,CAACN,IAAI,CAAC,CAAEI,IAAI,YAAYI,QAAQ,GAAGJ,IAAI,CAAC,CAAC,GAAGA,IAAI,CAAC;IACvE,OAAOG,IAAI,CAACE,MAAM,CAAEC,IAAW,IAAK;MAClC,OAAOA,IAAI,CAACC,EAAE,EAAEC,QAAQ,KAAK,CAAC;IAChC,CAAC,CAAC;EACJ;EACA,OAAOT,SAAS;AAClB;AAEA,OAAO,SAASU,MAAMA,CAAA,EAAG;EACvB,MAAMd,EAAE,GAAGH,kBAAkB,CAAC,CAAC;EAC/B,OAAOG,EAAE,EAAEe,GAAG;AAChB;AAEA,OAAO,SAASC,WAAWA,CACzBC,OAA4D,EAC5D;EACA,MAAMC,YAAY,GAAG,CAAC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CAAC,CAACC,IAAI,CAAC,CAAC,CAAC;EAC1E,CAAC,MAAM,IAAIjB,KAAK,CAACC,OAAO,CAACa,KAAK,CAACI,QAAQ,CAAC,EAAE;IACxC,OAAOJ,KAAK,CAACI,QAAQ,CAClBH,GAAG,CAAEC,KAAK,IAAKJ,uBAAuB,CAACC,GAAG,EAAEG,KAAK,CAAC,CAAC,CACnDC,IAAI,CAAC,CAAC,CAAC;EACZ,CAAC,MAAM,IAAIH,KAAK,CAACK,SAAS,EAAE;IAC1B,IACEd,MAAM,CAACe,qBAAqB,CAAEN,KAAK,CAACK,SAAS,CAASE,QAAQ,CAAC,CAACC,QAAQ,CACtET,GACF,CAAC,EACD;MACA,OAAO,CAACC,KAAK,CAACK,SAAS,CAAC;IAC1B,CAAC,MAAM,IAAIL,KAAK,CAACK,SAAS,CAACI,OAAO,EAAE;MAClC,OAAOX,uBAAuB,CAACC,GAAG,EAAEC,KAAK,CAACK,SAAS,CAACI,OAAO,CAAC,CAACN,IAAI,CAAC,CAAC,CAAC;IACtE;EACF;EAEA,OAAO,EAAE;AACX"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["getCurrentInstance","defineComponent","getSlot","vm","name","arguments","length","undefined","data","optional","$slots","slot","Function","filter","node","el","nodeType","getUid","uid","bindClasses","classes","boundClasses","Array","isArray","reduce","acc","clas","Object","keys","getHtmlElement","$el","Node","TEXT_NODE","nextElementSibling","findChildrenWithProvide","key","vnode","map","child","flat","children","component","getOwnPropertySymbols","provides","includes","subTree"],"sources":["../../../src/util/component/index.ts"],"sourcesContent":["import type {\r\n ComponentInternalInstance,\r\n ComponentPublicInstance,\r\n InjectionKey,\r\n VNode,\r\n VNodeChild,\r\n} from 'vue';\r\nimport { getCurrentInstance } from 'vue';\r\n\r\nimport { defineComponent } from './component';\r\n\r\nexport type { EventProp } from './types';\r\nexport * from './props';\r\n\r\nexport { defineComponent };\r\n\r\nexport function getSlot(\r\n vm: ComponentPublicInstance | any,\r\n // eslint-disable-next-line default-param-last\r\n name = 'default',\r\n data?: any | (() => any),\r\n optional = false,\r\n): VNode[] | undefined {\r\n if (vm.$slots?.[name]) {\r\n const slot = vm.$slots[name]!(data instanceof Function ? data() : data);\r\n return slot.filter((node: VNode) => {\r\n return node.el?.nodeType !== 8;\r\n });\r\n }\r\n return undefined;\r\n}\r\n\r\nexport function getUid() {\r\n const vm = getCurrentInstance();\r\n return vm?.uid;\r\n}\r\n\r\nexport function bindClasses(\r\n classes: string | string[] | Record<string, any> | undefined,\r\n) {\r\n const boundClasses = {} as Record<string, boolean>;\r\n if (typeof classes === 'string') {\r\n boundClasses[classes] = true;\r\n } else if (Array.isArray(classes)) {\r\n (classes as string[]).reduce((acc, clas) => {\r\n acc[clas] = true;\r\n return acc;\r\n }, boundClasses);\r\n } else if (typeof classes === 'object') {\r\n Object.keys(classes).reduce((acc, clas) => {\r\n acc[clas] = !!classes[clas];\r\n return acc;\r\n }, boundClasses);\r\n }\r\n return boundClasses;\r\n}\r\n\r\nexport function getHtmlElement<N extends object | undefined>(\r\n node: N,\r\n): Exclude<N, ComponentPublicInstance> | HTMLElement {\r\n if (node && '$el' in node) {\r\n const el = (node as ComponentPublicInstance).$el as HTMLElement;\r\n if (el.nodeType === Node.TEXT_NODE) {\r\n return el.nextElementSibling as HTMLElement;\r\n }\r\n return el;\r\n }\r\n return node as HTMLElement;\r\n}\r\n\r\nexport function findChildrenWithProvide(\r\n key: InjectionKey<any> | symbol,\r\n vnode?: VNodeChild,\r\n): ComponentInternalInstance[] {\r\n if (!vnode || typeof vnode !== 'object') {\r\n return [];\r\n }\r\n\r\n if (Array.isArray(vnode)) {\r\n return vnode.map((child) => findChildrenWithProvide(key, child)).flat(1);\r\n } else if (Array.isArray(vnode.children)) {\r\n return vnode.children\r\n .map((child) => findChildrenWithProvide(key, child))\r\n .flat(1);\r\n } else if (vnode.component) {\r\n if (\r\n Object.getOwnPropertySymbols((vnode.component as any).provides).includes(\r\n key as symbol,\r\n )\r\n ) {\r\n return [vnode.component];\r\n } else if (vnode.component.subTree) {\r\n return findChildrenWithProvide(key, vnode.component.subTree).flat(1);\r\n }\r\n }\r\n\r\n return [];\r\n}\r\n"],"mappings":"AAOA,SAASA,kBAAkB,QAAQ,KAAK;AAAC,SAEhCC,eAAe;AAAA;AAKxB,SAASA,eAAe;AAExB,OAAO,SAASC,OAAOA,CACrBC,EAAiC,EAKZ;EAAA,IAHrBC,IAAI,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,SAAS;EAAA,IAChBG,IAAwB,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAAA,IACxBE,QAAQ,GAAAJ,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAEhB,IAAIF,EAAE,CAACO,MAAM,GAAGN,IAAI,CAAC,EAAE;IACrB,MAAMO,IAAI,GAAGR,EAAE,CAACO,MAAM,CAACN,IAAI,CAAC,CAAEI,IAAI,YAAYI,QAAQ,GAAGJ,IAAI,CAAC,CAAC,GAAGA,IAAI,CAAC;IACvE,OAAOG,IAAI,CAACE,MAAM,CAAEC,IAAW,IAAK;MAClC,OAAOA,IAAI,CAACC,EAAE,EAAEC,QAAQ,KAAK,CAAC;IAChC,CAAC,CAAC;EACJ;EACA,OAAOT,SAAS;AAClB;AAEA,OAAO,SAASU,MAAMA,CAAA,EAAG;EACvB,MAAMd,EAAE,GAAGH,kBAAkB,CAAC,CAAC;EAC/B,OAAOG,EAAE,EAAEe,GAAG;AAChB;AAEA,OAAO,SAASC,WAAWA,CACzBC,OAA4D,EAC5D;EACA,MAAMC,YAAY,GAAG,CAAC,CAA4B;EAClD,IAAI,OAAOD,OAAO,KAAK,QAAQ,EAAE;IAC/BC,YAAY,CAACD,OAAO,CAAC,GAAG,IAAI;EAC9B,CAAC,MAAM,IAAIE,KAAK,CAACC,OAAO,CAACH,OAAO,CAAC,EAAE;IAChC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C,KAAK,IAAKJ,uBAAuB,CAACC,GAAG,EAAEG,KAAK,CAAC,CAAC,CACnDC,IAAI,CAAC,CAAC,CAAC;EACZ,CAAC,MAAM,IAAIH,KAAK,CAACK,SAAS,EAAE;IAC1B,IACEd,MAAM,CAACe,qBAAqB,CAAEN,KAAK,CAACK,SAAS,CAASE,QAAQ,CAAC,CAACC,QAAQ,CACtET,GACF,CAAC,EACD;MACA,OAAO,CAACC,KAAK,CAACK,SAAS,CAAC;IAC1B,CAAC,MAAM,IAAIL,KAAK,CAACK,SAAS,CAACI,OAAO,EAAE;MAClC,OAAOX,uBAAuB,CAACC,GAAG,EAAEC,KAAK,CAACK,SAAS,CAACI,OAAO,CAAC,CAACN,IAAI,CAAC,CAAC,CAAC;IACtE;EACF;EAEA,OAAO,EAAE;AACX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inject-self.mjs","names":["getCurrentInstance","injectSelf","key","vm","arguments","length","undefined","provides"],"sources":["../../../src/util/component/inject-self.ts"],"sourcesContent":["import {\n type ComponentInternalInstance,\n type InjectionKey,\n getCurrentInstance,\n} from 'vue';\n\nexport function injectSelf<T>(\n key: InjectionKey<T> | string,\n vm?: ComponentInternalInstance,\n): T | undefined;\nexport function injectSelf(\n key: InjectionKey<any> | string,\n vm = getCurrentInstance(),\n) {\n const provides = vm?.provides;\n\n if (provides && (key as string | symbol) in provides) {\n return provides[key as string];\n }\n\n return undefined;\n}\n"],"mappings":"AAAA,SAGEA,kBAAkB,QACb,KAAK;AAMZ,OAAO,SAASC,UAAUA,CACxBC,GAA+B,EAE/B;EAAA,IADAC,EAAE,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGJ,kBAAkB,CAAC,CAAC;EAEzB,MAAMO,QAAQ,GAAGJ,EAAE,EAAEI,QAAQ;EAE7B,IAAIA,QAAQ,IAAKL,GAAG,IAAwBK,QAAQ,EAAE;IACpD,OAAOA,QAAQ,CAACL,GAAG,CAAW;EAChC;EAEA,OAAOI,SAAS;AAClB"}
|
|
1
|
+
{"version":3,"file":"inject-self.mjs","names":["getCurrentInstance","injectSelf","key","vm","arguments","length","undefined","provides"],"sources":["../../../src/util/component/inject-self.ts"],"sourcesContent":["import {\r\n type ComponentInternalInstance,\r\n type InjectionKey,\r\n getCurrentInstance,\r\n} from 'vue';\r\n\r\nexport function injectSelf<T>(\r\n key: InjectionKey<T> | string,\r\n vm?: ComponentInternalInstance,\r\n): T | undefined;\r\nexport function injectSelf(\r\n key: InjectionKey<any> | string,\r\n vm = getCurrentInstance(),\r\n) {\r\n const provides = vm?.provides;\r\n\r\n if (provides && (key as string | symbol) in provides) {\r\n return provides[key as string];\r\n }\r\n\r\n return undefined;\r\n}\r\n"],"mappings":"AAAA,SAGEA,kBAAkB,QACb,KAAK;AAMZ,OAAO,SAASC,UAAUA,CACxBC,GAA+B,EAE/B;EAAA,IADAC,EAAE,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGJ,kBAAkB,CAAC,CAAC;EAEzB,MAAMO,QAAQ,GAAGJ,EAAE,EAAEI,QAAQ;EAE7B,IAAIA,QAAQ,IAAKL,GAAG,IAAwBK,QAAQ,EAAE;IACpD,OAAOA,QAAQ,CAACL,GAAG,CAAW;EAChC;EAEA,OAAOI,SAAS;AAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.mjs","names":["capitalize","toKebabCase","propsFactory","props","source","defaults","Object","keys","reduce","options","prop","option","isObjectOption","Array","isArray","objectOption","type","default","chooseProps","target","acc","hasEventProp","onType","propIsDefined","vnode"],"sources":["../../../src/util/component/props.ts"],"sourcesContent":["import { capitalize } from 'vue';\nimport type { IfAny } from '@vue/shared';\nimport type {\n ComponentObjectPropsOptions,\n ExtractPropTypes,\n Prop,\n PropType,\n VNode,\n} from 'vue';\n\nimport { toKebabCase } from '../string';\n\nexport function propsFactory<PropsOptions extends ComponentObjectPropsOptions>(\n props: PropsOptions,\n source: string,\n) {\n return <Defaults extends PartialKeys<PropsOptions> = {}>(\n defaults?: Defaults,\n ): OverwrittenPropOptions<PropsOptions, Defaults> => {\n return Object.keys(props).reduce<any>((options, prop) => {\n const option = props[prop];\n const isObjectOption =\n typeof option === 'object' && option != null && !Array.isArray(option);\n const objectOption = isObjectOption ? option : { type: option };\n if (defaults && prop in defaults) {\n options[prop] = {\n ...objectOption,\n default: defaults[prop],\n };\n } else {\n options[prop] = objectOption;\n }\n\n if (source && !options[prop].source) {\n options[prop].source = source;\n }\n return options;\n }, {} as PropsOptions);\n };\n}\n\nexport function chooseProps<PropsOptions extends ComponentObjectPropsOptions>(\n props: any,\n target: PropsOptions,\n): ExtractPropTypes<PropsOptions> {\n return Object.keys(target).reduce((acc, prop) => {\n if (props && prop in props) {\n acc[prop as keyof ExtractPropTypes<PropsOptions>] = props[prop];\n }\n return acc;\n }, {} as ExtractPropTypes<PropsOptions>);\n}\n\nexport function hasEventProp(props: Record<string, any>, type: string) {\n const onType = `on${capitalize(type)}`;\n return !!(\n props[onType] ||\n props[`${onType}Once`] ||\n props[`${onType}Capture`] ||\n props[`${onType}OnceCapture`] ||\n props[`${onType}CaptureOnce`]\n );\n}\n\nexport function propIsDefined(vnode: VNode, prop: string) {\n return (\n typeof vnode.props?.[prop] !== 'undefined' ||\n typeof vnode.props?.[toKebabCase(prop)] !== 'undefined'\n );\n}\n\ntype OverwrittenPropOptions<\n T extends ComponentObjectPropsOptions,\n D extends PartialKeys<T>,\n> = {\n [P in keyof T]-?: unknown extends D[P]\n ? T[P]\n : T[P] extends Record<string, unknown>\n ? Omit<T[P], 'type' | 'default'> & {\n type: PropType<MergeDefault<T[P], D[P]>>;\n default: MergeDefault<T[P], D[P]>;\n }\n : {\n type: PropType<MergeDefault<T[P], D[P]>>;\n default: MergeDefault<T[P], D[P]>;\n };\n};\n\ntype MergeDefault<T, D> = unknown extends D\n ? InferPropType<T>\n : NonNullable<InferPropType<T>> | D;\n\ntype FollowPropType<T, P, D> = [T] extends [PropType<unknown>]\n ? T\n : PropType<MergeDefault<P, D>>;\n\ntype PartialKeys<T> = { [P in keyof T]?: unknown };\n\ntype InferPropType<T> = [T] extends [null]\n ? any // null & true would fail to infer\n : [T] extends [{ type: null | true }]\n ? // As TS issue https://github.com/Microsoft/TypeScript/issues/14829\n // somehow `ObjectConstructor` when inferred from { (): T } becomes `any`\n // `BooleanConstructor` when inferred from PropConstructor(with PropMethod) becomes `Boolean`\n any\n : [T] extends [ObjectConstructor | { type: ObjectConstructor }]\n ? Record<string, any>\n : [T] extends [BooleanConstructor | { type: BooleanConstructor }]\n ? boolean\n : [T] extends [DateConstructor | { type: DateConstructor }]\n ? Date\n : [T] extends [(infer U)[] | { type: (infer U)[] }]\n ? U extends DateConstructor\n ? Date | InferPropType<U>\n : InferPropType<U>\n : [T] extends [Prop<infer V, infer D>]\n ? unknown extends V\n ? IfAny<V, V, D>\n : V\n : T;\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,KAAK;AAAC,SAUxBC,WAAW;AAEpB,OAAO,SAASC,YAAYA,CAC1BC,KAAmB,EACnBC,MAAc,EACd;EACA,OACEC,QAAmB,IACgC;IACnD,OAAOC,MAAM,CAACC,IAAI,CAACJ,KAAK,CAAC,CAACK,MAAM,CAAM,CAACC,OAAO,EAAEC,IAAI,KAAK;MACvD,MAAMC,MAAM,GAAGR,KAAK,CAACO,IAAI,CAAC;MAC1B,MAAME,cAAc,GAClB,OAAOD,MAAM,KAAK,QAAQ,IAAIA,MAAM,IAAI,IAAI,IAAI,CAACE,KAAK,CAACC,OAAO,CAACH,MAAM,CAAC;MACxE,MAAMI,YAAY,GAAGH,cAAc,GAAGD,MAAM,GAAG;QAAEK,IAAI,EAAEL;MAAO,CAAC;MAC/D,IAAIN,QAAQ,IAAIK,IAAI,IAAIL,QAAQ,EAAE;QAChCI,OAAO,CAACC,IAAI,CAAC,GAAG;UACd,GAAGK,YAAY;UACfE,OAAO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AAK,WAAW;AAE3D"}
|
|
1
|
+
{"version":3,"file":"props.mjs","names":["capitalize","toKebabCase","propsFactory","props","source","defaults","Object","keys","reduce","options","prop","option","isObjectOption","Array","isArray","objectOption","type","default","chooseProps","target","acc","hasEventProp","onType","propIsDefined","vnode"],"sources":["../../../src/util/component/props.ts"],"sourcesContent":["import { capitalize } from 'vue';\r\nimport type { IfAny } from '@vue/shared';\r\nimport type {\r\n ComponentObjectPropsOptions,\r\n ExtractPropTypes,\r\n Prop,\r\n PropType,\r\n VNode,\r\n} from 'vue';\r\n\r\nimport { toKebabCase } from '../string';\r\n\r\nexport function propsFactory<PropsOptions extends ComponentObjectPropsOptions>(\r\n props: PropsOptions,\r\n source: string,\r\n) {\r\n return <Defaults extends PartialKeys<PropsOptions> = {}>(\r\n defaults?: Defaults,\r\n ): OverwrittenPropOptions<PropsOptions, Defaults> => {\r\n return Object.keys(props).reduce<any>((options, prop) => {\r\n const option = props[prop];\r\n const isObjectOption =\r\n typeof option === 'object' && option != null && !Array.isArray(option);\r\n const objectOption = isObjectOption ? option : { type: option };\r\n if (defaults && prop in defaults) {\r\n options[prop] = {\r\n ...objectOption,\r\n default: defaults[prop],\r\n };\r\n } else {\r\n options[prop] = objectOption;\r\n }\r\n\r\n if (source && !options[prop].source) {\r\n options[prop].source = source;\r\n }\r\n return options;\r\n }, {} as PropsOptions);\r\n };\r\n}\r\n\r\nexport function chooseProps<PropsOptions extends ComponentObjectPropsOptions>(\r\n props: any,\r\n target: PropsOptions,\r\n): ExtractPropTypes<PropsOptions> {\r\n return Object.keys(target).reduce((acc, prop) => {\r\n if (props && prop in props) {\r\n acc[prop as keyof ExtractPropTypes<PropsOptions>] = props[prop];\r\n }\r\n return acc;\r\n }, {} as ExtractPropTypes<PropsOptions>);\r\n}\r\n\r\nexport function hasEventProp(props: Record<string, any>, type: string) {\r\n const onType = `on${capitalize(type)}`;\r\n return !!(\r\n props[onType] ||\r\n props[`${onType}Once`] ||\r\n props[`${onType}Capture`] ||\r\n props[`${onType}OnceCapture`] ||\r\n props[`${onType}CaptureOnce`]\r\n );\r\n}\r\n\r\nexport function propIsDefined(vnode: VNode, prop: string) {\r\n return (\r\n typeof vnode.props?.[prop] !== 'undefined' ||\r\n typeof vnode.props?.[toKebabCase(prop)] !== 'undefined'\r\n );\r\n}\r\n\r\ntype OverwrittenPropOptions<\r\n T extends ComponentObjectPropsOptions,\r\n D extends PartialKeys<T>,\r\n> = {\r\n [P in keyof T]-?: unknown extends D[P]\r\n ? T[P]\r\n : T[P] extends Record<string, unknown>\r\n ? Omit<T[P], 'type' | 'default'> & {\r\n type: PropType<MergeDefault<T[P], D[P]>>;\r\n default: MergeDefault<T[P], D[P]>;\r\n }\r\n : {\r\n type: PropType<MergeDefault<T[P], D[P]>>;\r\n default: MergeDefault<T[P], D[P]>;\r\n };\r\n};\r\n\r\ntype MergeDefault<T, D> = unknown extends D\r\n ? InferPropType<T>\r\n : NonNullable<InferPropType<T>> | D;\r\n\r\ntype FollowPropType<T, P, D> = [T] extends [PropType<unknown>]\r\n ? T\r\n : PropType<MergeDefault<P, D>>;\r\n\r\ntype PartialKeys<T> = { [P in keyof T]?: unknown };\r\n\r\ntype InferPropType<T> = [T] extends [null]\r\n ? any // null & true would fail to infer\r\n : [T] extends [{ type: null | true }]\r\n ? // As TS issue https://github.com/Microsoft/TypeScript/issues/14829\r\n // somehow `ObjectConstructor` when inferred from { (): T } becomes `any`\r\n // `BooleanConstructor` when inferred from PropConstructor(with PropMethod) becomes `Boolean`\r\n any\r\n : [T] extends [ObjectConstructor | { type: ObjectConstructor }]\r\n ? Record<string, any>\r\n : [T] extends [BooleanConstructor | { type: BooleanConstructor }]\r\n ? boolean\r\n : [T] extends [DateConstructor | { type: DateConstructor }]\r\n ? Date\r\n : [T] extends [(infer U)[] | { type: (infer U)[] }]\r\n ? U extends DateConstructor\r\n ? Date | InferPropType<U>\r\n : InferPropType<U>\r\n : [T] extends [Prop<infer V, infer D>]\r\n ? unknown extends V\r\n ?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AK,CAACO,IAAI,CAAC;IACjE;IACA,OAAOU,GAAG;EACZ,CAAC,EAAE,CAAC,CAAmC,CAAC;AAC1C;AAEA,OAAO,SAASC,YAAYA,CAAClB,KAA0B,EAAEa,IAAY,EAAE;EACrE,MAAMM,MAAM,GAAI,KAAItB,UAAU,CAACgB,IAAI,CAAE,EAAC;EACtC,OAAO,CAAC,EACNb,KAAK,CAACmB,MAAM,CAAC,IACbnB,KAAK,CAAE,GAAEmB,MAAO,MAAK,CAAC,IACtBnB,KAAK,CAAE,GAAEmB,MAAO,SAAQ,CAAC,IACzBnB,KAAK,CAAE,GAAEmB,MAAO,aAAY,CAAC,IAC7BnB,KAAK,CAAE,GAAEmB,MAAO,aAAY,CAAC,CAC9B;AACH;AAEA,OAAO,SAASC,aAAaA,CAACC,KAAY,EAAEd,IAAY,EAAE;EACxD,OACE,OAAOc,KAAK,CAACrB,KAAK,GAAGO,IAAI,CAAC,KAAK,WAAW,IAC1C,OAAOc,KAAK,CAACrB,KAAK,GAAGF,WAAW,CAACS,IAAI,CAAC,CAAC,KAAK,WAAW;AAE3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","names":["EventPropOption","Function","Array"],"sources":["../../../src/util/component/types.ts"],"sourcesContent":["import type { EmitsOptions, ObjectEmitsOptions, PropType } from 'vue';\n\nexport type EventProp<T extends any[] = any[], F = (...args: T) => any> =\n | F\n | F[];\n\nexport const EventPropOption = <T extends any[] = any[]>() =>\n [Function, Array] as PropType<EventProp<T>>;\n\nexport type ComponentTypeEmits =\n | ((...args: any[]) => any)\n | Record<string, any[]>\n\nexport type EmitsToProps<T extends EmitsOptions | ComponentTypeEmits> =\n T extends string[]\n ? {\n [K in `on${Capitalize<T[number]>}`]?: (...args: any[]) => any\n }\n : T extends ObjectEmitsOptions\n ? {\n [K in string & keyof T as `on${Capitalize<K>}`]?: (\n ...args: T[K] extends (...args: infer P) => any\n ? P\n : T[K] extends null\n ? any[]\n : never\n ) => any\n }\n : {}\n\nexport type TypeEmitsToOptions<T extends ComponentTypeEmits> = {\n [K in keyof T & string]: T[K] extends [...args: infer Args]\n ? (...args: Args) => any\n : () => any\n} & (T extends (...args: any[]) => any\n ? ParametersToFns<OverloadParameters<T>>\n : {})\n\ntype ParametersToFns<T extends any[]> = {\n [K in T[0]]: K extends `${infer C}`\n ? (...args: T extends [C, ...infer Args] ? Args : never) => any\n : never\n}\n\nexport type OverloadParameters<T extends (...args: any[]) => any> = Parameters<\n OverloadUnion<T>\n>\n\ntype OverloadProps<TOverload> = Pick<TOverload, keyof TOverload>\n\ntype OverloadUnionRecursive<\n TOverload,\n TPartialOverload = unknown,\n> = TOverload extends (...args: infer TArgs) => infer TReturn\n ? TPartialOverload extends TOverload\n ? never\n :\n | OverloadUnionRecursive<\n TPartialOverload & TOverload,\n TPartialOverload &\n ((...args: TArgs) => TReturn) &\n OverloadProps<TOverload>\n >\n | ((...args: TArgs) => TReturn)\n : never\n\ntype OverloadUnion<TOverload extends (...args: any[]) => any> = Exclude<\n OverloadUnionRecursive<(() => never) & TOverload>,\n TOverload extends () => never ? never : () => never\n>\n"],"mappings":"AAMA,OAAO,MAAMA,eAAe,GAAGA,CAAA,KAC7B,CAACC,QAAQ,EAAEC,KAAK,CAA2B"}
|
|
1
|
+
{"version":3,"file":"types.mjs","names":["EventPropOption","Function","Array"],"sources":["../../../src/util/component/types.ts"],"sourcesContent":["import type { EmitsOptions, ObjectEmitsOptions, PropType } from 'vue';\r\n\r\nexport type EventProp<T extends any[] = any[], F = (...args: T) => any> =\r\n | F\r\n | F[];\r\n\r\nexport const EventPropOption = <T extends any[] = any[]>() =>\r\n [Function, Array] as PropType<EventProp<T>>;\r\n\r\nexport type ComponentTypeEmits =\r\n | ((...args: any[]) => any)\r\n | Record<string, any[]>\r\n\r\nexport type EmitsToProps<T extends EmitsOptions | ComponentTypeEmits> =\r\n T extends string[]\r\n ? {\r\n [K in `on${Capitalize<T[number]>}`]?: (...args: any[]) => any\r\n }\r\n : T extends ObjectEmitsOptions\r\n ? {\r\n [K in string & keyof T as `on${Capitalize<K>}`]?: (\r\n ...args: T[K] extends (...args: infer P) => any\r\n ? P\r\n : T[K] extends null\r\n ? any[]\r\n : never\r\n ) => any\r\n }\r\n : {}\r\n\r\nexport type TypeEmitsToOptions<T extends ComponentTypeEmits> = {\r\n [K in keyof T & string]: T[K] extends [...args: infer Args]\r\n ? (...args: Args) => any\r\n : () => any\r\n} & (T extends (...args: any[]) => any\r\n ? ParametersToFns<OverloadParameters<T>>\r\n : {})\r\n\r\ntype ParametersToFns<T extends any[]> = {\r\n [K in T[0]]: K extends `${infer C}`\r\n ? (...args: T extends [C, ...infer Args] ? Args : never) => any\r\n : never\r\n}\r\n\r\nexport type OverloadParameters<T extends (...args: any[]) => any> = Parameters<\r\n OverloadUnion<T>\r\n>\r\n\r\ntype OverloadProps<TOverload> = Pick<TOverload, keyof TOverload>\r\n\r\ntype OverloadUnionRecursive<\r\n TOverload,\r\n TPartialOverload = unknown,\r\n> = TOverload extends (...args: infer TArgs) => infer TReturn\r\n ? TPartialOverload extends TOverload\r\n ? never\r\n :\r\n | OverloadUnionRecursive<\r\n TPartialOverload & TOverload,\r\n TPartialOverload &\r\n ((...args: TArgs) => TReturn) &\r\n OverloadProps<TOverload>\r\n >\r\n | ((...args: TArgs) => TReturn)\r\n : never\r\n\r\ntype OverloadUnion<TOverload extends (...args: any[]) => any> = Exclude<\r\n OverloadUnionRecursive<(() => never) & TOverload>,\r\n TOverload extends () => never ? never : () => never\r\n>\r\n"],"mappings":"AAMA,OAAO,MAAMA,eAAe,GAAGA,CAAA,KAC7B,CAACC,QAAQ,EAAEC,KAAK,CAA2B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["YuyeonDateAdapter","createDateAdapter"],"sources":["../../../src/util/date/index.ts"],"sourcesContent":["export * from './built-in';\nexport { YuyeonDateAdapter } from './adapters/yuyeon-date-adapter';\n\nexport function createDateAdapter() {}\n"],"mappings":";SACSA,iBAAiB;AAE1B,OAAO,SAASC,iBAAiBA,CAAA,EAAG,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["YuyeonDateAdapter","createDateAdapter"],"sources":["../../../src/util/date/index.ts"],"sourcesContent":["export * from './built-in';\r\nexport { YuyeonDateAdapter } from './adapters/yuyeon-date-adapter';\r\n\r\nexport function createDateAdapter() {}\r\n"],"mappings":";SACSA,iBAAiB;AAE1B,OAAO,SAASC,iBAAiBA,CAAA,EAAG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","names":[],"sources":["../../../src/util/date/types.ts"],"sourcesContent":["export interface DateAdapter<T = unknown> {\n /**\n *\n * @param value\n */\n date(value?: any): T | null;\n\n /**\n *\n * @param date\n * @param formatString\n */\n format(date: T, formatString: string): string;\n\n /**\n *\n * @param value\n */\n toJsDate(value: T): Date;\n\n /**\n *\n * @param date\n */\n parseISO(date: string): T;\n\n /**\n *\n * @param date\n */\n toISO(date: T): string;\n\n /**\n *\n * @param date\n */\n startOfDay(date: T): T;\n\n /**\n *\n * @param date\n */\n endOfDay(date: T): T;\n\n /**\n *\n * @param date\n */\n startOfMonth(date: T): T;\n\n /**\n *\n * @param date\n */\n endOfMonth(date: T): T;\n\n /**\n *\n * @param date\n */\n startOfYear(date: T): T;\n\n /**\n *\n * @param date\n */\n endOfYear(date: T): T;\n\n /**\n *\n * @param date\n * @param comparing\n */\n isBefore(date: T, comparing: T): boolean;\n\n /**\n *\n * @param date\n * @param comparing\n */\n isAfter(date: T, comparing: T): boolean;\n\n /**\n *\n * @param date\n * @param comparing\n */\n isEqual(date: T, comparing: T): boolean;\n\n /**\n *\n * @param date\n * @param comparing\n */\n isSameDay(date: T, comparing: T): boolean;\n\n /**\n *\n * @param date\n * @param comparing\n */\n isSameMonth(date: T, comparing: T): boolean;\n\n /**\n *\n * @param date\n */\n isValid(date: any): boolean;\n\n /**\n *\n * @param date\n * @param range\n */\n isWithinRange(date: T, range: [T, T]): boolean;\n\n /**\n *\n * @param date\n * @param amount\n */\n addDays(date: T, amount: number): T;\n\n /**\n *\n * @param date\n * @param amount\n */\n addMonths(date: T, amount: number): T;\n\n /**\n *\n * @param date\n */\n getYear(date: T): number;\n\n /**\n *\n * @param date\n * @param year\n */\n setYear(date: T, year: number): T;\n\n /**\n *\n * @param date\n * @param comparing\n * @param unit\n */\n getDiff(date: T, comparing: T | string, unit?: string): number;\n\n /**\n *\n *\n * @param date\n */\n getWeekArray(date: T): T[][];\n\n /**\n *\n */\n getWeekdays(): string[];\n\n /**\n * 0 ~ 11\n * @param date\n */\n getMonth(date: T): number;\n\n /**\n *\n * @param date\n * @param month\n */\n setMonth(date: T, month: number): T;\n\n /**\n *\n * get day (1-31) number\n *\n * @param date\n */\n getDay(date: T): number;\n\n /**\n *\n * @param date\n */\n getNextMonth(date: T): T;\n\n getHour(date: T): number;\n\n setHour(date: T, hour: number): T;\n\n getMinute(date: T): number;\n\n setMinute(date:T, minute: number): T;\n}\n\nexport type DateFormatOptions =\n | Intl.DateTimeFormatOptions\n | ((date: Date, formatString: string, locale: string) => string);\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.mjs","names":[],"sources":["../../../src/util/date/types.ts"],"sourcesContent":["export interface DateAdapter<T = unknown> {\r\n /**\r\n *\r\n * @param value\r\n */\r\n date(value?: any): T | null;\r\n\r\n /**\r\n *\r\n * @param date\r\n * @param formatString\r\n */\r\n format(date: T, formatString: string): string;\r\n\r\n /**\r\n *\r\n * @param value\r\n */\r\n toJsDate(value: T): Date;\r\n\r\n /**\r\n *\r\n * @param date\r\n */\r\n parseISO(date: string): T;\r\n\r\n /**\r\n *\r\n * @param date\r\n */\r\n toISO(date: T): string;\r\n\r\n /**\r\n *\r\n * @param date\r\n */\r\n startOfDay(date: T): T;\r\n\r\n /**\r\n *\r\n * @param date\r\n */\r\n endOfDay(date: T): T;\r\n\r\n /**\r\n *\r\n * @param date\r\n */\r\n startOfMonth(date: T): T;\r\n\r\n /**\r\n *\r\n * @param date\r\n */\r\n endOfMonth(date: T): T;\r\n\r\n /**\r\n *\r\n * @param date\r\n */\r\n startOfYear(date: T): T;\r\n\r\n /**\r\n *\r\n * @param date\r\n */\r\n endOfYear(date: T): T;\r\n\r\n /**\r\n *\r\n * @param date\r\n * @param comparing\r\n */\r\n isBefore(date: T, comparing: T): boolean;\r\n\r\n /**\r\n *\r\n * @param date\r\n * @param comparing\r\n */\r\n isAfter(date: T, comparing: T): boolean;\r\n\r\n /**\r\n *\r\n * @param date\r\n * @param comparing\r\n */\r\n isEqual(date: T, comparing: T): boolean;\r\n\r\n /**\r\n *\r\n * @param date\r\n * @param comparing\r\n */\r\n isSameDay(date: T, comparing: T): boolean;\r\n\r\n /**\r\n *\r\n * @param date\r\n * @param comparing\r\n */\r\n isSameMonth(date: T, comparing: T): boolean;\r\n\r\n /**\r\n *\r\n * @param date\r\n */\r\n isValid(date: any): boolean;\r\n\r\n /**\r\n *\r\n * @param date\r\n * @param range\r\n */\r\n isWithinRange(date: T, range: [T, T]): boolean;\r\n\r\n /**\r\n *\r\n * @param date\r\n * @param amount\r\n */\r\n addDays(date: T, amount: number): T;\r\n\r\n /**\r\n *\r\n * @param date\r\n * @param amount\r\n */\r\n addMonths(date: T, amount: number): T;\r\n\r\n /**\r\n *\r\n * @param date\r\n */\r\n getYear(date: T): number;\r\n\r\n /**\r\n *\r\n * @param date\r\n * @param year\r\n */\r\n setYear(date: T, year: number): T;\r\n\r\n /**\r\n *\r\n * @param date\r\n * @param comparing\r\n * @param unit\r\n */\r\n getDiff(date: T, comparing: T | string, unit?: string): number;\r\n\r\n /**\r\n *\r\n *\r\n * @param date\r\n */\r\n getWeekArray(date: T): T[][];\r\n\r\n /**\r\n *\r\n */\r\n getWeekdays(): string[];\r\n\r\n /**\r\n * 0 ~ 11\r\n * @param date\r\n */\r\n getMonth(date: T): number;\r\n\r\n /**\r\n *\r\n * @param date\r\n * @param month\r\n */\r\n setMonth(date: T, month: number): T;\r\n\r\n /**\r\n *\r\n * get day (1-31) number\r\n *\r\n * @param date\r\n */\r\n getDay(date: T): number;\r\n\r\n /**\r\n *\r\n * @param date\r\n */\r\n getNextMonth(date: T): T;\r\n\r\n getHour(date: T): number;\r\n\r\n setHour(date: T, hour: number): T;\r\n\r\n getMinute(date: T): number;\r\n\r\n setMinute(date:T, minute: number): T;\r\n}\r\n\r\nexport type DateFormatOptions =\r\n | Intl.DateTimeFormatOptions\r\n | ((date: Date, formatString: string, locale: string) => string);\r\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debounce.mjs","names":["isObject","debounce","func","wait","arguments","length","undefined","options","leading","trailing","lastArgs","lastThis","maxWait","result","timerId","lastCallTime","lastInvokeTime","maxing","TypeError","Math","max","invokeFunc","time","args","thisArg","apply","leadingEdge","window","setTimeout","timerExpired","remainingWait","timeSinceLastCall","timeSinceLastInvoke","timeWaiting","min","shouldInvoke","Date","now","trailingEdge","cancel","clearTimeout","flush","debounced","isInvoking"],"sources":["../../src/util/debounce.ts"],"sourcesContent":["import { isObject } from \"./common\";\n\ninterface DebouncedFn<T extends (...args: any[]) => any> {\n (...args: Parameters<T>): ReturnType<T> | undefined;\n cancel(): void;\n flush(): ReturnType<T> | undefined;\n}\n\ninterface DebounceSettings {\n leading?: boolean | undefined;\n maxWait?: number | undefined;\n trailing?: boolean | undefined;\n}\ninterface DebounceSettingsLeading extends DebounceSettings {\n leading: true;\n}\n\ninterface DebouncedFuncLeading<T extends (...args: any[]) => any>\n extends DebouncedFn<T> {\n (...args: Parameters<T>): ReturnType<T>;\n flush(): ReturnType<T>;\n}\n\nexport function debounce<T extends (...args: any[]) => any>(\n func: T,\n wait = 0,\n options: { leading: boolean; maxWait?: number; trailing: boolean } = {\n leading: false,\n trailing: true,\n },\n): DebouncedFn<T> {\n let lastArgs: any;\n let lastThis: DebouncedFn<T> | undefined;\n let maxWait: number = 0;\n let result: ReturnType<T> | undefined;\n let timerId: number | undefined = undefined;\n let lastCallTime: number | undefined = undefined;\n let lastInvokeTime: number | undefined = 0;\n let leading = false;\n let maxing = false;\n let trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError('NOT Function');\n }\n wait = +wait || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? Math.max(+(options?.maxWait || 0), wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time?: number) {\n const args = lastArgs;\n const thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time?: number) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = window.setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time: number) {\n var timeSinceLastCall = time - (lastCallTime ?? 0),\n timeSinceLastInvoke = time - (lastInvokeTime ?? 0),\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? Math.min(timeWaiting, (maxWait ?? 0) - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time: number) {\n var timeSinceLastCall = time - (lastCallTime ?? 0),\n timeSinceLastInvoke = time - (lastInvokeTime ?? 0);\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (\n lastCallTime === undefined ||\n timeSinceLastCall >= wait ||\n timeSinceLastCall < 0 ||\n (maxing && timeSinceLastInvoke >= (maxWait ?? 0))\n );\n }\n\n function timerExpired() {\n const time = Date.now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = window.setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time: number) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(Date.now());\n }\n\n function debounced(this: DebouncedFn<T>): (ReturnType<T> | undefined) {\n const time = Date.now();\n const isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = window.setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = window.setTimeout(timerExpired, wait);\n }\n return result;\n }\n\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n"],"mappings":"SAASA,QAAQ;AAuBjB,OAAO,SAASC,QAAQA,CACtBC,IAAO,EAMS;EAAA,IALhBC,IAAI,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAAA,IACRG,OAAkE,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG;IACnEI,OAAO,EAAE,KAAK;IACdC,QAAQ,EAAE;EACZ,CAAC;EAED,IAAIC,QAAa;EACjB,IAAIC,QAAoC;EACxC,IAAIC,OAAe,GAAG,CAAC;EACvB,IAAIC,MAAiC;EACrC,IAAIC,OAA2B,GAAGR,SAAS;EAC3C,IAAIS,YAAgC,GAAGT,SAAS;EAChD,IAAIU,cAAkC,GAAG,CAAC;EAC1C,IAAIR,OAAO,GAAG,KAAK;EACnB,IAAIS,MAAM,GAAG,KAAK;EAClB,IAAIR,QAAQ,GAAG,IAAI;EAEnB,IAAI,OAAOP,IAAI,IAAI,UAAU,EAAE;IAC7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G,CAAC,CAAC,CAAC;EAClE;EAEA,SAASK,SAASA,CAAA,EAAoD;IACpE,MAAMpB,IAAI,GAAGc,IAAI,CAACC,GAAG,CAAC,CAAC;IACvB,MAAMM,UAAU,GAAGR,YAAY,CAACb,IAAI,CAAC;IAErCZ,QAAQ,GAAGN,SAAS;IACpBO,QAAQ,GAAG,IAAI;IACfI,YAAY,GAAGO,IAAI;IAEnB,IAAIqB,UAAU,EAAE;MACd,IAAI7B,OAAO,KAAKR,SAAS,EAAE;QACzB,OAAOoB,WAAW,CAACX,YAAY,CAAC;MAClC;MACA,IAAIE,MAAM,EAAE;QACV;QACAuB,YAAY,CAAC1B,OAAO,CAAC;QACrBA,OAAO,GAAGa,MAAM,CAACC,UAAU,CAACC,YAAY,EAAE1B,IAAI,CAAC;QAC/C,OAAOkB,UAAU,CAACN,YAAY,CAAC;MACjC;IACF;IACA,IAAID,OAAO,KAAKR,SAAS,EAAE;MACzBQ,OAAO,GAAGa,MAAM,CAACC,UAAU,CAACC,YAAY,EAAE1B,IAAI,CAAC;IACjD;IACA,OAAOU,MAAM;EACf;EAEA6B,SAAS,CAACH,MAAM,GAAGA,MAAM;EACzBG,SAAS,CAACD,KAAK,GAAGA,KAAK;EACvB,OAAOC,SAAS;AAClB"}
|
|
1
|
+
{"version":3,"file":"debounce.mjs","names":["isObject","debounce","func","wait","arguments","length","undefined","options","leading","trailing","lastArgs","lastThis","maxWait","result","timerId","lastCallTime","lastInvokeTime","maxing","TypeError","Math","max","invokeFunc","time","args","thisArg","apply","leadingEdge","window","setTimeout","timerExpired","remainingWait","timeSinceLastCall","timeSinceLastInvoke","timeWaiting","min","shouldInvoke","Date","now","trailingEdge","cancel","clearTimeout","flush","debounced","isInvoking"],"sources":["../../src/util/debounce.ts"],"sourcesContent":["import { isObject } from \"./common\";\r\n\r\ninterface DebouncedFn<T extends (...args: any[]) => any> {\r\n (...args: Parameters<T>): ReturnType<T> | undefined;\r\n cancel(): void;\r\n flush(): ReturnType<T> | undefined;\r\n}\r\n\r\ninterface DebounceSettings {\r\n leading?: boolean | undefined;\r\n maxWait?: number | undefined;\r\n trailing?: boolean | undefined;\r\n}\r\ninterface DebounceSettingsLeading extends DebounceSettings {\r\n leading: true;\r\n}\r\n\r\ninterface DebouncedFuncLeading<T extends (...args: any[]) => any>\r\n extends DebouncedFn<T> {\r\n (...args: Parameters<T>): ReturnType<T>;\r\n flush(): ReturnType<T>;\r\n}\r\n\r\nexport function debounce<T extends (...args: any[]) => any>(\r\n func: T,\r\n wait = 0,\r\n options: { leading: boolean; maxWait?: number; trailing: boolean } = {\r\n leading: false,\r\n trailing: true,\r\n },\r\n): DebouncedFn<T> {\r\n let lastArgs: any;\r\n let lastThis: DebouncedFn<T> | undefined;\r\n let maxWait: number = 0;\r\n let result: ReturnType<T> | undefined;\r\n let timerId: number | undefined = undefined;\r\n let lastCallTime: number | undefined = undefined;\r\n let lastInvokeTime: number | undefined = 0;\r\n let leading = false;\r\n let maxing = false;\r\n let trailing = true;\r\n\r\n if (typeof func != 'function') {\r\n throw new TypeError('NOT Function');\r\n }\r\n wait = +wait || 0;\r\n if (isObject(options)) {\r\n leading = !!options.leading;\r\n maxing = 'maxWait' in options;\r\n maxWait = maxing ? Math.max(+(options?.maxWait || 0), wait) : maxWait;\r\n trailing = 'trailing' in options ? !!options.trailing : trailing;\r\n }\r\n\r\n function invokeFunc(time?: number) {\r\n const args = lastArgs;\r\n const thisArg = lastThis;\r\n\r\n lastArgs = lastThis = undefined;\r\n lastInvokeTime = time;\r\n result = func.apply(thisArg, args);\r\n return result;\r\n }\r\n\r\n function leadingEdge(time?: number) {\r\n // Reset any `maxWait` timer.\r\n lastInvokeTime = time;\r\n // Start the timer for the trailing edge.\r\n timerId = window.setTimeout(timerExpired, wait);\r\n // Invoke the leading edge.\r\n return leading ? invokeFunc(time) : result;\r\n }\r\n\r\n function remainingWait(time: number) {\r\n var timeSinceLastCall = time - (lastCallTime ?? 0),\r\n timeSinceLastInvoke = time - (lastInvokeTime ?? 0),\r\n timeWaiting = wait - timeSinceLastCall;\r\n\r\n return maxing\r\n ? Math.min(timeWaiting, (maxWait ?? 0) - timeSinceLastInvoke)\r\n : timeWaiting;\r\n }\r\n\r\n function shouldInvoke(time: number) {\r\n var timeSinceLastCall = time - (lastCallTime ?? 0),\r\n timeSinceLastInvoke = time - (lastInvokeTime ?? 0);\r\n\r\n // Either this is the first call, activity has stopped and we're at the\r\n // trailing edge, the system time has gone backwards and we're treating\r\n // it as the trailing edge, or we've hit the `maxWait` limit.\r\n return (\r\n lastCallTime === undefined ||\r\n timeSinceLastCall >= wait ||\r\n timeSinceLastCall < 0 ||\r\n (maxing && timeSinceLastInvoke >= (maxWait ?? 0))\r\n );\r\n }\r\n\r\n function timerExpired() {\r\n const time = Date.now();\r\n if (shouldInvoke(time)) {\r\n return trailingEdge(time);\r\n }\r\n // Restart the timer.\r\n timerId = window.setTimeout(timerExpired, remainingWait(time));\r\n }\r\n\r\n function trailingEdge(time: number) {\r\n timerId = undefined;\r\n\r\n // Only invoke if we have `lastArgs` which means `func` has been\r\n // debounced at least once.\r\n if (trailing && lastArgs) {\r\n return invokeFunc(time);\r\n }\r\n lastArgs = lastThis = undefined;\r\n return result;\r\n }\r\n\r\n function cancel() {\r\n if (timerId !== undefined) {\r\n clearTimeout(timerId);\r\n }\r\n lastInvokeTime = 0;\r\n lastArgs = lastCallTime = lastThis = timerId = undefined;\r\n }\r\n\r\n function flush() {\r\n return timerId === undefined ? result : trailingEdge(Date.now());\r\n }\r\n\r\n function debounced(this: DebouncedFn<T>): (ReturnType<T> | undefined) {\r\n const time = Date.now();\r\n const isInvoking = shouldInvoke(time);\r\n\r\n lastArgs = arguments;\r\n lastThis = this;\r\n lastCallTime = time;\r\n\r\n if (isInvoking) {\r\n if (timerId === undefined) {\r\n return leadingEdge(lastCallTime);\r\n }\r\n if (maxing) {\r\n // Handle invocations in a tight loop.\r\n clearTimeout(timerId);\r\n timerId = window.setTimeout(timerExpired, wait);\r\n return invokeFunc(lastCallTime);\r\n }\r\n }\r\n if (timerId === undefined) {\r\n timerId = window.setTimeout(timerExpired, wait);\r\n }\r\n return result;\r\n }\r\n\r\n debounced.cancel = cancel;\r\n debounced.flush = flush;\r\n return debounced;\r\n}\r\n"],"mappings":"SAASA,QAAQ;AAuBjB,OAAO,SAASC,QAAQA,CACtBC,IAAO,EAMS;EAAA,IALhBC,IAAI,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAAA,IACRG,OAAkE,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG;IACnEI,OAAO,EAAE,KAAK;IACdC,QAAQ,EAAE;EACZ,CAAC;EAED,IAAIC,QAAa;EACjB,IAAIC,QAAoC;EACxC,IAAIC,OAAe,GAAG,CAAC;EACvB,IAAIC,MAAiC;EACrC,IAAIC,OAA2B,GAAGR,SAAS;EAC3C,IAAIS,YAAgC,GAAGT,SAAS;EAChD,IAAIU,cAAkC,GAAG,CAAC;EAC1C,IAAIR,OAAO,GAAG,KAAK;EACnB,IAAIS,MAAM,GAAG,KAAK;EAClB,IAAIR,QAAQ,GAAG,IAAI;EAEnB,IAAI,OAAOP,IAAI,IAAI,UAAU,EAAE;IAC7B,MAAM,IAAIgB,SAAS,CAAC,cAAc,CAAC;EACrC;EACAf,IAAI,GAAG,CAACA,IAAI,IAAI,CAAC;EACjB,IAAIH,QAAQ,CAACO,OAAO,CAAC,EAAE;IACrBC,OAAO,GAAG,CAAC,CAACD,OAAO,CAACC,OAAO;IAC3BS,MAAM,GAAG,SAAS,IAAIV,OAAO;IAC7BK,OAAO,GAAGK,MAAM,GAAGE,IAAI,CAACC,GAAG,CAAC,EAAEb,OAAO,EAAEK,OAAO,IAAI,CAAC,CAAC,EAAET,IAAI,CAAC,GAAGS,OAAO;IACrEH,QAAQ,GAAG,UAAU,IAAIF,OAAO,GAAG,CAAC,CAACA,OAAO,CAACE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,OAAO,GAAGa,MAAM,CAACC,UAAU,CAACC,YAAY,EAAE1B,IAAI,CAAC;QAC/C,OAAOkB,UAAU,CAACN,YAAY,CAAC;MACjC;IACF;IACA,IAAID,OAAO,KAAKR,SAAS,EAAE;MACzBQ,OAAO,GAAGa,MAAM,CAACC,UAAU,CAACC,YAAY,EAAE1B,IAAI,CAAC;IACjD;IACA,OAAOU,MAAM;EACf;EAEA6B,SAAS,CAACH,MAAM,GAAGA,MAAM;EACzBG,SAAS,CAACD,KAAK,GAAGA,KAAK;EACvB,OAAOC,SAAS;AAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environments.mjs","names":["IS_BROWSER","window","Environments","isBrowser","canUseIntersectionObserver","canUseResizeObserver"],"sources":["../../src/util/environments.ts"],"sourcesContent":["const IS_BROWSER = typeof window !== 'undefined';\nconst Environments = {\n isBrowser: IS_BROWSER,\n canUseIntersectionObserver: IS_BROWSER && 'IntersectionObserver' in window,\n canUseResizeObserver: IS_BROWSER && 'ResizeObserver' in window,\n};\n\nexport default Environments;\n"],"mappings":"AAAA,MAAMA,UAAU,GAAG,OAAOC,MAAM,KAAK,WAAW;AAChD,MAAMC,YAAY,GAAG;EACnBC,SAAS,EAAEH,UAAU;EACrBI,0BAA0B,EAAEJ,UAAU,IAAI,sBAAsB,IAAIC,MAAM;EAC1EI,oBAAoB,EAAEL,UAAU,IAAI,gBAAgB,IAAIC;AAC1D,CAAC;AAED,eAAeC,YAAY"}
|
|
1
|
+
{"version":3,"file":"environments.mjs","names":["IS_BROWSER","window","Environments","isBrowser","canUseIntersectionObserver","canUseResizeObserver"],"sources":["../../src/util/environments.ts"],"sourcesContent":["const IS_BROWSER = typeof window !== 'undefined';\r\nconst Environments = {\r\n isBrowser: IS_BROWSER,\r\n canUseIntersectionObserver: IS_BROWSER && 'IntersectionObserver' in window,\r\n canUseResizeObserver: IS_BROWSER && 'ResizeObserver' in window,\r\n};\r\n\r\nexport default Environments;\r\n"],"mappings":"AAAA,MAAMA,UAAU,GAAG,OAAOC,MAAM,KAAK,WAAW;AAChD,MAAMC,YAAY,GAAG;EACnBC,SAAS,EAAEH,UAAU;EACrBI,0BAA0B,EAAEJ,UAAU,IAAI,sBAAsB,IAAIC,MAAM;EAC1EI,oBAAoB,EAAEL,UAAU,IAAI,gBAAgB,IAAIC;AAC1D,CAAC;AAED,eAAeC,YAAY"}
|
package/lib/util/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/util/index.ts"],"sourcesContent":["export * from './common';\nexport * from './collection';\nexport * from './array';\nexport * from './string';\nexport * from './validation';\nexport * from './debounce';\nexport * from './dom';\nexport * from './ui';\nexport * from './rect';\nexport * from './anchor';\nexport * from './scroll';\nexport * from './frame-scheduler';\nexport * from './component';\nexport * from './reactivity';\nexport * from './color';\nexport * from './date';\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/util/index.ts"],"sourcesContent":["export * from './common';\r\nexport * from './collection';\r\nexport * from './array';\r\nexport * from './string';\r\nexport * from './validation';\r\nexport * from './debounce';\r\nexport * from './dom';\r\nexport * from './ui';\r\nexport * from './rect';\r\nexport * from './anchor';\r\nexport * from './scroll';\r\nexport * from './frame-scheduler';\r\nexport * from './component';\r\nexport * from './reactivity';\r\nexport * from './color';\r\nexport * from './date';\r\n"],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export function simpleBraceParse(input) {
|
|
2
|
+
const pattern = /\{([^{}]+)\}/g;
|
|
3
|
+
const results = [];
|
|
4
|
+
let match;
|
|
5
|
+
let pointer = 0;
|
|
6
|
+
while ((match = pattern.exec(input)) !== null) {
|
|
7
|
+
const variable = match[1];
|
|
8
|
+
const start = match.index;
|
|
9
|
+
const end = pattern.lastIndex;
|
|
10
|
+
if (start > 0) {
|
|
11
|
+
const prevText = input.substring(pointer, start);
|
|
12
|
+
results.push({
|
|
13
|
+
type: 'text',
|
|
14
|
+
content: prevText
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
if (variable.trim()) {
|
|
18
|
+
results.push({
|
|
19
|
+
type: 'variable',
|
|
20
|
+
content: variable.trim()
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
pointer = end;
|
|
24
|
+
}
|
|
25
|
+
results.push({
|
|
26
|
+
type: 'text',
|
|
27
|
+
content: input.substring(pointer, input.length)
|
|
28
|
+
});
|
|
29
|
+
return results;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=parser.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.mjs","names":["simpleBraceParse","input","pattern","results","match","pointer","exec","variable","start","index","end","lastIndex","prevText","substring","push","type","content","trim","length"],"sources":["../../src/util/parser.ts"],"sourcesContent":["export function simpleBraceParse(input: string) {\r\n const pattern = /\\{([^{}]+)\\}/g;\r\n const results = [];\r\n let match;\r\n let pointer = 0;\r\n\r\n while ((match = pattern.exec(input)) !== null) {\r\n const variable = match[1];\r\n const start = match.index;\r\n const end = pattern.lastIndex;\r\n if (start > 0) {\r\n const prevText = input.substring(pointer, start);\r\n results.push({\r\n type: 'text',\r\n content: prevText,\r\n });\r\n }\r\n if (variable.trim()) {\r\n results.push({\r\n type: 'variable',\r\n content: variable.trim(),\r\n });\r\n }\r\n\r\n pointer = end;\r\n }\r\n\r\n results.push({\r\n type: 'text',\r\n content: input.substring(pointer, input.length),\r\n });\r\n\r\n return results;\r\n}\r\n"],"mappings":"AAAA,OAAO,SAASA,gBAAgBA,CAACC,KAAa,EAAE;EAC9C,MAAMC,OAAO,GAAG,eAAe;EAC/B,MAAMC,OAAO,GAAG,EAAE;EAClB,IAAIC,KAAK;EACT,IAAIC,OAAO,GAAG,CAAC;EAEf,OAAO,CAACD,KAAK,GAAGF,OAAO,CAACI,IAAI,CAACL,KAAK,CAAC,MAAM,IAAI,EAAE;IAC7C,MAAMM,QAAQ,GAAGH,KAAK,CAAC,CAAC,CAAC;IACzB,MAAMI,KAAK,GAAGJ,KAAK,CAACK,KAAK;IACzB,MAAMC,GAAG,GAAGR,OAAO,CAACS,SAAS;IAC7B,IAAIH,KAAK,GAAG,CAAC,EAAE;MACb,MAAMI,QAAQ,GAAGX,KAAK,CAACY,SAAS,CAACR,OAAO,EAAEG,KAAK,CAAC;MAChDL,OAAO,CAACW,IAAI,CAAC;QACXC,IAAI,EAAE,MAAM;QACZC,OAAO,EAAEJ;MACX,CAAC,CAAC;IACJ;IACA,IAAIL,QAAQ,CAACU,IAAI,CAAC,CAAC,EAAE;MACnBd,OAAO,CAACW,IAAI,CAAC;QACXC,IAAI,EAAE,UAAU;QAChBC,OAAO,EAAET,QAAQ,CAACU,IAAI,CAAC;MACzB,CAAC,CAAC;IACJ;IAEAZ,OAAO,GAAGK,GAAG;EACf;EAEAP,OAAO,CAACW,IAAI,CAAC;IACXC,IAAI,EAAE,MAAM;IACZC,OAAO,EAAEf,KAAK,CAACY,SAAS,CAACR,OAAO,EAAEJ,KAAK,CAACiB,MAAM;EAChD,CAAC,CAAC;EAEF,OAAOf,OAAO;AAChB"}
|
package/lib/util/reactivity.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactivity.mjs","names":["computed","reactive","toRefs","watchEffect","$computed","getter","refs","base","key","value","flush"],"sources":["../../src/util/reactivity.ts"],"sourcesContent":["import {\n type ComputedGetter,\n computed,\n reactive,\n toRefs,\n watchEffect,\n} from 'vue';\n\n/**\n * For Destructuring assignment\n * @param getter\n */\nexport function $computed<T extends object>(getter: ComputedGetter<T>) {\n const refs = reactive({}) as T;\n const base = computed(getter);\n watchEffect(\n () => {\n for (const key in base.value) {\n refs[key] = base.value[key];\n }\n },\n { flush: 'sync' },\n );\n return toRefs(refs);\n}\n"],"mappings":"AAAA,SAEEA,QAAQ,EACRC,QAAQ,EACRC,MAAM,EACNC,WAAW,QACN,KAAK;;AAEZ;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAAmBC,MAAyB,EAAE;EACrE,MAAMC,IAAI,GAAGL,QAAQ,CAAC,CAAC,CAAC,CAAM;EAC9B,MAAMM,IAAI,GAAGP,QAAQ,CAACK,MAAM,CAAC;EAC7BF,WAAW,CACT,MAAM;IACJ,KAAK,MAAMK,GAAG,IAAID,IAAI,CAACE,KAAK,EAAE;MAC5BH,IAAI,CAACE,GAAG,CAAC,GAAGD,IAAI,CAACE,KAAK,CAACD,GAAG,CAAC;IAC7B;EACF,CAAC,EACD;IAAEE,KAAK,EAAE;EAAO,CAClB,CAAC;EACD,OAAOR,MAAM,CAACI,IAAI,CAAC;AACrB"}
|
|
1
|
+
{"version":3,"file":"reactivity.mjs","names":["computed","reactive","toRefs","watchEffect","$computed","getter","refs","base","key","value","flush"],"sources":["../../src/util/reactivity.ts"],"sourcesContent":["import {\r\n type ComputedGetter,\r\n computed,\r\n reactive,\r\n toRefs,\r\n watchEffect,\r\n} from 'vue';\r\n\r\n/**\r\n * For Destructuring assignment\r\n * @param getter\r\n */\r\nexport function $computed<T extends object>(getter: ComputedGetter<T>) {\r\n const refs = reactive({}) as T;\r\n const base = computed(getter);\r\n watchEffect(\r\n () => {\r\n for (const key in base.value) {\r\n refs[key] = base.value[key];\r\n }\r\n },\r\n { flush: 'sync' },\r\n );\r\n return toRefs(refs);\r\n}\r\n"],"mappings":"AAAA,SAEEA,QAAQ,EACRC,QAAQ,EACRC,MAAM,EACNC,WAAW,QACN,KAAK;;AAEZ;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAAmBC,MAAyB,EAAE;EACrE,MAAMC,IAAI,GAAGL,QAAQ,CAAC,CAAC,CAAC,CAAM;EAC9B,MAAMM,IAAI,GAAGP,QAAQ,CAACK,MAAM,CAAC;EAC7BF,WAAW,CACT,MAAM;IACJ,KAAK,MAAMK,GAAG,IAAID,IAAI,CAACE,KAAK,EAAE;MAC5BH,IAAI,CAACE,GAAG,CAAC,GAAGD,IAAI,CAACE,KAAK,CAACD,GAAG,CAAC;IAC7B;EACF,CAAC,EACD;IAAEE,KAAK,EAAE;EAAO,CAClB,CAAC;EACD,OAAOR,MAAM,CAACI,IAAI,CAAC;AACrB"}
|
package/lib/util/rect.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rect.mjs","names":["MutableRect","constructor","_ref","x","y","width","height","top","bottom","left","right","getOverflow","a","b","before","Math","max","after"],"sources":["../../src/util/rect.ts"],"sourcesContent":["export interface Rect {\n x: number;\n y: number;\n width: number;\n height: number;\n\n get top(): number;\n get bottom(): number;\n get left(): number;\n get right(): number;\n}\n\nexport class MutableRect implements Rect {\n public x: number;\n\n public y: number;\n\n public width: number;\n\n public height: number;\n\n constructor({\n x,\n y,\n width,\n height,\n }: {\n x: number;\n y: number;\n width: number;\n height: number;\n }) {\n this.x = x ?? 0;\n this.y = y ?? 0;\n this.width = width ?? 0;\n this.height = height ?? 0;\n }\n\n public get top(): number {\n return this.y;\n }\n\n public get bottom(): number {\n return this.y + this.height;\n }\n\n public get left(): number {\n return this.x;\n }\n\n public get right(): number {\n return this.x + this.width;\n }\n}\n\nexport function getOverflow(a: MutableRect, b: MutableRect) {\n return {\n x: {\n before: Math.max(0, b.left - a.left),\n after: Math.max(0, a.right - b.right),\n },\n y: {\n before: Math.max(0, b.top - a.top),\n after: Math.max(0, a.bottom - b.bottom),\n },\n };\n}\n"],"mappings":"AAYA,OAAO,MAAMA,WAAW,CAAiB;EASvCC,WAAWA,CAAAC,IAAA,EAUR;IAAA,IAVS;MACVC,CAAC;MACDC,CAAC;MACDC,KAAK;MACLC;IAMF,CAAC,GAAAJ,IAAA;IACC,IAAI,CAACC,CAAC,GAAGA,CAAC,IAAI,CAAC;IACf,IAAI,CAACC,CAAC,GAAGA,CAAC,IAAI,CAAC;IACf,IAAI,CAACC,KAAK,GAAGA,KAAK,IAAI,CAAC;IACvB,IAAI,CAACC,MAAM,GAAGA,MAAM,IAAI,CAAC;EAC3B;EAEA,IAAWC,GAAGA,CAAA,EAAW;IACvB,OAAO,IAAI,CAACH,CAAC;EACf;EAEA,IAAWI,MAAMA,CAAA,EAAW;IAC1B,OAAO,IAAI,CAACJ,CAAC,GAAG,IAAI,CAACE,MAAM;EAC7B;EAEA,IAAWG,IAAIA,CAAA,EAAW;IACxB,OAAO,IAAI,CAACN,CAAC;EACf;EAEA,IAAWO,KAAKA,CAAA,EAAW;IACzB,OAAO,IAAI,CAACP,CAAC,GAAG,IAAI,CAACE,KAAK;EAC5B;AACF;AAEA,OAAO,SAASM,WAAWA,CAACC,CAAc,EAAEC,CAAc,EAAE;EAC1D,OAAO;IACLV,CAAC,EAAE;MACDW,MAAM,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEH,CAAC,CAACJ,IAAI,GAAGG,CAAC,CAACH,IAAI,CAAC;MACpCQ,KAAK,EAAEF,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEJ,CAAC,CAACF,KAAK,GAAGG,CAAC,CAACH,KAAK;IACtC,CAAC;IACDN,CAAC,EAAE;MACDU,MAAM,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEH,CAAC,CAACN,GAAG,GAAGK,CAAC,CAACL,GAAG,CAAC;MAClCU,KAAK,EAAEF,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEJ,CAAC,CAACJ,MAAM,GAAGK,CAAC,CAACL,MAAM;IACxC;EACF,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"rect.mjs","names":["MutableRect","constructor","_ref","x","y","width","height","top","bottom","left","right","getOverflow","a","b","before","Math","max","after"],"sources":["../../src/util/rect.ts"],"sourcesContent":["export interface Rect {\r\n x: number;\r\n y: number;\r\n width: number;\r\n height: number;\r\n\r\n get top(): number;\r\n get bottom(): number;\r\n get left(): number;\r\n get right(): number;\r\n}\r\n\r\nexport class MutableRect implements Rect {\r\n public x: number;\r\n\r\n public y: number;\r\n\r\n public width: number;\r\n\r\n public height: number;\r\n\r\n constructor({\r\n x,\r\n y,\r\n width,\r\n height,\r\n }: {\r\n x: number;\r\n y: number;\r\n width: number;\r\n height: number;\r\n }) {\r\n this.x = x ?? 0;\r\n this.y = y ?? 0;\r\n this.width = width ?? 0;\r\n this.height = height ?? 0;\r\n }\r\n\r\n public get top(): number {\r\n return this.y;\r\n }\r\n\r\n public get bottom(): number {\r\n return this.y + this.height;\r\n }\r\n\r\n public get left(): number {\r\n return this.x;\r\n }\r\n\r\n public get right(): number {\r\n return this.x + this.width;\r\n }\r\n}\r\n\r\nexport function getOverflow(a: MutableRect, b: MutableRect) {\r\n return {\r\n x: {\r\n before: Math.max(0, b.left - a.left),\r\n after: Math.max(0, a.right - b.right),\r\n },\r\n y: {\r\n before: Math.max(0, b.top - a.top),\r\n after: Math.max(0, a.bottom - b.bottom),\r\n },\r\n };\r\n}\r\n"],"mappings":"AAYA,OAAO,MAAMA,WAAW,CAAiB;EASvCC,WAAWA,CAAAC,IAAA,EAUR;IAAA,IAVS;MACVC,CAAC;MACDC,CAAC;MACDC,KAAK;MACLC;IAMF,CAAC,GAAAJ,IAAA;IACC,IAAI,CAACC,CAAC,GAAGA,CAAC,IAAI,CAAC;IACf,IAAI,CAACC,CAAC,GAAGA,CAAC,IAAI,CAAC;IACf,IAAI,CAACC,KAAK,GAAGA,KAAK,IAAI,CAAC;IACvB,IAAI,CAACC,MAAM,GAAGA,MAAM,IAAI,CAAC;EAC3B;EAEA,IAAWC,GAAGA,CAAA,EAAW;IACvB,OAAO,IAAI,CAACH,CAAC;EACf;EAEA,IAAWI,MAAMA,CAAA,EAAW;IAC1B,OAAO,IAAI,CAACJ,CAAC,GAAG,IAAI,CAACE,MAAM;EAC7B;EAEA,IAAWG,IAAIA,CAAA,EAAW;IACxB,OAAO,IAAI,CAACN,CAAC;EACf;EAEA,IAAWO,KAAKA,CAAA,EAAW;IACzB,OAAO,IAAI,CAACP,CAAC,GAAG,IAAI,CAACE,KAAK;EAC5B;AACF;AAEA,OAAO,SAASM,WAAWA,CAACC,CAAc,EAAEC,CAAc,EAAE;EAC1D,OAAO;IACLV,CAAC,EAAE;MACDW,MAAM,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEH,CAAC,CAACJ,IAAI,GAAGG,CAAC,CAACH,IAAI,CAAC;MACpCQ,KAAK,EAAEF,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEJ,CAAC,CAACF,KAAK,GAAGG,CAAC,CAACH,KAAK;IACtC,CAAC;IACDN,CAAC,EAAE;MACDU,MAAM,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEH,CAAC,CAACN,GAAG,GAAGK,CAAC,CAACL,GAAG,CAAC;MAClCU,KAAK,EAAEF,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEJ,CAAC,CAACJ,MAAM,GAAGK,CAAC,CAACL,MAAM;IACxC;EACF,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.mjs","names":["REQUIRE_RULE","value"],"sources":["../../src/util/validation.ts"],"sourcesContent":["export function REQUIRE_RULE(value: any): boolean {\n return !!value;\n}\n\nexport default {};\n"],"mappings":"AAAA,OAAO,SAASA,YAAYA,CAACC,KAAU,EAAW;EAChD,OAAO,CAAC,CAACA,KAAK;AAChB;AAEA,eAAe,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"validation.mjs","names":["REQUIRE_RULE","value"],"sources":["../../src/util/validation.ts"],"sourcesContent":["export function REQUIRE_RULE(value: any): boolean {\r\n return !!value;\r\n}\r\n\r\nexport default {};\r\n"],"mappings":"AAAA,OAAO,SAASA,YAAYA,CAACC,KAAU,EAAW;EAChD,OAAO,CAAC,CAACA,KAAK;AAChB;AAEA,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { getCurrentInstance } from 'vue';
|
|
2
|
+
export * from "./props.mjs";
|
|
3
|
+
export function getSlot(vm) {
|
|
4
|
+
let name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
|
|
5
|
+
let data = arguments.length > 2 ? arguments[2] : undefined;
|
|
6
|
+
let optional = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
7
|
+
if (vm.$slots?.[name]) {
|
|
8
|
+
const slot = vm.$slots[name](data instanceof Function ? data() : data);
|
|
9
|
+
return slot.filter(node => {
|
|
10
|
+
return node.el?.nodeType !== 8;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
export function getUid() {
|
|
16
|
+
const vm = getCurrentInstance();
|
|
17
|
+
return vm?.uid;
|
|
18
|
+
}
|
|
19
|
+
export function bindClasses(classes) {
|
|
20
|
+
const boundClasses = {};
|
|
21
|
+
if (typeof classes === 'string') {
|
|
22
|
+
boundClasses[classes] = true;
|
|
23
|
+
} else if (Array.isArray(classes)) {
|
|
24
|
+
classes.reduce((acc, clas) => {
|
|
25
|
+
acc[clas] = true;
|
|
26
|
+
return acc;
|
|
27
|
+
}, boundClasses);
|
|
28
|
+
} else if (typeof classes === 'object') {
|
|
29
|
+
Object.keys(classes).reduce((acc, clas) => {
|
|
30
|
+
acc[clas] = !!classes[clas];
|
|
31
|
+
return acc;
|
|
32
|
+
}, boundClasses);
|
|
33
|
+
}
|
|
34
|
+
return boundClasses;
|
|
35
|
+
}
|
|
36
|
+
export function getHtmlElement(node) {
|
|
37
|
+
if (node && '$el' in node) {
|
|
38
|
+
const el = node.$el;
|
|
39
|
+
if (el.nodeType === Node.TEXT_NODE) {
|
|
40
|
+
return el.nextElementSibling;
|
|
41
|
+
}
|
|
42
|
+
return el;
|
|
43
|
+
}
|
|
44
|
+
return node;
|
|
45
|
+
}
|
|
46
|
+
export function findChildrenWithProvide(key, vnode) {
|
|
47
|
+
if (!vnode || typeof vnode !== 'object') {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
if (Array.isArray(vnode)) {
|
|
51
|
+
return vnode.map(child => findChildrenWithProvide(key, child)).flat(1);
|
|
52
|
+
} else if (Array.isArray(vnode.children)) {
|
|
53
|
+
return vnode.children.map(child => findChildrenWithProvide(key, child)).flat(1);
|
|
54
|
+
} else if (vnode.component) {
|
|
55
|
+
if (Object.getOwnPropertySymbols(vnode.component.provides).includes(key)) {
|
|
56
|
+
return [vnode.component];
|
|
57
|
+
} else if (vnode.component.subTree) {
|
|
58
|
+
return findChildrenWithProvide(key, vnode.component.subTree).flat(1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=index.mjs.map
|