lecodes-sdk 2.0.9 → 2.0.11
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/global.d.ts +1 -0
- package/dist/host.d.ts +6 -2
- package/dist/types/gl/Light.d.ts +0 -11
- package/dist/types/runtime/misc.d.ts +4 -0
- package/dist/types/ui/UITabs.d.ts +16 -3
- package/dist/types/version.d.ts +1 -1
- package/dist/types.json +1 -1
- package/package.json +1 -1
- package/prompts/core.md +1 -1
- package/prompts/ui.md +5 -7
- package/src/compile/assetMacro.ts +69 -4
- package/src/compile/bundler.ts +10 -3
- package/src/gl/Light.ts +257 -270
- package/src/host.d.ts +6 -2
- package/src/runtime/misc.ts +4 -0
- package/src/ui/UIPager.ts +2 -0
- package/src/ui/UITabs.ts +43 -5
- package/src/version.ts +1 -1
package/dist/global.d.ts
CHANGED
|
@@ -483,6 +483,7 @@ declare global {
|
|
|
483
483
|
type StopOptions = SDK.StopOptions
|
|
484
484
|
type StoredFile = SDK.StoredFile
|
|
485
485
|
type StoredImage = SDK.StoredImage
|
|
486
|
+
type SvgSource = SDK.SvgSource
|
|
486
487
|
type System<K extends string, S extends SystemHost = Scene, E extends EventMap = {}> = SDK.System<K, S, E>
|
|
487
488
|
type SystemHost = SDK.SystemHost
|
|
488
489
|
type TabDef = SDK.TabDef
|
package/dist/host.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// JS-runtime globals provided by the host engine (web viewer / desktop / iOS), NOT by the SDK.
|
|
2
2
|
// Declared only so SDK and user code type-check — never bundled or injected.
|
|
3
3
|
|
|
4
|
+
// The one SDK type the macros return: an SVG image source, the same `SvgSource` a project has as
|
|
5
|
+
// a global (build-types.ts points this import into dist/types when it copies the file).
|
|
6
|
+
import type { SvgSource } from "./types/runtime/misc"
|
|
7
|
+
|
|
4
8
|
declare global {
|
|
5
9
|
function setTimeout(handler: (...args: any[]) => void, timeout?: number): number
|
|
6
10
|
function setInterval(handler: (...args: any[]) => void, timeout?: number): number
|
|
@@ -33,7 +37,7 @@ declare global {
|
|
|
33
37
|
function asset(path: `${string}.json`): any
|
|
34
38
|
/** Compile-time macro: `asset('./logo.svg')` yields the file as an SVG image source — for
|
|
35
39
|
* `UIImage(...)` and `bgImage`. */
|
|
36
|
-
function asset(path: `${string}.svg`):
|
|
40
|
+
function asset(path: `${string}.svg`): SvgSource
|
|
37
41
|
/** Compile-time macro: `asset('./hero.png')` is desugared by the bundler into the module import
|
|
38
42
|
* for that resource. The file must exist — a path that resolves to nothing fails the compile
|
|
39
43
|
* (`asset not found: ./hero.png (main.ts:3)`); there is no runtime fallback. Calls inside
|
|
@@ -53,7 +57,7 @@ declare global {
|
|
|
53
57
|
* (e.g. `"lucide:bell"`), string literal only. Recolor via `{ color }`: a hex LITERAL is baked
|
|
54
58
|
* into the SVG at compile time, a token/expression is applied as a tint (as is the `tintColor`
|
|
55
59
|
* style prop). */
|
|
56
|
-
function assetIcon(id: string, opts?: { color?: string }):
|
|
60
|
+
function assetIcon(id: string, opts?: { color?: string }): SvgSource
|
|
57
61
|
|
|
58
62
|
/** Type-only editor convenience: the style object type of a UI element. `Style<UIButton>` (or
|
|
59
63
|
* `Style<typeof myButton>`) is what you'd pass to `el.style(...)` — for typing reusable style
|
package/dist/types/gl/Light.d.ts
CHANGED
|
@@ -103,26 +103,15 @@ export declare class Light extends Node {
|
|
|
103
103
|
static sun(options?: SunOptions): Light;
|
|
104
104
|
/**
|
|
105
105
|
* A point light — a lamp, a muzzle flash, a fireball. Position it like any node.
|
|
106
|
-
*
|
|
107
|
-
* Feature-detected: hosts that predate it create the node and light nothing, which keeps a scene
|
|
108
|
-
* that adds atmosphere on top of its sun renderable everywhere. Check `Light.supportsPoint`
|
|
109
|
-
* before making one carry the scene.
|
|
110
106
|
*/
|
|
111
107
|
static point(options?: PointOptions): Light;
|
|
112
|
-
/** Whether this host can create point lights at all. */
|
|
113
|
-
static get supportsPoint(): boolean;
|
|
114
108
|
_innerAngle: number;
|
|
115
109
|
/**
|
|
116
110
|
* A spot light — a flashlight, a headlight, a stage light. It shines along the node's forward (-Z): position
|
|
117
111
|
* it like any node and aim it with `lookAt`. Real time only: the lightmap bake takes no spot lights, so a spot
|
|
118
112
|
* lights the baked statics live too.
|
|
119
|
-
*
|
|
120
|
-
* Feature-detected like `Light.point`: on a host without it the node exists and lights nothing
|
|
121
|
-
* (`Light.supportsSpot`).
|
|
122
113
|
*/
|
|
123
114
|
static spot(options?: SpotOptions): Light;
|
|
124
|
-
/** Whether this host can create spot lights. */
|
|
125
|
-
static get supportsSpot(): boolean;
|
|
126
115
|
/** A spot's full cone angle in degrees — live (a flashlight's focus). */
|
|
127
116
|
get angle(): number;
|
|
128
117
|
set angle(value: number);
|
|
@@ -12,3 +12,7 @@ export type SvgSourceValue = {
|
|
|
12
12
|
};
|
|
13
13
|
/** Wrap raw SVG XML so it can be used as an image source. */
|
|
14
14
|
export declare const SvgSource: (svg: string) => SvgSourceValue;
|
|
15
|
+
/** The type of the value: what `SvgSource(xml)`, `assetIcon("lucide:bell")` and `asset("./logo.svg")`
|
|
16
|
+
* all return, and what `UIImage` / `bgImage` take — ONE name for an SVG image source, global to a
|
|
17
|
+
* project like the function (host.d.ts names it for the macros). */
|
|
18
|
+
export type SvgSource = SvgSourceValue;
|
|
@@ -61,9 +61,22 @@ export declare class TabsElement extends ScreenElement {
|
|
|
61
61
|
onSelect(callback: (id: string, index: number) => void): this;
|
|
62
62
|
badge(id: string, value: number | string | boolean | null | undefined): this;
|
|
63
63
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
export interface UITabsConstructor {
|
|
65
|
+
/** Create the standard bottom-tab shell — see {@link UITabs}. Keys are tab ids in tab order;
|
|
66
|
+
* each tab needs a `label` and its root `screen` (plus an optional `icon`). */
|
|
67
|
+
(tabs: Record<string, UITabDef>): UITabs;
|
|
68
|
+
/** The tabs whose page is currently visible, or `null` when the visible screen is not a tab
|
|
69
|
+
* of any — the twin of `UIPager.current`, so a screen switches tabs with no reference
|
|
70
|
+
* threading: `UITabs.current?.select("services")`. With tabs nested inside a tab's page,
|
|
71
|
+
* resolves to the innermost. */
|
|
72
|
+
readonly current: UITabs | null;
|
|
73
|
+
/** `UITabs.current.select(id)` — switch the visible tabs to `id`; a console warning and no-op
|
|
74
|
+
* when no tabs are on screen. */
|
|
75
|
+
select(id: string, animated?: boolean): void;
|
|
76
|
+
}
|
|
77
|
+
/** Create the standard bottom-tab shell — see {@link UITabs}; `UITabs.current` / `UITabs.select(id)`
|
|
78
|
+
* reach the visible tabs from anywhere. */
|
|
79
|
+
export declare const UITabs: UITabsConstructor;
|
|
67
80
|
/** A `defineTabs` tab: `label` + optional `icon` (an `assetIcon("lucide:…")` call — never a
|
|
68
81
|
* hand-written source object). `UITabDef` is this plus the tab's root `screen`. */
|
|
69
82
|
export type TabDef = Omit<UITabDef, "screen">;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.11";
|
|
2
2
|
/** The major of a semver string, or null when it is not one. */
|
|
3
3
|
export declare const sdkMajor: (version: string | null | undefined) => number | null;
|
|
4
4
|
/** The `// sdk: <version>` line of a compiled bundle's header (sdk/src/compile/header.ts), read from
|