@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
package/dist/runtime/style.d.mts
CHANGED
package/dist/runtime/style.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/style.ts
|
|
2
2
|
const injected = /* @__PURE__ */ new Map();
|
|
3
3
|
function createStyleId(css) {
|
|
4
4
|
let hash = 2166136261;
|
|
@@ -32,6 +32,5 @@ function injectStyle(css, id) {
|
|
|
32
32
|
return () => removeStyle(styleId);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
//#endregion
|
|
36
35
|
export { injectStyle, removeStyle };
|
|
37
36
|
//# sourceMappingURL=style.mjs.map
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { RenderContext } from "./renderContext.mjs";
|
|
2
2
|
import { createTemplate, renderTemplate } from "./legacyTemplate/index.mjs";
|
|
3
3
|
import { TemplateResult } from "lit";
|
|
4
|
-
//#region src/runtime/template.d.ts
|
|
5
4
|
export type TemplateScope = Record<string, any>;
|
|
6
5
|
export type TemplateRenderer = (scope: TemplateScope, ctx: RenderContext) => TemplateResult | string | unknown;
|
|
7
|
-
//#endregion
|
|
8
6
|
export { createTemplate, renderTemplate };
|
|
9
7
|
//# sourceMappingURL=template.d.mts.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ResolvedWebViewportConfig, WebViewportConfig } from "./types.mjs";
|
|
2
|
-
//#region src/runtime/viewport/index.d.ts
|
|
3
2
|
export declare function resolveWebViewportConfig(config?: WebViewportConfig): ResolvedWebViewportConfig;
|
|
4
3
|
export declare function setupWebViewport(config?: WebViewportConfig): {
|
|
5
4
|
mode: "mini-program" | "responsive";
|
|
@@ -7,6 +6,5 @@ export declare function setupWebViewport(config?: WebViewportConfig): {
|
|
|
7
6
|
desktopBreakpoint: number;
|
|
8
7
|
};
|
|
9
8
|
export declare function getWebViewportWidth(): number;
|
|
10
|
-
//#endregion
|
|
11
9
|
export type { ResolvedWebViewportConfig, WebViewportConfig };
|
|
12
10
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WEB_VIEWPORT_STYLE_ID, createWebViewportStyle } from "./style.mjs";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/runtime/viewport/index.ts
|
|
4
4
|
const DEFAULT_VIEWPORT_CONFIG = {
|
|
5
5
|
mode: "mini-program",
|
|
6
6
|
maxWidth: 375,
|
|
@@ -39,6 +39,5 @@ function getWebViewportWidth() {
|
|
|
39
39
|
return documentWidth || (typeof window !== "undefined" ? window.innerWidth : 0);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
//#endregion
|
|
43
42
|
export { getWebViewportWidth, resolveWebViewportConfig, setupWebViewport };
|
|
44
43
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/viewport/style.ts
|
|
2
2
|
const WEB_VIEWPORT_STYLE_ID = "weapp-web-viewport-style";
|
|
3
3
|
function createWebViewportStyle(config) {
|
|
4
4
|
const maxWidth = `${config.maxWidth}px`;
|
|
5
5
|
return `
|
|
6
6
|
:root {
|
|
7
7
|
--weapp-viewport-width: 100vw;
|
|
8
|
+
--weapp-viewport-height: 100dvh;
|
|
8
9
|
--weapp-viewport-max-width: ${maxWidth};
|
|
9
10
|
--weapp-viewport-left: 0px;
|
|
10
11
|
--weapp-viewport-right: 0px;
|
|
@@ -57,6 +58,5 @@ body {
|
|
|
57
58
|
`;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
//#endregion
|
|
61
61
|
export { WEB_VIEWPORT_STYLE_ID, createWebViewportStyle };
|
|
62
62
|
//# sourceMappingURL=style.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.mjs","names":[],"sources":["../../../src/runtime/viewport/style.ts"],"sourcesContent":["import type { ResolvedWebViewportConfig } from './types'\n\nexport const WEB_VIEWPORT_STYLE_ID = 'weapp-web-viewport-style'\n\nexport function createWebViewportStyle(config: ResolvedWebViewportConfig) {\n const maxWidth = `${config.maxWidth}px`\n const breakpoint = `${config.desktopBreakpoint}px`\n return `\n:root {\n --weapp-viewport-width: 100vw;\n --weapp-viewport-max-width: ${maxWidth};\n --weapp-viewport-left: 0px;\n --weapp-viewport-right: 0px;\n --weapp-safe-area-inset-top: env(safe-area-inset-top, 0px);\n --weapp-safe-area-inset-right: env(safe-area-inset-right, 0px);\n --weapp-safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);\n --weapp-safe-area-inset-left: env(safe-area-inset-left, 0px);\n}\n\nhtml,\nbody {\n min-width: 0;\n height: 100%;\n margin: 0;\n overflow: hidden;\n}\n\nbody {\n background: #f2f2f2;\n font-family: Helvetica, -apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Arial, sans-serif;\n}\n\n#app {\n --weapp-tab-bar-inset: 0px;\n --weapp-tab-bar-top-inset: 0px;\n position: relative;\n box-sizing: border-box;\n width: 100%;\n height: 100dvh;\n min-height: 0;\n margin: 0 auto;\n overflow: auto;\n overscroll-behavior: contain;\n background: #ffffff;\n contain: layout paint;\n transform: translateZ(0);\n}\n\n@media (min-width: ${breakpoint}) {\n html[data-weapp-viewport-mode=\"mini-program\"] {\n --weapp-viewport-width: ${maxWidth};\n --weapp-viewport-left: calc((100vw - ${maxWidth}) / 2);\n --weapp-viewport-right: calc((100vw - ${maxWidth}) / 2);\n }\n\n html[data-weapp-viewport-mode=\"mini-program\"] #app {\n width: ${maxWidth};\n }\n}\n`\n}\n"],"mappings":";AAEA,MAAa,wBAAwB;AAErC,SAAgB,uBAAuB,QAAmC;CACxE,MAAM,WAAW,GAAG,OAAO,SAAS;CAEpC,OAAO
|
|
1
|
+
{"version":3,"file":"style.mjs","names":[],"sources":["../../../src/runtime/viewport/style.ts"],"sourcesContent":["import type { ResolvedWebViewportConfig } from './types'\n\nexport const WEB_VIEWPORT_STYLE_ID = 'weapp-web-viewport-style'\n\nexport function createWebViewportStyle(config: ResolvedWebViewportConfig) {\n const maxWidth = `${config.maxWidth}px`\n const breakpoint = `${config.desktopBreakpoint}px`\n return `\n:root {\n --weapp-viewport-width: 100vw;\n --weapp-viewport-height: 100dvh;\n --weapp-viewport-max-width: ${maxWidth};\n --weapp-viewport-left: 0px;\n --weapp-viewport-right: 0px;\n --weapp-safe-area-inset-top: env(safe-area-inset-top, 0px);\n --weapp-safe-area-inset-right: env(safe-area-inset-right, 0px);\n --weapp-safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);\n --weapp-safe-area-inset-left: env(safe-area-inset-left, 0px);\n}\n\nhtml,\nbody {\n min-width: 0;\n height: 100%;\n margin: 0;\n overflow: hidden;\n}\n\nbody {\n background: #f2f2f2;\n font-family: Helvetica, -apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Arial, sans-serif;\n}\n\n#app {\n --weapp-tab-bar-inset: 0px;\n --weapp-tab-bar-top-inset: 0px;\n position: relative;\n box-sizing: border-box;\n width: 100%;\n height: 100dvh;\n min-height: 0;\n margin: 0 auto;\n overflow: auto;\n overscroll-behavior: contain;\n background: #ffffff;\n contain: layout paint;\n transform: translateZ(0);\n}\n\n@media (min-width: ${breakpoint}) {\n html[data-weapp-viewport-mode=\"mini-program\"] {\n --weapp-viewport-width: ${maxWidth};\n --weapp-viewport-left: calc((100vw - ${maxWidth}) / 2);\n --weapp-viewport-right: calc((100vw - ${maxWidth}) / 2);\n }\n\n html[data-weapp-viewport-mode=\"mini-program\"] #app {\n width: ${maxWidth};\n }\n}\n`\n}\n"],"mappings":";AAEA,MAAa,wBAAwB;AAErC,SAAgB,uBAAuB,QAAmC;CACxE,MAAM,WAAW,GAAG,OAAO,SAAS;CAEpC,OAAO;;;;gCAIuB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAsCpB,GA3CG,OAAO,kBAAkB,IA2CjB;;8BAEF,SAAS;2CACI,SAAS;4CACR,SAAS;;;;aAIxC,SAAS;;;;AAItB"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/runtime/viewport/types.d.ts
|
|
2
1
|
export interface WebViewportConfig {
|
|
3
2
|
mode?: 'mini-program' | 'responsive';
|
|
4
3
|
maxWidth?: number;
|
|
@@ -9,5 +8,4 @@ export interface ResolvedWebViewportConfig {
|
|
|
9
8
|
maxWidth: number;
|
|
10
9
|
desktopBreakpoint: number;
|
|
11
10
|
}
|
|
12
|
-
//#endregion
|
|
13
11
|
//# sourceMappingURL=types.d.mts.map
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
//#region src/runtime/warning.d.ts
|
|
2
1
|
export type RuntimeWarningLevel = 'off' | 'warn' | 'error';
|
|
3
2
|
export interface RuntimeWarningOptions {
|
|
4
3
|
level?: RuntimeWarningLevel;
|
|
5
4
|
dedupe?: boolean;
|
|
6
5
|
}
|
|
7
6
|
export declare function setRuntimeWarningOptions(options?: RuntimeWarningOptions): void;
|
|
8
|
-
//#endregion
|
|
9
7
|
//# sourceMappingURL=warning.d.mts.map
|
package/dist/runtime/warning.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/warning.ts
|
|
2
2
|
const defaultWarningOptions = {
|
|
3
3
|
level: "warn",
|
|
4
4
|
dedupe: true
|
|
@@ -38,6 +38,5 @@ function emitRuntimeWarning(message, options = {}) {
|
|
|
38
38
|
if (typeof logger.warn === "function") logger.warn(normalized);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
//#endregion
|
|
42
41
|
export { emitRuntimeWarning, setRuntimeWarningOptions };
|
|
43
42
|
//# sourceMappingURL=warning.mjs.map
|
package/dist/runtime/wevu.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { RegisterMeta } from "./polyfill/routeRuntime/options.mjs";
|
|
2
|
-
//#region src/runtime/wevu.d.ts
|
|
3
2
|
interface WevuRegisterMeta extends RegisterMeta {
|
|
4
3
|
kind: 'app' | 'page' | 'component';
|
|
5
4
|
}
|
|
@@ -19,5 +18,5 @@ export declare function registerWebWevuComponentFactory<TArgs extends unknown[],
|
|
|
19
18
|
* 在原生模块同步求值期间安装带页面元数据的宿主注册函数。
|
|
20
19
|
*/
|
|
21
20
|
export declare function installWebModuleRegistration(meta: WevuRegisterMeta, target?: Record<string, any>): () => void;
|
|
22
|
-
|
|
21
|
+
export {};
|
|
23
22
|
//# sourceMappingURL=wevu.d.mts.map
|
package/dist/runtime/wevu.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { setAppStyle } from "./appStyle.mjs";
|
|
|
2
2
|
import { registerApp, registerComponent, registerPage } from "./polyfill/routeRuntime.mjs";
|
|
3
3
|
import { createApp, createWevuComponent, takePendingRuntimeAppRegistration } from "wevu/internal-runtime";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/runtime/wevu.ts
|
|
6
6
|
function createRuntimeConstructor(meta, name) {
|
|
7
7
|
return (definition) => {
|
|
8
8
|
if (name === "App") registerApp(definition, meta);
|
|
@@ -81,6 +81,5 @@ function installWebModuleRegistration(meta, target = globalThis) {
|
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
//#endregion
|
|
85
84
|
export { installWebModuleRegistration, registerWebWevuApp, registerWebWevuComponent, registerWebWevuComponentFactory };
|
|
86
85
|
//# sourceMappingURL=wevu.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/shared/nativeComponents.ts
|
|
2
2
|
const NATIVE_COMPONENT_DESCRIPTORS = Object.freeze([
|
|
3
3
|
{
|
|
4
4
|
name: "view",
|
|
@@ -238,7 +238,15 @@ const NATIVE_COMPONENT_DESCRIPTORS = Object.freeze([
|
|
|
238
238
|
"scroll-x",
|
|
239
239
|
"scroll-y",
|
|
240
240
|
"scroll-top",
|
|
241
|
-
"scroll-left"
|
|
241
|
+
"scroll-left",
|
|
242
|
+
"upper-threshold",
|
|
243
|
+
"lower-threshold",
|
|
244
|
+
"scroll-into-view",
|
|
245
|
+
"scroll-into-view-offset",
|
|
246
|
+
"scroll-into-view-alignment",
|
|
247
|
+
"enable-flex",
|
|
248
|
+
"enhanced",
|
|
249
|
+
"show-scrollbar"
|
|
242
250
|
],
|
|
243
251
|
defaultStyle: "display: block; box-sizing: border-box;"
|
|
244
252
|
},
|
|
@@ -396,6 +404,5 @@ function isKnownUnsupportedNativeComponent(name) {
|
|
|
396
404
|
return KNOWN_UNSUPPORTED_NATIVE_COMPONENTS.has(name.toLowerCase());
|
|
397
405
|
}
|
|
398
406
|
|
|
399
|
-
//#endregion
|
|
400
407
|
export { NATIVE_COMPONENT_DESCRIPTORS, getNativeComponentDescriptor, isKnownUnsupportedNativeComponent, resolveNativeComponentPropertyAttributes, resolveNativeComponentWebTag };
|
|
401
408
|
//# sourceMappingURL=nativeComponents.mjs.map
|
|
@@ -1 +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,QAAQ;EACR,YAAY;GAAC;GAAS;GAAW;GAAY;EAAO;EACpD,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY,CAAC,MAAM;EACnB,c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O,6BAA6B,IAAI,CAAC,EAAE,sBAAsB,CAAC;AACpE;AAEA,SAAgB,kCAAkC,MAAc;CAC9D,OAAO,oCAAoC,IAAI,KAAK,YAAY,CAAC;AACnE"}
|
|
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: [\n 'scroll-x',\n 'scroll-y',\n 'scroll-top',\n 'scroll-left',\n 'upper-threshold',\n 'lower-threshold',\n 'scroll-into-view',\n 'scroll-into-view-offset',\n 'scroll-into-view-alignment',\n 'enable-flex',\n 'enhanced',\n 'show-scrollbar',\n ],\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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;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACA,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GACV;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACA,oBAAoB,CAAC,YAAY;EACjC,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GACV;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACA,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY,CAAC,SAAS;EACtB,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAM;GAAa;GAAQ;GAAkB;GAAS;EAAQ;EAC3E,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAM;GAAO;GAAU;GAAY;GAAQ;GAAS;GAAY;GAAgB;EAAY;EACzG,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY,CAAC;EACb,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAO;GAAQ;GAAa;EAAK;EAC9C,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY,CAAC;EACb,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAa;GAAW;GAAiB;GAAK;GAAK;GAAW;GAAY;GAAY;GAAS;GAAa;GAAa;GAAe;EAAW;EAChK,cAAc;CAChB;AACF,CAAyD;AAKzD,MAAM,gBAAgB,IAAI,IACxB,6BAA6B,KAAI,eAAc,CAAC,WAAW,MAAM,UAAU,CAAC,CAC9E;AAEA,MAAM,sDAAsC,IAAI,IAAI;CAClD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAgB,6BAA6B,MAAc;CACzD,OAAO,cAAc,IAAI,KAAK,YAAY,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"}
|
package/dist/shared/slugify.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// src/shared/slugify.ts
|
|
2
2
|
function slugify(id, prefix) {
|
|
3
3
|
return `${prefix}-${id.replace(/[^a-z0-9]+/gi, "-").replace(/^-+|-+$/g, "").toLowerCase() || "index"}`;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
//#endregion
|
|
7
6
|
export { slugify };
|
|
8
7
|
//# sourceMappingURL=slugify.mjs.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface WxssTransformOptions {
|
|
2
|
+
/**
|
|
3
|
+
* 1rpx 对应的 CSS 像素数。
|
|
4
|
+
* 默认值近似于 750rpx 设计稿在 375px 屏幕上的换算。
|
|
5
|
+
*/
|
|
6
|
+
pxPerRpx?: number;
|
|
7
|
+
/**
|
|
8
|
+
* rpx 换算的设计宽度。传入后会把 rpx 转为
|
|
9
|
+
* `calc(var(--rpx) * N)` 以实现响应式缩放。
|
|
10
|
+
*/
|
|
11
|
+
designWidth?: number;
|
|
12
|
+
/**
|
|
13
|
+
* 用于存储运行时 rpx 大小的 CSS 变量名。
|
|
14
|
+
* @default "--rpx"
|
|
15
|
+
*/
|
|
16
|
+
rpxVar?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ResolvedStyleUnitOptions {
|
|
19
|
+
useVariable: boolean;
|
|
20
|
+
rpxVar: string;
|
|
21
|
+
ratio: number;
|
|
22
|
+
designWidth: number;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=options.d.mts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/shared/styleUnits/options.ts
|
|
2
|
+
/** 编译端与运行时共用显式配置;有限设计宽度优先启用变量模式。 */
|
|
3
|
+
function resolveStyleUnitOptions(options) {
|
|
4
|
+
return {
|
|
5
|
+
useVariable: options?.pxPerRpx === void 0 || typeof options.designWidth === "number" && Number.isFinite(options.designWidth),
|
|
6
|
+
rpxVar: options?.rpxVar ?? "--rpx",
|
|
7
|
+
ratio: options?.pxPerRpx ?? .5,
|
|
8
|
+
designWidth: options?.designWidth ?? 750
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { resolveStyleUnitOptions };
|
|
13
|
+
//# sourceMappingURL=options.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.mjs","names":[],"sources":["../../../src/shared/styleUnits/options.ts"],"sourcesContent":["export interface WxssTransformOptions {\n /**\n * 1rpx 对应的 CSS 像素数。\n * 默认值近似于 750rpx 设计稿在 375px 屏幕上的换算。\n */\n pxPerRpx?: number\n /**\n * rpx 换算的设计宽度。传入后会把 rpx 转为\n * `calc(var(--rpx) * N)` 以实现响应式缩放。\n */\n designWidth?: number\n /**\n * 用于存储运行时 rpx 大小的 CSS 变量名。\n * @default \"--rpx\"\n */\n rpxVar?: string\n}\n\nexport interface ResolvedStyleUnitOptions {\n useVariable: boolean\n rpxVar: string\n ratio: number\n designWidth: number\n}\n\n/** 编译端与运行时共用显式配置;有限设计宽度优先启用变量模式。 */\nexport function resolveStyleUnitOptions(options?: WxssTransformOptions): ResolvedStyleUnitOptions {\n return {\n useVariable: options?.pxPerRpx === undefined\n || (typeof options.designWidth === 'number' && Number.isFinite(options.designWidth)),\n rpxVar: options?.rpxVar ?? '--rpx',\n ratio: options?.pxPerRpx ?? 0.5,\n designWidth: options?.designWidth ?? 750,\n }\n}\n"],"mappings":";;AA0BA,SAAgB,wBAAwB,SAA0D;CAChG,OAAO;EACL,aAAa,SAAS,aAAa,UAC7B,OAAO,QAAQ,gBAAgB,YAAY,OAAO,SAAS,QAAQ,WAAW;EACpF,QAAQ,SAAS,UAAU;EAC3B,OAAO,SAAS,YAAY;EAC5B,aAAa,SAAS,eAAe;CACvC;AACF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { TokenType, tokenize } from "@csstools/css-tokenizer";
|
|
2
|
+
|
|
3
|
+
// src/shared/styleUnits/value.ts
|
|
4
|
+
function resolveViewportUnitBase(unit) {
|
|
5
|
+
if (unit === "vw") return "var(--weapp-viewport-width)";
|
|
6
|
+
if (unit === "vh") return "var(--weapp-viewport-height)";
|
|
7
|
+
if (unit === "vmin") return "min(var(--weapp-viewport-width), var(--weapp-viewport-height))";
|
|
8
|
+
return "max(var(--weapp-viewport-width), var(--weapp-viewport-height))";
|
|
9
|
+
}
|
|
10
|
+
function nextSignificantToken(tokens, from) {
|
|
11
|
+
let index = from;
|
|
12
|
+
while (tokens[index]?.[0] === TokenType.Whitespace || tokens[index]?.[0] === TokenType.Comment) index += 1;
|
|
13
|
+
return index;
|
|
14
|
+
}
|
|
15
|
+
function functionArgument(tokens, from) {
|
|
16
|
+
const index = nextSignificantToken(tokens, from + 1);
|
|
17
|
+
const token = tokens[index];
|
|
18
|
+
const following = tokens[nextSignificantToken(tokens, index + 1)];
|
|
19
|
+
if (token?.[0] === TokenType.Ident && (following?.[0] === TokenType.Comma || following?.[0] === TokenType.CloseParen)) return {
|
|
20
|
+
index,
|
|
21
|
+
value: token[4].value
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** 仅转换完整单位 token;字面量及运行时视口变量的浏览器 fallback 保持原样。 */
|
|
25
|
+
function transformStyleValue(value, options) {
|
|
26
|
+
const tokens = tokenize({ css: value });
|
|
27
|
+
const replacements = /* @__PURE__ */ new Map();
|
|
28
|
+
let protectedDepth = 0;
|
|
29
|
+
return tokens.map((token, index) => {
|
|
30
|
+
if (protectedDepth > 0) {
|
|
31
|
+
if (token[0] === TokenType.Function || token[0] === TokenType.OpenParen) protectedDepth += 1;
|
|
32
|
+
else if (token[0] === TokenType.CloseParen) protectedDepth -= 1;
|
|
33
|
+
return token[1];
|
|
34
|
+
}
|
|
35
|
+
if (token[0] === TokenType.Function) {
|
|
36
|
+
const name = token[4].value.toLowerCase();
|
|
37
|
+
const argument = functionArgument(tokens, index);
|
|
38
|
+
if (name === "url" || name === "var" && (argument?.value === "--weapp-viewport-width" || argument?.value === "--weapp-viewport-height")) {
|
|
39
|
+
protectedDepth = 1;
|
|
40
|
+
return token[1];
|
|
41
|
+
}
|
|
42
|
+
if (name === "env" && argument && /^safe-area-inset-(?:top|right|bottom|left)$/i.test(argument.value)) {
|
|
43
|
+
replacements.set(argument.index, `--weapp-${argument.value.toLowerCase()}`);
|
|
44
|
+
return "var(";
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const replacement = replacements.get(index);
|
|
48
|
+
if (replacement !== void 0) return replacement;
|
|
49
|
+
if (token[0] !== TokenType.Dimension || !Number.isFinite(token[4].value)) return token[1];
|
|
50
|
+
const numeric = token[4].value;
|
|
51
|
+
const unit = token[4].unit.toLowerCase();
|
|
52
|
+
if (unit === "rpx") {
|
|
53
|
+
if (options.useVariable) return `calc(var(${options.rpxVar}) * ${numeric})`;
|
|
54
|
+
return `${Math.round(numeric * options.ratio * 1e3) / 1e3}px`;
|
|
55
|
+
}
|
|
56
|
+
if (!options.useVariable || !/^(?:vw|vh|vmin|vmax)$/.test(unit)) return token[1];
|
|
57
|
+
const base = resolveViewportUnitBase(unit);
|
|
58
|
+
return numeric === 0 ? "0px" : numeric === 100 ? base : `calc(${base} * ${numeric} / 100)`;
|
|
59
|
+
}).join("");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { transformStyleValue };
|
|
63
|
+
//# sourceMappingURL=value.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value.mjs","names":[],"sources":["../../../src/shared/styleUnits/value.ts"],"sourcesContent":["import type { CSSToken } from '@csstools/css-tokenizer'\nimport type { ResolvedStyleUnitOptions } from './options'\nimport { tokenize, TokenType } from '@csstools/css-tokenizer'\n\nfunction resolveViewportUnitBase(unit: string) {\n if (unit === 'vw') {\n return 'var(--weapp-viewport-width)'\n }\n if (unit === 'vh') {\n return 'var(--weapp-viewport-height)'\n }\n if (unit === 'vmin') {\n return 'min(var(--weapp-viewport-width), var(--weapp-viewport-height))'\n }\n return 'max(var(--weapp-viewport-width), var(--weapp-viewport-height))'\n}\n\nfunction nextSignificantToken(tokens: CSSToken[], from: number) {\n let index = from\n while (tokens[index]?.[0] === TokenType.Whitespace || tokens[index]?.[0] === TokenType.Comment) {\n index += 1\n }\n return index\n}\n\nfunction functionArgument(tokens: CSSToken[], from: number) {\n const index = nextSignificantToken(tokens, from + 1)\n const token = tokens[index]\n const following = tokens[nextSignificantToken(tokens, index + 1)]\n if (token?.[0] === TokenType.Ident && (following?.[0] === TokenType.Comma || following?.[0] === TokenType.CloseParen)) {\n return { index, value: token[4].value }\n }\n}\n\n/** 仅转换完整单位 token;字面量及运行时视口变量的浏览器 fallback 保持原样。 */\nexport function transformStyleValue(value: string, options: ResolvedStyleUnitOptions) {\n const tokens = tokenize({ css: value })\n const replacements = new Map<number, string>()\n let protectedDepth = 0\n return tokens.map((token, index) => {\n if (protectedDepth > 0) {\n if (token[0] === TokenType.Function || token[0] === TokenType.OpenParen) {\n protectedDepth += 1\n }\n else if (token[0] === TokenType.CloseParen) {\n protectedDepth -= 1\n }\n return token[1]\n }\n if (token[0] === TokenType.Function) {\n const name = token[4].value.toLowerCase()\n const argument = functionArgument(tokens, index)\n if (name === 'url' || (name === 'var' && (argument?.value === '--weapp-viewport-width' || argument?.value === '--weapp-viewport-height'))) {\n protectedDepth = 1\n return token[1]\n }\n if (name === 'env' && argument && /^safe-area-inset-(?:top|right|bottom|left)$/i.test(argument.value)) {\n replacements.set(argument.index, `--weapp-${argument.value.toLowerCase()}`)\n return 'var('\n }\n }\n const replacement = replacements.get(index)\n if (replacement !== undefined) {\n return replacement\n }\n if (token[0] !== TokenType.Dimension || !Number.isFinite(token[4].value)) {\n return token[1]\n }\n const numeric = token[4].value\n const unit = token[4].unit.toLowerCase()\n if (unit === 'rpx') {\n if (options.useVariable) {\n return `calc(var(${options.rpxVar}) * ${numeric})`\n }\n return `${Math.round(numeric * options.ratio * 1000) / 1000}px`\n }\n if (!options.useVariable || !/^(?:vw|vh|vmin|vmax)$/.test(unit)) {\n return token[1]\n }\n const base = resolveViewportUnitBase(unit)\n return numeric === 0 ? '0px' : numeric === 100 ? base : `calc(${base} * ${numeric} / 100)`\n }).join('')\n}\n"],"mappings":";;;AAIA,SAAS,wBAAwB,MAAc;CAC7C,IAAI,SAAS,MACX,OAAO;CAET,IAAI,SAAS,MACX,OAAO;CAET,IAAI,SAAS,QACX,OAAO;CAET,OAAO;AACT;AAEA,SAAS,qBAAqB,QAAoB,MAAc;CAC9D,IAAI,QAAQ;CACZ,OAAO,OAAO,MAAM,GAAG,OAAO,UAAU,cAAc,OAAO,MAAM,GAAG,OAAO,UAAU,SACrF,SAAS;CAEX,OAAO;AACT;AAEA,SAAS,iBAAiB,QAAoB,MAAc;CAC1D,MAAM,QAAQ,qBAAqB,QAAQ,OAAO,CAAC;CACnD,MAAM,QAAQ,OAAO;CACrB,MAAM,YAAY,OAAO,qBAAqB,QAAQ,QAAQ,CAAC;CAC/D,IAAI,QAAQ,OAAO,UAAU,UAAU,YAAY,OAAO,UAAU,SAAS,YAAY,OAAO,UAAU,aACxG,OAAO;EAAE;EAAO,OAAO,MAAM,EAAE,CAAC;CAAM;AAE1C;;AAGA,SAAgB,oBAAoB,OAAe,SAAmC;CACpF,MAAM,SAAS,SAAS,EAAE,KAAK,MAAM,CAAC;CACtC,MAAM,+BAAe,IAAI,IAAoB;CAC7C,IAAI,iBAAiB;CACrB,OAAO,OAAO,KAAK,OAAO,UAAU;EAClC,I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
|
|
|
1
|
-
//#region src/shared/tabBar.d.ts
|
|
2
1
|
export interface WebTabBarItem {
|
|
3
2
|
pagePath: string;
|
|
4
3
|
text: string;
|
|
@@ -14,5 +13,4 @@ export interface WebTabBarConfig {
|
|
|
14
13
|
custom: boolean;
|
|
15
14
|
list: WebTabBarItem[];
|
|
16
15
|
}
|
|
17
|
-
//#endregion
|
|
18
16
|
//# sourceMappingURL=tabBar.d.mts.map
|
package/dist/shared/tabBar.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/shared/tabBar.ts
|
|
2
2
|
function normalizeOptionalString(value) {
|
|
3
3
|
return typeof value === "string" && value.trim() ? value : void 0;
|
|
4
4
|
}
|
|
@@ -32,6 +32,5 @@ function normalizeWebTabBarConfig(value) {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
//#endregion
|
|
36
35
|
export { normalizeWebTabBarConfig };
|
|
37
36
|
//# sourceMappingURL=tabBar.mjs.map
|
package/dist/shared/wxml.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolveNativeComponentWebTag } from "./nativeComponents.mjs";
|
|
2
2
|
import { getSupportedMiniProgramDirectivePrefixes } from "@weapp-core/shared/platforms/runtime";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/shared/wxml.ts
|
|
5
5
|
const CONTROL_ATTR_SUFFIXES = [
|
|
6
6
|
"if",
|
|
7
7
|
"elif",
|
|
@@ -65,6 +65,5 @@ function normalizeAttributeName(name) {
|
|
|
65
65
|
return name.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
//#endregion
|
|
69
68
|
export { CONTROL_ATTRS, CONTROL_ATTR_PREFIXES, EVENT_KIND_ALIAS, EVENT_PREFIX_RE, SELF_CLOSING_TAGS, TEMPLATE_IMPORT_TAG_NAMES, TEMPLATE_INCLUDE_TAG_NAMES, hasControlAttribute, normalizeAttributeName, normalizeTagName, resolveControlAttributeName, resolveControlAttributeValue };
|
|
70
69
|
//# sourceMappingURL=wxml.mjs.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-vite/web",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.1.0",
|
|
5
5
|
"description": "Experimental web runtime for weapp-vite templates",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"dist"
|
|
53
53
|
],
|
|
54
54
|
"engines": {
|
|
55
|
-
"node": "^22.
|
|
55
|
+
"node": "^22.23.4 || ^24.22.1 || >=26.12.1"
|
|
56
56
|
},
|
|
57
57
|
"tsd": {
|
|
58
58
|
"compilerOptions": {
|
|
@@ -62,26 +62,28 @@
|
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@babel/parser": "^8.0.
|
|
65
|
+
"@babel/parser": "^8.0.8",
|
|
66
66
|
"@babel/traverse": "^8.0.7",
|
|
67
|
-
"@babel/types": "^8.0.
|
|
68
|
-
"@
|
|
69
|
-
"@
|
|
67
|
+
"@babel/types": "^8.0.8",
|
|
68
|
+
"@csstools/css-tokenizer": "4.0.2",
|
|
69
|
+
"@vue/shared": "^3.5.44",
|
|
70
|
+
"@weapp-core/constants": "0.5.0",
|
|
71
|
+
"@weapp-core/shared": "3.4.0",
|
|
70
72
|
"domhandler": "^6.0.1",
|
|
71
73
|
"esbuild": "^0.28.2",
|
|
72
74
|
"htmlparser2": "^12.0.0",
|
|
73
75
|
"lit": "^3.3.3",
|
|
74
76
|
"magic-string": "^1.4.3",
|
|
75
77
|
"pathe": "^2.0.3",
|
|
76
|
-
"postcss": "^8.5.
|
|
77
|
-
"postcss-selector-parser": "^7.1.
|
|
78
|
-
"rolldown": "1.2.
|
|
79
|
-
"rolldown-require": "2.0
|
|
80
|
-
"vite": "8.3.
|
|
81
|
-
"wevu": "7.
|
|
78
|
+
"postcss": "^8.5.31",
|
|
79
|
+
"postcss-selector-parser": "^7.1.7",
|
|
80
|
+
"rolldown": "1.2.15",
|
|
81
|
+
"rolldown-require": "2.1.0",
|
|
82
|
+
"vite": "8.3.5",
|
|
83
|
+
"wevu": "7.7.0"
|
|
82
84
|
},
|
|
83
85
|
"devDependencies": {
|
|
84
|
-
"happy-dom": "^
|
|
86
|
+
"happy-dom": "^21.0.4"
|
|
85
87
|
},
|
|
86
88
|
"publishConfig": {
|
|
87
89
|
"access": "public",
|