@weapp-vite/web 2.0.0 → 2.1.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/dist/_virtual/_rolldown/runtime.mjs +1 -2
- package/dist/compiler/wxml/attributes.mjs +12 -4
- package/dist/compiler/wxml/attributes.mjs.map +1 -1
- package/dist/compiler/wxml/compile.mjs +33 -39
- package/dist/compiler/wxml/compile.mjs.map +1 -1
- package/dist/compiler/wxml/dependency.mjs +10 -3
- package/dist/compiler/wxml/dependency.mjs.map +1 -1
- package/dist/compiler/wxml/interpolation.mjs +13 -3
- package/dist/compiler/wxml/interpolation.mjs.map +1 -1
- package/dist/compiler/wxml/nativeTags.mjs +60 -0
- package/dist/compiler/wxml/nativeTags.mjs.map +1 -0
- package/dist/compiler/wxml/navigation.mjs +1 -2
- package/dist/compiler/wxml/parser.mjs +1 -2
- package/dist/compiler/wxml/prepare.mjs +42 -0
- package/dist/compiler/wxml/prepare.mjs.map +1 -0
- package/dist/compiler/wxml/renderer.mjs +1 -2
- package/dist/compiler/wxml/specialNodes.mjs +1 -2
- package/dist/compiler/wxml/types.d.mts +0 -2
- package/dist/compiler/wxml/unknownTags.mjs +33 -0
- package/dist/compiler/wxml/unknownTags.mjs.map +1 -0
- package/dist/compiler/wxs.mjs +1 -2
- package/dist/css/wxss.d.mts +2 -19
- package/dist/css/wxss.mjs +5 -12
- package/dist/css/wxss.mjs.map +1 -1
- package/dist/index.d.mts +8 -3
- package/dist/index.mjs +8 -5
- package/dist/plugin/assets.d.mts +1 -2
- package/dist/plugin/assets.mjs +1 -2
- package/dist/plugin/constants.mjs +5 -4
- package/dist/plugin/constants.mjs.map +1 -1
- package/dist/plugin/dependencyScan.mjs +1 -2
- package/dist/plugin/entry.mjs +6 -4
- package/dist/plugin/entry.mjs.map +1 -1
- package/dist/plugin/files.mjs +1 -2
- package/dist/plugin/hostTypes.d.mts +1 -2
- package/dist/plugin/index.d.mts +0 -2
- package/dist/plugin/index.mjs +29 -24
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/plugin/layout.mjs +1 -2
- package/dist/plugin/navigation.mjs +1 -2
- package/dist/plugin/packageResolution.mjs +1 -2
- package/dist/plugin/path.mjs +1 -2
- package/dist/plugin/register.mjs +1 -2
- package/dist/plugin/scan.mjs +1 -2
- package/dist/plugin/scanConfig.mjs +1 -2
- package/dist/plugin/scanSfc.mjs +1 -2
- package/dist/plugin/sfcHmr.mjs +28 -10
- package/dist/plugin/sfcHmr.mjs.map +1 -1
- package/dist/plugin/state.mjs +1 -2
- package/dist/plugin/styleModule.mjs +1 -2
- package/dist/plugin/types.d.mts +2 -3
- package/dist/plugin/vueSfc.mjs +1 -2
- package/dist/runtime/appShell/container.mjs +1 -2
- package/dist/runtime/appShell/tabBar/index.mjs +1 -2
- package/dist/runtime/appShell/tabBar/style.mjs +1 -2
- package/dist/runtime/appStyle.mjs +1 -2
- package/dist/runtime/button/helpers.mjs +1 -2
- package/dist/runtime/button/index.d.mts +0 -2
- package/dist/runtime/button/index.mjs +1 -2
- package/dist/runtime/button/style.mjs +1 -2
- package/dist/runtime/component/behavior.mjs +1 -2
- package/dist/runtime/component/constants.mjs +1 -2
- package/dist/runtime/component/dom.mjs +1 -2
- package/dist/runtime/component/element.mjs +9 -2
- package/dist/runtime/component/element.mjs.map +1 -1
- package/dist/runtime/component/events.mjs +4 -4
- package/dist/runtime/component/events.mjs.map +1 -1
- package/dist/runtime/component/index.d.mts +0 -2
- package/dist/runtime/component/index.mjs +1 -2
- package/dist/runtime/component/observers.mjs +1 -2
- package/dist/runtime/component/publicInstance.mjs +1 -2
- package/dist/runtime/component/relations.mjs +1 -2
- package/dist/runtime/component/slots.mjs +1 -2
- package/dist/runtime/component/state.mjs +1 -2
- package/dist/runtime/component/types.d.mts +0 -2
- package/dist/runtime/component/utils.mjs +1 -2
- package/dist/runtime/component/virtualHost.mjs +1 -2
- package/dist/runtime/componentEvents.mjs +1 -2
- package/dist/runtime/dataset.mjs +49 -0
- package/dist/runtime/dataset.mjs.map +1 -0
- package/dist/runtime/datasetBinding.d.mts +13 -0
- package/dist/runtime/datasetBinding.mjs +40 -0
- package/dist/runtime/datasetBinding.mjs.map +1 -0
- package/dist/runtime/eventBinding.d.mts +1 -2
- package/dist/runtime/eventBinding.mjs +1 -2
- package/dist/runtime/execution.d.mts +0 -2
- package/dist/runtime/execution.mjs +1 -2
- package/dist/runtime/host/index.d.mts +0 -2
- package/dist/runtime/host/index.mjs +1 -2
- package/dist/runtime/host/types.d.mts +0 -2
- package/dist/runtime/hostGlobals.d.mts +1 -2
- package/dist/runtime/hostGlobals.mjs +1 -2
- package/dist/runtime/index.d.mts +8 -3
- package/dist/runtime/index.mjs +9 -7
- package/dist/runtime/index.mjs.map +1 -1
- package/dist/runtime/inlineStyle.d.mts +5 -0
- package/dist/runtime/inlineStyle.mjs +21 -0
- package/dist/runtime/inlineStyle.mjs.map +1 -0
- package/dist/runtime/inputHandlerResult.mjs +1 -2
- package/dist/runtime/legacyTemplate/dataset.mjs +53 -0
- package/dist/runtime/legacyTemplate/dataset.mjs.map +1 -0
- package/dist/runtime/legacyTemplate/dom.mjs +20 -5
- package/dist/runtime/legacyTemplate/dom.mjs.map +1 -1
- package/dist/runtime/legacyTemplate/expression.mjs +1 -2
- package/dist/runtime/legacyTemplate/index.d.mts +0 -2
- package/dist/runtime/legacyTemplate/index.mjs +23 -16
- package/dist/runtime/legacyTemplate/index.mjs.map +1 -1
- package/dist/runtime/legacyTemplate/types.d.mts +0 -2
- package/dist/runtime/nativeComponents/canvas/index.mjs +1 -2
- package/dist/runtime/nativeComponents/checkbox.mjs +1 -2
- package/dist/runtime/nativeComponents/cover/index.mjs +1 -2
- package/dist/runtime/nativeComponents/form.d.mts +0 -2
- package/dist/runtime/nativeComponents/form.mjs +1 -2
- package/dist/runtime/nativeComponents/formControl.mjs +1 -2
- package/dist/runtime/nativeComponents/helpers.mjs +1 -2
- package/dist/runtime/nativeComponents/icon/helpers.mjs +1 -2
- package/dist/runtime/nativeComponents/icon/index.mjs +1 -2
- package/dist/runtime/nativeComponents/icon/style.mjs +1 -2
- package/dist/runtime/nativeComponents/image.d.mts +0 -2
- package/dist/runtime/nativeComponents/image.mjs +1 -2
- package/dist/runtime/nativeComponents/index.d.mts +1 -3
- package/dist/runtime/nativeComponents/index.mjs +3 -4
- package/dist/runtime/nativeComponents/index.mjs.map +1 -1
- package/dist/runtime/nativeComponents/input.d.mts +0 -2
- package/dist/runtime/nativeComponents/input.mjs +1 -2
- package/dist/runtime/nativeComponents/label.mjs +1 -2
- package/dist/runtime/nativeComponents/mediaRegistry.mjs +1 -2
- package/dist/runtime/nativeComponents/movable/helpers.mjs +1 -2
- package/dist/runtime/nativeComponents/movable/index.mjs +1 -2
- package/dist/runtime/nativeComponents/navigator.mjs +1 -2
- package/dist/runtime/nativeComponents/picker/editors.mjs +1 -2
- package/dist/runtime/nativeComponents/picker/helpers.mjs +1 -2
- package/dist/runtime/nativeComponents/picker/index.mjs +1 -2
- package/dist/runtime/nativeComponents/picker/style.mjs +1 -2
- package/dist/runtime/nativeComponents/pickerView/column.mjs +1 -2
- package/dist/runtime/nativeComponents/pickerView/helpers.mjs +1 -2
- package/dist/runtime/nativeComponents/pickerView/index.mjs +1 -2
- package/dist/runtime/nativeComponents/pickerView/style.mjs +1 -2
- package/dist/runtime/nativeComponents/primitives.mjs +1 -2
- package/dist/runtime/nativeComponents/progress/helpers.mjs +1 -2
- package/dist/runtime/nativeComponents/progress/index.mjs +1 -2
- package/dist/runtime/nativeComponents/progress/style.mjs +1 -2
- package/dist/runtime/nativeComponents/radio.mjs +1 -2
- package/dist/runtime/nativeComponents/richText/index.mjs +3 -4
- package/dist/runtime/nativeComponents/richText/index.mjs.map +1 -1
- package/dist/runtime/nativeComponents/scrollView/boundaries.mjs +62 -0
- package/dist/runtime/nativeComponents/scrollView/boundaries.mjs.map +1 -0
- package/dist/runtime/nativeComponents/{scrollView.d.mts → scrollView/helpers.d.mts} +4 -5
- package/dist/runtime/nativeComponents/scrollView/helpers.mjs +14 -0
- package/dist/runtime/nativeComponents/scrollView/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/scrollView/index.mjs +193 -0
- package/dist/runtime/nativeComponents/scrollView/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/scrollView/position.mjs +43 -0
- package/dist/runtime/nativeComponents/scrollView/position.mjs.map +1 -0
- package/dist/runtime/nativeComponents/slider/helpers.mjs +1 -2
- package/dist/runtime/nativeComponents/slider/index.mjs +1 -2
- package/dist/runtime/nativeComponents/slider/style.mjs +1 -2
- package/dist/runtime/nativeComponents/style.mjs +1 -2
- package/dist/runtime/nativeComponents/swiper/helpers.mjs +1 -2
- package/dist/runtime/nativeComponents/swiper/index.mjs +1 -2
- package/dist/runtime/nativeComponents/swiper/item.mjs +1 -2
- package/dist/runtime/nativeComponents/swiper/style.mjs +1 -2
- package/dist/runtime/nativeComponents/switch.d.mts +0 -2
- package/dist/runtime/nativeComponents/switch.mjs +1 -2
- package/dist/runtime/nativeComponents/textarea.d.mts +0 -2
- package/dist/runtime/nativeComponents/textarea.mjs +1 -2
- package/dist/runtime/nativeComponents/video/helpers.d.mts +0 -2
- package/dist/runtime/nativeComponents/video/helpers.mjs +1 -2
- package/dist/runtime/nativeComponents/video/index.mjs +1 -2
- package/dist/runtime/nativeComponents/video/style.mjs +1 -2
- package/dist/runtime/navigationBar/index.d.mts +0 -2
- package/dist/runtime/navigationBar/index.mjs +1 -2
- package/dist/runtime/navigationBar/style.mjs +1 -2
- package/dist/runtime/pageLayout.d.mts +1 -2
- package/dist/runtime/pageLayout.mjs +1 -2
- package/dist/runtime/polyfill/ad.mjs +1 -2
- package/dist/runtime/polyfill/animation.mjs +1 -2
- package/dist/runtime/polyfill/appState.mjs +1 -2
- package/dist/runtime/polyfill/async.d.mts +0 -2
- package/dist/runtime/polyfill/async.mjs +1 -2
- package/dist/runtime/polyfill/auth.mjs +1 -2
- package/dist/runtime/polyfill/authApi.mjs +1 -2
- package/dist/runtime/polyfill/background.mjs +1 -2
- package/dist/runtime/polyfill/canvasContext.mjs +1 -2
- package/dist/runtime/polyfill/capability.mjs +1 -2
- package/dist/runtime/polyfill/cloud.mjs +1 -2
- package/dist/runtime/polyfill/device.mjs +1 -2
- package/dist/runtime/polyfill/deviceApi.mjs +1 -2
- package/dist/runtime/polyfill/deviceAuthSystemApi.d.mts +0 -2
- package/dist/runtime/polyfill/deviceAuthSystemApi.mjs +1 -2
- package/dist/runtime/polyfill/eventBus.mjs +1 -2
- package/dist/runtime/polyfill/filePicker.mjs +1 -2
- package/dist/runtime/polyfill/fileSystemManager.mjs +1 -2
- package/dist/runtime/polyfill/files.mjs +1 -2
- package/dist/runtime/polyfill/font.mjs +1 -2
- package/dist/runtime/polyfill/index.d.mts +4 -4
- package/dist/runtime/polyfill/index.mjs +12 -5
- package/dist/runtime/polyfill/index.mjs.map +1 -1
- package/dist/runtime/polyfill/interaction.mjs +1 -2
- package/dist/runtime/polyfill/interactionApi.mjs +1 -2
- package/dist/runtime/polyfill/intersectionObserver.mjs +4 -4
- package/dist/runtime/polyfill/intersectionObserver.mjs.map +1 -1
- package/dist/runtime/polyfill/lifecycleEvents.d.mts +12 -0
- package/dist/runtime/polyfill/lifecycleEvents.mjs +67 -0
- package/dist/runtime/polyfill/lifecycleEvents.mjs.map +1 -0
- package/dist/runtime/polyfill/locale.mjs +1 -2
- package/dist/runtime/polyfill/location.mjs +1 -2
- package/dist/runtime/polyfill/locationApi.mjs +1 -2
- package/dist/runtime/polyfill/mediaActions.mjs +1 -2
- package/dist/runtime/polyfill/mediaApi/file.mjs +1 -2
- package/dist/runtime/polyfill/mediaApi/info.mjs +1 -2
- package/dist/runtime/polyfill/mediaApi/picker.mjs +1 -2
- package/dist/runtime/polyfill/mediaApi/preview.mjs +1 -2
- package/dist/runtime/polyfill/mediaApi/process.mjs +1 -2
- package/dist/runtime/polyfill/mediaInfo.mjs +1 -2
- package/dist/runtime/polyfill/mediaPicker.mjs +1 -2
- package/dist/runtime/polyfill/mediaProcess.mjs +1 -2
- package/dist/runtime/polyfill/menuApi.mjs +5 -3
- package/dist/runtime/polyfill/menuApi.mjs.map +1 -1
- package/dist/runtime/polyfill/navigationBarRuntime.mjs +1 -2
- package/dist/runtime/polyfill/network/request.mjs +1 -2
- package/dist/runtime/polyfill/network/requestBridge.mjs +1 -2
- package/dist/runtime/polyfill/network/status.mjs +1 -2
- package/dist/runtime/polyfill/platformApi.mjs +1 -2
- package/dist/runtime/polyfill/platformRuntime.mjs +1 -2
- package/dist/runtime/polyfill/routeRuntime/appLifecycle.mjs +1 -2
- package/dist/runtime/polyfill/routeRuntime/dom.mjs +1 -2
- package/dist/runtime/polyfill/routeRuntime/events.d.mts +0 -2
- package/dist/runtime/polyfill/routeRuntime/events.mjs +1 -2
- package/dist/runtime/polyfill/routeRuntime/history.d.mts +0 -2
- package/dist/runtime/polyfill/routeRuntime/history.mjs +1 -2
- package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs +1 -2
- package/dist/runtime/polyfill/routeRuntime/options.d.mts +1 -2
- package/dist/runtime/polyfill/routeRuntime/options.mjs +1 -2
- package/dist/runtime/polyfill/routeRuntime/result.mjs +1 -2
- package/dist/runtime/polyfill/routeRuntime/scroll.mjs +37 -6
- package/dist/runtime/polyfill/routeRuntime/scroll.mjs.map +1 -1
- package/dist/runtime/polyfill/routeRuntime/stack.mjs +1 -2
- package/dist/runtime/polyfill/routeRuntime/url.mjs +1 -2
- package/dist/runtime/polyfill/routeRuntime.d.mts +2 -2
- package/dist/runtime/polyfill/routeRuntime.mjs +14 -5
- package/dist/runtime/polyfill/routeRuntime.mjs.map +1 -1
- package/dist/runtime/polyfill/runtimeCapabilityApi.mjs +1 -2
- package/dist/runtime/polyfill/runtimeDataApi.d.mts +0 -2
- package/dist/runtime/polyfill/runtimeDataApi.mjs +1 -2
- package/dist/runtime/polyfill/runtimeInfra.mjs +1 -2
- package/dist/runtime/polyfill/runtimeOps.mjs +1 -2
- package/dist/runtime/polyfill/selectorQuery.mjs +3 -3
- package/dist/runtime/polyfill/selectorQuery.mjs.map +1 -1
- package/dist/runtime/polyfill/storage.mjs +1 -2
- package/dist/runtime/polyfill/storageAsync.mjs +1 -2
- package/dist/runtime/polyfill/subscribe.mjs +1 -2
- package/dist/runtime/polyfill/system.mjs +1 -2
- package/dist/runtime/polyfill/systemApi.mjs +1 -2
- package/dist/runtime/polyfill/types/base.d.mts +0 -2
- package/dist/runtime/polyfill/types/common.d.mts +0 -2
- package/dist/runtime/polyfill/types/lifecycle.d.mts +12 -0
- package/dist/runtime/polyfill/types/locationRuntime.d.mts +0 -2
- package/dist/runtime/polyfill/types/mediaAuth.d.mts +0 -2
- package/dist/runtime/polyfill/types/platformRuntime.d.mts +0 -2
- package/dist/runtime/polyfill/types/systemAuth.d.mts +0 -2
- package/dist/runtime/polyfill/types/tabBarRuntime.d.mts +0 -2
- package/dist/runtime/polyfill/ui.mjs +1 -2
- package/dist/runtime/polyfill/uiFeedback.mjs +19 -5
- package/dist/runtime/polyfill/uiFeedback.mjs.map +1 -1
- package/dist/runtime/polyfill/uiMediaApi.d.mts +8 -2
- package/dist/runtime/polyfill/uiMediaApi.mjs +20 -5
- package/dist/runtime/polyfill/uiMediaApi.mjs.map +1 -1
- package/dist/runtime/polyfill/videoContext.mjs +1 -2
- package/dist/runtime/polyfill/vkSession.mjs +1 -2
- package/dist/runtime/polyfill/windowResize.mjs +1 -2
- package/dist/runtime/polyfill/worker.mjs +1 -2
- package/dist/runtime/polyfill.d.mts +4 -2
- package/dist/runtime/renderContext.d.mts +0 -2
- package/dist/runtime/renderContext.mjs +5 -4
- package/dist/runtime/renderContext.mjs.map +1 -1
- package/dist/runtime/rpx.d.mts +0 -2
- package/dist/runtime/rpx.mjs +6 -6
- package/dist/runtime/rpx.mjs.map +1 -1
- package/dist/runtime/seo/index.d.mts +0 -2
- package/dist/runtime/seo/index.mjs +1 -2
- package/dist/runtime/style.d.mts +0 -2
- package/dist/runtime/style.mjs +1 -2
- package/dist/runtime/template.d.mts +0 -2
- package/dist/runtime/utils/object.mjs +1 -2
- package/dist/runtime/viewport/index.d.mts +0 -2
- package/dist/runtime/viewport/index.mjs +1 -2
- package/dist/runtime/viewport/style.mjs +2 -2
- package/dist/runtime/viewport/style.mjs.map +1 -1
- package/dist/runtime/viewport/types.d.mts +0 -2
- package/dist/runtime/warning.d.mts +0 -2
- package/dist/runtime/warning.mjs +1 -2
- package/dist/runtime/wevu.d.mts +1 -2
- package/dist/runtime/wevu.mjs +1 -2
- package/dist/shared/nativeComponents.mjs +10 -3
- package/dist/shared/nativeComponents.mjs.map +1 -1
- package/dist/shared/slugify.mjs +1 -2
- package/dist/shared/styleUnits/options.d.mts +24 -0
- package/dist/shared/styleUnits/options.mjs +13 -0
- package/dist/shared/styleUnits/options.mjs.map +1 -0
- package/dist/shared/styleUnits/value.mjs +63 -0
- package/dist/shared/styleUnits/value.mjs.map +1 -0
- package/dist/shared/tabBar.d.mts +0 -2
- package/dist/shared/tabBar.mjs +1 -2
- package/dist/shared/wxml.mjs +1 -2
- package/package.json +15 -13
- package/dist/runtime/nativeComponents/richText/helpers.mjs +0 -230
- package/dist/runtime/nativeComponents/richText/helpers.mjs.map +0 -1
- package/dist/runtime/nativeComponents/scrollView.mjs +0 -88
- package/dist/runtime/nativeComponents/scrollView.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/runtime/legacyTemplate/index.ts"],"sourcesContent":["import type { ChildNode, DataNode, Element, Node } from 'domhandler'\nimport type {\n LegacyTemplateRenderer,\n LegacyTemplateScope,\n RenderOptions,\n} from './types'\nimport { parseDocument } from 'htmlparser2'\nimport {\n hasControlAttribute,\n normalizeTagName,\n resolveControlAttributeValue,\n SELF_CLOSING_TAGS,\n} from '../../shared/wxml'\nimport {\n buildAttributeString,\n extractFor,\n isConditionalElement,\n stripControlAttributes,\n} from './dom'\nimport {\n createChildScope,\n createScope,\n evaluateExpression,\n interpolateText,\n normalizeList,\n} from './expression'\n\nconst templateCache = new Map<string, ChildNode[]>()\n\nfunction filterRenderableNode(node: Node) {\n if (node.type === 'directive' || node.type === 'comment') {\n return false\n }\n if (node.type === 'text') {\n const data = (node as DataNode).data\n return data.trim().length > 0\n }\n return true\n}\n\nfunction getOrParseTemplate(source: string) {\n let cached = templateCache.get(source)\n if (!cached) {\n const document = parseDocument(source, {\n xmlMode: true,\n decodeEntities: true,\n recognizeSelfClosing: true,\n })\n cached = document.children.filter(filterRenderableNode)\n templateCache.set(source, cached)\n }\n return cached\n}\n\nfunction renderConditionalSequence(\n nodes: ChildNode[],\n startIndex: number,\n scope: LegacyTemplateScope,\n renderChildren: (input: ChildNode[] | ChildNode | undefined, scope: LegacyTemplateScope) => string,\n) {\n const branches: Array<{ node: Element, attribs: Record<string, string> }> = []\n let cursor = startIndex\n\n while (cursor < nodes.length) {\n const candidate = nodes[cursor]\n if (!isConditionalElement(candidate)) {\n break\n }\n const element = candidate as Element\n const attribs = element.attribs\n if (branches.length === 0 && !hasControlAttribute(attribs, 'if')) {\n break\n }\n if (branches.length > 0 && !hasControlAttribute(attribs, 'elif') && !hasControlAttribute(attribs, 'else')) {\n break\n }\n branches.push({ node: element, attribs })\n cursor += 1\n if (hasControlAttribute(attribs, 'else')) {\n break\n }\n }\n\n if (!branches.length) {\n const node = nodes[startIndex]\n return {\n rendered: renderChildren(node, scope),\n endIndex: startIndex,\n }\n }\n\n for (const { node, attribs } of branches) {\n if (hasControlAttribute(attribs, 'else')) {\n return {\n // eslint-disable-next-line ts/no-use-before-define -- 条件分支与普通节点复用同一元素渲染逻辑。\n rendered: renderElement(\n node,\n scope,\n renderChildren,\n { overrideAttribs: stripControlAttributes(attribs) },\n ),\n endIndex: startIndex + branches.length - 1,\n }\n }\n const conditionExpr = resolveControlAttributeValue(attribs, 'if')\n ?? resolveControlAttributeValue(attribs, 'elif')\n if (!conditionExpr) {\n continue\n }\n const condition = evaluateExpression(conditionExpr, scope)\n if (condition) {\n return {\n // eslint-disable-next-line ts/no-use-before-define -- 条件分支与普通节点复用同一元素渲染逻辑。\n rendered: renderElement(\n node,\n scope,\n renderChildren,\n { overrideAttribs: stripControlAttributes(attribs) },\n ),\n endIndex: startIndex + branches.length - 1,\n }\n }\n }\n\n return {\n rendered: '',\n endIndex: startIndex + branches.length - 1,\n }\n}\n\nfunction renderElement(\n node: Element,\n scope: LegacyTemplateScope,\n renderChildren: (nodes: ChildNode[] | undefined, scope: LegacyTemplateScope) => string,\n options: RenderOptions = {},\n) {\n const attribs = node.attribs\n if (!options.skipFor) {\n const forExtract = extractFor(attribs)\n if (forExtract.expr) {\n const list = normalizeList(evaluateExpression(forExtract.expr, scope))\n if (!list.length) {\n return ''\n }\n let buffer = ''\n for (let idx = 0; idx < list.length; idx++) {\n const item = list[idx]\n const childScope = createChildScope(scope)\n childScope[forExtract.itemName] = item\n childScope[forExtract.indexName] = idx\n buffer += renderElement(node, childScope, renderChildren, {\n skipFor: true,\n overrideAttribs: forExtract.restAttribs,\n })\n }\n return buffer\n }\n }\n\n const effectiveAttribs = options.overrideAttribs ?? attribs\n const normalizedTag = normalizeTagName(node.name)\n if (normalizedTag === '#fragment') {\n return renderChildren(node.children, scope)\n }\n\n const attrs = buildAttributeString(effectiveAttribs, scope)\n const children = renderChildren(node.children, scope)\n\n if (SELF_CLOSING_TAGS.has(normalizedTag) && !children) {\n return `<${normalizedTag}${attrs} />`\n }\n\n return `<${normalizedTag}${attrs}>${children}</${normalizedTag}>`\n}\n\nfunction renderTextNode(node: DataNode, scope: LegacyTemplateScope) {\n const value = node.data\n if (!value.trim()) {\n return ''\n }\n return interpolateText(value, scope, true)\n}\n\nfunction renderTree(\n input: ChildNode[] | ChildNode | undefined,\n scope: LegacyTemplateScope,\n): string {\n if (!input) {\n return ''\n }\n\n if (Array.isArray(input)) {\n let buffer = ''\n for (let index = 0; index < input.length; index++) {\n const node = input[index]\n if (isConditionalElement(node)) {\n const { rendered, endIndex } = renderConditionalSequence(input, index, scope, renderTree)\n buffer += rendered\n index = endIndex\n continue\n }\n buffer += renderTree(node, scope)\n }\n return buffer\n }\n\n const node = input\n if (node.type === 'text') {\n return renderTextNode(node as DataNode, scope)\n }\n if (node.type === 'tag' || node.type === 'script' || node.type === 'style') {\n return renderElement(node as Element, scope, renderTree)\n }\n if ('children' in node && node.children?.length) {\n return renderTree(node.children, scope)\n }\n return ''\n}\n\nexport function renderTemplate(nodes: ChildNode[], scope?: LegacyTemplateScope) {\n const renderScope = createScope(scope)\n return renderTree(nodes, renderScope)\n}\n\nexport function createTemplate(source: string): LegacyTemplateRenderer {\n const nodes = getOrParseTemplate(source)\n return (scope?: LegacyTemplateScope) => renderTemplate(nodes, scope)\n}\n\nexport type { LegacyTemplateRenderer, LegacyTemplateScope } from './types'\n"],"mappings":";;;;;;AA2BA,MAAM,gCAAgB,IAAI,IAAyB;AAEnD,SAAS,qBAAqB,MAAY;CACxC,IAAI,KAAK,SAAS,eAAe,KAAK,SAAS,WAC7C,OAAO;CAET,IAAI,KAAK,SAAS,QAEhB,OADc,KAAkB,KACpB,KAAK,CAAC,CAAC,SAAS;CAE9B,OAAO;AACT;AAEA,SAAS,mBAAmB,QAAgB;CAC1C,IAAI,SAAS,cAAc,IAAI,MAAM;CACrC,IAAI,CAAC,QAAQ;EAMX,SALiB,cAAc,QAAQ;GACrC,SAAS;GACT,gBAAgB;GAChB,sBAAsB;EACxB,CACgB,CAAC,CAAC,SAAS,OAAO,oBAAoB;EACtD,cAAc,IAAI,QAAQ,MAAM;CAClC;CACA,OAAO;AACT;AAEA,SAAS,0BACP,OACA,YACA,OACA,gBACA;CACA,MAAM,WAAsE,CAAC;CAC7E,IAAI,SAAS;CAEb,OAAO,SAAS,MAAM,QAAQ;EAC5B,MAAM,YAAY,MAAM;EACxB,IAAI,CAAC,qBAAqB,SAAS,GACjC;EAEF,MAAM,UAAU;EAChB,MAAM,UAAU,QAAQ;EACxB,IAAI,SAAS,WAAW,KAAK,CAAC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c,QAAQ,KAAK,UAAU,QACvC,OAAO,WAAW,KAAK,UAAU,KAAK;CAExC,OAAO;AACT;AAEA,SAAgB,eAAe,OAAoB,OAA6B;CAE9E,OAAO,WAAW,OADE,YAAY,KACG,CAAC;AACtC;AAEA,SAAgB,eAAe,QAAwC;CACrE,MAAM,QAAQ,mBAAmB,MAAM;CACvC,QAAQ,UAAgC,eAAe,OAAO,KAAK;AACrE"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/runtime/legacyTemplate/index.ts"],"sourcesContent":["import type { ChildNode, DataNode, Element, Node } from 'domhandler'\nimport type { LegacyDatasetValues } from './dataset'\nimport type {\n LegacyTemplateRenderer,\n LegacyTemplateScope,\n RenderOptions,\n} from './types'\nimport { parseDocument } from 'htmlparser2'\nimport {\n hasControlAttribute,\n normalizeTagName,\n resolveControlAttributeValue,\n SELF_CLOSING_TAGS,\n} from '../../shared/wxml'\nimport { createLegacyDatasetAnchor, recordLegacyDatasetRender } from './dataset'\nimport {\n buildAttributeString,\n extractFor,\n isConditionalElement,\n stripControlAttributes,\n} from './dom'\nimport {\n createChildScope,\n createScope,\n evaluateExpression,\n interpolateText,\n normalizeList,\n} from './expression'\n\nconst templateCache = new Map<string, ChildNode[]>()\n\nfunction filterRenderableNode(node: Node) {\n if (node.type === 'directive' || node.type === 'comment') {\n return false\n }\n if (node.type === 'text') {\n const data = (node as DataNode).data\n return data.trim().length > 0\n }\n return true\n}\n\nfunction getOrParseTemplate(source: string) {\n let cached = templateCache.get(source)\n if (!cached) {\n const document = parseDocument(source, {\n xmlMode: true,\n decodeEntities: true,\n recognizeSelfClosing: true,\n })\n cached = document.children.filter(filterRenderableNode)\n templateCache.set(source, cached)\n }\n return cached\n}\n\nfunction renderConditionalSequence(\n nodes: ChildNode[],\n startIndex: number,\n scope: LegacyTemplateScope,\n renderChildren: (input: ChildNode[] | ChildNode | undefined, scope: LegacyTemplateScope) => string,\n datasets?: LegacyDatasetValues,\n) {\n const branches: Array<{ node: Element, attribs: Record<string, string> }> = []\n let cursor = startIndex\n\n while (cursor < nodes.length) {\n const candidate = nodes[cursor]\n if (!isConditionalElement(candidate)) {\n break\n }\n const element = candidate as Element\n const attribs = element.attribs\n if (branches.length === 0 && !hasControlAttribute(attribs, 'if')) {\n break\n }\n if (branches.length > 0 && !hasControlAttribute(attribs, 'elif') && !hasControlAttribute(attribs, 'else')) {\n break\n }\n branches.push({ node: element, attribs })\n cursor += 1\n if (hasControlAttribute(attribs, 'else')) {\n break\n }\n }\n\n if (!branches.length) {\n const node = nodes[startIndex]\n return {\n rendered: renderChildren(node, scope),\n endIndex: startIndex,\n }\n }\n\n for (const { node, attribs } of branches) {\n if (hasControlAttribute(attribs, 'else')) {\n return {\n // eslint-disable-next-line ts/no-use-before-define -- 条件分支与普通节点复用同一元素渲染逻辑。\n rendered: renderElement(\n node,\n scope,\n renderChildren,\n { overrideAttribs: stripControlAttributes(attribs) },\n datasets,\n ),\n endIndex: startIndex + branches.length - 1,\n }\n }\n const conditionExpr = resolveControlAttributeValue(attribs, 'if')\n ?? resolveControlAttributeValue(attribs, 'elif')\n if (!conditionExpr) {\n continue\n }\n const condition = evaluateExpression(conditionExpr, scope)\n if (condition) {\n return {\n // eslint-disable-next-line ts/no-use-before-define -- 条件分支与普通节点复用同一元素渲染逻辑。\n rendered: renderElement(\n node,\n scope,\n renderChildren,\n { overrideAttribs: stripControlAttributes(attribs) },\n datasets,\n ),\n endIndex: startIndex + branches.length - 1,\n }\n }\n }\n\n return {\n rendered: '',\n endIndex: startIndex + branches.length - 1,\n }\n}\n\nfunction renderElement(\n node: Element,\n scope: LegacyTemplateScope,\n renderChildren: (nodes: ChildNode[] | undefined, scope: LegacyTemplateScope) => string,\n options: RenderOptions = {},\n datasets?: LegacyDatasetValues,\n) {\n const attribs = node.attribs\n if (!options.skipFor) {\n const forExtract = extractFor(attribs)\n if (forExtract.expr) {\n const list = normalizeList(evaluateExpression(forExtract.expr, scope))\n if (!list.length) {\n return ''\n }\n let buffer = ''\n for (let idx = 0; idx < list.length; idx++) {\n const item = list[idx]\n const childScope = createChildScope(scope)\n childScope[forExtract.itemName] = item\n childScope[forExtract.indexName] = idx\n buffer += renderElement(node, childScope, renderChildren, {\n skipFor: true,\n overrideAttribs: forExtract.restAttribs,\n }, datasets)\n }\n return buffer\n }\n }\n\n const effectiveAttribs = options.overrideAttribs ?? attribs\n const normalizedTag = normalizeTagName(node.name)\n if (normalizedTag === '#fragment') {\n return renderChildren(node.children, scope)\n }\n\n const dataset = datasets ? new Map<string, unknown>() : undefined\n const attrs = buildAttributeString(effectiveAttribs, scope, dataset)\n const anchor = dataset?.size && datasets ? createLegacyDatasetAnchor(datasets, dataset) : ''\n const children = renderChildren(node.children, scope)\n\n if (SELF_CLOSING_TAGS.has(normalizedTag) && !children) {\n return `${anchor}<${normalizedTag}${attrs} />`\n }\n\n return `${anchor}<${normalizedTag}${attrs}>${children}</${normalizedTag}>`\n}\n\nfunction renderTextNode(node: DataNode, scope: LegacyTemplateScope) {\n const value = node.data\n if (!value.trim()) {\n return ''\n }\n return interpolateText(value, scope, true)\n}\n\nfunction renderTree(\n input: ChildNode[] | ChildNode | undefined,\n scope: LegacyTemplateScope,\n datasets?: LegacyDatasetValues,\n): string {\n if (!input) {\n return ''\n }\n\n if (Array.isArray(input)) {\n let buffer = ''\n for (let index = 0; index < input.length; index++) {\n const node = input[index]\n if (isConditionalElement(node)) {\n const { rendered, endIndex } = renderConditionalSequence(input, index, scope, (nodes, childScope) => renderTree(nodes, childScope, datasets), datasets)\n buffer += rendered\n index = endIndex\n continue\n }\n buffer += renderTree(node, scope, datasets)\n }\n return buffer\n }\n\n const node = input\n if (node.type === 'text') {\n return renderTextNode(node as DataNode, scope)\n }\n if (node.type === 'tag' || node.type === 'script' || node.type === 'style') {\n return renderElement(node as Element, scope, (nodes, childScope) => renderTree(nodes, childScope, datasets), {}, datasets)\n }\n if ('children' in node && node.children?.length) {\n return renderTree(node.children, scope, datasets)\n }\n return ''\n}\n\nexport function renderTemplate(nodes: ChildNode[], scope?: LegacyTemplateScope) {\n const renderScope = createScope(scope)\n return renderTree(nodes, renderScope)\n}\n\nexport function createTemplate(source: string): LegacyTemplateRenderer {\n const nodes = getOrParseTemplate(source)\n return (scope?: LegacyTemplateScope, context?: object) => {\n const datasets: LegacyDatasetValues | undefined = context ? [] : undefined\n const result = renderTree(nodes, createScope(scope), datasets)\n if (context && datasets) {\n recordLegacyDatasetRender(context, datasets)\n }\n return result\n }\n}\n\nexport type { LegacyTemplateRenderer, LegacyTemplateScope } from './types'\n"],"mappings":";;;;;;;AA6BA,MAAM,gCAAgB,IAAI,IAAyB;AAEnD,SAAS,qBAAqB,MAAY;CACxC,IAAI,KAAK,SAAS,eAAe,KAAK,SAAS,WAC7C,OAAO;CAET,IAAI,KAAK,SAAS,QAEhB,OADc,KAAkB,KACpB,KAAK,CAAC,CAAC,SAAS;CAE9B,OAAO;AACT;AAEA,SAAS,mBAAmB,QAAgB;CAC1C,IAAI,SAAS,cAAc,IAAI,MAAM;CACrC,IAAI,CAAC,QAAQ;EAMX,SALiB,cAAc,QAAQ;GACrC,SAAS;GACT,gBAAgB;GAChB,sBAAsB;EACxB,CACgB,CAAC,CAAC,SAAS,OAAO,oBAAoB;EACtD,cAAc,IAAI,QAAQ,MAAM;CAClC;CACA,OAAO;AACT;AAEA,SAAS,0BACP,OACA,YACA,OACA,gBACA,UACA;CACA,MAAM,WAAsE,CAAC;CAC7E,IAAI,SAAS;CAEb,OAAO,SAAS,MAAM,QAAQ;EAC5B,MAAM,YAAY,MAAM;EACxB,IAAI,CAAC,qBAAqB,SAAS,GACjC;EAEF,MAAM,UAAU;EAChB,MAAM,UAAU,QAAQ;EACxB,IAAI,SAAS,WAAW,KAAK,CAAC,oBAAoB,SAAS,IAAI,GAC7D;EAEF,IAAI,SAAS,SAAS,KAAK,CAAC,oBAAoB,SAAS,MAAM,KAAK,CAAC,oBAAoB,SAAS,MAAM,GACtG;EAEF,SAAS,KAAK;G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SAAS,YAAY,KAAK,SAAS,SACjE,OAAO,cAAc,MAAiB,QAAQ,OAAO,eAAe,WAAW,OAAO,YAAY,QAAQ,GAAG,CAAC,GAAG,QAAQ;CAE3H,IAAI,cAAc,QAAQ,KAAK,UAAU,QACvC,OAAO,WAAW,KAAK,UAAU,OAAO,QAAQ;CAElD,OAAO;AACT;AAEA,SAAgB,eAAe,OAAoB,OAA6B;CAE9E,OAAO,WAAW,OADE,YAAY,KACG,CAAC;AACtC;AAEA,SAAgB,eAAe,QAAwC;CACrE,MAAM,QAAQ,mBAAmB,MAAM;CACvC,QAAQ,OAA6B,YAAqB;EACxD,MAAM,WAA4C,UAAU,CAAC,IAAI;EACjE,MAAM,SAAS,WAAW,OAAO,YAAY,KAAK,GAAG,QAAQ;EAC7D,IAAI,WAAW,UACb,0BAA0B,SAAS,QAAQ;EAE7C,OAAO;CACT;AACF"}
|
|
@@ -3,7 +3,7 @@ import { readBooleanAttribute, resolveContainingShadowRoot } from "../helpers.mj
|
|
|
3
3
|
import { ensureNativeComponentStyle } from "../style.mjs";
|
|
4
4
|
import { registerNativeMediaElement, unregisterNativeMediaElement } from "../mediaRegistry.mjs";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/runtime/nativeComponents/canvas/index.ts
|
|
7
7
|
const BaseElement = globalThis.HTMLElement ?? class {};
|
|
8
8
|
function resolveCanvasSize(value, fallback) {
|
|
9
9
|
const size = Number(value);
|
|
@@ -57,6 +57,5 @@ var WeappCanvas = class extends BaseElement {
|
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
//#endregion
|
|
61
60
|
export { WeappCanvas };
|
|
62
61
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -3,7 +3,7 @@ import { connectFormControl, disconnectFormControl, findClosestComposedElement }
|
|
|
3
3
|
import { dispatchMiniProgramEvent, readBooleanAttribute, resolveContainingShadowRoot } from "./helpers.mjs";
|
|
4
4
|
import { ensureNativeComponentStyle } from "./style.mjs";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/runtime/nativeComponents/checkbox.ts
|
|
7
7
|
const BaseElement = globalThis.HTMLElement ?? class {};
|
|
8
8
|
function collectCheckboxGroupValue(checkboxes) {
|
|
9
9
|
return Array.from(checkboxes).filter((checkbox) => checkbox.checked && !checkbox.disabled).map((checkbox) => checkbox.value);
|
|
@@ -132,6 +132,5 @@ var WeappCheckbox = class extends BaseElement {
|
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
134
|
|
|
135
|
-
//#endregion
|
|
136
135
|
export { WeappCheckbox, WeappCheckboxGroup, collectCheckboxGroupValue };
|
|
137
136
|
//# sourceMappingURL=checkbox.mjs.map
|
|
@@ -2,7 +2,7 @@ import { getNativeComponentDescriptor } from "../../../shared/nativeComponents.m
|
|
|
2
2
|
import { WeappImage } from "../image.mjs";
|
|
3
3
|
import { WeappView } from "../primitives.mjs";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/runtime/nativeComponents/cover/index.ts
|
|
6
6
|
var WeappCoverView = class extends WeappView {
|
|
7
7
|
connectedCallback() {
|
|
8
8
|
super.connectedCallback();
|
|
@@ -18,6 +18,5 @@ var WeappCoverImage = class extends WeappImage {
|
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
//#endregion
|
|
22
21
|
export { WeappCoverImage, WeappCoverView };
|
|
23
22
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -2,7 +2,7 @@ import { collectFormControlValues, resetFormControls } from "./formControl.mjs";
|
|
|
2
2
|
import { dispatchMiniProgramEvent, resolveContainingShadowRoot } from "./helpers.mjs";
|
|
3
3
|
import { ensureNativeComponentStyle } from "./style.mjs";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/runtime/nativeComponents/form.ts
|
|
6
6
|
const DEFAULT_FORM_CONFIG = { preventDefault: true };
|
|
7
7
|
const BaseElement = globalThis.HTMLElement ?? class {};
|
|
8
8
|
let formConfig = { ...DEFAULT_FORM_CONFIG };
|
|
@@ -45,6 +45,5 @@ function setFormConfig(next) {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
//#endregion
|
|
49
48
|
export { WeappForm, setFormConfig };
|
|
50
49
|
//# sourceMappingURL=form.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/nativeComponents/formControl.ts
|
|
2
2
|
const controlsByForm = /* @__PURE__ */ new WeakMap();
|
|
3
3
|
const formByControl = /* @__PURE__ */ new WeakMap();
|
|
4
4
|
function resolveParentAcrossShadow(element) {
|
|
@@ -56,6 +56,5 @@ function isFormActivatable(value) {
|
|
|
56
56
|
return typeof value.formActivate === "function";
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
//#endregion
|
|
60
59
|
export { collectFormControlValues, connectFormControl, disconnectFormControl, findClosestComposedElement, isFormActivatable, requestContainingFormAction, resetFormControls };
|
|
61
60
|
//# sourceMappingURL=formControl.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/nativeComponents/helpers.ts
|
|
2
2
|
function readBooleanAttribute(element, name) {
|
|
3
3
|
const value = element.getAttribute(name);
|
|
4
4
|
return value !== null && value !== "false" && value !== "0";
|
|
@@ -20,6 +20,5 @@ function dispatchMiniProgramEvent(element, name, detail, options = {}) {
|
|
|
20
20
|
}));
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
//#endregion
|
|
24
23
|
export { dispatchMiniProgramEvent, readBooleanAttribute, resolveContainingShadowRoot, resolveMaxLength };
|
|
25
24
|
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/nativeComponents/icon/helpers.ts
|
|
2
2
|
const ICON_TYPES = [
|
|
3
3
|
"success",
|
|
4
4
|
"success_no_circle",
|
|
@@ -37,6 +37,5 @@ function resolveIconColor(type, value) {
|
|
|
37
37
|
return String(value ?? "").trim() || DEFAULT_ICON_COLORS[type];
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
//#endregion
|
|
41
40
|
export { ICON_TYPES, resolveIconColor, resolveIconSize, resolveIconType };
|
|
42
41
|
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -4,7 +4,7 @@ import { ensureNativeComponentStyle } from "../style.mjs";
|
|
|
4
4
|
import { ICON_TYPES, resolveIconColor, resolveIconSize, resolveIconType } from "./helpers.mjs";
|
|
5
5
|
import { ICON_SHADOW_STYLE } from "./style.mjs";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/runtime/nativeComponents/icon/index.ts
|
|
8
8
|
const BaseElement = globalThis.HTMLElement ?? class {};
|
|
9
9
|
var WeappIcon = class extends BaseElement {
|
|
10
10
|
static observedAttributes = [...getNativeComponentDescriptor("icon").attributes];
|
|
@@ -40,6 +40,5 @@ var WeappIcon = class extends BaseElement {
|
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
//#endregion
|
|
44
43
|
export { ICON_TYPES, WeappIcon, resolveIconColor, resolveIconSize, resolveIconType };
|
|
45
44
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/nativeComponents/icon/style.ts
|
|
2
2
|
const ICON_SHADOW_STYLE = `
|
|
3
3
|
:host {
|
|
4
4
|
width: var(--weapp-icon-size);
|
|
@@ -171,6 +171,5 @@ const ICON_SHADOW_STYLE = `
|
|
|
171
171
|
}
|
|
172
172
|
`;
|
|
173
173
|
|
|
174
|
-
//#endregion
|
|
175
174
|
export { ICON_SHADOW_STYLE };
|
|
176
175
|
//# sourceMappingURL=style.mjs.map
|
|
@@ -2,7 +2,7 @@ import { getNativeComponentDescriptor } from "../../shared/nativeComponents.mjs"
|
|
|
2
2
|
import { dispatchMiniProgramEvent, readBooleanAttribute, resolveContainingShadowRoot } from "./helpers.mjs";
|
|
3
3
|
import { ensureNativeComponentStyle } from "./style.mjs";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/runtime/nativeComponents/image.ts
|
|
6
6
|
const BaseElement = globalThis.HTMLElement ?? class {};
|
|
7
7
|
const IMAGE_MODE_STYLES = {
|
|
8
8
|
"scaleToFill": {
|
|
@@ -116,6 +116,5 @@ var WeappImage = class extends BaseElement {
|
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
118
|
|
|
119
|
-
//#endregion
|
|
120
119
|
export { WeappImage, resolveImageModeStyle };
|
|
121
120
|
//# sourceMappingURL=image.mjs.map
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { resolveImageModeStyle } from "./image.mjs";
|
|
2
2
|
import { createInputEventDetail } from "./input.mjs";
|
|
3
|
-
import { createScrollEventDetail } from "./scrollView.mjs";
|
|
3
|
+
import { createScrollEventDetail } from "./scrollView/helpers.mjs";
|
|
4
4
|
import { createSwitchEventDetail } from "./switch.mjs";
|
|
5
5
|
import { createTextareaLineChangeDetail } from "./textarea.mjs";
|
|
6
6
|
import { createVideoProgressDetail, createVideoTimeUpdateDetail, resolveVideoObjectFit } from "./video/helpers.mjs";
|
|
7
|
-
//#region src/runtime/nativeComponents/index.d.ts
|
|
8
7
|
export declare function ensureNativeComponentsDefined(): void;
|
|
9
|
-
//#endregion
|
|
10
8
|
export { createInputEventDetail, createScrollEventDetail, createSwitchEventDetail, createTextareaLineChangeDetail, createVideoProgressDetail, createVideoTimeUpdateDetail, resolveImageModeStyle, resolveVideoObjectFit };
|
|
11
9
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -23,9 +23,9 @@ import { WeappPickerView } from "./pickerView/index.mjs";
|
|
|
23
23
|
import { createProgressActiveEndDetail, resolveProgressAnimationDuration, resolveProgressConfig } from "./progress/helpers.mjs";
|
|
24
24
|
import { WeappProgress } from "./progress/index.mjs";
|
|
25
25
|
import { WeappRadio, WeappRadioGroup, collectRadioGroupValue } from "./radio.mjs";
|
|
26
|
-
import { normalizeRichTextNodes, sanitizeRichTextAttributes, sanitizeRichTextStyle } from "./richText/helpers.mjs";
|
|
27
26
|
import { WeappRichText } from "./richText/index.mjs";
|
|
28
|
-
import {
|
|
27
|
+
import { createScrollEventDetail } from "./scrollView/helpers.mjs";
|
|
28
|
+
import { WeappScrollView } from "./scrollView/index.mjs";
|
|
29
29
|
import { createSliderEventDetail, resolveSliderConfig } from "./slider/helpers.mjs";
|
|
30
30
|
import { WeappSlider } from "./slider/index.mjs";
|
|
31
31
|
import { createSwiperChangeDetail, resolveSwipeTarget, resolveSwiperIndex, resolveSwiperNumber } from "./swiper/helpers.mjs";
|
|
@@ -36,7 +36,7 @@ import { WeappTextarea, createTextareaLineChangeDetail } from "./textarea.mjs";
|
|
|
36
36
|
import { createVideoProgressDetail, createVideoTimeUpdateDetail, resolveVideoObjectFit } from "./video/helpers.mjs";
|
|
37
37
|
import { WeappVideo } from "./video/index.mjs";
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
// src/runtime/nativeComponents/index.ts
|
|
40
40
|
const constructors = {
|
|
41
41
|
"weapp-view": WeappView,
|
|
42
42
|
"weapp-text": WeappText,
|
|
@@ -78,6 +78,5 @@ function ensureNativeComponentsDefined() {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
//#endregion
|
|
82
81
|
export { createInputEventDetail, createScrollEventDetail, createSwitchEventDetail, createTextareaLineChangeDetail, createVideoProgressDetail, createVideoTimeUpdateDetail, ensureNativeComponentsDefined, resolveImageModeStyle, resolveVideoObjectFit };
|
|
83
82
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/runtime/nativeComponents/index.ts"],"sourcesContent":["import type { NativeComponentWebTag } from '../../shared/nativeComponents'\nimport { NATIVE_COMPONENT_DESCRIPTORS } from '../../shared/nativeComponents'\nimport { WeappButton } from '../button'\nimport { WeappCanvas } from './canvas'\nimport { WeappCheckbox, WeappCheckboxGroup } from './checkbox'\nimport { WeappCoverImage, WeappCoverView } from './cover'\nimport { WeappForm } from './form'\nimport { WeappIcon } from './icon'\nimport { WeappImage } from './image'\nimport { WeappInput } from './input'\nimport { WeappLabel } from './label'\nimport { WeappMovableArea, WeappMovableView } from './movable'\nimport { WeappNavigator } from './navigator'\nimport { WeappPicker } from './picker'\nimport { WeappPickerView, WeappPickerViewColumn } from './pickerView'\nimport { WeappText, WeappView } from './primitives'\nimport { WeappProgress } from './progress'\nimport { WeappRadio, WeappRadioGroup } from './radio'\nimport { WeappRichText } from './richText'\nimport { WeappScrollView } from './scrollView'\nimport { WeappSlider } from './slider'\nimport { WeappSwiper } from './swiper'\nimport { WeappSwiperItem } from './swiper/item'\nimport { WeappSwitch } from './switch'\nimport { WeappTextarea } from './textarea'\nimport { WeappVideo } from './video'\n\nconst constructors = {\n 'weapp-view': WeappView,\n 'weapp-text': WeappText,\n 'weapp-image': WeappImage,\n 'weapp-button': WeappButton,\n 'weapp-input': WeappInput,\n 'weapp-textarea': WeappTextarea,\n 'weapp-form': WeappForm,\n 'weapp-label': WeappLabel,\n 'weapp-checkbox-group': WeappCheckboxGroup,\n 'weapp-checkbox': WeappCheckbox,\n 'weapp-radio-group': WeappRadioGroup,\n 'weapp-radio': WeappRadio,\n 'weapp-switch': WeappSwitch,\n 'weapp-picker': WeappPicker,\n 'weapp-picker-view': WeappPickerView,\n 'weapp-picker-view-column': WeappPickerViewColumn,\n 'weapp-slider': WeappSlider,\n 'weapp-icon': WeappIcon,\n 'weapp-progress': WeappProgress,\n 'weapp-rich-text': WeappRichText,\n 'weapp-scroll-view': WeappScrollView,\n 'weapp-navigator': WeappNavigator,\n 'weapp-swiper': WeappSwiper,\n 'weapp-swiper-item': WeappSwiperItem,\n 'weapp-canvas': WeappCanvas,\n 'weapp-video': WeappVideo,\n 'weapp-cover-view': WeappCoverView,\n 'weapp-cover-image': WeappCoverImage,\n 'weapp-movable-area': WeappMovableArea,\n 'weapp-movable-view': WeappMovableView,\n} satisfies Record<NativeComponentWebTag, CustomElementConstructor>\n\nexport function ensureNativeComponentsDefined() {\n if (typeof customElements === 'undefined') {\n return\n }\n for (const descriptor of NATIVE_COMPONENT_DESCRIPTORS) {\n if (customElements.get(descriptor.webTag)) {\n continue\n }\n const constructor = constructors[descriptor.webTag]\n customElements.define(descriptor.webTag, constructor)\n }\n}\n\nexport { collectCheckboxGroupValue } from './checkbox'\nexport { collectFormControlValues } from './formControl'\nexport { resolveIconColor, resolveIconSize, resolveIconType } from './icon/helpers'\nexport { resolveImageModeStyle } from './image'\nexport { createInputEventDetail } from './input'\nexport { clampMovablePosition, resolveMovableDirection } from './movable/helpers'\nexport {\n createPickerChangeDetail,\n normalizePickerIndexes,\n resolvePickerColumns,\n resolvePickerMode,\n} from './picker/helpers'\nexport { normalizePickerViewValue } from './pickerView/helpers'\nexport {\n createProgressActiveEndDetail,\n resolveProgressAnimationDuration,\n resolveProgressConfig,\n} from './progress/helpers'\nexport { collectRadioGroupValue } from './radio'\nexport {
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/runtime/nativeComponents/index.ts"],"sourcesContent":["import type { NativeComponentWebTag } from '../../shared/nativeComponents'\nimport { NATIVE_COMPONENT_DESCRIPTORS } from '../../shared/nativeComponents'\nimport { WeappButton } from '../button'\nimport { WeappCanvas } from './canvas'\nimport { WeappCheckbox, WeappCheckboxGroup } from './checkbox'\nimport { WeappCoverImage, WeappCoverView } from './cover'\nimport { WeappForm } from './form'\nimport { WeappIcon } from './icon'\nimport { WeappImage } from './image'\nimport { WeappInput } from './input'\nimport { WeappLabel } from './label'\nimport { WeappMovableArea, WeappMovableView } from './movable'\nimport { WeappNavigator } from './navigator'\nimport { WeappPicker } from './picker'\nimport { WeappPickerView, WeappPickerViewColumn } from './pickerView'\nimport { WeappText, WeappView } from './primitives'\nimport { WeappProgress } from './progress'\nimport { WeappRadio, WeappRadioGroup } from './radio'\nimport { WeappRichText } from './richText'\nimport { WeappScrollView } from './scrollView'\nimport { WeappSlider } from './slider'\nimport { WeappSwiper } from './swiper'\nimport { WeappSwiperItem } from './swiper/item'\nimport { WeappSwitch } from './switch'\nimport { WeappTextarea } from './textarea'\nimport { WeappVideo } from './video'\n\nconst constructors = {\n 'weapp-view': WeappView,\n 'weapp-text': WeappText,\n 'weapp-image': WeappImage,\n 'weapp-button': WeappButton,\n 'weapp-input': WeappInput,\n 'weapp-textarea': WeappTextarea,\n 'weapp-form': WeappForm,\n 'weapp-label': WeappLabel,\n 'weapp-checkbox-group': WeappCheckboxGroup,\n 'weapp-checkbox': WeappCheckbox,\n 'weapp-radio-group': WeappRadioGroup,\n 'weapp-radio': WeappRadio,\n 'weapp-switch': WeappSwitch,\n 'weapp-picker': WeappPicker,\n 'weapp-picker-view': WeappPickerView,\n 'weapp-picker-view-column': WeappPickerViewColumn,\n 'weapp-slider': WeappSlider,\n 'weapp-icon': WeappIcon,\n 'weapp-progress': WeappProgress,\n 'weapp-rich-text': WeappRichText,\n 'weapp-scroll-view': WeappScrollView,\n 'weapp-navigator': WeappNavigator,\n 'weapp-swiper': WeappSwiper,\n 'weapp-swiper-item': WeappSwiperItem,\n 'weapp-canvas': WeappCanvas,\n 'weapp-video': WeappVideo,\n 'weapp-cover-view': WeappCoverView,\n 'weapp-cover-image': WeappCoverImage,\n 'weapp-movable-area': WeappMovableArea,\n 'weapp-movable-view': WeappMovableView,\n} satisfies Record<NativeComponentWebTag, CustomElementConstructor>\n\nexport function ensureNativeComponentsDefined() {\n if (typeof customElements === 'undefined') {\n return\n }\n for (const descriptor of NATIVE_COMPONENT_DESCRIPTORS) {\n if (customElements.get(descriptor.webTag)) {\n continue\n }\n const constructor = constructors[descriptor.webTag]\n customElements.define(descriptor.webTag, constructor)\n }\n}\n\nexport { collectCheckboxGroupValue } from './checkbox'\nexport { collectFormControlValues } from './formControl'\nexport { resolveIconColor, resolveIconSize, resolveIconType } from './icon/helpers'\nexport { resolveImageModeStyle } from './image'\nexport { createInputEventDetail } from './input'\nexport { clampMovablePosition, resolveMovableDirection } from './movable/helpers'\nexport {\n createPickerChangeDetail,\n normalizePickerIndexes,\n resolvePickerColumns,\n resolvePickerMode,\n} from './picker/helpers'\nexport { normalizePickerViewValue } from './pickerView/helpers'\nexport {\n createProgressActiveEndDetail,\n resolveProgressAnimationDuration,\n resolveProgressConfig,\n} from './progress/helpers'\nexport { collectRadioGroupValue } from './radio'\nexport { createScrollEventDetail } from './scrollView'\nexport { createSliderEventDetail, resolveSliderConfig } from './slider/helpers'\nexport { NATIVE_COMPONENT_STYLE } from './style'\nexport {\n createSwiperChangeDetail,\n resolveSwiperIndex,\n resolveSwiperNumber,\n resolveSwipeTarget,\n} from './swiper/helpers'\nexport { createSwitchEventDetail } from './switch'\nexport { createTextareaLineChangeDetail } from './textarea'\nexport {\n createVideoProgressDetail,\n createVideoTimeUpdateDetail,\n resolveVideoObjectFit,\n} from './video/helpers'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,eAAe;CACnB,cAAc;CACd,cAAc;CACd,eAAe;CACf,gBAAgB;CAChB,eAAe;CACf,kBAAkB;CAClB,cAAc;CACd,eAAe;CACf,wBAAwB;CACxB,kBAAkB;CAClB,qBAAqB;CACrB,eAAe;CACf,gBAAgB;CAChB,gBAAgB;CAChB,qBAAqB;CACrB,4BAA4B;CAC5B,gBAAgB;CAChB,cAAc;CACd,kBAAkB;CAClB,mBAAmB;CACnB,qBAAqB;CACrB,mBAAmB;CACnB,gBAAgB;CAChB,qBAAqB;CACrB,gBAAgB;CAChB,eAAe;CACf,oBAAoB;CACpB,qBAAqB;CACrB,sBAAsB;CACtB,sBAAsB;AACxB;AAEA,SAAgB,gCAAgC;CAC9C,IAAI,OAAO,mBAAmB,aAC5B;CAEF,KAAK,MAAM,cAAc,8BAA8B;EACrD,IAAI,eAAe,IAAI,WAAW,MAAM,GACtC;EAEF,MAAM,cAAc,aAAa,WAAW;EAC5C,eAAe,OAAO,WAAW,QAAQ,WAAW;CACtD;AACF"}
|
|
@@ -4,7 +4,7 @@ import { dispatchMiniProgramEvent, readBooleanAttribute, resolveContainingShadow
|
|
|
4
4
|
import { ensureNativeComponentStyle } from "./style.mjs";
|
|
5
5
|
import { dispatchNativeInputEvent } from "../inputHandlerResult.mjs";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/runtime/nativeComponents/input.ts
|
|
8
8
|
const BaseElement = globalThis.HTMLElement ?? class {};
|
|
9
9
|
function resolveInputType(element) {
|
|
10
10
|
if (readBooleanAttribute(element, "password")) return "password";
|
|
@@ -128,6 +128,5 @@ var WeappInput = class extends BaseElement {
|
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
-
//#endregion
|
|
132
131
|
export { WeappInput, createInputEventDetail };
|
|
133
132
|
//# sourceMappingURL=input.mjs.map
|
|
@@ -3,7 +3,7 @@ import { isFormActivatable } from "./formControl.mjs";
|
|
|
3
3
|
import { resolveContainingShadowRoot } from "./helpers.mjs";
|
|
4
4
|
import { ensureNativeComponentStyle } from "./style.mjs";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/runtime/nativeComponents/label.ts
|
|
7
7
|
const BaseElement = globalThis.HTMLElement ?? class {};
|
|
8
8
|
const FORM_CONTROL_SELECTOR = "weapp-input, weapp-textarea, weapp-checkbox, weapp-radio, weapp-switch";
|
|
9
9
|
function findElementById(root, id) {
|
|
@@ -31,6 +31,5 @@ var WeappLabel = class extends BaseElement {
|
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
//#endregion
|
|
35
34
|
export { WeappLabel };
|
|
36
35
|
//# sourceMappingURL=label.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/nativeComponents/mediaRegistry.ts
|
|
2
2
|
const mediaElements = /* @__PURE__ */ new Map();
|
|
3
3
|
const mediaRegistrations = /* @__PURE__ */ new WeakMap();
|
|
4
4
|
function normalizeMediaIds(ids) {
|
|
@@ -42,6 +42,5 @@ function resolveNativeMediaElement(kind, id) {
|
|
|
42
42
|
return elements?.[elements.length - 1];
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
//#endregion
|
|
46
45
|
export { registerNativeMediaElement, resolveNativeMediaElement, unregisterNativeMediaElement };
|
|
47
46
|
//# sourceMappingURL=mediaRegistry.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/nativeComponents/movable/helpers.ts
|
|
2
2
|
function resolveMovableDirection(value) {
|
|
3
3
|
if (value === "horizontal" || value === "vertical" || value === "none") return value;
|
|
4
4
|
return "all";
|
|
@@ -18,6 +18,5 @@ function clampMovablePosition(position, bounds, direction, outOfBounds) {
|
|
|
18
18
|
return next;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
//#endregion
|
|
22
21
|
export { clampMovablePosition, resolveMovableDirection, resolveMovableNumber };
|
|
23
22
|
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -3,7 +3,7 @@ import { dispatchMiniProgramEvent, readBooleanAttribute, resolveContainingShadow
|
|
|
3
3
|
import { ensureNativeComponentStyle } from "../style.mjs";
|
|
4
4
|
import { clampMovablePosition, resolveMovableDirection, resolveMovableNumber } from "./helpers.mjs";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/runtime/nativeComponents/movable/index.ts
|
|
7
7
|
const BaseElement = globalThis.HTMLElement ?? class {};
|
|
8
8
|
var WeappMovableArea = class extends BaseElement {
|
|
9
9
|
connectedCallback() {
|
|
@@ -112,6 +112,5 @@ var WeappMovableView = class extends BaseElement {
|
|
|
112
112
|
};
|
|
113
113
|
};
|
|
114
114
|
|
|
115
|
-
//#endregion
|
|
116
115
|
export { WeappMovableArea, WeappMovableView };
|
|
117
116
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -5,7 +5,7 @@ import { ensureNativeComponentStyle } from "./style.mjs";
|
|
|
5
5
|
import { exitMiniProgram, navigateToMiniProgram } from "../polyfill/runtimeDataApi.mjs";
|
|
6
6
|
import { navigateBack, navigateTo, reLaunch, redirectTo, switchTab } from "../polyfill/routeRuntime.mjs";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/runtime/nativeComponents/navigator.ts
|
|
9
9
|
const BaseElement = globalThis.HTMLElement ?? class {};
|
|
10
10
|
const defaultBridge = {
|
|
11
11
|
navigateTo,
|
|
@@ -195,6 +195,5 @@ var WeappNavigator = class extends BaseElement {
|
|
|
195
195
|
}
|
|
196
196
|
};
|
|
197
197
|
|
|
198
|
-
//#endregion
|
|
199
198
|
export { WeappNavigator, executeNavigatorRequest, resolveNavigatorExtraData };
|
|
200
199
|
//# sourceMappingURL=navigator.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { normalizePickerIndex, normalizePickerIndexes, resolvePickerColumns } from "./helpers.mjs";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/runtime/nativeComponents/picker/editors.ts
|
|
4
4
|
function currentDateValue(fields) {
|
|
5
5
|
const date = /* @__PURE__ */ new Date();
|
|
6
6
|
const year = String(date.getFullYear()).padStart(4, "0");
|
|
@@ -69,6 +69,5 @@ function renderPickerEditors(options) {
|
|
|
69
69
|
return renderRegionEditors(options);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
//#endregion
|
|
73
72
|
export { currentDateValue, renderPickerEditors };
|
|
74
73
|
//# sourceMappingURL=editors.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/nativeComponents/picker/helpers.ts
|
|
2
2
|
const PICKER_MODES = [
|
|
3
3
|
"selector",
|
|
4
4
|
"multiSelector",
|
|
@@ -52,6 +52,5 @@ function createPickerChangeDetail(mode, value) {
|
|
|
52
52
|
return { value };
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
//#endregion
|
|
56
55
|
export { PICKER_MODES, createPickerChangeDetail, normalizePickerIndex, normalizePickerIndexes, resolvePickerColumns, resolvePickerMode };
|
|
57
56
|
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -6,7 +6,7 @@ import { PICKER_MODES, createPickerChangeDetail, normalizePickerIndex, normalize
|
|
|
6
6
|
import { currentDateValue, renderPickerEditors } from "./editors.mjs";
|
|
7
7
|
import { PICKER_SHADOW_STYLE } from "./style.mjs";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// src/runtime/nativeComponents/picker/index.ts
|
|
10
10
|
const BaseElement = globalThis.HTMLElement ?? class {};
|
|
11
11
|
function parsePickerAttribute(value) {
|
|
12
12
|
if (value === null || value === "") return value ?? void 0;
|
|
@@ -205,6 +205,5 @@ var WeappPicker = class extends BaseElement {
|
|
|
205
205
|
};
|
|
206
206
|
};
|
|
207
207
|
|
|
208
|
-
//#endregion
|
|
209
208
|
export { PICKER_MODES, WeappPicker, createPickerChangeDetail, normalizePickerIndex, normalizePickerIndexes, resolvePickerColumns, resolvePickerMode };
|
|
210
209
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/nativeComponents/picker/style.ts
|
|
2
2
|
const PICKER_SHADOW_STYLE = `
|
|
3
3
|
:host { position: relative; cursor: pointer; }
|
|
4
4
|
:host([disabled]) { cursor: not-allowed; opacity: 0.6; }
|
|
@@ -66,6 +66,5 @@ const PICKER_SHADOW_STYLE = `
|
|
|
66
66
|
.editors input { align-self: center; height: 44px; padding: 0 12px; }
|
|
67
67
|
`;
|
|
68
68
|
|
|
69
|
-
//#endregion
|
|
70
69
|
export { PICKER_SHADOW_STYLE };
|
|
71
70
|
//# sourceMappingURL=style.mjs.map
|
|
@@ -4,7 +4,7 @@ import { ensureNativeComponentStyle } from "../style.mjs";
|
|
|
4
4
|
import { PICKER_VIEW_COLUMN_CHANGE_EVENT, PICKER_VIEW_COLUMN_READY_EVENT, PICKER_VIEW_PICK_END_EVENT, PICKER_VIEW_PICK_START_EVENT } from "./helpers.mjs";
|
|
5
5
|
import { PICKER_VIEW_COLUMN_SHADOW_STYLE } from "./style.mjs";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/runtime/nativeComponents/pickerView/column.ts
|
|
8
8
|
const BaseElement = globalThis.HTMLElement ?? class {};
|
|
9
9
|
var WeappPickerViewColumn = class extends BaseElement {
|
|
10
10
|
static observedAttributes = [...getNativeComponentDescriptor("picker-view-column").attributes];
|
|
@@ -129,6 +129,5 @@ var WeappPickerViewColumn = class extends BaseElement {
|
|
|
129
129
|
};
|
|
130
130
|
};
|
|
131
131
|
|
|
132
|
-
//#endregion
|
|
133
132
|
export { WeappPickerViewColumn };
|
|
134
133
|
//# sourceMappingURL=column.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/nativeComponents/pickerView/helpers.ts
|
|
2
2
|
const PICKER_VIEW_COLUMN_CHANGE_EVENT = "weapp-picker-view-column-change";
|
|
3
3
|
const PICKER_VIEW_COLUMN_READY_EVENT = "weapp-picker-view-column-ready";
|
|
4
4
|
const PICKER_VIEW_PICK_START_EVENT = "weapp-picker-view-pick-start";
|
|
@@ -12,6 +12,5 @@ function normalizePickerViewValue(value, columnLengths) {
|
|
|
12
12
|
return columnLengths.map((length, column) => normalizeColumnIndex(indexes[column], length));
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
//#endregion
|
|
16
15
|
export { PICKER_VIEW_COLUMN_CHANGE_EVENT, PICKER_VIEW_COLUMN_READY_EVENT, PICKER_VIEW_PICK_END_EVENT, PICKER_VIEW_PICK_START_EVENT, normalizePickerViewValue };
|
|
17
16
|
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -5,7 +5,7 @@ import { PICKER_VIEW_COLUMN_CHANGE_EVENT, PICKER_VIEW_COLUMN_READY_EVENT, PICKER
|
|
|
5
5
|
import { PICKER_VIEW_SHADOW_STYLE } from "./style.mjs";
|
|
6
6
|
import { WeappPickerViewColumn } from "./column.mjs";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/runtime/nativeComponents/pickerView/index.ts
|
|
9
9
|
const BaseElement = globalThis.HTMLElement ?? class {};
|
|
10
10
|
function parsePickerViewValue(value) {
|
|
11
11
|
if (!value) return [];
|
|
@@ -123,6 +123,5 @@ var WeappPickerView = class extends BaseElement {
|
|
|
123
123
|
};
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
-
//#endregion
|
|
127
126
|
export { PICKER_VIEW_COLUMN_CHANGE_EVENT, PICKER_VIEW_COLUMN_READY_EVENT, PICKER_VIEW_PICK_END_EVENT, PICKER_VIEW_PICK_START_EVENT, WeappPickerView, WeappPickerViewColumn, normalizePickerViewValue };
|
|
128
127
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/nativeComponents/pickerView/style.ts
|
|
2
2
|
const PICKER_VIEW_SHADOW_STYLE = `
|
|
3
3
|
:host { position: relative; min-width: 0; }
|
|
4
4
|
.viewport { position: relative; display: flex; width: 100%; height: 100%; overflow: hidden; }
|
|
@@ -53,6 +53,5 @@ const PICKER_VIEW_COLUMN_SHADOW_STYLE = `
|
|
|
53
53
|
}
|
|
54
54
|
`;
|
|
55
55
|
|
|
56
|
-
//#endregion
|
|
57
56
|
export { PICKER_VIEW_COLUMN_SHADOW_STYLE, PICKER_VIEW_SHADOW_STYLE };
|
|
58
57
|
//# sourceMappingURL=style.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolveContainingShadowRoot } from "./helpers.mjs";
|
|
2
2
|
import { ensureNativeComponentStyle } from "./style.mjs";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/runtime/nativeComponents/primitives.ts
|
|
5
5
|
const BaseElement = globalThis.HTMLElement ?? class {};
|
|
6
6
|
var StyledNativeElement = class extends BaseElement {
|
|
7
7
|
connectedCallback() {
|
|
@@ -11,6 +11,5 @@ var StyledNativeElement = class extends BaseElement {
|
|
|
11
11
|
var WeappView = class extends StyledNativeElement {};
|
|
12
12
|
var WeappText = class extends StyledNativeElement {};
|
|
13
13
|
|
|
14
|
-
//#endregion
|
|
15
14
|
export { WeappText, WeappView };
|
|
16
15
|
//# sourceMappingURL=primitives.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/nativeComponents/progress/helpers.ts
|
|
2
2
|
function finiteNumber(value, fallback) {
|
|
3
3
|
const numeric = Number(value);
|
|
4
4
|
return Number.isFinite(numeric) ? numeric : fallback;
|
|
@@ -24,6 +24,5 @@ function createProgressActiveEndDetail() {
|
|
|
24
24
|
return {};
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
//#endregion
|
|
28
27
|
export { createProgressActiveEndDetail, resolveProgressAnimationDuration, resolveProgressConfig };
|
|
29
28
|
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -4,7 +4,7 @@ import { ensureNativeComponentStyle } from "../style.mjs";
|
|
|
4
4
|
import { createProgressActiveEndDetail, resolveProgressAnimationDuration, resolveProgressConfig } from "./helpers.mjs";
|
|
5
5
|
import { PROGRESS_SHADOW_STYLE } from "./style.mjs";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/runtime/nativeComponents/progress/index.ts
|
|
8
8
|
const BaseElement = globalThis.HTMLElement ?? class {};
|
|
9
9
|
var WeappProgress = class extends BaseElement {
|
|
10
10
|
static observedAttributes = [...getNativeComponentDescriptor("progress").attributes];
|
|
@@ -125,6 +125,5 @@ var WeappProgress = class extends BaseElement {
|
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
|
|
128
|
-
//#endregion
|
|
129
128
|
export { WeappProgress, createProgressActiveEndDetail, resolveProgressAnimationDuration, resolveProgressConfig };
|
|
130
129
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/nativeComponents/progress/style.ts
|
|
2
2
|
const PROGRESS_SHADOW_STYLE = `
|
|
3
3
|
:host {
|
|
4
4
|
min-width: 0;
|
|
@@ -35,6 +35,5 @@ const PROGRESS_SHADOW_STYLE = `
|
|
|
35
35
|
}
|
|
36
36
|
`;
|
|
37
37
|
|
|
38
|
-
//#endregion
|
|
39
38
|
export { PROGRESS_SHADOW_STYLE };
|
|
40
39
|
//# sourceMappingURL=style.mjs.map
|
|
@@ -3,7 +3,7 @@ import { connectFormControl, disconnectFormControl, findClosestComposedElement }
|
|
|
3
3
|
import { dispatchMiniProgramEvent, readBooleanAttribute, resolveContainingShadowRoot } from "./helpers.mjs";
|
|
4
4
|
import { ensureNativeComponentStyle } from "./style.mjs";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/runtime/nativeComponents/radio.ts
|
|
7
7
|
const BaseElement = globalThis.HTMLElement ?? class {};
|
|
8
8
|
function collectRadioGroupValue(radios) {
|
|
9
9
|
return Array.from(radios).find((radio) => radio.checked && !radio.disabled)?.value ?? "";
|
|
@@ -142,6 +142,5 @@ var WeappRadio = class extends BaseElement {
|
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
144
|
|
|
145
|
-
//#endregion
|
|
146
145
|
export { WeappRadio, WeappRadioGroup, collectRadioGroupValue };
|
|
147
146
|
//# sourceMappingURL=radio.mjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getNativeComponentDescriptor } from "../../../shared/nativeComponents.mjs";
|
|
2
2
|
import { readBooleanAttribute, resolveContainingShadowRoot } from "../helpers.mjs";
|
|
3
3
|
import { ensureNativeComponentStyle } from "../style.mjs";
|
|
4
|
-
import { normalizeRichTextNodes
|
|
4
|
+
import { normalizeRichTextNodes } from "@weapp-core/shared/rich-text";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/runtime/nativeComponents/richText/index.ts
|
|
7
7
|
const BaseElement = globalThis.HTMLElement ?? class {};
|
|
8
8
|
function createRichTextDomNode(node) {
|
|
9
9
|
if (node.type === "text") return document.createTextNode(node.text);
|
|
@@ -69,6 +69,5 @@ var WeappRichText = class extends BaseElement {
|
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
export { WeappRichText, normalizeRichTextNodes, sanitizeRichTextAttributes, sanitizeRichTextStyle };
|
|
72
|
+
export { WeappRichText };
|
|
74
73
|
//# sourceMappingURL=index.mjs.map
|