@lark.js/mvc 0.0.9 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -32
- package/dist/chunk-RIV4NK3K.js +108 -0
- package/dist/compiler.cjs +733 -193
- package/dist/compiler.d.cts +35 -35
- package/dist/compiler.d.ts +35 -35
- package/dist/compiler.js +730 -193
- package/dist/devtool.cjs +3421 -0
- package/dist/devtool.d.cts +83 -0
- package/dist/devtool.d.ts +83 -0
- package/dist/devtool.js +3333 -0
- package/dist/index.cjs +811 -319
- package/dist/index.d.cts +247 -491
- package/dist/index.d.ts +247 -491
- package/dist/index.js +808 -280
- package/dist/rspack.cjs +15978 -0
- package/dist/rspack.d.cts +122 -0
- package/dist/rspack.d.ts +122 -0
- package/dist/{chunk-3HSA7OHB.js → rspack.js} +809 -193
- package/dist/runtime.cjs +35 -10
- package/dist/runtime.d.cts +22 -13
- package/dist/runtime.d.ts +22 -13
- package/dist/runtime.js +13 -34
- package/dist/vite.cjs +753 -195
- package/dist/vite.d.cts +3 -0
- package/dist/vite.d.ts +3 -0
- package/dist/vite.js +15917 -10
- package/dist/webpack.cjs +798 -201
- package/dist/webpack.d.cts +60 -4
- package/dist/webpack.d.ts +60 -4
- package/dist/webpack.js +15962 -14
- package/package.json +25 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lark framework constants.
|
|
3
|
+
*/
|
|
4
|
+
/** Internal splitter character (U+001E Record Separator, invisible, used as namespace separator).
|
|
5
|
+
* Uses String.fromCharCode to survive bundlers that strip control-char literals. */
|
|
6
|
+
declare const SPLITTER: string;
|
|
7
|
+
declare const RouterEvents: {
|
|
8
|
+
CHANGE: string;
|
|
9
|
+
CHANGED: string;
|
|
10
|
+
PAGE_UNLOAD: string;
|
|
11
|
+
};
|
|
12
|
+
/** Attribute name: v-lark */
|
|
13
|
+
declare const LARK_VIEW = "v-lark";
|
|
14
|
+
/** View event method regex: e.g. "app\x1eclickHandler(click)" or "clickHandler()"
|
|
15
|
+
* Group 1: optional frame ID (before SPLITTER)
|
|
16
|
+
* Group 2: handler name
|
|
17
|
+
* Group 3: params string
|
|
18
|
+
*/
|
|
19
|
+
declare const EVENT_METHOD_REGEXP: RegExp;
|
|
20
|
+
/** View event method name regex: e.g. "name<click,mousedown>" or "$selector<click>" */
|
|
21
|
+
declare const VIEW_EVENT_METHOD_REGEXP: RegExp;
|
|
22
|
+
/** Tag name regexp for I_GetNode */
|
|
23
|
+
declare const TAG_NAME_REGEXP: RegExp;
|
|
24
|
+
/** Async task break time (ms) */
|
|
25
|
+
declare const CALL_BREAK_TIME = 48;
|
|
26
|
+
/** Increment global counter and return new value */
|
|
27
|
+
declare function nextCounter(): number;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Dynamically inject CSS styles into the document head.
|
|
31
|
+
* Returns a cleanup function to remove the injected styles.
|
|
32
|
+
*
|
|
33
|
+
* @param styleIdOrPairs - Style ID string or array of [id, content] pairs
|
|
34
|
+
* @param css - CSS content string (only used when first arg is string)
|
|
35
|
+
* @returns Cleanup function to remove the styles
|
|
36
|
+
*/
|
|
37
|
+
declare function applyStyle(styleIdOrPairs: string | string[], css?: string): () => void;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Mark/Unmark: signature-based lifecycle tracking for async callbacks.
|
|
41
|
+
*
|
|
42
|
+
* `mark(host, key)` returns a validity checker. The checker returns `false`
|
|
43
|
+
* once the host is unmarked (e.g. when a view re-renders or is destroyed),
|
|
44
|
+
* so stale async callbacks can short-circuit and skip work.
|
|
45
|
+
*
|
|
46
|
+
* State is stored in a module-level WeakMap, not on the host object, so
|
|
47
|
+
* `mark/unmark` never pollutes user objects with magic keys, never breaks
|
|
48
|
+
* on `Object.freeze`-ed inputs, and never shows up in debug snapshots.
|
|
49
|
+
*/
|
|
50
|
+
/**
|
|
51
|
+
* Create a mark for tracking async callback validity.
|
|
52
|
+
* Returns a function that returns true while the mark is still valid.
|
|
53
|
+
*
|
|
54
|
+
* @param host - Object to associate the mark with (typically a view)
|
|
55
|
+
* @param key - Key to track (typically "render" or a specific async-op identifier)
|
|
56
|
+
*/
|
|
57
|
+
declare function mark(host: object, key: string): () => boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Clear all marks for a host object, invalidating every existing checker.
|
|
60
|
+
* Called when a view re-renders or is destroyed.
|
|
61
|
+
*
|
|
62
|
+
* @param host - Object whose marks should be invalidated
|
|
63
|
+
*/
|
|
64
|
+
declare function unmark(host: object): void;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Safeguard: Proxy-based debug protection for data objects.
|
|
68
|
+
*
|
|
69
|
+
* In DEBUG mode, wraps data objects with Proxy to:
|
|
70
|
+
* 1. Warn when data is read from a different page than where it was set
|
|
71
|
+
* 2. Prevent direct mutation (forces use of State.set/digest)
|
|
72
|
+
* 3. Track access patterns for debugging
|
|
73
|
+
*/
|
|
74
|
+
/**
|
|
75
|
+
* Wrap data with a Proxy for debug-mode protection.
|
|
76
|
+
* Only active when window.__lark_Debug is true and Proxy is available.
|
|
77
|
+
*
|
|
78
|
+
* @param data - Data to wrap
|
|
79
|
+
* @param getter - Optional callback when properties are read
|
|
80
|
+
* @param setter - Optional callback when properties are written
|
|
81
|
+
* @param isRoot - Whether this is the root data object
|
|
82
|
+
* @returns Proxied data or original data if debug mode is off
|
|
83
|
+
*/
|
|
84
|
+
declare function safeguard<T>(data: T, getter?: ((key: string) => void) | null, setter?: ((path: string, value: unknown) => void) | null, isRoot?: boolean): T;
|
|
85
|
+
|
|
1
86
|
/**
|
|
2
87
|
* Multi-cast event emitter class.
|
|
3
88
|
*
|
|
@@ -59,8 +144,6 @@ declare class View implements ViewInterface {
|
|
|
59
144
|
observedStateKeys?: string[];
|
|
60
145
|
/** Resource map */
|
|
61
146
|
resources: Record<string, ViewResourceEntry>;
|
|
62
|
-
/** Assign method reference */
|
|
63
|
-
assignMethod?: AnyFunc;
|
|
64
147
|
/** Whether endUpdate pending */
|
|
65
148
|
endUpdatePending?: number;
|
|
66
149
|
/** Internal event storage */
|
|
@@ -303,15 +386,15 @@ declare class Frame extends EventEmitter implements FrameInterface {
|
|
|
303
386
|
/**
|
|
304
387
|
* Unmount a child frame.
|
|
305
388
|
*/
|
|
306
|
-
unmountFrame(id?: string
|
|
389
|
+
unmountFrame(id?: string): void;
|
|
307
390
|
/**
|
|
308
391
|
* Mount all views in a zone.
|
|
309
392
|
*/
|
|
310
|
-
mountZone(zoneId?: string
|
|
393
|
+
mountZone(zoneId?: string): void;
|
|
311
394
|
/**
|
|
312
395
|
* Unmount all views in a zone.
|
|
313
396
|
*/
|
|
314
|
-
unmountZone(zoneId?: string
|
|
397
|
+
unmountZone(zoneId?: string): void;
|
|
315
398
|
/**
|
|
316
399
|
* Get all child frame IDs.
|
|
317
400
|
*/
|
|
@@ -363,15 +446,6 @@ declare class Frame extends EventEmitter implements FrameInterface {
|
|
|
363
446
|
* `Framework.boot()` is the canonical caller; user code rarely needs this.
|
|
364
447
|
*/
|
|
365
448
|
static createRoot(rootId?: string): Frame;
|
|
366
|
-
/**
|
|
367
|
-
* @deprecated Use `Frame.getRoot()` for read-only access or
|
|
368
|
-
* `Frame.createRoot(id)` to create the root explicitly. The single-method
|
|
369
|
-
* `root()` blurred the distinction and was a common source of bugs in
|
|
370
|
-
* Micro-Frontend hosts.
|
|
371
|
-
*
|
|
372
|
-
* Kept for backward compatibility — behavior unchanged.
|
|
373
|
-
*/
|
|
374
|
-
static root(rootId?: string): Frame;
|
|
375
449
|
/** Bind event listener (static) */
|
|
376
450
|
static on(event: string, handler: AnyFunc): typeof Frame;
|
|
377
451
|
/** Unbind event listener (static) */
|
|
@@ -380,75 +454,6 @@ declare class Frame extends EventEmitter implements FrameInterface {
|
|
|
380
454
|
static fire(event: string, data?: Record<string, unknown>): void;
|
|
381
455
|
}
|
|
382
456
|
|
|
383
|
-
/**
|
|
384
|
-
* Cache class with LFU-style eviction.
|
|
385
|
-
* Keys are prefixed with SPLITTER for namespace isolation.
|
|
386
|
-
*
|
|
387
|
-
* @example
|
|
388
|
-
* const cache = new Cache({ maxSize: 20, bufferSize: 5 });
|
|
389
|
-
* cache.set('user', { name: 'Alice' });
|
|
390
|
-
* const user = cache.get('user');
|
|
391
|
-
* cache.has('user'); // true
|
|
392
|
-
* cache.del('user');
|
|
393
|
-
*/
|
|
394
|
-
declare class Cache<T = unknown> implements CacheInterface<T> {
|
|
395
|
-
/** Cache entries array */
|
|
396
|
-
private entries;
|
|
397
|
-
/** Fast lookup: prefixed key -> entry */
|
|
398
|
-
private lookup;
|
|
399
|
-
/** Buffer size for eviction */
|
|
400
|
-
private readonly bufferSize;
|
|
401
|
-
/** Maximum cache size */
|
|
402
|
-
private readonly maxSize;
|
|
403
|
-
/** Total capacity (maxSize + bufferSize) */
|
|
404
|
-
private readonly capacity;
|
|
405
|
-
/** Callback when entry is removed */
|
|
406
|
-
private readonly onRemove?;
|
|
407
|
-
/** Sort comparator */
|
|
408
|
-
private readonly comparator;
|
|
409
|
-
constructor(options?: CacheOptions<T>);
|
|
410
|
-
/** Prefix a key with SPLITTER for namespace isolation */
|
|
411
|
-
private prefixKey;
|
|
412
|
-
/**
|
|
413
|
-
* Get a cached value by key.
|
|
414
|
-
* Updates frequency and timestamp for cache sorting.
|
|
415
|
-
*/
|
|
416
|
-
get(key: string): T | undefined;
|
|
417
|
-
/**
|
|
418
|
-
* Iterate all cached values.
|
|
419
|
-
*/
|
|
420
|
-
forEach(callback: (value: T | undefined) => void): void;
|
|
421
|
-
/**
|
|
422
|
-
* Set or update a cached value.
|
|
423
|
-
* If key already exists, updates value and increments frequency.
|
|
424
|
-
* If cache exceeds capacity, triggers eviction.
|
|
425
|
-
*/
|
|
426
|
-
set(key: string, value: T): void;
|
|
427
|
-
/**
|
|
428
|
-
* Delete a cached entry. Removes it immediately from both the lookup map
|
|
429
|
-
* and the entries array so the GC can reclaim the value without waiting
|
|
430
|
-
* for the next eviction sweep.
|
|
431
|
-
*/
|
|
432
|
-
del(key: string): void;
|
|
433
|
-
/**
|
|
434
|
-
* Check if a key exists in cache.
|
|
435
|
-
*/
|
|
436
|
-
has(key: string): boolean;
|
|
437
|
-
/** Get current cache size */
|
|
438
|
-
get size(): number;
|
|
439
|
-
/** Clear all entries */
|
|
440
|
-
clear(): void;
|
|
441
|
-
/**
|
|
442
|
-
* Evict the `bufferSize` worst entries from the cache.
|
|
443
|
-
*
|
|
444
|
-
* Uses single-pass partial selection (O(n·k)) instead of sorting the entire
|
|
445
|
-
* `entries` array (O(n log n)). For the typical `bufferSize = 5` this is
|
|
446
|
-
* effectively a linear scan with at most 5 in-bucket comparisons per
|
|
447
|
-
* iteration — and it avoids mutating the rest of `entries`.
|
|
448
|
-
*/
|
|
449
|
-
private evictEntries;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
457
|
/**
|
|
453
458
|
* Lark framework type definitions.
|
|
454
459
|
* All shared types are defined here to eliminate type cheats across modules.
|
|
@@ -660,6 +665,68 @@ interface DomRef {
|
|
|
660
665
|
* Comment), so the child slots are typed as ChildNode.
|
|
661
666
|
*/
|
|
662
667
|
type DomOp = [1, Element, ChildNode] | [2, Element, ChildNode] | [4, Element, ChildNode, ChildNode] | [8, Element, ChildNode, ChildNode];
|
|
668
|
+
/**
|
|
669
|
+
* Virtual DOM node. Produced by `vdomCreate`, consumed by the VDOM diff engine.
|
|
670
|
+
*
|
|
671
|
+
* Property semantics:
|
|
672
|
+
* - Text nodes: tag = 0 (V_TEXT_NODE), html = text content
|
|
673
|
+
* - Element nodes: tag = string, attrs = serialized opening tag, children = child VDomNodes
|
|
674
|
+
* - Raw HTML nodes: tag = SPLITTER (\x1e), html = raw HTML string
|
|
675
|
+
* - Self-closing: selfClose = true (children param was 1)
|
|
676
|
+
*/
|
|
677
|
+
interface VDomNode {
|
|
678
|
+
/** Tag name for elements, 0 (V_TEXT_NODE) for text, SPLITTER for raw HTML */
|
|
679
|
+
tag: string | number;
|
|
680
|
+
/** Inner HTML (serialized children for elements, text content for text nodes) */
|
|
681
|
+
html: string;
|
|
682
|
+
/** Serialized opening tag with attributes, e.g. '<div class="row"' */
|
|
683
|
+
attrs?: string;
|
|
684
|
+
/** Attribute key-value map */
|
|
685
|
+
attrsMap?: Record<string, unknown>;
|
|
686
|
+
/** Attribute names that are set as DOM properties (not attributes) */
|
|
687
|
+
attrsSpecials?: Record<string, string>;
|
|
688
|
+
/** Original specials argument before defaulting (for change detection) */
|
|
689
|
+
hasSpecials?: Record<string, string> | undefined;
|
|
690
|
+
/** Child VDomNode array (undefined for text/raw/self-closing) */
|
|
691
|
+
children?: VDomNode[] | undefined;
|
|
692
|
+
/** Diff key: from id, _, #, or v-lark path */
|
|
693
|
+
compareKey?: string | undefined;
|
|
694
|
+
/** Keyed children count map (compareKey -> count) */
|
|
695
|
+
reused?: Record<string, number> | undefined;
|
|
696
|
+
/** Total count of keyed children */
|
|
697
|
+
reusedTotal?: number;
|
|
698
|
+
/** Sub-view references: [viewPath, owner, uri, params] tuples */
|
|
699
|
+
views?: [string, string, string, Record<string, string>][] | undefined;
|
|
700
|
+
/** Whether self-closing (children param was literal 1) */
|
|
701
|
+
selfClose?: boolean;
|
|
702
|
+
/** Sub-view path if this node hosts a v-lark view, otherwise falsy */
|
|
703
|
+
isLarkView?: string | undefined;
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* VDOM diff operation tracker. Parallel to DomRef but for the VDOM pipeline.
|
|
707
|
+
*/
|
|
708
|
+
interface VDomRef {
|
|
709
|
+
/** View ID (for placeholder replacement) */
|
|
710
|
+
viewId: string;
|
|
711
|
+
/** Sub-views that need re-rendering after diff */
|
|
712
|
+
viewRenders: ViewInterface[];
|
|
713
|
+
/** Deferred DOM property assignments: [element, propName, value][] */
|
|
714
|
+
nodeProps: [Element, string, unknown][];
|
|
715
|
+
/** Pending async operation count */
|
|
716
|
+
asyncCount: number;
|
|
717
|
+
/** Whether the DOM actually changed */
|
|
718
|
+
changed: number;
|
|
719
|
+
/** DOM mutation operations (same format as DomOp) */
|
|
720
|
+
domOps: DomOp[];
|
|
721
|
+
}
|
|
722
|
+
/** VDOM node creation function signature (vdomCreate) */
|
|
723
|
+
type VDomCreateFn = (tag: string | number, props?: Record<string, unknown> | number | null, children?: VDomNode[] | number | null, specials?: Record<string, string>) => VDomNode;
|
|
724
|
+
/**
|
|
725
|
+
* VDOM template function signature.
|
|
726
|
+
* The compiled template imports vdomCreate via ES module import and
|
|
727
|
+
* takes only (data, viewId, refData). Extra arguments are ignored.
|
|
728
|
+
*/
|
|
729
|
+
type VDomTemplate = (data: unknown, viewId: string, refData: unknown) => VDomNode;
|
|
663
730
|
interface FrameInvokeEntry {
|
|
664
731
|
/** Method name */
|
|
665
732
|
name: string;
|
|
@@ -853,7 +920,7 @@ interface ViewInterface extends EventEmitterInterface<ViewInterface> {
|
|
|
853
920
|
* View template function. Receives data + viewId + refData and a set of
|
|
854
921
|
* encoder helpers wired in by the Updater, and returns the rendered HTML.
|
|
855
922
|
*/
|
|
856
|
-
template?: ViewTemplate;
|
|
923
|
+
template?: ViewTemplate | VDomTemplate;
|
|
857
924
|
/**
|
|
858
925
|
* Mixin object array for extending view functionality.
|
|
859
926
|
* Framework merges properties and methods from mixins into view prototype.
|
|
@@ -872,10 +939,10 @@ interface ViewInterface extends EventEmitterInterface<ViewInterface> {
|
|
|
872
939
|
eventObjectMap: Record<string, number>;
|
|
873
940
|
/** Global event list */
|
|
874
941
|
globalEventList: ViewGlobalEventEntry[];
|
|
875
|
-
/** Assign method reference */
|
|
876
|
-
assignMethod?: AnyFunc;
|
|
877
942
|
/** Whether endUpdate has been called (1 = pending) */
|
|
878
943
|
endUpdatePending?: number;
|
|
944
|
+
/** Last rendered VDOM tree (only used when virtualDom is enabled) */
|
|
945
|
+
vdom?: VDomNode;
|
|
879
946
|
/** Render method (wrapped) */
|
|
880
947
|
render(): void;
|
|
881
948
|
/**
|
|
@@ -1022,18 +1089,17 @@ interface FrameInterface extends EventEmitterInterface<FrameInterface> {
|
|
|
1022
1089
|
* Unmount child Frame from specified DOM node.
|
|
1023
1090
|
* @param id DOM node ID, defaults to current Frame if omitted
|
|
1024
1091
|
*/
|
|
1025
|
-
unmountFrame: (id?: string
|
|
1092
|
+
unmountFrame: (id?: string) => void;
|
|
1026
1093
|
/**
|
|
1027
1094
|
* Render all child views under specified node (scans v-lark attributes and mounts).
|
|
1028
1095
|
* @param zoneId DOM node ID, defaults to current Frame
|
|
1029
|
-
* @param inner Whether this is an internal framework call
|
|
1030
1096
|
*/
|
|
1031
|
-
mountZone: (zoneId?: string
|
|
1097
|
+
mountZone: (zoneId?: string) => void;
|
|
1032
1098
|
/**
|
|
1033
1099
|
* Unmount all child views under specified node.
|
|
1034
1100
|
* @param zoneId DOM node ID, defaults to current Frame
|
|
1035
1101
|
*/
|
|
1036
|
-
unmountZone: (zoneId?: string
|
|
1102
|
+
unmountZone: (zoneId?: string) => void;
|
|
1037
1103
|
/**
|
|
1038
1104
|
* Get ancestor Frame, defaults to parent Frame (level=1).
|
|
1039
1105
|
* @param level Levels to traverse upward, defaults to 1
|
|
@@ -1254,24 +1320,6 @@ interface ServiceOptions {
|
|
|
1254
1320
|
/** POST data */
|
|
1255
1321
|
data?: unknown;
|
|
1256
1322
|
}
|
|
1257
|
-
interface PayloadEntry {
|
|
1258
|
-
/** Payload data */
|
|
1259
|
-
data: Record<string, unknown>;
|
|
1260
|
-
}
|
|
1261
|
-
interface ServiceEntry {
|
|
1262
|
-
/** Service ID */
|
|
1263
|
-
id: string;
|
|
1264
|
-
/** Service URL */
|
|
1265
|
-
url: string;
|
|
1266
|
-
/** Cache time in ms, 0 = no cache */
|
|
1267
|
-
cacheTime: number;
|
|
1268
|
-
/** Payload instance */
|
|
1269
|
-
payload?: PayloadEntry;
|
|
1270
|
-
/** Whether loading */
|
|
1271
|
-
loading?: boolean;
|
|
1272
|
-
/** Error info */
|
|
1273
|
-
error?: Error;
|
|
1274
|
-
}
|
|
1275
1323
|
/** Pending cache entry for deduplication (internal to Service) */
|
|
1276
1324
|
interface PendingCacheEntry extends Array<unknown> {
|
|
1277
1325
|
/** Reference to the pending Payload entity */
|
|
@@ -1321,103 +1369,6 @@ interface ServiceMetaEntry {
|
|
|
1321
1369
|
/** Additional properties */
|
|
1322
1370
|
[key: string]: unknown;
|
|
1323
1371
|
}
|
|
1324
|
-
interface ServiceInternals {
|
|
1325
|
-
metaList: Record<string, ServiceMetaEntry>;
|
|
1326
|
-
payloadCache: CacheInterface<PayloadInterface>;
|
|
1327
|
-
pendingCacheKeys: Record<string, PendingCacheEntry>;
|
|
1328
|
-
syncFn: (payload: PayloadInterface, callback: () => void) => void;
|
|
1329
|
-
staticEmitter: EventEmitterInterface;
|
|
1330
|
-
}
|
|
1331
|
-
interface ServiceInterface {
|
|
1332
|
-
id: string;
|
|
1333
|
-
destroyed: number;
|
|
1334
|
-
busy: number;
|
|
1335
|
-
taskQueue: AnyFunc[];
|
|
1336
|
-
prevArgs: unknown[];
|
|
1337
|
-
emitter: EventEmitterInterface;
|
|
1338
|
-
internals: ServiceInternals;
|
|
1339
|
-
/**
|
|
1340
|
-
* Send all requests in parallel, execute done callback when all requests complete (success or failure).
|
|
1341
|
-
* If endpoint specifies cache and cache is valid, uses cached data directly.
|
|
1342
|
-
* @param metaList Endpoint name string, params object, or array of them
|
|
1343
|
-
* @param done Callback when all requests complete, first param is error array, followed by each endpoint's Payload
|
|
1344
|
-
*/
|
|
1345
|
-
all(metaList: string | Record<string, unknown> | (string | Record<string, unknown>)[], done: AnyFunc): ServiceInterface;
|
|
1346
|
-
/**
|
|
1347
|
-
* Execute callback after each request succeeds, callback may be called multiple times.
|
|
1348
|
-
* @param metaList Endpoint name string, params object, or array of them
|
|
1349
|
-
* @param done Callback
|
|
1350
|
-
*/
|
|
1351
|
-
one(attrs: string | Record<string, unknown> | (string | Record<string, unknown>)[], done: AnyFunc): ServiceInterface;
|
|
1352
|
-
/**
|
|
1353
|
-
* Similar to all, but always skips cache and forces actual requests.
|
|
1354
|
-
* @param metaList Endpoint name string, params object, or array of them
|
|
1355
|
-
* @param done Callback
|
|
1356
|
-
*/
|
|
1357
|
-
save(metaList: string | Record<string, unknown> | (string | Record<string, unknown>)[], done: AnyFunc): ServiceInterface;
|
|
1358
|
-
/**
|
|
1359
|
-
* Queue task for execution, executes next task after previous all/one/save task completes, similar to Promise chain.
|
|
1360
|
-
* @param callback Callback invoked after task completes
|
|
1361
|
-
*/
|
|
1362
|
-
enqueue(callback: AnyFunc): ServiceInterface;
|
|
1363
|
-
/**
|
|
1364
|
-
* Dequeue and execute next task in queue.
|
|
1365
|
-
*/
|
|
1366
|
-
dequeue(...args: unknown[]): void;
|
|
1367
|
-
/**
|
|
1368
|
-
* Destroy current Service instance, cannot send new requests or invoke callbacks after destruction.
|
|
1369
|
-
*/
|
|
1370
|
-
destroy(): void;
|
|
1371
|
-
/**
|
|
1372
|
-
* Add endpoint metadata, register one or more API endpoints.
|
|
1373
|
-
* @param metaList Endpoint metadata array, or single metadata object
|
|
1374
|
-
*/
|
|
1375
|
-
add(attrs: ServiceMetaEntry | ServiceMetaEntry[]): void;
|
|
1376
|
-
/**
|
|
1377
|
-
* Get metadata object.
|
|
1378
|
-
* @param attrs Endpoint metadata object or name string
|
|
1379
|
-
*/
|
|
1380
|
-
meta(attrs: string | Record<string, unknown>): ServiceMetaEntry;
|
|
1381
|
-
/**
|
|
1382
|
-
* Create Payload object from endpoint metadata.
|
|
1383
|
-
* @param meta Endpoint metadata object or name string
|
|
1384
|
-
*/
|
|
1385
|
-
create(meta: Record<string, unknown>): PayloadInterface;
|
|
1386
|
-
/**
|
|
1387
|
-
* Get or create Payload object from cache.
|
|
1388
|
-
* @param meta Endpoint metadata object
|
|
1389
|
-
* @param createNew Whether to create new Payload object; if false, prioritizes getting from cache
|
|
1390
|
-
*/
|
|
1391
|
-
get(meta: Record<string, unknown>, createNew?: boolean): {
|
|
1392
|
-
entity: PayloadInterface;
|
|
1393
|
-
needsUpdate: boolean;
|
|
1394
|
-
};
|
|
1395
|
-
/**
|
|
1396
|
-
* Get Payload object from cache, returns undefined if cache doesn't exist or has expired.
|
|
1397
|
-
* @param meta Endpoint metadata object
|
|
1398
|
-
*/
|
|
1399
|
-
cached(meta: Record<string, unknown>): PayloadInterface | undefined;
|
|
1400
|
-
/**
|
|
1401
|
-
* Clear cached data for specified endpoint.
|
|
1402
|
-
* @param names Comma-separated endpoint name string or string array
|
|
1403
|
-
*/
|
|
1404
|
-
clear(names: string | string[]): void;
|
|
1405
|
-
/**
|
|
1406
|
-
* Inherit to create new Service subclass, bind custom data sync function.
|
|
1407
|
-
* @param sync Method to sync data, typically exchanges data with server
|
|
1408
|
-
* @param cacheMax Maximum cache entries
|
|
1409
|
-
* @param cacheBuffer Cache buffer size
|
|
1410
|
-
*/
|
|
1411
|
-
extend(newSyncFn: (payload: PayloadInterface, callback: () => void) => void, newCacheMax?: number, newCacheBuffer?: number): ServiceInterface;
|
|
1412
|
-
/**
|
|
1413
|
-
* Triggered before endpoint sends request.
|
|
1414
|
-
*/
|
|
1415
|
-
onBegin?: (e?: ServiceEvent) => void;
|
|
1416
|
-
/**
|
|
1417
|
-
* Triggered when endpoint request completes, whether success or failure.
|
|
1418
|
-
*/
|
|
1419
|
-
onEnd?: (e?: ServiceEvent) => void;
|
|
1420
|
-
}
|
|
1421
1372
|
/** Cache info attached to Payload entity */
|
|
1422
1373
|
interface ServiceCacheInfo {
|
|
1423
1374
|
/** Endpoint name */
|
|
@@ -1633,7 +1584,7 @@ interface FrameworkInterface {
|
|
|
1633
1584
|
}
|
|
1634
1585
|
/**
|
|
1635
1586
|
* Framework configuration interface, global config passed to app during `Framework.boot()`.
|
|
1636
|
-
* All config items can be accessed at runtime via `Framework.
|
|
1587
|
+
* All config items can be accessed at runtime via `Framework.getConfig('key')`.
|
|
1637
1588
|
*/
|
|
1638
1589
|
interface FrameworkConfig {
|
|
1639
1590
|
/**
|
|
@@ -1715,7 +1666,7 @@ interface FrameworkConfig {
|
|
|
1715
1666
|
*/
|
|
1716
1667
|
crossConfigs?: CrossSiteConfig[];
|
|
1717
1668
|
/** Default false. */
|
|
1718
|
-
|
|
1669
|
+
virtualDom?: boolean;
|
|
1719
1670
|
/** Dynamic config access, custom config items */
|
|
1720
1671
|
[key: string]: unknown;
|
|
1721
1672
|
}
|
|
@@ -1772,153 +1723,80 @@ interface CompileOptions {
|
|
|
1772
1723
|
globalVars?: string[];
|
|
1773
1724
|
/** File path for debug error messages (default: undefined) */
|
|
1774
1725
|
file?: string;
|
|
1726
|
+
/** Generate VDOM output instead of HTML string (default: false) */
|
|
1727
|
+
virtualDom?: boolean;
|
|
1728
|
+
/** Use SWC instead of Babel for parsing (default: false) */
|
|
1729
|
+
useSwc?: boolean;
|
|
1775
1730
|
}
|
|
1776
1731
|
|
|
1777
1732
|
/**
|
|
1778
|
-
*
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
/** Check if value is a plain object (not null, not array, typeof object) */
|
|
1782
|
-
declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
1783
|
-
/** Check if value is primitive or function (not a complex object) */
|
|
1784
|
-
declare function isPrimitiveOrFunc(value: unknown): boolean;
|
|
1785
|
-
/** Check if value is primitive (not object, not function) */
|
|
1786
|
-
declare function isPrimitive(value: unknown): boolean;
|
|
1787
|
-
declare function generateId(prefix?: string): string;
|
|
1788
|
-
/** Sync local counter with global counter */
|
|
1789
|
-
declare function syncCounter(val: number): void;
|
|
1790
|
-
declare function noop(): void;
|
|
1791
|
-
/** Safe hasOwnProperty check */
|
|
1792
|
-
declare function hasOwnProperty<T extends object>(owner: T | undefined | null, prop: PropertyKey): boolean;
|
|
1793
|
-
/** Get object keys (own enumerable) */
|
|
1794
|
-
declare function keys<T extends object>(obj: T): string[];
|
|
1795
|
-
/** Assign properties from sources to target (like Object.assign but safer) */
|
|
1796
|
-
declare function assign<T extends object>(target: T, ...sources: Partial<T>[]): T;
|
|
1797
|
-
/**
|
|
1798
|
-
* Execute functions in try-catch, ignoring errors.
|
|
1799
|
-
* Returns the result of the last successfully executed function.
|
|
1800
|
-
*/
|
|
1801
|
-
declare function funcWithTry(fns: AnyFunc | AnyFunc[], args: unknown[], context: unknown, configError?: (e: unknown) => void): unknown;
|
|
1802
|
-
/**
|
|
1803
|
-
* Set newData into oldData, tracking changed keys.
|
|
1804
|
-
* Returns whether any value changed.
|
|
1805
|
-
*/
|
|
1806
|
-
declare function setData(newData: Record<string, unknown>, oldData: Record<string, unknown>, changedKeys: Set<string>, excludes: ReadonlySet<string>): boolean;
|
|
1807
|
-
declare function translateData(data: object, value: unknown): unknown;
|
|
1808
|
-
/** Get element by ID, or return the element itself if already an element */
|
|
1809
|
-
declare function getById(id: string | Element | null): Element | null;
|
|
1810
|
-
/** Get attribute from element safely */
|
|
1811
|
-
declare function getAttribute(element: Element, attr: string): string;
|
|
1812
|
-
/** Ensure element has an ID, generating one if missing. Returns the ID. */
|
|
1813
|
-
declare function ensureElementId(element: HTMLElement): string;
|
|
1814
|
-
/**
|
|
1815
|
-
* Check if node A is inside node B (or is the same node).
|
|
1816
|
-
* Uses compareDocumentPosition for efficiency.
|
|
1817
|
-
*/
|
|
1818
|
-
declare function nodeInside(a: string | HTMLElement, b: string | HTMLElement): boolean;
|
|
1819
|
-
/**
|
|
1820
|
-
* Parse URI string into path and params object.
|
|
1821
|
-
* e.g. "/xxx/?a=b&c=d" => { path: "/xxx/", params: { a: "b", c: "d" } }
|
|
1822
|
-
*
|
|
1823
|
-
* The accumulator is function-local, so nested / re-entrant calls
|
|
1824
|
-
* (e.g. invoking `parseUri` again inside a replace callback) are safe.
|
|
1825
|
-
*/
|
|
1826
|
-
declare function parseUri(uri: string): ParsedUri;
|
|
1827
|
-
/**
|
|
1828
|
-
* Convert path and params to URI string.
|
|
1829
|
-
* e.g. toUri("/xxx/", { a: "b", c: "d" }) => "/xxx/?a=b&c=d"
|
|
1830
|
-
*/
|
|
1831
|
-
declare function toUri(path: string, params: Record<string, unknown>, keepEmpty?: ReadonlySet<string>): string;
|
|
1832
|
-
/**
|
|
1833
|
-
* Convert array to map/hash object.
|
|
1834
|
-
* For simple arrays, counts occurrences.
|
|
1835
|
-
* For object arrays, uses specified key as map key.
|
|
1836
|
-
*/
|
|
1837
|
-
declare function toMap<T>(list: T[] | null | undefined, key?: keyof T): Record<string, T | number>;
|
|
1838
|
-
/** Get current timestamp */
|
|
1839
|
-
declare function now(): number;
|
|
1840
|
-
|
|
1841
|
-
/** Internal splitter character (U+001E Record Separator, invisible, used as namespace separator).
|
|
1842
|
-
* Uses String.fromCharCode to survive bundlers that strip control-char literals. */
|
|
1843
|
-
declare const SPLITTER: string;
|
|
1844
|
-
declare const RouterEvents: {
|
|
1845
|
-
CHANGE: string;
|
|
1846
|
-
CHANGED: string;
|
|
1847
|
-
PAGE_UNLOAD: string;
|
|
1848
|
-
};
|
|
1849
|
-
/** Attribute name: v-lark */
|
|
1850
|
-
declare const LARK_VIEW = "v-lark";
|
|
1851
|
-
/** View event method regex: e.g. "app\x1eclickHandler(click)" or "clickHandler()"
|
|
1852
|
-
* Group 1: optional frame ID (before SPLITTER)
|
|
1853
|
-
* Group 2: handler name
|
|
1854
|
-
* Group 3: params string
|
|
1855
|
-
*/
|
|
1856
|
-
declare const EVENT_METHOD_REGEXP: RegExp;
|
|
1857
|
-
/** View event method name regex: e.g. "name<click,mousedown>" or "$selector<click>" */
|
|
1858
|
-
declare const VIEW_EVENT_METHOD_REGEXP: RegExp;
|
|
1859
|
-
/** Tag name regexp for I_GetNode */
|
|
1860
|
-
declare const TAG_NAME_REGEXP: RegExp;
|
|
1861
|
-
/** Async task break time (ms) */
|
|
1862
|
-
declare const CALL_BREAK_TIME = 48;
|
|
1863
|
-
/** Increment global counter and return new value */
|
|
1864
|
-
declare function nextCounter(): number;
|
|
1865
|
-
|
|
1866
|
-
/**
|
|
1867
|
-
* Dynamically inject CSS styles into the document head.
|
|
1868
|
-
* Returns a cleanup function to remove the injected styles.
|
|
1869
|
-
*
|
|
1870
|
-
* @param styleIdOrPairs - Style ID string or array of [id, content] pairs
|
|
1871
|
-
* @param css - CSS content string (only used when first arg is string)
|
|
1872
|
-
* @returns Cleanup function to remove the styles
|
|
1873
|
-
*/
|
|
1874
|
-
declare function applyStyle(styleIdOrPairs: string | string[], css?: string): () => void;
|
|
1875
|
-
|
|
1876
|
-
/**
|
|
1877
|
-
* Mark/Unmark: signature-based lifecycle tracking for async callbacks.
|
|
1878
|
-
*
|
|
1879
|
-
* `mark(host, key)` returns a validity checker. The checker returns `false`
|
|
1880
|
-
* once the host is unmarked (e.g. when a view re-renders or is destroyed),
|
|
1881
|
-
* so stale async callbacks can short-circuit and skip work.
|
|
1882
|
-
*
|
|
1883
|
-
* State is stored in a module-level WeakMap, not on the host object, so
|
|
1884
|
-
* `mark/unmark` never pollutes user objects with magic keys, never breaks
|
|
1885
|
-
* on `Object.freeze`-ed inputs, and never shows up in debug snapshots.
|
|
1886
|
-
*/
|
|
1887
|
-
/**
|
|
1888
|
-
* Create a mark for tracking async callback validity.
|
|
1889
|
-
* Returns a function that returns true while the mark is still valid.
|
|
1890
|
-
*
|
|
1891
|
-
* @param host - Object to associate the mark with (typically a view)
|
|
1892
|
-
* @param key - Key to track (typically "render" or a specific async-op identifier)
|
|
1893
|
-
*/
|
|
1894
|
-
declare function mark(host: object, key: string): () => boolean;
|
|
1895
|
-
/**
|
|
1896
|
-
* Clear all marks for a host object, invalidating every existing checker.
|
|
1897
|
-
* Called when a view re-renders or is destroyed.
|
|
1898
|
-
*
|
|
1899
|
-
* @param host - Object whose marks should be invalidated
|
|
1900
|
-
*/
|
|
1901
|
-
declare function unmark(host: object): void;
|
|
1902
|
-
|
|
1903
|
-
/**
|
|
1904
|
-
* Safeguard: Proxy-based debug protection for data objects.
|
|
1905
|
-
*
|
|
1906
|
-
* In DEBUG mode, wraps data objects with Proxy to:
|
|
1907
|
-
* 1. Warn when data is read from a different page than where it was set
|
|
1908
|
-
* 2. Prevent direct mutation (forces use of State.set/digest)
|
|
1909
|
-
* 3. Track access patterns for debugging
|
|
1910
|
-
*/
|
|
1911
|
-
/**
|
|
1912
|
-
* Wrap data with a Proxy for debug-mode protection.
|
|
1913
|
-
* Only active when window.__lark_Debug is true and Proxy is available.
|
|
1733
|
+
* Cache class with LFU-style eviction.
|
|
1734
|
+
* Keys are prefixed with SPLITTER for namespace isolation.
|
|
1914
1735
|
*
|
|
1915
|
-
* @
|
|
1916
|
-
*
|
|
1917
|
-
*
|
|
1918
|
-
*
|
|
1919
|
-
*
|
|
1736
|
+
* @example
|
|
1737
|
+
* const cache = new Cache({ maxSize: 20, bufferSize: 5 });
|
|
1738
|
+
* cache.set('user', { name: 'Alice' });
|
|
1739
|
+
* const user = cache.get('user');
|
|
1740
|
+
* cache.has('user'); // true
|
|
1741
|
+
* cache.del('user');
|
|
1920
1742
|
*/
|
|
1921
|
-
declare
|
|
1743
|
+
declare class Cache<T = unknown> implements CacheInterface<T> {
|
|
1744
|
+
/** Cache entries array */
|
|
1745
|
+
private entries;
|
|
1746
|
+
/** Fast lookup: prefixed key -> entry */
|
|
1747
|
+
private lookup;
|
|
1748
|
+
/** Buffer size for eviction */
|
|
1749
|
+
private readonly bufferSize;
|
|
1750
|
+
/** Maximum cache size */
|
|
1751
|
+
private readonly maxSize;
|
|
1752
|
+
/** Total capacity (maxSize + bufferSize) */
|
|
1753
|
+
private readonly capacity;
|
|
1754
|
+
/** Callback when entry is removed */
|
|
1755
|
+
private readonly onRemove?;
|
|
1756
|
+
/** Sort comparator */
|
|
1757
|
+
private readonly comparator;
|
|
1758
|
+
constructor(options?: CacheOptions<T>);
|
|
1759
|
+
/** Prefix a key with SPLITTER for namespace isolation */
|
|
1760
|
+
private prefixKey;
|
|
1761
|
+
/**
|
|
1762
|
+
* Get a cached value by key.
|
|
1763
|
+
* Updates frequency and timestamp for cache sorting.
|
|
1764
|
+
*/
|
|
1765
|
+
get(key: string): T | undefined;
|
|
1766
|
+
/**
|
|
1767
|
+
* Iterate all cached values.
|
|
1768
|
+
*/
|
|
1769
|
+
forEach(callback: (value: T | undefined) => void): void;
|
|
1770
|
+
/**
|
|
1771
|
+
* Set or update a cached value.
|
|
1772
|
+
* If key already exists, updates value and increments frequency.
|
|
1773
|
+
* If cache exceeds capacity, triggers eviction.
|
|
1774
|
+
*/
|
|
1775
|
+
set(key: string, value: T): void;
|
|
1776
|
+
/**
|
|
1777
|
+
* Delete a cached entry. Removes it immediately from both the lookup map
|
|
1778
|
+
* and the entries array so the GC can reclaim the value without waiting
|
|
1779
|
+
* for the next eviction sweep.
|
|
1780
|
+
*/
|
|
1781
|
+
del(key: string): void;
|
|
1782
|
+
/**
|
|
1783
|
+
* Check if a key exists in cache.
|
|
1784
|
+
*/
|
|
1785
|
+
has(key: string): boolean;
|
|
1786
|
+
/** Get current cache size */
|
|
1787
|
+
get size(): number;
|
|
1788
|
+
/** Clear all entries */
|
|
1789
|
+
clear(): void;
|
|
1790
|
+
/**
|
|
1791
|
+
* Evict the `bufferSize` worst entries from the cache.
|
|
1792
|
+
*
|
|
1793
|
+
* Uses single-pass partial selection (O(n·k)) instead of sorting the entire
|
|
1794
|
+
* `entries` array (O(n log n)). For the typical `bufferSize = 5` this is
|
|
1795
|
+
* effectively a linear scan with at most 5 in-bucket comparisons per
|
|
1796
|
+
* iteration — and it avoids mutating the rest of `entries`.
|
|
1797
|
+
*/
|
|
1798
|
+
private evictEntries;
|
|
1799
|
+
}
|
|
1922
1800
|
|
|
1923
1801
|
/** Mark framework as booted (called from Framework.boot) */
|
|
1924
1802
|
declare function markBooted(): void;
|
|
@@ -1992,59 +1870,6 @@ declare function resetProjectsMap(): void;
|
|
|
1992
1870
|
*/
|
|
1993
1871
|
declare const CrossSite: typeof View;
|
|
1994
1872
|
|
|
1995
|
-
/**
|
|
1996
|
-
* Unmount frames within a DOM node.
|
|
1997
|
-
*/
|
|
1998
|
-
declare function domUnmountFrames(frame: FrameInterface, node: ChildNode): void;
|
|
1999
|
-
/**
|
|
2000
|
-
* Parse HTML string into a DOM element.
|
|
2001
|
-
* Handles special elements (table, SVG, MathML) with wrapper elements.
|
|
2002
|
-
*/
|
|
2003
|
-
declare function domGetNode(html: string, refNode: Element): Element;
|
|
2004
|
-
/**
|
|
2005
|
-
* Get compare key for a DOM node (for keyed diff).
|
|
2006
|
-
* Uses id or v-lark path.
|
|
2007
|
-
*/
|
|
2008
|
-
declare function domGetCompareKey(node: ChildNode): string | undefined;
|
|
2009
|
-
/**
|
|
2010
|
-
* Special diff for form elements (value, checked, selected).
|
|
2011
|
-
* Form elements carry state on the DOM node (e.g. `input.value`) that isn't
|
|
2012
|
-
* reflected in attributes, so we have to sync those properties separately.
|
|
2013
|
-
*/
|
|
2014
|
-
declare function domSpecialDiff(oldNode: ChildNode, newNode: ChildNode): number;
|
|
2015
|
-
/**
|
|
2016
|
-
* Set attributes from new element onto old element, tracking changes in ref.
|
|
2017
|
-
*/
|
|
2018
|
-
declare function domSetAttributes(oldNode: Element, newNode: Element, ref: DomRef, keepId?: boolean): void;
|
|
2019
|
-
/**
|
|
2020
|
-
* Set child nodes from new parent onto old parent using keyed diff algorithm.
|
|
2021
|
-
*/
|
|
2022
|
-
declare function domSetChildNodes(oldParent: Element, newParent: Element, ref: DomRef, frame: FrameInterface, keys_?: ReadonlySet<string>): void;
|
|
2023
|
-
/**
|
|
2024
|
-
* Diff two DOM nodes and apply changes.
|
|
2025
|
-
*/
|
|
2026
|
-
declare function domSetNode(oldNode: ChildNode, newNode: ChildNode, oldParent: Element, ref: DomRef, frame: FrameInterface, keys_?: ReadonlySet<string>): void;
|
|
2027
|
-
/**
|
|
2028
|
-
* Create an empty DomRef for tracking diff operations.
|
|
2029
|
-
*/
|
|
2030
|
-
declare function createDomRef(): DomRef;
|
|
2031
|
-
/**
|
|
2032
|
-
* Apply DOM diff operations to the DOM.
|
|
2033
|
-
*/
|
|
2034
|
-
declare function applyDomOps(ops: DomOp[]): void;
|
|
2035
|
-
/**
|
|
2036
|
-
* Apply ID updates from DOM diff.
|
|
2037
|
-
*/
|
|
2038
|
-
declare function applyIdUpdates(updates: [Element, string][]): void;
|
|
2039
|
-
/** Encode value for safe HTML output */
|
|
2040
|
-
declare function encodeHTML(v: unknown): string;
|
|
2041
|
-
/** Safe string conversion */
|
|
2042
|
-
declare function encodeSafe(v: unknown): string;
|
|
2043
|
-
/** URI-encode a value with extra character encoding */
|
|
2044
|
-
declare function encodeURIExtra(v: unknown): string;
|
|
2045
|
-
/** Quote-encode a value for attribute use */
|
|
2046
|
-
declare function encodeQ(v: unknown): string;
|
|
2047
|
-
|
|
2048
1873
|
/**
|
|
2049
1874
|
* Updater class for view data binding.
|
|
2050
1875
|
* Manages view-local data with change detection and DOM diff triggering.
|
|
@@ -2071,6 +1896,8 @@ declare class Updater implements UpdaterInterface {
|
|
|
2071
1896
|
private version;
|
|
2072
1897
|
/** Snapshot of `version` taken by `snapshot()`, used by `altered()`. */
|
|
2073
1898
|
private snapshotVersion;
|
|
1899
|
+
/** Last rendered VDOM tree (only used when virtualDom is enabled) */
|
|
1900
|
+
private vdom?;
|
|
2074
1901
|
constructor(viewId: string);
|
|
2075
1902
|
/**
|
|
2076
1903
|
* Get data by key.
|
|
@@ -2112,7 +1939,7 @@ declare class Updater implements UpdaterInterface {
|
|
|
2112
1939
|
* Translate a refData reference back to its original value.
|
|
2113
1940
|
*
|
|
2114
1941
|
* The ref protocol is `SPLITTER` + ascii decimal digits — the exact format
|
|
2115
|
-
* emitted by `
|
|
1942
|
+
* emitted by `refFn`. We require that exact shape so a user-supplied
|
|
2116
1943
|
* string that merely begins with SPLITTER is never accidentally resolved
|
|
2117
1944
|
* (or mishandled as a "missing ref").
|
|
2118
1945
|
*/
|
|
@@ -2133,6 +1960,21 @@ declare class Updater implements UpdaterInterface {
|
|
|
2133
1960
|
getChangedKeys(): ReadonlySet<string>;
|
|
2134
1961
|
}
|
|
2135
1962
|
|
|
1963
|
+
/**
|
|
1964
|
+
* Create a virtual DOM node.
|
|
1965
|
+
*
|
|
1966
|
+
* Text node: `vdomCreate(0, 'text content')`
|
|
1967
|
+
* Element: `vdomCreate('div', { class: 'row' }, [child1, child2])`
|
|
1968
|
+
* Self-closing: `vdomCreate('br', null, 1)`
|
|
1969
|
+
* Raw HTML: `vdomCreate(0, '<b>bold</b>', 1)` (children truthy → raw HTML node)
|
|
1970
|
+
* Root: `vdomCreate(viewId, 0, [children])`
|
|
1971
|
+
*/
|
|
1972
|
+
declare function vdomCreate(tag: string | number, props?: Record<string, unknown> | string | number | null, children?: VDomNode[] | string | number | null, specials?: Record<string, string>): VDomNode;
|
|
1973
|
+
/**
|
|
1974
|
+
* Create an empty VDomRef for tracking diff operations.
|
|
1975
|
+
*/
|
|
1976
|
+
declare function createVDomRef(viewId: string): VDomRef;
|
|
1977
|
+
|
|
2136
1978
|
/**
|
|
2137
1979
|
* Payload wraps API response data with convenient access methods.
|
|
2138
1980
|
*/
|
|
@@ -2427,92 +2269,6 @@ declare function create<T>(name: string, creator: StateCreator<T>): StoreApi<T>;
|
|
|
2427
2269
|
* bindStore(this, useCountStore, (s) => ({ count: s.count }));
|
|
2428
2270
|
* ```
|
|
2429
2271
|
*/
|
|
2430
|
-
declare function bindStore<T
|
|
2431
|
-
/**
|
|
2432
|
-
* @deprecated Use `create()` instead. This is a temporary alias.
|
|
2433
|
-
*/
|
|
2434
|
-
declare const defineStore: typeof create;
|
|
2435
|
-
|
|
2436
|
-
/** Serialized view info attached to a frame node */
|
|
2437
|
-
interface SerializedViewInfo {
|
|
2438
|
-
/** View ID (same as frame ID) */
|
|
2439
|
-
id: string;
|
|
2440
|
-
/** Whether the view has rendered at least once */
|
|
2441
|
-
rendered: boolean;
|
|
2442
|
-
/** View signature (> 0 = active) */
|
|
2443
|
-
signature: number;
|
|
2444
|
-
/** Observed state keys */
|
|
2445
|
-
observedStateKeys: string[] | null;
|
|
2446
|
-
/** Location observation config */
|
|
2447
|
-
locationObserved: {
|
|
2448
|
-
flag: number;
|
|
2449
|
-
keys: string[];
|
|
2450
|
-
observePath: boolean;
|
|
2451
|
-
};
|
|
2452
|
-
/** Whether view has a template function */
|
|
2453
|
-
hasTemplate: boolean;
|
|
2454
|
-
/** Delegated event types (keys from $evtObjMap) */
|
|
2455
|
-
eventMethodKeys: string[];
|
|
2456
|
-
/** Captured resource keys */
|
|
2457
|
-
resourceKeys: string[];
|
|
2458
|
-
/** Whether view exposes an assign method (supports CrossSite reuse) */
|
|
2459
|
-
hasAssign: boolean;
|
|
2460
|
-
/** Updater refData snapshot (shallow copy of current data) */
|
|
2461
|
-
updaterData: Record<string, unknown> | null;
|
|
2462
|
-
}
|
|
2463
|
-
/** A single node in the serialized frame tree */
|
|
2464
|
-
interface SerializedFrameNode {
|
|
2465
|
-
/** Frame ID (same as owner DOM element ID) */
|
|
2466
|
-
id: string;
|
|
2467
|
-
/** Parent frame ID (null for root) */
|
|
2468
|
-
parentId: string | null;
|
|
2469
|
-
/** View path (v-lark attribute value) */
|
|
2470
|
-
viewPath: string | null;
|
|
2471
|
-
/** Number of child frames */
|
|
2472
|
-
childrenCount: number;
|
|
2473
|
-
/** Number of children that have fired 'created' */
|
|
2474
|
-
readyCount: number;
|
|
2475
|
-
/** Whether children have been created */
|
|
2476
|
-
childrenCreated: number;
|
|
2477
|
-
/** Whether children are in alter state */
|
|
2478
|
-
childrenAlter: number;
|
|
2479
|
-
/** Whether this frame is destroyed */
|
|
2480
|
-
destroyed: number;
|
|
2481
|
-
/** Serialized view info (null if no view mounted) */
|
|
2482
|
-
view: SerializedViewInfo | null;
|
|
2483
|
-
/** Child frame nodes */
|
|
2484
|
-
children: SerializedFrameNode[];
|
|
2485
|
-
}
|
|
2486
|
-
/** Top-level serialized frame tree */
|
|
2487
|
-
interface SerializedFrameTree {
|
|
2488
|
-
/** Root frame node */
|
|
2489
|
-
root: SerializedFrameNode | null;
|
|
2490
|
-
/** Total frame count */
|
|
2491
|
-
totalFrames: number;
|
|
2492
|
-
/** Timestamp of serialization */
|
|
2493
|
-
timestamp: number;
|
|
2494
|
-
/** Root element ID */
|
|
2495
|
-
rootId: string;
|
|
2496
|
-
}
|
|
2497
|
-
declare const FrameVisualBridge: {
|
|
2498
|
-
MSG_PING: string;
|
|
2499
|
-
MSG_PONG: string;
|
|
2500
|
-
MSG_REQUEST_TREE: string;
|
|
2501
|
-
MSG_TREE: string;
|
|
2502
|
-
MSG_TREE_DELTA: string;
|
|
2503
|
-
};
|
|
2504
|
-
/**
|
|
2505
|
-
* Serialize the entire Frame tree starting from root.
|
|
2506
|
-
* Returns an empty snapshot if the app hasn't booted yet.
|
|
2507
|
-
*/
|
|
2508
|
-
declare function serializeFrameTree(): SerializedFrameTree;
|
|
2509
|
-
/**
|
|
2510
|
-
* Install the Frame Visualizer Bridge.
|
|
2511
|
-
* Listens for postMessage events from the visualizer and responds
|
|
2512
|
-
* with serialized frame tree data.
|
|
2513
|
-
*
|
|
2514
|
-
* This should be called once during Framework.boot().
|
|
2515
|
-
*/
|
|
2516
|
-
declare function installFrameVisualizerBridge(): void;
|
|
2272
|
+
declare function bindStore<T>(view: unknown, store: StoreApi<T>, selector?: (state: T) => Record<string, unknown>): () => void;
|
|
2517
2273
|
|
|
2518
|
-
export { type AnyFunc, CALL_BREAK_TIME, Cache, type CacheEntry, type CacheInterface, type CacheOptions, type ChangeEvent, type CompileOptions, CrossSite, type CrossSiteConfig, type DomElement, type DomOp, type DomRef, EVENT_METHOD_REGEXP, EventDelegator, EventEmitter, type EventEmitterInterface, type EventListenerEntry, Frame, type FrameBoundElement, type FrameInterface, type FrameInvokeEntry, type FrameStaticEvent,
|
|
2274
|
+
export { type AnyFunc, CALL_BREAK_TIME, Cache, type CacheEntry, type CacheInterface, type CacheOptions, type ChangeEvent, type CompileOptions, CrossSite, type CrossSiteConfig, type DomElement, type DomOp, type DomRef, EVENT_METHOD_REGEXP, EventDelegator, EventEmitter, type EventEmitterInterface, type EventListenerEntry, Frame, type FrameBoundElement, type FrameInterface, type FrameInvokeEntry, type FrameStaticEvent, Framework, type FrameworkConfig, type FrameworkInterface, LARK_VIEW, type Location, type LocationDiff, type MixinEventHandler, type ParamDiff, type ParsedUri, Payload, type PayloadInterface, type PendingCacheEntry, RouterEvents as ROUTER_EVENTS, type RouteChangeEvent, type RouteChangedEvent, type RouteViewConfig, Router, type RouterInterface, SPLITTER, Service, type ServiceCacheInfo, type ServiceEvent, type ServiceMetaEntry, type ServiceOptions, State, type StateInterface, type StoreApi, TAG_NAME_REGEXP, Updater, type UpdaterInterface, type VDomCreateFn, type VDomNode, type VDomRef, type VDomTemplate, VIEW_EVENT_METHOD_REGEXP, View, type ViewEvent, type ViewEventSelectorEntry, type ViewGlobalEventEntry, type ViewInterface, type ViewLocationObserved, type ViewObserveLocation, type ViewResourceEntry, type ViewTemplate, type VoidFunc, applyStyle, bindStore, computed, create, createVDomRef, defineView, config as frameworkConfig, getRouteMode, invalidateViewClass, mark, markBooted, markRouterBooted, nextCounter, registerViewClass, resetProjectsMap, safeguard, unmark, use, useUrlState, vdomCreate };
|