@lark.js/mvc 0.0.10 → 0.0.12

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.js CHANGED
@@ -20,6 +20,11 @@ var SVG_NS = "http://www.w3.org/2000/svg";
20
20
  var MATH_NS = "http://www.w3.org/1998/Math/MathML";
21
21
  var TAG_NAME_REGEXP = /<([a-z][^/\0>\x20\t\r\n\f]+)/i;
22
22
  var CALL_BREAK_TIME = 48;
23
+ var V_TEXT_NODE = 0;
24
+ var VDOM_NS_MAP = {
25
+ svg: SVG_NS,
26
+ math: MATH_NS
27
+ };
23
28
  function nextCounter() {
24
29
  return ++globalCounter;
25
30
  }
@@ -32,7 +37,7 @@ var HTML_ENT_MAP = {
32
37
  "`": "#96"
33
38
  };
34
39
  var HTML_ENT_REGEXP = /[&<>"'`]/g;
35
- function encodeSafe(v) {
40
+ function strSafe(v) {
36
41
  return String(v == null ? "" : v);
37
42
  }
38
43
  function encodeHTML(v) {
@@ -50,14 +55,14 @@ var URI_ENT_MAP = {
50
55
  };
51
56
  var URI_ENT_REGEXP = /[!')(*]/g;
52
57
  function encodeURIExtra(v) {
53
- return encodeURIComponent(encodeSafe(v)).replace(
58
+ return encodeURIComponent(strSafe(v)).replace(
54
59
  URI_ENT_REGEXP,
55
60
  (m) => URI_ENT_MAP[m]
56
61
  );
57
62
  }
58
63
  var QUOTE_ENT_REGEXP = /['"\\]/g;
59
- function encodeQ(v) {
60
- return encodeSafe(v).replace(QUOTE_ENT_REGEXP, "\\$&");
64
+ function encodeQuote(v) {
65
+ return strSafe(v).replace(QUOTE_ENT_REGEXP, "\\$&");
61
66
  }
62
67
  function refFn(ref, value, key) {
63
68
  const counter = ref[SPLITTER];
@@ -79,11 +84,66 @@ function isRefToken(s) {
79
84
  }
80
85
 
81
86
  // src/utils.ts
87
+ var CALL_BREAK_TIME2 = 9;
88
+ var callQueue = [];
89
+ var callScheduled = false;
90
+ var schedulerYield = (() => {
91
+ try {
92
+ if (typeof globalThis?.scheduler?.yield === "function") {
93
+ return globalThis.scheduler.yield.bind(globalThis.scheduler);
94
+ }
95
+ } catch {
96
+ }
97
+ return void 0;
98
+ })();
99
+ async function startCall() {
100
+ callScheduled = false;
101
+ const startTime = performance.now();
102
+ while (callQueue.length > 0) {
103
+ const task2 = callQueue.shift();
104
+ try {
105
+ task2();
106
+ } catch (e) {
107
+ console.error("scheduler task error:", e);
108
+ }
109
+ if (callQueue.length > 0 && performance.now() - startTime > CALL_BREAK_TIME2) {
110
+ if (schedulerYield) {
111
+ await schedulerYield();
112
+ } else {
113
+ scheduleNextChunk();
114
+ return;
115
+ }
116
+ }
117
+ }
118
+ }
119
+ function scheduleNextChunk() {
120
+ setTimeout(() => startCall(), 0);
121
+ callScheduled = true;
122
+ }
123
+ function callFunction(fn, args) {
124
+ callQueue.push(() => fn(...args));
125
+ if (!callScheduled) {
126
+ scheduleNextChunk();
127
+ }
128
+ }
82
129
  function isPlainObject(value) {
83
130
  if (typeof value !== "object" || value === null) return false;
84
131
  const proto = Object.getPrototypeOf(value);
85
132
  return proto === null || proto === Object.prototype;
86
133
  }
134
+ function isRecord(value) {
135
+ return typeof value === "object" && value !== null;
136
+ }
137
+ function asRecord(value) {
138
+ if (isRecord(value)) {
139
+ return value;
140
+ }
141
+ console.error("fallback to Object.fromEntries, even an empty object {}.");
142
+ if (Array.isArray(value)) {
143
+ return Object.fromEntries(value.entries());
144
+ }
145
+ return {};
146
+ }
87
147
  function isPrimitiveOrFunc(value) {
88
148
  return !value || typeof value !== "object" && typeof value !== "function";
89
149
  }
@@ -137,13 +197,13 @@ function setData(newData, oldData, changedKeys2, excludes) {
137
197
  let changed = false;
138
198
  for (const p in newData) {
139
199
  if (hasOwnProperty(newData, p)) {
140
- const now2 = newData[p];
200
+ const now = newData[p];
141
201
  const old = oldData[p];
142
- if ((!isPrimitiveOrFunc(now2) || old !== now2) && !excludes.has(p)) {
202
+ if ((!isPrimitiveOrFunc(now) || old !== now) && !excludes.has(p)) {
143
203
  changedKeys2.add(p);
144
204
  changed = true;
145
205
  }
146
- oldData[p] = now2;
206
+ oldData[p] = now;
147
207
  }
148
208
  }
149
209
  return changed;
@@ -236,9 +296,6 @@ function toMap(list, key) {
236
296
  }
237
297
  return map;
238
298
  }
239
- function now() {
240
- return Date.now();
241
- }
242
299
 
243
300
  // src/apply-style.ts
244
301
  var injectedStyleIds = /* @__PURE__ */ new Set();
@@ -990,10 +1047,7 @@ var Router = {
990
1047
  if (lastChanged["path"]) {
991
1048
  document.title = defaultTitle || document.title;
992
1049
  }
993
- emitter2.fire(
994
- RouterEvents.CHANGED,
995
- lastChanged
996
- );
1050
+ emitter2.fire(RouterEvents.CHANGED, asRecord(lastChanged));
997
1051
  }
998
1052
  silent = 0;
999
1053
  if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug && lastChanged) {
@@ -1124,10 +1178,7 @@ var Router = {
1124
1178
  suspend = 1;
1125
1179
  }
1126
1180
  };
1127
- Router.fire(
1128
- RouterEvents.CHANGE,
1129
- changeEvent
1130
- );
1181
+ Router.fire(RouterEvents.CHANGE, changeEvent);
1131
1182
  if (suspend || changeEvent.p) {
1132
1183
  return;
1133
1184
  }
@@ -1401,6 +1452,53 @@ var EventDelegator = {
1401
1452
  }
1402
1453
  };
1403
1454
 
1455
+ // src/module-loader.ts
1456
+ var config = {
1457
+ rootId: "root",
1458
+ routeMode: "history",
1459
+ hashbang: "#!",
1460
+ error: (error) => {
1461
+ throw error;
1462
+ }
1463
+ };
1464
+ function use(names, callback) {
1465
+ const nameList = typeof names === "string" ? [names] : names;
1466
+ const loadPromise = (() => {
1467
+ if (config.require) {
1468
+ const result = config.require(nameList);
1469
+ if (result && typeof result.then === "function") {
1470
+ return result;
1471
+ }
1472
+ return Promise.resolve([]);
1473
+ }
1474
+ return Promise.all(
1475
+ nameList.map((name) => {
1476
+ const importPath = name.startsWith(".") || name.startsWith("/") ? name : `./${name}`;
1477
+ return import(
1478
+ /* @vite-ignore */
1479
+ /* webpackIgnore: true */
1480
+ importPath
1481
+ ).then((mod) => {
1482
+ return mod && (mod["__esModule"] || // For Webpack
1483
+ typeof mod["default"] === "function") ? mod["default"] : mod;
1484
+ }).catch((err) => {
1485
+ const errorHandler = config.error;
1486
+ if (errorHandler) {
1487
+ errorHandler(err instanceof Error ? err : new Error(String(err)));
1488
+ }
1489
+ return void 0;
1490
+ });
1491
+ })
1492
+ );
1493
+ })();
1494
+ if (callback) {
1495
+ loadPromise.then((modules) => {
1496
+ callback(...modules);
1497
+ });
1498
+ }
1499
+ return loadPromise;
1500
+ }
1501
+
1404
1502
  // src/dom.ts
1405
1503
  var wrapMeta = {
1406
1504
  option: [1, "<select multiple>"],
@@ -1476,13 +1574,11 @@ function domGetCompareKey(node) {
1476
1574
  function domSpecialDiff(oldNode, newNode) {
1477
1575
  const specials = DomSpecials[oldNode.nodeName];
1478
1576
  if (!specials) return 0;
1479
- const oldEl = oldNode;
1480
- const newEl = newNode;
1481
1577
  let result = 0;
1482
1578
  for (const prop of specials) {
1483
- if (oldEl[prop] !== newEl[prop]) {
1579
+ if (Reflect.get(oldNode, prop) !== Reflect.get(newNode, prop)) {
1484
1580
  result = 1;
1485
- oldEl[prop] = newEl[prop];
1581
+ Reflect.set(oldNode, prop, Reflect.get(newNode, prop));
1486
1582
  }
1487
1583
  }
1488
1584
  return result;
@@ -1664,6 +1760,465 @@ function applyIdUpdates(updates) {
1664
1760
  }
1665
1761
  }
1666
1762
 
1763
+ // src/vdom.ts
1764
+ var DOM_SPECIALS = {
1765
+ INPUT: ["value", "checked"],
1766
+ TEXTAREA: ["value"],
1767
+ OPTION: ["selected"]
1768
+ };
1769
+ function vdomCreate(tag, props, children, specials) {
1770
+ if (!tag) {
1771
+ return {
1772
+ tag: children ? SPLITTER : V_TEXT_NODE,
1773
+ html: String(props ?? "")
1774
+ };
1775
+ }
1776
+ const propsObj = props || {};
1777
+ const specialsObj = specials || {};
1778
+ const unary = children === 1;
1779
+ let compareKey;
1780
+ let innerHTML = "";
1781
+ let newChildren;
1782
+ let reused;
1783
+ let reusedTotal = 0;
1784
+ let viewList;
1785
+ let isLarkView2;
1786
+ let attrs = `<${tag}`;
1787
+ let hasSpecials;
1788
+ let prevChild;
1789
+ if (children && children !== 1) {
1790
+ for (const c of children) {
1791
+ if (c.attrs !== void 0) {
1792
+ innerHTML += c.attrs + (c.selfClose ? "/>" : `>${c.html}</${c.tag}>`);
1793
+ } else {
1794
+ if (c.tag === V_TEXT_NODE) {
1795
+ innerHTML += encodeHTML(c.html);
1796
+ } else {
1797
+ innerHTML += c.html;
1798
+ }
1799
+ }
1800
+ if (c.tag === V_TEXT_NODE && prevChild && prevChild.tag === V_TEXT_NODE) {
1801
+ prevChild.html += c.html;
1802
+ } else {
1803
+ if (!newChildren) newChildren = [];
1804
+ newChildren.push(c);
1805
+ prevChild = c;
1806
+ }
1807
+ if (c.compareKey) {
1808
+ if (!reused) reused = {};
1809
+ reused[c.compareKey] = (reused[c.compareKey] || 0) + 1;
1810
+ reusedTotal++;
1811
+ }
1812
+ if (c.views) {
1813
+ if (!viewList) viewList = [];
1814
+ viewList.push(...c.views);
1815
+ }
1816
+ }
1817
+ }
1818
+ hasSpecials = specials || void 0;
1819
+ for (const prop in propsObj) {
1820
+ let value = propsObj[prop];
1821
+ if (value === false || value == null) {
1822
+ if (!specialsObj[prop]) {
1823
+ delete propsObj[prop];
1824
+ }
1825
+ continue;
1826
+ } else if (value === true) {
1827
+ propsObj[prop] = value = specialsObj[prop] ? value : "";
1828
+ }
1829
+ if ((prop === "#" || prop === "id") && !compareKey) {
1830
+ compareKey = value;
1831
+ if (prop !== "id") {
1832
+ delete propsObj[prop];
1833
+ continue;
1834
+ }
1835
+ }
1836
+ if (prop === LARK_VIEW && value) {
1837
+ const parsed = parseUri(value);
1838
+ isLarkView2 = parsed.path;
1839
+ if (!viewList) viewList = [];
1840
+ viewList.push([
1841
+ isLarkView2,
1842
+ propsObj["lark-owner"],
1843
+ value,
1844
+ parsed.params
1845
+ ]);
1846
+ if (!compareKey) {
1847
+ compareKey = tag + SPLITTER + isLarkView2;
1848
+ }
1849
+ }
1850
+ if (prop === "value" && tag === "textarea") {
1851
+ innerHTML = String(value);
1852
+ delete propsObj[prop];
1853
+ continue;
1854
+ }
1855
+ attrs += ` ${prop}="${value && encodeHTML(value)}"`;
1856
+ }
1857
+ return {
1858
+ tag,
1859
+ html: innerHTML,
1860
+ attrs,
1861
+ attrsMap: propsObj,
1862
+ attrsSpecials: specialsObj,
1863
+ hasSpecials,
1864
+ children: newChildren,
1865
+ compareKey,
1866
+ reused,
1867
+ reusedTotal,
1868
+ views: viewList,
1869
+ selfClose: unary,
1870
+ isLarkView: isLarkView2
1871
+ };
1872
+ }
1873
+ function isSameVDomNode(a, b) {
1874
+ return a.compareKey && b.compareKey === a.compareKey || !a.compareKey && !b.compareKey && a.tag === b.tag || a.tag === SPLITTER || b.tag === SPLITTER;
1875
+ }
1876
+ function vdomCreateNode(vnode, owner, ref) {
1877
+ const tag = vnode.tag;
1878
+ if (tag === V_TEXT_NODE) {
1879
+ return document.createTextNode(vnode.html);
1880
+ }
1881
+ const sTag = typeof tag === "string" ? tag : tag.toString();
1882
+ const ns = VDOM_NS_MAP[sTag] || owner.namespaceURI;
1883
+ const el = document.createElementNS(ns, sTag);
1884
+ vdomSetAttributes(el, vnode, ref);
1885
+ el.innerHTML = vnode.html;
1886
+ return el;
1887
+ }
1888
+ function vdomSetAttributes(realNode, newVDom, ref, lastVDom) {
1889
+ let changed = 0;
1890
+ const nMap = newVDom.attrsMap || {};
1891
+ const nsMap = newVDom.attrsSpecials || {};
1892
+ if (lastVDom) {
1893
+ const oMap = lastVDom.attrsMap || {};
1894
+ const osMap = lastVDom.attrsSpecials || {};
1895
+ for (const key in oMap) {
1896
+ if (!hasOwnProperty(nMap, key)) {
1897
+ changed = 1;
1898
+ const sValue = osMap[key];
1899
+ if (sValue) {
1900
+ if (ref) {
1901
+ ref.nodeProps.push([realNode, sValue, ""]);
1902
+ } else {
1903
+ Reflect.set(realNode, sValue, "");
1904
+ }
1905
+ } else {
1906
+ realNode.removeAttribute(key);
1907
+ }
1908
+ }
1909
+ }
1910
+ }
1911
+ for (const key in nMap) {
1912
+ const value = nMap[key];
1913
+ const sKey = nsMap[key];
1914
+ if (sKey) {
1915
+ if (Reflect.get(realNode, sKey) !== value) {
1916
+ changed = 1;
1917
+ if (ref) {
1918
+ ref.nodeProps.push([realNode, sKey, value]);
1919
+ } else {
1920
+ Reflect.set(realNode, sKey, value);
1921
+ }
1922
+ }
1923
+ } else {
1924
+ const oldMap = lastVDom?.attrsMap;
1925
+ if (!oldMap || oldMap[key] !== value) {
1926
+ changed = 1;
1927
+ realNode.setAttribute(key, String(value ?? ""));
1928
+ }
1929
+ }
1930
+ }
1931
+ return changed;
1932
+ }
1933
+ function vdomSyncFormState(realNode, newVDom) {
1934
+ const specials = DOM_SPECIALS[realNode.nodeName];
1935
+ if (!specials) return 0;
1936
+ const nMap = newVDom.attrsMap || {};
1937
+ let result = 0;
1938
+ for (const prop of specials) {
1939
+ const newVal = nMap[prop];
1940
+ if (newVal !== void 0 && Reflect.get(realNode, prop) !== newVal) {
1941
+ result = 1;
1942
+ Reflect.set(realNode, prop, newVal);
1943
+ }
1944
+ }
1945
+ return result;
1946
+ }
1947
+ function vdomSetNode(realNode, oldParent, lastVDom, newVDom, ref, frame, keys2, rootView, ready) {
1948
+ const lastTag = lastVDom.tag;
1949
+ const newTag = newVDom.tag;
1950
+ if (lastTag === V_TEXT_NODE || newTag === V_TEXT_NODE) {
1951
+ if (lastTag === newTag) {
1952
+ if (lastVDom.html !== newVDom.html) {
1953
+ ref.changed = 1;
1954
+ realNode.nodeValue = newVDom.html;
1955
+ }
1956
+ } else {
1957
+ ref.changed = 1;
1958
+ domUnmountFrames(frame, realNode);
1959
+ oldParent.replaceChild(vdomCreateNode(newVDom, oldParent, ref), realNode);
1960
+ }
1961
+ return;
1962
+ }
1963
+ if (lastTag === newTag) {
1964
+ if (lastVDom.attrs === newVDom.attrs && lastVDom.html === newVDom.html) {
1965
+ if (newVDom.hasSpecials) {
1966
+ vdomSyncFormState(realNode, newVDom);
1967
+ }
1968
+ return;
1969
+ }
1970
+ let attrChanged = 0;
1971
+ if (lastVDom.attrs !== newVDom.attrs || newVDom.hasSpecials) {
1972
+ attrChanged = vdomSetAttributes(
1973
+ realNode,
1974
+ newVDom,
1975
+ ref,
1976
+ lastVDom
1977
+ );
1978
+ if (attrChanged) ref.changed = 1;
1979
+ }
1980
+ let updateChildren = true;
1981
+ if (newVDom.isLarkView) {
1982
+ const oldFrameId = realNode.getAttribute("id") || "";
1983
+ const newViewPath = newVDom.isLarkView;
1984
+ const oldViewPath = lastVDom.isLarkView || "";
1985
+ if (oldFrameId && newViewPath === oldViewPath) {
1986
+ updateChildren = false;
1987
+ }
1988
+ }
1989
+ vdomSyncFormState(realNode, newVDom);
1990
+ if (updateChildren && !newVDom.selfClose) {
1991
+ vdomSetChildNodes(
1992
+ realNode,
1993
+ lastVDom,
1994
+ newVDom,
1995
+ ref,
1996
+ frame,
1997
+ keys2,
1998
+ rootView,
1999
+ ready
2000
+ );
2001
+ }
2002
+ } else {
2003
+ ref.changed = 1;
2004
+ domUnmountFrames(frame, realNode);
2005
+ oldParent.replaceChild(vdomCreateNode(newVDom, oldParent, ref), realNode);
2006
+ }
2007
+ }
2008
+ function computeLIS(sequence) {
2009
+ const len = sequence.length;
2010
+ if (len === 0) return [];
2011
+ const result = [];
2012
+ const tails = [];
2013
+ const predecessors = new Array(len);
2014
+ let lisLength = 0;
2015
+ for (let i = 0; i < len; i++) {
2016
+ const value = sequence[i];
2017
+ if (value < 0) continue;
2018
+ let lo = 0;
2019
+ let hi = lisLength;
2020
+ while (lo < hi) {
2021
+ const mid = lo + hi >>> 1;
2022
+ if (sequence[tails[mid]] < value) lo = mid + 1;
2023
+ else hi = mid;
2024
+ }
2025
+ tails[lo] = i;
2026
+ predecessors[i] = lo > 0 ? tails[lo - 1] : -1;
2027
+ if (lo === lisLength) lisLength++;
2028
+ }
2029
+ let cursor = tails[lisLength - 1];
2030
+ for (let i = lisLength - 1; i >= 0; i--) {
2031
+ result[i] = cursor;
2032
+ cursor = predecessors[cursor];
2033
+ }
2034
+ return result;
2035
+ }
2036
+ function vdomSetChildNodes(realNode, lastVDom, newVDom, ref, frame, keys2, view, ready) {
2037
+ if (!lastVDom) {
2038
+ ref.changed = 1;
2039
+ realNode.innerHTML = newVDom.html;
2040
+ callFunction(ready, []);
2041
+ return;
2042
+ }
2043
+ if (lastVDom.html === newVDom.html) {
2044
+ callFunction(ready, []);
2045
+ return;
2046
+ }
2047
+ const oldChildren = lastVDom.children;
2048
+ const newChildren = newVDom.children;
2049
+ const oldLen = oldChildren?.length || 0;
2050
+ const newLen = newChildren?.length || 0;
2051
+ if (oldLen === 0 && newLen === 0) {
2052
+ callFunction(ready, []);
2053
+ return;
2054
+ }
2055
+ const nodes = realNode.childNodes;
2056
+ const oldDomNodes = new Array(oldLen);
2057
+ for (let i = 0; i < oldLen; i++) {
2058
+ oldDomNodes[i] = nodes[i];
2059
+ }
2060
+ const usedOldDomNodes = /* @__PURE__ */ new Set();
2061
+ let headIdx = 0;
2062
+ let tailIdx = oldLen - 1;
2063
+ let newHead = 0;
2064
+ let newTail = newLen - 1;
2065
+ while (headIdx <= tailIdx && newHead <= newTail) {
2066
+ const oc = oldChildren[headIdx];
2067
+ const nc = newChildren[newHead];
2068
+ if (!isSameVDomNode(nc, oc)) break;
2069
+ if (nc.tag === SPLITTER || oc.tag === SPLITTER) break;
2070
+ vdomSetNode(
2071
+ oldDomNodes[headIdx],
2072
+ realNode,
2073
+ oc,
2074
+ nc,
2075
+ ref,
2076
+ frame,
2077
+ keys2,
2078
+ view,
2079
+ ready
2080
+ );
2081
+ usedOldDomNodes.add(oldDomNodes[headIdx]);
2082
+ headIdx++;
2083
+ newHead++;
2084
+ }
2085
+ while (headIdx <= tailIdx && newHead <= newTail) {
2086
+ const oc = oldChildren[tailIdx];
2087
+ const nc = newChildren[newTail];
2088
+ if (!isSameVDomNode(nc, oc)) break;
2089
+ if (nc.tag === SPLITTER || oc.tag === SPLITTER) break;
2090
+ vdomSetNode(
2091
+ oldDomNodes[tailIdx],
2092
+ realNode,
2093
+ oc,
2094
+ nc,
2095
+ ref,
2096
+ frame,
2097
+ keys2,
2098
+ view,
2099
+ ready
2100
+ );
2101
+ usedOldDomNodes.add(oldDomNodes[tailIdx]);
2102
+ tailIdx--;
2103
+ newTail--;
2104
+ }
2105
+ if (headIdx > tailIdx && newHead > newTail) {
2106
+ if (ref.asyncCount === 0) callFunction(ready, []);
2107
+ return;
2108
+ }
2109
+ const keyMap = {};
2110
+ for (let i = headIdx; i <= tailIdx; i++) {
2111
+ const c = oldChildren[i];
2112
+ if (c?.compareKey) {
2113
+ if (!keyMap[c.compareKey]) keyMap[c.compareKey] = [];
2114
+ keyMap[c.compareKey].push({ domNode: oldDomNodes[i], vdomNode: c });
2115
+ }
2116
+ }
2117
+ const newRemaining = newTail - newHead + 1;
2118
+ const sequence = new Array(newRemaining);
2119
+ for (let i = 0; i < newRemaining; i++) {
2120
+ const nc = newChildren[newHead + i];
2121
+ const cKey = nc.compareKey;
2122
+ const entries = cKey ? keyMap[cKey] : void 0;
2123
+ if (entries && entries.length > 0) {
2124
+ const entry = entries.shift();
2125
+ if (entries.length === 0) delete keyMap[cKey];
2126
+ const oldIdx = oldChildren.indexOf(entry.vdomNode, headIdx);
2127
+ sequence[i] = oldIdx >= 0 ? oldIdx : -1;
2128
+ usedOldDomNodes.add(entry.domNode);
2129
+ } else {
2130
+ sequence[i] = -1;
2131
+ }
2132
+ }
2133
+ if (newHead > newTail) {
2134
+ for (let i = 0; i < oldLen; i++) {
2135
+ const domNode = oldDomNodes[i];
2136
+ if (domNode && !usedOldDomNodes.has(domNode) && domNode.parentNode === realNode) {
2137
+ domUnmountFrames(frame, domNode);
2138
+ ref.changed = 1;
2139
+ realNode.removeChild(domNode);
2140
+ }
2141
+ }
2142
+ if (ref.asyncCount === 0) callFunction(ready, []);
2143
+ return;
2144
+ }
2145
+ if (headIdx > tailIdx) {
2146
+ const insertRef = tailIdx < oldLen ? oldDomNodes[tailIdx + 1] ?? null : null;
2147
+ for (let i = newHead; i <= newTail; i++) {
2148
+ ref.changed = 1;
2149
+ const newNode = vdomCreateNode(newChildren[i], realNode, ref);
2150
+ realNode.insertBefore(newNode, insertRef);
2151
+ }
2152
+ if (ref.asyncCount === 0) callFunction(ready, []);
2153
+ return;
2154
+ }
2155
+ const lis = computeLIS(sequence);
2156
+ let lisCursor = lis.length - 1;
2157
+ let nextNode = tailIdx + 1 < oldLen ? oldDomNodes[tailIdx + 1] : null;
2158
+ for (let j = newRemaining - 1; j >= 0; j--) {
2159
+ const newIdx = newHead + j;
2160
+ const nc = newChildren[newIdx];
2161
+ if (lisCursor >= 0 && lis[lisCursor] === j) {
2162
+ const oldIdx = sequence[j];
2163
+ vdomSetNode(
2164
+ oldDomNodes[oldIdx],
2165
+ realNode,
2166
+ oldChildren[oldIdx],
2167
+ nc,
2168
+ ref,
2169
+ frame,
2170
+ keys2,
2171
+ view,
2172
+ ready
2173
+ );
2174
+ nextNode = oldDomNodes[oldIdx];
2175
+ lisCursor--;
2176
+ } else if (sequence[j] >= 0) {
2177
+ const oldIdx = sequence[j];
2178
+ ref.changed = 1;
2179
+ realNode.insertBefore(oldDomNodes[oldIdx], nextNode);
2180
+ vdomSetNode(
2181
+ oldDomNodes[oldIdx],
2182
+ realNode,
2183
+ oldChildren[oldIdx],
2184
+ nc,
2185
+ ref,
2186
+ frame,
2187
+ keys2,
2188
+ view,
2189
+ ready
2190
+ );
2191
+ nextNode = oldDomNodes[oldIdx];
2192
+ } else {
2193
+ ref.changed = 1;
2194
+ const newNode = vdomCreateNode(nc, realNode, ref);
2195
+ realNode.insertBefore(newNode, nextNode);
2196
+ nextNode = newNode;
2197
+ }
2198
+ }
2199
+ for (let i = 0; i < oldLen; i++) {
2200
+ const domNode = oldDomNodes[i];
2201
+ if (domNode && !usedOldDomNodes.has(domNode) && domNode.parentNode === realNode) {
2202
+ domUnmountFrames(frame, domNode);
2203
+ ref.changed = 1;
2204
+ realNode.removeChild(domNode);
2205
+ }
2206
+ }
2207
+ if (ref.asyncCount === 0) {
2208
+ callFunction(ready, []);
2209
+ }
2210
+ }
2211
+ function createVDomRef(viewId) {
2212
+ return {
2213
+ viewId,
2214
+ viewRenders: [],
2215
+ nodeProps: [],
2216
+ asyncCount: 0,
2217
+ changed: 0,
2218
+ domOps: []
2219
+ };
2220
+ }
2221
+
1667
2222
  // src/updater.ts
1668
2223
  var Updater = class {
1669
2224
  /** View ID (same as owner frame ID) */
@@ -1686,6 +2241,8 @@ var Updater = class {
1686
2241
  version = 0;
1687
2242
  /** Snapshot of `version` taken by `snapshot()`, used by `altered()`. */
1688
2243
  snapshotVersion;
2244
+ /** Last rendered VDOM tree (only used when virtualDom is enabled) */
2245
+ vdom;
1689
2246
  constructor(viewId) {
1690
2247
  this.viewId = viewId;
1691
2248
  this.data = { vId: viewId };
@@ -1765,28 +2322,58 @@ var Updater = class {
1765
2322
  if (changed && view && node && view.signature > 0 && frame) {
1766
2323
  const template = view.template;
1767
2324
  if (typeof template === "function") {
1768
- const html = template(
1769
- this.data,
1770
- this.viewId,
1771
- this.refData,
1772
- encodeHTML,
1773
- encodeSafe,
1774
- encodeURIExtra,
1775
- refFn,
1776
- encodeQ
1777
- );
1778
- const newDom = domGetNode(html, node);
1779
- const ref = createDomRef();
1780
- domSetChildNodes(node, newDom, ref, frame, keys2);
1781
- applyIdUpdates(ref.idUpdates);
1782
- applyDomOps(ref.domOps);
1783
- for (const v of ref.views) {
1784
- if (v.render) {
1785
- funcWithTry(v.render, [], v, noop);
2325
+ if (config.virtualDom) {
2326
+ const vdomTemplate = template;
2327
+ const newVDom = vdomTemplate(this.data, this.viewId, this.refData);
2328
+ const ref = createVDomRef(this.viewId);
2329
+ const ready = () => {
2330
+ this.vdom = newVDom;
2331
+ if (ref.changed || !view.rendered) {
2332
+ view.endUpdate(this.viewId);
2333
+ }
2334
+ for (const [el, prop, val] of ref.nodeProps) {
2335
+ Reflect.set(el, prop, val);
2336
+ }
2337
+ for (const v of ref.viewRenders) {
2338
+ if (v.render) {
2339
+ funcWithTry(v.render, [], v, noop);
2340
+ }
2341
+ }
2342
+ };
2343
+ vdomSetChildNodes(
2344
+ node,
2345
+ this.vdom,
2346
+ newVDom,
2347
+ ref,
2348
+ frame,
2349
+ keys2,
2350
+ view,
2351
+ ready
2352
+ );
2353
+ } else {
2354
+ const html = template(
2355
+ this.data,
2356
+ this.viewId,
2357
+ this.refData,
2358
+ encodeHTML,
2359
+ strSafe,
2360
+ encodeURIExtra,
2361
+ refFn,
2362
+ encodeQuote
2363
+ );
2364
+ const newDom = domGetNode(html, node);
2365
+ const ref = createDomRef();
2366
+ domSetChildNodes(node, newDom, ref, frame, keys2);
2367
+ applyIdUpdates(ref.idUpdates);
2368
+ applyDomOps(ref.domOps);
2369
+ for (const v of ref.views) {
2370
+ if (v.render) {
2371
+ funcWithTry(v.render, [], v, noop);
2372
+ }
2373
+ }
2374
+ if (ref.hasChanged || !view.rendered) {
2375
+ view.endUpdate(this.viewId);
1786
2376
  }
1787
- }
1788
- if (ref.hasChanged || !view.rendered) {
1789
- view.endUpdate(this.viewId);
1790
2377
  }
1791
2378
  }
1792
2379
  }
@@ -1861,6 +2448,63 @@ var Updater = class {
1861
2448
  }
1862
2449
  };
1863
2450
 
2451
+ // src/view-registry.ts
2452
+ var viewClassRegistry = {};
2453
+ function getViewClass(path) {
2454
+ return viewClassRegistry[path];
2455
+ }
2456
+ function registerViewClass(viewPath, ViewClass) {
2457
+ const parsed = parseUri(viewPath);
2458
+ const path = parsed.path;
2459
+ if (path) {
2460
+ viewClassRegistry[path] = ViewClass;
2461
+ }
2462
+ }
2463
+ function invalidateViewClass(viewPath) {
2464
+ const parsed = parseUri(viewPath);
2465
+ const path = parsed.path;
2466
+ if (path) {
2467
+ Reflect.deleteProperty(viewClassRegistry, path);
2468
+ }
2469
+ }
2470
+ function getViewClassRegistry() {
2471
+ return viewClassRegistry;
2472
+ }
2473
+
2474
+ // src/hmr.ts
2475
+ function reloadViews(viewPath) {
2476
+ const allFrames = Frame.getAll();
2477
+ const toReload = [];
2478
+ for (const [, frame] of allFrames) {
2479
+ if (frame.viewPath) {
2480
+ const parsed = parseUri(frame.viewPath);
2481
+ if (parsed.path === viewPath) {
2482
+ toReload.push({ frame, fullPath: frame.viewPath });
2483
+ }
2484
+ }
2485
+ }
2486
+ for (const { frame, fullPath } of toReload) {
2487
+ frame.mountView(fullPath);
2488
+ }
2489
+ }
2490
+ function acceptView(hot, viewPath) {
2491
+ hot.accept((newModule) => {
2492
+ const candidate = newModule?.default ?? newModule;
2493
+ if (typeof candidate === "function") {
2494
+ const NewViewClass = candidate;
2495
+ registerViewClass(viewPath, NewViewClass);
2496
+ reloadViews(viewPath);
2497
+ } else {
2498
+ hot.invalidate();
2499
+ }
2500
+ });
2501
+ }
2502
+ function disposeView(hot, viewPath) {
2503
+ hot.dispose(() => {
2504
+ invalidateViewClass(viewPath);
2505
+ });
2506
+ }
2507
+
1864
2508
  // src/view.ts
1865
2509
  var VIEW_GLOBALS = {};
1866
2510
  if (typeof window !== "undefined") {
@@ -2137,17 +2781,16 @@ var View = class _View {
2137
2781
  }
2138
2782
  const makes = [];
2139
2783
  oView.makes = makes;
2140
- const proto = oView.prototype;
2141
2784
  const eventsObject = {};
2142
2785
  const eventsList = [];
2143
2786
  const selectorObject = {};
2144
- const mixins = proto["mixins"];
2787
+ const mixins = Reflect.get(oView.prototype, "mixins");
2145
2788
  if (mixins && Array.isArray(mixins)) {
2146
2789
  _View.mergeMixins(mixins, oView, makes);
2147
2790
  }
2148
- for (const p in proto) {
2149
- if (!hasOwnProperty(proto, p)) continue;
2150
- const currentFn = proto[p];
2791
+ for (const p in oView.prototype) {
2792
+ if (!hasOwnProperty(oView.prototype, p)) continue;
2793
+ const currentFn = Reflect.get(oView.prototype, p);
2151
2794
  if (typeof currentFn !== "function") continue;
2152
2795
  const matches = p.match(VIEW_EVENT_METHOD_REGEXP);
2153
2796
  if (!matches) continue;
@@ -2189,29 +2832,30 @@ var View = class _View {
2189
2832
  }
2190
2833
  eventsObject[item] = (eventsObject[item] || 0) | mask;
2191
2834
  const combinedKey = selectorOrCallback + SPLITTER + item;
2192
- const existingFn = proto[combinedKey];
2835
+ const existingFn = Reflect.get(oView.prototype, combinedKey);
2193
2836
  if (!existingFn) {
2194
- proto[combinedKey] = currentFn;
2837
+ Reflect.set(oView.prototype, combinedKey, currentFn);
2195
2838
  } else if (typeof existingFn === "function") {
2196
2839
  const mixinFn = currentFn;
2197
2840
  const existingMixin = existingFn;
2198
2841
  if (existingMixin.marker) {
2199
2842
  if (mixinFn.marker) {
2200
- proto[combinedKey] = _View.processMixinsSameEvent(
2201
- mixinFn,
2202
- existingMixin
2843
+ Reflect.set(
2844
+ oView.prototype,
2845
+ combinedKey,
2846
+ _View.processMixinsSameEvent(mixinFn, existingMixin)
2203
2847
  );
2204
- } else if (hasOwnProperty(proto, p)) {
2205
- proto[combinedKey] = currentFn;
2848
+ } else if (hasOwnProperty(oView.prototype, p)) {
2849
+ Reflect.set(oView.prototype, combinedKey, currentFn);
2206
2850
  }
2207
2851
  }
2208
2852
  }
2209
2853
  }
2210
2854
  }
2211
- _View.wrapMethod(proto, "render", "$renderWrap");
2212
- proto["$evtObjMap"] = eventsObject;
2213
- proto["$globalEvtList"] = eventsList;
2214
- proto["$selMap"] = selectorObject;
2855
+ _View.wrapMethod(asRecord(oView.prototype), "render", "$renderWrap");
2856
+ Reflect.set(oView.prototype, "$evtObjMap", eventsObject);
2857
+ Reflect.set(oView.prototype, "$globalEvtList", eventsList);
2858
+ Reflect.set(oView.prototype, "$selMap", selectorObject);
2215
2859
  return makes;
2216
2860
  }
2217
2861
  /**
@@ -2302,7 +2946,7 @@ var View = class _View {
2302
2946
  this.signature++;
2303
2947
  this.fire("render");
2304
2948
  _View.destroyAllResources(this, false);
2305
- const lookup = this;
2949
+ const lookup = asRecord(this);
2306
2950
  const candidate = lookup[fnName];
2307
2951
  const instanceFn = typeof candidate === "function" ? candidate : originalAsFn;
2308
2952
  const fnToCall = instanceFn === wrapped ? originalAsFn : instanceFn;
@@ -2338,7 +2982,7 @@ var View = class _View {
2338
2982
  * Merge an array of mixin objects into the view prototype.
2339
2983
  */
2340
2984
  static mergeMixins(mixins, viewClass, makes) {
2341
- const proto = viewClass.prototype;
2985
+ const proto = asRecord(viewClass.prototype);
2342
2986
  const temp = {};
2343
2987
  for (const node of mixins) {
2344
2988
  for (const p in node) {
@@ -2429,17 +3073,15 @@ var View = class _View {
2429
3073
  }
2430
3074
  }
2431
3075
  };
2432
- const proto = ChildView.prototype;
2433
3076
  for (const key in definedProps) {
2434
3077
  if (hasOwnProperty(definedProps, key) && key !== "make") {
2435
- proto[key] = definedProps[key];
3078
+ Reflect.set(ChildView.prototype, key, definedProps[key]);
2436
3079
  }
2437
3080
  }
2438
3081
  if (statics) {
2439
- const staticTarget = ChildView;
2440
3082
  for (const key in statics) {
2441
3083
  if (hasOwnProperty(statics, key)) {
2442
- staticTarget[key] = statics[key];
3084
+ Reflect.set(ChildView, key, statics[key]);
2443
3085
  }
2444
3086
  }
2445
3087
  }
@@ -2453,81 +3095,51 @@ var View = class _View {
2453
3095
  _View.mergeMixins(mixins, this, existingCtors);
2454
3096
  return this;
2455
3097
  }
3098
+ // ============================================================
3099
+ // HMR support (static accept / dispose)
3100
+ // ============================================================
3101
+ /**
3102
+ * Set up HMR accept handler for this view module.
3103
+ *
3104
+ * When the module is hot-replaced, the new View class is extracted from
3105
+ * the new module, registered in the view registry, and all currently
3106
+ * mounted frames using this viewPath are re-mounted.
3107
+ *
3108
+ * No-op when `hot` is undefined (production / non-HMR environment).
3109
+ *
3110
+ * ```ts
3111
+ * if (import.meta.hot) {
3112
+ * HomeView.accept(import.meta.hot, 'home');
3113
+ * }
3114
+ * ```
3115
+ */
3116
+ static accept(hot, viewPath) {
3117
+ if (!hot) return;
3118
+ acceptView(hot, viewPath);
3119
+ }
3120
+ /**
3121
+ * Set up HMR dispose handler for this view module.
3122
+ *
3123
+ * When the module is about to be replaced, the old View class is removed
3124
+ * from the registry so subsequent lookups don't return the stale class.
3125
+ *
3126
+ * No-op when `hot` is undefined (production / non-HMR environment).
3127
+ *
3128
+ * ```ts
3129
+ * if (import.meta.hot) {
3130
+ * HomeView.dispose(import.meta.hot, 'home');
3131
+ * }
3132
+ * ```
3133
+ */
3134
+ static dispose(hot, viewPath) {
3135
+ if (!hot) return;
3136
+ disposeView(hot, viewPath);
3137
+ }
2456
3138
  };
2457
3139
  function defineView(props, statics) {
2458
3140
  return View.extend(props, statics);
2459
3141
  }
2460
3142
 
2461
- // src/module-loader.ts
2462
- var config = {
2463
- rootId: "root",
2464
- routeMode: "history",
2465
- hashbang: "#!",
2466
- error: (error) => {
2467
- throw error;
2468
- }
2469
- };
2470
- function use(names, callback) {
2471
- const nameList = typeof names === "string" ? [names] : names;
2472
- const loadPromise = (() => {
2473
- if (config.require) {
2474
- const result = config.require(nameList);
2475
- if (result && typeof result.then === "function") {
2476
- return result;
2477
- }
2478
- return Promise.resolve([]);
2479
- }
2480
- return Promise.all(
2481
- nameList.map((name) => {
2482
- const importPath = name.startsWith(".") || name.startsWith("/") ? name : `./${name}`;
2483
- return import(
2484
- /* @vite-ignore */
2485
- /* webpackIgnore: true */
2486
- importPath
2487
- ).then((mod) => {
2488
- return mod && (mod["__esModule"] || // For Webpack
2489
- typeof mod["default"] === "function") ? mod["default"] : mod;
2490
- }).catch((err) => {
2491
- const errorHandler = config.error;
2492
- if (errorHandler) {
2493
- errorHandler(err instanceof Error ? err : new Error(String(err)));
2494
- }
2495
- return void 0;
2496
- });
2497
- })
2498
- );
2499
- })();
2500
- if (callback) {
2501
- loadPromise.then((modules) => {
2502
- callback(...modules);
2503
- });
2504
- }
2505
- return loadPromise;
2506
- }
2507
-
2508
- // src/view-registry.ts
2509
- var viewClassRegistry = {};
2510
- function getViewClass(path) {
2511
- return viewClassRegistry[path];
2512
- }
2513
- function registerViewClass(viewPath, ViewClass) {
2514
- const parsed = parseUri(viewPath);
2515
- const path = parsed.path;
2516
- if (path) {
2517
- viewClassRegistry[path] = ViewClass;
2518
- }
2519
- }
2520
- function invalidateViewClass(viewPath) {
2521
- const parsed = parseUri(viewPath);
2522
- const path = parsed.path;
2523
- if (path) {
2524
- Reflect.deleteProperty(viewClassRegistry, path);
2525
- }
2526
- }
2527
- function getViewClassRegistry() {
2528
- return viewClassRegistry;
2529
- }
2530
-
2531
3143
  // src/frame.ts
2532
3144
  var frameRegistry = /* @__PURE__ */ new Map();
2533
3145
  var rootFrame;
@@ -2651,9 +3263,15 @@ var Frame = class _Frame extends EventEmitter {
2651
3263
  */
2652
3264
  doMountView(ViewClass, params, node, sign) {
2653
3265
  if (sign !== this.signature) return;
2654
- const mixinCtors = View.prepare(ViewClass);
2655
- const Ctor = ViewClass;
2656
- const view = new Ctor(this.id, this, params, node, mixinCtors);
3266
+ const mixinConstructors = View.prepare(ViewClass);
3267
+ const Constructor = ViewClass;
3268
+ const view = new Constructor(
3269
+ this.id,
3270
+ this,
3271
+ params,
3272
+ node,
3273
+ mixinConstructors
3274
+ );
2657
3275
  this.viewInstance = view;
2658
3276
  view.signature = 1;
2659
3277
  View.delegateEvents(view);
@@ -2814,8 +3432,7 @@ var Frame = class _Frame extends EventEmitter {
2814
3432
  let result;
2815
3433
  const view = this.view;
2816
3434
  if (view && view.rendered) {
2817
- const lookup = view;
2818
- const fn = lookup[name];
3435
+ const fn = Reflect.get(view, name);
2819
3436
  if (typeof fn === "function") {
2820
3437
  result = funcWithTry(fn, args || [], view, noop);
2821
3438
  }
@@ -3370,7 +3987,7 @@ var Service = class {
3370
3987
  }
3371
3988
  const cached = this._payloadCache.get(cacheKey);
3372
3989
  if (cached && cached.cacheInfo) {
3373
- if (now() - cached.cacheInfo.time > cache) {
3990
+ if (Date.now() - cached.cacheInfo.time > cache) {
3374
3991
  this._payloadCache.del(cacheKey);
3375
3992
  return void 0;
3376
3993
  }
@@ -3528,7 +4145,7 @@ function serviceSend(service, attrs, done, flag, save) {
3528
4145
  const list = pendingCacheKeys[cacheKey];
3529
4146
  const entity = list.entity;
3530
4147
  if (entity instanceof Payload && entity.cacheInfo) {
3531
- entity.cacheInfo.time = now();
4148
+ entity.cacheInfo.time = Date.now();
3532
4149
  internals.payloadCache.set(cacheKey, entity);
3533
4150
  }
3534
4151
  Reflect.deleteProperty(pendingCacheKeys, cacheKey);
@@ -3546,20 +4163,19 @@ function serviceSend(service, attrs, done, flag, save) {
3546
4163
  }
3547
4164
  }
3548
4165
 
3549
- // src/frame-visual.ts
3550
- var FrameVisualBridge = {
3551
- MSG_PING: "LARK_VIS_PING",
3552
- MSG_PONG: "LARK_VIS_PONG",
3553
- MSG_REQUEST_TREE: "LARK_VIS_REQUEST_TREE",
3554
- MSG_TREE: "LARK_VIS_TREE",
3555
- MSG_TREE_DELTA: "LARK_VIS_TREE_DELTA"
4166
+ // src/devtool.ts
4167
+ var FrameDevtoolBridge = {
4168
+ MSG_PING: "LARK_DEVTOOL_PING",
4169
+ MSG_PONG: "LARK_DEVTOOL_PONG",
4170
+ MSG_REQUEST_TREE: "LARK_DEVTOOL_REQUEST_TREE",
4171
+ MSG_TREE: "LARK_DEVTOOL_TREE",
4172
+ MSG_TREE_DELTA: "LARK_DEVTOOL_TREE_DELTA"
3556
4173
  };
3557
4174
  function serializeView(view) {
3558
4175
  const evtMap = view.eventObjectMap;
3559
4176
  const eventMethodKeys = evtMap ? Object.keys(evtMap) : [];
3560
4177
  const resourceKeys = view.resources ? Object.keys(view.resources) : [];
3561
- const lookup = view;
3562
- const hasAssign = typeof lookup["assign"] === "function";
4178
+ const hasAssign = typeof view["assign"] === "function";
3563
4179
  let updaterData = null;
3564
4180
  try {
3565
4181
  const ref = view.updater?.refData;
@@ -3637,7 +4253,7 @@ function serializeFrameTree() {
3637
4253
  }
3638
4254
  var bridgeInstalled = false;
3639
4255
  var lastTreeJson = "";
3640
- function installFrameVisualizerBridge() {
4256
+ function installFrameDevtoolBridge() {
3641
4257
  if (bridgeInstalled) return;
3642
4258
  if (typeof window === "undefined") return;
3643
4259
  bridgeInstalled = true;
@@ -3645,22 +4261,22 @@ function installFrameVisualizerBridge() {
3645
4261
  const data = event.data;
3646
4262
  if (!data || typeof data !== "object") return;
3647
4263
  const type = data.type;
3648
- if (type === FrameVisualBridge.MSG_PING) {
4264
+ if (type === FrameDevtoolBridge.MSG_PING) {
3649
4265
  const source = event.source;
3650
4266
  if (source) {
3651
4267
  source.postMessage(
3652
- { type: FrameVisualBridge.MSG_PONG },
4268
+ { type: FrameDevtoolBridge.MSG_PONG },
3653
4269
  { targetOrigin: "*" }
3654
4270
  );
3655
4271
  }
3656
4272
  return;
3657
4273
  }
3658
- if (type === FrameVisualBridge.MSG_REQUEST_TREE) {
4274
+ if (type === FrameDevtoolBridge.MSG_REQUEST_TREE) {
3659
4275
  const tree = serializeFrameTree();
3660
4276
  const source = event.source;
3661
4277
  if (source) {
3662
4278
  source.postMessage(
3663
- { type: FrameVisualBridge.MSG_TREE, data: tree },
4279
+ { type: FrameDevtoolBridge.MSG_TREE, data: tree },
3664
4280
  { targetOrigin: "*" }
3665
4281
  );
3666
4282
  }
@@ -3680,7 +4296,7 @@ function pushTreeUpdate() {
3680
4296
  if (treeJson !== lastTreeJson) {
3681
4297
  lastTreeJson = treeJson;
3682
4298
  window.parent.postMessage(
3683
- { type: FrameVisualBridge.MSG_TREE_DELTA, data: tree },
4299
+ { type: FrameDevtoolBridge.MSG_TREE_DELTA, data: tree },
3684
4300
  "*"
3685
4301
  );
3686
4302
  }
@@ -3693,7 +4309,7 @@ var taskIndex = 0;
3693
4309
  var taskScheduled = false;
3694
4310
  function executeTaskChunk(deadline) {
3695
4311
  const hasDeadline = !!deadline;
3696
- const startTime = now();
4312
+ const startTime = Date.now();
3697
4313
  while (true) {
3698
4314
  const fn = taskList[taskIndex];
3699
4315
  if (!fn) {
@@ -3707,7 +4323,7 @@ function executeTaskChunk(deadline) {
3707
4323
  scheduleTaskChunk();
3708
4324
  return;
3709
4325
  }
3710
- } else if (now() - startTime > CALL_BREAK_TIME && taskList.length > taskIndex + 3) {
4326
+ } else if (Date.now() - startTime > CALL_BREAK_TIME && taskList.length > taskIndex + 3) {
3711
4327
  scheduleTaskChunk();
3712
4328
  return;
3713
4329
  }
@@ -3839,10 +4455,10 @@ function waitZoneViewsRendered(viewId, timeout) {
3839
4455
  timeout = 30 * 1e3;
3840
4456
  }
3841
4457
  const checkFrame = Frame.get(viewId);
3842
- const endTime = now() + timeout;
4458
+ const endTime = Date.now() + timeout;
3843
4459
  return new Promise((resolve) => {
3844
4460
  const check = () => {
3845
- const currentTime = now();
4461
+ const currentTime = Date.now();
3846
4462
  if (currentTime > endTime || !checkFrame) {
3847
4463
  resolve(WAIT_TIMEOUT_OR_NOT_FOUND);
3848
4464
  } else if (checkFrame.childrenCount === checkFrame.readyCount) {
@@ -3904,7 +4520,7 @@ var Framework = {
3904
4520
  booted3 = true;
3905
4521
  markBooted();
3906
4522
  markRouterBooted();
3907
- installFrameVisualizerBridge();
4523
+ installFrameDevtoolBridge();
3908
4524
  const rootFrame2 = Frame.createRoot(config.rootId);
3909
4525
  Router._bind();
3910
4526
  const defaultView = config.defaultView || "";
@@ -4178,7 +4794,6 @@ export {
4178
4794
  EventDelegator,
4179
4795
  EventEmitter,
4180
4796
  Frame,
4181
- FrameVisualBridge,
4182
4797
  Framework,
4183
4798
  LARK_VIEW,
4184
4799
  Payload,
@@ -4195,20 +4810,21 @@ export {
4195
4810
  bindStore,
4196
4811
  computed,
4197
4812
  create,
4813
+ createVDomRef,
4198
4814
  defineView,
4199
4815
  config as frameworkConfig,
4200
4816
  getRouteMode,
4201
- installFrameVisualizerBridge,
4202
4817
  invalidateViewClass,
4203
4818
  mark,
4204
4819
  markBooted,
4205
4820
  markRouterBooted,
4206
4821
  nextCounter,
4207
4822
  registerViewClass,
4823
+ reloadViews,
4208
4824
  resetProjectsMap,
4209
4825
  safeguard,
4210
- serializeFrameTree,
4211
4826
  unmark,
4212
4827
  use,
4213
- useUrlState
4828
+ useUrlState,
4829
+ vdomCreate
4214
4830
  };