embedded-react 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/aot/compile.mjs +178 -58
- package/aot/compiler/animations.mjs +290 -281
- package/aot/compiler/boot.mjs +70 -33
- package/aot/compiler/branch-merge.mjs +4 -3
- package/aot/compiler/check.mjs +9 -9
- package/aot/compiler/collect.mjs +324 -205
- package/aot/compiler/control-flow.mjs +209 -197
- package/aot/compiler/diagnostics.mjs +22 -25
- package/aot/compiler/elements/activity-indicator.mjs +25 -24
- package/aot/compiler/elements/dial.mjs +91 -77
- package/aot/compiler/elements/flat-list.mjs +24 -22
- package/aot/compiler/elements/image.mjs +51 -50
- package/aot/compiler/elements/modal.mjs +31 -30
- package/aot/compiler/elements/props.mjs +23 -23
- package/aot/compiler/elements/switch.mjs +42 -34
- package/aot/compiler/elements/text-input.mjs +34 -32
- package/aot/compiler/expressions.mjs +372 -333
- package/aot/compiler/handlers.mjs +473 -387
- package/aot/compiler/ir/functions.mjs +11 -1
- package/aot/compiler/ir/nodes.mjs +4 -4
- package/aot/compiler/ir/reads.mjs +19 -19
- package/aot/compiler/ir/types.mjs +14 -14
- package/aot/compiler/ir/vectors.mjs +5 -1
- package/aot/compiler/keyboard.mjs +17 -7
- package/aot/compiler/lower.mjs +77 -80
- package/aot/compiler/nodes.mjs +169 -152
- package/aot/compiler/options.mjs +35 -30
- package/aot/compiler/out.mjs +18 -22
- package/aot/compiler/package/animations.mjs +669 -0
- package/aot/compiler/package/arena.mjs +252 -0
- package/aot/compiler/package/assemble.mjs +177 -0
- package/aot/compiler/package/bytecode.mjs +286 -0
- package/aot/compiler/package/checks.mjs +1022 -0
- package/aot/compiler/package/codegen.mjs +1329 -0
- package/aot/compiler/package/enums.mjs +138 -0
- package/aot/compiler/package/format.mjs +760 -0
- package/aot/compiler/package/layouts.mjs +136 -0
- package/aot/compiler/package/lower.mjs +1606 -0
- package/aot/compiler/package/props.mjs +118 -0
- package/aot/compiler/package/tables.mjs +103 -0
- package/aot/compiler/package/vectors.mjs +502 -0
- package/aot/compiler/package/writer.mjs +664 -0
- package/aot/compiler/pan-responder.mjs +69 -61
- package/aot/compiler/parse.mjs +21 -21
- package/aot/compiler/static-eval.mjs +25 -23
- package/aot/compiler/style-text.mjs +161 -172
- package/aot/compiler/svg.mjs +477 -251
- package/aot/screenshot-smoke.mjs +54 -40
- package/aot/style-map.mjs +102 -90
- package/assets/bake-font.mjs +123 -77
- package/assets/bake-image.mjs +39 -22
- package/assets/bake-svg.mjs +361 -262
- package/assets/build-builtin-font.mjs +11 -7
- package/assets/emit-c.mjs +77 -58
- package/assets/emit-container.mjs +123 -37
- package/assets/emit-pack.mjs +77 -67
- package/assets/font-config.mjs +9 -6
- package/assets/font-sizes.mjs +163 -123
- package/assets/glyph-coverage.mjs +74 -54
- package/assets/index.mjs +31 -9
- package/assets/rasterize.mjs +126 -99
- package/assets/svg-loader.mjs +8 -8
- package/build.mjs +14 -12
- package/cli.mjs +359 -172
- package/compile-bin.mjs +3 -3
- package/flash.mjs +537 -0
- package/hotreload/dev-device.mjs +90 -33
- package/hotreload/pack-app.mjs +55 -43
- package/hotreload/pack-split.mjs +46 -37
- package/hotreload/package-transfer.mjs +175 -0
- package/hotreload/protocol.mjs +50 -37
- package/hotreload/uploader.mjs +38 -27
- package/hotreload/watch-tree.mjs +19 -19
- package/pack-container.mjs +28 -20
- package/package.json +7 -8
- package/persist-transform.mjs +34 -28
- package/qjsc-wasm.mjs +25 -14
- package/sim/embedded-react.cjs +1 -1
- package/sim/embedded-react.js +1 -1
- package/sim/embedded-react.wasm +0 -0
- package/sim/index.html +94 -85
- package/sim-server.mjs +101 -82
- package/src/embedded-react/Animated.js +24 -24
- package/src/embedded-react/Easing.js +1 -1
- package/src/embedded-react/FlatList.js +3 -3
- package/src/embedded-react/LayoutAnimation.js +8 -5
- package/src/embedded-react/PanResponder.js +75 -71
- package/src/embedded-react/Pressable.js +2 -8
- package/src/embedded-react/SectionList.js +6 -6
- package/src/embedded-react/StyleSheet.js +4 -3
- package/src/embedded-react/TouchableOpacity.js +13 -8
- package/src/embedded-react/index.d.ts +5 -5
- package/src/embedded-react/layout-anim-config.js +10 -4
- package/src/embedded-react/list-child.js +5 -5
- package/src/embedded-react/named-colors.js +1 -1
- package/src/embedded-react/split-style.js +11 -11
- package/src/embedded-react/svg-ops.js +760 -593
- package/src/embedded-react/useHostValue.js +3 -3
- package/src/embedded-react/usePersistentState.js +6 -6
- package/src/embedded-react/warn-props.js +1 -1
- package/src/host-config.js +60 -53
- package/src/props.js +49 -41
- package/src/renderer.js +7 -4
- package/aot/compiler/assemble.mjs +0 -944
- package/aot/compiler/c/animations.mjs +0 -436
- package/aot/compiler/c/boot.mjs +0 -127
- package/aot/compiler/c/expressions.mjs +0 -270
- package/aot/compiler/c/functions.mjs +0 -268
- package/aot/compiler/c/keyboard.mjs +0 -96
- package/aot/compiler/c/nodes.mjs +0 -303
- package/aot/compiler/c/pan-responder.mjs +0 -136
- package/aot/compiler/c/statements.mjs +0 -319
- package/aot/compiler/c/text.mjs +0 -83
- package/aot/compiler/c/vectors.mjs +0 -381
- package/aot/compiler/c-syntax.mjs +0 -127
package/build.mjs
CHANGED
|
@@ -50,8 +50,8 @@ const entry = resolve(demoDir, 'index.jsx');
|
|
|
50
50
|
if (!existsSync(entry)) {
|
|
51
51
|
const available = existsSync(demosDir)
|
|
52
52
|
? readdirSync(demosDir, {withFileTypes: true})
|
|
53
|
-
.filter(
|
|
54
|
-
.map(
|
|
53
|
+
.filter(entry => entry.isDirectory())
|
|
54
|
+
.map(entry => entry.name)
|
|
55
55
|
: [];
|
|
56
56
|
console.error(`Demo "${demo}" not found (expected ${entry}).`);
|
|
57
57
|
console.error(`Available demos: ${available.join(', ') || '(none)'}`);
|
|
@@ -66,8 +66,8 @@ const images = new Map(); // name -> path
|
|
|
66
66
|
const fonts = new Map(); // family -> path
|
|
67
67
|
const assetPlugin = {
|
|
68
68
|
name: 'embedded-react-assets',
|
|
69
|
-
setup(
|
|
70
|
-
|
|
69
|
+
setup(pluginBuild) {
|
|
70
|
+
pluginBuild.onLoad({filter: /\.(png|jpe?g|webp|gif|bmp)$/i}, args => {
|
|
71
71
|
const name = basename(args.path).replace(/\.[^.]+$/, '');
|
|
72
72
|
images.set(name, args.path);
|
|
73
73
|
return {
|
|
@@ -75,7 +75,7 @@ const assetPlugin = {
|
|
|
75
75
|
loader: 'js',
|
|
76
76
|
};
|
|
77
77
|
});
|
|
78
|
-
|
|
78
|
+
pluginBuild.onLoad({filter: /\.(ttf|otf)$/i}, args => {
|
|
79
79
|
const family = basename(args.path).replace(/\.[^.]+$/, '');
|
|
80
80
|
fonts.set(family, args.path);
|
|
81
81
|
return {
|
|
@@ -83,7 +83,9 @@ const assetPlugin = {
|
|
|
83
83
|
loader: 'js',
|
|
84
84
|
};
|
|
85
85
|
});
|
|
86
|
-
registerSvgVectorLoader(
|
|
86
|
+
registerSvgVectorLoader(pluginBuild, (name, svgPath) =>
|
|
87
|
+
images.set(name, svgPath),
|
|
88
|
+
);
|
|
87
89
|
},
|
|
88
90
|
};
|
|
89
91
|
|
|
@@ -124,8 +126,8 @@ console.log(`Bundled demo "${demo}" -> dist/app.bundle.js`);
|
|
|
124
126
|
// Fonts are pre-rasterized at fixed sizes (the engine has no runtime rasterizer), so bake exactly the
|
|
125
127
|
// fontSize values the bundle uses — constants and token scales folded, not just literals. A size that
|
|
126
128
|
// only exists at runtime can't be discovered; the bake reports those rather than snapping silently.
|
|
127
|
-
const
|
|
128
|
-
const usedSizes = analyzeFontSizes(
|
|
129
|
+
const bundleSource = readFileSync(bundlePath, 'utf8');
|
|
130
|
+
const usedSizes = analyzeFontSizes(bundleSource);
|
|
129
131
|
|
|
130
132
|
// Optional per-demo overrides: demos/<demo>/assets.config.js
|
|
131
133
|
// export default { fonts: { 'Family': { sizes: [..], bpp: 4, glyphs: 'ascii'|'common'|[cps],
|
|
@@ -149,15 +151,15 @@ const summary = bakeAssets({
|
|
|
149
151
|
images: imageJobs,
|
|
150
152
|
fonts: fontJobs,
|
|
151
153
|
outDir: distDir,
|
|
152
|
-
source:
|
|
154
|
+
source: bundleSource,
|
|
153
155
|
usedSizes,
|
|
154
156
|
});
|
|
155
|
-
const
|
|
157
|
+
const fontDescription = fontJobs.length
|
|
156
158
|
? fontJobs
|
|
157
|
-
.map(
|
|
159
|
+
.map(font => `${font.family}@[${font.sizes.join(',')}]x${font.bpp}bpp`)
|
|
158
160
|
.join(', ')
|
|
159
161
|
: 'none';
|
|
160
162
|
console.log(
|
|
161
163
|
`Baked ${summary.images} image(s), ${summary.fonts} font size(s) -> dist/assets.generated.c\n` +
|
|
162
|
-
` fonts: ${
|
|
164
|
+
` fonts: ${fontDescription}`,
|
|
163
165
|
);
|