@jqhtml/core 2.3.35 → 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 +100 -67
- 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 +1378 -697
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1374 -698
- package/dist/index.js.map +1 -1
- package/dist/instruction-processor.d.ts.map +1 -1
- package/dist/jqhtml-core.esm.js +1375 -699
- package/dist/jqhtml-core.esm.js.map +1 -1
- package/dist/jquery-plugin.d.ts.map +1 -1
- package/dist/lifecycle-manager.d.ts +3 -5
- package/dist/lifecycle-manager.d.ts.map +1 -1
- 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/package.json +10 -2
package/LICENSE
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JQHTML Component Cache Integration
|
|
3
|
+
*
|
|
4
|
+
* Extracted from component.ts - handles cache key generation,
|
|
5
|
+
* cache reads during create(), cache checks during reload(),
|
|
6
|
+
* and HTML cache snapshots during ready().
|
|
7
|
+
*
|
|
8
|
+
* Uses Jqhtml_Local_Storage as the underlying storage layer.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Result of generating a cache key for a component.
|
|
12
|
+
*/
|
|
13
|
+
interface Cache_Key_Result {
|
|
14
|
+
cache_key: string | null;
|
|
15
|
+
uncacheable_property?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Generate a cache key for a component using its name + args.
|
|
19
|
+
* Supports custom cache_id() override.
|
|
20
|
+
*
|
|
21
|
+
* @param component - The component instance
|
|
22
|
+
* @returns Cache key string or null if caching is disabled
|
|
23
|
+
*/
|
|
24
|
+
export declare function generate_cache_key(component: any): Cache_Key_Result;
|
|
25
|
+
/**
|
|
26
|
+
* Read cache during create() phase.
|
|
27
|
+
* Sets component._cache_key, _cached_html, _use_cached_data_hit as side effects.
|
|
28
|
+
*
|
|
29
|
+
* @param component - The component instance
|
|
30
|
+
*/
|
|
31
|
+
export declare function read_cache_in_create(component: any): void;
|
|
32
|
+
/**
|
|
33
|
+
* Check cache during reload() when args have changed.
|
|
34
|
+
* If cache hit, hydrates data/html and triggers an immediate render.
|
|
35
|
+
*
|
|
36
|
+
* @param component - The component instance
|
|
37
|
+
* @returns true if rendered from cache, false otherwise
|
|
38
|
+
*/
|
|
39
|
+
export declare function check_cache_on_reload(component: any): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Write HTML cache snapshot during ready() phase.
|
|
42
|
+
* Only caches if the component is dynamic (data changed during on_load).
|
|
43
|
+
*
|
|
44
|
+
* @param component - The component instance
|
|
45
|
+
*/
|
|
46
|
+
export declare function write_html_cache_snapshot(component: any): void;
|
|
47
|
+
/**
|
|
48
|
+
* Write data/HTML to cache after on_load() completes.
|
|
49
|
+
* Called from _apply_load_result().
|
|
50
|
+
*
|
|
51
|
+
* @param component - The component instance
|
|
52
|
+
* @param data_changed - Whether this.data changed during on_load
|
|
53
|
+
*/
|
|
54
|
+
export declare function write_cache_on_loaded(component: any, data_changed: boolean): void;
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=component-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-cache.d.ts","sourceRoot":"","sources":["../src/component-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH;;GAEG;AACH,UAAU,gBAAgB;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,GAAG,GAAG,gBAAgB,CAanE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,GAAG,GAAG,IAAI,CA+FzD;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAqD7D;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,GAAG,GAAG,IAAI,CA2B9D;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,GAAG,IAAI,CA4BjF"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JQHTML Component Event System
|
|
3
|
+
*
|
|
4
|
+
* Extracted from component.ts - handles lifecycle event registration,
|
|
5
|
+
* triggering, and state tracking.
|
|
6
|
+
*
|
|
7
|
+
* Events have "sticky" semantics for lifecycle events: if an event has already
|
|
8
|
+
* occurred, new .on() handlers fire immediately with the stored data.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Register a callback for an event.
|
|
12
|
+
*
|
|
13
|
+
* Lifecycle events (create, render, load, loaded, ready) are "sticky":
|
|
14
|
+
* If a lifecycle event has already occurred, the callback fires immediately
|
|
15
|
+
* AND registers for future occurrences.
|
|
16
|
+
*
|
|
17
|
+
* Custom events only fire when explicitly triggered via trigger().
|
|
18
|
+
*
|
|
19
|
+
* @param component - The component instance
|
|
20
|
+
* @param event_name - Name of the event
|
|
21
|
+
* @param callback - Callback: (component, data?) => void
|
|
22
|
+
*/
|
|
23
|
+
export declare function event_on(component: any, event_name: string, callback: (comp: any, data?: any) => void): any;
|
|
24
|
+
/**
|
|
25
|
+
* Register a callback that fires exactly once.
|
|
26
|
+
*
|
|
27
|
+
* - If the event already occurred (sticky), fires immediately and does NOT register.
|
|
28
|
+
* - If the event has not occurred, registers and auto-deregisters after first fire.
|
|
29
|
+
*
|
|
30
|
+
* @param component - The component instance
|
|
31
|
+
* @param event_name - Name of the event
|
|
32
|
+
* @param callback - Callback: (component, data?) => void
|
|
33
|
+
*/
|
|
34
|
+
export declare function event_once(component: any, event_name: string, callback: (comp: any, data?: any) => void): any;
|
|
35
|
+
/**
|
|
36
|
+
* Trigger an event - fires all registered callbacks.
|
|
37
|
+
* Marks event as occurred so future .on() calls fire immediately.
|
|
38
|
+
*
|
|
39
|
+
* @param component - The component instance
|
|
40
|
+
* @param event_name - Name of the event to trigger
|
|
41
|
+
* @param data - Optional data to pass to callbacks as second parameter
|
|
42
|
+
*/
|
|
43
|
+
export declare function event_trigger(component: any, event_name: string, data?: any): void;
|
|
44
|
+
/**
|
|
45
|
+
* Check if any callbacks are registered for a given event.
|
|
46
|
+
*
|
|
47
|
+
* @param component - The component instance
|
|
48
|
+
* @param event_name - Name of the event to check
|
|
49
|
+
*/
|
|
50
|
+
export declare function event_on_registered(component: any, event_name: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Invalidate a lifecycle event - removes the "already occurred" marker.
|
|
53
|
+
*
|
|
54
|
+
* After invalidate() is called:
|
|
55
|
+
* - New .on() handlers will NOT fire immediately
|
|
56
|
+
* - The ready() promise will NOT resolve immediately
|
|
57
|
+
* - Handlers wait for the next trigger() call
|
|
58
|
+
*
|
|
59
|
+
* Existing registered callbacks are NOT removed - they'll fire on next trigger().
|
|
60
|
+
*
|
|
61
|
+
* Use case: Call invalidate('ready') at the start of reload() or render()
|
|
62
|
+
* so that any new .on('ready') handlers wait for the reload/render to complete.
|
|
63
|
+
*
|
|
64
|
+
* @param component - The component instance
|
|
65
|
+
* @param event_name - Name of the event to invalidate
|
|
66
|
+
*/
|
|
67
|
+
export declare function event_invalidate(component: any, event_name: string): void;
|
|
68
|
+
//# sourceMappingURL=component-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-events.d.ts","sourceRoot":"","sources":["../src/component-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,GAAG,CAqB3G;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,GAAG,CA+B7G;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI,CAelF;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAG/E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAEzE"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JQHTML Component Lifecycle Queue
|
|
3
|
+
*
|
|
4
|
+
* Serializes lifecycle operations (render, reload, refresh) per component.
|
|
5
|
+
* Replaces _create_debounced_function with a proper queue that:
|
|
6
|
+
*
|
|
7
|
+
* - At most one operation runs at a time per component
|
|
8
|
+
* - At most one operation is pending (waiting for the current to finish)
|
|
9
|
+
* - Same-type pending operations collapse (fan-in: all callers share one execution)
|
|
10
|
+
* - Different-type pending operations: new replaces old (old callers get the new result)
|
|
11
|
+
*
|
|
12
|
+
* Boot bypasses this queue entirely - it runs the lifecycle directly.
|
|
13
|
+
*/
|
|
14
|
+
export declare class Component_Queue {
|
|
15
|
+
/** Currently executing operation */
|
|
16
|
+
private _current;
|
|
17
|
+
/** Next operation waiting to execute after current completes */
|
|
18
|
+
private _pending;
|
|
19
|
+
/**
|
|
20
|
+
* Enqueue a lifecycle operation.
|
|
21
|
+
*
|
|
22
|
+
* Behavior:
|
|
23
|
+
* - Nothing running → execute immediately
|
|
24
|
+
* - Something running, no pending → create pending entry
|
|
25
|
+
* - Something running, same type pending → collapse (share pending promise)
|
|
26
|
+
* - Something running, different type pending → replace pending (all callers get new result)
|
|
27
|
+
*
|
|
28
|
+
* @param type - Operation type ('render', 'reload', 'refresh', 'load')
|
|
29
|
+
* @param executor - The async function to execute
|
|
30
|
+
* @returns Promise that resolves when the operation completes
|
|
31
|
+
*/
|
|
32
|
+
enqueue(type: string, executor: () => Promise<void>): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Execute an operation and handle pending queue after completion.
|
|
35
|
+
* @private
|
|
36
|
+
*/
|
|
37
|
+
private _execute;
|
|
38
|
+
/**
|
|
39
|
+
* Check if any operation is currently running.
|
|
40
|
+
*/
|
|
41
|
+
get is_busy(): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Check if there's a pending operation waiting.
|
|
44
|
+
*/
|
|
45
|
+
get has_pending(): boolean;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=component-queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-queue.d.ts","sourceRoot":"","sources":["../src/component-queue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH,qBAAa,eAAe;IAC1B,oCAAoC;IACpC,OAAO,CAAC,QAAQ,CAAyD;IAEzE,gEAAgE;IAChE,OAAO,CAAC,QAAQ,CAA4B;IAE5C;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IA4CnE;;;OAGG;IACH,OAAO,CAAC,QAAQ;IA0BhB;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,OAAO,CAEzB;CACF"}
|
package/dist/component.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export declare class Jqhtml_Component {
|
|
|
40
40
|
private _data_on_last_render;
|
|
41
41
|
private __initial_data_snapshot;
|
|
42
42
|
private __data_frozen;
|
|
43
|
-
private
|
|
43
|
+
private _queue;
|
|
44
44
|
private next_reload_force_refresh;
|
|
45
45
|
private __lifecycle_authorized;
|
|
46
46
|
private _cache_key;
|
|
@@ -50,11 +50,16 @@ export declare class Jqhtml_Component {
|
|
|
50
50
|
private _is_dynamic;
|
|
51
51
|
private _on_render_complete;
|
|
52
52
|
private _use_cached_data_hit;
|
|
53
|
-
private
|
|
54
|
-
private
|
|
53
|
+
private _load_only;
|
|
54
|
+
private _load_render_only;
|
|
55
|
+
_is_detached: boolean;
|
|
56
|
+
private _force_initial_render;
|
|
55
57
|
private _has_rendered;
|
|
56
58
|
private _load_queue;
|
|
57
59
|
private __has_custom_on_load;
|
|
60
|
+
private __load_gates;
|
|
61
|
+
private __first_load_started;
|
|
62
|
+
private __gate_resume;
|
|
58
63
|
constructor(element?: any, args?: Record<string, any>);
|
|
59
64
|
/**
|
|
60
65
|
* Protect lifecycle methods from manual invocation
|
|
@@ -100,31 +105,100 @@ export declare class Jqhtml_Component {
|
|
|
100
105
|
* @returns The current _render_count after incrementing (used to detect stale renders)
|
|
101
106
|
* @private
|
|
102
107
|
*/
|
|
103
|
-
_render(id?: string | null
|
|
108
|
+
_render(id?: string | null, options?: {
|
|
109
|
+
skip_on_render?: boolean;
|
|
110
|
+
}): number;
|
|
104
111
|
/**
|
|
105
112
|
* Public render method - re-renders component and completes lifecycle
|
|
106
113
|
* This is what users should call when they want to update a component.
|
|
107
114
|
*
|
|
108
|
-
* Lifecycle sequence:
|
|
115
|
+
* Lifecycle sequence (serialized via component queue):
|
|
109
116
|
* 1. _render() - Updates DOM synchronously, calls on_render(), fires 'render' event
|
|
110
|
-
* 2.
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* - trigger('ready') - Fires ready event
|
|
117
|
+
* 2. _wait_for_children_ready() - Waits for all children to reach ready state
|
|
118
|
+
* 3. on_ready() - Calls user's ready hook
|
|
119
|
+
* 4. trigger('ready') - Fires ready event
|
|
114
120
|
*
|
|
115
|
-
*
|
|
121
|
+
* Goes through the component queue to prevent concurrent lifecycle operations.
|
|
122
|
+
* Returns a Promise that resolves when the full render lifecycle completes.
|
|
116
123
|
*/
|
|
117
|
-
render(id?: string | null): void
|
|
124
|
+
render(id?: string | null): Promise<void>;
|
|
118
125
|
/**
|
|
119
126
|
* Alias for render() - re-renders component with current data
|
|
120
127
|
* Provided for API consistency and clarity
|
|
121
128
|
*/
|
|
122
|
-
redraw(id?: string | null): void
|
|
129
|
+
redraw(id?: string | null): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Re-fetch data by executing on_load() without triggering re-render or lifecycle.
|
|
132
|
+
*
|
|
133
|
+
* Runs on_load() on a detached proxy (same restrictions as during boot):
|
|
134
|
+
* - this.data is restored to on_create() snapshot, then unfrozen for writing
|
|
135
|
+
* - this.args is read-only
|
|
136
|
+
* - All other properties (this.$, this.$sid, etc.) are blocked
|
|
137
|
+
*
|
|
138
|
+
* After on_load() completes, this.data is atomically updated and re-frozen.
|
|
139
|
+
* The developer decides what to do next (e.g., call this.render()).
|
|
140
|
+
*
|
|
141
|
+
* Pattern: load() invokes on_load(), just as render() invokes on_render().
|
|
142
|
+
*
|
|
143
|
+
* @returns true if this.data changed, false if unchanged
|
|
144
|
+
*/
|
|
145
|
+
load(): Promise<boolean>;
|
|
123
146
|
/**
|
|
124
147
|
* Create phase - Quick setup, prepare UI
|
|
125
148
|
* SYNCHRONOUS - no awaits, no yields
|
|
126
149
|
*/
|
|
127
150
|
create(): void;
|
|
151
|
+
/**
|
|
152
|
+
* Register a "load gate" — a promise that must settle before this component's
|
|
153
|
+
* FIRST on_load() runs.
|
|
154
|
+
*
|
|
155
|
+
* Register gates during on_create(). Multiple calls accumulate; all gates are
|
|
156
|
+
* awaited together (via Promise.allSettled) at the seam between create and the
|
|
157
|
+
* first load. A REJECTED gate does NOT block or abort the load — it is an
|
|
158
|
+
* ordering hint, not a data dependency, so loading proceeds after settlement
|
|
159
|
+
* (rejections are logged through the debug channel).
|
|
160
|
+
*
|
|
161
|
+
* Gates are ONE-SHOT: they delay the first on_load() only. Once that load
|
|
162
|
+
* begins the gate list is cleared, and reload()/refresh() never re-await gates.
|
|
163
|
+
* Calling reload()/refresh() while a gate is still holding the first load
|
|
164
|
+
* releases the wait immediately and resumes the lifecycle (a later gate
|
|
165
|
+
* settlement then does nothing).
|
|
166
|
+
*
|
|
167
|
+
* Gates delay ONLY the on_load phase — never create(), the initial render,
|
|
168
|
+
* on_render(), or the cached-content first paint (stale-while-revalidate is
|
|
169
|
+
* preserved). Components with no custom on_load() ignore gates entirely.
|
|
170
|
+
*
|
|
171
|
+
* No-op during SSR (the server cannot await arbitrary client promises).
|
|
172
|
+
*
|
|
173
|
+
* jqhtml has no knowledge of WHAT is being awaited — the caller supplies the
|
|
174
|
+
* promise, and policy such as timeouts is the caller's responsibility (bake it
|
|
175
|
+
* into the promise you pass).
|
|
176
|
+
*
|
|
177
|
+
* @param promise The promise to await before the first on_load().
|
|
178
|
+
* @throws If called after the component's first load has already started.
|
|
179
|
+
*/
|
|
180
|
+
gate_load(promise: Promise<any>): void;
|
|
181
|
+
/**
|
|
182
|
+
* Await all registered load gates before the first on_load().
|
|
183
|
+
*
|
|
184
|
+
* Called exactly once, at the boot seam immediately before the load phase
|
|
185
|
+
* (only for components with a custom on_load()). Latches "first load started"
|
|
186
|
+
* so any later gate_load() throws and reload()/refresh() never re-await.
|
|
187
|
+
*
|
|
188
|
+
* Returns a promise to await when there are gates to wait on, or `null` when
|
|
189
|
+
* there is nothing to wait for (no gates, or SSR). Returning `null` keeps the
|
|
190
|
+
* common no-gate path free of an extra microtask hop, so it does not shift the
|
|
191
|
+
* timing of ungated components.
|
|
192
|
+
*
|
|
193
|
+
* The returned promise resolves as soon as any of the following happens
|
|
194
|
+
* (whichever is first — the rest become no-ops):
|
|
195
|
+
* - all gates settle (Promise.allSettled),
|
|
196
|
+
* - reload()/refresh() is called while gated (they resolve __gate_resume),
|
|
197
|
+
* - the component is stopped (stop() resolves __gate_resume).
|
|
198
|
+
*
|
|
199
|
+
* @private
|
|
200
|
+
*/
|
|
201
|
+
private _await_load_gates;
|
|
128
202
|
/**
|
|
129
203
|
* Load phase - Fetch asynchronous data
|
|
130
204
|
* Called bottom-up, fully parallel
|
|
@@ -139,16 +213,7 @@ export declare class Jqhtml_Component {
|
|
|
139
213
|
_load(): Promise<void>;
|
|
140
214
|
/**
|
|
141
215
|
* Execute on_load() on a fully detached proxy.
|
|
142
|
-
*
|
|
143
|
-
* The proxy has:
|
|
144
|
-
* - A CLONE of this.data (from __initial_data_snapshot)
|
|
145
|
-
* - Read-only access to this.args
|
|
146
|
-
* - No access to anything else (this.$, this.sid, etc.)
|
|
147
|
-
*
|
|
148
|
-
* This ensures on_load runs completely isolated from the component instance.
|
|
149
|
-
*
|
|
150
|
-
* @param use_load_coordinator - If true, register with Load_Coordinator for deduplication
|
|
151
|
-
* @returns The resulting data from the proxy after on_load completes
|
|
216
|
+
* @see data-proxy.ts for full implementation
|
|
152
217
|
* @private
|
|
153
218
|
*/
|
|
154
219
|
private _execute_on_load_detached;
|
|
@@ -301,6 +366,7 @@ export declare class Jqhtml_Component {
|
|
|
301
366
|
on_render(): void;
|
|
302
367
|
on_create(): void;
|
|
303
368
|
on_load(): void | Promise<void>;
|
|
369
|
+
on_loaded(): void | Promise<void>;
|
|
304
370
|
on_ready(): Promise<void>;
|
|
305
371
|
on_stop(): void;
|
|
306
372
|
/**
|
|
@@ -329,45 +395,28 @@ export declare class Jqhtml_Component {
|
|
|
329
395
|
*/
|
|
330
396
|
component_name(): string;
|
|
331
397
|
/**
|
|
332
|
-
* Register event callback
|
|
333
|
-
*
|
|
334
|
-
* Lifecycle event callbacks fire after the lifecycle method completes
|
|
335
|
-
* If a lifecycle event has already occurred, the callback fires immediately AND registers for future occurrences
|
|
336
|
-
* Custom events only fire when explicitly triggered via .trigger()
|
|
337
|
-
*
|
|
338
|
-
* Callback signature: (component, data?) => void
|
|
339
|
-
* - component: The component instance that triggered the event
|
|
340
|
-
* - data: Optional data passed as second parameter to trigger()
|
|
398
|
+
* Register event callback - delegates to component-events.ts
|
|
399
|
+
* @see component-events.ts for full documentation
|
|
341
400
|
*/
|
|
342
401
|
on(event_name: string, callback: (component: Jqhtml_Component, data?: any) => void): this;
|
|
343
402
|
/**
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
|
|
348
|
-
|
|
403
|
+
* Register a callback that fires exactly once - delegates to component-events.ts
|
|
404
|
+
* If the event already occurred, fires immediately and does not register.
|
|
405
|
+
* @see component-events.ts for full documentation
|
|
406
|
+
*/
|
|
407
|
+
once(event_name: string, callback: (component: Jqhtml_Component, data?: any) => void): this;
|
|
408
|
+
/**
|
|
409
|
+
* Trigger a lifecycle event - delegates to component-events.ts
|
|
410
|
+
* @see component-events.ts for full documentation
|
|
349
411
|
*/
|
|
350
412
|
trigger(event_name: string, data?: any): void;
|
|
351
413
|
/**
|
|
352
414
|
* Check if any callbacks are registered for a given event
|
|
353
|
-
* Used to determine if cleanup logic needs to run
|
|
354
415
|
*/
|
|
355
416
|
_on_registered(event_name: string): boolean;
|
|
356
417
|
/**
|
|
357
|
-
* Invalidate a lifecycle event -
|
|
358
|
-
*
|
|
359
|
-
* This is the opposite of trigger(). After invalidate() is called:
|
|
360
|
-
* - New .on() handlers will NOT fire immediately
|
|
361
|
-
* - The ready() promise will NOT resolve immediately
|
|
362
|
-
* - Handlers wait for the next trigger() call
|
|
363
|
-
*
|
|
364
|
-
* Existing registered callbacks are NOT removed - they'll fire on next trigger().
|
|
365
|
-
*
|
|
366
|
-
* Use case: Call invalidate('ready') at the start of reload() or render()
|
|
367
|
-
* so that any new .on('ready') handlers wait for the reload/render to complete
|
|
368
|
-
* rather than firing immediately based on the previous lifecycle's state.
|
|
369
|
-
*
|
|
370
|
-
* @param event_name - Name of the event to invalidate
|
|
418
|
+
* Invalidate a lifecycle event - delegates to component-events.ts
|
|
419
|
+
* @see component-events.ts for full documentation
|
|
371
420
|
*/
|
|
372
421
|
invalidate(event_name: string): void;
|
|
373
422
|
/**
|
|
@@ -440,21 +489,5 @@ export declare class Jqhtml_Component {
|
|
|
440
489
|
private _get_dom_children;
|
|
441
490
|
private _log_lifecycle;
|
|
442
491
|
private _log_debug;
|
|
443
|
-
/**
|
|
444
|
-
* Creates a debounced function with exclusivity and promise fan-in
|
|
445
|
-
*
|
|
446
|
-
* When invoked, immediately runs the callback exclusively.
|
|
447
|
-
* For subsequent invocations, applies a delay before running the callback exclusively again.
|
|
448
|
-
* The delay starts after the current asynchronous operation resolves.
|
|
449
|
-
*
|
|
450
|
-
* If delay is 0, the function only prevents enqueueing multiple executions,
|
|
451
|
-
* but will still run them immediately in an exclusive sequential manner.
|
|
452
|
-
*
|
|
453
|
-
* The most recent invocation's parameters are used when the function executes.
|
|
454
|
-
* Returns a promise that resolves when the next exclusive execution completes.
|
|
455
|
-
*
|
|
456
|
-
* @private
|
|
457
|
-
*/
|
|
458
|
-
private _create_debounced_function;
|
|
459
492
|
}
|
|
460
493
|
//# sourceMappingURL=component.d.ts.map
|
package/dist/component.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":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AAgB,GAAG,IAAI;IAoBlD;;OAEG;IACH,MAAM,CAAC,mBAAmB,IAAI,MAAM,EAAE;IA0CtC,OAAO,CAAC,aAAa;IAIrB;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAkB7B,OAAO,CAAC,kBAAkB;IA4B1B,OAAO,CAAC,yBAAyB;IAuHjC,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,gBAAgB;IAcxB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IA+BzB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,UAAU;CAUnB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JQHTML Data Proxy System
|
|
3
|
+
*
|
|
4
|
+
* Extracted from component.ts - handles:
|
|
5
|
+
* - Data freeze/unfreeze enforcement via Proxy
|
|
6
|
+
* - Detached on_load() execution with restricted access
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Set up the `this.data` property on a component using Object.defineProperty
|
|
10
|
+
* with a Proxy that enforces freeze/unfreeze semantics.
|
|
11
|
+
*
|
|
12
|
+
* After setup:
|
|
13
|
+
* - `this.data` reads/writes go through a Proxy
|
|
14
|
+
* - When `component.__data_frozen === true`, writes throw errors
|
|
15
|
+
* - When frozen is false, writes pass through normally
|
|
16
|
+
*
|
|
17
|
+
* @param component - The component instance to set up data on
|
|
18
|
+
*/
|
|
19
|
+
export declare function setup_data_property(component: any): void;
|
|
20
|
+
/**
|
|
21
|
+
* Execute on_load() in a detached context with restricted access.
|
|
22
|
+
*
|
|
23
|
+
* Creates a sandboxed environment where on_load() can only access:
|
|
24
|
+
* - this.args (read-only)
|
|
25
|
+
* - this.data (read/write, cloned from __initial_data_snapshot)
|
|
26
|
+
*
|
|
27
|
+
* All other property access (this.$, this.$sid, etc.) throws errors.
|
|
28
|
+
*
|
|
29
|
+
* @param component - The component instance
|
|
30
|
+
* @param use_load_coordinator - Whether to use Load_Coordinator for deduplication
|
|
31
|
+
* @returns The resulting data and optional coordination completion function
|
|
32
|
+
*/
|
|
33
|
+
export declare function execute_on_load_detached(component: any, use_load_coordinator?: boolean): Promise<{
|
|
34
|
+
data: Record<string, any>;
|
|
35
|
+
complete_coordination: ((data: Record<string, any>) => void) | null;
|
|
36
|
+
}>;
|
|
37
|
+
//# sourceMappingURL=data-proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-proxy.d.ts","sourceRoot":"","sources":["../src/data-proxy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,GAAG,GAAG,IAAI,CAiFxD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,wBAAwB,CAAC,SAAS,EAAE,GAAG,EAAE,oBAAoB,GAAE,OAAe,GAAG,OAAO,CAAC;IAC7G,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,qBAAqB,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;CACrE,CAAC,CA8JD"}
|