@weapp-vite/web 1.3.37 → 1.4.1
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/README.md +144 -5
- package/dist/_virtual/_rolldown/runtime.mjs +19 -1
- package/dist/compiler/wxml/attributes.mjs +1 -1
- package/dist/compiler/wxml/attributes.mjs.map +1 -1
- package/dist/compiler/wxml/compile.mjs +6 -3
- package/dist/compiler/wxml/compile.mjs.map +1 -1
- package/dist/compiler/wxml/interpolation.mjs +1 -2
- package/dist/compiler/wxml/interpolation.mjs.map +1 -1
- package/dist/compiler/wxml/navigation.mjs +5 -7
- package/dist/compiler/wxml/navigation.mjs.map +1 -1
- package/dist/compiler/wxml/parser.mjs +5 -5
- package/dist/compiler/wxml/parser.mjs.map +1 -1
- package/dist/compiler/wxml/renderer.mjs +16 -12
- package/dist/compiler/wxml/renderer.mjs.map +1 -1
- package/dist/compiler/wxml/specialNodes.mjs +8 -2
- package/dist/compiler/wxml/specialNodes.mjs.map +1 -1
- package/dist/compiler/wxml/types.d.mts +12 -0
- package/dist/compiler/wxs.mjs +5 -5
- package/dist/compiler/wxs.mjs.map +1 -1
- package/dist/css/wxss.d.mts +1 -0
- package/dist/css/wxss.mjs +110 -9
- package/dist/css/wxss.mjs.map +1 -1
- package/dist/index.d.mts +24 -6
- package/dist/index.mjs +21 -4
- package/dist/plugin/assets.d.mts +7 -0
- package/dist/plugin/assets.mjs +122 -0
- package/dist/plugin/assets.mjs.map +1 -0
- package/dist/plugin/constants.mjs +10 -1
- package/dist/plugin/constants.mjs.map +1 -1
- package/dist/plugin/dependencyScan.mjs +41 -0
- package/dist/plugin/dependencyScan.mjs.map +1 -0
- package/dist/plugin/entry.mjs +55 -6
- package/dist/plugin/entry.mjs.map +1 -1
- package/dist/plugin/files.mjs +1 -1
- package/dist/plugin/files.mjs.map +1 -1
- package/dist/plugin/index.d.mts +37 -3
- package/dist/plugin/index.mjs +244 -73
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/plugin/layout.mjs +24 -0
- package/dist/plugin/layout.mjs.map +1 -0
- package/dist/plugin/path.mjs +6 -2
- package/dist/plugin/path.mjs.map +1 -1
- package/dist/plugin/register.mjs +45 -33
- package/dist/plugin/register.mjs.map +1 -1
- package/dist/plugin/scan.mjs +211 -92
- package/dist/plugin/scan.mjs.map +1 -1
- package/dist/plugin/scanSfc.mjs +65 -0
- package/dist/plugin/scanSfc.mjs.map +1 -0
- package/dist/plugin/state.mjs +3 -2
- package/dist/plugin/state.mjs.map +1 -1
- package/dist/plugin/styleModule.mjs +52 -0
- package/dist/plugin/styleModule.mjs.map +1 -0
- package/dist/plugin/types.d.mts +37 -1
- package/dist/plugin/vueSfc.mjs +150 -0
- package/dist/plugin/vueSfc.mjs.map +1 -0
- package/dist/runtime/appShell/container.mjs +25 -0
- package/dist/runtime/appShell/container.mjs.map +1 -0
- package/dist/runtime/appShell/tabBar/index.mjs +192 -0
- package/dist/runtime/appShell/tabBar/index.mjs.map +1 -0
- package/dist/runtime/appShell/tabBar/style.mjs +127 -0
- package/dist/runtime/appShell/tabBar/style.mjs.map +1 -0
- package/dist/runtime/button/helpers.mjs +1 -58
- package/dist/runtime/button/helpers.mjs.map +1 -1
- package/dist/runtime/button/index.d.mts +4 -5
- package/dist/runtime/button/index.mjs +6 -28
- package/dist/runtime/button/index.mjs.map +1 -1
- package/dist/runtime/button/style.mjs +53 -28
- package/dist/runtime/button/style.mjs.map +1 -1
- package/dist/runtime/component/behavior.mjs +26 -2
- package/dist/runtime/component/behavior.mjs.map +1 -1
- package/dist/runtime/component/element.mjs +107 -31
- package/dist/runtime/component/element.mjs.map +1 -1
- package/dist/runtime/component/observers.mjs +36 -0
- package/dist/runtime/component/observers.mjs.map +1 -0
- package/dist/runtime/component/publicInstance.mjs +48 -0
- package/dist/runtime/component/publicInstance.mjs.map +1 -0
- package/dist/runtime/component/relations.mjs +36 -0
- package/dist/runtime/component/relations.mjs.map +1 -0
- package/dist/runtime/component/slots.mjs +24 -0
- package/dist/runtime/component/slots.mjs.map +1 -0
- package/dist/runtime/component/state.mjs +13 -3
- package/dist/runtime/component/state.mjs.map +1 -1
- package/dist/runtime/component/types.d.mts +29 -4
- package/dist/runtime/component/virtualHost.mjs +83 -0
- package/dist/runtime/component/virtualHost.mjs.map +1 -0
- package/dist/runtime/host/index.d.mts +13 -0
- package/dist/runtime/host/index.mjs +47 -0
- package/dist/runtime/host/index.mjs.map +1 -0
- package/dist/runtime/host/types.d.mts +28 -0
- package/dist/runtime/hostGlobals.d.mts +9 -0
- package/dist/runtime/hostGlobals.mjs +39 -0
- package/dist/runtime/hostGlobals.mjs.map +1 -0
- package/dist/runtime/index.d.mts +21 -3
- package/dist/runtime/index.mjs +26 -4
- package/dist/runtime/index.mjs.map +1 -0
- package/dist/runtime/legacyTemplate/dom.mjs +3 -3
- package/dist/runtime/legacyTemplate/dom.mjs.map +1 -1
- package/dist/runtime/legacyTemplate/expression.mjs +9 -9
- package/dist/runtime/legacyTemplate/expression.mjs.map +1 -1
- package/dist/runtime/legacyTemplate/index.mjs +6 -6
- package/dist/runtime/legacyTemplate/index.mjs.map +1 -1
- package/dist/runtime/nativeComponents/canvas/index.mjs +53 -0
- package/dist/runtime/nativeComponents/canvas/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/checkbox.mjs +137 -0
- package/dist/runtime/nativeComponents/checkbox.mjs.map +1 -0
- package/dist/runtime/nativeComponents/cover/index.mjs +23 -0
- package/dist/runtime/nativeComponents/cover/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/form.d.mts +7 -0
- package/dist/runtime/nativeComponents/form.mjs +50 -0
- package/dist/runtime/nativeComponents/form.mjs.map +1 -0
- package/dist/runtime/nativeComponents/formControl.mjs +61 -0
- package/dist/runtime/nativeComponents/formControl.mjs.map +1 -0
- package/dist/runtime/nativeComponents/helpers.mjs +25 -0
- package/dist/runtime/nativeComponents/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/icon/helpers.mjs +42 -0
- package/dist/runtime/nativeComponents/icon/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/icon/index.mjs +45 -0
- package/dist/runtime/nativeComponents/icon/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/icon/style.mjs +176 -0
- package/dist/runtime/nativeComponents/icon/style.mjs.map +1 -0
- package/dist/runtime/nativeComponents/image.d.mts +8 -0
- package/dist/runtime/nativeComponents/image.mjs +121 -0
- package/dist/runtime/nativeComponents/image.mjs.map +1 -0
- package/dist/runtime/nativeComponents/index.d.mts +11 -0
- package/dist/runtime/nativeComponents/index.mjs +83 -0
- package/dist/runtime/nativeComponents/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/input.d.mts +8 -0
- package/dist/runtime/nativeComponents/input.mjs +131 -0
- package/dist/runtime/nativeComponents/input.mjs.map +1 -0
- package/dist/runtime/nativeComponents/label.mjs +36 -0
- package/dist/runtime/nativeComponents/label.mjs.map +1 -0
- package/dist/runtime/nativeComponents/mediaRegistry.mjs +47 -0
- package/dist/runtime/nativeComponents/mediaRegistry.mjs.map +1 -0
- package/dist/runtime/nativeComponents/movable/helpers.mjs +23 -0
- package/dist/runtime/nativeComponents/movable/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/movable/index.mjs +117 -0
- package/dist/runtime/nativeComponents/movable/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/navigator.mjs +200 -0
- package/dist/runtime/nativeComponents/navigator.mjs.map +1 -0
- package/dist/runtime/nativeComponents/picker/editors.mjs +74 -0
- package/dist/runtime/nativeComponents/picker/editors.mjs.map +1 -0
- package/dist/runtime/nativeComponents/picker/helpers.mjs +57 -0
- package/dist/runtime/nativeComponents/picker/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/picker/index.mjs +210 -0
- package/dist/runtime/nativeComponents/picker/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/picker/style.mjs +71 -0
- package/dist/runtime/nativeComponents/picker/style.mjs.map +1 -0
- package/dist/runtime/nativeComponents/pickerView/column.mjs +134 -0
- package/dist/runtime/nativeComponents/pickerView/column.mjs.map +1 -0
- package/dist/runtime/nativeComponents/pickerView/helpers.mjs +17 -0
- package/dist/runtime/nativeComponents/pickerView/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/pickerView/index.mjs +128 -0
- package/dist/runtime/nativeComponents/pickerView/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/pickerView/style.mjs +58 -0
- package/dist/runtime/nativeComponents/pickerView/style.mjs.map +1 -0
- package/dist/runtime/nativeComponents/primitives.mjs +16 -0
- package/dist/runtime/nativeComponents/primitives.mjs.map +1 -0
- package/dist/runtime/nativeComponents/progress/helpers.mjs +29 -0
- package/dist/runtime/nativeComponents/progress/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/progress/index.mjs +130 -0
- package/dist/runtime/nativeComponents/progress/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/progress/style.mjs +40 -0
- package/dist/runtime/nativeComponents/progress/style.mjs.map +1 -0
- package/dist/runtime/nativeComponents/radio.mjs +147 -0
- package/dist/runtime/nativeComponents/radio.mjs.map +1 -0
- package/dist/runtime/nativeComponents/richText/helpers.mjs +230 -0
- package/dist/runtime/nativeComponents/richText/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/richText/index.mjs +74 -0
- package/dist/runtime/nativeComponents/richText/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/scrollView.d.mts +15 -0
- package/dist/runtime/nativeComponents/scrollView.mjs +79 -0
- package/dist/runtime/nativeComponents/scrollView.mjs.map +1 -0
- package/dist/runtime/nativeComponents/slider/helpers.mjs +28 -0
- package/dist/runtime/nativeComponents/slider/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/slider/index.mjs +120 -0
- package/dist/runtime/nativeComponents/slider/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/slider/style.mjs +60 -0
- package/dist/runtime/nativeComponents/slider/style.mjs.map +1 -0
- package/dist/runtime/nativeComponents/style.mjs +41 -0
- package/dist/runtime/nativeComponents/style.mjs.map +1 -0
- package/dist/runtime/nativeComponents/swiper/helpers.mjs +52 -0
- package/dist/runtime/nativeComponents/swiper/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/swiper/index.mjs +235 -0
- package/dist/runtime/nativeComponents/swiper/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/swiper/item.mjs +14 -0
- package/dist/runtime/nativeComponents/swiper/item.mjs.map +1 -0
- package/dist/runtime/nativeComponents/swiper/style.mjs +20 -0
- package/dist/runtime/nativeComponents/swiper/style.mjs.map +1 -0
- package/dist/runtime/nativeComponents/switch.d.mts +7 -0
- package/dist/runtime/nativeComponents/switch.mjs +132 -0
- package/dist/runtime/nativeComponents/switch.mjs.map +1 -0
- package/dist/runtime/nativeComponents/textarea.d.mts +9 -0
- package/dist/runtime/nativeComponents/textarea.mjs +144 -0
- package/dist/runtime/nativeComponents/textarea.mjs.map +1 -0
- package/dist/runtime/nativeComponents/video/helpers.d.mts +12 -0
- package/dist/runtime/nativeComponents/video/helpers.mjs +21 -0
- package/dist/runtime/nativeComponents/video/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/video/index.mjs +124 -0
- package/dist/runtime/nativeComponents/video/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/video/style.mjs +14 -0
- package/dist/runtime/nativeComponents/video/style.mjs.map +1 -0
- package/dist/runtime/navigationBar/index.mjs +1 -3
- package/dist/runtime/navigationBar/index.mjs.map +1 -1
- package/dist/runtime/pageLayout.d.mts +9 -0
- package/dist/runtime/pageLayout.mjs +16 -0
- package/dist/runtime/pageLayout.mjs.map +1 -0
- package/dist/runtime/polyfill/animation.mjs +120 -0
- package/dist/runtime/polyfill/animation.mjs.map +1 -0
- package/dist/runtime/polyfill/appState.mjs +1 -1
- package/dist/runtime/polyfill/appState.mjs.map +1 -1
- package/dist/runtime/polyfill/async.d.mts +7 -0
- package/dist/runtime/polyfill/async.mjs.map +1 -1
- package/dist/runtime/polyfill/canvasContext.mjs +41 -0
- package/dist/runtime/polyfill/canvasContext.mjs.map +1 -1
- package/dist/runtime/polyfill/device.mjs +1 -1
- package/dist/runtime/polyfill/device.mjs.map +1 -1
- package/dist/runtime/polyfill/deviceApi.mjs +6 -3
- package/dist/runtime/polyfill/deviceApi.mjs.map +1 -1
- package/dist/runtime/polyfill/deviceAuthSystemApi.mjs +8 -2
- package/dist/runtime/polyfill/deviceAuthSystemApi.mjs.map +1 -1
- package/dist/runtime/polyfill/eventBus.mjs +56 -0
- package/dist/runtime/polyfill/eventBus.mjs.map +1 -0
- package/dist/runtime/polyfill/fileSystemManager.mjs +5 -2
- package/dist/runtime/polyfill/fileSystemManager.mjs.map +1 -1
- package/dist/runtime/polyfill/files.mjs +10 -10
- package/dist/runtime/polyfill/files.mjs.map +1 -1
- package/dist/runtime/polyfill/font.mjs +33 -0
- package/dist/runtime/polyfill/font.mjs.map +1 -0
- package/dist/runtime/polyfill/index.d.mts +2 -2
- package/dist/runtime/polyfill/index.mjs +49 -45
- package/dist/runtime/polyfill/index.mjs.map +1 -1
- package/dist/runtime/polyfill/interaction.mjs +7 -6
- package/dist/runtime/polyfill/interaction.mjs.map +1 -1
- package/dist/runtime/polyfill/interactionApi.mjs +9 -5
- package/dist/runtime/polyfill/interactionApi.mjs.map +1 -1
- package/dist/runtime/polyfill/intersectionObserver.mjs +106 -0
- package/dist/runtime/polyfill/intersectionObserver.mjs.map +1 -0
- package/dist/runtime/polyfill/locale.mjs +14 -0
- package/dist/runtime/polyfill/locale.mjs.map +1 -0
- package/dist/runtime/polyfill/locationApi.mjs +11 -6
- package/dist/runtime/polyfill/locationApi.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaActions.mjs +2 -2
- package/dist/runtime/polyfill/mediaActions.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaApi/file.mjs +3 -2
- package/dist/runtime/polyfill/mediaApi/file.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaApi/info.mjs +6 -4
- package/dist/runtime/polyfill/mediaApi/info.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaApi/picker.mjs +16 -8
- package/dist/runtime/polyfill/mediaApi/picker.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaApi/preview.mjs +4 -2
- package/dist/runtime/polyfill/mediaApi/preview.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaApi/process.mjs +4 -2
- package/dist/runtime/polyfill/mediaApi/process.mjs.map +1 -1
- package/dist/runtime/polyfill/menuApi.mjs +39 -4
- package/dist/runtime/polyfill/menuApi.mjs.map +1 -1
- package/dist/runtime/polyfill/navigationBarRuntime.mjs +6 -1
- package/dist/runtime/polyfill/navigationBarRuntime.mjs.map +1 -1
- package/dist/runtime/polyfill/network/request.mjs +2 -2
- package/dist/runtime/polyfill/network/request.mjs.map +1 -1
- package/dist/runtime/polyfill/platformApi.mjs +3 -2
- package/dist/runtime/polyfill/platformApi.mjs.map +1 -1
- package/dist/runtime/polyfill/routeRuntime/appLifecycle.mjs +88 -0
- package/dist/runtime/polyfill/routeRuntime/appLifecycle.mjs.map +1 -0
- package/dist/runtime/polyfill/routeRuntime/dom.mjs +44 -15
- package/dist/runtime/polyfill/routeRuntime/dom.mjs.map +1 -1
- package/dist/runtime/polyfill/routeRuntime/history.d.mts +30 -0
- package/dist/runtime/polyfill/routeRuntime/history.mjs +148 -0
- package/dist/runtime/polyfill/routeRuntime/history.mjs.map +1 -0
- package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs +39 -8
- package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs.map +1 -1
- package/dist/runtime/polyfill/routeRuntime/options.d.mts +11 -1
- package/dist/runtime/polyfill/routeRuntime/options.mjs +0 -1
- package/dist/runtime/polyfill/routeRuntime/options.mjs.map +1 -1
- package/dist/runtime/polyfill/routeRuntime/result.mjs +12 -0
- package/dist/runtime/polyfill/routeRuntime/result.mjs.map +1 -0
- package/dist/runtime/polyfill/routeRuntime/scroll.mjs +39 -0
- package/dist/runtime/polyfill/routeRuntime/scroll.mjs.map +1 -0
- package/dist/runtime/polyfill/routeRuntime/stack.mjs +122 -0
- package/dist/runtime/polyfill/routeRuntime/stack.mjs.map +1 -0
- package/dist/runtime/polyfill/routeRuntime.d.mts +26 -17
- package/dist/runtime/polyfill/routeRuntime.mjs +121 -96
- package/dist/runtime/polyfill/routeRuntime.mjs.map +1 -1
- package/dist/runtime/polyfill/runtimeDataApi.mjs +8 -3
- package/dist/runtime/polyfill/runtimeDataApi.mjs.map +1 -1
- package/dist/runtime/polyfill/runtimeOps.mjs +10 -6
- package/dist/runtime/polyfill/runtimeOps.mjs.map +1 -1
- package/dist/runtime/polyfill/selectorQuery.mjs +70 -14
- package/dist/runtime/polyfill/selectorQuery.mjs.map +1 -1
- package/dist/runtime/polyfill/storage.mjs +5 -2
- package/dist/runtime/polyfill/storage.mjs.map +1 -1
- package/dist/runtime/polyfill/storageAsync.mjs +4 -2
- package/dist/runtime/polyfill/storageAsync.mjs.map +1 -1
- package/dist/runtime/polyfill/system.mjs +31 -4
- package/dist/runtime/polyfill/system.mjs.map +1 -1
- package/dist/runtime/polyfill/systemApi.mjs +2 -1
- package/dist/runtime/polyfill/systemApi.mjs.map +1 -1
- package/dist/runtime/polyfill/types/locationRuntime.d.mts +1 -4
- package/dist/runtime/polyfill/types/platformRuntime.d.mts +9 -0
- package/dist/runtime/polyfill/types/systemAuth.d.mts +20 -9
- package/dist/runtime/polyfill/types/tabBarRuntime.d.mts +25 -0
- package/dist/runtime/polyfill/ui.mjs +2 -6
- package/dist/runtime/polyfill/ui.mjs.map +1 -1
- package/dist/runtime/polyfill/uiMediaApi.d.mts +11 -10
- package/dist/runtime/polyfill/uiMediaApi.mjs +26 -2
- package/dist/runtime/polyfill/uiMediaApi.mjs.map +1 -1
- package/dist/runtime/polyfill/videoContext.mjs +4 -0
- package/dist/runtime/polyfill/videoContext.mjs.map +1 -1
- package/dist/runtime/polyfill/vkSession.mjs +4 -14
- package/dist/runtime/polyfill/vkSession.mjs.map +1 -1
- package/dist/runtime/polyfill.d.mts +2 -2
- package/dist/runtime/renderContext.mjs +1 -1
- package/dist/runtime/renderContext.mjs.map +1 -1
- package/dist/runtime/rpx.mjs +17 -8
- package/dist/runtime/rpx.mjs.map +1 -1
- package/dist/runtime/seo/index.d.mts +31 -0
- package/dist/runtime/seo/index.mjs +94 -0
- package/dist/runtime/seo/index.mjs.map +1 -0
- package/dist/runtime/viewport/index.d.mts +12 -0
- package/dist/runtime/viewport/index.mjs +44 -0
- package/dist/runtime/viewport/index.mjs.map +1 -0
- package/dist/runtime/viewport/style.mjs +62 -0
- package/dist/runtime/viewport/style.mjs.map +1 -0
- package/dist/runtime/viewport/types.d.mts +14 -0
- package/dist/runtime/wevu.d.mts +20 -0
- package/dist/runtime/wevu.mjs +73 -0
- package/dist/runtime/wevu.mjs.map +1 -0
- package/dist/shared/nativeComponents.mjs +401 -0
- package/dist/shared/nativeComponents.mjs.map +1 -0
- package/dist/shared/tabBar.d.mts +19 -0
- package/dist/shared/tabBar.mjs +37 -0
- package/dist/shared/tabBar.mjs.map +1 -0
- package/dist/shared/wxml.mjs +3 -20
- package/dist/shared/wxml.mjs.map +1 -1
- package/package.json +14 -6
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//#region src/runtime/nativeComponents/pickerView/style.ts
|
|
2
|
+
const PICKER_VIEW_SHADOW_STYLE = `
|
|
3
|
+
:host { position: relative; min-width: 0; }
|
|
4
|
+
.viewport { position: relative; display: flex; width: 100%; height: 100%; overflow: hidden; }
|
|
5
|
+
slot { display: flex; width: 100%; height: 100%; }
|
|
6
|
+
::slotted(weapp-picker-view-column) { min-width: 0; flex: 1; }
|
|
7
|
+
.mask,
|
|
8
|
+
.indicator { position: absolute; right: 0; left: 0; pointer-events: none; }
|
|
9
|
+
.mask--top {
|
|
10
|
+
top: 0;
|
|
11
|
+
bottom: 50%;
|
|
12
|
+
background: linear-gradient(to bottom, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.35));
|
|
13
|
+
}
|
|
14
|
+
.mask--bottom {
|
|
15
|
+
top: 50%;
|
|
16
|
+
bottom: 0;
|
|
17
|
+
background: linear-gradient(to top, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.35));
|
|
18
|
+
}
|
|
19
|
+
.indicator {
|
|
20
|
+
top: 50%;
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
height: var(--weapp-picker-view-item-height, 34px);
|
|
23
|
+
border-top: 1px solid #e5e5e5;
|
|
24
|
+
border-bottom: 1px solid #e5e5e5;
|
|
25
|
+
transform: translateY(-50%);
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
const PICKER_VIEW_COLUMN_SHADOW_STYLE = `
|
|
29
|
+
:host { min-width: 0; overflow: hidden; }
|
|
30
|
+
.scroller {
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: 100%;
|
|
34
|
+
overflow-x: hidden;
|
|
35
|
+
overflow-y: auto;
|
|
36
|
+
overscroll-behavior: contain;
|
|
37
|
+
scrollbar-width: none;
|
|
38
|
+
scroll-snap-type: y mandatory;
|
|
39
|
+
touch-action: pan-y;
|
|
40
|
+
}
|
|
41
|
+
.scroller::-webkit-scrollbar { display: none; }
|
|
42
|
+
.spacer { width: 1px; height: calc((100% - var(--weapp-picker-view-item-height, 34px)) / 2); }
|
|
43
|
+
slot { display: block; }
|
|
44
|
+
::slotted(*) {
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
height: var(--weapp-picker-view-item-height, 34px);
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
line-height: var(--weapp-picker-view-item-height, 34px);
|
|
49
|
+
text-align: center;
|
|
50
|
+
text-overflow: ellipsis;
|
|
51
|
+
white-space: nowrap;
|
|
52
|
+
scroll-snap-align: center;
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
export { PICKER_VIEW_COLUMN_SHADOW_STYLE, PICKER_VIEW_SHADOW_STYLE };
|
|
58
|
+
//# sourceMappingURL=style.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.mjs","names":[],"sources":["../../../../src/runtime/nativeComponents/pickerView/style.ts"],"sourcesContent":["export const PICKER_VIEW_SHADOW_STYLE = `\n :host { position: relative; min-width: 0; }\n .viewport { position: relative; display: flex; width: 100%; height: 100%; overflow: hidden; }\n slot { display: flex; width: 100%; height: 100%; }\n ::slotted(weapp-picker-view-column) { min-width: 0; flex: 1; }\n .mask,\n .indicator { position: absolute; right: 0; left: 0; pointer-events: none; }\n .mask--top {\n top: 0;\n bottom: 50%;\n background: linear-gradient(to bottom, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.35));\n }\n .mask--bottom {\n top: 50%;\n bottom: 0;\n background: linear-gradient(to top, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.35));\n }\n .indicator {\n top: 50%;\n box-sizing: border-box;\n height: var(--weapp-picker-view-item-height, 34px);\n border-top: 1px solid #e5e5e5;\n border-bottom: 1px solid #e5e5e5;\n transform: translateY(-50%);\n }\n`\n\nexport const PICKER_VIEW_COLUMN_SHADOW_STYLE = `\n :host { min-width: 0; overflow: hidden; }\n .scroller {\n box-sizing: border-box;\n width: 100%;\n height: 100%;\n overflow-x: hidden;\n overflow-y: auto;\n overscroll-behavior: contain;\n scrollbar-width: none;\n scroll-snap-type: y mandatory;\n touch-action: pan-y;\n }\n .scroller::-webkit-scrollbar { display: none; }\n .spacer { width: 1px; height: calc((100% - var(--weapp-picker-view-item-height, 34px)) / 2); }\n slot { display: block; }\n ::slotted(*) {\n box-sizing: border-box;\n height: var(--weapp-picker-view-item-height, 34px);\n overflow: hidden;\n line-height: var(--weapp-picker-view-item-height, 34px);\n text-align: center;\n text-overflow: ellipsis;\n white-space: nowrap;\n scroll-snap-align: center;\n }\n`\n"],"mappings":";AAAA,MAAa,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BxC,MAAa,kCAAkC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { resolveContainingShadowRoot } from "./helpers.mjs";
|
|
2
|
+
import { ensureNativeComponentStyle } from "./style.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/runtime/nativeComponents/primitives.ts
|
|
5
|
+
const BaseElement = globalThis.HTMLElement ?? class {};
|
|
6
|
+
var StyledNativeElement = class extends BaseElement {
|
|
7
|
+
connectedCallback() {
|
|
8
|
+
ensureNativeComponentStyle(resolveContainingShadowRoot(this));
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
var WeappView = class extends StyledNativeElement {};
|
|
12
|
+
var WeappText = class extends StyledNativeElement {};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { WeappText, WeappView };
|
|
16
|
+
//# sourceMappingURL=primitives.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitives.mjs","names":[],"sources":["../../../src/runtime/nativeComponents/primitives.ts"],"sourcesContent":["import { resolveContainingShadowRoot } from './helpers'\nimport { ensureNativeComponentStyle } from './style'\n\nconst BaseElement = (globalThis.HTMLElement ?? class {}) as typeof HTMLElement\n\nclass StyledNativeElement extends BaseElement {\n connectedCallback() {\n ensureNativeComponentStyle(resolveContainingShadowRoot(this))\n }\n}\n\nexport class WeappView extends StyledNativeElement {}\nexport class WeappText extends StyledNativeElement {}\n"],"mappings":";;;;AAGA,MAAM,cAAe,WAAW,eAAe,MAAM,CAAC;AAEtD,IAAM,sBAAN,cAAkC,YAAY;CAC5C,oBAAoB;EAClB,2BAA2B,4BAA4B,IAAI,CAAC;CAC9D;AACF;AAEA,IAAa,YAAb,cAA+B,oBAAoB,CAAC;AACpD,IAAa,YAAb,cAA+B,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/runtime/nativeComponents/progress/helpers.ts
|
|
2
|
+
function finiteNumber(value, fallback) {
|
|
3
|
+
const numeric = Number(value);
|
|
4
|
+
return Number.isFinite(numeric) ? numeric : fallback;
|
|
5
|
+
}
|
|
6
|
+
function nonNegativeNumber(value, fallback) {
|
|
7
|
+
return Math.max(0, finiteNumber(value, fallback));
|
|
8
|
+
}
|
|
9
|
+
function resolveProgressConfig(input = {}) {
|
|
10
|
+
const activeMode = input.activeMode === "forwards" ? "forwards" : "backwards";
|
|
11
|
+
return {
|
|
12
|
+
percent: Math.min(100, Math.max(0, finiteNumber(input.percent, 0))),
|
|
13
|
+
strokeWidth: nonNegativeNumber(input.strokeWidth, 6),
|
|
14
|
+
duration: nonNegativeNumber(input.duration, 30),
|
|
15
|
+
borderRadius: nonNegativeNumber(input.borderRadius, 0),
|
|
16
|
+
fontSize: nonNegativeNumber(input.fontSize, 16),
|
|
17
|
+
activeMode
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function resolveProgressAnimationDuration(start, end, durationPerPercent) {
|
|
21
|
+
return Math.abs(end - start) * durationPerPercent;
|
|
22
|
+
}
|
|
23
|
+
function createProgressActiveEndDetail() {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { createProgressActiveEndDetail, resolveProgressAnimationDuration, resolveProgressConfig };
|
|
29
|
+
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.mjs","names":[],"sources":["../../../../src/runtime/nativeComponents/progress/helpers.ts"],"sourcesContent":["export type ProgressActiveMode = 'backwards' | 'forwards'\n\nexport interface ProgressConfigInput {\n percent?: unknown\n strokeWidth?: unknown\n duration?: unknown\n borderRadius?: unknown\n fontSize?: unknown\n activeMode?: unknown\n}\n\nexport interface ProgressConfig {\n percent: number\n strokeWidth: number\n duration: number\n borderRadius: number\n fontSize: number\n activeMode: ProgressActiveMode\n}\n\nfunction finiteNumber(value: unknown, fallback: number) {\n const numeric = Number(value)\n return Number.isFinite(numeric) ? numeric : fallback\n}\n\nfunction nonNegativeNumber(value: unknown, fallback: number) {\n return Math.max(0, finiteNumber(value, fallback))\n}\n\nexport function resolveProgressConfig(input: ProgressConfigInput = {}): ProgressConfig {\n const activeMode = input.activeMode === 'forwards' ? 'forwards' : 'backwards'\n return {\n percent: Math.min(100, Math.max(0, finiteNumber(input.percent, 0))),\n strokeWidth: nonNegativeNumber(input.strokeWidth, 6),\n duration: nonNegativeNumber(input.duration, 30),\n borderRadius: nonNegativeNumber(input.borderRadius, 0),\n fontSize: nonNegativeNumber(input.fontSize, 16),\n activeMode,\n }\n}\n\nexport function resolveProgressAnimationDuration(start: number, end: number, durationPerPercent: number) {\n return Math.abs(end - start) * durationPerPercent\n}\n\nexport function createProgressActiveEndDetail() {\n return {}\n}\n"],"mappings":";AAoBA,SAAS,aAAa,OAAgB,UAAkB;CACtD,MAAM,UAAU,OAAO,KAAK;CAC5B,OAAO,OAAO,SAAS,OAAO,IAAI,UAAU;AAC9C;AAEA,SAAS,kBAAkB,OAAgB,UAAkB;CAC3D,OAAO,KAAK,IAAI,GAAG,aAAa,OAAO,QAAQ,CAAC;AAClD;AAEA,SAAgB,sBAAsB,QAA6B,CAAC,GAAmB;CACrF,MAAM,aAAa,MAAM,eAAe,aAAa,aAAa;CAClE,OAAO;EACL,SAAS,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,aAAa,MAAM,SAAS,CAAC,CAAC,CAAC;EAClE,aAAa,kBAAkB,MAAM,aAAa,CAAC;EACnD,UAAU,kBAAkB,MAAM,UAAU,EAAE;EAC9C,cAAc,kBAAkB,MAAM,cAAc,CAAC;EACrD,UAAU,kBAAkB,MAAM,UAAU,EAAE;EAC9C;CACF;AACF;AAEA,SAAgB,iCAAiC,OAAe,KAAa,oBAA4B;CACvG,OAAO,KAAK,IAAI,MAAM,KAAK,IAAI;AACjC;AAEA,SAAgB,gCAAgC;CAC9C,OAAO,CAAC;AACV"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { getNativeComponentDescriptor } from "../../../shared/nativeComponents.mjs";
|
|
2
|
+
import { dispatchMiniProgramEvent, readBooleanAttribute, resolveContainingShadowRoot } from "../helpers.mjs";
|
|
3
|
+
import { ensureNativeComponentStyle } from "../style.mjs";
|
|
4
|
+
import { createProgressActiveEndDetail, resolveProgressAnimationDuration, resolveProgressConfig } from "./helpers.mjs";
|
|
5
|
+
import { PROGRESS_SHADOW_STYLE } from "./style.mjs";
|
|
6
|
+
|
|
7
|
+
//#region src/runtime/nativeComponents/progress/index.ts
|
|
8
|
+
const BaseElement = globalThis.HTMLElement ?? class {};
|
|
9
|
+
var WeappProgress = class extends BaseElement {
|
|
10
|
+
static observedAttributes = [...getNativeComponentDescriptor("progress").attributes];
|
|
11
|
+
#value;
|
|
12
|
+
#info;
|
|
13
|
+
#renderedPercent = 0;
|
|
14
|
+
#animationKey = "";
|
|
15
|
+
#animationToken = 0;
|
|
16
|
+
#animationFrame;
|
|
17
|
+
#animationTimer;
|
|
18
|
+
connectedCallback() {
|
|
19
|
+
ensureNativeComponentStyle(resolveContainingShadowRoot(this));
|
|
20
|
+
this.#ensureStructure();
|
|
21
|
+
this.#syncAttributes();
|
|
22
|
+
}
|
|
23
|
+
disconnectedCallback() {
|
|
24
|
+
this.#cancelAnimation();
|
|
25
|
+
}
|
|
26
|
+
attributeChangedCallback() {
|
|
27
|
+
this.#syncAttributes();
|
|
28
|
+
}
|
|
29
|
+
#ensureStructure() {
|
|
30
|
+
if (this.#value || typeof document === "undefined") return;
|
|
31
|
+
const root = this.shadowRoot ?? this.attachShadow({ mode: "open" });
|
|
32
|
+
const style = document.createElement("style");
|
|
33
|
+
style.textContent = PROGRESS_SHADOW_STYLE;
|
|
34
|
+
const track = document.createElement("div");
|
|
35
|
+
track.className = "track";
|
|
36
|
+
const value = document.createElement("div");
|
|
37
|
+
value.className = "value";
|
|
38
|
+
const info = document.createElement("span");
|
|
39
|
+
info.className = "info";
|
|
40
|
+
track.append(value);
|
|
41
|
+
root.append(style, track, info);
|
|
42
|
+
this.#value = value;
|
|
43
|
+
this.#info = info;
|
|
44
|
+
}
|
|
45
|
+
#syncAttributes() {
|
|
46
|
+
if (!this.#value || !this.#info) return;
|
|
47
|
+
const config = resolveProgressConfig({
|
|
48
|
+
percent: this.getAttribute("percent"),
|
|
49
|
+
strokeWidth: this.getAttribute("stroke-width"),
|
|
50
|
+
duration: this.getAttribute("duration"),
|
|
51
|
+
borderRadius: this.getAttribute("border-radius"),
|
|
52
|
+
fontSize: this.getAttribute("font-size"),
|
|
53
|
+
activeMode: this.getAttribute("active-mode")
|
|
54
|
+
});
|
|
55
|
+
this.style.setProperty("--weapp-progress-stroke-width", `${config.strokeWidth}px`);
|
|
56
|
+
this.style.setProperty("--weapp-progress-border-radius", `${config.borderRadius}px`);
|
|
57
|
+
this.style.setProperty("--weapp-progress-font-size", `${config.fontSize}px`);
|
|
58
|
+
this.style.setProperty("--weapp-progress-active-color", this.getAttribute("active-color") ?? this.getAttribute("color") ?? "#09bb07");
|
|
59
|
+
this.style.setProperty("--weapp-progress-background-color", this.getAttribute("background-color") ?? "#ebebeb");
|
|
60
|
+
this.#info.hidden = !readBooleanAttribute(this, "show-info");
|
|
61
|
+
if (!readBooleanAttribute(this, "active")) {
|
|
62
|
+
this.#animationKey = "";
|
|
63
|
+
this.#cancelAnimation();
|
|
64
|
+
this.#setProgress(config.percent, 0);
|
|
65
|
+
this.#setInfo(config.percent);
|
|
66
|
+
this.#renderedPercent = config.percent;
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const animationKey = `${config.percent}:${config.duration}:${config.activeMode}`;
|
|
70
|
+
if (animationKey === this.#animationKey) return;
|
|
71
|
+
this.#animationKey = animationKey;
|
|
72
|
+
const start = config.activeMode === "backwards" ? 0 : this.#renderedPercent;
|
|
73
|
+
this.#renderedPercent = config.percent;
|
|
74
|
+
this.#animate(start, config.percent, resolveProgressAnimationDuration(start, config.percent, config.duration));
|
|
75
|
+
}
|
|
76
|
+
#setProgress(percent, duration) {
|
|
77
|
+
this.style.setProperty("--weapp-progress-percent", `${percent}%`);
|
|
78
|
+
this.style.setProperty("--weapp-progress-duration", `${duration}ms`);
|
|
79
|
+
}
|
|
80
|
+
#setInfo(percent) {
|
|
81
|
+
this.#info.textContent = `${Math.round(percent)}%`;
|
|
82
|
+
}
|
|
83
|
+
#animate(start, end, duration) {
|
|
84
|
+
this.#cancelAnimation();
|
|
85
|
+
const token = ++this.#animationToken;
|
|
86
|
+
this.#setProgress(start, 0);
|
|
87
|
+
this.#setInfo(start);
|
|
88
|
+
this.#value.offsetWidth;
|
|
89
|
+
requestAnimationFrame((startTime) => {
|
|
90
|
+
if (token !== this.#animationToken || !this.isConnected) return;
|
|
91
|
+
this.#setProgress(end, duration);
|
|
92
|
+
if (duration === 0 || start === end) {
|
|
93
|
+
queueMicrotask(() => this.#completeAnimation(token));
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
this.#animateInfo(token, start, end, duration, startTime);
|
|
97
|
+
this.#animationTimer = globalThis.setTimeout(() => this.#completeAnimation(token), duration + 50);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
#animateInfo(token, start, end, duration, startTime) {
|
|
101
|
+
const update = (time) => {
|
|
102
|
+
if (token !== this.#animationToken || !this.isConnected) return;
|
|
103
|
+
const progress = Math.min(1, Math.max(0, (time - startTime) / duration));
|
|
104
|
+
this.#setInfo(start + (end - start) * progress);
|
|
105
|
+
if (progress < 1) this.#animationFrame = requestAnimationFrame(update);
|
|
106
|
+
};
|
|
107
|
+
this.#animationFrame = requestAnimationFrame(update);
|
|
108
|
+
}
|
|
109
|
+
#completeAnimation(token) {
|
|
110
|
+
if (token !== this.#animationToken) return;
|
|
111
|
+
this.#cancelAnimation(false);
|
|
112
|
+
this.#setInfo(this.#renderedPercent);
|
|
113
|
+
dispatchMiniProgramEvent(this, "activeend", createProgressActiveEndDetail());
|
|
114
|
+
}
|
|
115
|
+
#cancelAnimation(invalidate = true) {
|
|
116
|
+
if (this.#animationFrame !== void 0) {
|
|
117
|
+
cancelAnimationFrame(this.#animationFrame);
|
|
118
|
+
this.#animationFrame = void 0;
|
|
119
|
+
}
|
|
120
|
+
if (this.#animationTimer !== void 0) {
|
|
121
|
+
globalThis.clearTimeout(this.#animationTimer);
|
|
122
|
+
this.#animationTimer = void 0;
|
|
123
|
+
}
|
|
124
|
+
if (invalidate) this.#animationToken += 1;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
//#endregion
|
|
129
|
+
export { WeappProgress, createProgressActiveEndDetail, resolveProgressAnimationDuration, resolveProgressConfig };
|
|
130
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["#ensureStructure","#syncAttributes","#cancelAnimation","#value","#info","#animationKey","#setProgress","#setInfo","#renderedPercent","#animate","#animationToken","#completeAnimation","#animateInfo","#animationTimer","#animationFrame"],"sources":["../../../../src/runtime/nativeComponents/progress/index.ts"],"sourcesContent":["import { getNativeComponentDescriptor } from '../../../shared/nativeComponents'\nimport { dispatchMiniProgramEvent, readBooleanAttribute, resolveContainingShadowRoot } from '../helpers'\nimport { ensureNativeComponentStyle } from '../style'\nimport {\n createProgressActiveEndDetail,\n resolveProgressAnimationDuration,\n resolveProgressConfig,\n} from './helpers'\nimport { PROGRESS_SHADOW_STYLE } from './style'\n\nconst BaseElement = (globalThis.HTMLElement ?? class {}) as typeof HTMLElement\n\nexport class WeappProgress extends BaseElement {\n static observedAttributes = [...getNativeComponentDescriptor('progress')!.attributes]\n\n #value?: HTMLDivElement\n #info?: HTMLSpanElement\n #renderedPercent = 0\n #animationKey = ''\n #animationToken = 0\n #animationFrame?: number\n #animationTimer?: ReturnType<typeof globalThis.setTimeout>\n\n connectedCallback() {\n ensureNativeComponentStyle(resolveContainingShadowRoot(this))\n this.#ensureStructure()\n this.#syncAttributes()\n }\n\n disconnectedCallback() {\n this.#cancelAnimation()\n }\n\n attributeChangedCallback() {\n this.#syncAttributes()\n }\n\n #ensureStructure() {\n if (this.#value || typeof document === 'undefined') {\n return\n }\n const root = this.shadowRoot ?? this.attachShadow({ mode: 'open' })\n const style = document.createElement('style')\n style.textContent = PROGRESS_SHADOW_STYLE\n const track = document.createElement('div')\n track.className = 'track'\n const value = document.createElement('div')\n value.className = 'value'\n const info = document.createElement('span')\n info.className = 'info'\n track.append(value)\n root.append(style, track, info)\n this.#value = value\n this.#info = info\n }\n\n #syncAttributes() {\n if (!this.#value || !this.#info) {\n return\n }\n const config = resolveProgressConfig({\n percent: this.getAttribute('percent'),\n strokeWidth: this.getAttribute('stroke-width'),\n duration: this.getAttribute('duration'),\n borderRadius: this.getAttribute('border-radius'),\n fontSize: this.getAttribute('font-size'),\n activeMode: this.getAttribute('active-mode'),\n })\n this.style.setProperty('--weapp-progress-stroke-width', `${config.strokeWidth}px`)\n this.style.setProperty('--weapp-progress-border-radius', `${config.borderRadius}px`)\n this.style.setProperty('--weapp-progress-font-size', `${config.fontSize}px`)\n this.style.setProperty('--weapp-progress-active-color', this.getAttribute('active-color') ?? this.getAttribute('color') ?? '#09bb07')\n this.style.setProperty('--weapp-progress-background-color', this.getAttribute('background-color') ?? '#ebebeb')\n this.#info.hidden = !readBooleanAttribute(this, 'show-info')\n\n if (!readBooleanAttribute(this, 'active')) {\n this.#animationKey = ''\n this.#cancelAnimation()\n this.#setProgress(config.percent, 0)\n this.#setInfo(config.percent)\n this.#renderedPercent = config.percent\n return\n }\n\n const animationKey = `${config.percent}:${config.duration}:${config.activeMode}`\n if (animationKey === this.#animationKey) {\n return\n }\n this.#animationKey = animationKey\n const start = config.activeMode === 'backwards' ? 0 : this.#renderedPercent\n this.#renderedPercent = config.percent\n this.#animate(\n start,\n config.percent,\n resolveProgressAnimationDuration(start, config.percent, config.duration),\n )\n }\n\n #setProgress(percent: number, duration: number) {\n this.style.setProperty('--weapp-progress-percent', `${percent}%`)\n this.style.setProperty('--weapp-progress-duration', `${duration}ms`)\n }\n\n #setInfo(percent: number) {\n this.#info!.textContent = `${Math.round(percent)}%`\n }\n\n #animate(start: number, end: number, duration: number) {\n this.#cancelAnimation()\n const token = ++this.#animationToken\n this.#setProgress(start, 0)\n this.#setInfo(start)\n void this.#value!.offsetWidth\n requestAnimationFrame((startTime) => {\n if (token !== this.#animationToken || !this.isConnected) {\n return\n }\n this.#setProgress(end, duration)\n if (duration === 0 || start === end) {\n queueMicrotask(() => this.#completeAnimation(token))\n return\n }\n this.#animateInfo(token, start, end, duration, startTime)\n this.#animationTimer = globalThis.setTimeout(\n () => this.#completeAnimation(token),\n duration + 50,\n )\n })\n }\n\n #animateInfo(token: number, start: number, end: number, duration: number, startTime: number) {\n const update = (time: number) => {\n if (token !== this.#animationToken || !this.isConnected) {\n return\n }\n const progress = Math.min(1, Math.max(0, (time - startTime) / duration))\n this.#setInfo(start + (end - start) * progress)\n if (progress < 1) {\n this.#animationFrame = requestAnimationFrame(update)\n }\n }\n this.#animationFrame = requestAnimationFrame(update)\n }\n\n #completeAnimation(token: number) {\n if (token !== this.#animationToken) {\n return\n }\n this.#cancelAnimation(false)\n this.#setInfo(this.#renderedPercent)\n dispatchMiniProgramEvent(this, 'activeend', createProgressActiveEndDetail())\n }\n\n #cancelAnimation(invalidate = true) {\n if (this.#animationFrame !== undefined) {\n cancelAnimationFrame(this.#animationFrame)\n this.#animationFrame = undefined\n }\n if (this.#animationTimer !== undefined) {\n globalThis.clearTimeout(this.#animationTimer)\n this.#animationTimer = undefined\n }\n if (invalidate) {\n this.#animationToken += 1\n }\n }\n}\n\nexport * from './helpers'\n"],"mappings":";;;;;;;AAUA,MAAM,cAAe,WAAW,eAAe,MAAM,CAAC;AAEtD,IAAa,gBAAb,cAAmC,YAAY;CAC7C,OAAO,qBAAqB,CAAC,GAAG,6BAA6B,UAAU,CAAC,CAAE,UAAU;CAEpF;CACA;CACA,mBAAmB;CACnB,gBAAgB;CAChB,kBAAkB;CAClB;CACA;CAEA,oBAAoB;EAClB,2BAA2B,4BAA4B,IAAI,C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ACH;CAEA,aAAa,OAAe,OAAe,KAAa,UAAkB,WAAmB;EAC3F,MAAM,UAAU,SAAiB;GAC/B,IAAI,UAAU,KAAKD,mBAAmB,CAAC,KAAK,aAC1C;GAEF,MAAM,WAAW,KAAK,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,aAAa,QAAQ,CAAC;GACvE,KAAKH,SAAS,SAAS,MAAM,SAAS,QAAQ;GAC9C,IAAI,WAAW,GACb,KAAKO,kBAAkB,sBAAsB,MAAM;EAEvD;EACA,KAAKA,kBAAkB,sBAAsB,MAAM;CACrD;CAEA,mBAAmB,OAAe;EAChC,IAAI,UAAU,KAAKJ,iBACjB;EAEF,KAAKR,iBAAiB,KAAK;EAC3B,KAAKK,SAAS,KAAKC,gBAAgB;EACnC,yBAAyB,MAAM,aAAa,8BAA8B,CAAC;CAC7E;CAEA,iBAAiB,aAAa,MAAM;EAClC,IAAI,KAAKM,oBAAoB,QAAW;GACtC,qBAAqB,KAAKA,eAAe;GACzC,KAAKA,kBAAkB;EACzB;EACA,IAAI,KAAKD,oBAAoB,QAAW;GACtC,WAAW,aAAa,KAAKA,eAAe;GAC5C,KAAKA,kBAAkB;EACzB;EACA,IAAI,YACF,KAAKH,mBAAmB;CAE5B;AACF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//#region src/runtime/nativeComponents/progress/style.ts
|
|
2
|
+
const PROGRESS_SHADOW_STYLE = `
|
|
3
|
+
:host {
|
|
4
|
+
min-width: 0;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.track {
|
|
8
|
+
position: relative;
|
|
9
|
+
min-width: 0;
|
|
10
|
+
height: var(--weapp-progress-stroke-width);
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
flex: 1;
|
|
13
|
+
background: var(--weapp-progress-background-color);
|
|
14
|
+
border-radius: var(--weapp-progress-border-radius);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.value {
|
|
18
|
+
width: var(--weapp-progress-percent);
|
|
19
|
+
height: 100%;
|
|
20
|
+
background: var(--weapp-progress-active-color);
|
|
21
|
+
border-radius: inherit;
|
|
22
|
+
transition-property: width;
|
|
23
|
+
transition-duration: var(--weapp-progress-duration);
|
|
24
|
+
transition-timing-function: linear;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.info {
|
|
28
|
+
min-width: 2.5em;
|
|
29
|
+
margin-left: 5px;
|
|
30
|
+
color: #888;
|
|
31
|
+
font-size: var(--weapp-progress-font-size);
|
|
32
|
+
line-height: 1;
|
|
33
|
+
text-align: left;
|
|
34
|
+
white-space: nowrap;
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { PROGRESS_SHADOW_STYLE };
|
|
40
|
+
//# sourceMappingURL=style.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.mjs","names":[],"sources":["../../../../src/runtime/nativeComponents/progress/style.ts"],"sourcesContent":["export const PROGRESS_SHADOW_STYLE = `\n :host {\n min-width: 0;\n }\n\n .track {\n position: relative;\n min-width: 0;\n height: var(--weapp-progress-stroke-width);\n overflow: hidden;\n flex: 1;\n background: var(--weapp-progress-background-color);\n border-radius: var(--weapp-progress-border-radius);\n }\n\n .value {\n width: var(--weapp-progress-percent);\n height: 100%;\n background: var(--weapp-progress-active-color);\n border-radius: inherit;\n transition-property: width;\n transition-duration: var(--weapp-progress-duration);\n transition-timing-function: linear;\n }\n\n .info {\n min-width: 2.5em;\n margin-left: 5px;\n color: #888;\n font-size: var(--weapp-progress-font-size);\n line-height: 1;\n text-align: left;\n white-space: nowrap;\n }\n`\n"],"mappings":";AAAA,MAAa,wBAAwB"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { getNativeComponentDescriptor } from "../../shared/nativeComponents.mjs";
|
|
2
|
+
import { connectFormControl, disconnectFormControl, findClosestComposedElement } from "./formControl.mjs";
|
|
3
|
+
import { dispatchMiniProgramEvent, readBooleanAttribute, resolveContainingShadowRoot } from "./helpers.mjs";
|
|
4
|
+
import { ensureNativeComponentStyle } from "./style.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/runtime/nativeComponents/radio.ts
|
|
7
|
+
const BaseElement = globalThis.HTMLElement ?? class {};
|
|
8
|
+
function collectRadioGroupValue(radios) {
|
|
9
|
+
return Array.from(radios).find((radio) => radio.checked && !radio.disabled)?.value ?? "";
|
|
10
|
+
}
|
|
11
|
+
var WeappRadioGroup = class extends BaseElement {
|
|
12
|
+
static observedAttributes = [...getNativeComponentDescriptor("radio-group").attributes];
|
|
13
|
+
get formControlName() {
|
|
14
|
+
return this.getAttribute("name") ?? "";
|
|
15
|
+
}
|
|
16
|
+
get formControlValue() {
|
|
17
|
+
return collectRadioGroupValue(this.querySelectorAll("weapp-radio"));
|
|
18
|
+
}
|
|
19
|
+
get formControlDisabled() {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
connectedCallback() {
|
|
23
|
+
ensureNativeComponentStyle(resolveContainingShadowRoot(this));
|
|
24
|
+
connectFormControl(this);
|
|
25
|
+
this.#normalizeCheckedRadios();
|
|
26
|
+
}
|
|
27
|
+
disconnectedCallback() {
|
|
28
|
+
disconnectFormControl(this);
|
|
29
|
+
}
|
|
30
|
+
formReset() {
|
|
31
|
+
for (const radio of this.querySelectorAll("weapp-radio")) radio.formReset();
|
|
32
|
+
this.#normalizeCheckedRadios();
|
|
33
|
+
}
|
|
34
|
+
notifyRadioChange(source) {
|
|
35
|
+
for (const radio of this.querySelectorAll("weapp-radio")) if (radio !== source) radio.setCheckedFromGroup(false);
|
|
36
|
+
dispatchMiniProgramEvent(this, "change", { value: source.value });
|
|
37
|
+
}
|
|
38
|
+
#normalizeCheckedRadios() {
|
|
39
|
+
let selected = false;
|
|
40
|
+
for (const radio of this.querySelectorAll("weapp-radio")) {
|
|
41
|
+
if (!radio.checked) continue;
|
|
42
|
+
if (selected) radio.setCheckedFromGroup(false);
|
|
43
|
+
selected = true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var WeappRadio = class extends BaseElement {
|
|
48
|
+
static observedAttributes = [...getNativeComponentDescriptor("radio").attributes];
|
|
49
|
+
#input;
|
|
50
|
+
#initialChecked = false;
|
|
51
|
+
#initialCheckedCaptured = false;
|
|
52
|
+
get value() {
|
|
53
|
+
return this.getAttribute("value") ?? "";
|
|
54
|
+
}
|
|
55
|
+
set value(value) {
|
|
56
|
+
this.setAttribute("value", value ?? "");
|
|
57
|
+
}
|
|
58
|
+
get checked() {
|
|
59
|
+
return this.#input?.checked ?? readBooleanAttribute(this, "checked");
|
|
60
|
+
}
|
|
61
|
+
set checked(value) {
|
|
62
|
+
this.toggleAttribute("checked", Boolean(value));
|
|
63
|
+
}
|
|
64
|
+
get disabled() {
|
|
65
|
+
return readBooleanAttribute(this, "disabled");
|
|
66
|
+
}
|
|
67
|
+
connectedCallback() {
|
|
68
|
+
ensureNativeComponentStyle(resolveContainingShadowRoot(this));
|
|
69
|
+
if (!this.#initialCheckedCaptured) {
|
|
70
|
+
this.#initialChecked = readBooleanAttribute(this, "checked");
|
|
71
|
+
this.#initialCheckedCaptured = true;
|
|
72
|
+
}
|
|
73
|
+
this.#ensureStructure();
|
|
74
|
+
this.#syncAttributes();
|
|
75
|
+
}
|
|
76
|
+
attributeChangedCallback() {
|
|
77
|
+
this.#syncAttributes();
|
|
78
|
+
}
|
|
79
|
+
formReset() {
|
|
80
|
+
this.setCheckedFromGroup(this.#initialChecked);
|
|
81
|
+
}
|
|
82
|
+
formActivate() {
|
|
83
|
+
if (!this.disabled) this.#input?.click();
|
|
84
|
+
}
|
|
85
|
+
setCheckedFromGroup(checked) {
|
|
86
|
+
if (this.#input) this.#input.checked = checked;
|
|
87
|
+
}
|
|
88
|
+
#ensureStructure() {
|
|
89
|
+
if (this.#input || typeof document === "undefined") return;
|
|
90
|
+
const root = this.shadowRoot ?? this.attachShadow({ mode: "open" });
|
|
91
|
+
const style = document.createElement("style");
|
|
92
|
+
style.textContent = `
|
|
93
|
+
:host { --weapp-control-color: #07c160; }
|
|
94
|
+
label { display: inline-flex; align-items: center; cursor: pointer; }
|
|
95
|
+
input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
|
|
96
|
+
.control {
|
|
97
|
+
position: relative;
|
|
98
|
+
box-sizing: border-box;
|
|
99
|
+
width: 23px;
|
|
100
|
+
height: 23px;
|
|
101
|
+
flex: 0 0 23px;
|
|
102
|
+
border: 1px solid #d1d1d1;
|
|
103
|
+
border-radius: 50%;
|
|
104
|
+
background: #ffffff;
|
|
105
|
+
}
|
|
106
|
+
input:checked + .control { border-color: var(--weapp-control-color); background: var(--weapp-control-color); }
|
|
107
|
+
input:checked + .control::after {
|
|
108
|
+
position: absolute;
|
|
109
|
+
top: 6px;
|
|
110
|
+
left: 6px;
|
|
111
|
+
width: 9px;
|
|
112
|
+
height: 9px;
|
|
113
|
+
border-radius: 50%;
|
|
114
|
+
background: #ffffff;
|
|
115
|
+
content: '';
|
|
116
|
+
}
|
|
117
|
+
input:disabled + .control { border-color: #d8d8d8; background: #eeeeee; opacity: 0.7; }
|
|
118
|
+
.content { margin-left: 8px; }
|
|
119
|
+
`;
|
|
120
|
+
const label = document.createElement("label");
|
|
121
|
+
const input = document.createElement("input");
|
|
122
|
+
input.type = "radio";
|
|
123
|
+
const control = document.createElement("span");
|
|
124
|
+
control.className = "control";
|
|
125
|
+
const content = document.createElement("span");
|
|
126
|
+
content.className = "content";
|
|
127
|
+
content.append(document.createElement("slot"));
|
|
128
|
+
input.addEventListener("change", (event) => {
|
|
129
|
+
event.stopPropagation();
|
|
130
|
+
findClosestComposedElement(this, "weapp-radio-group")?.notifyRadioChange(this);
|
|
131
|
+
});
|
|
132
|
+
label.append(input, control, content);
|
|
133
|
+
root.append(style, label);
|
|
134
|
+
this.#input = input;
|
|
135
|
+
}
|
|
136
|
+
#syncAttributes() {
|
|
137
|
+
if (!this.#input) return;
|
|
138
|
+
this.#input.checked = readBooleanAttribute(this, "checked");
|
|
139
|
+
this.#input.disabled = this.disabled;
|
|
140
|
+
this.#input.value = this.value;
|
|
141
|
+
this.style.setProperty("--weapp-control-color", this.getAttribute("color") || "#07c160");
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
//#endregion
|
|
146
|
+
export { WeappRadio, WeappRadioGroup, collectRadioGroupValue };
|
|
147
|
+
//# sourceMappingURL=radio.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio.mjs","names":["#normalizeCheckedRadios","#input","#initialCheckedCaptured","#initialChecked","#ensureStructure","#syncAttributes"],"sources":["../../../src/runtime/nativeComponents/radio.ts"],"sourcesContent":["import { getNativeComponentDescriptor } from '../../shared/nativeComponents'\nimport { connectFormControl, disconnectFormControl, findClosestComposedElement } from './formControl'\nimport { dispatchMiniProgramEvent, readBooleanAttribute, resolveContainingShadowRoot } from './helpers'\nimport { ensureNativeComponentStyle } from './style'\n\nconst BaseElement = (globalThis.HTMLElement ?? class {}) as typeof HTMLElement\n\nexport function collectRadioGroupValue(radios: ArrayLike<WeappRadio>) {\n return Array.from(radios).find(radio => radio.checked && !radio.disabled)?.value ?? ''\n}\n\nexport class WeappRadioGroup extends BaseElement {\n static observedAttributes = [...getNativeComponentDescriptor('radio-group')!.attributes]\n\n get formControlName() {\n return this.getAttribute('name') ?? ''\n }\n\n get formControlValue() {\n return collectRadioGroupValue(this.querySelectorAll<WeappRadio>('weapp-radio'))\n }\n\n get formControlDisabled() {\n return false\n }\n\n connectedCallback() {\n ensureNativeComponentStyle(resolveContainingShadowRoot(this))\n connectFormControl(this)\n this.#normalizeCheckedRadios()\n }\n\n disconnectedCallback() {\n disconnectFormControl(this)\n }\n\n formReset() {\n for (const radio of this.querySelectorAll<WeappRadio>('weapp-radio')) {\n radio.formReset()\n }\n this.#normalizeCheckedRadios()\n }\n\n notifyRadioChange(source: WeappRadio) {\n for (const radio of this.querySelectorAll<WeappRadio>('weapp-radio')) {\n if (radio !== source) {\n radio.setCheckedFromGroup(false)\n }\n }\n dispatchMiniProgramEvent(this, 'change', { value: source.value })\n }\n\n #normalizeCheckedRadios() {\n let selected = false\n for (const radio of this.querySelectorAll<WeappRadio>('weapp-radio')) {\n if (!radio.checked) {\n continue\n }\n if (selected) {\n radio.setCheckedFromGroup(false)\n }\n selected = true\n }\n }\n}\n\nexport class WeappRadio extends BaseElement {\n static observedAttributes = [...getNativeComponentDescriptor('radio')!.attributes]\n\n #input?: HTMLInputElement\n #initialChecked = false\n #initialCheckedCaptured = false\n\n get value() {\n return this.getAttribute('value') ?? ''\n }\n\n set value(value: string) {\n this.setAttribute('value', value ?? '')\n }\n\n get checked() {\n return this.#input?.checked ?? readBooleanAttribute(this, 'checked')\n }\n\n set checked(value: boolean) {\n this.toggleAttribute('checked', Boolean(value))\n }\n\n get disabled() {\n return readBooleanAttribute(this, 'disabled')\n }\n\n connectedCallback() {\n ensureNativeComponentStyle(resolveContainingShadowRoot(this))\n if (!this.#initialCheckedCaptured) {\n this.#initialChecked = readBooleanAttribute(this, 'checked')\n this.#initialCheckedCaptured = true\n }\n this.#ensureStructure()\n this.#syncAttributes()\n }\n\n attributeChangedCallback() {\n this.#syncAttributes()\n }\n\n formReset() {\n this.setCheckedFromGroup(this.#initialChecked)\n }\n\n formActivate() {\n if (!this.disabled) {\n this.#input?.click()\n }\n }\n\n setCheckedFromGroup(checked: boolean) {\n if (this.#input) {\n this.#input.checked = checked\n }\n }\n\n #ensureStructure() {\n if (this.#input || typeof document === 'undefined') {\n return\n }\n const root = this.shadowRoot ?? this.attachShadow({ mode: 'open' })\n const style = document.createElement('style')\n style.textContent = `\n :host { --weapp-control-color: #07c160; }\n label { display: inline-flex; align-items: center; cursor: pointer; }\n input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }\n .control {\n position: relative;\n box-sizing: border-box;\n width: 23px;\n height: 23px;\n flex: 0 0 23px;\n border: 1px solid #d1d1d1;\n border-radius: 50%;\n background: #ffffff;\n }\n input:checked + .control { border-color: var(--weapp-control-color); background: var(--weapp-control-color); }\n input:checked + .control::after {\n position: absolute;\n top: 6px;\n left: 6px;\n width: 9px;\n height: 9px;\n border-radius: 50%;\n background: #ffffff;\n content: '';\n }\n input:disabled + .control { border-color: #d8d8d8; background: #eeeeee; opacity: 0.7; }\n .content { margin-left: 8px; }\n `\n const label = document.createElement('label')\n const input = document.createElement('input')\n input.type = 'radio'\n const control = document.createElement('span')\n control.className = 'control'\n const content = document.createElement('span')\n content.className = 'content'\n content.append(document.createElement('slot'))\n input.addEventListener('change', (event) => {\n event.stopPropagation()\n const group = findClosestComposedElement(this, 'weapp-radio-group') as WeappRadioGroup | null\n group?.notifyRadioChange(this)\n })\n label.append(input, control, content)\n root.append(style, label)\n this.#input = input\n }\n\n #syncAttributes() {\n if (!this.#input) {\n return\n }\n this.#input.checked = readBooleanAttribute(this, 'checked')\n this.#input.disabled = this.disabled\n this.#input.value = this.value\n this.style.setProperty('--weapp-control-color', this.getAttribute('color') || '#07c160')\n }\n}\n"],"mappings":";;;;;;AAKA,MAAM,cAAe,WAAW,eAAe,MAAM,CAAC;AAEtD,SAAgB,uBAAuB,QAA+B;CACpE,OAAO,MAAM,KAAK,MAAM,CAAC,CAAC,MAAK,UAAS,MAAM,WAAW,CAAC,MAAM,QAAQ,CAAC,EAAE,SAAS;AACtF;AAEA,IAAa,kBAAb,cAAqC,YAAY;CAC/C,OAAO,qBAAqB,CAAC,GAAG,6BAA6B,aAAa,CAAC,CAAE,UAAU;CAEvF,IAAI,kBAAkB;EACpB,OAAO,KAAK,aAAa,MAAM,KAAK;CACtC;CAEA,IAAI,mBAAmB;EACrB,OAAO,uBAAuB,KAAK,iBAA6B,aAAa,CAAC;CAChF;CAEA,IAAI,sBAAsB;EACxB,OAAO;CACT;CAEA,oBAAoB;EAClB,2BAA2B,4BAA4B,IAAI,CAAC;EAC5D,mBAAmB,IAAI;EACvB,KAAKA,wBAAwB;CAC/B;CA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