lecodes-cli 0.7.1 → 0.7.2
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 +3 -3
- package/dist/index.js +255 -243
- package/package.json +3 -3
- package/runtime/sdk/compile/bundler.ts +4 -2
- package/runtime/sdk/compile/compileProject.ts +6 -1
- package/runtime/sdk/inject.ts +1 -1
- package/runtime/sdk/ui/UINode.ts +13 -5
- package/runtime/sdk-types.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lecodes-cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Clone, edit and push LeCodes projects from your machine.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"@letary/chisel": "^0.4.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"lecodes-design": "^0.3.
|
|
37
|
-
"lecodes-renderer": "^0.6.
|
|
36
|
+
"lecodes-design": "^0.3.2",
|
|
37
|
+
"lecodes-renderer": "^0.6.2",
|
|
38
38
|
"lecodes-3d-editor": "^0.1.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependenciesMeta": {
|
|
@@ -194,7 +194,8 @@ export const bundleProject = async (
|
|
|
194
194
|
): Promise<string> => (await bundleProjectChisel(entrypoint, files, format, false)).code
|
|
195
195
|
|
|
196
196
|
/** Like `bundleProject`, but also returns chisel's source map. The map's `sources` are the original
|
|
197
|
-
* module paths and its generated positions are relative to `code` (line 1 = first line of `code`).
|
|
197
|
+
* module paths and its generated positions are relative to `code` (line 1 = first line of `code`).
|
|
198
|
+
* Pass `sourcemap: false` to skip map generation entirely — `map` then comes back null. */
|
|
198
199
|
export const bundleProjectWithMap = async (
|
|
199
200
|
entrypoint: string,
|
|
200
201
|
files: MemoryFiles,
|
|
@@ -202,4 +203,5 @@ export const bundleProjectWithMap = async (
|
|
|
202
203
|
minify?: boolean,
|
|
203
204
|
editor?: boolean,
|
|
204
205
|
libraries?: Record<string, MemoryFiles>,
|
|
205
|
-
|
|
206
|
+
sourcemap = true,
|
|
207
|
+
): Promise<{ code: string, map: string | null }> => bundleProjectChisel(entrypoint, files, format, sourcemap, minify, editor, libraries)
|
|
@@ -39,6 +39,9 @@ export type CompileOptions = {
|
|
|
39
39
|
/** Override minification (default: on, `LECODES_CHISEL_MINIFY` env aside). Scene-editor bundles
|
|
40
40
|
* compile with `false`: mangling erases class names, which the editor matches aspect schemas by. */
|
|
41
41
|
minify?: boolean
|
|
42
|
+
/** Generate a source map (default true) and inline it into the bundle. `false` skips the map
|
|
43
|
+
* entirely — a smaller bundle, but runtime errors report generated positions only. */
|
|
44
|
+
sourcemap?: boolean
|
|
42
45
|
/** Editor compile: the `EDITOR` global compiles to `true` (scene-editor bundles). Default false —
|
|
43
46
|
* shipped bundles get `EDITOR` = `false`, const-folded so `if (EDITOR)` branches are DCE'd. */
|
|
44
47
|
editor?: boolean
|
|
@@ -96,7 +99,9 @@ export const compileProject = async (opts: CompileOptions): Promise<string> => {
|
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
101
|
|
|
99
|
-
const { code, map } = await bundleProjectWithMap(
|
|
102
|
+
const { code, map } = await bundleProjectWithMap(
|
|
103
|
+
entry, files, opts.format ?? "esm", opts.minify, opts.editor, opts.libraries, opts.sourcemap ?? true,
|
|
104
|
+
)
|
|
100
105
|
if (opts.header === false) {
|
|
101
106
|
return map ? `${code}\n${inlineSourceMapComment(map)}` : code
|
|
102
107
|
}
|
package/runtime/sdk/inject.ts
CHANGED
|
@@ -29,7 +29,7 @@ export { toast, openURL, SvgSource } from "./runtime/misc"
|
|
|
29
29
|
export { app, type AppState } from "./runtime/app"
|
|
30
30
|
export { clipboard } from "./runtime/clipboard"
|
|
31
31
|
export { date, type DateValue, type DateInput, type Unit, type Locale } from "./runtime/datetime"
|
|
32
|
-
export { fetch, fetchLocal, FormData, File } from "./runtime/fetch"
|
|
32
|
+
export { fetch, fetchLocal, FormData, File, type FetchResponse } from "./runtime/fetch"
|
|
33
33
|
export { localStorage } from "./runtime/storage"
|
|
34
34
|
export { device, type HapticStyle, type MotionOptions } from "./runtime/device"
|
|
35
35
|
export { Input } from "./runtime/input"
|
package/runtime/sdk/ui/UINode.ts
CHANGED
|
@@ -245,10 +245,15 @@ export type Reactive<T> = { [K in keyof T]: NonNullable<T[K]> extends object ? T
|
|
|
245
245
|
|
|
246
246
|
// User-defined style classes: any `$`-prefixed key in .style() declares a state block (like
|
|
247
247
|
// onPressed, but with any name), toggled from code via setClass/toggleClass. `duration`/`delay`
|
|
248
|
-
// make the swap transition.
|
|
249
|
-
//
|
|
250
|
-
//
|
|
251
|
-
//
|
|
248
|
+
// make the swap transition. Class state INHERITS down the tree (CSS-`.dark`-on-body style): a
|
|
249
|
+
// class set on a node also activates same-name `$` blocks on all descendants within the same
|
|
250
|
+
// root — see docs/style-class-cascade-plan.md. `$pressed`/`$focused` are reserved: hosts toggle
|
|
251
|
+
// them on press/focus (they beat other classes, lose to onPressed/onFocused), so children can
|
|
252
|
+
// react to an ancestor's press. Instantiate with the node's own style `T` (see StyleFn below) — a
|
|
253
|
+
// class block accepts everything the node's `.style()` does (e.g. `color` on text, layout on any
|
|
254
|
+
// node), exactly like `onLandscape`/`onPortrait`. Narrowing it (it once was `DrawableStyle &
|
|
255
|
+
// BaseStyle`) wrongly rejected valid props such as `$active: { color }`. Guarded by
|
|
256
|
+
// tests/ui-types.test.ts.
|
|
252
257
|
export type ClassStyles<T> = { [key: `$${string}`]: T & { duration?: number, delay?: number } }
|
|
253
258
|
|
|
254
259
|
// NB: do NOT annotate `this: R` here. `this` is a parameter position, so it makes R contravariant,
|
|
@@ -341,7 +346,10 @@ export class Element<T extends string> {
|
|
|
341
346
|
* re-assign _id on every open). */
|
|
342
347
|
protected _classes?: Set<string>
|
|
343
348
|
|
|
344
|
-
/** Activate/deactivate a `$`-class declared in .style() (accepts the name with or without `$`).
|
|
349
|
+
/** Activate/deactivate a `$`-class declared in .style() (accepts the name with or without `$`).
|
|
350
|
+
* The class cascades: it is also active on every descendant (their same-name `$` blocks light
|
|
351
|
+
* up), until the subtree's root — hosted screens/widgets don't inherit. `hasClass`/`toggleClass`
|
|
352
|
+
* reflect only THIS node's own classes; there is no opt-out below an active ancestor. */
|
|
345
353
|
setClass(name: string, enabled: boolean): this {
|
|
346
354
|
if (name[0] === "$") name = name.slice(1)
|
|
347
355
|
if (enabled) {
|