duoyun-ui 2.2.2 → 2.2.8
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/elements/badge.d.ts +2 -16
- package/elements/badge.d.ts.map +1 -1
- package/elements/badge.js +4 -158
- package/elements/badge.js.map +1 -1
- package/elements/banner.d.ts +2 -17
- package/elements/banner.d.ts.map +1 -1
- package/elements/banner.js +4 -127
- package/elements/banner.js.map +1 -1
- package/elements/base/chart.d.ts +2 -2
- package/elements/base/resize.d.ts +1 -22
- package/elements/base/resize.d.ts.map +1 -1
- package/elements/base/resize.js +1 -95
- package/elements/base/resize.js.map +1 -1
- package/elements/base/scroll.d.ts +1 -8
- package/elements/base/scroll.d.ts.map +1 -1
- package/elements/base/scroll.js +1 -158
- package/elements/base/scroll.js.map +1 -1
- package/elements/base/visible.d.ts +1 -18
- package/elements/base/visible.d.ts.map +1 -1
- package/elements/base/visible.js +1 -112
- package/elements/base/visible.js.map +1 -1
- package/elements/button.d.ts +2 -24
- package/elements/button.d.ts.map +1 -1
- package/elements/button.js +7 -287
- package/elements/button.js.map +1 -1
- package/elements/checkbox.d.ts +3 -21
- package/elements/checkbox.d.ts.map +1 -1
- package/elements/checkbox.js +6 -180
- package/elements/checkbox.js.map +1 -1
- package/elements/code-block.d.ts +2 -7
- package/elements/code-block.d.ts.map +1 -1
- package/elements/code-block.js +4 -432
- package/elements/code-block.js.map +1 -1
- package/elements/collapse.d.ts +3 -29
- package/elements/collapse.d.ts.map +1 -1
- package/elements/collapse.js +6 -197
- package/elements/collapse.js.map +1 -1
- package/elements/compartment.d.ts +2 -5
- package/elements/compartment.d.ts.map +1 -1
- package/elements/compartment.js +4 -23
- package/elements/compartment.js.map +1 -1
- package/elements/contextmenu.d.ts +5 -42
- package/elements/contextmenu.d.ts.map +1 -1
- package/elements/contextmenu.js +8 -285
- package/elements/contextmenu.js.map +1 -1
- package/elements/countdown.d.ts +2 -12
- package/elements/countdown.d.ts.map +1 -1
- package/elements/countdown.js +4 -94
- package/elements/countdown.js.map +1 -1
- package/elements/divider.d.ts +2 -8
- package/elements/divider.d.ts.map +1 -1
- package/elements/divider.js +4 -129
- package/elements/divider.js.map +1 -1
- package/elements/empty.d.ts +2 -8
- package/elements/empty.d.ts.map +1 -1
- package/elements/empty.js +4 -59
- package/elements/empty.js.map +1 -1
- package/elements/grouped-picker.d.ts +29 -0
- package/elements/grouped-picker.d.ts.map +1 -0
- package/elements/grouped-picker.js +199 -0
- package/elements/grouped-picker.js.map +1 -0
- package/elements/input.d.ts +4 -36
- package/elements/input.d.ts.map +1 -1
- package/elements/input.js +6 -489
- package/elements/input.js.map +1 -1
- package/elements/letters.d.ts +4 -0
- package/elements/letters.d.ts.map +1 -0
- package/elements/letters.js +56 -0
- package/elements/letters.js.map +1 -0
- package/elements/link.d.ts +3 -5
- package/elements/link.d.ts.map +1 -1
- package/elements/link.js +6 -38
- package/elements/link.js.map +1 -1
- package/elements/list.d.ts +5 -58
- package/elements/list.d.ts.map +1 -1
- package/elements/list.js +19 -664
- package/elements/list.js.map +1 -1
- package/elements/modal.d.ts +5 -63
- package/elements/modal.d.ts.map +1 -1
- package/elements/modal.js +13 -411
- package/elements/modal.js.map +1 -1
- package/elements/options.d.ts +4 -32
- package/elements/options.d.ts.map +1 -1
- package/elements/options.js +5 -254
- package/elements/options.js.map +1 -1
- package/elements/page-loadbar.js +1 -1
- package/elements/paragraph.d.ts +2 -2
- package/elements/paragraph.d.ts.map +1 -1
- package/elements/paragraph.js +4 -45
- package/elements/paragraph.js.map +1 -1
- package/elements/placeholder.d.ts +2 -14
- package/elements/placeholder.d.ts.map +1 -1
- package/elements/placeholder.js +4 -114
- package/elements/placeholder.js.map +1 -1
- package/elements/radio.d.ts +5 -24
- package/elements/radio.d.ts.map +1 -1
- package/elements/radio.js +7 -165
- package/elements/radio.js.map +1 -1
- package/elements/rate.d.ts +2 -12
- package/elements/rate.d.ts.map +1 -1
- package/elements/rate.js +4 -142
- package/elements/rate.js.map +1 -1
- package/elements/rolling-number.d.ts +4 -0
- package/elements/rolling-number.d.ts.map +1 -0
- package/elements/rolling-number.js +56 -0
- package/elements/rolling-number.js.map +1 -0
- package/elements/scroll-box.d.ts +2 -2
- package/elements/scroll-box.d.ts.map +1 -1
- package/elements/scroll-box.js +4 -5
- package/elements/scroll-box.js.map +1 -1
- package/elements/segmented.d.ts +3 -20
- package/elements/segmented.d.ts.map +1 -1
- package/elements/segmented.js +4 -191
- package/elements/segmented.js.map +1 -1
- package/elements/slider.d.ts +2 -20
- package/elements/slider.d.ts.map +1 -1
- package/elements/slider.js +4 -261
- package/elements/slider.js.map +1 -1
- package/elements/sort-box.d.ts +1 -2
- package/elements/sort-box.d.ts.map +1 -1
- package/elements/sort-box.js +4 -15
- package/elements/sort-box.js.map +1 -1
- package/elements/space.d.ts +2 -4
- package/elements/space.d.ts.map +1 -1
- package/elements/space.js +4 -37
- package/elements/space.js.map +1 -1
- package/elements/switch.d.ts +2 -11
- package/elements/switch.d.ts.map +1 -1
- package/elements/switch.js +5 -134
- package/elements/switch.js.map +1 -1
- package/elements/tag.d.ts +3 -16
- package/elements/tag.d.ts.map +1 -1
- package/elements/tag.js +4 -133
- package/elements/tag.js.map +1 -1
- package/elements/timeline.d.ts.map +1 -1
- package/elements/timeline.js +0 -1
- package/elements/timeline.js.map +1 -1
- package/elements/toast.js +1 -1
- package/elements/wait.js +1 -1
- package/helper/error.js +2 -39
- package/helper/error.js.map +1 -1
- package/helper/webapp.d.ts +4 -5
- package/helper/webapp.d.ts.map +1 -1
- package/helper/webapp.js +5 -11
- package/helper/webapp.js.map +1 -1
- package/lib/animations.d.ts +1 -10
- package/lib/animations.d.ts.map +1 -1
- package/lib/animations.js +1 -29
- package/lib/animations.js.map +1 -1
- package/lib/cache.d.ts +1 -18
- package/lib/cache.d.ts.map +1 -1
- package/lib/cache.js +1 -62
- package/lib/cache.js.map +1 -1
- package/lib/color.d.ts +1 -37
- package/lib/color.d.ts.map +1 -1
- package/lib/color.js +1 -98
- package/lib/color.js.map +1 -1
- package/lib/decorators.d.ts +2 -0
- package/lib/decorators.d.ts.map +1 -0
- package/lib/decorators.js +2 -0
- package/lib/decorators.js.map +1 -0
- package/lib/easing.d.ts +2 -0
- package/lib/easing.d.ts.map +1 -0
- package/lib/easing.js +2 -0
- package/lib/easing.js.map +1 -0
- package/lib/element.d.ts +1 -18
- package/lib/element.d.ts.map +1 -1
- package/lib/element.js +1 -131
- package/lib/element.js.map +1 -1
- package/lib/encode.d.ts +1 -10
- package/lib/encode.d.ts.map +1 -1
- package/lib/encode.js +1 -48
- package/lib/encode.js.map +1 -1
- package/lib/hotkeys.d.ts +1 -43
- package/lib/hotkeys.d.ts.map +1 -1
- package/lib/hotkeys.js +1 -247
- package/lib/hotkeys.js.map +1 -1
- package/lib/icons.d.ts +1 -114
- package/lib/icons.d.ts.map +1 -1
- package/lib/icons.js +1 -90
- package/lib/icons.js.map +1 -1
- package/lib/image.d.ts +1 -39
- package/lib/image.d.ts.map +1 -1
- package/lib/image.js +1 -140
- package/lib/image.js.map +1 -1
- package/lib/locale.d.ts +1 -87
- package/lib/locale.d.ts.map +1 -1
- package/lib/locale.js +1 -8
- package/lib/locale.js.map +1 -1
- package/lib/map.d.ts +1 -8
- package/lib/map.d.ts.map +1 -1
- package/lib/map.js +1 -31
- package/lib/map.js.map +1 -1
- package/lib/number.d.ts +1 -94
- package/lib/number.d.ts.map +1 -1
- package/lib/number.js +1 -169
- package/lib/number.js.map +1 -1
- package/lib/patterns.d.ts +1 -9
- package/lib/patterns.d.ts.map +1 -1
- package/lib/patterns.js +1 -11
- package/lib/patterns.js.map +1 -1
- package/lib/styles.d.ts +1 -4
- package/lib/styles.d.ts.map +1 -1
- package/lib/styles.js +1 -28
- package/lib/styles.js.map +1 -1
- package/lib/theme.d.ts +1 -85
- package/lib/theme.d.ts.map +1 -1
- package/lib/theme.js +6 -70
- package/lib/theme.js.map +1 -1
- package/lib/time.d.ts +1 -81
- package/lib/time.d.ts.map +1 -1
- package/lib/time.js +1 -255
- package/lib/time.js.map +1 -1
- package/lib/timer.d.ts +1 -25
- package/lib/timer.d.ts.map +1 -1
- package/lib/timer.js +1 -106
- package/lib/timer.js.map +1 -1
- package/lib/types.d.ts +1 -13
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +1 -16
- package/lib/types.js.map +1 -1
- package/lib/utils.d.ts +1 -79
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +1 -240
- package/lib/utils.js.map +1 -1
- package/locales/en.d.ts +1 -37
- package/locales/en.d.ts.map +1 -1
- package/locales/en.js +1 -36
- package/locales/en.js.map +1 -1
- package/locales/zh.d.ts +1 -3
- package/locales/zh.d.ts.map +1 -1
- package/locales/zh.js +1 -37
- package/locales/zh.js.map +1 -1
- package/package.json +4 -6
- package/patterns/console.d.ts +1 -1
- package/patterns/form.d.ts +5 -3
- package/patterns/form.d.ts.map +1 -1
- package/patterns/form.js +18 -5
- package/patterns/form.js.map +1 -1
- package/react/DyBadge.d.ts +1 -9
- package/react/DyBadge.js +1 -1
- package/react/DyBanner.d.ts +1 -6
- package/react/DyBanner.js +1 -1
- package/react/DyButton.d.ts +1 -15
- package/react/DyButton.js +1 -1
- package/react/DyCheckbox.d.ts +1 -7
- package/react/DyCheckbox.js +1 -1
- package/react/DyCheckboxGroup.d.ts +1 -7
- package/react/DyCheckboxGroup.js +1 -1
- package/react/DyCoachMark.d.ts +0 -5
- package/react/DyCoachMark.js +1 -1
- package/react/DyCodeBlock.d.ts +1 -5
- package/react/DyCodeBlock.js +1 -1
- package/react/DyCollapse.d.ts +1 -5
- package/react/DyCollapse.js +1 -1
- package/react/DyCollapsePanel.d.ts +1 -6
- package/react/DyCollapsePanel.js +1 -1
- package/react/DyCompartment.d.ts +1 -3
- package/react/DyCompartment.js +1 -1
- package/react/DyCountdown.d.ts +1 -5
- package/react/DyCountdown.js +1 -1
- package/react/DyDivider.d.ts +1 -6
- package/react/DyDivider.js +1 -1
- package/react/DyDrawer.d.ts +1 -21
- package/react/DyDrawer.js +1 -1
- package/react/DyEmpty.d.ts +1 -5
- package/react/DyEmpty.js +1 -1
- package/react/DyGroupedPicker.d.ts +27 -0
- package/react/DyGroupedPicker.js +22 -0
- package/react/DyInput.d.ts +1 -22
- package/react/DyInput.js +1 -1
- package/react/DyLegend.d.ts +0 -4
- package/react/DyLegend.js +1 -1
- package/react/DyLetters.d.ts +15 -0
- package/react/{DyListOutside.js → DyLetters.js} +4 -4
- package/react/DyList.d.ts +0 -13
- package/react/DyList.js +1 -1
- package/react/DyOptions.d.ts +1 -5
- package/react/DyOptions.js +1 -1
- package/react/DyPatForm.d.ts +1 -0
- package/react/DyPlaceholder.d.ts +1 -10
- package/react/DyPlaceholder.js +1 -1
- package/react/DyRadio.d.ts +1 -6
- package/react/DyRadio.js +1 -1
- package/react/DyRadioGroup.d.ts +1 -7
- package/react/DyRadioGroup.js +1 -1
- package/react/DyRate.d.ts +1 -7
- package/react/DyRate.js +1 -1
- package/react/DyRollingNumber.d.ts +15 -0
- package/react/{DyListItem.js → DyRollingNumber.js} +5 -5
- package/react/DySegmented.d.ts +1 -8
- package/react/DySegmented.js +1 -1
- package/react/DySlider.d.ts +1 -12
- package/react/DySlider.js +1 -1
- package/react/DySortItem.d.ts +1 -3
- package/react/DySortItem.js +1 -1
- package/react/DySpace.d.ts +1 -4
- package/react/DySpace.js +1 -1
- package/react/DySwitch.d.ts +1 -7
- package/react/DySwitch.js +1 -1
- package/react/DyTag.d.ts +1 -9
- package/react/DyTag.js +1 -1
- package/svelte/badge.d.ts +0 -8
- package/svelte/banner.d.ts +0 -5
- package/svelte/button.d.ts +0 -14
- package/svelte/checkbox.d.ts +0 -6
- package/svelte/coach-mark.d.ts +0 -5
- package/svelte/code-block.d.ts +0 -4
- package/svelte/collapse.d.ts +0 -4
- package/svelte/compartment.d.ts +0 -2
- package/svelte/countdown.d.ts +0 -4
- package/svelte/divider.d.ts +0 -5
- package/svelte/drawer.d.ts +0 -20
- package/svelte/empty.d.ts +0 -4
- package/svelte/grouped-picker.d.ts +19 -0
- package/svelte/grouped-picker.js +2 -0
- package/svelte/legend.d.ts +0 -4
- package/svelte/letters.d.ts +9 -0
- package/svelte/letters.js +2 -0
- package/svelte/list.d.ts +4 -11
- package/svelte/options.d.ts +0 -4
- package/svelte/pat-form.d.ts +1 -0
- package/svelte/placeholder.d.ts +0 -9
- package/svelte/radio.d.ts +0 -6
- package/svelte/rate.d.ts +0 -6
- package/svelte/rolling-number.d.ts +9 -0
- package/svelte/rolling-number.js +2 -0
- package/svelte/segmented.d.ts +0 -7
- package/svelte/slider.d.ts +0 -11
- package/svelte/space.d.ts +0 -3
- package/svelte/switch.d.ts +0 -6
- package/svelte/tag.d.ts +0 -8
- package/vue/DyBadge.vue +2 -8
- package/vue/DyBanner.vue +4 -6
- package/vue/DyButton.vue +2 -14
- package/vue/DyCheckbox.vue +4 -7
- package/vue/DyCheckboxGroup.vue +4 -7
- package/vue/DyCoachMark.vue +4 -8
- package/vue/DyCodeBlock.vue +2 -4
- package/vue/DyCollapse.vue +2 -4
- package/vue/DyCollapsePanel.vue +4 -6
- package/vue/DyCompartment.vue +2 -2
- package/vue/DyCountdown.vue +4 -5
- package/vue/DyDivider.vue +2 -5
- package/vue/DyDrawer.vue +4 -21
- package/vue/DyEmpty.vue +2 -4
- package/vue/DyGroupedPicker.vue +53 -0
- package/vue/DyInput.vue +4 -22
- package/vue/DyLegend.vue +2 -6
- package/vue/{DyListOutside.vue → DyLetters.vue} +8 -8
- package/vue/DyList.vue +4 -16
- package/vue/DyOptions.vue +2 -4
- package/vue/DyPatForm.vue +2 -2
- package/vue/DyPlaceholder.vue +2 -9
- package/vue/DyRadio.vue +4 -6
- package/vue/DyRadioGroup.vue +4 -7
- package/vue/DyRate.vue +4 -7
- package/vue/DyRollingNumber.vue +42 -0
- package/vue/DySegmented.vue +4 -8
- package/vue/DySlider.vue +4 -12
- package/vue/DySortItem.vue +2 -2
- package/vue/DySpace.vue +2 -3
- package/vue/DySwitch.vue +4 -7
- package/vue/DyTag.vue +4 -9
- package/elements/flow.d.ts +0 -52
- package/elements/flow.d.ts.map +0 -1
- package/elements/flow.js +0 -703
- package/elements/flow.js.map +0 -1
- package/elements/map.d.ts +0 -48
- package/elements/map.d.ts.map +0 -1
- package/elements/map.js +0 -396
- package/elements/map.js.map +0 -1
- package/react/DyFlow.d.ts +0 -24
- package/react/DyFlow.js +0 -18
- package/react/DyFlowCanvas.d.ts +0 -29
- package/react/DyFlowCanvas.js +0 -18
- package/react/DyListItem.d.ts +0 -24
- package/react/DyListOutside.d.ts +0 -15
- package/react/DyMap.d.ts +0 -32
- package/react/DyMap.js +0 -18
- package/svelte/flow.d.ts +0 -18
- package/svelte/flow.js +0 -2
- package/svelte/map.d.ts +0 -26
- package/svelte/map.js +0 -2
- package/vue/DyFlow.vue +0 -49
- package/vue/DyFlowCanvas.vue +0 -53
- package/vue/DyListItem.vue +0 -48
- package/vue/DyMap.vue +0 -56
package/helper/webapp.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { mediaQuery } from '@mantou/gem/helper/mediaquery';
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (serviceWorkerScript) {
|
|
8
|
-
navigator.serviceWorker?.register(serviceWorkerScript, { type: 'module' });
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
navigator.serviceWorker?.getRegistration().then((reg) => reg?.unregister());
|
|
12
|
-
}
|
|
2
|
+
import { initApp as initTapApp } from '@mantou/tap-ui/helper/base/webapp';
|
|
3
|
+
export { getWebManifestURL } from '@mantou/tap-ui/helper/base/webapp';
|
|
4
|
+
export function initApp(options = {}) {
|
|
5
|
+
initTapApp(options);
|
|
6
|
+
const { initWindowSize } = options;
|
|
13
7
|
// Installed
|
|
14
8
|
if (initWindowSize) {
|
|
15
9
|
matchMedia(mediaQuery.PWA).addEventListener('change', ({ matches }) => {
|
package/helper/webapp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webapp.js","sourceRoot":"","sources":["../src/helper/webapp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"webapp.js","sourceRoot":"","sources":["../src/helper/webapp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,UAAU,EAA0B,MAAM,mCAAmC,CAAC;AAElG,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAMtE,MAAM,UAAU,OAAO,CAAC,UAA0B,EAAE;IAClD,UAAU,CAAC,OAAO,CAAC,CAAC;IACpB,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IAEnC,YAAY;IACZ,IAAI,cAAc,EAAE,CAAC;QACnB,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;YACpE,IAAI,OAAO,EAAE,CAAC;gBACZ,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;gBAC5B,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;gBAC5B,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBACf,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
package/lib/animations.d.ts
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
easing: string;
|
|
3
|
-
duration: number;
|
|
4
|
-
};
|
|
5
|
-
export declare const fadeIn: Keyframe[];
|
|
6
|
-
export declare const fadeOut: Keyframe[];
|
|
7
|
-
export declare const slideInUp: Keyframe[];
|
|
8
|
-
export declare const slideOutDown: Keyframe[];
|
|
9
|
-
export declare const slideInLeft: Keyframe[];
|
|
10
|
-
export declare const slideOutRight: Keyframe[];
|
|
1
|
+
export * from '@mantou/tap-ui/lib/animations';
|
|
11
2
|
//# sourceMappingURL=animations.d.ts.map
|
package/lib/animations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animations.d.ts","sourceRoot":"","sources":["../src/lib/animations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"animations.d.ts","sourceRoot":"","sources":["../src/lib/animations.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
|
package/lib/animations.js
CHANGED
|
@@ -1,30 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export const commonAnimationOptions = {
|
|
3
|
-
easing: themeStore.timingFunction,
|
|
4
|
-
duration: 150,
|
|
5
|
-
};
|
|
6
|
-
export const fadeIn = [{ opacity: 0 }, { opacity: 1 }];
|
|
7
|
-
export const fadeOut = [...fadeIn].reverse();
|
|
8
|
-
export const slideInUp = [
|
|
9
|
-
{
|
|
10
|
-
transform: 'translateY(50%)',
|
|
11
|
-
opacity: 0,
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
transform: 'translateY(0)',
|
|
15
|
-
opacity: 1,
|
|
16
|
-
},
|
|
17
|
-
];
|
|
18
|
-
export const slideOutDown = [...slideInUp].reverse();
|
|
19
|
-
export const slideInLeft = [
|
|
20
|
-
{
|
|
21
|
-
transform: 'translateX(50%)',
|
|
22
|
-
opacity: 0,
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
transform: 'translateX(0)',
|
|
26
|
-
opacity: 1,
|
|
27
|
-
},
|
|
28
|
-
];
|
|
29
|
-
export const slideOutRight = [...slideInLeft].reverse();
|
|
1
|
+
export * from '@mantou/tap-ui/lib/animations';
|
|
30
2
|
//# sourceMappingURL=animations.js.map
|
package/lib/animations.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animations.js","sourceRoot":"","sources":["../src/lib/animations.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"animations.js","sourceRoot":"","sources":["../src/lib/animations.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
|
package/lib/cache.d.ts
CHANGED
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
max?: number;
|
|
3
|
-
maxAge?: number;
|
|
4
|
-
renewal?: boolean;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* 过期的不能自动清理,但超出最大容量时会被修剪
|
|
8
|
-
*/
|
|
9
|
-
export declare class Cache<T = any> {
|
|
10
|
-
#private;
|
|
11
|
-
constructor({ max, maxAge, renewal }?: CacheOptions);
|
|
12
|
-
setOptions(options: CacheOptions): void;
|
|
13
|
-
set(key: string, value: T): T;
|
|
14
|
-
get(key: string): T | undefined;
|
|
15
|
-
get(key: string, init: (key: string) => T): T;
|
|
16
|
-
clear(): void;
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
1
|
+
export * from '@mantou/tap-ui/lib/cache';
|
|
19
2
|
//# sourceMappingURL=cache.d.ts.map
|
package/lib/cache.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/lib/cache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/lib/cache.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
package/lib/cache.js
CHANGED
|
@@ -1,63 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* 过期的不能自动清理,但超出最大容量时会被修剪
|
|
4
|
-
*/
|
|
5
|
-
export class Cache {
|
|
6
|
-
#max;
|
|
7
|
-
#maxAge;
|
|
8
|
-
#renewal;
|
|
9
|
-
#map = new Map();
|
|
10
|
-
#reverseMap = new Map();
|
|
11
|
-
#addedLinked = new LinkedList();
|
|
12
|
-
constructor({ max = Infinity, maxAge = Infinity, renewal = false } = {}) {
|
|
13
|
-
this.#max = max;
|
|
14
|
-
this.#maxAge = maxAge;
|
|
15
|
-
this.#renewal = renewal;
|
|
16
|
-
}
|
|
17
|
-
setOptions(options) {
|
|
18
|
-
this.#max = options.max ?? this.#max;
|
|
19
|
-
this.#maxAge = options.maxAge ?? this.#maxAge;
|
|
20
|
-
this.#renewal = options.renewal ?? this.#renewal;
|
|
21
|
-
}
|
|
22
|
-
#trim() {
|
|
23
|
-
for (let i = this.#addedLinked.size - this.#max; i > 0; i--) {
|
|
24
|
-
const value = this.#addedLinked.get();
|
|
25
|
-
const key = this.#reverseMap.get(value);
|
|
26
|
-
this.#reverseMap.delete(value);
|
|
27
|
-
this.#map.delete(key);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
set(key, value) {
|
|
31
|
-
this.#addedLinked.add(value);
|
|
32
|
-
this.#reverseMap.set(value, key);
|
|
33
|
-
this.#map.set(key, { value, timestamp: Date.now() });
|
|
34
|
-
this.#trim();
|
|
35
|
-
return value;
|
|
36
|
-
}
|
|
37
|
-
get(key, init) {
|
|
38
|
-
const cache = this.#map.get(key);
|
|
39
|
-
if (!cache) {
|
|
40
|
-
return init && this.set(key, init(key));
|
|
41
|
-
}
|
|
42
|
-
const { timestamp, value } = cache;
|
|
43
|
-
// 过期重新生成
|
|
44
|
-
if (Date.now() - timestamp > this.#maxAge) {
|
|
45
|
-
this.#addedLinked.delete(value);
|
|
46
|
-
this.#reverseMap.delete(value);
|
|
47
|
-
this.#map.delete(key);
|
|
48
|
-
return init && this.set(key, init(key));
|
|
49
|
-
}
|
|
50
|
-
if (this.#renewal) {
|
|
51
|
-
cache.timestamp = Date.now();
|
|
52
|
-
}
|
|
53
|
-
// 调整下位置
|
|
54
|
-
this.#addedLinked.add(value);
|
|
55
|
-
return value;
|
|
56
|
-
}
|
|
57
|
-
clear() {
|
|
58
|
-
this.#map.clear();
|
|
59
|
-
this.#reverseMap.clear();
|
|
60
|
-
this.#addedLinked.clear();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
1
|
+
export * from '@mantou/tap-ui/lib/cache';
|
|
63
2
|
//# sourceMappingURL=cache.js.map
|
package/lib/cache.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/lib/cache.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/lib/cache.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
package/lib/color.d.ts
CHANGED
|
@@ -1,38 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export type RGBA = readonly [number, number, number, number];
|
|
3
|
-
export type HSL = readonly [number, number, number];
|
|
4
|
-
export type HSLA = readonly [number, number, number, number];
|
|
5
|
-
export type HSV = readonly [number, number, number];
|
|
6
|
-
export type HexColor = `#${string}`;
|
|
7
|
-
export type RGBColor = `rgb${'a' | ''}(${string})`;
|
|
8
|
-
export type HSLColor = `hsl${'a' | ''}(${string})`;
|
|
9
|
-
export declare const commonColors: `#${string}`[];
|
|
10
|
-
export declare function rgbToRgbColor([r, g, b, a]: RGB | RGBA): RGBColor;
|
|
11
|
-
export declare function rgbToHslColor([r, g, b, a]: RGB | RGBA): HSLColor;
|
|
12
|
-
export declare function rgbToHexColor(rgba: RGB | RGBA): HexColor;
|
|
13
|
-
export declare function randomColor(): RGB;
|
|
14
|
-
export declare function randomColor(type: 'rgba'): RGBColor;
|
|
15
|
-
export declare function randomColor(type: 'hsla'): HSLColor;
|
|
16
|
-
export declare function randomColor(type: 'hex'): HexColor;
|
|
17
|
-
export declare function parseHexColor(str: HexColor): RGBA;
|
|
18
|
-
/**
|
|
19
|
-
* Note: ignore alpha
|
|
20
|
-
*/
|
|
21
|
-
export declare function luminance([r, g, b]: RGB | RGBA): number;
|
|
22
|
-
/**
|
|
23
|
-
* Note: ignore alpha
|
|
24
|
-
*/
|
|
25
|
-
export declare function contrast(rgb1: RGB | RGBA, rgb2: RGB | RGBA): number;
|
|
26
|
-
/**
|
|
27
|
-
* Note: ignore alpha
|
|
28
|
-
*
|
|
29
|
-
* @see
|
|
30
|
-
* https://stackoverflow.com/questions/8022885/rgb-to-hsv-color-in-javascript
|
|
31
|
-
*/
|
|
32
|
-
export declare function rgbToHsl(rgb: RGB | RGBA): HSL;
|
|
33
|
-
export declare function hslToRgb([h, s, l]: HSL | HSLA): RGB;
|
|
34
|
-
export declare function rgbToHsv(rgb: RGB | RGBA): HSV;
|
|
35
|
-
export declare function hsvToRgb([h, s, v]: HSV): RGB;
|
|
36
|
-
export declare function hslToHsv([h, s, l]: HSL | HSLA): HSV;
|
|
37
|
-
export declare function hsvToHsl([h, s, v]: HSV): HSL;
|
|
1
|
+
export * from '@mantou/tap-ui/lib/color';
|
|
38
2
|
//# sourceMappingURL=color.d.ts.map
|
package/lib/color.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../src/lib/color.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../src/lib/color.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
package/lib/color.js
CHANGED
|
@@ -1,99 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export const commonColors = Array(20)
|
|
3
|
-
.fill(null)
|
|
4
|
-
.map((_, index) => Math.abs((326 + index * 81 * (index % 2 ? 1 : -1)) % 360) / 360)
|
|
5
|
-
.map((h) => [h, 78 / 100, 64 / 100])
|
|
6
|
-
.map((hsl) => hslToRgb(hsl))
|
|
7
|
-
.map((rgb) => rgbToHexColor(rgb));
|
|
8
|
-
export function rgbToRgbColor([r, g, b, a = 1]) {
|
|
9
|
-
const rgbStr = [r, g, b].join();
|
|
10
|
-
return a === 1 ? `rgb(${rgbStr})` : `rgba(${rgbStr},${Number(a.toFixed(2))})`;
|
|
11
|
-
}
|
|
12
|
-
export function rgbToHslColor([r, g, b, a = 1]) {
|
|
13
|
-
const [h, s, l] = rgbToHsl([r, g, b]);
|
|
14
|
-
const hslStr = `${Math.round(h * 360)},${Math.round(s * 100)}%,${Math.round(l * 100)}%`;
|
|
15
|
-
return a === 1 ? `hsl(${hslStr})` : `hsla(${hslStr},${Number(a.toFixed(2))})`;
|
|
16
|
-
}
|
|
17
|
-
export function rgbToHexColor(rgba) {
|
|
18
|
-
const rgb = rgba.slice(0, 3);
|
|
19
|
-
return `#${(rgba.length === 4 && rgba[3] !== 1 ? [...rgb, rgba[3] * 255] : rgb)
|
|
20
|
-
.map((e) => Math.round(e).toString(16).padStart(2, '0'))
|
|
21
|
-
.join('')}`;
|
|
22
|
-
}
|
|
23
|
-
export function randomColor(type) {
|
|
24
|
-
const randomNumber = () => Math.round(Math.random() * 255);
|
|
25
|
-
const rgb = [randomNumber(), randomNumber(), randomNumber()];
|
|
26
|
-
switch (type) {
|
|
27
|
-
case 'rgba':
|
|
28
|
-
return rgbToRgbColor(rgb);
|
|
29
|
-
case 'hsla':
|
|
30
|
-
return rgbToHslColor(rgb);
|
|
31
|
-
case 'hex':
|
|
32
|
-
return rgbToHexColor(rgb);
|
|
33
|
-
default:
|
|
34
|
-
return rgb;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
export function parseHexColor(str) {
|
|
38
|
-
const s = str.replace('#', '');
|
|
39
|
-
const fullHex = s.length === 3 || s.length === 4 ? s.replace(/\w/g, ($1) => $1 + $1) : s;
|
|
40
|
-
const [r, g, b, a = 255] = fullHex
|
|
41
|
-
.split(/(\w{2})/)
|
|
42
|
-
.filter((e) => !!e)
|
|
43
|
-
.map((e) => parseInt(e, 16));
|
|
44
|
-
return [r, g, b, a / 255];
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Note: ignore alpha
|
|
48
|
-
*/
|
|
49
|
-
export function luminance([r, g, b]) {
|
|
50
|
-
const a = [r, g, b].map((v) => {
|
|
51
|
-
v /= 255;
|
|
52
|
-
return v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
|
|
53
|
-
});
|
|
54
|
-
return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Note: ignore alpha
|
|
58
|
-
*/
|
|
59
|
-
export function contrast(rgb1, rgb2) {
|
|
60
|
-
const l1 = luminance([rgb1[0], rgb1[1], rgb1[2]]) + 0.05;
|
|
61
|
-
const l2 = luminance([rgb2[0], rgb2[1], rgb2[2]]) + 0.05;
|
|
62
|
-
return Math.max(l1, l2) / Math.min(l1, l2);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Note: ignore alpha
|
|
66
|
-
*
|
|
67
|
-
* @see
|
|
68
|
-
* https://stackoverflow.com/questions/8022885/rgb-to-hsv-color-in-javascript
|
|
69
|
-
*/
|
|
70
|
-
export function rgbToHsl(rgb) {
|
|
71
|
-
const [r, g, b] = rgb.map((e) => e / 255);
|
|
72
|
-
const v = Math.max(r, g, b), c = v - Math.min(r, g, b), f = 1 - Math.abs(v + v - c - 1);
|
|
73
|
-
const h = c && (v === r ? (g - b) / c : v === g ? 2 + (b - r) / c : 4 + (r - g) / c);
|
|
74
|
-
return [(h < 0 ? h + 6 : h) / 6, f ? c / f : 0, (v + v - c) / 2];
|
|
75
|
-
}
|
|
76
|
-
export function hslToRgb([h, s, l]) {
|
|
77
|
-
const a = s * Math.min(l, 1 - l);
|
|
78
|
-
const f = (n, k = (n + h * 12) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
|
79
|
-
return [f(0), f(8), f(4)].map((e) => Math.round(e * 255));
|
|
80
|
-
}
|
|
81
|
-
export function rgbToHsv(rgb) {
|
|
82
|
-
const [r, g, b] = rgb.map((e) => e / 255);
|
|
83
|
-
const v = Math.max(r, g, b), c = v - Math.min(r, g, b);
|
|
84
|
-
const h = c && (v === r ? (g - b) / c : v === g ? 2 + (b - r) / c : 4 + (r - g) / c);
|
|
85
|
-
return [(h < 0 ? h + 6 : h) / 6, v && c / v, v];
|
|
86
|
-
}
|
|
87
|
-
export function hsvToRgb([h, s, v]) {
|
|
88
|
-
const f = (n, k = (n + h * 6) % 6) => v - v * s * Math.max(Math.min(k, 4 - k, 1), 0);
|
|
89
|
-
return [f(5), f(3), f(1)].map((e) => Math.round(e * 255));
|
|
90
|
-
}
|
|
91
|
-
export function hslToHsv([h, s, l]) {
|
|
92
|
-
const v = s * Math.min(l, 1 - l) + l;
|
|
93
|
-
return [h, v ? 2 - (2 * l) / v : 0, v];
|
|
94
|
-
}
|
|
95
|
-
export function hsvToHsl([h, s, v]) {
|
|
96
|
-
const l = v - (v * s) / 2, m = Math.min(l, 1 - l);
|
|
97
|
-
return [h, m ? (v - l) / m : 0, l];
|
|
98
|
-
}
|
|
1
|
+
export * from '@mantou/tap-ui/lib/color';
|
|
99
2
|
//# sourceMappingURL=color.js.map
|
package/lib/color.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color.js","sourceRoot":"","sources":["../src/lib/color.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"color.js","sourceRoot":"","sources":["../src/lib/color.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/lib/decorators.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../src/lib/decorators.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
|
package/lib/easing.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"easing.d.ts","sourceRoot":"","sources":["../src/lib/easing.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
|
package/lib/easing.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"easing.js","sourceRoot":"","sources":["../src/lib/easing.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
|
package/lib/element.d.ts
CHANGED
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
top: number;
|
|
3
|
-
left: number;
|
|
4
|
-
right: number;
|
|
5
|
-
bottom: number;
|
|
6
|
-
};
|
|
7
|
-
export declare function toggleActiveState(ele: Element | undefined | null, active: boolean): void;
|
|
8
|
-
/**Y axis */
|
|
9
|
-
export declare function findScrollContainer(startElement?: HTMLElement | null): HTMLElement | undefined;
|
|
10
|
-
export declare function findRanges(root: Node, text: string): Range[];
|
|
11
|
-
export declare function findActiveElement(): Element | null;
|
|
12
|
-
export declare function isInputElement(originElement: HTMLElement): true | undefined;
|
|
13
|
-
export declare function closestElement<K extends keyof HTMLElementTagNameMap>(ele: Element, tag: K): HTMLElementTagNameMap[K] | null;
|
|
14
|
-
export declare function closestElement<K extends abstract new (...args: any) => any>(ele: Element, con: K): InstanceType<K> | null;
|
|
15
|
-
export declare function closestElement<K extends Element>(ele: Element, tag: string): K | null;
|
|
16
|
-
export declare function containsElement(ele: Element, other: Element): boolean;
|
|
17
|
-
/**In addition to the parameter element, set the `inert` attribute for all element */
|
|
18
|
-
export declare function setBodyInert(modal: HTMLElement): () => void;
|
|
1
|
+
export * from '@mantou/tap-ui/lib/element';
|
|
19
2
|
//# sourceMappingURL=element.d.ts.map
|
package/lib/element.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/lib/element.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/lib/element.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
|
package/lib/element.js
CHANGED
|
@@ -1,132 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export function getBoundingClientRect(eleList) {
|
|
3
|
-
const rects = eleList.map((e) => e.getBoundingClientRect());
|
|
4
|
-
return {
|
|
5
|
-
top: Math.min(...rects.map((e) => e.top)),
|
|
6
|
-
left: Math.min(...rects.map((e) => e.left)),
|
|
7
|
-
right: Math.max(...rects.map((e) => e.right)),
|
|
8
|
-
bottom: Math.max(...rects.map((e) => e.bottom)),
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export function toggleActiveState(ele, active) {
|
|
12
|
-
if (!ele)
|
|
13
|
-
return;
|
|
14
|
-
if (ele instanceof GemElement) {
|
|
15
|
-
if (Reflect.get(ele.constructor, Symbol.metadata).definedCSSStates?.includes('active')) {
|
|
16
|
-
ele.active = active;
|
|
17
|
-
}
|
|
18
|
-
if (['button', 'combobox'].includes(ele.role || ele.internals.role || '')) {
|
|
19
|
-
ele.internals.ariaExpanded = String(active);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
const closestEle = closestElement(ele, '[data-state-active]');
|
|
23
|
-
if (closestEle instanceof HTMLElement) {
|
|
24
|
-
closestEle.dataset.stateActive = active ? '?1' : '';
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
/**Y axis */
|
|
28
|
-
export function findScrollContainer(startElement) {
|
|
29
|
-
let element = startElement;
|
|
30
|
-
while (element) {
|
|
31
|
-
const { overflowY } = getComputedStyle(element);
|
|
32
|
-
if (overflowY === 'auto' || overflowY === 'scroll') {
|
|
33
|
-
return element;
|
|
34
|
-
}
|
|
35
|
-
element = element.parentElement || element.getRootNode()?.host;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
export function findRanges(root, text) {
|
|
39
|
-
const reg = new RegExp([...text].map((c) => `\\u{${c.codePointAt(0).toString(16)}}`).join(''), 'gui');
|
|
40
|
-
const ranges = [];
|
|
41
|
-
const nodes = [root];
|
|
42
|
-
while (nodes.length) {
|
|
43
|
-
const node = nodes.pop();
|
|
44
|
-
switch (node.nodeType) {
|
|
45
|
-
case Node.TEXT_NODE: {
|
|
46
|
-
const matched = node.nodeValue?.matchAll(reg);
|
|
47
|
-
if (matched) {
|
|
48
|
-
for (const arr of matched) {
|
|
49
|
-
if (arr.index !== undefined) {
|
|
50
|
-
const range = new Range();
|
|
51
|
-
range.setStart(node, arr.index);
|
|
52
|
-
range.setEnd(node, arr.index + text.length);
|
|
53
|
-
ranges.push(range);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
case Node.ELEMENT_NODE:
|
|
60
|
-
if (node.shadowRoot)
|
|
61
|
-
nodes.push(node.shadowRoot);
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
if (node.childNodes[0])
|
|
65
|
-
nodes.push(node.childNodes[0]);
|
|
66
|
-
if (node.nextSibling)
|
|
67
|
-
nodes.push(node.nextSibling);
|
|
68
|
-
}
|
|
69
|
-
return ranges;
|
|
70
|
-
}
|
|
71
|
-
export function findActiveElement() {
|
|
72
|
-
let element = document.activeElement;
|
|
73
|
-
while (element) {
|
|
74
|
-
if (!element.shadowRoot?.activeElement)
|
|
75
|
-
break;
|
|
76
|
-
element = element.shadowRoot.activeElement;
|
|
77
|
-
}
|
|
78
|
-
return element;
|
|
79
|
-
}
|
|
80
|
-
export function isInputElement(originElement) {
|
|
81
|
-
if (originElement.isContentEditable ||
|
|
82
|
-
originElement instanceof HTMLInputElement ||
|
|
83
|
-
originElement instanceof HTMLTextAreaElement) {
|
|
84
|
-
return true;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
export function closestElement(ele, selector) {
|
|
88
|
-
let node = ele;
|
|
89
|
-
if (typeof selector === 'function') {
|
|
90
|
-
while (node) {
|
|
91
|
-
if (node instanceof selector)
|
|
92
|
-
return node;
|
|
93
|
-
node = node.parentElement || node.getRootNode().host;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
while (node) {
|
|
98
|
-
const e = node.closest(selector);
|
|
99
|
-
if (e)
|
|
100
|
-
return e;
|
|
101
|
-
node = node.getRootNode().host;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
export function containsElement(ele, other) {
|
|
107
|
-
let node = other;
|
|
108
|
-
while (node) {
|
|
109
|
-
if (ele.contains(node))
|
|
110
|
-
return true;
|
|
111
|
-
node = node.getRootNode().host;
|
|
112
|
-
}
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
/**In addition to the parameter element, set the `inert` attribute for all element */
|
|
116
|
-
export function setBodyInert(modal) {
|
|
117
|
-
const map = new Map();
|
|
118
|
-
[...document.body.children].forEach((e) => {
|
|
119
|
-
if (e instanceof HTMLElement) {
|
|
120
|
-
map.set(e, e.inert);
|
|
121
|
-
e.inert = true;
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
modal.inert = false;
|
|
125
|
-
return () => {
|
|
126
|
-
map.forEach((inert, ele) => {
|
|
127
|
-
ele.inert = inert;
|
|
128
|
-
});
|
|
129
|
-
modal.inert = true;
|
|
130
|
-
};
|
|
131
|
-
}
|
|
1
|
+
export * from '@mantou/tap-ui/lib/element';
|
|
132
2
|
//# sourceMappingURL=element.js.map
|
package/lib/element.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.js","sourceRoot":"","sources":["../src/lib/element.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"","sources":["../src/lib/element.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
|
package/lib/encode.d.ts
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare function base64ToArrayBuffer(str: string): ArrayBuffer;
|
|
3
|
-
/**Converted string to Base64, `isSafe` indicates URL safe */
|
|
4
|
-
export declare function utf8ToB64(str: string, isSafe?: boolean): string;
|
|
5
|
-
export declare function arrayBufferToBase64(arrayBuffer: ArrayBufferLike, isSafe?: boolean): string;
|
|
6
|
-
/**Must be async */
|
|
7
|
-
export declare function hash(strOrAb: string | ArrayBuffer, options?: 'string'): Promise<string>;
|
|
8
|
-
export declare function hash(strOrAb: string | ArrayBuffer, output: 'arrayBuffer'): Promise<ArrayBuffer>;
|
|
9
|
-
/**Simple hash, output int */
|
|
10
|
-
export declare function fnv1a(str: string): number;
|
|
1
|
+
export * from '@mantou/tap-ui/lib/encode';
|
|
11
2
|
//# sourceMappingURL=encode.d.ts.map
|
package/lib/encode.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../src/lib/encode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../src/lib/encode.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
|
package/lib/encode.js
CHANGED
|
@@ -1,49 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
function safeUrlToBase64Str(str) {
|
|
3
|
-
return str.replaceAll('-', '+').replaceAll('_', '/');
|
|
4
|
-
}
|
|
5
|
-
// https://developer.mozilla.org/en-US/docs/Glossary/Base64#solution_1_%E2%80%93_escaping_the_string_before_encoding_it
|
|
6
|
-
export function b64ToUtf8(str) {
|
|
7
|
-
return decodeURIComponent(self
|
|
8
|
-
.atob(safeUrlToBase64Str(str))
|
|
9
|
-
.split('')
|
|
10
|
-
.map((c) => `%${(`00${c.charCodeAt(0).toString(16)}`).slice(-2)}`)
|
|
11
|
-
.join(''));
|
|
12
|
-
}
|
|
13
|
-
export function base64ToArrayBuffer(str) {
|
|
14
|
-
return new Uint8Array([...atob(safeUrlToBase64Str(str))].map((char) => char.charCodeAt(0))).buffer;
|
|
15
|
-
}
|
|
16
|
-
function base64ToSafeUrl(str) {
|
|
17
|
-
return str.replaceAll('+', '-').replaceAll('/', '_').replaceAll('=', '');
|
|
18
|
-
}
|
|
19
|
-
/**Converted string to Base64, `isSafe` indicates URL safe */
|
|
20
|
-
export function utf8ToB64(str, isSafe) {
|
|
21
|
-
const base64 = btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (_, p1) => String.fromCharCode(Number(`0x${p1}`))));
|
|
22
|
-
return isSafe ? base64ToSafeUrl(base64) : base64;
|
|
23
|
-
}
|
|
24
|
-
// https://github.com/tc39/proposal-arraybuffer-base64
|
|
25
|
-
export function arrayBufferToBase64(arrayBuffer, isSafe) {
|
|
26
|
-
const base64 = btoa(String.fromCharCode(...new Uint8Array(arrayBuffer)));
|
|
27
|
-
return isSafe ? base64ToSafeUrl(base64) : base64;
|
|
28
|
-
}
|
|
29
|
-
export async function hash(strOrAb, output = 'string') {
|
|
30
|
-
const ab = typeof strOrAb === 'string' ? new TextEncoder().encode(strOrAb) : strOrAb;
|
|
31
|
-
const buffer = await crypto.subtle.digest('SHA-1', ab);
|
|
32
|
-
if (output === 'arrayBuffer')
|
|
33
|
-
return buffer;
|
|
34
|
-
return [...new Uint8Array(buffer)].map((e) => e.toString(16).padStart(2, '0')).join('');
|
|
35
|
-
}
|
|
36
|
-
// https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
|
|
37
|
-
/**Simple hash, output int */
|
|
38
|
-
export function fnv1a(str) {
|
|
39
|
-
const FNV_OFFSET_BASIS = 2166136261;
|
|
40
|
-
const FNV_PRIME = 16777619;
|
|
41
|
-
let v = FNV_OFFSET_BASIS;
|
|
42
|
-
for (let i = 0; i < str.length; i++) {
|
|
43
|
-
v ^= str.charCodeAt(i);
|
|
44
|
-
v *= FNV_PRIME;
|
|
45
|
-
}
|
|
46
|
-
// 减少连续性
|
|
47
|
-
return pseudoRandom(Math.abs(v))();
|
|
48
|
-
}
|
|
1
|
+
export * from '@mantou/tap-ui/lib/encode';
|
|
49
2
|
//# sourceMappingURL=encode.js.map
|