@lark.js/mvc 0.0.1 → 0.0.3
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 +945 -1
- package/dist/{chunk-DZUOIUWX.js → chunk-Y72BUONO.js} +38 -39
- package/dist/index.cjs +236 -125
- package/dist/index.d.cts +89 -29
- package/dist/index.d.ts +89 -29
- package/dist/index.js +231 -119
- package/dist/vite.cjs +47 -48
- package/dist/vite.d.cts +5 -5
- package/dist/vite.d.ts +5 -5
- package/dist/vite.js +9 -9
- package/dist/webpack.cjs +42 -43
- package/dist/webpack.d.cts +2 -2
- package/dist/webpack.d.ts +2 -2
- package/dist/webpack.js +4 -4
- package/package.json +8 -3
package/dist/index.d.cts
CHANGED
|
@@ -155,7 +155,7 @@ interface ViewInstance {
|
|
|
155
155
|
/** Whether rendered at least once */
|
|
156
156
|
rendered?: boolean;
|
|
157
157
|
/** Whether view has template */
|
|
158
|
-
|
|
158
|
+
template?: AnyFunc | string;
|
|
159
159
|
/** Location observation config */
|
|
160
160
|
locationObserved: ViewLocationObserved;
|
|
161
161
|
/** Observed state keys */
|
|
@@ -417,7 +417,7 @@ type Constructable = new (...args: never[]) => unknown;
|
|
|
417
417
|
* This is the only place where we touch constructor internals -
|
|
418
418
|
* it's a low-level framework utility for View.extend.
|
|
419
419
|
*/
|
|
420
|
-
declare function classExtend<Proto extends object, Statics extends object>(
|
|
420
|
+
declare function classExtend<Proto extends object, Statics extends object>(make: Constructable, base: Constructable, props: Proto, statics: Statics): void;
|
|
421
421
|
|
|
422
422
|
/** Internal splitter character (invisible, used as namespace separator) */
|
|
423
423
|
declare const SPLITTER = "\u001E";
|
|
@@ -426,24 +426,18 @@ declare const ROUTER_EVENTS: {
|
|
|
426
426
|
CHANGED: string;
|
|
427
427
|
PAGE_UNLOAD: string;
|
|
428
428
|
};
|
|
429
|
-
/** Attribute name: lark
|
|
430
|
-
declare const
|
|
431
|
-
/** Attribute name: lark-attr-key (static attribute key) */
|
|
432
|
-
declare const TAG_ATTR_KEY = "lark-attr-key";
|
|
433
|
-
/** Attribute name: l (view key for assign) */
|
|
434
|
-
declare const TAG_VIEW_KEY = "lark-view-key";
|
|
435
|
-
/** Attribute name: lark-view */
|
|
436
|
-
declare const LARK_VIEW = "lark-view";
|
|
429
|
+
/** Attribute name: v-lark */
|
|
430
|
+
declare const LARK_VIEW = "v-lark";
|
|
437
431
|
/** View event method regex: e.g. "app\x1eclickHandler(click)" or "clickHandler()"
|
|
438
432
|
* Group 1: optional frame ID (before SPLITTER)
|
|
439
433
|
* Group 2: handler name
|
|
440
434
|
* Group 3: params string
|
|
441
435
|
*/
|
|
442
|
-
declare const
|
|
436
|
+
declare const EVENT_METHOD_REGEXP: RegExp;
|
|
443
437
|
/** View event method name regex: e.g. "name<click,mousedown>" or "$selector<click>" */
|
|
444
|
-
declare const
|
|
445
|
-
/** Tag name
|
|
446
|
-
declare const
|
|
438
|
+
declare const VIEW_EVENT_METHOD_REGEXP: RegExp;
|
|
439
|
+
/** Tag name regexp for I_GetNode */
|
|
440
|
+
declare const TAG_NAME_REGEXP: RegExp;
|
|
447
441
|
/** Async task break time (ms) */
|
|
448
442
|
declare const CALL_BREAK_TIME = 48;
|
|
449
443
|
/** Increment global counter and return new value */
|
|
@@ -492,7 +486,7 @@ declare function unmark$1(host: object): void;
|
|
|
492
486
|
*/
|
|
493
487
|
/**
|
|
494
488
|
* Wrap data with a Proxy for debug-mode protection.
|
|
495
|
-
* Only active when window.
|
|
489
|
+
* Only active when window.__lark_Debug is true and Proxy is available.
|
|
496
490
|
*
|
|
497
491
|
* @param data - Data to wrap
|
|
498
492
|
* @param getter - Optional callback when properties are read
|
|
@@ -608,7 +602,7 @@ declare const State: {
|
|
|
608
602
|
digest(data?: Record<string, unknown>, excludes?: Set<string>): void;
|
|
609
603
|
diff(): Readonly<Record<string, number>>;
|
|
610
604
|
clean(keys: string): {
|
|
611
|
-
|
|
605
|
+
make: AnyFunc;
|
|
612
606
|
};
|
|
613
607
|
on(event: string, handler: AnyFunc): typeof State;
|
|
614
608
|
off(event: string, handler?: AnyFunc): typeof State;
|
|
@@ -665,7 +659,7 @@ declare class View {
|
|
|
665
659
|
/** Whether rendered at least once */
|
|
666
660
|
rendered?: boolean;
|
|
667
661
|
/** Whether view has template */
|
|
668
|
-
|
|
662
|
+
template?: AnyFunc | string;
|
|
669
663
|
/** Location observation config */
|
|
670
664
|
locationObserved: ViewLocationObserved;
|
|
671
665
|
/** Observed state keys */
|
|
@@ -749,7 +743,7 @@ declare class View {
|
|
|
749
743
|
* Extend View to create a new View subclass.
|
|
750
744
|
*
|
|
751
745
|
* Supports:
|
|
752
|
-
* - props.
|
|
746
|
+
* - props.make: constructor-like init (called with initParams + {node, deep})
|
|
753
747
|
* - props.mixins: array of mixin objects
|
|
754
748
|
* - Event method patterns: `'name<click>'` etc.
|
|
755
749
|
*/
|
|
@@ -791,7 +785,7 @@ declare class Frame extends EventEmitter implements FrameLike {
|
|
|
791
785
|
hasAltered: number;
|
|
792
786
|
/** Whether view is destroyed */
|
|
793
787
|
destroyed: number;
|
|
794
|
-
/** View path (lark
|
|
788
|
+
/** View path (v-lark attribute value) */
|
|
795
789
|
viewPath?: string;
|
|
796
790
|
/** Original template before mount */
|
|
797
791
|
originalTemplate?: string;
|
|
@@ -813,8 +807,8 @@ declare class Frame extends EventEmitter implements FrameLike {
|
|
|
813
807
|
* 5. Create View instance
|
|
814
808
|
* 6. View_DelegateEvents (bind DOM events)
|
|
815
809
|
* 7. Call view.init()
|
|
816
|
-
* 8. If view has
|
|
817
|
-
* 9. If no
|
|
810
|
+
* 8. If view has template, call render via Updater
|
|
811
|
+
* 9. If no template, call endUpdate directly
|
|
818
812
|
*/
|
|
819
813
|
mountView(viewPath: string, viewInitParams?: Record<string, unknown>): void;
|
|
820
814
|
/**
|
|
@@ -884,7 +878,7 @@ declare function vdomUnmountFrames(frame: FrameLike, node: ChildNode): void;
|
|
|
884
878
|
declare function vdomGetNode(html: string, refNode: Element): Element;
|
|
885
879
|
/**
|
|
886
880
|
* Get compare key for a DOM node (for keyed diff).
|
|
887
|
-
* Uses id,
|
|
881
|
+
* Uses id, ldk (static key), or v-lark path.
|
|
888
882
|
*/
|
|
889
883
|
declare function vdomGetCompareKey(node: ChildNode): string | undefined;
|
|
890
884
|
/**
|
|
@@ -1233,7 +1227,7 @@ declare const Framework: {
|
|
|
1233
1227
|
digest(data?: Record<string, unknown>, excludes?: Set<string>): void;
|
|
1234
1228
|
diff(): Readonly<Record<string, number>>;
|
|
1235
1229
|
clean(keys: string): {
|
|
1236
|
-
|
|
1230
|
+
make: AnyFunc;
|
|
1237
1231
|
};
|
|
1238
1232
|
on(event: string, handler: AnyFunc): typeof State;
|
|
1239
1233
|
off(event: string, handler?: AnyFunc): typeof State;
|
|
@@ -1392,19 +1386,85 @@ declare function isStoreActive(name: string): boolean;
|
|
|
1392
1386
|
declare function cell<T = unknown>(data: T): T;
|
|
1393
1387
|
declare function observeCell(state: ProxyObject, cb: AnyFunc, immediate?: boolean): () => void;
|
|
1394
1388
|
declare function multi<S = Record<string, unknown>>(useStore: LarkUseStore<S>): [LarkUseStore<S>, {
|
|
1395
|
-
|
|
1389
|
+
make: AnyFunc;
|
|
1396
1390
|
}];
|
|
1397
1391
|
|
|
1392
|
+
/** Serialized view info attached to a frame node */
|
|
1393
|
+
interface SerializedViewInfo {
|
|
1394
|
+
/** View ID (same as frame ID) */
|
|
1395
|
+
id: string;
|
|
1396
|
+
/** Whether the view has rendered at least once */
|
|
1397
|
+
rendered: boolean;
|
|
1398
|
+
/** View signature (> 0 = active) */
|
|
1399
|
+
signature: number;
|
|
1400
|
+
/** Observed state keys */
|
|
1401
|
+
observedStateKeys: string[] | null;
|
|
1402
|
+
/** Location observation config */
|
|
1403
|
+
locationObserved: {
|
|
1404
|
+
flag: number;
|
|
1405
|
+
keys: string[];
|
|
1406
|
+
observePath: boolean;
|
|
1407
|
+
};
|
|
1408
|
+
/** Whether view has a template function */
|
|
1409
|
+
hasTemplate: boolean;
|
|
1410
|
+
}
|
|
1411
|
+
/** A single node in the serialized frame tree */
|
|
1412
|
+
interface SerializedFrameNode {
|
|
1413
|
+
/** Frame ID (same as owner DOM element ID) */
|
|
1414
|
+
id: string;
|
|
1415
|
+
/** Parent frame ID (null for root) */
|
|
1416
|
+
parentId: string | null;
|
|
1417
|
+
/** View path (v-lark attribute value) */
|
|
1418
|
+
viewPath: string | null;
|
|
1419
|
+
/** Number of child frames */
|
|
1420
|
+
childrenCount: number;
|
|
1421
|
+
/** Number of children that have fired 'created' */
|
|
1422
|
+
readyCount: number;
|
|
1423
|
+
/** Whether children have been created */
|
|
1424
|
+
childrenCreated: number;
|
|
1425
|
+
/** Whether children are in alter state */
|
|
1426
|
+
childrenAlter: number;
|
|
1427
|
+
/** Whether this frame is destroyed */
|
|
1428
|
+
destroyed: number;
|
|
1429
|
+
/** Serialized view info (null if no view mounted) */
|
|
1430
|
+
view: SerializedViewInfo | null;
|
|
1431
|
+
/** Child frame nodes */
|
|
1432
|
+
children: SerializedFrameNode[];
|
|
1433
|
+
}
|
|
1434
|
+
/** Top-level serialized frame tree */
|
|
1435
|
+
interface SerializedFrameTree {
|
|
1436
|
+
/** Root frame node */
|
|
1437
|
+
root: SerializedFrameNode | null;
|
|
1438
|
+
/** Total frame count */
|
|
1439
|
+
totalFrames: number;
|
|
1440
|
+
/** Timestamp of serialization */
|
|
1441
|
+
timestamp: number;
|
|
1442
|
+
/** Root element ID */
|
|
1443
|
+
rootId: string;
|
|
1444
|
+
}
|
|
1445
|
+
/**
|
|
1446
|
+
* Serialize the entire Frame tree starting from root.
|
|
1447
|
+
*/
|
|
1448
|
+
declare function serializeFrameTree(): SerializedFrameTree;
|
|
1449
|
+
/**
|
|
1450
|
+
* Install the Frame Visualizer Bridge.
|
|
1451
|
+
* Listens for postMessage events from the visualizer and responds
|
|
1452
|
+
* with serialized frame tree data.
|
|
1453
|
+
*
|
|
1454
|
+
* This should be called once during Framework.boot().
|
|
1455
|
+
*/
|
|
1456
|
+
declare function installFrameVisualizerBridge(): void;
|
|
1457
|
+
|
|
1398
1458
|
/**
|
|
1399
1459
|
* @lark/framework Template Compiler
|
|
1400
1460
|
*
|
|
1401
1461
|
* convertArtSyntax() ({{}} → <% %>)
|
|
1402
|
-
*
|
|
1462
|
+
* processViewEvents() (@event prefix + param encoding)
|
|
1403
1463
|
* compileToFunction() (<% %> → JS template function)
|
|
1404
1464
|
* extractGlobalVars() (AST-based global var analysis via @babel/parser)
|
|
1405
1465
|
*
|
|
1406
1466
|
* - All template operators: = (escape), ! (raw), @ (ref lookup), : (binding)
|
|
1407
|
-
* -
|
|
1467
|
+
* - @event attribute processing with $g prefix + \x1e separator
|
|
1408
1468
|
* - $n (null-safe toString), $e (HTML entity encode), $eu (URI encode), $eq (quote encode), $i (ref lookup)
|
|
1409
1469
|
* - Debug mode with line tracking ($expr/$art/$line) and try-catch error wrapper
|
|
1410
1470
|
* - View ID injection (\x1f → '+$viewId+')
|
|
@@ -1418,12 +1478,12 @@ declare function multi<S = Record<string, unknown>>(useStore: LarkUseStore<S>):
|
|
|
1418
1478
|
* {{@variable}} → reference lookup for component data passing
|
|
1419
1479
|
* {{each list as item}} → loop
|
|
1420
1480
|
* {{each list as item idx}} → loop with index
|
|
1421
|
-
* {{
|
|
1481
|
+
* {{parse obj as val key}} → object iteration
|
|
1422
1482
|
* {{for(let i=0;i<n;i++)}} → generic for loop
|
|
1423
1483
|
* {{if condition}} → conditional
|
|
1424
1484
|
* {{else if condition}} → else-if
|
|
1425
1485
|
* {{else}} → else
|
|
1426
|
-
* {{/if}} / {{/each}} / {{/
|
|
1486
|
+
* {{/if}} / {{/each}} / {{/parse}} / {{/for}} → close blocks
|
|
1427
1487
|
* {{set a = b}} → variable declaration
|
|
1428
1488
|
*/
|
|
1429
1489
|
/** Options for compileTemplate() */
|
|
@@ -1468,4 +1528,4 @@ declare function compileTemplate(source: string, options?: CompileOptions): stri
|
|
|
1468
1528
|
*/
|
|
1469
1529
|
declare function extractGlobalVars(source: string): string[];
|
|
1470
1530
|
|
|
1471
|
-
export { type AnyFunc, Bag, type BagEntry, CALL_BREAK_TIME, Cache, type CacheEntry, type CacheOptions, type CompileOptions, type Constructable,
|
|
1531
|
+
export { type AnyFunc, Bag, type BagEntry, CALL_BREAK_TIME, Cache, type CacheEntry, type CacheOptions, type CompileOptions, type Constructable, EVENT_METHOD_REGEXP, EventDelegator, EventEmitter, type EventListenerEntry, Frame, type FrameBoundElement, type FrameChildrenMap, type FrameInvokeEntry, type FrameLike, type FrameReadyMap, Framework, type FrameworkConfig, LARK_VIEW, type LarkUseStore, type Location, type LocationDiff, type MixinEventHandler, type NodeUseStore, type ObservePayload, type ParamDiff, type ParsedUri, type PendingCacheEntry, Platform, ROUTER_EVENTS, type ReactUseStore, type RouteViewConfig, Router, SPLITTER, type SerializedFrameNode, type SerializedFrameTree, type SerializedViewInfo, Service, type ServiceCacheInfo, type ServiceConstructor, type ServiceEntry, type ServiceMetaEntry, type ServiceOptions, State, type StoreConfig, type StoreMethods, TAG_NAME_REGEXP, Updater, type UpdaterLike, type VDomOp, type VDomRef, VIEW_EVENT_METHOD_REGEXP, type VdomElement, View, type ViewClassInternal, type ViewEventObjectMap, type ViewEventSelectorEntry, type ViewEventSelectorMap, type ViewGlobalEventEntry, type ViewInstance, type ViewLocationObserved, type ViewResourceEntry, type ViewResourceMap, type VoidFunc, applyIdUpdates, applyStyle, applyVdomOps, assign, cell, classExtend, cloneData, cloneStore, compileTemplate, createState, createVdomRef, defineStore, delStore, encodeHTML, encodeQ, encodeSafe, encodeURIExtra, ensureElementId, extractGlobalVars, funcWithTry, generateId, getAttribute, getById, getPlatform, getStore, getUseStore, has, installFrameVisualizerBridge, isArray, isPlainObject, isPrimitive, isPrimitiveOrFunc, isState, isStoreActive, keys, lazySet, mark$1 as mark, markBooted, markRouterBooted, multi, nextCounter, nodeInside, noop, now, observeCell, parseUri, registerViewClass, safeguard, serializeFrameTree, setData, shallowSet, mark as storeMark, unmark as storeUnmark, syncCounter, toMap, toUri, translateData, unmark$1 as unmark, vdomGetCompareKey, vdomGetNode, vdomSetAttributes, vdomSetChildNodes, vdomSetNode, vdomSpecialDiff, vdomUnmountFrames };
|
package/dist/index.d.ts
CHANGED
|
@@ -155,7 +155,7 @@ interface ViewInstance {
|
|
|
155
155
|
/** Whether rendered at least once */
|
|
156
156
|
rendered?: boolean;
|
|
157
157
|
/** Whether view has template */
|
|
158
|
-
|
|
158
|
+
template?: AnyFunc | string;
|
|
159
159
|
/** Location observation config */
|
|
160
160
|
locationObserved: ViewLocationObserved;
|
|
161
161
|
/** Observed state keys */
|
|
@@ -417,7 +417,7 @@ type Constructable = new (...args: never[]) => unknown;
|
|
|
417
417
|
* This is the only place where we touch constructor internals -
|
|
418
418
|
* it's a low-level framework utility for View.extend.
|
|
419
419
|
*/
|
|
420
|
-
declare function classExtend<Proto extends object, Statics extends object>(
|
|
420
|
+
declare function classExtend<Proto extends object, Statics extends object>(make: Constructable, base: Constructable, props: Proto, statics: Statics): void;
|
|
421
421
|
|
|
422
422
|
/** Internal splitter character (invisible, used as namespace separator) */
|
|
423
423
|
declare const SPLITTER = "\u001E";
|
|
@@ -426,24 +426,18 @@ declare const ROUTER_EVENTS: {
|
|
|
426
426
|
CHANGED: string;
|
|
427
427
|
PAGE_UNLOAD: string;
|
|
428
428
|
};
|
|
429
|
-
/** Attribute name: lark
|
|
430
|
-
declare const
|
|
431
|
-
/** Attribute name: lark-attr-key (static attribute key) */
|
|
432
|
-
declare const TAG_ATTR_KEY = "lark-attr-key";
|
|
433
|
-
/** Attribute name: l (view key for assign) */
|
|
434
|
-
declare const TAG_VIEW_KEY = "lark-view-key";
|
|
435
|
-
/** Attribute name: lark-view */
|
|
436
|
-
declare const LARK_VIEW = "lark-view";
|
|
429
|
+
/** Attribute name: v-lark */
|
|
430
|
+
declare const LARK_VIEW = "v-lark";
|
|
437
431
|
/** View event method regex: e.g. "app\x1eclickHandler(click)" or "clickHandler()"
|
|
438
432
|
* Group 1: optional frame ID (before SPLITTER)
|
|
439
433
|
* Group 2: handler name
|
|
440
434
|
* Group 3: params string
|
|
441
435
|
*/
|
|
442
|
-
declare const
|
|
436
|
+
declare const EVENT_METHOD_REGEXP: RegExp;
|
|
443
437
|
/** View event method name regex: e.g. "name<click,mousedown>" or "$selector<click>" */
|
|
444
|
-
declare const
|
|
445
|
-
/** Tag name
|
|
446
|
-
declare const
|
|
438
|
+
declare const VIEW_EVENT_METHOD_REGEXP: RegExp;
|
|
439
|
+
/** Tag name regexp for I_GetNode */
|
|
440
|
+
declare const TAG_NAME_REGEXP: RegExp;
|
|
447
441
|
/** Async task break time (ms) */
|
|
448
442
|
declare const CALL_BREAK_TIME = 48;
|
|
449
443
|
/** Increment global counter and return new value */
|
|
@@ -492,7 +486,7 @@ declare function unmark$1(host: object): void;
|
|
|
492
486
|
*/
|
|
493
487
|
/**
|
|
494
488
|
* Wrap data with a Proxy for debug-mode protection.
|
|
495
|
-
* Only active when window.
|
|
489
|
+
* Only active when window.__lark_Debug is true and Proxy is available.
|
|
496
490
|
*
|
|
497
491
|
* @param data - Data to wrap
|
|
498
492
|
* @param getter - Optional callback when properties are read
|
|
@@ -608,7 +602,7 @@ declare const State: {
|
|
|
608
602
|
digest(data?: Record<string, unknown>, excludes?: Set<string>): void;
|
|
609
603
|
diff(): Readonly<Record<string, number>>;
|
|
610
604
|
clean(keys: string): {
|
|
611
|
-
|
|
605
|
+
make: AnyFunc;
|
|
612
606
|
};
|
|
613
607
|
on(event: string, handler: AnyFunc): typeof State;
|
|
614
608
|
off(event: string, handler?: AnyFunc): typeof State;
|
|
@@ -665,7 +659,7 @@ declare class View {
|
|
|
665
659
|
/** Whether rendered at least once */
|
|
666
660
|
rendered?: boolean;
|
|
667
661
|
/** Whether view has template */
|
|
668
|
-
|
|
662
|
+
template?: AnyFunc | string;
|
|
669
663
|
/** Location observation config */
|
|
670
664
|
locationObserved: ViewLocationObserved;
|
|
671
665
|
/** Observed state keys */
|
|
@@ -749,7 +743,7 @@ declare class View {
|
|
|
749
743
|
* Extend View to create a new View subclass.
|
|
750
744
|
*
|
|
751
745
|
* Supports:
|
|
752
|
-
* - props.
|
|
746
|
+
* - props.make: constructor-like init (called with initParams + {node, deep})
|
|
753
747
|
* - props.mixins: array of mixin objects
|
|
754
748
|
* - Event method patterns: `'name<click>'` etc.
|
|
755
749
|
*/
|
|
@@ -791,7 +785,7 @@ declare class Frame extends EventEmitter implements FrameLike {
|
|
|
791
785
|
hasAltered: number;
|
|
792
786
|
/** Whether view is destroyed */
|
|
793
787
|
destroyed: number;
|
|
794
|
-
/** View path (lark
|
|
788
|
+
/** View path (v-lark attribute value) */
|
|
795
789
|
viewPath?: string;
|
|
796
790
|
/** Original template before mount */
|
|
797
791
|
originalTemplate?: string;
|
|
@@ -813,8 +807,8 @@ declare class Frame extends EventEmitter implements FrameLike {
|
|
|
813
807
|
* 5. Create View instance
|
|
814
808
|
* 6. View_DelegateEvents (bind DOM events)
|
|
815
809
|
* 7. Call view.init()
|
|
816
|
-
* 8. If view has
|
|
817
|
-
* 9. If no
|
|
810
|
+
* 8. If view has template, call render via Updater
|
|
811
|
+
* 9. If no template, call endUpdate directly
|
|
818
812
|
*/
|
|
819
813
|
mountView(viewPath: string, viewInitParams?: Record<string, unknown>): void;
|
|
820
814
|
/**
|
|
@@ -884,7 +878,7 @@ declare function vdomUnmountFrames(frame: FrameLike, node: ChildNode): void;
|
|
|
884
878
|
declare function vdomGetNode(html: string, refNode: Element): Element;
|
|
885
879
|
/**
|
|
886
880
|
* Get compare key for a DOM node (for keyed diff).
|
|
887
|
-
* Uses id,
|
|
881
|
+
* Uses id, ldk (static key), or v-lark path.
|
|
888
882
|
*/
|
|
889
883
|
declare function vdomGetCompareKey(node: ChildNode): string | undefined;
|
|
890
884
|
/**
|
|
@@ -1233,7 +1227,7 @@ declare const Framework: {
|
|
|
1233
1227
|
digest(data?: Record<string, unknown>, excludes?: Set<string>): void;
|
|
1234
1228
|
diff(): Readonly<Record<string, number>>;
|
|
1235
1229
|
clean(keys: string): {
|
|
1236
|
-
|
|
1230
|
+
make: AnyFunc;
|
|
1237
1231
|
};
|
|
1238
1232
|
on(event: string, handler: AnyFunc): typeof State;
|
|
1239
1233
|
off(event: string, handler?: AnyFunc): typeof State;
|
|
@@ -1392,19 +1386,85 @@ declare function isStoreActive(name: string): boolean;
|
|
|
1392
1386
|
declare function cell<T = unknown>(data: T): T;
|
|
1393
1387
|
declare function observeCell(state: ProxyObject, cb: AnyFunc, immediate?: boolean): () => void;
|
|
1394
1388
|
declare function multi<S = Record<string, unknown>>(useStore: LarkUseStore<S>): [LarkUseStore<S>, {
|
|
1395
|
-
|
|
1389
|
+
make: AnyFunc;
|
|
1396
1390
|
}];
|
|
1397
1391
|
|
|
1392
|
+
/** Serialized view info attached to a frame node */
|
|
1393
|
+
interface SerializedViewInfo {
|
|
1394
|
+
/** View ID (same as frame ID) */
|
|
1395
|
+
id: string;
|
|
1396
|
+
/** Whether the view has rendered at least once */
|
|
1397
|
+
rendered: boolean;
|
|
1398
|
+
/** View signature (> 0 = active) */
|
|
1399
|
+
signature: number;
|
|
1400
|
+
/** Observed state keys */
|
|
1401
|
+
observedStateKeys: string[] | null;
|
|
1402
|
+
/** Location observation config */
|
|
1403
|
+
locationObserved: {
|
|
1404
|
+
flag: number;
|
|
1405
|
+
keys: string[];
|
|
1406
|
+
observePath: boolean;
|
|
1407
|
+
};
|
|
1408
|
+
/** Whether view has a template function */
|
|
1409
|
+
hasTemplate: boolean;
|
|
1410
|
+
}
|
|
1411
|
+
/** A single node in the serialized frame tree */
|
|
1412
|
+
interface SerializedFrameNode {
|
|
1413
|
+
/** Frame ID (same as owner DOM element ID) */
|
|
1414
|
+
id: string;
|
|
1415
|
+
/** Parent frame ID (null for root) */
|
|
1416
|
+
parentId: string | null;
|
|
1417
|
+
/** View path (v-lark attribute value) */
|
|
1418
|
+
viewPath: string | null;
|
|
1419
|
+
/** Number of child frames */
|
|
1420
|
+
childrenCount: number;
|
|
1421
|
+
/** Number of children that have fired 'created' */
|
|
1422
|
+
readyCount: number;
|
|
1423
|
+
/** Whether children have been created */
|
|
1424
|
+
childrenCreated: number;
|
|
1425
|
+
/** Whether children are in alter state */
|
|
1426
|
+
childrenAlter: number;
|
|
1427
|
+
/** Whether this frame is destroyed */
|
|
1428
|
+
destroyed: number;
|
|
1429
|
+
/** Serialized view info (null if no view mounted) */
|
|
1430
|
+
view: SerializedViewInfo | null;
|
|
1431
|
+
/** Child frame nodes */
|
|
1432
|
+
children: SerializedFrameNode[];
|
|
1433
|
+
}
|
|
1434
|
+
/** Top-level serialized frame tree */
|
|
1435
|
+
interface SerializedFrameTree {
|
|
1436
|
+
/** Root frame node */
|
|
1437
|
+
root: SerializedFrameNode | null;
|
|
1438
|
+
/** Total frame count */
|
|
1439
|
+
totalFrames: number;
|
|
1440
|
+
/** Timestamp of serialization */
|
|
1441
|
+
timestamp: number;
|
|
1442
|
+
/** Root element ID */
|
|
1443
|
+
rootId: string;
|
|
1444
|
+
}
|
|
1445
|
+
/**
|
|
1446
|
+
* Serialize the entire Frame tree starting from root.
|
|
1447
|
+
*/
|
|
1448
|
+
declare function serializeFrameTree(): SerializedFrameTree;
|
|
1449
|
+
/**
|
|
1450
|
+
* Install the Frame Visualizer Bridge.
|
|
1451
|
+
* Listens for postMessage events from the visualizer and responds
|
|
1452
|
+
* with serialized frame tree data.
|
|
1453
|
+
*
|
|
1454
|
+
* This should be called once during Framework.boot().
|
|
1455
|
+
*/
|
|
1456
|
+
declare function installFrameVisualizerBridge(): void;
|
|
1457
|
+
|
|
1398
1458
|
/**
|
|
1399
1459
|
* @lark/framework Template Compiler
|
|
1400
1460
|
*
|
|
1401
1461
|
* convertArtSyntax() ({{}} → <% %>)
|
|
1402
|
-
*
|
|
1462
|
+
* processViewEvents() (@event prefix + param encoding)
|
|
1403
1463
|
* compileToFunction() (<% %> → JS template function)
|
|
1404
1464
|
* extractGlobalVars() (AST-based global var analysis via @babel/parser)
|
|
1405
1465
|
*
|
|
1406
1466
|
* - All template operators: = (escape), ! (raw), @ (ref lookup), : (binding)
|
|
1407
|
-
* -
|
|
1467
|
+
* - @event attribute processing with $g prefix + \x1e separator
|
|
1408
1468
|
* - $n (null-safe toString), $e (HTML entity encode), $eu (URI encode), $eq (quote encode), $i (ref lookup)
|
|
1409
1469
|
* - Debug mode with line tracking ($expr/$art/$line) and try-catch error wrapper
|
|
1410
1470
|
* - View ID injection (\x1f → '+$viewId+')
|
|
@@ -1418,12 +1478,12 @@ declare function multi<S = Record<string, unknown>>(useStore: LarkUseStore<S>):
|
|
|
1418
1478
|
* {{@variable}} → reference lookup for component data passing
|
|
1419
1479
|
* {{each list as item}} → loop
|
|
1420
1480
|
* {{each list as item idx}} → loop with index
|
|
1421
|
-
* {{
|
|
1481
|
+
* {{parse obj as val key}} → object iteration
|
|
1422
1482
|
* {{for(let i=0;i<n;i++)}} → generic for loop
|
|
1423
1483
|
* {{if condition}} → conditional
|
|
1424
1484
|
* {{else if condition}} → else-if
|
|
1425
1485
|
* {{else}} → else
|
|
1426
|
-
* {{/if}} / {{/each}} / {{/
|
|
1486
|
+
* {{/if}} / {{/each}} / {{/parse}} / {{/for}} → close blocks
|
|
1427
1487
|
* {{set a = b}} → variable declaration
|
|
1428
1488
|
*/
|
|
1429
1489
|
/** Options for compileTemplate() */
|
|
@@ -1468,4 +1528,4 @@ declare function compileTemplate(source: string, options?: CompileOptions): stri
|
|
|
1468
1528
|
*/
|
|
1469
1529
|
declare function extractGlobalVars(source: string): string[];
|
|
1470
1530
|
|
|
1471
|
-
export { type AnyFunc, Bag, type BagEntry, CALL_BREAK_TIME, Cache, type CacheEntry, type CacheOptions, type CompileOptions, type Constructable,
|
|
1531
|
+
export { type AnyFunc, Bag, type BagEntry, CALL_BREAK_TIME, Cache, type CacheEntry, type CacheOptions, type CompileOptions, type Constructable, EVENT_METHOD_REGEXP, EventDelegator, EventEmitter, type EventListenerEntry, Frame, type FrameBoundElement, type FrameChildrenMap, type FrameInvokeEntry, type FrameLike, type FrameReadyMap, Framework, type FrameworkConfig, LARK_VIEW, type LarkUseStore, type Location, type LocationDiff, type MixinEventHandler, type NodeUseStore, type ObservePayload, type ParamDiff, type ParsedUri, type PendingCacheEntry, Platform, ROUTER_EVENTS, type ReactUseStore, type RouteViewConfig, Router, SPLITTER, type SerializedFrameNode, type SerializedFrameTree, type SerializedViewInfo, Service, type ServiceCacheInfo, type ServiceConstructor, type ServiceEntry, type ServiceMetaEntry, type ServiceOptions, State, type StoreConfig, type StoreMethods, TAG_NAME_REGEXP, Updater, type UpdaterLike, type VDomOp, type VDomRef, VIEW_EVENT_METHOD_REGEXP, type VdomElement, View, type ViewClassInternal, type ViewEventObjectMap, type ViewEventSelectorEntry, type ViewEventSelectorMap, type ViewGlobalEventEntry, type ViewInstance, type ViewLocationObserved, type ViewResourceEntry, type ViewResourceMap, type VoidFunc, applyIdUpdates, applyStyle, applyVdomOps, assign, cell, classExtend, cloneData, cloneStore, compileTemplate, createState, createVdomRef, defineStore, delStore, encodeHTML, encodeQ, encodeSafe, encodeURIExtra, ensureElementId, extractGlobalVars, funcWithTry, generateId, getAttribute, getById, getPlatform, getStore, getUseStore, has, installFrameVisualizerBridge, isArray, isPlainObject, isPrimitive, isPrimitiveOrFunc, isState, isStoreActive, keys, lazySet, mark$1 as mark, markBooted, markRouterBooted, multi, nextCounter, nodeInside, noop, now, observeCell, parseUri, registerViewClass, safeguard, serializeFrameTree, setData, shallowSet, mark as storeMark, unmark as storeUnmark, syncCounter, toMap, toUri, translateData, unmark$1 as unmark, vdomGetCompareKey, vdomGetNode, vdomSetAttributes, vdomSetChildNodes, vdomSetNode, vdomSpecialDiff, vdomUnmountFrames };
|