@lark.js/mvc 0.0.15 → 0.0.16
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 +324 -215
- package/dist/chunk-OGPBFCIK.js +105 -0
- package/dist/client.d.cts +63 -0
- package/dist/client.d.ts +10 -34
- package/dist/compiler.cjs +15534 -15854
- package/dist/compiler.js +15519 -15851
- package/dist/devtool.cjs +2617 -4152
- package/dist/devtool.d.cts +1 -2
- package/dist/devtool.d.ts +1 -2
- package/dist/devtool.js +2543 -4159
- package/dist/index.cjs +4128 -6008
- package/dist/index.d.cts +568 -1288
- package/dist/index.d.ts +568 -1288
- package/dist/index.js +4058 -5976
- package/dist/rspack.cjs +15648 -15935
- package/dist/rspack.d.cts +5 -42
- package/dist/rspack.d.ts +5 -42
- package/dist/rspack.js +15641 -15934
- package/dist/runtime.cjs +79 -79
- package/dist/runtime.js +19 -85
- package/dist/vite.cjs +15841 -15957
- package/dist/vite.d.cts +1 -2
- package/dist/vite.d.ts +1 -2
- package/dist/vite.js +15834 -15955
- package/dist/webpack.cjs +15648 -15985
- package/dist/webpack.d.cts +4 -32
- package/dist/webpack.d.ts +4 -32
- package/dist/webpack.js +15641 -15984
- package/package.json +3 -4
- package/dist/apply-style.d.ts +0 -9
- package/dist/cache.d.ts +0 -69
- package/dist/common.d.ts +0 -64
- package/dist/compiler/compile-template.d.ts +0 -16
- package/dist/compiler/compile-to-vdom-function.d.ts +0 -13
- package/dist/compiler/extract-global-vars.d.ts +0 -17
- package/dist/compiler/template-syntax.d.ts +0 -61
- package/dist/cross-site.d.ts +0 -29
- package/dist/dom.d.ts +0 -45
- package/dist/event-delegator.d.ts +0 -28
- package/dist/event-emitter.d.ts +0 -38
- package/dist/frame.d.ts +0 -143
- package/dist/framework.d.ts +0 -9
- package/dist/hmr.d.ts +0 -53
- package/dist/index.amd.js +0 -6285
- package/dist/index.umd.js +0 -6272
- package/dist/mark.d.ts +0 -26
- package/dist/module-loader.d.ts +0 -20
- package/dist/router.d.ts +0 -14
- package/dist/runtime.amd.js +0 -94
- package/dist/runtime.umd.js +0 -98
- package/dist/service.d.ts +0 -173
- package/dist/state.d.ts +0 -8
- package/dist/store.d.ts +0 -60
- package/dist/types.d.ts +0 -1259
- package/dist/updater.d.ts +0 -90
- package/dist/url-state.d.ts +0 -32
- package/dist/utils.d.ts +0 -90
- package/dist/vdom.d.ts +0 -45
- package/dist/view-registry.d.ts +0 -20
- package/dist/view.d.ts +0 -214
package/dist/types.d.ts
DELETED
|
@@ -1,1259 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lark framework type definitions.
|
|
3
|
-
* All shared types are defined here to eliminate type cheats across modules.
|
|
4
|
-
*
|
|
5
|
-
* Lark is a lightweight MVC frontend framework that provides:
|
|
6
|
-
* - View: base view class with extend/merge inheritance and mixin support
|
|
7
|
-
* - Router: hash-based two-phase route confirmation
|
|
8
|
-
* - State: simple cross-view observable singleton (recommended for simple cases)
|
|
9
|
-
* - Store: zustand-aligned state management with create/getState/setState/subscribe
|
|
10
|
-
* (recommended for complex cases)
|
|
11
|
-
* - Service: API request management with caching, queuing, and deduplication
|
|
12
|
-
* - Frame: view frame managing view mount/unmount lifecycle
|
|
13
|
-
* - Updater: view data binding and DOM diff (in-memory real DOM diff) renderer
|
|
14
|
-
*
|
|
15
|
-
* Designed for single-page application (SPA) development.
|
|
16
|
-
*/
|
|
17
|
-
/** Generic function type for event handlers and callbacks.
|
|
18
|
-
* Uses any[] to accept callbacks with specific parameter types
|
|
19
|
-
* (TypeScript function parameters are contravariant).
|
|
20
|
-
*/
|
|
21
|
-
export type AnyFunc = (...args: any[]) => unknown;
|
|
22
|
-
/** A function that returns void. */
|
|
23
|
-
export type VoidFunc = (...args: any[]) => void;
|
|
24
|
-
export interface CacheEntry<T> {
|
|
25
|
-
/** Original key without prefix */
|
|
26
|
-
originalKey: string;
|
|
27
|
-
/** Cached value */
|
|
28
|
-
value: T | undefined;
|
|
29
|
-
/** Access frequency count */
|
|
30
|
-
frequency: number;
|
|
31
|
-
/** Last access timestamp */
|
|
32
|
-
lastTimestamp: number;
|
|
33
|
-
}
|
|
34
|
-
export interface CacheOptions<T> {
|
|
35
|
-
/** Maximum cache size before eviction triggers (default: 20) */
|
|
36
|
-
maxSize?: number;
|
|
37
|
-
/** Buffer size for eviction (default: 5) */
|
|
38
|
-
bufferSize?: number;
|
|
39
|
-
/** Callback when entry is removed */
|
|
40
|
-
onRemove?: (key: string) => void;
|
|
41
|
-
/** Comparator for sorting entries */
|
|
42
|
-
sortComparator?: (a: CacheEntry<T>, b: CacheEntry<T>) => number;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Cache interface providing LFU (Least Frequently Used) cache management.
|
|
46
|
-
* Cache keys use a special prefix internally for namespace isolation.
|
|
47
|
-
*/
|
|
48
|
-
export interface CacheInterface<T = unknown> {
|
|
49
|
-
/**
|
|
50
|
-
* Set a cache resource. If the key exists, updates the value and increments frequency.
|
|
51
|
-
* Triggers LFU eviction when cache entries exceed capacity (maxSize + bufferSize).
|
|
52
|
-
* @param key Unique identifier for the cached resource
|
|
53
|
-
* @param resource The resource to cache
|
|
54
|
-
*/
|
|
55
|
-
set(key: string, resource: T): void;
|
|
56
|
-
/**
|
|
57
|
-
* Get a cached resource. Access increments frequency count and timestamp for LFU ranking.
|
|
58
|
-
* Returns undefined if the key does not exist.
|
|
59
|
-
* @param key Cache resource key
|
|
60
|
-
*/
|
|
61
|
-
get(key: string): T | undefined;
|
|
62
|
-
/**
|
|
63
|
-
* Remove a resource from cache by key. Triggers onRemove callback on deletion.
|
|
64
|
-
* @param key Cache resource key to remove
|
|
65
|
-
*/
|
|
66
|
-
del(key: string): void;
|
|
67
|
-
/**
|
|
68
|
-
* Check if cache contains a resource for the given key.
|
|
69
|
-
* @param key Cache resource key
|
|
70
|
-
*/
|
|
71
|
-
has(key: string): boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Iterate over all cached resource values.
|
|
74
|
-
* @param callback Iteration callback receiving the cached value (may be undefined)
|
|
75
|
-
*/
|
|
76
|
-
forEach(callback: (value: T | undefined) => void): void;
|
|
77
|
-
/**
|
|
78
|
-
* Number of cache entries.
|
|
79
|
-
*/
|
|
80
|
-
readonly size: number;
|
|
81
|
-
/**
|
|
82
|
-
* Clear all cache entries. Triggers onRemove callback for each deleted entry.
|
|
83
|
-
*/
|
|
84
|
-
clear(): void;
|
|
85
|
-
}
|
|
86
|
-
export interface EventListenerEntry {
|
|
87
|
-
/** Handler function */
|
|
88
|
-
handler: AnyFunc;
|
|
89
|
-
/** Whether currently executing (1 = executing, '' = done) */
|
|
90
|
-
executing: number | string;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Parsed URL result containing path and parameters.
|
|
94
|
-
* Returned by `Router.parse()`, includes the path string and parsed key-value parameter pairs.
|
|
95
|
-
*/
|
|
96
|
-
export interface ParsedUri {
|
|
97
|
-
/** Path portion (before ? or #), excluding query parameters */
|
|
98
|
-
path: string;
|
|
99
|
-
/** Key-value params parsed from the URL */
|
|
100
|
-
params: Record<string, string>;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Current URL parsing result interface.
|
|
104
|
-
* Returned by `Router.parse()`, includes both query (after ?) and hash (after #) sections.
|
|
105
|
-
*/
|
|
106
|
-
export interface Location {
|
|
107
|
-
/** Full href, original href string */
|
|
108
|
-
href: string;
|
|
109
|
-
/** Query string (before #), raw query string (after ?, before #) */
|
|
110
|
-
srcQuery: string;
|
|
111
|
-
/** Hash string (after #), raw hash string (after #) */
|
|
112
|
-
srcHash: string;
|
|
113
|
-
/** Parsed query object, path and params parsed from srcQuery */
|
|
114
|
-
query: ParsedUri;
|
|
115
|
-
/** Parsed hash object, path and params parsed from srcHash */
|
|
116
|
-
hash: ParsedUri;
|
|
117
|
-
/**
|
|
118
|
-
* Merged params from query and hash,
|
|
119
|
-
* hash values take precedence when keys conflict.
|
|
120
|
-
*/
|
|
121
|
-
params: Record<string, string>;
|
|
122
|
-
/**
|
|
123
|
-
* Resolved view path for the current URL.
|
|
124
|
-
* May be undefined before framework boot.
|
|
125
|
-
*/
|
|
126
|
-
view?: string;
|
|
127
|
-
/**
|
|
128
|
-
* Resolved path computed from hash path and query path based on routing rules.
|
|
129
|
-
* May be undefined before framework boot.
|
|
130
|
-
*/
|
|
131
|
-
path?: string;
|
|
132
|
-
/**
|
|
133
|
-
* Get param by key with optional default value.
|
|
134
|
-
* Returns default value or empty string if key does not exist.
|
|
135
|
-
* @param key Parameter key name
|
|
136
|
-
* @param defaultValue Default value when key is missing, defaults to empty string
|
|
137
|
-
*/
|
|
138
|
-
get: (key: string, defaultValue?: string) => string;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* URL parameter change representing a parameter value transition from old to new.
|
|
142
|
-
* Used in `Router.diff()` return value to describe parameter changes.
|
|
143
|
-
*/
|
|
144
|
-
export interface ParamDiff {
|
|
145
|
-
/** Value before the change */
|
|
146
|
-
from: string;
|
|
147
|
-
/** Value after the change */
|
|
148
|
-
to: string;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* URL route change object interface describing changes between two routing states.
|
|
152
|
-
* Returned by `Router.diff()`, includes changes in path, view, and other parameters.
|
|
153
|
-
*/
|
|
154
|
-
export interface LocationDiff {
|
|
155
|
-
/**
|
|
156
|
-
* Changed params (key -> {from, to}),
|
|
157
|
-
* diff for all changed parameters
|
|
158
|
-
*/
|
|
159
|
-
params: Record<string, ParamDiff>;
|
|
160
|
-
/** Path diff when path has changed */
|
|
161
|
-
path?: ParamDiff;
|
|
162
|
-
/** View diff when rendered view has changed */
|
|
163
|
-
view?: ParamDiff;
|
|
164
|
-
/**
|
|
165
|
-
* Whether this is a first forced change during app initialization.
|
|
166
|
-
*/
|
|
167
|
-
force: boolean;
|
|
168
|
-
/** Whether any content has changed */
|
|
169
|
-
changed: boolean;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Route pre-change event interface (change phase).
|
|
173
|
-
* Provides two-phase confirmation: triggers change (can be rejected), then changed.
|
|
174
|
-
* Can prevent, reject, or accept route changes through this event object.
|
|
175
|
-
*/
|
|
176
|
-
export interface RouteChangeEvent extends ChangeEvent {
|
|
177
|
-
/**
|
|
178
|
-
* Reject the URL change, revert to previous URL.
|
|
179
|
-
*/
|
|
180
|
-
reject: () => void;
|
|
181
|
-
/**
|
|
182
|
-
* Accept the URL change, continue navigation.
|
|
183
|
-
*/
|
|
184
|
-
resolve: () => void;
|
|
185
|
-
/**
|
|
186
|
-
* Prevent the URL change, pause subsequent route processing.
|
|
187
|
-
*/
|
|
188
|
-
prevent: () => void;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Route post-change event interface (changed phase).
|
|
192
|
-
* Carries route diff information. Triggered after route change is confirmed and URL is updated.
|
|
193
|
-
*/
|
|
194
|
-
export type RouteChangedEvent = LocationDiff & ChangeEvent;
|
|
195
|
-
export interface DomRef {
|
|
196
|
-
/** ID update list: [element, newId][] */
|
|
197
|
-
idUpdates: [Element, string][];
|
|
198
|
-
/** Views that need post-processing */
|
|
199
|
-
views: ViewInterface[];
|
|
200
|
-
/** DOM operation list: [opCode, parent, newChild?, oldChild?][] */
|
|
201
|
-
domOps: DomOp[];
|
|
202
|
-
/** Whether anything changed */
|
|
203
|
-
hasChanged: number;
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Encoded DOM mutation. The op code matches `Node.appendChild` family at the
|
|
207
|
-
* DOM level — parents are always Elements (you can't appendChild onto text)
|
|
208
|
-
* but the moving / replaced child can be any ChildNode (Element / Text /
|
|
209
|
-
* Comment), so the child slots are typed as ChildNode.
|
|
210
|
-
*/
|
|
211
|
-
export type DomOp = [1, Element, ChildNode] | [2, Element, ChildNode] | [4, Element, ChildNode, ChildNode] | [8, Element, ChildNode, ChildNode];
|
|
212
|
-
/**
|
|
213
|
-
* Virtual DOM node. Produced by `vdomCreate`, consumed by the VDOM diff engine.
|
|
214
|
-
*
|
|
215
|
-
* Property semantics:
|
|
216
|
-
* - Text nodes: tag = 0 (V_TEXT_NODE), html = text content
|
|
217
|
-
* - Element nodes: tag = string, attrs = serialized opening tag, children = child VDomNodes
|
|
218
|
-
* - Raw HTML nodes: tag = SPLITTER (\x1e), html = raw HTML string
|
|
219
|
-
* - Self-closing: selfClose = true (children param was 1)
|
|
220
|
-
*/
|
|
221
|
-
export interface VDomNode {
|
|
222
|
-
/** Tag name for elements, 0 (V_TEXT_NODE) for text, SPLITTER for raw HTML */
|
|
223
|
-
tag: string | number;
|
|
224
|
-
/** Inner HTML (serialized children for elements, text content for text nodes) */
|
|
225
|
-
html: string;
|
|
226
|
-
/** Serialized opening tag with attributes, e.g. '<div class="row"' */
|
|
227
|
-
attrs?: string;
|
|
228
|
-
/** Attribute key-value map */
|
|
229
|
-
attrsMap?: Record<string, unknown>;
|
|
230
|
-
/** Attribute names that are set as DOM properties (not attributes) */
|
|
231
|
-
attrsSpecials?: Record<string, string>;
|
|
232
|
-
/** Original specials argument before defaulting (for change detection) */
|
|
233
|
-
hasSpecials?: Record<string, string> | undefined;
|
|
234
|
-
/** Child VDomNode array (undefined for text/raw/self-closing) */
|
|
235
|
-
children?: VDomNode[] | undefined;
|
|
236
|
-
/** Diff key: from id, #, or v-lark path */
|
|
237
|
-
compareKey?: string | undefined;
|
|
238
|
-
/** Keyed children count map (compareKey -> count) */
|
|
239
|
-
reused?: Record<string, number> | undefined;
|
|
240
|
-
/** Total count of keyed children */
|
|
241
|
-
reusedTotal?: number;
|
|
242
|
-
/** Sub-view references: [viewPath, owner, uri, params] tuples */
|
|
243
|
-
views?: [string, string, string, Record<string, string>][] | undefined;
|
|
244
|
-
/** Whether self-closing (children param was literal 1) */
|
|
245
|
-
selfClose?: boolean;
|
|
246
|
-
/** Sub-view path if this node hosts a v-lark view, otherwise falsy */
|
|
247
|
-
isLarkView?: string | undefined;
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* VDOM diff operation tracker. Parallel to DomRef but for the VDOM pipeline.
|
|
251
|
-
*/
|
|
252
|
-
export interface VDomRef {
|
|
253
|
-
/** View ID (for placeholder replacement) */
|
|
254
|
-
viewId: string;
|
|
255
|
-
/** Sub-views that need re-rendering after diff */
|
|
256
|
-
viewRenders: ViewInterface[];
|
|
257
|
-
/** Deferred DOM property assignments: [element, propName, value][] */
|
|
258
|
-
nodeProps: [Element, string, unknown][];
|
|
259
|
-
/** Pending async operation count */
|
|
260
|
-
asyncCount: number;
|
|
261
|
-
/** Whether the DOM actually changed */
|
|
262
|
-
changed: number;
|
|
263
|
-
/** DOM mutation operations (same format as DomOp) */
|
|
264
|
-
domOps: DomOp[];
|
|
265
|
-
}
|
|
266
|
-
/** VDOM node creation function signature (vdomCreate) */
|
|
267
|
-
export type VDomCreateFn = (tag: string | number, props?: Record<string, unknown> | number | null, children?: VDomNode[] | number | null, specials?: Record<string, string>) => VDomNode;
|
|
268
|
-
/**
|
|
269
|
-
* VDOM template function signature.
|
|
270
|
-
* The compiled template imports vdomCreate via ES module import and
|
|
271
|
-
* takes only (data, viewId, refData). Extra arguments are ignored.
|
|
272
|
-
*/
|
|
273
|
-
export type VDomTemplate = (data: unknown, viewId: string, refData: unknown) => VDomNode;
|
|
274
|
-
export interface FrameInvokeEntry {
|
|
275
|
-
/** Method name */
|
|
276
|
-
name: string;
|
|
277
|
-
/** Method arguments */
|
|
278
|
-
args: unknown[];
|
|
279
|
-
/** Internal key */
|
|
280
|
-
key: string;
|
|
281
|
-
/** Whether removed (args match) */
|
|
282
|
-
removed?: boolean;
|
|
283
|
-
}
|
|
284
|
-
/** Mixin event handler with internal merge marker and handler list */
|
|
285
|
-
export interface MixinEventHandler extends AnyFunc {
|
|
286
|
-
/** Merged handler list */
|
|
287
|
-
handlerList?: AnyFunc[];
|
|
288
|
-
/** Mixin marker: 1 = this is a mixin function */
|
|
289
|
-
marker?: number;
|
|
290
|
-
}
|
|
291
|
-
/** View event selector map entry: handler name list with selector presence tracking */
|
|
292
|
-
export interface ViewEventSelectorEntry {
|
|
293
|
-
/** Selector name list */
|
|
294
|
-
selectors: string[];
|
|
295
|
-
/** Index signature for checking if selector is already registered */
|
|
296
|
-
[selector: string]: unknown;
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Compiled template function signature.
|
|
300
|
-
* `data`/`viewId`/`refData` are required; subsequent encoder args are
|
|
301
|
-
* injected by the Updater (encodeHTML/encodeSafe/encodeURIExtra/refFn/encodeQ).
|
|
302
|
-
*/
|
|
303
|
-
export type ViewTemplate = (data: unknown, viewId: string, refData: unknown, ...encoders: unknown[]) => string;
|
|
304
|
-
export interface ViewLocationObserved {
|
|
305
|
-
/** Whether observing location */
|
|
306
|
-
flag: number;
|
|
307
|
-
/** Keys to observe */
|
|
308
|
-
keys: string[];
|
|
309
|
-
/** Whether observing path */
|
|
310
|
-
observePath: boolean;
|
|
311
|
-
}
|
|
312
|
-
export interface ViewResourceEntry {
|
|
313
|
-
/** The resource entity */
|
|
314
|
-
entity: unknown;
|
|
315
|
-
/** Whether to destroy when render() is called */
|
|
316
|
-
destroyOnRender: boolean;
|
|
317
|
-
}
|
|
318
|
-
export interface ViewGlobalEventEntry {
|
|
319
|
-
/** Handler function */
|
|
320
|
-
handler: AnyFunc;
|
|
321
|
-
/** Bound handler wrapper (for removeEventListener) */
|
|
322
|
-
boundHandler?: AnyFunc;
|
|
323
|
-
/** DOM element (window/document) */
|
|
324
|
-
element: EventTarget;
|
|
325
|
-
/** Event name */
|
|
326
|
-
eventName: string;
|
|
327
|
-
/** Modifiers */
|
|
328
|
-
modifiers: Record<string, boolean>;
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* View configuration for listening to URL changes.
|
|
332
|
-
* Used as object parameter for `observeLocation()` method.
|
|
333
|
-
*/
|
|
334
|
-
export interface ViewObserveLocation {
|
|
335
|
-
/**
|
|
336
|
-
* Whether to listen for path changes.
|
|
337
|
-
*/
|
|
338
|
-
observePath?: boolean;
|
|
339
|
-
/**
|
|
340
|
-
* Parameter keys to observe, supports comma-separated string or string array.
|
|
341
|
-
*/
|
|
342
|
-
params?: string | string[];
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* Router interface providing URL parsing, navigation, diff, and event listening capabilities.
|
|
346
|
-
* Supports two-phase route confirmation mechanism: change (can reject) → changed.
|
|
347
|
-
* Hash-based implementation using #! as default hash prefix.
|
|
348
|
-
*/
|
|
349
|
-
export interface RouterInterface extends EventEmitterInterface<RouterInterface> {
|
|
350
|
-
/**
|
|
351
|
-
* Parse href into Location object.
|
|
352
|
-
* Parses query and hash sections of href, returns structured routing information.
|
|
353
|
-
* Defaults to parsing current page `location.href`.
|
|
354
|
-
* @param href URL to parse, uses `location.href` if not specified
|
|
355
|
-
*/
|
|
356
|
-
parse(href?: string): Location;
|
|
357
|
-
/**
|
|
358
|
-
* Compute diff between current and previous location.
|
|
359
|
-
* Returns undefined if no routing changes have occurred yet.
|
|
360
|
-
*/
|
|
361
|
-
diff(): LocationDiff | undefined;
|
|
362
|
-
/**
|
|
363
|
-
* Navigate to new URL.
|
|
364
|
-
* Supports two calling modes:
|
|
365
|
-
* - `Router.to("/list", { page: 2 })` specify path and params
|
|
366
|
-
* - `Router.to({ page: 2 })` update params only, keep current path
|
|
367
|
-
* @param pathOrParams Path string or params object
|
|
368
|
-
* @param params Query params object (only used when first arg is path string)
|
|
369
|
-
* @param replace Whether to replace current history entry instead of adding new one
|
|
370
|
-
* @param silent Whether to silently update without triggering change event
|
|
371
|
-
*/
|
|
372
|
-
to(pathOrParams: string | Record<string, unknown>, params?: Record<string, unknown>, replace?: boolean, silent?: boolean): void;
|
|
373
|
-
/** Join path segments */
|
|
374
|
-
join(...paths: string[]): string;
|
|
375
|
-
/**
|
|
376
|
-
* Register an async-friendly navigation guard.
|
|
377
|
-
*
|
|
378
|
-
* Each guard is invoked with the parsed `(to, from)` Locations. Guards
|
|
379
|
-
* may return a Promise; the router awaits all guards in registration
|
|
380
|
-
* order. If any guard:
|
|
381
|
-
*
|
|
382
|
-
* - returns / resolves to `false`,
|
|
383
|
-
* - throws or rejects,
|
|
384
|
-
*
|
|
385
|
-
* the navigation is aborted and the URL is reverted. Returning `true`,
|
|
386
|
-
* `undefined`, or any non-false value permits the navigation.
|
|
387
|
-
*
|
|
388
|
-
* Returns an unsubscribe function so the guard can be torn down (e.g.
|
|
389
|
-
* inside a view's `destroy` handler).
|
|
390
|
-
*/
|
|
391
|
-
beforeEach(guard: (to: Location, from: Location) => boolean | Promise<boolean>): () => void;
|
|
392
|
-
/** Internal: bind hashchange (called by Framework.boot) */
|
|
393
|
-
_bind(): void;
|
|
394
|
-
/** Internal: set framework config */
|
|
395
|
-
_setConfig(cfg: FrameworkConfig): void;
|
|
396
|
-
/** Internal: notify hash change (for programmatic trigger) */
|
|
397
|
-
notify?(e?: Event): void;
|
|
398
|
-
/**
|
|
399
|
-
* Triggered when URL is about to change (change phase), can reject or prevent navigation via event object.
|
|
400
|
-
*/
|
|
401
|
-
onChange?: (e?: RouteChangeEvent) => void;
|
|
402
|
-
/**
|
|
403
|
-
* Triggered after URL has changed (changed phase), carries route diff information.
|
|
404
|
-
*/
|
|
405
|
-
onChanged?: (e?: RouteChangedEvent) => void;
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* Service event interface, triggered when request starts or ends.
|
|
409
|
-
* Includes begin/done/fail/end event types.
|
|
410
|
-
*/
|
|
411
|
-
export interface ServiceEvent extends ChangeEvent {
|
|
412
|
-
/**
|
|
413
|
-
* Data payload object carrying this request's data.
|
|
414
|
-
*/
|
|
415
|
-
readonly payload: PayloadInterface;
|
|
416
|
-
/**
|
|
417
|
-
* Error object, present if request throws an error, otherwise null.
|
|
418
|
-
*/
|
|
419
|
-
readonly error: object | string | null;
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* View event interface carrying the ID of the node that triggered the event.
|
|
423
|
-
* Carried in DOM events bound via @event attribute.
|
|
424
|
-
*/
|
|
425
|
-
export interface ViewEvent extends ChangeEvent {
|
|
426
|
-
/**
|
|
427
|
-
* DOM node ID that triggered the event.
|
|
428
|
-
*/
|
|
429
|
-
readonly id: string;
|
|
430
|
-
}
|
|
431
|
-
/**
|
|
432
|
-
* Frame static event interface carrying associated Frame instance.
|
|
433
|
-
* Carried in Frame's add/remove static events.
|
|
434
|
-
*/
|
|
435
|
-
export interface FrameStaticEvent extends ChangeEvent {
|
|
436
|
-
/**
|
|
437
|
-
* Associated Frame instance object.
|
|
438
|
-
*/
|
|
439
|
-
readonly frame: FrameInterface;
|
|
440
|
-
}
|
|
441
|
-
export interface ViewInterface extends EventEmitterInterface<ViewInterface> {
|
|
442
|
-
/**
|
|
443
|
-
* View ID (same as owner frame ID),
|
|
444
|
-
* DOM node ID where current view resides.
|
|
445
|
-
*/
|
|
446
|
-
id: string;
|
|
447
|
-
/**
|
|
448
|
-
* Owner frame,
|
|
449
|
-
* Frame instance holding current view.
|
|
450
|
-
* May be numeric placeholder 0 before view initialization completes.
|
|
451
|
-
* TODO: Migrate numeric placeholder 0 to undefined or null
|
|
452
|
-
*/
|
|
453
|
-
owner: FrameInterface | number;
|
|
454
|
-
/**
|
|
455
|
-
* Updater instance managing view data binding and DOM rendering.
|
|
456
|
-
*/
|
|
457
|
-
updater: UpdaterInterface;
|
|
458
|
-
/**
|
|
459
|
-
* Signature: > 0 means active, incremented on render, 0 = destroyed */
|
|
460
|
-
signature: number;
|
|
461
|
-
/** Whether rendered at least once */
|
|
462
|
-
rendered?: boolean;
|
|
463
|
-
/**
|
|
464
|
-
* View template function. Receives data + viewId + refData and a set of
|
|
465
|
-
* encoder helpers wired in by the Updater, and returns the rendered HTML.
|
|
466
|
-
*/
|
|
467
|
-
template?: ViewTemplate | VDomTemplate;
|
|
468
|
-
/**
|
|
469
|
-
* Mixin object array for extending view functionality.
|
|
470
|
-
* Framework merges properties and methods from mixins into view prototype.
|
|
471
|
-
* Event method conflicts are automatically merged into sequential calls.
|
|
472
|
-
*/
|
|
473
|
-
mixins?: Record<string, unknown>[];
|
|
474
|
-
/** Location observation config */
|
|
475
|
-
locationObserved: ViewLocationObserved;
|
|
476
|
-
/** Observed state keys */
|
|
477
|
-
observedStateKeys?: string[];
|
|
478
|
-
/** Resource map */
|
|
479
|
-
resources: Record<string, ViewResourceEntry>;
|
|
480
|
-
/** Selector event map: eventType -> selector list */
|
|
481
|
-
eventSelectorMap: Record<string, ViewEventSelectorEntry>;
|
|
482
|
-
/** Event object map: eventType -> bitmask */
|
|
483
|
-
eventObjectMap: Record<string, number>;
|
|
484
|
-
/** Global event list */
|
|
485
|
-
globalEventList: ViewGlobalEventEntry[];
|
|
486
|
-
/** Whether endUpdate has been called (1 = pending) */
|
|
487
|
-
endUpdatePending?: number;
|
|
488
|
-
/** Last rendered VDOM tree (only used when virtualDom is enabled) */
|
|
489
|
-
vdom?: VDomNode;
|
|
490
|
-
/** Render method (wrapped) */
|
|
491
|
-
render(): void;
|
|
492
|
-
/**
|
|
493
|
-
* Init method called after view is mounted.
|
|
494
|
-
* Used for initialization logic.
|
|
495
|
-
* Framework passes two arguments during actual invocation:
|
|
496
|
-
* - initParams: initialization parameter object
|
|
497
|
-
* - options: contains `node: Element` and `deep: boolean`
|
|
498
|
-
*/
|
|
499
|
-
init(): void;
|
|
500
|
-
/** Wrapped render method */
|
|
501
|
-
renderMethod?: AnyFunc;
|
|
502
|
-
/** endUpdate pending flag */
|
|
503
|
-
endUpdatePendingFlag?: number;
|
|
504
|
-
/**
|
|
505
|
-
* Notify view that HTML update is about to begin for a specific region.
|
|
506
|
-
* Framework unmounts child Frames in that region to prevent DOM diff from operating on unmounted nodes.
|
|
507
|
-
* @param id Region node ID to update, defaults to current view
|
|
508
|
-
*/
|
|
509
|
-
beginUpdate: (id?: string) => void;
|
|
510
|
-
/**
|
|
511
|
-
* Notify view that HTML update has completed for a specific region.
|
|
512
|
-
* Framework mounts child Frames in that region and executes deferred invoke queue.
|
|
513
|
-
* @param id Region node ID that finished updating, defaults to current view
|
|
514
|
-
* @param inner Whether this is an internal framework call
|
|
515
|
-
*/
|
|
516
|
-
endUpdate: (id?: string, inner?: boolean) => void;
|
|
517
|
-
/**
|
|
518
|
-
* Wrap async callback to ensure it only executes if view is not destroyed.
|
|
519
|
-
* In SPAs, async callbacks (e.g., setTimeout, AJAX) may execute after view is destroyed,
|
|
520
|
-
* causing errors when manipulating DOM.
|
|
521
|
-
* After wrapping with `wrapAsync`, framework automatically checks view state and only executes callback if view is alive.
|
|
522
|
-
* @param fn Callback function to wrap
|
|
523
|
-
* @param context `this` binding for callback execution, defaults to view itself
|
|
524
|
-
*/
|
|
525
|
-
wrapAsync: <Fn extends AnyFunc>(fn: Fn, context?: unknown) => (...args: Parameters<Fn>) => ReturnType<Fn> | undefined;
|
|
526
|
-
/**
|
|
527
|
-
* Listen for URL bar changes, supports two calling modes:
|
|
528
|
-
* - `observeLocation("page,size", true)` pass parameter keys (comma-separated) and whether to observe path
|
|
529
|
-
* - `observeLocation({ params: ["page", "size"], path: true })` pass config object
|
|
530
|
-
* View automatically re-renders when observed parameters or path change.
|
|
531
|
-
* @param params Parameter keys to observe, supports comma-separated string, string array, or config object
|
|
532
|
-
* @param observePath Whether to observe path changes
|
|
533
|
-
*/
|
|
534
|
-
observeLocation: (params: string | string[] | Record<string, unknown>, observePath?: boolean) => void;
|
|
535
|
-
/**
|
|
536
|
-
* Observe data changes for specified keys in State.
|
|
537
|
-
* View automatically re-renders when observed keys are updated via `State.digest()`.
|
|
538
|
-
* @param keys Comma-separated key string or string array
|
|
539
|
-
*/
|
|
540
|
-
observeState: (keys: string | string[]) => void;
|
|
541
|
-
/**
|
|
542
|
-
* Hand over resource to current view for lifecycle management.
|
|
543
|
-
* Framework automatically calls resource's destroy method at appropriate time when view unmounts or re-renders.
|
|
544
|
-
* @param key Unique key for managed resource; if key already manages different resource, old resource is auto-destroyed
|
|
545
|
-
* @param resource Resource object to manage
|
|
546
|
-
* @param destroyOnRender Whether to auto-destroy resource when render method is called; Service instances typically need auto-destroy on render
|
|
547
|
-
*/
|
|
548
|
-
capture: (key: string, resource?: unknown, destroyOnRender?: boolean) => unknown;
|
|
549
|
-
/**
|
|
550
|
-
* Release managed resource, returns the resource object regardless of destruction state.
|
|
551
|
-
* @param key Managed resource key
|
|
552
|
-
* @param destroy Whether to destroy resource (call its destroy method), defaults to true
|
|
553
|
-
*/
|
|
554
|
-
release: (key: string, destroy?: boolean) => unknown;
|
|
555
|
-
/**
|
|
556
|
-
* Set leave prompt, e.g., when form has unsaved changes.
|
|
557
|
-
* Can prompt user to choose between leaving directly or saving before leaving.
|
|
558
|
-
* Framework calls condition function during route changes (change phase) and page unloads (beforeunload).
|
|
559
|
-
* Navigation is prevented if condition returns true.
|
|
560
|
-
* @param message Leave prompt message
|
|
561
|
-
* @param condition Function to determine whether to show leave prompt; returns true to prevent navigation
|
|
562
|
-
*/
|
|
563
|
-
leaveTip: (message: string, condition: () => boolean) => void;
|
|
564
|
-
/**
|
|
565
|
-
* Assign method for incremental DOM updates.
|
|
566
|
-
* Framework uses DOM diff (in-memory real DOM diff) to update only changed portions,
|
|
567
|
-
* automatically handling child view mounting and unmounting.
|
|
568
|
-
* Returns true if DOM changed, undefined if no change.
|
|
569
|
-
* @param options Incremental update config, used internally by framework
|
|
570
|
-
*/
|
|
571
|
-
assign?: (options?: unknown) => boolean | undefined;
|
|
572
|
-
/**
|
|
573
|
-
* Triggered when view is destroyed.
|
|
574
|
-
*/
|
|
575
|
-
onDestroy?: (e?: ChangeEvent) => void;
|
|
576
|
-
/**
|
|
577
|
-
* Triggered when render method is called.
|
|
578
|
-
*/
|
|
579
|
-
onRender?: (e?: ChangeEvent) => void;
|
|
580
|
-
/**
|
|
581
|
-
* Inherit View to create new view subclass.
|
|
582
|
-
* Supports props.ctor constructor, props.mixins, and event methods (e.g., `'name<click>'`).
|
|
583
|
-
* @param props Prototype object containing init, render, and other methods
|
|
584
|
-
* @param statics Object of static methods or properties
|
|
585
|
-
*/
|
|
586
|
-
extend?<TProps = object, TStatics = object>(props?: ExtendThisType<TProps & ViewInterface>, statics?: TStatics): ViewInterface & TStatics;
|
|
587
|
-
/**
|
|
588
|
-
* Merge multiple mixin objects into View prototype.
|
|
589
|
-
* Existing properties are not overwritten; event method conflicts are automatically merged into sequential calls.
|
|
590
|
-
* @param args Mixin object list
|
|
591
|
-
*/
|
|
592
|
-
merge?(...args: ExtendThisType<ViewInterface>[]): ViewInterface;
|
|
593
|
-
navigate?: (path: string, params?: Record<string, unknown>) => void;
|
|
594
|
-
}
|
|
595
|
-
type ExtendThisType<T> = Record<string, unknown> & ThisType<T>;
|
|
596
|
-
/**
|
|
597
|
-
* Minimal Frame interface needed by View.
|
|
598
|
-
* Frame (View Frame) is a view container managing view mount, unmount, and parent-child hierarchy.
|
|
599
|
-
* Each Frame corresponds to one DOM node, associated with view via v-lark attribute.
|
|
600
|
-
*/
|
|
601
|
-
export interface FrameInterface extends EventEmitterInterface<FrameInterface> {
|
|
602
|
-
/**
|
|
603
|
-
* DOM node ID where Frame resides.
|
|
604
|
-
*/
|
|
605
|
-
id: string;
|
|
606
|
-
/**
|
|
607
|
-
* View module path currently rendered by this Frame, e.g., "app/views/default".
|
|
608
|
-
*/
|
|
609
|
-
readonly viewPath?: string;
|
|
610
|
-
/**
|
|
611
|
-
* Parent Frame ID, undefined if this is a top-level Frame.
|
|
612
|
-
*/
|
|
613
|
-
readonly parentId: string | undefined;
|
|
614
|
-
/**
|
|
615
|
-
* Mount view to current Frame.
|
|
616
|
-
* Framework loads view class, creates instance, and renders view.
|
|
617
|
-
* @param viewPath View module path, e.g., "app/views/default"
|
|
618
|
-
* @param viewInitParams Parameters passed during view initialization, accessible in view's init method
|
|
619
|
-
*/
|
|
620
|
-
mountView(viewPath: string, viewInitParams?: Record<string, unknown>): void;
|
|
621
|
-
/**
|
|
622
|
-
* Unmount view from current Frame, triggers view's destroy event and cleans up resources.
|
|
623
|
-
*/
|
|
624
|
-
unmountView(): void;
|
|
625
|
-
/**
|
|
626
|
-
* Mount child Frame on specified DOM node and render view.
|
|
627
|
-
* @param frameId DOM node ID for rendering
|
|
628
|
-
* @param viewPath View path
|
|
629
|
-
* @param viewInitParams Parameters passed during view initialization
|
|
630
|
-
*/
|
|
631
|
-
mountFrame: (frameId: string, viewPath: string, viewInitParams?: Record<string, unknown>) => FrameInterface;
|
|
632
|
-
/**
|
|
633
|
-
* Unmount child Frame from specified DOM node.
|
|
634
|
-
* @param id DOM node ID, defaults to current Frame if omitted
|
|
635
|
-
*/
|
|
636
|
-
unmountFrame: (id?: string) => void;
|
|
637
|
-
/**
|
|
638
|
-
* Render all child views under specified node (scans v-lark attributes and mounts).
|
|
639
|
-
* @param zoneId DOM node ID, defaults to current Frame
|
|
640
|
-
*/
|
|
641
|
-
mountZone: (zoneId?: string) => void;
|
|
642
|
-
/**
|
|
643
|
-
* Unmount all child views under specified node.
|
|
644
|
-
* @param zoneId DOM node ID, defaults to current Frame
|
|
645
|
-
*/
|
|
646
|
-
unmountZone: (zoneId?: string) => void;
|
|
647
|
-
/**
|
|
648
|
-
* Get ancestor Frame, defaults to parent Frame (level=1).
|
|
649
|
-
* @param level Levels to traverse upward, defaults to 1
|
|
650
|
-
*/
|
|
651
|
-
parent(level?: number): FrameInterface | undefined;
|
|
652
|
-
/**
|
|
653
|
-
* Invoke specified method on view in current Frame.
|
|
654
|
-
* If view is not rendered yet, invocation is deferred until render completes.
|
|
655
|
-
* @param name Method name
|
|
656
|
-
* @param args Arguments array passed to method
|
|
657
|
-
*/
|
|
658
|
-
invoke: (name: string, args?: unknown[]) => unknown;
|
|
659
|
-
/**
|
|
660
|
-
* Triggered when all descendant views have been created.
|
|
661
|
-
*/
|
|
662
|
-
onCreated?: (e?: ChangeEvent) => void;
|
|
663
|
-
/**
|
|
664
|
-
* Triggered when descendant views change.
|
|
665
|
-
*/
|
|
666
|
-
onAlter?: (e?: ChangeEvent) => void;
|
|
667
|
-
/**
|
|
668
|
-
* Get Frame instance by ID, returns undefined if not exists.
|
|
669
|
-
* @param id Frame's DOM node ID
|
|
670
|
-
*/
|
|
671
|
-
get?(id: string): FrameInterface | undefined;
|
|
672
|
-
/**
|
|
673
|
-
* Get all Frame instances map for current page.
|
|
674
|
-
*/
|
|
675
|
-
getAll?(): Map<string, FrameInterface>;
|
|
676
|
-
/**
|
|
677
|
-
* Triggered when Frame is created and registered.
|
|
678
|
-
*/
|
|
679
|
-
onAdd?: (e?: FrameStaticEvent) => void;
|
|
680
|
-
/**
|
|
681
|
-
* Triggered when Frame is destroyed and unregistered.
|
|
682
|
-
*/
|
|
683
|
-
onRemove?: (e?: FrameStaticEvent) => void;
|
|
684
|
-
view: ViewInterface | undefined;
|
|
685
|
-
/**
|
|
686
|
-
* Get ID array of all child Frames for current Frame.
|
|
687
|
-
* Note: ID positions in array are not fixed.
|
|
688
|
-
*/
|
|
689
|
-
children: () => string[];
|
|
690
|
-
invokeList: FrameInvokeEntry[];
|
|
691
|
-
}
|
|
692
|
-
/**
|
|
693
|
-
* Minimal Updater interface needed by View.
|
|
694
|
-
* View updater responsible for view data binding and data/page updates.
|
|
695
|
-
* Each View instance has an Updater, triggering data/page updates via set/digest.
|
|
696
|
-
* Internally executes complete pipeline: template rendering → DOM diff (in-memory real DOM diff) → DOM operations.
|
|
697
|
-
*/
|
|
698
|
-
export interface UpdaterInterface {
|
|
699
|
-
/**
|
|
700
|
-
* Get data that has been set.
|
|
701
|
-
* Returns complete data object if key is omitted, otherwise returns value for specified key.
|
|
702
|
-
* @param key Data key name, omitted returns complete data object
|
|
703
|
-
*/
|
|
704
|
-
get: <T = unknown>(key?: string) => T;
|
|
705
|
-
/**
|
|
706
|
-
* Set data and track changed keys.
|
|
707
|
-
* After set, must explicitly call `digest()` to commit changes to page.
|
|
708
|
-
* Returns this for chaining.
|
|
709
|
-
* @param data Data object, e.g., `{ a: 1, b: 2 }`
|
|
710
|
-
* @param excludes Set of keys to exclude from change tracking
|
|
711
|
-
*/
|
|
712
|
-
set: (data: Record<string, unknown>, excludes?: ReadonlySet<string>) => UpdaterInterface;
|
|
713
|
-
/**
|
|
714
|
-
* Trigger page re-render.
|
|
715
|
-
* After set, must explicitly call `digest()` to commit changes to page.
|
|
716
|
-
* Internally executes complete pipeline: template rendering → DOM diff (in-memory real DOM diff) → DOM operations.
|
|
717
|
-
* @param data Optional data object, if provided calls `set()` first to set data
|
|
718
|
-
* @param excludes Set of keys to exclude from change tracking
|
|
719
|
-
* @param callback Callback executed after render completes
|
|
720
|
-
*/
|
|
721
|
-
digest: (data?: Record<string, unknown>, excludes?: ReadonlySet<string>, callback?: () => void) => void;
|
|
722
|
-
/**
|
|
723
|
-
* Save a snapshot of current data for altered() detection.
|
|
724
|
-
* Works with `altered()` method to detect whether data has changed.
|
|
725
|
-
*/
|
|
726
|
-
snapshot: () => UpdaterInterface;
|
|
727
|
-
/**
|
|
728
|
-
* Check if data has changed since last snapshot.
|
|
729
|
-
* Returns undefined if `snapshot()` has not been called.
|
|
730
|
-
*/
|
|
731
|
-
altered: () => boolean | undefined;
|
|
732
|
-
/** Ref data for template rendering */
|
|
733
|
-
refData: Record<string, unknown>;
|
|
734
|
-
/**
|
|
735
|
-
* Translate raw reference data starting with @ symbol in template.
|
|
736
|
-
* Replaces `{{@refData}}` with actual value from refData.
|
|
737
|
-
* @param data Reference data to translate
|
|
738
|
-
*/
|
|
739
|
-
translate(data: unknown): unknown;
|
|
740
|
-
/**
|
|
741
|
-
* Parse expression string.
|
|
742
|
-
* @param expr Expression string to parse
|
|
743
|
-
*/
|
|
744
|
-
parse(expr: string): unknown;
|
|
745
|
-
}
|
|
746
|
-
/**
|
|
747
|
-
* Data payload interface wrapping API request response data, providing read/write methods.
|
|
748
|
-
* Payload instances are created internally by Service, developers access via all/one/save callbacks.
|
|
749
|
-
*/
|
|
750
|
-
export interface PayloadInterface {
|
|
751
|
-
/**
|
|
752
|
-
* Get data from Payload by key.
|
|
753
|
-
* @param key Data key name
|
|
754
|
-
*/
|
|
755
|
-
get<T = unknown>(key: string): T;
|
|
756
|
-
/**
|
|
757
|
-
* Set data to Payload, supports three calling modes:
|
|
758
|
-
* - Key-value pair: `payload.set("name", "value")`
|
|
759
|
-
* - Data object: `payload.set({ name: "value" })`
|
|
760
|
-
* - Endpoint metadata object (for internal framework use)
|
|
761
|
-
* Returns this for chaining.
|
|
762
|
-
* @param keyOrData Key/value string, data object, or endpoint metadata object
|
|
763
|
-
* @param value Value when first parameter is a key
|
|
764
|
-
*/
|
|
765
|
-
set(keyOrData: string | Record<string, unknown> | ServiceMetaEntry, value?: unknown): PayloadInterface;
|
|
766
|
-
data: Record<string, unknown>;
|
|
767
|
-
cacheInfo?: ServiceCacheInfo;
|
|
768
|
-
}
|
|
769
|
-
/**
|
|
770
|
-
* Change event object.
|
|
771
|
-
*/
|
|
772
|
-
export interface ChangeEvent {
|
|
773
|
-
/**
|
|
774
|
-
* Event type.
|
|
775
|
-
*/
|
|
776
|
-
readonly type: string;
|
|
777
|
-
/**
|
|
778
|
-
* Set of changed data keys. Use `keys.has(name)` to check membership.
|
|
779
|
-
*/
|
|
780
|
-
readonly keys?: ReadonlySet<string>;
|
|
781
|
-
}
|
|
782
|
-
/**
|
|
783
|
-
* Event emitter interface providing on/off/fire methods for publish-subscribe pattern.
|
|
784
|
-
*/
|
|
785
|
-
export interface EventEmitterInterface<T = unknown> {
|
|
786
|
-
/**
|
|
787
|
-
* Bind event listener, calls handler when event is triggered.
|
|
788
|
-
* @param name Event name
|
|
789
|
-
* @param fn Event handler function
|
|
790
|
-
*/
|
|
791
|
-
on(name: string, fn: (this: T, e?: ChangeEvent) => void): EventEmitterInterface<T>;
|
|
792
|
-
/**
|
|
793
|
-
* Unbind event listener, removes all handlers for event if no handler function is provided.
|
|
794
|
-
* @param name Event name
|
|
795
|
-
* @param fn Optional event handler function, if omitted removes all handlers
|
|
796
|
-
*/
|
|
797
|
-
off(name: string, fn?: AnyFunc): EventEmitterInterface<T>;
|
|
798
|
-
/**
|
|
799
|
-
* Fire event, executes all bound handlers, automatically adds type property to event data.
|
|
800
|
-
* Supports removing all handlers after firing.
|
|
801
|
-
* Supports executing handler list in reverse order.
|
|
802
|
-
* @param name Event name
|
|
803
|
-
* @param data Event data object
|
|
804
|
-
* @param remove Whether to remove all handlers after firing
|
|
805
|
-
* @param lastToFirst Whether to execute handler list in reverse order
|
|
806
|
-
*/
|
|
807
|
-
fire(name: string, data?: Record<string, unknown>, remove?: boolean, lastToFirst?: boolean): EventEmitterInterface<T>;
|
|
808
|
-
}
|
|
809
|
-
/**
|
|
810
|
-
* Global state interface providing cross-view data sharing and data change notification capabilities.
|
|
811
|
-
* State is a singleton object managing app-level state data via get/set/digest.
|
|
812
|
-
* Supports `clean()` method to create a mixin for automatic cleanup on view destruction.
|
|
813
|
-
*
|
|
814
|
-
* Use State for SIMPLE cross-view data (lightweight shared values: counters,
|
|
815
|
-
* toggles, page title, session info, etc.). For COMPLEX reactive state —
|
|
816
|
-
* handlers, derived data, or fine-grained subscriptions — use `create` instead.
|
|
817
|
-
*/
|
|
818
|
-
export interface StateInterface extends EventEmitterInterface<StateInterface> {
|
|
819
|
-
/**
|
|
820
|
-
* Get data from global state, returns complete state object if key is omitted.
|
|
821
|
-
* @param key Data key name, omitted returns complete state object
|
|
822
|
-
*/
|
|
823
|
-
get<T = unknown>(key?: string): T;
|
|
824
|
-
/**
|
|
825
|
-
* Set global state data.
|
|
826
|
-
* After set, must explicitly call `digest()` to dispatch changed event and notify views to update.
|
|
827
|
-
* @param data Data object, e.g., `{ a: 1, b: 2 }`
|
|
828
|
-
* @param excludes Set of keys to exclude from change tracking
|
|
829
|
-
*/
|
|
830
|
-
set(data: Record<string, unknown>, excludes?: ReadonlySet<string>): this;
|
|
831
|
-
/**
|
|
832
|
-
* Clean data for specified keys in State, can only be used in view's mixins.
|
|
833
|
-
* For example `mixins: [State.clean("a,b")]`.
|
|
834
|
-
* Keys registered via this method are automatically cleaned when view is destroyed,
|
|
835
|
-
* and corresponding key reference counts are decremented; data is auto-deleted when count reaches zero.
|
|
836
|
-
* @param keys Comma-separated key string
|
|
837
|
-
* @returns Object with ctor method, called by mixins mechanism
|
|
838
|
-
*/
|
|
839
|
-
clean(keys: string): {
|
|
840
|
-
ctor: AnyFunc;
|
|
841
|
-
};
|
|
842
|
-
/**
|
|
843
|
-
* Detect data changes and dispatch changed event.
|
|
844
|
-
* After set, must explicitly call `digest()` to dispatch changed event and notify views to update.
|
|
845
|
-
* @param data Optional data object, if provided calls `set()` first to set data
|
|
846
|
-
* @param excludes Set of keys to exclude from change tracking
|
|
847
|
-
*/
|
|
848
|
-
digest(data?: Record<string, unknown>, excludes?: ReadonlySet<string>): void;
|
|
849
|
-
/**
|
|
850
|
-
* Get the set of keys changed in the most recent digest.
|
|
851
|
-
*/
|
|
852
|
-
diff: () => ReadonlySet<string>;
|
|
853
|
-
onChanged?: (e?: ChangeEvent) => void;
|
|
854
|
-
}
|
|
855
|
-
export interface ServiceOptions {
|
|
856
|
-
/** Request URL */
|
|
857
|
-
url: string;
|
|
858
|
-
/** Request params */
|
|
859
|
-
params?: Record<string, unknown>;
|
|
860
|
-
/** HTTP method */
|
|
861
|
-
method?: "GET" | "POST" | "PUT" | "DELETE" | string;
|
|
862
|
-
/** Cache: true for default, number for TTL */
|
|
863
|
-
cache?: boolean | number;
|
|
864
|
-
/** POST data */
|
|
865
|
-
data?: unknown;
|
|
866
|
-
}
|
|
867
|
-
/** Pending cache entry for deduplication (internal to Service) */
|
|
868
|
-
export interface PendingCacheEntry extends Array<unknown> {
|
|
869
|
-
/** Reference to the pending Payload entity */
|
|
870
|
-
entity?: unknown;
|
|
871
|
-
}
|
|
872
|
-
/**
|
|
873
|
-
* Endpoint metadata configuration for registering an API endpoint with Service.
|
|
874
|
-
* Each meta describes endpoint's URL, cache strategy, before/after interceptors, etc.
|
|
875
|
-
*/
|
|
876
|
-
export interface ServiceMetaEntry {
|
|
877
|
-
/**
|
|
878
|
-
* Endpoint name,
|
|
879
|
-
* Unique name for endpoint metadata, must be unique within same Service.
|
|
880
|
-
*/
|
|
881
|
-
name: string;
|
|
882
|
-
/** Request URL, required. */
|
|
883
|
-
url: string;
|
|
884
|
-
/**
|
|
885
|
-
* Cache TTL in ms, 0 = no cache.
|
|
886
|
-
* Cache validity time in milliseconds.
|
|
887
|
-
* 0 means no caching.
|
|
888
|
-
* Greater than 0 means cache TTL, reuse cached data within this time range.
|
|
889
|
-
*/
|
|
890
|
-
cache?: number;
|
|
891
|
-
/**
|
|
892
|
-
* Before-fetch hook,
|
|
893
|
-
* Hook function called before request is sent, can process request data.
|
|
894
|
-
* `this` points to current Payload instance.
|
|
895
|
-
* @param payload Data carrier for current request
|
|
896
|
-
*/
|
|
897
|
-
before?: (this: PayloadInterface, payload: PayloadInterface) => void;
|
|
898
|
-
/**
|
|
899
|
-
* After-fetch hook.
|
|
900
|
-
* Hook function called after request succeeds, before data is passed to view.
|
|
901
|
-
* Can process response data in this method.
|
|
902
|
-
* `this` points to current Payload instance.
|
|
903
|
-
* @param payload Data carrier for current request
|
|
904
|
-
*/
|
|
905
|
-
after?: (this: PayloadInterface, payload: PayloadInterface) => void;
|
|
906
|
-
/** Clean keys on destroy,
|
|
907
|
-
* Comma-separated endpoint name string for clearing other endpoints' cache.
|
|
908
|
-
* For example, if an endpoint creates new data,
|
|
909
|
-
* after successful call, should clear all data-fetching endpoints' cache,
|
|
910
|
-
* otherwise new data cannot be retrieved.
|
|
911
|
-
*/
|
|
912
|
-
cleanKeys?: string;
|
|
913
|
-
/** Additional properties */
|
|
914
|
-
[key: string]: unknown;
|
|
915
|
-
}
|
|
916
|
-
/** Cache info attached to Payload entity */
|
|
917
|
-
export interface ServiceCacheInfo {
|
|
918
|
-
/** Endpoint name */
|
|
919
|
-
name: string;
|
|
920
|
-
/** After-fetch hook */
|
|
921
|
-
after?: AnyFunc | undefined;
|
|
922
|
-
/** Clean keys */
|
|
923
|
-
cleans?: string | undefined;
|
|
924
|
-
/** Cache key */
|
|
925
|
-
key: string;
|
|
926
|
-
/** Timestamp when cached */
|
|
927
|
-
time: number;
|
|
928
|
-
}
|
|
929
|
-
export interface FrameworkInterface {
|
|
930
|
-
/**
|
|
931
|
-
* Read framework configuration.
|
|
932
|
-
* - Without arguments: returns the complete config object.
|
|
933
|
-
* - With a key: returns just `config[key]` (untyped — use a generic to
|
|
934
|
-
* constrain the return type if you know the key's shape).
|
|
935
|
-
*
|
|
936
|
-
* `getConfig` is a pure read — call `setConfig(patch)` to mutate.
|
|
937
|
-
*/
|
|
938
|
-
getConfig(): FrameworkConfig;
|
|
939
|
-
getConfig<T = unknown>(key: string): T | undefined;
|
|
940
|
-
/**
|
|
941
|
-
* Merge a patch into the framework configuration and return the merged
|
|
942
|
-
* config object.
|
|
943
|
-
*/
|
|
944
|
-
setConfig<T extends object = Partial<FrameworkConfig>>(patch: Partial<FrameworkConfig> & T): FrameworkConfig & T;
|
|
945
|
-
/**
|
|
946
|
-
* App initialization entry point, starts framework and renders root view.
|
|
947
|
-
* After invocation: merge config → bind route events → create root Frame → mount default view.
|
|
948
|
-
* @param cfg Config object
|
|
949
|
-
*/
|
|
950
|
-
boot(cfg: FrameworkConfig): void;
|
|
951
|
-
/**
|
|
952
|
-
* Convert array to hash map object.
|
|
953
|
-
* - Simple array: `Framework.toMap([1,2,3])` => `{1:1, 2:1, 3:1}`
|
|
954
|
-
* - Object array: `Framework.toMap([{id:20},{id:30}], 'id')` => `{20:{id:20}, 30:{id:30}}`
|
|
955
|
-
* @param list Source array
|
|
956
|
-
* @param key Use object's key value from array as map key
|
|
957
|
-
*/
|
|
958
|
-
toMap<T>(list: T[] | null | undefined, key?: keyof T): Record<string, T | number>;
|
|
959
|
-
/**
|
|
960
|
-
* Execute methods in try-catch manner, catches exceptions.
|
|
961
|
-
* Returns return value of last successfully executed method.
|
|
962
|
-
* @param fns Function or function array
|
|
963
|
-
* @param args Arguments array passed to functions
|
|
964
|
-
* @param context `this` binding during function execution
|
|
965
|
-
* @param configError Optional error callback, receives the caught exception
|
|
966
|
-
*/
|
|
967
|
-
toTry(fns: AnyFunc | AnyFunc[], args?: unknown[], context?: unknown, configError?: (e: unknown) => void): unknown;
|
|
968
|
-
/**
|
|
969
|
-
* Convert path and params to URL string.
|
|
970
|
-
* Example: `Framework.toUrl('/xxx/', {a:'b',c:'d'})` => `/xxx/?a=b&c=d`
|
|
971
|
-
* @param path Path string
|
|
972
|
-
* @param params Params object
|
|
973
|
-
* @param keepEmpty Set of keys whose empty values should be preserved
|
|
974
|
-
*/
|
|
975
|
-
toUrl(path: string, params?: Record<string, unknown>, keepEmpty?: Set<string>): string;
|
|
976
|
-
/**
|
|
977
|
-
* Parse URL string to path and params object.
|
|
978
|
-
* Example: `Framework.parseUrl('/xxx/?a=b&c=d')` => `{path:'/xxx/', params:{a:'b',c:'d'}}`
|
|
979
|
-
* @param url URL string
|
|
980
|
-
*/
|
|
981
|
-
parseUrl(url: string): ParsedUri;
|
|
982
|
-
/**
|
|
983
|
-
* Merge source object properties into target object.
|
|
984
|
-
* @param target Target object
|
|
985
|
-
* @param sources One or more source objects
|
|
986
|
-
*/
|
|
987
|
-
mix<T extends object>(target: T, ...sources: Record<string, unknown>[]): T;
|
|
988
|
-
/**
|
|
989
|
-
* Check if object has specified own property (safe hasOwnProperty).
|
|
990
|
-
* @param owner Object to check, supports undefined/null
|
|
991
|
-
* @param prop Property key name
|
|
992
|
-
*/
|
|
993
|
-
has<T extends object>(owner: T | undefined | null, prop: PropertyKey): boolean;
|
|
994
|
-
/**
|
|
995
|
-
* Get enumerable property keys of object as array.
|
|
996
|
-
* @param src Source object
|
|
997
|
-
*/
|
|
998
|
-
keys<T extends object>(src: T): string[];
|
|
999
|
-
/**
|
|
1000
|
-
* Check if one DOM node is contained within another.
|
|
1001
|
-
* Returns true if both nodes are the same.
|
|
1002
|
-
* @param node Node or node ID
|
|
1003
|
-
* @param container Container node or node ID
|
|
1004
|
-
*/
|
|
1005
|
-
inside(node: HTMLElement | string, container: HTMLElement | string): boolean;
|
|
1006
|
-
/**
|
|
1007
|
-
* Shorthand for document.getElementById.
|
|
1008
|
-
* Returns directly if Element is passed.
|
|
1009
|
-
* @param id Node ID or Element object
|
|
1010
|
-
*/
|
|
1011
|
-
node(id: string | Element | null): Element | null;
|
|
1012
|
-
/**
|
|
1013
|
-
* Ensure DOM element has an ID, auto-generates one if missing.
|
|
1014
|
-
* Returns element's ID.
|
|
1015
|
-
* @param node DOM element object
|
|
1016
|
-
*/
|
|
1017
|
-
nodeId(node: HTMLElement): string;
|
|
1018
|
-
/**
|
|
1019
|
-
* Load modules using configured module loader.
|
|
1020
|
-
* @param names Module names, supports string or string array
|
|
1021
|
-
* @param callback Callback after modules are loaded
|
|
1022
|
-
*/
|
|
1023
|
-
use(names: string | string[], callback?: (...modules: unknown[]) => void): void;
|
|
1024
|
-
/**
|
|
1025
|
-
* Dynamically inject CSS styles into page. Returns cleanup function to remove injected styles.
|
|
1026
|
-
* Supports single and batch injection.
|
|
1027
|
-
* - `Framework.applyStyle("my-style", "body { color: red; }")` single injection
|
|
1028
|
-
* - `Framework.applyStyle(["style1", "css1", "style2", "css2"])` batch injection
|
|
1029
|
-
* @param styleIdOrPairs Style unique key or [id1, css1, id2, css2, ...] batch array
|
|
1030
|
-
* @param cssText CSS style string (only used when first param is string)
|
|
1031
|
-
*/
|
|
1032
|
-
applyStyle(styleIdOrPairs: string | string[], cssText?: string): () => void;
|
|
1033
|
-
/**
|
|
1034
|
-
* Generate globally unique identifier (GUID).
|
|
1035
|
-
* @param prefix GUID prefix, defaults to "lark-"
|
|
1036
|
-
*/
|
|
1037
|
-
guid(prefix?: string): string;
|
|
1038
|
-
/**
|
|
1039
|
-
* Create async callback validity marker.
|
|
1040
|
-
* Returns a check function; if host object is unmarked (e.g., view re-rendered), check function returns false, preventing expired async callbacks from executing.
|
|
1041
|
-
* Typical usage: `const check = Framework.mark(this, 'render'); setTimeout(() => { if (check()) ... })`
|
|
1042
|
-
* @param host Host object (usually view instance)
|
|
1043
|
-
* @param key Marker key name (usually "render" or specific async operation identifier)
|
|
1044
|
-
*/
|
|
1045
|
-
mark(host: object, key: string): () => boolean;
|
|
1046
|
-
/**
|
|
1047
|
-
* Delay wait, Promise-based setTimeout wrapper.
|
|
1048
|
-
* @param time Delay time in milliseconds
|
|
1049
|
-
*/
|
|
1050
|
-
delay(time: number): Promise<void>;
|
|
1051
|
-
/**
|
|
1052
|
-
* Whether framework has booted
|
|
1053
|
-
*/
|
|
1054
|
-
isBooted(): boolean;
|
|
1055
|
-
/**
|
|
1056
|
-
* Invalidate (unmark) async callback markers for a host object.
|
|
1057
|
-
* Typically called when a view is re-rendered or destroyed.
|
|
1058
|
-
* @param host The host object whose markers should be invalidated
|
|
1059
|
-
*/
|
|
1060
|
-
unmark(host: object): void;
|
|
1061
|
-
/**
|
|
1062
|
-
* Fire a custom DOM event on a target element.
|
|
1063
|
-
* @param target Target element or EventTarget
|
|
1064
|
-
* @param eventType Event type string
|
|
1065
|
-
* @param eventInit CustomEvent init options
|
|
1066
|
-
*/
|
|
1067
|
-
dispatch(target: EventTarget, eventType: string, eventInit?: CustomEventInit): void;
|
|
1068
|
-
/**
|
|
1069
|
-
* Execute a function in try-catch with chunked scheduling.
|
|
1070
|
-
* @param fn Function to execute
|
|
1071
|
-
* @param args Arguments to pass
|
|
1072
|
-
* @param context `this` context
|
|
1073
|
-
*/
|
|
1074
|
-
task(fn: AnyFunc, args?: unknown[], context?: unknown): void;
|
|
1075
|
-
/**
|
|
1076
|
-
* Wait for all views in a zone to be rendered.
|
|
1077
|
-
* Returns WAIT_OK if rendered, WAIT_TIMEOUT_OR_NOT_FOUND if timeout or not found.
|
|
1078
|
-
* @param viewId Zone view ID
|
|
1079
|
-
* @param timeout Timeout in milliseconds (default: 30000)
|
|
1080
|
-
*/
|
|
1081
|
-
waitZoneViewsRendered(viewId: string, timeout?: number): Promise<number>;
|
|
1082
|
-
/** Wait result: views rendered successfully */
|
|
1083
|
-
WAIT_OK: number;
|
|
1084
|
-
/** Wait result: timeout or view not found */
|
|
1085
|
-
WAIT_TIMEOUT_OR_NOT_FOUND: number;
|
|
1086
|
-
/**
|
|
1087
|
-
* Base class with EventEmitter.
|
|
1088
|
-
* Inherits EventEmitter for use as a base class in the framework.
|
|
1089
|
-
*/
|
|
1090
|
-
Base: typeof import("./event-emitter").EventEmitter;
|
|
1091
|
-
/**
|
|
1092
|
-
* View class.
|
|
1093
|
-
* Use `View.extend()` to create subclasses.
|
|
1094
|
-
*/
|
|
1095
|
-
View: typeof import("./view").View;
|
|
1096
|
-
/**
|
|
1097
|
-
* Cache class.
|
|
1098
|
-
* Use `new Cache()` to create cache instances.
|
|
1099
|
-
*/
|
|
1100
|
-
Cache: typeof import("./cache").Cache;
|
|
1101
|
-
/**
|
|
1102
|
-
* Global state object.
|
|
1103
|
-
*/
|
|
1104
|
-
State: StateInterface;
|
|
1105
|
-
/**
|
|
1106
|
-
* Router object.
|
|
1107
|
-
*/
|
|
1108
|
-
Router: RouterInterface;
|
|
1109
|
-
/**
|
|
1110
|
-
* Frame class.
|
|
1111
|
-
* Frame tree for view lifecycle management. Do not extend or instantiate directly.
|
|
1112
|
-
*/
|
|
1113
|
-
Frame: typeof import("./frame").Frame;
|
|
1114
|
-
}
|
|
1115
|
-
/**
|
|
1116
|
-
* Framework configuration interface, global config passed to app during `Framework.boot()`.
|
|
1117
|
-
* All config items can be accessed at runtime via `Framework.getConfig('key')`.
|
|
1118
|
-
*/
|
|
1119
|
-
export interface FrameworkConfig {
|
|
1120
|
-
/**
|
|
1121
|
-
* Root element ID.
|
|
1122
|
-
* DOM root node ID where root view resides, framework renders root view within this node.
|
|
1123
|
-
* This field is required, defaults to "root".
|
|
1124
|
-
*/
|
|
1125
|
-
rootId: string;
|
|
1126
|
-
/**
|
|
1127
|
-
* Routing mode.
|
|
1128
|
-
* - `"history"` (default): uses `history.pushState` / `popstate`, clean URLs like `/home`
|
|
1129
|
-
* - `"hash"`: uses URL hash fragment with `#!` prefix, e.g. `#!/home`
|
|
1130
|
-
*/
|
|
1131
|
-
routeMode?: "history" | "hash";
|
|
1132
|
-
/**
|
|
1133
|
-
* Default view path.
|
|
1134
|
-
* Default root view path to load when URL doesn't match any route.
|
|
1135
|
-
*/
|
|
1136
|
-
defaultView?: string;
|
|
1137
|
-
/**
|
|
1138
|
-
* Default path when no hash present,
|
|
1139
|
-
* Path used when URL hash is empty, defaults to "/".
|
|
1140
|
-
*/
|
|
1141
|
-
defaultPath?: string;
|
|
1142
|
-
/**
|
|
1143
|
-
* Route mapping: path -> view.
|
|
1144
|
-
* Mapping relationship between paths and views.
|
|
1145
|
-
* - Simple mapping: `{ "/home": "app/views/home" }`
|
|
1146
|
-
* - Config mapping: `{ "/detail": { view: "app/views/detail", title: "Detail" } }`
|
|
1147
|
-
* Use rewrite config item for path rewriting logic.
|
|
1148
|
-
*/
|
|
1149
|
-
routes?: Record<string, string | RouteViewConfig>;
|
|
1150
|
-
/** Hashbang prefix (only used in hash mode) */
|
|
1151
|
-
hashbang?: string;
|
|
1152
|
-
/**
|
|
1153
|
-
* Error handler.
|
|
1154
|
-
* Global error handling function, framework uses try-catch to execute some core logic.
|
|
1155
|
-
* When errors are thrown, allows developers to catch them via this config item.
|
|
1156
|
-
* Note: Do not re-throw any errors in this method.
|
|
1157
|
-
*/
|
|
1158
|
-
error?: (error: Error) => void;
|
|
1159
|
-
/**
|
|
1160
|
-
* Extensions to load.
|
|
1161
|
-
* Array of extension view paths to load during app startup.
|
|
1162
|
-
* These extension views are loaded before app initialization.
|
|
1163
|
-
*/
|
|
1164
|
-
extensions?: string[];
|
|
1165
|
-
/** Init module to load */
|
|
1166
|
-
initModule?: string;
|
|
1167
|
-
/** Rewrite function for routes */
|
|
1168
|
-
rewrite?: (path: string, params: Record<string, string>, routes: Record<string, string>) => string;
|
|
1169
|
-
/**
|
|
1170
|
-
* Unmatched view (404).
|
|
1171
|
-
* View path to use when no matching view is found in routes, e.g., 404 page.
|
|
1172
|
-
*/
|
|
1173
|
-
unmatchedView?: string;
|
|
1174
|
-
/**
|
|
1175
|
-
* Module require function for asynchronous view loading.
|
|
1176
|
-
* Called by `Framework.use()` when a view class is not found in the registry.
|
|
1177
|
-
* Integrate with Webpack Module Federation or other dynamic loading strategies.
|
|
1178
|
-
*
|
|
1179
|
-
* @param names - Array of module names to load (e.g., `["remote-app/views/home"]`)
|
|
1180
|
-
* @param params - Optional parameters passed to the module initializer
|
|
1181
|
-
* @returns Promise resolving to an array of loaded modules, or undefined if not available
|
|
1182
|
-
*/
|
|
1183
|
-
require?: (names: string[], params?: Record<string, unknown>) => Promise<unknown[]> | undefined;
|
|
1184
|
-
/** Skip view rendered check */
|
|
1185
|
-
skipViewRendered?: boolean;
|
|
1186
|
-
/**
|
|
1187
|
-
* Project name of the current application.
|
|
1188
|
-
* Used by the micro-frontend bridge to determine if a view path
|
|
1189
|
-
* belongs to the current project or a remote project.
|
|
1190
|
-
*/
|
|
1191
|
-
projectName?: string;
|
|
1192
|
-
/**
|
|
1193
|
-
* Cross-site (micro-frontend) configuration list.
|
|
1194
|
-
* Defines remote projects that can be loaded via Module Federation.
|
|
1195
|
-
* Also accessible via `window.crossConfigs` for build-time injection.
|
|
1196
|
-
*/
|
|
1197
|
-
crossConfigs?: CrossSiteConfig[];
|
|
1198
|
-
/** Default false. */
|
|
1199
|
-
virtualDom?: boolean;
|
|
1200
|
-
/** Dynamic config access, custom config items */
|
|
1201
|
-
[key: string]: unknown;
|
|
1202
|
-
}
|
|
1203
|
-
export interface RouteViewConfig {
|
|
1204
|
-
/** View path */
|
|
1205
|
-
view: string;
|
|
1206
|
-
/** Additional properties merged into location */
|
|
1207
|
-
[key: string]: unknown;
|
|
1208
|
-
}
|
|
1209
|
-
/**
|
|
1210
|
-
* Configuration for a remote (cross-site) project in the micro-frontend setup.
|
|
1211
|
-
* Each entry defines how to load views from a different project via Module Federation.
|
|
1212
|
-
*/
|
|
1213
|
-
export interface CrossSiteConfig {
|
|
1214
|
-
/** Project name, used as the prefix in view paths (e.g., "remote-app" in "remote-app/views/home") */
|
|
1215
|
-
projectName: string;
|
|
1216
|
-
/**
|
|
1217
|
-
* Remote source URL or Module Federation remote name.
|
|
1218
|
-
* For Webpack MF: the remote entry URL (e.g., "remote_app@//cdn.example.com/remote-app/remoteEntry.js")
|
|
1219
|
-
*/
|
|
1220
|
-
source: string;
|
|
1221
|
-
/** Optional API host for the remote project */
|
|
1222
|
-
apiHost?: string;
|
|
1223
|
-
/** Optional business code for multi-tenant scenarios */
|
|
1224
|
-
bizCode?: string;
|
|
1225
|
-
}
|
|
1226
|
-
/** Element with DOM diff cached compare key */
|
|
1227
|
-
export interface DomElement extends Element {
|
|
1228
|
-
/** Whether compare key is cached */
|
|
1229
|
-
compareKeyCached?: number | undefined;
|
|
1230
|
-
/** Cached compare key */
|
|
1231
|
-
cachedCompareKey?: string | undefined;
|
|
1232
|
-
/** Whether auto-generated ID */
|
|
1233
|
-
autoId?: number;
|
|
1234
|
-
}
|
|
1235
|
-
/** Element with frame binding */
|
|
1236
|
-
export interface FrameBoundElement extends HTMLElement {
|
|
1237
|
-
/** Frame instance bound to this element */
|
|
1238
|
-
frame?: FrameInterface;
|
|
1239
|
-
/** Whether frame is bound (1 = bound) */
|
|
1240
|
-
frameBound?: number;
|
|
1241
|
-
/** View rendered flag */
|
|
1242
|
-
viewRendered?: number;
|
|
1243
|
-
/** Range frame ID */
|
|
1244
|
-
rangeFrameId?: string;
|
|
1245
|
-
/** Range element guid */
|
|
1246
|
-
rangeElementGuid?: number;
|
|
1247
|
-
}
|
|
1248
|
-
/** Options for compileTemplate() */
|
|
1249
|
-
export interface CompileOptions {
|
|
1250
|
-
/** Enable debug mode with line tracking (default: false) */
|
|
1251
|
-
debug?: boolean;
|
|
1252
|
-
/** Global variable names to destructure from $$ (refData) */
|
|
1253
|
-
globalVars?: string[];
|
|
1254
|
-
/** File path for debug error messages (default: undefined) */
|
|
1255
|
-
file?: string;
|
|
1256
|
-
/** Generate VDOM output instead of HTML string (default: false) */
|
|
1257
|
-
virtualDom?: boolean;
|
|
1258
|
-
}
|
|
1259
|
-
export {};
|