@lingxia/html 0.18.0 → 0.19.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/global.d.ts +2 -0
- package/dist/global.es2020.js +555 -56
- package/dist/global.es5.js +630 -64
- package/dist/global.js +5 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/page.d.ts +19 -0
- package/dist/page.js +20 -0
- package/package.json +4 -4
package/dist/global.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Entry of the `<script>` build (`@lingxia/html/global`): the same page API as
|
|
2
|
+
// the module. The host already booted the bridge, so the build aliases
|
|
3
|
+
// `@lingxia/bridge` to its side-effect-free parts.
|
|
4
|
+
export { pageReady, getPage, subscribePage } from "./page.js";
|
|
5
|
+
export { getHost, subscribeHost } from "@lingxia/bridge";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export
|
|
3
|
-
export {
|
|
1
|
+
export { pageReady, getPage, subscribePage } from "./page.js";
|
|
2
|
+
export { getHost, subscribeHost, type LxHost } from "@lingxia/bridge";
|
|
3
|
+
export type { ActionMap, DeepReadonly, Snapshot } from "@lingxia/page-runtime";
|
|
4
4
|
export { registerInlineNativeComponents, registerInlineNativeAuthorComponents, compileInlineNativeRoot, compileInlineNativeForest, unwrapNativeEventPayload, } from "@lingxia/elements";
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { pageReady, getPage, subscribePage } from "./page.js";
|
|
2
|
+
export { getHost, subscribeHost } from "@lingxia/bridge";
|
|
3
3
|
export { registerInlineNativeComponents, registerInlineNativeAuthorComponents, compileInlineNativeRoot, compileInlineNativeForest, unwrapNativeEventPayload, } from "@lingxia/elements";
|
package/dist/page.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ActionMap, type PageActions, type DeepReadonly, type Snapshot } from "@lingxia/page-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Resolves once the first state arrives. By default a delayed startup shows
|
|
4
|
+
* a fault panel and keeps waiting, just like React/Vue. An explicit timeout
|
|
5
|
+
* rejects instead; `null` waits without the panel. Await before `getPage()`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function pageReady(options?: {
|
|
8
|
+
timeoutMs?: number | null;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* This page's Logic state and actions — `this.data` and the page's methods.
|
|
12
|
+
* `data` is readonly: Logic owns it (in a dev session a write throws).
|
|
13
|
+
*/
|
|
14
|
+
export declare function getPage<TData = Snapshot, TActions extends ActionMap = ActionMap>(): {
|
|
15
|
+
data: DeepReadonly<TData>;
|
|
16
|
+
actions: PageActions<TActions>;
|
|
17
|
+
};
|
|
18
|
+
/** Follow the page's state. Change-only; read it with `getPage()`. Returns an unsubscribe. */
|
|
19
|
+
export declare function subscribePage(listener: () => void): () => void;
|
package/dist/page.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getPageActions, getPageSnapshot, subscribePageSnapshot, whenPageReady, waitForPageState, } from "@lingxia/page-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Resolves once the first state arrives. By default a delayed startup shows
|
|
4
|
+
* a fault panel and keeps waiting, just like React/Vue. An explicit timeout
|
|
5
|
+
* rejects instead; `null` waits without the panel. Await before `getPage()`.
|
|
6
|
+
*/
|
|
7
|
+
export function pageReady(options) {
|
|
8
|
+
return options?.timeoutMs === undefined ? waitForPageState() : whenPageReady(options);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* This page's Logic state and actions — `this.data` and the page's methods.
|
|
12
|
+
* `data` is readonly: Logic owns it (in a dev session a write throws).
|
|
13
|
+
*/
|
|
14
|
+
export function getPage() {
|
|
15
|
+
return { data: getPageSnapshot(), actions: getPageActions() };
|
|
16
|
+
}
|
|
17
|
+
/** Follow the page's state. Change-only; read it with `getPage()`. Returns an unsubscribe. */
|
|
18
|
+
export function subscribePage(listener) {
|
|
19
|
+
return subscribePageSnapshot(listener);
|
|
20
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingxia/html",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "LingXia HTML runtime for lxapp pages",
|
|
6
6
|
"type": "module",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"prepublishOnly": "npm run build"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@lingxia/bridge": "~0.
|
|
25
|
-
"@lingxia/elements": "~0.
|
|
26
|
-
"@lingxia/page-runtime": "~0.
|
|
24
|
+
"@lingxia/bridge": "~0.19.0",
|
|
25
|
+
"@lingxia/elements": "~0.19.0",
|
|
26
|
+
"@lingxia/page-runtime": "~0.19.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@lingxia/bridge": "file:../lingxia-bridge",
|