@weapp-vite/web 1.3.36 → 1.4.0
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 +13 -12
- package/dist/compiler/wxml/renderer.mjs.map +1 -1
- package/dist/compiler/wxml/specialNodes.mjs +6 -1
- 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 +29 -6
- package/dist/index.mjs +197 -4
- package/dist/index.mjs.map +1 -0
- 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 +56 -7
- 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 +245 -74
- 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 +4 -1
- package/dist/plugin/path.mjs.map +1 -1
- package/dist/plugin/register.mjs +48 -36
- package/dist/plugin/register.mjs.map +1 -1
- package/dist/plugin/scan.mjs +206 -94
- 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 +46 -1
- package/dist/plugin/vueSfc.mjs +149 -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 +35 -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/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 +32 -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 +3 -2
- 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 +7 -4
- 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 +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/menuApi.mjs +38 -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 +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/system.mjs +30 -3
- package/dist/runtime/polyfill/system.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 +13 -5
|
@@ -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":";AAQA,MAAa,+BAA+B,OAAO,OAAO;CACxD;EACE,MAAM;EACN,QAAQ;EACR,YAAY,CAAC;EACb,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAc;GAAe;GAAS;EAAQ;EAC3D,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAO;GAAQ;GAAa;EAAK;EAC9C,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAQ;GAAQ;GAAS;GAAY;GAAW;GAAa;EAAW;EACrF,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAQ;GAAS;GAAQ;GAAY;GAAe;GAAY;GAAa;GAAgB;EAAO;EACjH,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAQ;GAAS;GAAe;GAAY;GAAa;GAAgB;GAAc;GAAS;EAAa;EAC1H,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY,CAAC;EACb,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY,CAAC,KAAK;EAClB,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY,CAAC,MAAM;EACnB,cAAc;CAChB;CACA;EACE,MAAM;EACN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,CAAC;AAC7C;AAEA,SAAgB,6BAA6B,MAAc;CACzD,OAAO,6BAA6B,IAAI,CAAC,EAAE;AAC7C;AAEA,SAAgB,yCAAyC,MAAc;CACrE,OAAO,6BAA6B,IAAI,CAAC,EAAE,sBAAsB,CAAC;AACpE;AAEA,SAAgB,kCAAkC,MAAc;CAC9D,OAAO,oCAAoC,IAAI,KAAK,YAAY,CAAC;AACnE"}
|
|
@@ -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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-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
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": "^
|
|
58
|
+
"magic-string": "^1.1.0",
|
|
58
59
|
"pathe": "^2.0.3",
|
|
60
|
+
"postcss": "^8.5.24",
|
|
61
|
+
"postcss-selector-parser": "^7.1.4",
|
|
59
62
|
"rolldown": "1.1.5",
|
|
60
|
-
"@weapp-core/constants": "0.1.
|
|
61
|
-
"@weapp-core/shared": "3.0
|
|
62
|
-
"rolldown-require": "2.0.
|
|
63
|
+
"@weapp-core/constants": "0.1.15",
|
|
64
|
+
"@weapp-core/shared": "3.1.0",
|
|
65
|
+
"rolldown-require": "2.0.22",
|
|
66
|
+
"wevu": "6.19.0"
|
|
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
|
}
|