@lark.js/mvc 0.0.2 → 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/dist/index.d.ts CHANGED
@@ -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>(ctor: Constructable, base: Constructable, props: Proto, statics: Statics): void;
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,14 +426,8 @@ declare const ROUTER_EVENTS: {
426
426
  CHANGED: string;
427
427
  PAGE_UNLOAD: string;
428
428
  };
429
- /** Attribute name: lark-key (static key for skipping VDOM diff) */
430
- declare const TAG_KEY = "lark-key";
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
@@ -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.__lark_debug is true and Proxy is available.
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
- ctor: AnyFunc;
605
+ make: AnyFunc;
612
606
  };
613
607
  on(event: string, handler: AnyFunc): typeof State;
614
608
  off(event: string, handler?: AnyFunc): typeof State;
@@ -749,7 +743,7 @@ declare class View {
749
743
  * Extend View to create a new View subclass.
750
744
  *
751
745
  * Supports:
752
- * - props.ctor: constructor-like init (called with initParams + {node, deep})
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-view attribute value) */
788
+ /** View path (v-lark attribute value) */
795
789
  viewPath?: string;
796
790
  /** Original template before mount */
797
791
  originalTemplate?: string;
@@ -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, lark-key (static key), or lark-view path.
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
- ctor: AnyFunc;
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
- ctor: AnyFunc;
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
- * processViewEvents() (v-event prefix + param encoding)
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
- * - v-event attribute processing with $g prefix + \x1e separator
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+')
@@ -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, 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, Service, type ServiceCacheInfo, type ServiceConstructor, type ServiceEntry, type ServiceMetaEntry, type ServiceOptions, State, type StoreConfig, type StoreMethods, TAG_ATTR_KEY, TAG_KEY, TAG_NAME_REGEXP, TAG_VIEW_KEY, 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, isArray, isPlainObject, isPrimitive, isPrimitiveOrFunc, isState, isStoreActive, keys, lazySet, mark$1 as mark, markBooted, markRouterBooted, multi, nextCounter, nodeInside, noop, now, observeCell, parseUri, registerViewClass, safeguard, setData, shallowSet, mark as storeMark, unmark as storeUnmark, syncCounter, toMap, toUri, translateData, unmark$1 as unmark, vdomGetCompareKey, vdomGetNode, vdomSetAttributes, vdomSetChildNodes, vdomSetNode, vdomSpecialDiff, vdomUnmountFrames };
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.js CHANGED
@@ -6,10 +6,15 @@ var ROUTER_EVENTS = {
6
6
  CHANGED: "changed",
7
7
  PAGE_UNLOAD: "page_unload"
8
8
  };
9
- var TAG_KEY = "lark-key";
10
- var TAG_ATTR_KEY = "lark-attr-key";
11
- var TAG_VIEW_KEY = "lark-view-key";
12
- var LARK_VIEW = "lark-view";
9
+ var LARK_KEYS = {
10
+ /** Attribute name: ldk (static key for skipping VDOM diff) */
11
+ DIFF_KEY: "ldk",
12
+ /** Attribute name: lak (static attribute key) */
13
+ ATTR_KEY: "lak",
14
+ /** Attribute name: lvk (view key for assign) */
15
+ VIEW_KEY: "lvk"
16
+ };
17
+ var LARK_VIEW = "v-lark";
13
18
  var EVENT_METHOD_REGEXP = new RegExp(
14
19
  `(?:([\\w-]+)${SPLITTER})?([^(]+)\\(([\\s\\S]*?)?\\)`
15
20
  );
