@jqhtml/core 2.3.13 → 2.3.50
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/LICENSE +1 -1
- package/dist/component-cache.d.ts +56 -0
- package/dist/component-cache.d.ts.map +1 -0
- package/dist/component-events.d.ts +68 -0
- package/dist/component-events.d.ts.map +1 -0
- package/dist/component-queue.d.ts +47 -0
- package/dist/component-queue.d.ts.map +1 -0
- package/dist/component.d.ts +162 -44
- package/dist/component.d.ts.map +1 -1
- package/dist/data-proxy.d.ts +37 -0
- package/dist/data-proxy.d.ts.map +1 -0
- package/dist/index.cjs +4308 -3237
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4303 -3238
- package/dist/index.js.map +1 -1
- package/dist/instruction-processor.d.ts.map +1 -1
- package/dist/jqhtml-core.esm.js +4304 -3239
- package/dist/jqhtml-core.esm.js.map +1 -1
- package/dist/jquery-plugin.d.ts.map +1 -1
- package/dist/lifecycle-manager.d.ts +13 -4
- package/dist/lifecycle-manager.d.ts.map +1 -1
- package/dist/load-coordinator.d.ts +16 -3
- package/dist/load-coordinator.d.ts.map +1 -1
- package/dist/local-storage.d.ts.map +1 -1
- package/dist/preload-data.d.ts +69 -0
- package/dist/preload-data.d.ts.map +1 -0
- package/dist/template-renderer.d.ts +5 -0
- package/dist/template-renderer.d.ts.map +1 -1
- package/package.json +10 -2
|
@@ -5,10 +5,15 @@
|
|
|
5
5
|
* Components boot when created. That's it.
|
|
6
6
|
*
|
|
7
7
|
* Lifecycle order:
|
|
8
|
-
* 1. create() - Calls on_create() BEFORE first render
|
|
9
|
-
* 2. render() - Creates DOM, instantiates child components, calls on_render()
|
|
10
|
-
* 3. _load() - Calls on_load(), may trigger re-render if this.data changes
|
|
11
|
-
* 4. ready() - Waits for children to be ready, calls on_ready()
|
|
8
|
+
* 1. create() - SYNC - Calls on_create() BEFORE first render
|
|
9
|
+
* 2. render() - SYNC - Creates DOM, instantiates child components, calls on_render()
|
|
10
|
+
* 3. _load() - ASYNC - Calls on_load() if overridden, may trigger re-render if this.data changes
|
|
11
|
+
* 4. ready() - ASYNC - Waits for children to be ready, calls on_ready()
|
|
12
|
+
*
|
|
13
|
+
* Key insight: create/render/on_render are synchronous. If a component doesn't
|
|
14
|
+
* override on_load(), the entire create→render→on_render chain completes without
|
|
15
|
+
* yielding to the event loop. This means parent components can access child
|
|
16
|
+
* components in their on_render() as long as the children don't have async on_load().
|
|
12
17
|
*/
|
|
13
18
|
import type { Jqhtml_Component } from './component.js';
|
|
14
19
|
export type LifecyclePhase = 'render' | 'create' | 'load' | 'ready';
|
|
@@ -20,6 +25,10 @@ export declare class LifecycleManager {
|
|
|
20
25
|
/**
|
|
21
26
|
* Boot a component - run its full lifecycle
|
|
22
27
|
* Called when component is created
|
|
28
|
+
*
|
|
29
|
+
* Supports lifecycle truncation flags:
|
|
30
|
+
* - _load_only: on_create + on_load only. No render, no children, no on_render, no on_loaded, no on_ready.
|
|
31
|
+
* - _load_render_only: on_create + render + on_load + re-render. No on_render, no on_loaded, no on_ready.
|
|
23
32
|
*/
|
|
24
33
|
boot_component(component: Jqhtml_Component): Promise<void>;
|
|
25
34
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle-manager.d.ts","sourceRoot":"","sources":["../src/lifecycle-manager.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lifecycle-manager.d.ts","sourceRoot":"","sources":["../src/lifecycle-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAEpE,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAmB;IAC1C,OAAO,CAAC,iBAAiB,CAAoC;IAE7D,MAAM,CAAC,YAAY,IAAI,gBAAgB;;IAevC;;;;;;;OAOG;IACG,cAAc,CAAC,SAAS,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IA2JhE;;OAEG;IACH,oBAAoB,CAAC,SAAS,EAAE,gBAAgB,GAAG,IAAI;IAIvD;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CAetC"}
|
|
@@ -48,9 +48,11 @@ export declare class Load_Coordinator {
|
|
|
48
48
|
static should_execute_on_load(component: Jqhtml_Component): boolean;
|
|
49
49
|
/**
|
|
50
50
|
* Register a leader component that will execute on_load()
|
|
51
|
-
* Creates coordination entry and returns a function to call when
|
|
51
|
+
* Creates coordination entry and returns a function to call when data is ready
|
|
52
|
+
*
|
|
53
|
+
* @returns A function that accepts the final data and completes coordination
|
|
52
54
|
*/
|
|
53
|
-
static register_leader(component: Jqhtml_Component, on_load_promise: Promise<void>): () => void;
|
|
55
|
+
static register_leader(component: Jqhtml_Component, on_load_promise: Promise<void>): (final_data: Record<string, any>) => void;
|
|
54
56
|
/**
|
|
55
57
|
* Get the coordination promise for a follower component
|
|
56
58
|
* Returns a promise that resolves when the leader completes
|
|
@@ -58,10 +60,21 @@ export declare class Load_Coordinator {
|
|
|
58
60
|
static get_coordination_promise(component: Jqhtml_Component): Promise<void> | null;
|
|
59
61
|
/**
|
|
60
62
|
* Complete coordination after leader's on_load() finishes
|
|
61
|
-
*
|
|
63
|
+
* Stores leader's data, marks entry as completed, and resolves the promise.
|
|
64
|
+
* Followers retrieve the data themselves via get_leader_data().
|
|
65
|
+
*
|
|
66
|
+
* @param key - The coordination key
|
|
67
|
+
* @param leader - The leader component
|
|
68
|
+
* @param final_data - The final data after on_load and normalization
|
|
62
69
|
* @private
|
|
63
70
|
*/
|
|
64
71
|
private static _complete_coordination;
|
|
72
|
+
/**
|
|
73
|
+
* Get leader's data for a follower component
|
|
74
|
+
* Called by follower after coordination promise resolves
|
|
75
|
+
* Returns the data and cleans up if this is the last follower
|
|
76
|
+
*/
|
|
77
|
+
static get_leader_data(component: Jqhtml_Component): Record<string, any> | null;
|
|
65
78
|
/**
|
|
66
79
|
* Handle leader on_load() error
|
|
67
80
|
* Propagates error to all followers and cleans up entry
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-coordinator.d.ts","sourceRoot":"","sources":["../src/load-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"load-coordinator.d.ts","sourceRoot":"","sources":["../src/load-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAYvD,MAAM,WAAW,mBAAmB;IAChC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,qBAAa,gBAAgB;IACzB,OAAO,CAAC,MAAM,CAAC,SAAS,CAA6C;IAErE;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,uBAAuB,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,mBAAmB;IA2EtF;;;OAGG;IACH,MAAM,CAAC,sBAAsB,CAAC,SAAS,EAAE,gBAAgB,GAAG,OAAO;IAoBnE;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAClB,SAAS,EAAE,gBAAgB,EAC3B,eAAe,EAAE,OAAO,CAAC,IAAI,CAAC,GAC/B,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI;IAyB5C;;;OAGG;IACH,MAAM,CAAC,wBAAwB,CAAC,SAAS,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAWlF;;;;;;;;;OASG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAgCrC;;;;OAIG;IACH,MAAM,CAAC,eAAe,CAAC,SAAS,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAyC/E;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAuC3E;;OAEG;IACH,MAAM,CAAC,kBAAkB,IAAI,GAAG;IAahC;;OAEG;IACH,MAAM,CAAC,SAAS,IAAI,IAAI;CAG3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-storage.d.ts","sourceRoot":"","sources":["../src/local-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAaH;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAAG,IAAI,CAK7E;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAErE;
|
|
1
|
+
{"version":3,"file":"local-storage.d.ts","sourceRoot":"","sources":["../src/local-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAaH;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAAG,IAAI,CAK7E;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAErE;AAoTD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,G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CAAC,MAAM,CAAC,YAAY;CAS9B"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JQHTML SSR Preload Data System
|
|
3
|
+
*
|
|
4
|
+
* Captures component data during SSR rendering and replays it on the client
|
|
5
|
+
* to skip redundant on_load() calls during hydration.
|
|
6
|
+
*
|
|
7
|
+
* Server-side: start_data_capture() → render → get_captured_data()
|
|
8
|
+
* Client-side: set_preload_data(entries) → components boot with preloaded data → clear_preload_data()
|
|
9
|
+
*/
|
|
10
|
+
export interface PreloadEntry {
|
|
11
|
+
component: string;
|
|
12
|
+
args: Record<string, any>;
|
|
13
|
+
data: Record<string, any>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Enable data capture mode. After this call, every component that completes
|
|
17
|
+
* on_load() has its final this.data recorded.
|
|
18
|
+
*
|
|
19
|
+
* Idempotent — calling twice is fine.
|
|
20
|
+
*/
|
|
21
|
+
export declare function start_data_capture(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Record a component's data after on_load() completes.
|
|
24
|
+
* Called internally from _apply_load_result().
|
|
25
|
+
*
|
|
26
|
+
* @param component_name - Component name
|
|
27
|
+
* @param args - Component args at time of on_load()
|
|
28
|
+
* @param data - this.data after on_load() completed
|
|
29
|
+
* @param cache_key - The cache key for deduplication (null = always capture)
|
|
30
|
+
*/
|
|
31
|
+
export declare function capture_component_data(component_name: string, args: Record<string, any>, data: Record<string, any>, cache_key: string | null): void;
|
|
32
|
+
/**
|
|
33
|
+
* Returns all captured component data and resets the capture buffer.
|
|
34
|
+
* One-shot: calling clears the buffer.
|
|
35
|
+
*/
|
|
36
|
+
export declare function get_captured_data(): PreloadEntry[];
|
|
37
|
+
/**
|
|
38
|
+
* Check if data capture is currently enabled.
|
|
39
|
+
*/
|
|
40
|
+
export declare function is_capture_enabled(): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Stop data capture and clear all state.
|
|
43
|
+
*/
|
|
44
|
+
export declare function stop_data_capture(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Seed the preload cache with SSR-captured data.
|
|
47
|
+
* Must be called before any component _load() runs.
|
|
48
|
+
*
|
|
49
|
+
* @param entries - Array of { component, args, data } entries from get_captured_data()
|
|
50
|
+
*/
|
|
51
|
+
export declare function set_preload_data(entries: PreloadEntry[] | null): void;
|
|
52
|
+
/**
|
|
53
|
+
* Check if preloaded data exists for a given cache key.
|
|
54
|
+
* If found, returns the data and removes the entry (one-shot).
|
|
55
|
+
*
|
|
56
|
+
* @param cache_key - The cache key (same format as Load Coordinator)
|
|
57
|
+
* @returns The preloaded data, or null if no match
|
|
58
|
+
*/
|
|
59
|
+
export declare function consume_preload_data(cache_key: string): Record<string, any> | null;
|
|
60
|
+
/**
|
|
61
|
+
* Clear any remaining unconsumed preload entries.
|
|
62
|
+
* Call after initial page hydration is complete.
|
|
63
|
+
*/
|
|
64
|
+
export declare function clear_preload_data(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Check if any preload data is available (for fast early exit in _load).
|
|
67
|
+
*/
|
|
68
|
+
export declare function has_preload_data(): boolean;
|
|
69
|
+
//# sourceMappingURL=preload-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preload-data.d.ts","sourceRoot":"","sources":["../src/preload-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC3B;AASD;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAIzC;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,SAAS,EAAE,MAAM,GAAG,IAAI,GACvB,IAAI,CA4BN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,YAAY,EAAE,CAKlD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAIxC;AAMD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,IAAI,GAAG,IAAI,CAYrE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CASlF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C"}
|
|
@@ -14,4 +14,9 @@ export declare function render_template(component: Jqhtml_Component, template_fn
|
|
|
14
14
|
* Helper to escape HTML for safe output
|
|
15
15
|
*/
|
|
16
16
|
export declare function escape_html(str: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Helper to escape HTML and convert newlines to <br /> tags
|
|
19
|
+
* Used by <%br= %> syntax for displaying user-entered text with line breaks
|
|
20
|
+
*/
|
|
21
|
+
export declare function escape_html_nl2br(str: string): string;
|
|
17
22
|
//# sourceMappingURL=template-renderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-renderer.d.ts","sourceRoot":"","sources":["../src/template-renderer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AA2EvD;;;GAGG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,gBAAgB,EAC3B,WAAW,CAAC,EAAE,QAAQ,GACrB,OAAO,CAAC,IAAI,CAAC,CAqDf;AA6KD;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI/C"}
|
|
1
|
+
{"version":3,"file":"template-renderer.d.ts","sourceRoot":"","sources":["../src/template-renderer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AA2EvD;;;GAGG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,gBAAgB,EAC3B,WAAW,CAAC,EAAE,QAAQ,GACrB,OAAO,CAAC,IAAI,CAAC,CAqDf;AA6KD;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI/C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKrD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jqhtml/core",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.50",
|
|
4
4
|
"description": "Core runtime library for JQHTML",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -65,5 +65,13 @@
|
|
|
65
65
|
"tslib": "^2.8.1",
|
|
66
66
|
"typescript": "^5.9.2"
|
|
67
67
|
},
|
|
68
|
-
"devDependencies": null
|
|
68
|
+
"devDependencies": null,
|
|
69
|
+
"repository": {
|
|
70
|
+
"type": "git",
|
|
71
|
+
"url": "git+https://github.com/jqhtml/jqhtml.git"
|
|
72
|
+
},
|
|
73
|
+
"bugs": {
|
|
74
|
+
"url": "https://github.com/jqhtml/jqhtml/issues"
|
|
75
|
+
},
|
|
76
|
+
"homepage": "https://github.com/jqhtml/jqhtml#readme"
|
|
69
77
|
}
|