@dongmingzhixiu/vuexir-compiler 0.6.0 → 0.7.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/codegen/bindings.d.ts +11 -0
- package/dist/codegen/bindings.js +32 -0
- package/dist/codegen/compose.d.ts +10 -1
- package/dist/codegen/compose.js +297 -65
- package/dist/codegen/dynamic-vector.d.ts +3 -0
- package/dist/codegen/dynamic-vector.js +81 -0
- package/dist/codegen/page-js-android.d.ts +2 -0
- package/dist/codegen/page-js-android.js +59 -0
- package/dist/codegen/project-assets.d.ts +5 -0
- package/dist/codegen/project-assets.js +31 -0
- package/dist/codegen/project-styles.d.ts +2 -0
- package/dist/codegen/project-styles.js +41 -0
- package/dist/codegen/swiftui.d.ts +4 -25
- package/dist/codegen/swiftui.js +251 -71
- package/dist/codegen/vector.d.ts +3 -0
- package/dist/codegen/vector.js +165 -0
- package/dist/index.d.ts +9 -2
- package/dist/index.js +8 -2
- package/dist/ir/schema.d.ts +41 -1
- package/dist/ir/schema.js +39 -20
- package/dist/transform/css.d.ts +21 -1
- package/dist/transform/css.js +217 -14
- package/dist/transform/dynamic-svg.d.ts +3 -0
- package/dist/transform/dynamic-svg.js +53 -0
- package/dist/transform/svg.d.ts +16 -0
- package/dist/transform/svg.js +96 -0
- package/dist/transform/tab-bar.d.ts +17 -0
- package/dist/transform/tab-bar.js +44 -0
- package/dist/transform/visuals.d.ts +17 -0
- package/dist/transform/visuals.js +91 -0
- package/dist/transform/vue2ir.d.ts +12 -1
- package/dist/transform/vue2ir.js +581 -188
- package/package.json +4 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface LoopBinding {
|
|
2
|
+
expression: string;
|
|
3
|
+
aliases: string[];
|
|
4
|
+
}
|
|
5
|
+
export declare function loopBinding(binding: string | undefined): LoopBinding | null;
|
|
6
|
+
export declare function swiftBoundValue(binding: string, runtime?: string): string;
|
|
7
|
+
export declare function kotlinBoundValue(binding: string): string;
|
|
8
|
+
/** 将嵌套行内文本摊平成 Text/Span 叶子,继承内层样式。 */
|
|
9
|
+
export declare function flattenTextRuns<T extends {
|
|
10
|
+
textRuns?: T[];
|
|
11
|
+
}>(runs: T[]): T[];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export function loopBinding(binding) {
|
|
2
|
+
if (!binding?.startsWith('__vrnLoop:'))
|
|
3
|
+
return null;
|
|
4
|
+
try {
|
|
5
|
+
return JSON.parse(binding.slice(10));
|
|
6
|
+
}
|
|
7
|
+
catch {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export function swiftBoundValue(binding, runtime = 'Runtime.shared') {
|
|
12
|
+
const scoped = loopBinding(binding);
|
|
13
|
+
if (!scoped)
|
|
14
|
+
return binding;
|
|
15
|
+
return `${runtime}.evaluateTemplate(${JSON.stringify(scoped.expression)}, [${scoped.aliases.map((key) => `${JSON.stringify(key)}: ${key}`).join(', ')}])`;
|
|
16
|
+
}
|
|
17
|
+
const kotlinQuote = (value) => JSON.stringify(value).replace(/\$/g, '\\$');
|
|
18
|
+
export function kotlinBoundValue(binding) {
|
|
19
|
+
const scoped = loopBinding(binding);
|
|
20
|
+
if (!scoped)
|
|
21
|
+
return binding;
|
|
22
|
+
return `vrnPageJs.template(${kotlinQuote(scoped.expression)}, mapOf(${scoped.aliases.map((key) => `${kotlinQuote(key)} to ${key}`).join(', ')}))`;
|
|
23
|
+
}
|
|
24
|
+
/** 将嵌套行内文本摊平成 Text/Span 叶子,继承内层样式。 */
|
|
25
|
+
export function flattenTextRuns(runs) {
|
|
26
|
+
return runs.flatMap((run) => {
|
|
27
|
+
if (!run.textRuns)
|
|
28
|
+
return [run];
|
|
29
|
+
const { textRuns, ...style } = run;
|
|
30
|
+
return flattenTextRuns(textRuns.map((child) => ({ ...style, ...child })));
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TabBarSpec } from '../transform/tab-bar.js';
|
|
1
2
|
import type { IrNode } from '../ir/schema.js';
|
|
2
3
|
declare const MANIFEST: (label: string) => string;
|
|
3
4
|
declare const STYLES_XML = "<resources>\n <!-- R-SYSTEMBAR\uFF1A\u56FA\u5B9A\u6DF1\u8272\u4E3B\u9898 \u2192 \u7CFB\u7EDF\u680F\u56FE\u6807\u56FA\u5B9A\u6D45\u8272\uFF08windowLightStatusBar=false\uFF09\uFF0C\u4E0D\u8DDF\u968F\u7CFB\u7EDF\u660E\u6697 -->\n <style name=\"Theme.Vuexir\" parent=\"android:Theme.Material.NoActionBar\">\n <item name=\"android:windowBackground\">#0A0F1E</item>\n <item name=\"android:statusBarColor\">#0A0F1E</item>\n <item name=\"android:navigationBarColor\">#0A0F1E</item>\n <item name=\"android:windowLightStatusBar\">false</item>\n </style>\n</resources>\n";
|
|
@@ -6,6 +7,9 @@ declare const THEME_KT: (bundleId: string) => string;
|
|
|
6
7
|
declare const RUNTIME_KT: (bundleId: string) => string;
|
|
7
8
|
declare const NAV_TEST_KT: (bundleId: string) => string;
|
|
8
9
|
interface ComposeCtx {
|
|
10
|
+
parentAxis?: 'row' | 'column' | 'box';
|
|
11
|
+
inVerticalScroll?: boolean;
|
|
12
|
+
runtimeAsset?: string;
|
|
9
13
|
warnings: string[];
|
|
10
14
|
pageId: string;
|
|
11
15
|
/** R72 异步:本页是否需要协程作用域(async handler / async onMounted)→ 页面 composable 声明 vrnScope */
|
|
@@ -73,6 +77,9 @@ declare function parseRouter(src: string, dir: string, routerFile?: string): {
|
|
|
73
77
|
warnings: string[];
|
|
74
78
|
};
|
|
75
79
|
export interface RunTabsOptions {
|
|
80
|
+
tabBar?: TabBarSpec;
|
|
81
|
+
buildPageRuntime?: (pageFile: string, runtime: string, pageKey?: string) => string;
|
|
82
|
+
nativeNavigationBar?: boolean;
|
|
76
83
|
/** 产物根(默认 <repo>/compiler/generated/android 或 VRN_OUT_DIR) */
|
|
77
84
|
outDirRoot?: string;
|
|
78
85
|
/** 工程名(默认入口目录名 PascalCase) */
|
|
@@ -99,7 +106,9 @@ declare function buildNavHost(bundleId: string, tabs: {
|
|
|
99
106
|
bg?: string;
|
|
100
107
|
backText?: string;
|
|
101
108
|
mode?: string;
|
|
102
|
-
}[]
|
|
109
|
+
}[], options?: {
|
|
110
|
+
tabBar?: TabBarSpec;
|
|
111
|
+
}): string;
|
|
103
112
|
/**
|
|
104
113
|
* 输入解析(R-PKG):CLI 通过 VRN_SAMPLES_ROOT 注入样例根(默认 <repo>/examples)。
|
|
105
114
|
* 依次尝试:样例名 → 目录 → 直接路径;都不存在时原样返回由调用方报错。
|