@@ -201,13 +206,13 @@ function toMap(list, key) {
201
206
  function now() {
202
207
  return Date.now ? Date.now() : (/* @__PURE__ */ new Date()).getTime();
203
208
  }
204
- function classExtend(ctor, base, props, statics) {
209
+ function classExtend(make, base, props, statics) {
205
210
  const baseProto = base["prototype"] ?? {};
206
211
  const cProto = Object.create(baseProto);
207
212
  assign(cProto, props);
208
- Object.assign(ctor, statics);
209
- cProto.constructor = ctor;
210
- ctor["prototype"] = cProto;
213
+ Object.assign(make, statics);
214
+ cProto.constructor = make;
215
+ make["prototype"] = cProto;
211
216
  }
212
217
 
213
218
  // src/apply-style.ts
@@ -275,7 +280,7 @@ function unmark(host) {
275
280
  var proxiesPool = /* @__PURE__ */ new Map();
276
281
  var SAFEGUARD_SENTINEL = "_sf_";
277
282
  function safeguard(data, getter, setter, isRoot) {
278
- if (typeof window.__lark_debug === "undefined" || !window.__lark_debug) {
283
+ if (typeof window.__lark_Debug === "undefined" || !window.__lark_Debug) {
279
284
  return data;
280
285
  }
281
286
  if (typeof Proxy === "undefined") {
@@ -577,7 +582,7 @@ function teardownKeysRef(keyList) {
577
582
  if (count <= 0) {
578
583
  Reflect.deleteProperty(keyRefCounts, key);
579
584
  Reflect.deleteProperty(appData, key);
580
- if (typeof window.__lark_debug !== "undefined" && window.__lark_debug) {
585
+ if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug) {
581
586
  Reflect.deleteProperty(dataWhereSet, key);
582
587
  }
583
588
  }
@@ -620,7 +625,7 @@ var State = {
620
625
  */
621
626
  get(key) {
622
627
  const result = key ? appData[key] : appData;
623
- if (typeof window.__lark_debug !== "undefined" && window.__lark_debug) {
628
+ if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug) {
624
629
  return safeguard(
625
630
  result,
626
631
  (dataKey) => {
@@ -646,7 +651,7 @@ var State = {
646
651
  */
647
652
  set(data, excludes) {
648
653
  dataIsChanged = setData(data, appData, changedKeys, excludes || /* @__PURE__ */ new Set()) || dataIsChanged;
649
- if (typeof window.__lark_debug !== "undefined" && window.__lark_debug && booted) {
654
+ if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug && booted) {
650
655
  for (const p in data) {
651
656
  dataWhereSet[p] = window.location.pathname;
652
657
  }
@@ -661,7 +666,7 @@ var State = {
661
666
  State.set(data, excludes);
662
667
  }
663
668
  if (dataIsChanged) {
664
- if (typeof window.__lark_debug !== "undefined" && window.__lark_debug) {
669
+ if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug) {
665
670
  for (const p in changedKeys) {
666
671
  if (has(changedKeys, p)) {
667
672
  clearNotify(p);
@@ -692,7 +697,7 @@ var State = {
692
697
  */
693
698
  clean(keys2) {
694
699
  return {
695
- ctor: function() {
700
+ make: function() {
696
701
  const keyList = setupKeysRef(keys2);
697
702
  this.on("destroy", () => {
698
703
  teardownKeysRef(keyList);
@@ -873,7 +878,7 @@ var Router = {
873
878
  attachViewAndPath(location);
874
879
  hrefCache.set(href, location);
875
880
  }
876
- if (typeof window.__lark_debug !== "undefined" && window.__lark_debug) {
881
+ if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug) {
877
882
  location["params"] = safeguard(location["params"]);
878
883
  }
879
884
  return location;
@@ -897,7 +902,7 @@ var Router = {
897
902
  );
898
903
  }
899
904
  silent = 0;
900
- if (typeof window.__lark_debug !== "undefined" && window.__lark_debug && lastChanged) {
905
+ if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug && lastChanged) {
901
906
  lastChanged = safeguard(lastChanged);
902
907
  }
903
908
  return lastChanged;
@@ -1074,7 +1079,7 @@ function parseEventInfo(eventInfo) {
1074
1079
  function findFrameInfo(current, eventType) {
1075
1080
  const eventInfos = [];
1076
1081
  let begin = current;
1077
- const info = current.getAttribute(`v-${eventType}`);
1082
+ const info = current.getAttribute(`@${eventType}`);
1078
1083
  let match;
1079
1084
  if (info) {
1080
1085
  match = parseEventInfo(info);
@@ -1318,7 +1323,7 @@ function vdomGetCompareKey(node) {
1318
1323
  }
1319
1324
  let key = el.autoId ? "" : el.getAttribute("id") || void 0;
1320
1325
  if (!key) {
1321
- key = el.getAttribute(TAG_KEY) || void 0;
1326
+ key = el.getAttribute(LARK_KEYS.DIFF_KEY) || void 0;
1322
1327
  }
1323
1328
  if (!key) {
1324
1329
  const larkView = el.getAttribute(LARK_VIEW);
@@ -1446,17 +1451,17 @@ function vdomSetChildNodes(oldParent, newParent, ref, frame, keys_) {
1446
1451
  }
1447
1452
  }
1448
1453
  function vdomSetNode(oldNode, newNode, oldParent, ref, frame, keys_) {
1449
- if (vdomSpecialDiff(oldNode, newNode) || oldNode.nodeType === 1 && oldNode.hasAttribute(TAG_VIEW_KEY) || !(oldNode.isEqualNode && oldNode.isEqualNode(newNode))) {
1454
+ if (vdomSpecialDiff(oldNode, newNode) || oldNode.nodeType === 1 && oldNode.hasAttribute(LARK_KEYS.VIEW_KEY) || !(oldNode.isEqualNode && oldNode.isEqualNode(newNode))) {
1450
1455
  if (oldNode.nodeType === newNode.nodeType && oldNode.nodeName === newNode.nodeName) {
1451
1456
  if (oldNode.nodeType === 1) {
1452
1457
  const oldEl = oldNode;
1453
1458
  const newEl = newNode;
1454
- const staticKey = newEl.getAttribute(TAG_KEY);
1455
- if (staticKey && staticKey === oldEl.getAttribute(TAG_KEY)) {
1459
+ const staticKey = newEl.getAttribute(LARK_KEYS.DIFF_KEY);
1460
+ if (staticKey && staticKey === oldEl.getAttribute(LARK_KEYS.DIFF_KEY)) {
1456
1461
  return;
1457
1462
  }
1458
1463
  const newLarkView = newEl.getAttribute(LARK_VIEW);
1459
- const updateAttribute = !newEl.getAttribute(TAG_ATTR_KEY) || newEl.getAttribute(TAG_ATTR_KEY) !== oldEl.getAttribute(TAG_ATTR_KEY);
1464
+ const updateAttribute = !newEl.getAttribute(LARK_KEYS.ATTR_KEY) || newEl.getAttribute(LARK_KEYS.ATTR_KEY) !== oldEl.getAttribute(LARK_KEYS.ATTR_KEY);
1460
1465
  let updateChildren = true;
1461
1466
  if (newLarkView) {
1462
1467
  const oldFrameId = oldEl.getAttribute("id") || "";
@@ -1601,7 +1606,7 @@ var Updater = class {
1601
1606
  if (key) {
1602
1607
  result = this.data[key];
1603
1608
  }
1604
- if (typeof window !== "undefined" && window.__lark_debug) {
1609
+ if (typeof window !== "undefined" && window.__lark_Debug) {
1605
1610
  return safeguard(result);
1606
1611
  }
1607
1612
  return result;
@@ -1736,10 +1741,10 @@ var Updater = class {
1736
1741
  // src/view.ts
1737
1742
  var VIEW_GLOBALS = {};
1738
1743
  if (typeof window !== "undefined") {
1739
- VIEW_GLOBALS["win"] = window;
1744
+ VIEW_GLOBALS["window"] = window;
1740
1745
  }
1741
1746
  if (typeof document !== "undefined") {
1742
- VIEW_GLOBALS["doc"] = document;
1747
+ VIEW_GLOBALS["document"] = document;
1743
1748
  }
1744
1749
  function viewPrepare(oView) {
1745
1750
  if (oView.ctors) {
@@ -1866,7 +1871,7 @@ function viewMergeMixins(mixins, viewClass, ctors) {
1866
1871
  if (!has(node, p)) continue;
1867
1872
  const fn = node[p];
1868
1873
  const exist = temp[p];
1869
- if (p === "ctor") {
1874
+ if (p === "make") {
1870
1875
  ctors.push(fn);
1871
1876
  continue;
1872
1877
  }
@@ -2203,23 +2208,23 @@ var View = class _View {
2203
2208
  * Extend View to create a new View subclass.
2204
2209
  *
2205
2210
  * Supports:
2206
- * - props.ctor: constructor-like init (called with initParams + {node, deep})
2211
+ * - props.make: constructor-like init (called with initParams + {node, deep})
2207
2212
  * - props.mixins: array of mixin objects
2208
2213
  * - Event method patterns: `'name<click>'` etc.
2209
2214
  */
2210
2215
  static extend(props, statics) {
2211
2216
  props = props || {};
2212
- const ctor = props["ctor"];
2217
+ const make = props["make"];
2213
2218
  const ctors = [];
2214
- if (ctor) {
2215
- ctors.push(ctor);
2219
+ if (make) {
2220
+ ctors.push(make);
2216
2221
  }
2217
2222
  const ParentView = this;
2218
2223
  const ChildView = class extends ParentView {
2219
2224
  constructor(nodeId, ownerFrame, initParams, node, mixinCtors) {
2220
2225
  super(nodeId, ownerFrame, initParams, node, []);
2221
2226
  for (const key in props) {
2222
- if (has(props, key) && key !== "ctor") {
2227
+ if (has(props, key) && key !== "make") {
2223
2228
  this[key] = props[key];
2224
2229
  }
2225
2230
  }
@@ -2241,7 +2246,7 @@ var View = class _View {
2241
2246
  };
2242
2247
  const proto = ChildView.prototype;
2243
2248
  for (const key in props) {
2244
- if (has(props, key) && key !== "ctor") {
2249
+ if (has(props, key) && key !== "make") {
2245
2250
  proto[key] = props[key];
2246
2251
  }
2247
2252
  }
@@ -2320,7 +2325,7 @@ var Frame = class _Frame extends EventEmitter {
2320
2325
  hasAltered = 0;
2321
2326
  /** Whether view is destroyed */
2322
2327
  destroyed = 0;
2323
- /** View path (lark-view attribute value) */
2328
+ /** View path (v-lark attribute value) */
2324
2329
  viewPath;
2325
2330
  /** Original template before mount */
2326
2331
  originalTemplate;
@@ -3047,6 +3052,114 @@ function serviceSend(service, attrs, done, flag, save) {
3047
3052
  }
3048
3053
  }
3049
3054
 
3055
+ // src/frame-visualizer/index.ts
3056
+ var MSG_PING = "LARK_VIS_PING";
3057
+ var MSG_PONG = "LARK_VIS_PONG";
3058
+ var MSG_REQUEST_TREE = "LARK_VIS_REQUEST_TREE";
3059
+ var MSG_TREE = "LARK_VIS_TREE";
3060
+ var MSG_TREE_DELTA = "LARK_VIS_TREE_DELTA";
3061
+ function serializeView(view) {
3062
+ return {
3063
+ id: view.id,
3064
+ rendered: !!view.rendered,
3065
+ signature: view.signature,
3066
+ observedStateKeys: view.observedStateKeys ?? null,
3067
+ locationObserved: {
3068
+ flag: view.locationObserved.flag,
3069
+ keys: view.locationObserved.keys,
3070
+ observePath: view.locationObserved.observePath
3071
+ },
3072
+ hasTemplate: !!view.template
3073
+ };
3074
+ }
3075
+ function serializeFrame(frameId) {
3076
+ const frame = Frame.get(frameId);
3077
+ if (!frame) return null;
3078
+ const view = frame.view;
3079
+ const children = [];
3080
+ for (const childId of frame.children()) {
3081
+ const childNode = serializeFrame(childId);
3082
+ if (childNode) {
3083
+ children.push(childNode);
3084
+ }
3085
+ }
3086
+ return {
3087
+ id: frame.id,
3088
+ parentId: frame.parentId ?? null,
3089
+ viewPath: frame.viewPath ?? null,
3090
+ childrenCount: frame.childrenCount,
3091
+ readyCount: frame.readyCount,
3092
+ childrenCreated: frame.childrenCreated,
3093
+ childrenAlter: frame.childrenAlter,
3094
+ destroyed: frame.destroyed,
3095
+ view: view ? serializeView(view) : null,
3096
+ children
3097
+ };
3098
+ }
3099
+ function serializeFrameTree() {
3100
+ const root = Frame.root();
3101
+ const rootNode = serializeFrame(root.id);
3102
+ let totalFrames = 0;
3103
+ const countFrames = (node) => {
3104
+ if (!node) return;
3105
+ totalFrames++;
3106
+ for (const child of node.children) {
3107
+ countFrames(child);
3108
+ }
3109
+ };
3110
+ countFrames(rootNode);
3111
+ return {
3112
+ root: rootNode,
3113
+ totalFrames,
3114
+ timestamp: Date.now(),
3115
+ rootId: root.id
3116
+ };
3117
+ }
3118
+ var bridgeInstalled = false;
3119
+ var lastTreeJson = "";
3120
+ function installFrameVisualizerBridge() {
3121
+ if (bridgeInstalled) return;
3122
+ if (typeof window === "undefined") return;
3123
+ bridgeInstalled = true;
3124
+ window.addEventListener("message", (event) => {
3125
+ const data = event.data;
3126
+ if (!data || typeof data !== "object") return;
3127
+ const type = data.type;
3128
+ if (type === MSG_PING) {
3129
+ const source = event.source;
3130
+ if (source) {
3131
+ source.postMessage({ type: MSG_PONG }, { targetOrigin: "*" });
3132
+ }
3133
+ return;
3134
+ }
3135
+ if (type === MSG_REQUEST_TREE) {
3136
+ const tree = serializeFrameTree();
3137
+ const source = event.source;
3138
+ if (source) {
3139
+ source.postMessage(
3140
+ { type: MSG_TREE, data: tree },
3141
+ { targetOrigin: "*" }
3142
+ );
3143
+ }
3144
+ }
3145
+ });
3146
+ Frame.on("add", () => {
3147
+ pushTreeUpdate();
3148
+ });
3149
+ Frame.on("remove", () => {
3150
+ pushTreeUpdate();
3151
+ });
3152
+ }
3153
+ function pushTreeUpdate() {
3154
+ if (window === window.parent) return;
3155
+ const tree = serializeFrameTree();
3156
+ const treeJson = JSON.stringify(tree);
3157
+ if (treeJson !== lastTreeJson) {
3158
+ lastTreeJson = treeJson;
3159
+ window.parent.postMessage({ type: MSG_TREE_DELTA, data: tree }, "*");
3160
+ }
3161
+ }
3162
+
3050
3163
  // src/framework.ts
3051
3164
  var config = {
3052
3165
  rootId: "lark-root",
@@ -3253,6 +3366,7 @@ var Framework = {
3253
3366
  booted3 = true;
3254
3367
  markBooted();
3255
3368
  markRouterBooted();
3369
+ installFrameVisualizerBridge();
3256
3370
  const rootFrame2 = Frame.root(config.rootId);
3257
3371
  Router._bind();
3258
3372
  const defaultView = config.defaultView || "";
@@ -3685,20 +3799,20 @@ function createState(initialData, config2) {
3685
3799
  lazySet(state, initialData);
3686
3800
  return state;
3687
3801
  }
3688
- var currLazySetKey = null;
3802
+ var curLazySetKey = null;
3689
3803
  function lazySet(target, data) {
3690
3804
  if (isObject(data)) {
3691
3805
  Reflect.ownKeys(data).forEach((key) => {
3692
3806
  const strKey = key;
3693
- if (currLazySetKey) throw new Error("[lark-store] lazy set key conflict");
3694
- currLazySetKey = strKey;
3807
+ if (curLazySetKey) throw new Error("[lark-store] lazy set key conflict");
3808
+ curLazySetKey = strKey;
3695
3809
  target[strKey] = data[strKey];
3696
3810
  });
3697
3811
  }
3698
3812
  }
3699
3813
  function isLazySet(property) {
3700
- if (currLazySetKey === property) {
3701
- currLazySetKey = "";
3814
+ if (curLazySetKey === property) {
3815
+ curLazySetKey = "";
3702
3816
  return true;
3703
3817
  }
3704
3818
  return false;
@@ -4192,7 +4306,7 @@ function multi(useStore) {
4192
4306
  return useFn(view);
4193
4307
  });
4194
4308
  const mixinObj = {
4195
- ctor() {
4309
+ make() {
4196
4310
  if (!rootViewPath) {
4197
4311
  const owner = this["owner"];
4198
4312
  rootViewPath = owner?.["path"] || "";
@@ -4242,17 +4356,17 @@ function restoreComments(source, comments) {
4242
4356
  }
4243
4357
  function processViewEvents(source) {
4244
4358
  return source.replace(
4245
- /v-(\w+)="([^"]+)"/g,
4359
+ /@(\w+)="([^"]+)"/g,
4246
4360
  (fullAttr, eventName, attrValue) => {
4247
4361
  const eventMatch = attrValue.match(/^(\w+)\((.*)\)$/s);
4248
4362
  if (!eventMatch) return fullAttr;
4249
4363
  const handlerName = eventMatch[1];
4250
4364
  const paramsStr = eventMatch[2].trim();
4251
4365
  if (!paramsStr) {
4252
- return `v-${eventName}="${VIEW_ID_PLACEHOLDER}${SPLITTER2}${handlerName}()"`;
4366
+ return `@${eventName}="${VIEW_ID_PLACEHOLDER}${SPLITTER2}${handlerName}()"`;
4253
4367
  }
4254
4368
  const urlParams = jsObjectToUrlParams(paramsStr);
4255
- return `v-${eventName}="${VIEW_ID_PLACEHOLDER}${SPLITTER2}${handlerName}(${urlParams})"`;
4369
+ return `@${eventName}="${VIEW_ID_PLACEHOLDER}${SPLITTER2}${handlerName}(${urlParams})"`;
4256
4370
  }
4257
4371
  );
4258
4372
  }
@@ -4478,12 +4592,12 @@ function convertArtExpression(code, debug, lineNo, blockStack = []) {
4478
4592
  const last = blockStack.pop();
4479
4593
  if (!last) {
4480
4594
  throw new Error(
4481
- `[@lark/mvc error(template] unexpected {{${code}}}: no matching open block`
4595
+ `[@lark/mvc error] unexpected {{${code}}}: no matching open block`
4482
4596
  );
4483
4597
  }
4484
4598
  if (last.ctrl !== expectedCtrl) {
4485
4599
  throw new Error(
4486
- `[@lark/mvc error(template] unexpected {{${code}}}: expected {{/${last.ctrl}}} to close block opened at line ${last.line}`
4600
+ `[@lark/mvc error] unexpected {{${code}}}: expected {{/${last.ctrl}}} to close block opened at line ${last.line}`
4487
4601
  );
4488
4602
  }
4489
4603
  return `${debugPrefix}<%}%>`;
@@ -4843,19 +4957,18 @@ var BUILTIN_GLOBALS = {
4843
4957
  // Reference lookup: (refData, value) => key
4844
4958
  // Finds or allocates a SPLITTER-prefixed key in refData for a given
4845
4959
  // object reference. Used by {{@ref}} operator for passing object
4846
- // references to child views via lark-view attributes.
4847
- // Aligned with mx.js Updater_Ref.
4960
+ // references to child views via v-lark attributes.
4848
4961
  $i: 1,
4849
4962
  // URI encoder: v => encodeURIComponent($n(v)).replace(/[!')(*]/g, extraMap)
4850
4963
  // Extends encodeURIComponent with encoding of ! ' ( ) *.
4851
- // Applied to values in v-event URL parameters and {{!uri}} contexts.
4964
+ // Applied to values in @event URL parameters and {{!uri}} contexts.
4852
4965
  $eu: 1,
4853
4966
  // Quote encoder: v => $n(v).replace(/['"\\]/g, '\\$&')
4854
4967
  // Escapes quotes and backslashes for safe embedding in HTML attribute
4855
4968
  // values (e.g. data-json='...').
4856
4969
  $eq: 1,
4857
4970
  // View ID — the unique identifier of the owning View instance.
4858
- // Injected into v-event attribute values at render time so that
4971
+ // Injected into @event attribute values at render time so that
4859
4972
  // EventDelegator can dispatch events to the correct View handler.
4860
4973
  // The \x1f placeholder in compiled output is replaced with '+$viewId+'.
4861
4974
  $viewId: 1,
@@ -4957,10 +5070,7 @@ export {
4957
5070
  SPLITTER,
4958
5071
  Service,
4959
5072
  State,
4960
- TAG_ATTR_KEY,
4961
- TAG_KEY,
4962
5073
  TAG_NAME_REGEXP,
4963
- TAG_VIEW_KEY,
4964
5074
  Updater,
4965
5075
  VIEW_EVENT_METHOD_REGEXP,
4966
5076
  View,
@@ -4991,6 +5101,7 @@ export {
4991
5101
  getStore,
4992
5102
  getUseStore,
4993
5103
  has,
5104
+ installFrameVisualizerBridge,
4994
5105
  isArray,
4995
5106
  isPlainObject,
4996
5107
  isPrimitive,
@@ -5011,6 +5122,7 @@ export {
5011
5122
  parseUri,
5012
5123
  registerViewClass,
5013
5124
  safeguard,
5125
+ serializeFrameTree,
5014
5126
  setData,
5015
5127
  shallowSet,
5016
5128
  mark2 as storeMark,