@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,401 @@
|
|
|
1
|
+
//#region src/shared/nativeComponents.ts
|
|
2
|
+
const NATIVE_COMPONENT_DESCRIPTORS = Object.freeze([
|
|
3
|
+
{
|
|
4
|
+
name: "view",
|
|
5
|
+
webTag: "weapp-view",
|
|
6
|
+
attributes: [],
|
|
7
|
+
defaultStyle: "display: block; box-sizing: border-box;"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
name: "text",
|
|
11
|
+
webTag: "weapp-text",
|
|
12
|
+
attributes: [
|
|
13
|
+
"selectable",
|
|
14
|
+
"user-select",
|
|
15
|
+
"space",
|
|
16
|
+
"decode"
|
|
17
|
+
],
|
|
18
|
+
defaultStyle: "display: inline; box-sizing: border-box; white-space: pre-wrap;"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "image",
|
|
22
|
+
webTag: "weapp-image",
|
|
23
|
+
attributes: [
|
|
24
|
+
"src",
|
|
25
|
+
"mode",
|
|
26
|
+
"lazy-load",
|
|
27
|
+
"alt"
|
|
28
|
+
],
|
|
29
|
+
defaultStyle: "display: inline-block; box-sizing: border-box; width: 320px; height: 240px; overflow: hidden; vertical-align: middle;"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: "button",
|
|
33
|
+
webTag: "weapp-button",
|
|
34
|
+
attributes: [
|
|
35
|
+
"type",
|
|
36
|
+
"size",
|
|
37
|
+
"plain",
|
|
38
|
+
"disabled",
|
|
39
|
+
"loading",
|
|
40
|
+
"form-type",
|
|
41
|
+
"open-type"
|
|
42
|
+
],
|
|
43
|
+
defaultStyle: "display: block; box-sizing: border-box;"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "input",
|
|
47
|
+
webTag: "weapp-input",
|
|
48
|
+
attributes: [
|
|
49
|
+
"name",
|
|
50
|
+
"value",
|
|
51
|
+
"type",
|
|
52
|
+
"password",
|
|
53
|
+
"placeholder",
|
|
54
|
+
"disabled",
|
|
55
|
+
"maxlength",
|
|
56
|
+
"confirm-type",
|
|
57
|
+
"focus"
|
|
58
|
+
],
|
|
59
|
+
defaultStyle: "display: block; box-sizing: border-box; min-height: 1.4em;"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: "textarea",
|
|
63
|
+
webTag: "weapp-textarea",
|
|
64
|
+
attributes: [
|
|
65
|
+
"name",
|
|
66
|
+
"value",
|
|
67
|
+
"placeholder",
|
|
68
|
+
"disabled",
|
|
69
|
+
"maxlength",
|
|
70
|
+
"confirm-type",
|
|
71
|
+
"auto-focus",
|
|
72
|
+
"focus",
|
|
73
|
+
"auto-height"
|
|
74
|
+
],
|
|
75
|
+
defaultStyle: "display: block; box-sizing: border-box; width: 300px; height: 150px;"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "form",
|
|
79
|
+
webTag: "weapp-form",
|
|
80
|
+
attributes: [],
|
|
81
|
+
defaultStyle: "display: inline; box-sizing: border-box;"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "label",
|
|
85
|
+
webTag: "weapp-label",
|
|
86
|
+
attributes: ["for"],
|
|
87
|
+
defaultStyle: "display: inline; box-sizing: border-box; cursor: pointer;"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: "checkbox-group",
|
|
91
|
+
webTag: "weapp-checkbox-group",
|
|
92
|
+
attributes: ["name"],
|
|
93
|
+
defaultStyle: "display: block; box-sizing: border-box;"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "checkbox",
|
|
97
|
+
webTag: "weapp-checkbox",
|
|
98
|
+
attributes: [
|
|
99
|
+
"value",
|
|
100
|
+
"checked",
|
|
101
|
+
"disabled",
|
|
102
|
+
"color"
|
|
103
|
+
],
|
|
104
|
+
defaultStyle: "display: inline-flex; box-sizing: border-box; align-items: center; vertical-align: middle;"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "radio-group",
|
|
108
|
+
webTag: "weapp-radio-group",
|
|
109
|
+
attributes: ["name"],
|
|
110
|
+
defaultStyle: "display: block; box-sizing: border-box;"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "radio",
|
|
114
|
+
webTag: "weapp-radio",
|
|
115
|
+
attributes: [
|
|
116
|
+
"value",
|
|
117
|
+
"checked",
|
|
118
|
+
"disabled",
|
|
119
|
+
"color"
|
|
120
|
+
],
|
|
121
|
+
defaultStyle: "display: inline-flex; box-sizing: border-box; align-items: center; vertical-align: middle;"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: "switch",
|
|
125
|
+
webTag: "weapp-switch",
|
|
126
|
+
attributes: [
|
|
127
|
+
"name",
|
|
128
|
+
"checked",
|
|
129
|
+
"disabled",
|
|
130
|
+
"type",
|
|
131
|
+
"color"
|
|
132
|
+
],
|
|
133
|
+
defaultStyle: "display: inline-flex; box-sizing: border-box; align-items: center; vertical-align: middle;"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: "picker",
|
|
137
|
+
webTag: "weapp-picker",
|
|
138
|
+
attributes: [
|
|
139
|
+
"name",
|
|
140
|
+
"header-text",
|
|
141
|
+
"mode",
|
|
142
|
+
"range",
|
|
143
|
+
"range-key",
|
|
144
|
+
"value",
|
|
145
|
+
"start",
|
|
146
|
+
"end",
|
|
147
|
+
"fields",
|
|
148
|
+
"custom-item",
|
|
149
|
+
"level",
|
|
150
|
+
"disabled"
|
|
151
|
+
],
|
|
152
|
+
propertyAttributes: ["range", "value"],
|
|
153
|
+
defaultStyle: "display: block; box-sizing: border-box;"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: "picker-view",
|
|
157
|
+
webTag: "weapp-picker-view",
|
|
158
|
+
attributes: [
|
|
159
|
+
"value",
|
|
160
|
+
"mask-class",
|
|
161
|
+
"indicator-style",
|
|
162
|
+
"indicator-class",
|
|
163
|
+
"mask-style",
|
|
164
|
+
"immediate-change"
|
|
165
|
+
],
|
|
166
|
+
propertyAttributes: ["value"],
|
|
167
|
+
defaultStyle: "position: relative; display: flex; box-sizing: border-box; height: 225px; overflow: hidden;"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: "picker-view-column",
|
|
171
|
+
webTag: "weapp-picker-view-column",
|
|
172
|
+
attributes: ["indicator-style"],
|
|
173
|
+
defaultStyle: "display: block; box-sizing: border-box; min-width: 0; height: 100%; flex: 1;"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "slider",
|
|
177
|
+
webTag: "weapp-slider",
|
|
178
|
+
attributes: [
|
|
179
|
+
"name",
|
|
180
|
+
"min",
|
|
181
|
+
"max",
|
|
182
|
+
"step",
|
|
183
|
+
"disabled",
|
|
184
|
+
"value",
|
|
185
|
+
"color",
|
|
186
|
+
"selected-color",
|
|
187
|
+
"active-color",
|
|
188
|
+
"background-color",
|
|
189
|
+
"block-size",
|
|
190
|
+
"block-color",
|
|
191
|
+
"show-value"
|
|
192
|
+
],
|
|
193
|
+
defaultStyle: "display: block; box-sizing: border-box; margin: 10px 18px;"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: "icon",
|
|
197
|
+
webTag: "weapp-icon",
|
|
198
|
+
attributes: [
|
|
199
|
+
"type",
|
|
200
|
+
"size",
|
|
201
|
+
"color"
|
|
202
|
+
],
|
|
203
|
+
defaultStyle: "display: inline-flex; box-sizing: border-box; align-items: center; justify-content: center; vertical-align: middle;"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: "progress",
|
|
207
|
+
webTag: "weapp-progress",
|
|
208
|
+
attributes: [
|
|
209
|
+
"percent",
|
|
210
|
+
"show-info",
|
|
211
|
+
"stroke-width",
|
|
212
|
+
"color",
|
|
213
|
+
"active-color",
|
|
214
|
+
"background-color",
|
|
215
|
+
"active",
|
|
216
|
+
"active-mode",
|
|
217
|
+
"duration",
|
|
218
|
+
"border-radius",
|
|
219
|
+
"font-size"
|
|
220
|
+
],
|
|
221
|
+
defaultStyle: "display: flex; box-sizing: border-box; align-items: center;"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: "rich-text",
|
|
225
|
+
webTag: "weapp-rich-text",
|
|
226
|
+
attributes: [
|
|
227
|
+
"nodes",
|
|
228
|
+
"space",
|
|
229
|
+
"user-select"
|
|
230
|
+
],
|
|
231
|
+
propertyAttributes: ["nodes"],
|
|
232
|
+
defaultStyle: "display: block; box-sizing: border-box;"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
name: "scroll-view",
|
|
236
|
+
webTag: "weapp-scroll-view",
|
|
237
|
+
attributes: [
|
|
238
|
+
"scroll-x",
|
|
239
|
+
"scroll-y",
|
|
240
|
+
"scroll-top",
|
|
241
|
+
"scroll-left"
|
|
242
|
+
],
|
|
243
|
+
defaultStyle: "display: block; box-sizing: border-box;"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
name: "navigator",
|
|
247
|
+
webTag: "weapp-navigator",
|
|
248
|
+
attributes: [
|
|
249
|
+
"url",
|
|
250
|
+
"open-type",
|
|
251
|
+
"delta",
|
|
252
|
+
"target",
|
|
253
|
+
"app-id",
|
|
254
|
+
"path",
|
|
255
|
+
"extra-data",
|
|
256
|
+
"version",
|
|
257
|
+
"short-link",
|
|
258
|
+
"aria-label",
|
|
259
|
+
"hover-class",
|
|
260
|
+
"hover-start-time",
|
|
261
|
+
"hover-stay-time",
|
|
262
|
+
"hover-stop-propagation"
|
|
263
|
+
],
|
|
264
|
+
propertyAttributes: ["extra-data"],
|
|
265
|
+
defaultStyle: "display: block; box-sizing: border-box;"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
name: "swiper",
|
|
269
|
+
webTag: "weapp-swiper",
|
|
270
|
+
attributes: [
|
|
271
|
+
"current",
|
|
272
|
+
"current-item-id",
|
|
273
|
+
"autoplay",
|
|
274
|
+
"interval",
|
|
275
|
+
"duration",
|
|
276
|
+
"circular",
|
|
277
|
+
"vertical",
|
|
278
|
+
"indicator-dots",
|
|
279
|
+
"indicator-color",
|
|
280
|
+
"indicator-active-color",
|
|
281
|
+
"display-multiple-items",
|
|
282
|
+
"previous-margin",
|
|
283
|
+
"next-margin",
|
|
284
|
+
"disable-touch",
|
|
285
|
+
"easing-function"
|
|
286
|
+
],
|
|
287
|
+
defaultStyle: "display: block; box-sizing: border-box; height: 150px; overflow: hidden;"
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
name: "swiper-item",
|
|
291
|
+
webTag: "weapp-swiper-item",
|
|
292
|
+
attributes: ["item-id"],
|
|
293
|
+
defaultStyle: "display: block; box-sizing: border-box; width: 100%; height: 100%; overflow: hidden;"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
name: "canvas",
|
|
297
|
+
webTag: "weapp-canvas",
|
|
298
|
+
attributes: [
|
|
299
|
+
"id",
|
|
300
|
+
"canvas-id",
|
|
301
|
+
"type",
|
|
302
|
+
"disable-scroll",
|
|
303
|
+
"width",
|
|
304
|
+
"height"
|
|
305
|
+
],
|
|
306
|
+
defaultStyle: "display: block; box-sizing: border-box; width: 300px; height: 150px; overflow: hidden;"
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
name: "video",
|
|
310
|
+
webTag: "weapp-video",
|
|
311
|
+
attributes: [
|
|
312
|
+
"id",
|
|
313
|
+
"src",
|
|
314
|
+
"poster",
|
|
315
|
+
"autoplay",
|
|
316
|
+
"loop",
|
|
317
|
+
"muted",
|
|
318
|
+
"controls",
|
|
319
|
+
"initial-time",
|
|
320
|
+
"object-fit"
|
|
321
|
+
],
|
|
322
|
+
defaultStyle: "display: block; box-sizing: border-box; width: 300px; height: 225px; overflow: hidden;"
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
name: "cover-view",
|
|
326
|
+
webTag: "weapp-cover-view",
|
|
327
|
+
attributes: [],
|
|
328
|
+
defaultStyle: "position: absolute; z-index: 2; display: block; box-sizing: border-box; pointer-events: auto;"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
name: "cover-image",
|
|
332
|
+
webTag: "weapp-cover-image",
|
|
333
|
+
attributes: [
|
|
334
|
+
"src",
|
|
335
|
+
"mode",
|
|
336
|
+
"lazy-load",
|
|
337
|
+
"alt"
|
|
338
|
+
],
|
|
339
|
+
defaultStyle: "position: absolute; z-index: 2; display: block; box-sizing: border-box; width: 100%; height: 100%; overflow: hidden; pointer-events: auto;"
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
name: "movable-area",
|
|
343
|
+
webTag: "weapp-movable-area",
|
|
344
|
+
attributes: [],
|
|
345
|
+
defaultStyle: "position: relative; display: block; box-sizing: border-box; overflow: hidden;"
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
name: "movable-view",
|
|
349
|
+
webTag: "weapp-movable-view",
|
|
350
|
+
attributes: [
|
|
351
|
+
"direction",
|
|
352
|
+
"inertia",
|
|
353
|
+
"out-of-bounds",
|
|
354
|
+
"x",
|
|
355
|
+
"y",
|
|
356
|
+
"damping",
|
|
357
|
+
"friction",
|
|
358
|
+
"disabled",
|
|
359
|
+
"scale",
|
|
360
|
+
"scale-min",
|
|
361
|
+
"scale-max",
|
|
362
|
+
"scale-value",
|
|
363
|
+
"animation"
|
|
364
|
+
],
|
|
365
|
+
defaultStyle: "position: absolute; top: 0; left: 0; display: block; box-sizing: border-box; width: 10px; height: 10px; touch-action: none; user-select: none;"
|
|
366
|
+
}
|
|
367
|
+
]);
|
|
368
|
+
const descriptorMap = new Map(NATIVE_COMPONENT_DESCRIPTORS.map((descriptor) => [descriptor.name, descriptor]));
|
|
369
|
+
const KNOWN_UNSUPPORTED_NATIVE_COMPONENTS = /* @__PURE__ */ new Set([
|
|
370
|
+
"editor",
|
|
371
|
+
"keyboard-accessory",
|
|
372
|
+
"match-media",
|
|
373
|
+
"root-portal",
|
|
374
|
+
"page-container",
|
|
375
|
+
"share-element",
|
|
376
|
+
"audio",
|
|
377
|
+
"camera",
|
|
378
|
+
"live-player",
|
|
379
|
+
"live-pusher",
|
|
380
|
+
"map",
|
|
381
|
+
"web-view",
|
|
382
|
+
"ad",
|
|
383
|
+
"official-account",
|
|
384
|
+
"open-data"
|
|
385
|
+
]);
|
|
386
|
+
function getNativeComponentDescriptor(name) {
|
|
387
|
+
return descriptorMap.get(name.toLowerCase());
|
|
388
|
+
}
|
|
389
|
+
function resolveNativeComponentWebTag(name) {
|
|
390
|
+
return getNativeComponentDescriptor(name)?.webTag;
|
|
391
|
+
}
|
|
392
|
+
function resolveNativeComponentPropertyAttributes(name) {
|
|
393
|
+
return getNativeComponentDescriptor(name)?.propertyAttributes ?? [];
|
|
394
|
+
}
|
|
395
|
+
function isKnownUnsupportedNativeComponent(name) {
|
|
396
|
+
return KNOWN_UNSUPPORTED_NATIVE_COMPONENTS.has(name.toLowerCase());
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
//#endregion
|
|
400
|
+
export { NATIVE_COMPONENT_DESCRIPTORS, getNativeComponentDescriptor, isKnownUnsupportedNativeComponent, resolveNativeComponentPropertyAttributes, resolveNativeComponentWebTag };
|
|
401
|
+
//# sourceMappingURL=nativeComponents.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeComponents.mjs","names":[],"sources":["../../src/shared/nativeComponents.ts"],"sourcesContent":["export interface NativeComponentDescriptor {\n name: string\n webTag: string\n attributes: readonly string[]\n propertyAttributes?: readonly string[]\n defaultStyle: string\n}\n\nexport const NATIVE_COMPONENT_DESCRIPTORS = Object.freeze([\n {\n name: 'view',\n webTag: 'weapp-view',\n attributes: [],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'text',\n webTag: 'weapp-text',\n attributes: ['selectable', 'user-select', 'space', 'decode'],\n defaultStyle: 'display: inline; box-sizing: border-box; white-space: pre-wrap;',\n },\n {\n name: 'image',\n webTag: 'weapp-image',\n attributes: ['src', 'mode', 'lazy-load', 'alt'],\n defaultStyle: 'display: inline-block; box-sizing: border-box; width: 320px; height: 240px; overflow: hidden; vertical-align: middle;',\n },\n {\n name: 'button',\n webTag: 'weapp-button',\n attributes: ['type', 'size', 'plain', 'disabled', 'loading', 'form-type', 'open-type'],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'input',\n webTag: 'weapp-input',\n attributes: ['name', 'value', 'type', 'password', 'placeholder', 'disabled', 'maxlength', 'confirm-type', 'focus'],\n defaultStyle: 'display: block; box-sizing: border-box; min-height: 1.4em;',\n },\n {\n name: 'textarea',\n webTag: 'weapp-textarea',\n attributes: ['name', 'value', 'placeholder', 'disabled', 'maxlength', 'confirm-type', 'auto-focus', 'focus', 'auto-height'],\n defaultStyle: 'display: block; box-sizing: border-box; width: 300px; height: 150px;',\n },\n {\n name: 'form',\n webTag: 'weapp-form',\n attributes: [],\n defaultStyle: 'display: inline; box-sizing: border-box;',\n },\n {\n name: 'label',\n webTag: 'weapp-label',\n attributes: ['for'],\n defaultStyle: 'display: inline; box-sizing: border-box; cursor: pointer;',\n },\n {\n name: 'checkbox-group',\n webTag: 'weapp-checkbox-group',\n attributes: ['name'],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'checkbox',\n webTag: 'weapp-checkbox',\n attributes: ['value', 'checked', 'disabled', 'color'],\n defaultStyle: 'display: inline-flex; box-sizing: border-box; align-items: center; vertical-align: middle;',\n },\n {\n name: 'radio-group',\n webTag: 'weapp-radio-group',\n attributes: ['name'],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'radio',\n webTag: 'weapp-radio',\n attributes: ['value', 'checked', 'disabled', 'color'],\n defaultStyle: 'display: inline-flex; box-sizing: border-box; align-items: center; vertical-align: middle;',\n },\n {\n name: 'switch',\n webTag: 'weapp-switch',\n attributes: ['name', 'checked', 'disabled', 'type', 'color'],\n defaultStyle: 'display: inline-flex; box-sizing: border-box; align-items: center; vertical-align: middle;',\n },\n {\n name: 'picker',\n webTag: 'weapp-picker',\n attributes: ['name', 'header-text', 'mode', 'range', 'range-key', 'value', 'start', 'end', 'fields', 'custom-item', 'level', 'disabled'],\n propertyAttributes: ['range', 'value'],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'picker-view',\n webTag: 'weapp-picker-view',\n attributes: ['value', 'mask-class', 'indicator-style', 'indicator-class', 'mask-style', 'immediate-change'],\n propertyAttributes: ['value'],\n defaultStyle: 'position: relative; display: flex; box-sizing: border-box; height: 225px; overflow: hidden;',\n },\n {\n name: 'picker-view-column',\n webTag: 'weapp-picker-view-column',\n attributes: ['indicator-style'],\n defaultStyle: 'display: block; box-sizing: border-box; min-width: 0; height: 100%; flex: 1;',\n },\n {\n name: 'slider',\n webTag: 'weapp-slider',\n attributes: ['name', 'min', 'max', 'step', 'disabled', 'value', 'color', 'selected-color', 'active-color', 'background-color', 'block-size', 'block-color', 'show-value'],\n defaultStyle: 'display: block; box-sizing: border-box; margin: 10px 18px;',\n },\n {\n name: 'icon',\n webTag: 'weapp-icon',\n attributes: ['type', 'size', 'color'],\n defaultStyle: 'display: inline-flex; box-sizing: border-box; align-items: center; justify-content: center; vertical-align: middle;',\n },\n {\n name: 'progress',\n webTag: 'weapp-progress',\n attributes: ['percent', 'show-info', 'stroke-width', 'color', 'active-color', 'background-color', 'active', 'active-mode', 'duration', 'border-radius', 'font-size'],\n defaultStyle: 'display: flex; box-sizing: border-box; align-items: center;',\n },\n {\n name: 'rich-text',\n webTag: 'weapp-rich-text',\n attributes: ['nodes', 'space', 'user-select'],\n propertyAttributes: ['nodes'],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'scroll-view',\n webTag: 'weapp-scroll-view',\n attributes: ['scroll-x', 'scroll-y', 'scroll-top', 'scroll-left'],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'navigator',\n webTag: 'weapp-navigator',\n attributes: [\n 'url',\n 'open-type',\n 'delta',\n 'target',\n 'app-id',\n 'path',\n 'extra-data',\n 'version',\n 'short-link',\n 'aria-label',\n 'hover-class',\n 'hover-start-time',\n 'hover-stay-time',\n 'hover-stop-propagation',\n ],\n propertyAttributes: ['extra-data'],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'swiper',\n webTag: 'weapp-swiper',\n attributes: [\n 'current',\n 'current-item-id',\n 'autoplay',\n 'interval',\n 'duration',\n 'circular',\n 'vertical',\n 'indicator-dots',\n 'indicator-color',\n 'indicator-active-color',\n 'display-multiple-items',\n 'previous-margin',\n 'next-margin',\n 'disable-touch',\n 'easing-function',\n ],\n defaultStyle: 'display: block; box-sizing: border-box; height: 150px; overflow: hidden;',\n },\n {\n name: 'swiper-item',\n webTag: 'weapp-swiper-item',\n attributes: ['item-id'],\n defaultStyle: 'display: block; box-sizing: border-box; width: 100%; height: 100%; overflow: hidden;',\n },\n {\n name: 'canvas',\n webTag: 'weapp-canvas',\n attributes: ['id', 'canvas-id', 'type', 'disable-scroll', 'width', 'height'],\n defaultStyle: 'display: block; box-sizing: border-box; width: 300px; height: 150px; overflow: hidden;',\n },\n {\n name: 'video',\n webTag: 'weapp-video',\n attributes: ['id', 'src', 'poster', 'autoplay', 'loop', 'muted', 'controls', 'initial-time', 'object-fit'],\n defaultStyle: 'display: block; box-sizing: border-box; width: 300px; height: 225px; overflow: hidden;',\n },\n {\n name: 'cover-view',\n webTag: 'weapp-cover-view',\n attributes: [],\n defaultStyle: 'position: absolute; z-index: 2; display: block; box-sizing: border-box; pointer-events: auto;',\n },\n {\n name: 'cover-image',\n webTag: 'weapp-cover-image',\n attributes: ['src', 'mode', 'lazy-load', 'alt'],\n defaultStyle: 'position: absolute; z-index: 2; display: block; box-sizing: border-box; width: 100%; height: 100%; overflow: hidden; pointer-events: auto;',\n },\n {\n name: 'movable-area',\n webTag: 'weapp-movable-area',\n attributes: [],\n defaultStyle: 'position: relative; display: block; box-sizing: border-box; overflow: hidden;',\n },\n {\n name: 'movable-view',\n webTag: 'weapp-movable-view',\n attributes: ['direction', 'inertia', 'out-of-bounds', 'x', 'y', 'damping', 'friction', 'disabled', 'scale', 'scale-min', 'scale-max', 'scale-value', 'animation'],\n defaultStyle: 'position: absolute; top: 0; left: 0; display: block; box-sizing: border-box; width: 10px; height: 10px; touch-action: none; user-select: none;',\n },\n] as const satisfies readonly NativeComponentDescriptor[])\n\nexport type SupportedNativeComponentName = typeof NATIVE_COMPONENT_DESCRIPTORS[number]['name']\nexport type NativeComponentWebTag = typeof NATIVE_COMPONENT_DESCRIPTORS[number]['webTag']\n\nconst descriptorMap = new Map<string, NativeComponentDescriptor>(\n NATIVE_COMPONENT_DESCRIPTORS.map(descriptor => [descriptor.name, descriptor]),\n)\n\nconst KNOWN_UNSUPPORTED_NATIVE_COMPONENTS = new Set([\n 'editor',\n 'keyboard-accessory',\n 'match-media',\n 'root-portal',\n 'page-container',\n 'share-element',\n 'audio',\n 'camera',\n 'live-player',\n 'live-pusher',\n 'map',\n 'web-view',\n 'ad',\n 'official-account',\n 'open-data',\n])\n\nexport function getNativeComponentDescriptor(name: string) {\n return descriptorMap.get(name.toLowerCase())\n}\n\nexport function resolveNativeComponentWebTag(name: string) {\n return getNativeComponentDescriptor(name)?.webTag\n}\n\nexport function resolveNativeComponentPropertyAttributes(name: string) {\n return getNativeComponentDescriptor(name)?.propertyAttributes ?? []\n}\n\nexport function isKnownUnsupportedNativeComponent(name: string) {\n return KNOWN_UNSUPPORTED_NATIVE_COMPONENTS.has(name.toLowerCase())\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/shared/tabBar.d.ts
|
|
2
|
+
interface WebTabBarItem {
|
|
3
|
+
pagePath: string;
|
|
4
|
+
text: string;
|
|
5
|
+
iconPath?: string;
|
|
6
|
+
selectedIconPath?: string;
|
|
7
|
+
}
|
|
8
|
+
interface WebTabBarConfig {
|
|
9
|
+
color: string;
|
|
10
|
+
selectedColor: string;
|
|
11
|
+
backgroundColor: string;
|
|
12
|
+
borderStyle: 'black' | 'white';
|
|
13
|
+
position: 'bottom' | 'top';
|
|
14
|
+
custom: boolean;
|
|
15
|
+
list: WebTabBarItem[];
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { WebTabBarConfig, WebTabBarItem };
|
|
19
|
+
//# sourceMappingURL=tabBar.d.mts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//#region src/shared/tabBar.ts
|
|
2
|
+
function normalizeOptionalString(value) {
|
|
3
|
+
return typeof value === "string" && value.trim() ? value : void 0;
|
|
4
|
+
}
|
|
5
|
+
function normalizePagePath(value) {
|
|
6
|
+
return normalizeOptionalString(value)?.replace(/^\//, "");
|
|
7
|
+
}
|
|
8
|
+
function normalizeWebTabBarConfig(value) {
|
|
9
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return;
|
|
10
|
+
const source = value;
|
|
11
|
+
const list = (Array.isArray(source.list) ? source.list : []).flatMap((rawItem) => {
|
|
12
|
+
if (!rawItem || typeof rawItem !== "object" || Array.isArray(rawItem)) return [];
|
|
13
|
+
const item = rawItem;
|
|
14
|
+
const pagePath = normalizePagePath(item.pagePath);
|
|
15
|
+
if (!pagePath) return [];
|
|
16
|
+
return [{
|
|
17
|
+
pagePath,
|
|
18
|
+
text: normalizeOptionalString(item.text) ?? "",
|
|
19
|
+
iconPath: normalizeOptionalString(item.iconPath),
|
|
20
|
+
selectedIconPath: normalizeOptionalString(item.selectedIconPath)
|
|
21
|
+
}];
|
|
22
|
+
});
|
|
23
|
+
if (!list.length) return;
|
|
24
|
+
return {
|
|
25
|
+
color: normalizeOptionalString(source.color) ?? "#7a7e83",
|
|
26
|
+
selectedColor: normalizeOptionalString(source.selectedColor) ?? "#3cc51f",
|
|
27
|
+
backgroundColor: normalizeOptionalString(source.backgroundColor) ?? "#ffffff",
|
|
28
|
+
borderStyle: source.borderStyle === "white" ? "white" : "black",
|
|
29
|
+
position: source.position === "top" ? "top" : "bottom",
|
|
30
|
+
custom: source.custom === true,
|
|
31
|
+
list
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { normalizeWebTabBarConfig };
|
|
37
|
+
//# sourceMappingURL=tabBar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabBar.mjs","names":[],"sources":["../../src/shared/tabBar.ts"],"sourcesContent":["export interface WebTabBarItem {\n pagePath: string\n text: string\n iconPath?: string\n selectedIconPath?: string\n}\n\nexport interface WebTabBarConfig {\n color: string\n selectedColor: string\n backgroundColor: string\n borderStyle: 'black' | 'white'\n position: 'bottom' | 'top'\n custom: boolean\n list: WebTabBarItem[]\n}\n\nfunction normalizeOptionalString(value: unknown) {\n return typeof value === 'string' && value.trim() ? value : undefined\n}\n\nfunction normalizePagePath(value: unknown) {\n const path = normalizeOptionalString(value)\n return path?.replace(/^\\//, '')\n}\n\nexport function normalizeWebTabBarConfig(value: unknown): WebTabBarConfig | undefined {\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n return undefined\n }\n const source = value as Record<string, unknown>\n const rawList = Array.isArray(source.list) ? source.list : []\n const list = rawList.flatMap<WebTabBarItem>((rawItem) => {\n if (!rawItem || typeof rawItem !== 'object' || Array.isArray(rawItem)) {\n return []\n }\n const item = rawItem as Record<string, unknown>\n const pagePath = normalizePagePath(item.pagePath)\n if (!pagePath) {\n return []\n }\n return [{\n pagePath,\n text: normalizeOptionalString(item.text) ?? '',\n iconPath: normalizeOptionalString(item.iconPath),\n selectedIconPath: normalizeOptionalString(item.selectedIconPath),\n }]\n })\n if (!list.length) {\n return undefined\n }\n return {\n color: normalizeOptionalString(source.color) ?? '#7a7e83',\n selectedColor: normalizeOptionalString(source.selectedColor) ?? '#3cc51f',\n backgroundColor: normalizeOptionalString(source.backgroundColor) ?? '#ffffff',\n borderStyle: source.borderStyle === 'white' ? 'white' : 'black',\n position: source.position === 'top' ? 'top' : 'bottom',\n custom: source.custom === true,\n list,\n }\n}\n"],"mappings":";AAiBA,SAAS,wBAAwB,OAAgB;CAC/C,OAAO,OAAO,UAAU,YAAY,MAAM,KAAK,IAAI,QAAQ;AAC7D;AAEA,SAAS,kBAAkB,OAAgB;CAEzC,OADa,wBAAwB,KAC3B,CAAC,EAAE,QAAQ,OAAO,EAAE;AAChC;AAEA,SAAgB,yBAAyB,OAA6C;CACpF,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAC5D;CAEF,MAAM,SAAS;CAEf,MAAM,QADU,MAAM,QAAQ,OAAO,IAAI,IAAI,OAAO,OAAO,CAAC,EACxC,CAAC,SAAwB,YAAY;EACvD,IAAI,CAAC,WAAW,OAAO,YAAY,YAAY,MAAM,QAAQ,OAAO,GAClE,OAAO,CAAC;EAEV,MAAM,OAAO;EACb,MAAM,WAAW,kBAAkB,KAAK,QAAQ;EAChD,IAAI,CAAC,UACH,OAAO,CAAC;EAEV,OAAO,CAAC;GACN;GACA,MAAM,wBAAwB,KAAK,IAAI,KAAK;GAC5C,UAAU,wBAAwB,KAAK,QAAQ;GAC/C,kBAAkB,wBAAwB,KAAK,gBAAgB;EACjE,CAAC;CACH,CAAC;CACD,IAAI,CAAC,KAAK,QACR;CAEF,OAAO;EACL,OAAO,wBAAwB,OAAO,KAAK,KAAK;EAChD,eAAe,wBAAwB,OAAO,aAAa,KAAK;EAChE,iBAAiB,wBAAwB,OAAO,eAAe,KAAK;EACpE,aAAa,OAAO,gBAAgB,UAAU,UAAU;EACxD,UAAU,OAAO,aAAa,QAAQ,QAAQ;EAC9C,QAAQ,OAAO,WAAW;EAC1B;CACF;AACF"}
|
package/dist/shared/wxml.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolveNativeComponentWebTag } from "./nativeComponents.mjs";
|
|
1
2
|
import { getMiniProgramDirectivePrefix, getSupportedMiniProgramPlatforms } from "@weapp-core/shared";
|
|
2
3
|
|
|
3
4
|
//#region src/shared/wxml.ts
|
|
@@ -47,26 +48,9 @@ function hasControlAttribute(attribs, suffix) {
|
|
|
47
48
|
return resolveControlAttributeName(attribs, suffix) !== void 0;
|
|
48
49
|
}
|
|
49
50
|
function normalizeTagName(name) {
|
|
51
|
+
const nativeComponentTag = resolveNativeComponentWebTag(name);
|
|
52
|
+
if (nativeComponentTag) return nativeComponentTag;
|
|
50
53
|
switch (name) {
|
|
51
|
-
case "view":
|
|
52
|
-
case "cover-view":
|
|
53
|
-
case "navigator":
|
|
54
|
-
case "scroll-view":
|
|
55
|
-
case "swiper":
|
|
56
|
-
case "swiper-item":
|
|
57
|
-
case "movable-area":
|
|
58
|
-
case "movable-view":
|
|
59
|
-
case "cover-image": return "div";
|
|
60
|
-
case "text":
|
|
61
|
-
case "icon": return "span";
|
|
62
|
-
case "image": return "img";
|
|
63
|
-
case "button": return "weapp-button";
|
|
64
|
-
case "input": return "input";
|
|
65
|
-
case "textarea": return "textarea";
|
|
66
|
-
case "form": return "form";
|
|
67
|
-
case "label": return "label";
|
|
68
|
-
case "picker":
|
|
69
|
-
case "picker-view": return "select";
|
|
70
54
|
case "block": return "#fragment";
|
|
71
55
|
case "slot": return "slot";
|
|
72
56
|
default: return name || "div";
|
|
@@ -74,7 +58,6 @@ function normalizeTagName(name) {
|
|
|
74
58
|
}
|
|
75
59
|
function normalizeAttributeName(name) {
|
|
76
60
|
if (name === "class" || name === "style" || name.startsWith("data-")) return name;
|
|
77
|
-
if (name === "hover-class") return "data-hover-class";
|
|
78
61
|
return name.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
|
|
79
62
|
}
|
|
80
63
|
|
package/dist/shared/wxml.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wxml.mjs","names":[],"sources":["../../src/shared/wxml.ts"],"sourcesContent":["import { getMiniProgramDirectivePrefix, getSupportedMiniProgramPlatforms } from '@weapp-core/shared'\n\nconst CONTROL_ATTR_SUFFIXES = [\n 'if',\n 'elif',\n 'else',\n 'for',\n 'for-item',\n 'for-index',\n 'key',\n] as const\n\nexport type ControlAttrSuffix = typeof CONTROL_ATTR_SUFFIXES[number]\n\nexport const CONTROL_ATTR_PREFIXES = Array.from(new Set(\n getSupportedMiniProgramPlatforms().map(platform => getMiniProgramDirectivePrefix(platform)),\n))\n\nexport const TEMPLATE_IMPORT_TAG_NAMES = Array.from(new Set([\n 'import',\n ...CONTROL_ATTR_PREFIXES.map(prefix => `${prefix}-import`),\n]))\n\nexport const TEMPLATE_INCLUDE_TAG_NAMES = Array.from(new Set([\n 'include',\n ...CONTROL_ATTR_PREFIXES.map(prefix => `${prefix}-include`),\n]))\n\nexport const CONTROL_ATTRS = new Set([\n ...CONTROL_ATTR_PREFIXES.flatMap(prefix => CONTROL_ATTR_SUFFIXES.map(suffix => `${prefix}:${suffix}`)),\n])\n\nexport const EVENT_PREFIX_RE = /^(?:bind|catch|mut-bind|capture-bind|capture-catch)([\\w-]+)$/\nexport const EVENT_KIND_ALIAS: Record<string, string> = {\n tap: 'click',\n}\n\nexport const SELF_CLOSING_TAGS = new Set([\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'image',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n])\n\nexport function resolveControlAttributeName(\n attribs: Record<string, string>,\n suffix: ControlAttrSuffix,\n): string | undefined {\n for (const prefix of CONTROL_ATTR_PREFIXES) {\n const name = `${prefix}:${suffix}`\n if (name in attribs) {\n return name\n }\n }\n return undefined\n}\n\nexport function resolveControlAttributeValue(\n attribs: Record<string, string>,\n suffix: ControlAttrSuffix,\n): string | undefined {\n const name = resolveControlAttributeName(attribs, suffix)\n return name ? attribs[name] : undefined\n}\n\nexport function hasControlAttribute(\n attribs: Record<string, string>,\n suffix: ControlAttrSuffix,\n): boolean {\n return resolveControlAttributeName(attribs, suffix) !== undefined\n}\n\nexport function normalizeTagName(name: string) {\n
|
|
1
|
+
{"version":3,"file":"wxml.mjs","names":[],"sources":["../../src/shared/wxml.ts"],"sourcesContent":["import { getMiniProgramDirectivePrefix, getSupportedMiniProgramPlatforms } from '@weapp-core/shared'\nimport { resolveNativeComponentWebTag } from './nativeComponents'\n\nconst CONTROL_ATTR_SUFFIXES = [\n 'if',\n 'elif',\n 'else',\n 'for',\n 'for-item',\n 'for-index',\n 'key',\n] as const\n\nexport type ControlAttrSuffix = typeof CONTROL_ATTR_SUFFIXES[number]\n\nexport const CONTROL_ATTR_PREFIXES = Array.from(new Set(\n getSupportedMiniProgramPlatforms().map(platform => getMiniProgramDirectivePrefix(platform)),\n))\n\nexport const TEMPLATE_IMPORT_TAG_NAMES = Array.from(new Set([\n 'import',\n ...CONTROL_ATTR_PREFIXES.map(prefix => `${prefix}-import`),\n]))\n\nexport const TEMPLATE_INCLUDE_TAG_NAMES = Array.from(new Set([\n 'include',\n ...CONTROL_ATTR_PREFIXES.map(prefix => `${prefix}-include`),\n]))\n\nexport const CONTROL_ATTRS = new Set([\n ...CONTROL_ATTR_PREFIXES.flatMap(prefix => CONTROL_ATTR_SUFFIXES.map(suffix => `${prefix}:${suffix}`)),\n])\n\nexport const EVENT_PREFIX_RE = /^(?:bind|catch|mut-bind|capture-bind|capture-catch)([\\w-]+)$/\nexport const EVENT_KIND_ALIAS: Record<string, string> = {\n tap: 'click',\n}\n\nexport const SELF_CLOSING_TAGS = new Set([\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'image',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n])\n\nexport function resolveControlAttributeName(\n attribs: Record<string, string>,\n suffix: ControlAttrSuffix,\n): string | undefined {\n for (const prefix of CONTROL_ATTR_PREFIXES) {\n const name = `${prefix}:${suffix}`\n if (name in attribs) {\n return name\n }\n }\n return undefined\n}\n\nexport function resolveControlAttributeValue(\n attribs: Record<string, string>,\n suffix: ControlAttrSuffix,\n): string | undefined {\n const name = resolveControlAttributeName(attribs, suffix)\n return name ? attribs[name] : undefined\n}\n\nexport function hasControlAttribute(\n attribs: Record<string, string>,\n suffix: ControlAttrSuffix,\n): boolean {\n return resolveControlAttributeName(attribs, suffix) !== undefined\n}\n\nexport function normalizeTagName(name: string) {\n const nativeComponentTag = resolveNativeComponentWebTag(name)\n if (nativeComponentTag) {\n return nativeComponentTag\n }\n switch (name) {\n case 'block':\n return '#fragment'\n case 'slot':\n return 'slot'\n default:\n return name || 'div'\n }\n}\n\nexport function normalizeAttributeName(name: string) {\n if (name === 'class' || name === 'style' || name.startsWith('data-')) {\n return name\n }\n return name.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`)\n}\n"],"mappings":";;;;AAGA,MAAM,wBAAwB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAIA,MAAa,wBAAwB,MAAM,KAAK,IAAI,IAClD,iCAAiC,CAAC,CAAC,KAAI,aAAY,8BAA8B,QAAQ,CAAC,CAC5F,CAAC;AAED,MAAa,4BAA4B,MAAM,qBAAK,IAAI,IAAI,CAC1D,UACA,GAAG,sBAAsB,KAAI,WAAU,GAAG,OAAO,QAAQ,CAC3D,CAAC,CAAC;AAEF,MAAa,6BAA6B,MAAM,qBAAK,IAAI,IAAI,CAC3D,WACA,GAAG,sBAAsB,KAAI,WAAU,GAAG,OAAO,SAAS,CAC5D,CAAC,CAAC;AAEF,MAAa,gCAAgB,IAAI,IAAI,CACnC,GAAG,sBAAsB,SAAQ,WAAU,sBAAsB,KAAI,WAAU,GAAG,OAAO,GAAG,QAAQ,CAAC,CACvG,CAAC;AAED,MAAa,kBAAkB;AAC/B,MAAa,mBAA2C,EACtD,KAAK,QACP;AAEA,MAAa,oCAAoB,IAAI,IAAI;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAgB,4BACd,SACA,QACoB;CACpB,KAAK,MAAM,UAAU,uBAAuB;EAC1C,MAAM,OAAO,GAAG,OAAO,GAAG;EAC1B,IAAI,QAAQ,SACV,OAAO;CAEX;AAEF;AAEA,SAAgB,6BACd,SACA,QACoB;CACpB,MAAM,OAAO,4BAA4B,SAAS,MAAM;CACxD,OAAO,OAAO,QAAQ,QAAQ;AAChC;AAEA,SAAgB,oBACd,SACA,QACS;CACT,OAAO,4BAA4B,SAAS,MAAM,MAAM;AAC1D;AAEA,SAAgB,iBAAiB,MAAc;CAC7C,MAAM,qBAAqB,6BAA6B,IAAI;CAC5D,IAAI,oBACF,OAAO;CAET,QAAQ,MAAR;EACE,KAAK,SACH,OAAO;EACT,KAAK,QACH,OAAO;EACT,SACE,OAAO,QAAQ;CACnB;AACF;AAEA,SAAgB,uBAAuB,MAAc;CACnD,IAAI,SAAS,WAAW,SAAS,WAAW,KAAK,WAAW,OAAO,GACjE,OAAO;CAET,OAAO,KAAK,QAAQ,WAAU,UAAS,IAAI,MAAM,YAAY,GAAG;AAClE"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-vite/web",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.1",
|
|
5
5
|
"description": "Experimental web runtime for weapp-vite templates",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -52,20 +52,28 @@
|
|
|
52
52
|
"@babel/traverse": "^8.0.4",
|
|
53
53
|
"@babel/types": "^8.0.4",
|
|
54
54
|
"domhandler": "^6.0.1",
|
|
55
|
+
"esbuild": "^0.28.1",
|
|
55
56
|
"htmlparser2": "^12.0.0",
|
|
56
57
|
"lit": "^3.3.3",
|
|
57
|
-
"magic-string": "^1.
|
|
58
|
+
"magic-string": "^1.1.0",
|
|
58
59
|
"pathe": "^2.0.3",
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
60
|
+
"postcss": "^8.5.25",
|
|
61
|
+
"postcss-selector-parser": "^7.1.4",
|
|
62
|
+
"rolldown": "1.2.2",
|
|
63
|
+
"@weapp-core/constants": "0.1.15",
|
|
64
|
+
"@weapp-core/shared": "3.1.0",
|
|
65
|
+
"rolldown-require": "2.0.23",
|
|
66
|
+
"wevu": "6.19.1"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"happy-dom": "^20.11.1"
|
|
63
70
|
},
|
|
64
71
|
"scripts": {
|
|
65
72
|
"dev": "tsdown -w --sourcemap",
|
|
66
73
|
"build:watch": "tsdown -w --sourcemap",
|
|
67
74
|
"build": "tsdown",
|
|
68
75
|
"test": "vitest run",
|
|
76
|
+
"test:coverage": "cross-env WEAPP_VITE_WEB_COVERAGE_STRICT=1 vitest run --coverage",
|
|
69
77
|
"test:dev": "vitest",
|
|
70
78
|
"typecheck": "tsc --noEmit"
|
|
71
79
|
}
|