@lark.js/mvc 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -27,7 +27,6 @@ __export(index_exports, {
27
27
  EventDelegator: () => EventDelegator,
28
28
  EventEmitter: () => EventEmitter,
29
29
  Frame: () => Frame,
30
- FrameVisualBridge: () => FrameVisualBridge,
31
30
  Framework: () => Framework,
32
31
  LARK_VIEW: () => LARK_VIEW,
33
32
  Payload: () => Payload,
@@ -44,10 +43,10 @@ __export(index_exports, {
44
43
  bindStore: () => bindStore,
45
44
  computed: () => computed,
46
45
  create: () => create,
46
+ createVDomRef: () => createVDomRef,
47
47
  defineView: () => defineView,
48
48
  frameworkConfig: () => config,
49
49
  getRouteMode: () => getRouteMode,
50
- installFrameVisualizerBridge: () => installFrameVisualizerBridge,
51
50
  invalidateViewClass: () => invalidateViewClass,
52
51
  mark: () => mark,
53
52
  markBooted: () => markBooted,
@@ -56,10 +55,10 @@ __export(index_exports, {
56
55
  registerViewClass: () => registerViewClass,
57
56
  resetProjectsMap: () => resetProjectsMap,
58
57
  safeguard: () => safeguard,
59
- serializeFrameTree: () => serializeFrameTree,
60
58
  unmark: () => unmark,
61
59
  use: () => use,
62
- useUrlState: () => useUrlState
60
+ useUrlState: () => useUrlState,
61
+ vdomCreate: () => vdomCreate
63
62
  });
64
63
  module.exports = __toCommonJS(index_exports);
65
64
 
@@ -85,6 +84,12 @@ var SVG_NS = "http://www.w3.org/2000/svg";
85
84
  var MATH_NS = "http://www.w3.org/1998/Math/MathML";
86
85
  var TAG_NAME_REGEXP = /<([a-z][^/\0>\x20\t\r\n\f]+)/i;
87
86
  var CALL_BREAK_TIME = 48;
87
+ var V_TEXT_NODE = 0;
88
+ var TAG_STATIC_KEY = "_";
89
+ var VDOM_NS_MAP = {
90
+ svg: SVG_NS,
91
+ math: MATH_NS
92
+ };
88
93
  function nextCounter() {
89
94
  return ++globalCounter;
90
95
  }
@@ -97,7 +102,7 @@ var HTML_ENT_MAP = {
97
102
  "`": "#96"
98
103
  };
99
104
  var HTML_ENT_REGEXP = /[&<>"'`]/g;
100
- function encodeSafe(v) {
105
+ function strSafe(v) {
101
106
  return String(v == null ? "" : v);
102
107
  }
103
108
  function encodeHTML(v) {
@@ -115,14 +120,14 @@ var URI_ENT_MAP = {
115
120
  };
116
121
  var URI_ENT_REGEXP = /[!')(*]/g;
117
122
  function encodeURIExtra(v) {
118
- return encodeURIComponent(encodeSafe(v)).replace(
123
+ return encodeURIComponent(strSafe(v)).replace(
119
124
  URI_ENT_REGEXP,
120
125
  (m) => URI_ENT_MAP[m]
121
126
  );
122
127
  }
123
128
  var QUOTE_ENT_REGEXP = /['"\\]/g;
124
- function encodeQ(v) {
125
- return encodeSafe(v).replace(QUOTE_ENT_REGEXP, "\\$&");
129
+ function encodeQuote(v) {
130
+ return strSafe(v).replace(QUOTE_ENT_REGEXP, "\\$&");
126
131
  }
127
132
  function refFn(ref, value, key) {
128
133
  const counter = ref[SPLITTER];
@@ -144,11 +149,66 @@ function isRefToken(s) {
144
149
  }
145
150
 
146
151
  // src/utils.ts
152
+ var CALL_BREAK_TIME2 = 9;
153
+ var callQueue = [];
154
+ var callScheduled = false;
155
+ var schedulerYield = (() => {
156
+ try {
157
+ if (typeof globalThis?.scheduler?.yield === "function") {
158
+ return globalThis.scheduler.yield.bind(globalThis.scheduler);
159
+ }
160
+ } catch {
161
+ }
162
+ return void 0;
163
+ })();
164
+ async function startCall() {
165
+ callScheduled = false;
166
+ const startTime = performance.now();
167
+ while (callQueue.length > 0) {
168
+ const task2 = callQueue.shift();
169
+ try {
170
+ task2();
171
+ } catch (e) {
172
+ console.error("scheduler task error:", e);
173
+ }
174
+ if (callQueue.length > 0 && performance.now() - startTime > CALL_BREAK_TIME2) {
175
+ if (schedulerYield) {
176
+ await schedulerYield();
177
+ } else {
178
+ scheduleNextChunk();
179
+ return;
180
+ }
181
+ }
182
+ }
183
+ }
184
+ function scheduleNextChunk() {
185
+ setTimeout(() => startCall(), 0);
186
+ callScheduled = true;
187
+ }
188
+ function callFunction(fn, args) {
189
+ callQueue.push(() => fn(...args));
190
+ if (!callScheduled) {
191
+ scheduleNextChunk();
192
+ }
193
+ }
147
194
  function isPlainObject(value) {
148
195
  if (typeof value !== "object" || value === null) return false;
149
196
  const proto = Object.getPrototypeOf(value);
150
197
  return proto === null || proto === Object.prototype;
151
198
  }
199
+ function isRecord(value) {
200
+ return typeof value === "object" && value !== null;
201
+ }
202
+ function asRecord(value) {
203
+ if (isRecord(value)) {
204
+ return value;
205
+ }
206
+ console.error("fallback to Object.fromEntries, even an empty object {}.");
207
+ if (Array.isArray(value)) {
208
+ return Object.fromEntries(value.entries());
209
+ }
210
+ return {};
211
+ }
152
212
  function isPrimitiveOrFunc(value) {
153
213
  return !value || typeof value !== "object" && typeof value !== "function";
154
214
  }
@@ -202,13 +262,13 @@ function setData(newData, oldData, changedKeys2, excludes) {
202
262
  let changed = false;
203
263
  for (const p in newData) {
204
264
  if (hasOwnProperty(newData, p)) {
205
- const now2 = newData[p];
265
+ const now = newData[p];
206
266
  const old = oldData[p];
207
- if ((!isPrimitiveOrFunc(now2) || old !== now2) && !excludes.has(p)) {
267
+ if ((!isPrimitiveOrFunc(now) || old !== now) && !excludes.has(p)) {
208
268
  changedKeys2.add(p);
209
269
  changed = true;
210
270
  }
211
- oldData[p] = now2;
271
+ oldData[p] = now;
212
272
  }
213
273
  }
214
274
  return changed;
@@ -301,9 +361,6 @@ function toMap(list, key) {
301
361
  }
302
362
  return map;
303
363
  }
304
- function now() {
305
- return Date.now();
306
- }
307
364
 
308
365
  // src/apply-style.ts
309
366
  var injectedStyleIds = /* @__PURE__ */ new Set();
@@ -1055,10 +1112,7 @@ var Router = {
1055
1112
  if (lastChanged["path"]) {
1056
1113
  document.title = defaultTitle || document.title;
1057
1114
  }
1058
- emitter2.fire(
1059
- RouterEvents.CHANGED,
1060
- lastChanged
1061
- );
1115
+ emitter2.fire(RouterEvents.CHANGED, asRecord(lastChanged));
1062
1116
  }
1063
1117
  silent = 0;
1064
1118
  if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug && lastChanged) {
@@ -1189,10 +1243,7 @@ var Router = {
1189
1243
  suspend = 1;
1190
1244
  }
1191
1245
  };
1192
- Router.fire(
1193
- RouterEvents.CHANGE,
1194
- changeEvent
1195
- );
1246
+ Router.fire(RouterEvents.CHANGE, changeEvent);
1196
1247
  if (suspend || changeEvent.p) {
1197
1248
  return;
1198
1249
  }
@@ -1466,6 +1517,53 @@ var EventDelegator = {
1466
1517
  }
1467
1518
  };
1468
1519
 
1520
+ // src/module-loader.ts
1521
+ var config = {
1522
+ rootId: "root",
1523
+ routeMode: "history",
1524
+ hashbang: "#!",
1525
+ error: (error) => {
1526
+ throw error;
1527
+ }
1528
+ };
1529
+ function use(names, callback) {
1530
+ const nameList = typeof names === "string" ? [names] : names;
1531
+ const loadPromise = (() => {
1532
+ if (config.require) {
1533
+ const result = config.require(nameList);
1534
+ if (result && typeof result.then === "function") {
1535
+ return result;
1536
+ }
1537
+ return Promise.resolve([]);
1538
+ }
1539
+ return Promise.all(
1540
+ nameList.map((name) => {
1541
+ const importPath = name.startsWith(".") || name.startsWith("/") ? name : `./${name}`;
1542
+ return import(
1543
+ /* @vite-ignore */
1544
+ /* webpackIgnore: true */
1545
+ importPath
1546
+ ).then((mod) => {
1547
+ return mod && (mod["__esModule"] || // For Webpack
1548
+ typeof mod["default"] === "function") ? mod["default"] : mod;
1549
+ }).catch((err) => {
1550
+ const errorHandler = config.error;
1551
+ if (errorHandler) {
1552
+ errorHandler(err instanceof Error ? err : new Error(String(err)));
1553
+ }
1554
+ return void 0;
1555
+ });
1556
+ })
1557
+ );
1558
+ })();
1559
+ if (callback) {
1560
+ loadPromise.then((modules) => {
1561
+ callback(...modules);
1562
+ });
1563
+ }
1564
+ return loadPromise;
1565
+ }
1566
+
1469
1567
  // src/dom.ts
1470
1568
  var wrapMeta = {
1471
1569
  option: [1, "<select multiple>"],
@@ -1541,13 +1639,11 @@ function domGetCompareKey(node) {
1541
1639
  function domSpecialDiff(oldNode, newNode) {
1542
1640
  const specials = DomSpecials[oldNode.nodeName];
1543
1641
  if (!specials) return 0;
1544
- const oldEl = oldNode;
1545
- const newEl = newNode;
1546
1642
  let result = 0;
1547
1643
  for (const prop of specials) {
1548
- if (oldEl[prop] !== newEl[prop]) {
1644
+ if (Reflect.get(oldNode, prop) !== Reflect.get(newNode, prop)) {
1549
1645
  result = 1;
1550
- oldEl[prop] = newEl[prop];
1646
+ Reflect.set(oldNode, prop, Reflect.get(newNode, prop));
1551
1647
  }
1552
1648
  }
1553
1649
  return result;
@@ -1729,6 +1825,528 @@ function applyIdUpdates(updates) {
1729
1825
  }
1730
1826
  }
1731
1827
 
1828
+ // src/vdom.ts
1829
+ var DOM_SPECIALS = {
1830
+ INPUT: ["value", "checked"],
1831
+ TEXTAREA: ["value"],
1832
+ OPTION: ["selected"]
1833
+ };
1834
+ function vdomCreate(tag, props, children, specials) {
1835
+ if (!tag) {
1836
+ return {
1837
+ tag: children ? SPLITTER : V_TEXT_NODE,
1838
+ html: String(props ?? "")
1839
+ };
1840
+ }
1841
+ const propsObj = props || {};
1842
+ const specialsObj = specials || {};
1843
+ const unary = children === 1;
1844
+ let compareKey;
1845
+ let innerHTML = "";
1846
+ let newChildren;
1847
+ let reused;
1848
+ let reusedTotal = 0;
1849
+ let viewList;
1850
+ let isLarkView2;
1851
+ let attrs = `<${tag}`;
1852
+ let hasSpecials;
1853
+ let prevChild;
1854
+ if (children && children !== 1) {
1855
+ for (const c of children) {
1856
+ if (c.attrs !== void 0) {
1857
+ innerHTML += c.attrs + (c.selfClose ? "/>" : `>${c.html}</${c.tag}>`);
1858
+ } else {
1859
+ if (c.tag === V_TEXT_NODE) {
1860
+ innerHTML += encodeHTML(c.html);
1861
+ } else {
1862
+ innerHTML += c.html;
1863
+ }
1864
+ }
1865
+ if (c.tag === V_TEXT_NODE && prevChild && prevChild.tag === V_TEXT_NODE) {
1866
+ prevChild.html += c.html;
1867
+ } else {
1868
+ if (!newChildren) newChildren = [];
1869
+ newChildren.push(c);
1870
+ prevChild = c;
1871
+ }
1872
+ if (c.compareKey) {
1873
+ if (!reused) reused = {};
1874
+ reused[c.compareKey] = (reused[c.compareKey] || 0) + 1;
1875
+ reusedTotal++;
1876
+ }
1877
+ if (c.views) {
1878
+ if (!viewList) viewList = [];
1879
+ viewList.push(...c.views);
1880
+ }
1881
+ }
1882
+ }
1883
+ hasSpecials = specials || void 0;
1884
+ for (const prop in propsObj) {
1885
+ let value = propsObj[prop];
1886
+ if (value === false || value == null) {
1887
+ if (!specialsObj[prop]) {
1888
+ delete propsObj[prop];
1889
+ }
1890
+ continue;
1891
+ } else if (value === true) {
1892
+ propsObj[prop] = value = specialsObj[prop] ? value : "";
1893
+ }
1894
+ if ((prop === "#" || prop === "id" || prop === TAG_STATIC_KEY) && !compareKey) {
1895
+ compareKey = value;
1896
+ if (prop !== "id") {
1897
+ delete propsObj[prop];
1898
+ continue;
1899
+ }
1900
+ }
1901
+ if (prop === LARK_VIEW && value) {
1902
+ const parsed = parseUri(value);
1903
+ isLarkView2 = parsed.path;
1904
+ if (!viewList) viewList = [];
1905
+ viewList.push([
1906
+ isLarkView2,
1907
+ propsObj["lark-owner"],
1908
+ value,
1909
+ parsed.params
1910
+ ]);
1911
+ if (!compareKey) {
1912
+ compareKey = tag + SPLITTER + isLarkView2;
1913
+ }
1914
+ }
1915
+ if (prop === "value" && tag === "textarea") {
1916
+ innerHTML = String(value);
1917
+ delete propsObj[prop];
1918
+ continue;
1919
+ }
1920
+ attrs += ` ${prop}="${value && encodeHTML(value)}"`;
1921
+ }
1922
+ return {
1923
+ tag,
1924
+ html: innerHTML,
1925
+ attrs,
1926
+ attrsMap: propsObj,
1927
+ attrsSpecials: specialsObj,
1928
+ hasSpecials,
1929
+ children: newChildren,
1930
+ compareKey,
1931
+ reused,
1932
+ reusedTotal,
1933
+ views: viewList,
1934
+ selfClose: unary,
1935
+ isLarkView: isLarkView2
1936
+ };
1937
+ }
1938
+ function isSameVDomNode(a, b) {
1939
+ return a.compareKey && b.compareKey === a.compareKey || !a.compareKey && !b.compareKey && a.tag === b.tag || a.tag === SPLITTER || b.tag === SPLITTER;
1940
+ }
1941
+ function getKeyNodes(list, nodes, start, end, realEnd) {
1942
+ const keyedNodes = {};
1943
+ for (let i = end, re = realEnd; i >= start; i--, re--) {
1944
+ const oc = list[i];
1945
+ const cKey = oc.compareKey;
1946
+ if (cKey) {
1947
+ const bucket = keyedNodes[cKey] || (keyedNodes[cKey] = []);
1948
+ bucket.push(nodes[re]);
1949
+ }
1950
+ }
1951
+ return keyedNodes;
1952
+ }
1953
+ function vdomCreateNode(vnode, owner, ref) {
1954
+ const tag = vnode.tag;
1955
+ if (tag === V_TEXT_NODE) {
1956
+ return document.createTextNode(vnode.html);
1957
+ }
1958
+ const sTag = typeof tag === "string" ? tag : tag.toString();
1959
+ const ns = VDOM_NS_MAP[sTag] || owner.namespaceURI;
1960
+ const el = document.createElementNS(ns, sTag);
1961
+ vdomSetAttributes(el, vnode, ref);
1962
+ el.innerHTML = vnode.html;
1963
+ return el;
1964
+ }
1965
+ function vdomSetAttributes(realNode, newVDom, ref, lastVDom) {
1966
+ let changed = 0;
1967
+ const nMap = newVDom.attrsMap || {};
1968
+ const nsMap = newVDom.attrsSpecials || {};
1969
+ if (lastVDom) {
1970
+ const oMap = lastVDom.attrsMap || {};
1971
+ const osMap = lastVDom.attrsSpecials || {};
1972
+ for (const key in oMap) {
1973
+ if (!hasOwnProperty(nMap, key)) {
1974
+ changed = 1;
1975
+ const sValue = osMap[key];
1976
+ if (sValue) {
1977
+ if (ref) {
1978
+ ref.nodeProps.push([realNode, sValue, ""]);
1979
+ } else {
1980
+ Reflect.set(realNode, sValue, "");
1981
+ }
1982
+ } else {
1983
+ realNode.removeAttribute(key);
1984
+ }
1985
+ }
1986
+ }
1987
+ }
1988
+ for (const key in nMap) {
1989
+ const value = nMap[key];
1990
+ const sKey = nsMap[key];
1991
+ if (sKey) {
1992
+ if (Reflect.get(realNode, sKey) !== value) {
1993
+ changed = 1;
1994
+ if (ref) {
1995
+ ref.nodeProps.push([realNode, sKey, value]);
1996
+ } else {
1997
+ Reflect.set(realNode, sKey, value);
1998
+ }
1999
+ }
2000
+ } else {
2001
+ const oldMap = lastVDom?.attrsMap;
2002
+ if (!oldMap || oldMap[key] !== value) {
2003
+ changed = 1;
2004
+ realNode.setAttribute(key, String(value ?? ""));
2005
+ }
2006
+ }
2007
+ }
2008
+ return changed;
2009
+ }
2010
+ function vdomSyncFormState(realNode, newVDom) {
2011
+ const specials = DOM_SPECIALS[realNode.nodeName];
2012
+ if (!specials) return 0;
2013
+ const nMap = newVDom.attrsMap || {};
2014
+ let result = 0;
2015
+ for (const prop of specials) {
2016
+ const newVal = nMap[prop];
2017
+ if (newVal !== void 0 && Reflect.get(realNode, prop) !== newVal) {
2018
+ result = 1;
2019
+ Reflect.set(realNode, prop, newVal);
2020
+ }
2021
+ }
2022
+ return result;
2023
+ }
2024
+ function vdomSetNode(realNode, oldParent, lastVDom, newVDom, ref, frame, keys2, rootView, ready) {
2025
+ const lastTag = lastVDom.tag;
2026
+ const newTag = newVDom.tag;
2027
+ if (lastTag === V_TEXT_NODE || newTag === V_TEXT_NODE) {
2028
+ if (lastTag === newTag) {
2029
+ if (lastVDom.html !== newVDom.html) {
2030
+ ref.changed = 1;
2031
+ realNode.nodeValue = newVDom.html;
2032
+ }
2033
+ } else {
2034
+ ref.changed = 1;
2035
+ domUnmountFrames(frame, realNode);
2036
+ oldParent.replaceChild(vdomCreateNode(newVDom, oldParent, ref), realNode);
2037
+ }
2038
+ return;
2039
+ }
2040
+ if (lastTag === newTag) {
2041
+ const lastAMap = lastVDom.attrsMap || {};
2042
+ const newAMap = newVDom.attrsMap || {};
2043
+ if (lastVDom.compareKey && lastVDom.compareKey === newVDom.compareKey && !lastAMap["id"] && !newAMap["id"]) {
2044
+ return;
2045
+ }
2046
+ let attrChanged = 0;
2047
+ if (lastVDom.attrs !== newVDom.attrs || newVDom.hasSpecials) {
2048
+ attrChanged = vdomSetAttributes(
2049
+ realNode,
2050
+ newVDom,
2051
+ ref,
2052
+ lastVDom
2053
+ );
2054
+ if (attrChanged) ref.changed = 1;
2055
+ }
2056
+ let updateChildren = true;
2057
+ if (newVDom.isLarkView) {
2058
+ const oldFrameId = realNode.getAttribute("id") || "";
2059
+ const newViewPath = newVDom.isLarkView;
2060
+ const oldViewPath = lastVDom.isLarkView || "";
2061
+ if (oldFrameId && newViewPath === oldViewPath) {
2062
+ updateChildren = false;
2063
+ }
2064
+ }
2065
+ vdomSyncFormState(realNode, newVDom);
2066
+ if (updateChildren && !newVDom.selfClose) {
2067
+ vdomSetChildNodes(
2068
+ realNode,
2069
+ lastVDom,
2070
+ newVDom,
2071
+ ref,
2072
+ frame,
2073
+ keys2,
2074
+ rootView,
2075
+ ready
2076
+ );
2077
+ }
2078
+ } else {
2079
+ ref.changed = 1;
2080
+ domUnmountFrames(frame, realNode);
2081
+ oldParent.replaceChild(vdomCreateNode(newVDom, oldParent, ref), realNode);
2082
+ }
2083
+ }
2084
+ function vdomSetChildNodes(realNode, lastVDom, newVDom, ref, frame, keys2, view, ready) {
2085
+ if (!lastVDom) {
2086
+ ref.changed = 1;
2087
+ realNode.innerHTML = newVDom.html;
2088
+ return;
2089
+ }
2090
+ if (lastVDom.html === newVDom.html) {
2091
+ return;
2092
+ }
2093
+ const oldChildren = lastVDom.children;
2094
+ const newChildren = newVDom.children;
2095
+ const oldLen = oldChildren?.length || 0;
2096
+ const newLen = newChildren?.length || 0;
2097
+ if (oldLen === 0 && newLen === 0) return;
2098
+ const nodes = realNode.childNodes;
2099
+ let oldStart = 0;
2100
+ let oldEnd = oldLen - 1;
2101
+ let newStart = 0;
2102
+ let newEnd = newLen - 1;
2103
+ let realStart = oldStart;
2104
+ let realEnd = oldEnd;
2105
+ let keyedNodes;
2106
+ const oldReusedTotal = lastVDom.reusedTotal || 0;
2107
+ const newReusedTotal = newVDom.reusedTotal || 0;
2108
+ let oldStartNode = oldChildren?.[oldStart];
2109
+ let oldEndNode = oldChildren?.[oldEnd];
2110
+ let newStartNode = newChildren?.[newStart];
2111
+ let newEndNode = newChildren?.[newEnd];
2112
+ while (oldStart <= oldEnd && newStart <= newEnd) {
2113
+ if (!oldStartNode) {
2114
+ oldStartNode = oldChildren?.[++oldStart];
2115
+ realStart++;
2116
+ continue;
2117
+ }
2118
+ if (!oldEndNode) {
2119
+ oldEndNode = oldChildren?.[--oldEnd];
2120
+ realEnd--;
2121
+ continue;
2122
+ }
2123
+ if (isSameVDomNode(newStartNode, oldStartNode)) {
2124
+ if (newStartNode.tag === SPLITTER || oldStartNode.tag === SPLITTER) {
2125
+ ref.changed = 1;
2126
+ domUnmountFrames(frame, realNode);
2127
+ if (newStartNode.tag === SPLITTER) {
2128
+ realNode.innerHTML = newStartNode.html;
2129
+ } else {
2130
+ realNode.innerHTML = "";
2131
+ realNode.appendChild(vdomCreateNode(newStartNode, realNode, ref));
2132
+ }
2133
+ } else {
2134
+ vdomSetNode(
2135
+ nodes[realStart],
2136
+ realNode,
2137
+ oldStartNode,
2138
+ newStartNode,
2139
+ ref,
2140
+ frame,
2141
+ keys2,
2142
+ view,
2143
+ ready
2144
+ );
2145
+ }
2146
+ reduceCached(keyedNodes, oldStartNode, nodes[realStart]);
2147
+ realStart++;
2148
+ oldStartNode = oldChildren?.[++oldStart];
2149
+ newStartNode = newChildren?.[++newStart];
2150
+ } else if (isSameVDomNode(newEndNode, oldEndNode)) {
2151
+ if (newEndNode.tag === SPLITTER || oldEndNode.tag === SPLITTER) {
2152
+ ref.changed = 1;
2153
+ domUnmountFrames(frame, realNode);
2154
+ realNode.innerHTML = newEndNode.tag === SPLITTER ? newEndNode.html : "";
2155
+ if (newEndNode.tag !== SPLITTER) {
2156
+ realNode.appendChild(vdomCreateNode(newEndNode, realNode, ref));
2157
+ }
2158
+ } else {
2159
+ vdomSetNode(
2160
+ nodes[realEnd],
2161
+ realNode,
2162
+ oldEndNode,
2163
+ newEndNode,
2164
+ ref,
2165
+ frame,
2166
+ keys2,
2167
+ view,
2168
+ ready
2169
+ );
2170
+ }
2171
+ reduceCached(keyedNodes, oldEndNode, nodes[realEnd]);
2172
+ realEnd--;
2173
+ oldEndNode = oldChildren?.[--oldEnd];
2174
+ newEndNode = newChildren?.[--newEnd];
2175
+ } else if (isSameVDomNode(newEndNode, oldStartNode)) {
2176
+ if (newEndNode.tag === SPLITTER || oldStartNode.tag === SPLITTER) {
2177
+ ref.changed = 1;
2178
+ domUnmountFrames(frame, realNode);
2179
+ realNode.innerHTML = newEndNode.tag === SPLITTER ? newEndNode.html : "";
2180
+ if (newEndNode.tag !== SPLITTER) {
2181
+ realNode.appendChild(vdomCreateNode(newEndNode, realNode, ref));
2182
+ }
2183
+ } else {
2184
+ const oi = nodes[realStart];
2185
+ realNode.insertBefore(oi, nodes[realEnd + 1] || null);
2186
+ vdomSetNode(
2187
+ oi,
2188
+ realNode,
2189
+ oldStartNode,
2190
+ newEndNode,
2191
+ ref,
2192
+ frame,
2193
+ keys2,
2194
+ view,
2195
+ ready
2196
+ );
2197
+ }
2198
+ reduceCached(keyedNodes, oldStartNode, nodes[realStart]);
2199
+ realStart++;
2200
+ oldStartNode = oldChildren?.[++oldStart];
2201
+ newEndNode = newChildren?.[--newEnd];
2202
+ } else if (isSameVDomNode(newStartNode, oldEndNode)) {
2203
+ if (newStartNode.tag === SPLITTER || oldEndNode.tag === SPLITTER) {
2204
+ ref.changed = 1;
2205
+ domUnmountFrames(frame, realNode);
2206
+ realNode.innerHTML = newStartNode.tag === SPLITTER ? newStartNode.html : "";
2207
+ if (newStartNode.tag !== SPLITTER) {
2208
+ realNode.appendChild(vdomCreateNode(newStartNode, realNode, ref));
2209
+ }
2210
+ } else {
2211
+ const oi = nodes[realEnd];
2212
+ realNode.insertBefore(oi, nodes[realStart]);
2213
+ vdomSetNode(
2214
+ oi,
2215
+ realNode,
2216
+ oldEndNode,
2217
+ newStartNode,
2218
+ ref,
2219
+ frame,
2220
+ keys2,
2221
+ view,
2222
+ ready
2223
+ );
2224
+ }
2225
+ reduceCached(keyedNodes, oldEndNode, nodes[realEnd]);
2226
+ realEnd--;
2227
+ oldEndNode = oldChildren?.[--oldEnd];
2228
+ newStartNode = newChildren?.[++newStart];
2229
+ } else {
2230
+ if (!keyedNodes && newReusedTotal > 0 && oldReusedTotal > 0) {
2231
+ keyedNodes = getKeyNodes(
2232
+ oldChildren,
2233
+ nodes,
2234
+ oldStart,
2235
+ oldEnd,
2236
+ realEnd
2237
+ );
2238
+ }
2239
+ const cKey = newStartNode.compareKey;
2240
+ let found;
2241
+ let compareKey;
2242
+ if (cKey && keyedNodes) {
2243
+ found = keyedNodes[cKey];
2244
+ compareKey = void 0;
2245
+ while (found && found.length > 0) {
2246
+ compareKey = found.pop();
2247
+ if (compareKey) break;
2248
+ }
2249
+ if (found && found.length === 0) delete keyedNodes[cKey];
2250
+ }
2251
+ if (compareKey) {
2252
+ if (compareKey !== nodes[realStart]) {
2253
+ for (let j = oldStart + 1; j <= oldEnd; j++) {
2254
+ const oc = oldChildren?.[j];
2255
+ if (oc && nodes[realStart + (j - oldStart)] === compareKey) {
2256
+ oldChildren[j] = void 0;
2257
+ break;
2258
+ }
2259
+ }
2260
+ realNode.insertBefore(compareKey, nodes[realStart]);
2261
+ }
2262
+ vdomSetNode(
2263
+ compareKey,
2264
+ realNode,
2265
+ oldStartNode,
2266
+ newStartNode,
2267
+ ref,
2268
+ frame,
2269
+ keys2,
2270
+ view,
2271
+ ready
2272
+ );
2273
+ } else if (oldStartNode.compareKey && lastVDom.reused?.[oldStartNode.compareKey] && newVDom.reused?.[oldStartNode.compareKey] || nodes[realStart]?.id && realNode.querySelectorAll?.(
2274
+ `#${nodes[realStart].id}`
2275
+ )?.length && !newStartNode.isLarkView) {
2276
+ ref.changed = 1;
2277
+ const newNode = vdomCreateNode(newStartNode, realNode, ref);
2278
+ realNode.insertBefore(newNode, nodes[realStart]);
2279
+ realStart--;
2280
+ realEnd++;
2281
+ } else {
2282
+ vdomSetNode(
2283
+ nodes[realStart],
2284
+ realNode,
2285
+ oldStartNode,
2286
+ newStartNode,
2287
+ ref,
2288
+ frame,
2289
+ keys2,
2290
+ view,
2291
+ ready
2292
+ );
2293
+ }
2294
+ realStart++;
2295
+ oldStartNode = oldChildren?.[++oldStart];
2296
+ newStartNode = newChildren?.[++newStart];
2297
+ }
2298
+ }
2299
+ if (newStart <= newEnd) {
2300
+ const refNode = nodes[realEnd + 1] || null;
2301
+ for (let i = newStart; i <= newEnd; i++) {
2302
+ ref.changed = 1;
2303
+ const nc = newChildren[i];
2304
+ if (nc.tag === SPLITTER) {
2305
+ domUnmountFrames(frame, realNode);
2306
+ realNode.innerHTML = nc.html;
2307
+ return;
2308
+ }
2309
+ const newNode = vdomCreateNode(nc, realNode, ref);
2310
+ realNode.insertBefore(newNode, refNode);
2311
+ }
2312
+ }
2313
+ if (oldStart <= oldEnd) {
2314
+ for (let i = realEnd; i >= realStart; i--) {
2315
+ const node = nodes[i];
2316
+ if (node) {
2317
+ domUnmountFrames(frame, node);
2318
+ ref.changed = 1;
2319
+ realNode.removeChild(node);
2320
+ }
2321
+ }
2322
+ }
2323
+ if (ref.asyncCount === 0) {
2324
+ callFunction(ready, []);
2325
+ }
2326
+ }
2327
+ function reduceCached(keyedNodes, node, compared) {
2328
+ if (!keyedNodes || !node.compareKey) return;
2329
+ const bucket = keyedNodes[node.compareKey];
2330
+ if (bucket) {
2331
+ for (let i = bucket.length; i--; ) {
2332
+ if (bucket[i] === compared) {
2333
+ bucket[i] = void 0;
2334
+ break;
2335
+ }
2336
+ }
2337
+ }
2338
+ }
2339
+ function createVDomRef(viewId) {
2340
+ return {
2341
+ viewId,
2342
+ viewRenders: [],
2343
+ nodeProps: [],
2344
+ asyncCount: 0,
2345
+ changed: 0,
2346
+ domOps: []
2347
+ };
2348
+ }
2349
+
1732
2350
  // src/updater.ts
1733
2351
  var Updater = class {
1734
2352
  /** View ID (same as owner frame ID) */
@@ -1751,6 +2369,8 @@ var Updater = class {
1751
2369
  version = 0;
1752
2370
  /** Snapshot of `version` taken by `snapshot()`, used by `altered()`. */
1753
2371
  snapshotVersion;
2372
+ /** Last rendered VDOM tree (only used when virtualDom is enabled) */
2373
+ vdom;
1754
2374
  constructor(viewId) {
1755
2375
  this.viewId = viewId;
1756
2376
  this.data = { vId: viewId };
@@ -1830,28 +2450,61 @@ var Updater = class {
1830
2450
  if (changed && view && node && view.signature > 0 && frame) {
1831
2451
  const template = view.template;
1832
2452
  if (typeof template === "function") {
1833
- const html = template(
1834
- this.data,
1835
- this.viewId,
1836
- this.refData,
1837
- encodeHTML,
1838
- encodeSafe,
1839
- encodeURIExtra,
1840
- refFn,
1841
- encodeQ
1842
- );
1843
- const newDom = domGetNode(html, node);
1844
- const ref = createDomRef();
1845
- domSetChildNodes(node, newDom, ref, frame, keys2);
1846
- applyIdUpdates(ref.idUpdates);
1847
- applyDomOps(ref.domOps);
1848
- for (const v of ref.views) {
1849
- if (v.render) {
1850
- funcWithTry(v.render, [], v, noop);
2453
+ if (config.virtualDom) {
2454
+ const vdomTemplate = template;
2455
+ const newVDom = vdomTemplate(this.data, this.viewId, this.refData);
2456
+ const ref = createVDomRef(this.viewId);
2457
+ const ready = () => {
2458
+ this.vdom = newVDom;
2459
+ if (ref.changed || !view.rendered) {
2460
+ view.endUpdate(this.viewId);
2461
+ }
2462
+ for (const [el, prop, val] of ref.nodeProps) {
2463
+ Reflect.set(el, prop, val);
2464
+ }
2465
+ for (const v of ref.viewRenders) {
2466
+ if (v.render) {
2467
+ funcWithTry(v.render, [], v, noop);
2468
+ }
2469
+ }
2470
+ };
2471
+ vdomSetChildNodes(
2472
+ node,
2473
+ this.vdom,
2474
+ newVDom,
2475
+ ref,
2476
+ frame,
2477
+ keys2,
2478
+ view,
2479
+ ready
2480
+ );
2481
+ if (ref.asyncCount === 0) {
2482
+ ready();
2483
+ }
2484
+ } else {
2485
+ const html = template(
2486
+ this.data,
2487
+ this.viewId,
2488
+ this.refData,
2489
+ encodeHTML,
2490
+ strSafe,
2491
+ encodeURIExtra,
2492
+ refFn,
2493
+ encodeQuote
2494
+ );
2495
+ const newDom = domGetNode(html, node);
2496
+ const ref = createDomRef();
2497
+ domSetChildNodes(node, newDom, ref, frame, keys2);
2498
+ applyIdUpdates(ref.idUpdates);
2499
+ applyDomOps(ref.domOps);
2500
+ for (const v of ref.views) {
2501
+ if (v.render) {
2502
+ funcWithTry(v.render, [], v, noop);
2503
+ }
2504
+ }
2505
+ if (ref.hasChanged || !view.rendered) {
2506
+ view.endUpdate(this.viewId);
1851
2507
  }
1852
- }
1853
- if (ref.hasChanged || !view.rendered) {
1854
- view.endUpdate(this.viewId);
1855
2508
  }
1856
2509
  }
1857
2510
  }
@@ -2202,17 +2855,16 @@ var View = class _View {
2202
2855
  }
2203
2856
  const makes = [];
2204
2857
  oView.makes = makes;
2205
- const proto = oView.prototype;
2206
2858
  const eventsObject = {};
2207
2859
  const eventsList = [];
2208
2860
  const selectorObject = {};
2209
- const mixins = proto["mixins"];
2861
+ const mixins = Reflect.get(oView.prototype, "mixins");
2210
2862
  if (mixins && Array.isArray(mixins)) {
2211
2863
  _View.mergeMixins(mixins, oView, makes);
2212
2864
  }
2213
- for (const p in proto) {
2214
- if (!hasOwnProperty(proto, p)) continue;
2215
- const currentFn = proto[p];
2865
+ for (const p in oView.prototype) {
2866
+ if (!hasOwnProperty(oView.prototype, p)) continue;
2867
+ const currentFn = Reflect.get(oView.prototype, p);
2216
2868
  if (typeof currentFn !== "function") continue;
2217
2869
  const matches = p.match(VIEW_EVENT_METHOD_REGEXP);
2218
2870
  if (!matches) continue;
@@ -2254,29 +2906,30 @@ var View = class _View {
2254
2906
  }
2255
2907
  eventsObject[item] = (eventsObject[item] || 0) | mask;
2256
2908
  const combinedKey = selectorOrCallback + SPLITTER + item;
2257
- const existingFn = proto[combinedKey];
2909
+ const existingFn = Reflect.get(oView.prototype, combinedKey);
2258
2910
  if (!existingFn) {
2259
- proto[combinedKey] = currentFn;
2911
+ Reflect.set(oView.prototype, combinedKey, currentFn);
2260
2912
  } else if (typeof existingFn === "function") {
2261
2913
  const mixinFn = currentFn;
2262
2914
  const existingMixin = existingFn;
2263
2915
  if (existingMixin.marker) {
2264
2916
  if (mixinFn.marker) {
2265
- proto[combinedKey] = _View.processMixinsSameEvent(
2266
- mixinFn,
2267
- existingMixin
2917
+ Reflect.set(
2918
+ oView.prototype,
2919
+ combinedKey,
2920
+ _View.processMixinsSameEvent(mixinFn, existingMixin)
2268
2921
  );
2269
- } else if (hasOwnProperty(proto, p)) {
2270
- proto[combinedKey] = currentFn;
2922
+ } else if (hasOwnProperty(oView.prototype, p)) {
2923
+ Reflect.set(oView.prototype, combinedKey, currentFn);
2271
2924
  }
2272
2925
  }
2273
2926
  }
2274
2927
  }
2275
2928
  }
2276
- _View.wrapMethod(proto, "render", "$renderWrap");
2277
- proto["$evtObjMap"] = eventsObject;
2278
- proto["$globalEvtList"] = eventsList;
2279
- proto["$selMap"] = selectorObject;
2929
+ _View.wrapMethod(asRecord(oView.prototype), "render", "$renderWrap");
2930
+ Reflect.set(oView.prototype, "$evtObjMap", eventsObject);
2931
+ Reflect.set(oView.prototype, "$globalEvtList", eventsList);
2932
+ Reflect.set(oView.prototype, "$selMap", selectorObject);
2280
2933
  return makes;
2281
2934
  }
2282
2935
  /**
@@ -2367,7 +3020,7 @@ var View = class _View {
2367
3020
  this.signature++;
2368
3021
  this.fire("render");
2369
3022
  _View.destroyAllResources(this, false);
2370
- const lookup = this;
3023
+ const lookup = asRecord(this);
2371
3024
  const candidate = lookup[fnName];
2372
3025
  const instanceFn = typeof candidate === "function" ? candidate : originalAsFn;
2373
3026
  const fnToCall = instanceFn === wrapped ? originalAsFn : instanceFn;
@@ -2403,7 +3056,7 @@ var View = class _View {
2403
3056
  * Merge an array of mixin objects into the view prototype.
2404
3057
  */
2405
3058
  static mergeMixins(mixins, viewClass, makes) {
2406
- const proto = viewClass.prototype;
3059
+ const proto = asRecord(viewClass.prototype);
2407
3060
  const temp = {};
2408
3061
  for (const node of mixins) {
2409
3062
  for (const p in node) {
@@ -2494,17 +3147,15 @@ var View = class _View {
2494
3147
  }
2495
3148
  }
2496
3149
  };
2497
- const proto = ChildView.prototype;
2498
3150
  for (const key in definedProps) {
2499
3151
  if (hasOwnProperty(definedProps, key) && key !== "make") {
2500
- proto[key] = definedProps[key];
3152
+ Reflect.set(ChildView.prototype, key, definedProps[key]);
2501
3153
  }
2502
3154
  }
2503
3155
  if (statics) {
2504
- const staticTarget = ChildView;
2505
3156
  for (const key in statics) {
2506
3157
  if (hasOwnProperty(statics, key)) {
2507
- staticTarget[key] = statics[key];
3158
+ Reflect.set(ChildView, key, statics[key]);
2508
3159
  }
2509
3160
  }
2510
3161
  }
@@ -2523,53 +3174,6 @@ function defineView(props, statics) {
2523
3174
  return View.extend(props, statics);
2524
3175
  }
2525
3176
 
2526
- // src/module-loader.ts
2527
- var config = {
2528
- rootId: "root",
2529
- routeMode: "history",
2530
- hashbang: "#!",
2531
- error: (error) => {
2532
- throw error;
2533
- }
2534
- };
2535
- function use(names, callback) {
2536
- const nameList = typeof names === "string" ? [names] : names;
2537
- const loadPromise = (() => {
2538
- if (config.require) {
2539
- const result = config.require(nameList);
2540
- if (result && typeof result.then === "function") {
2541
- return result;
2542
- }
2543
- return Promise.resolve([]);
2544
- }
2545
- return Promise.all(
2546
- nameList.map((name) => {
2547
- const importPath = name.startsWith(".") || name.startsWith("/") ? name : `./${name}`;
2548
- return import(
2549
- /* @vite-ignore */
2550
- /* webpackIgnore: true */
2551
- importPath
2552
- ).then((mod) => {
2553
- return mod && (mod["__esModule"] || // For Webpack
2554
- typeof mod["default"] === "function") ? mod["default"] : mod;
2555
- }).catch((err) => {
2556
- const errorHandler = config.error;
2557
- if (errorHandler) {
2558
- errorHandler(err instanceof Error ? err : new Error(String(err)));
2559
- }
2560
- return void 0;
2561
- });
2562
- })
2563
- );
2564
- })();
2565
- if (callback) {
2566
- loadPromise.then((modules) => {
2567
- callback(...modules);
2568
- });
2569
- }
2570
- return loadPromise;
2571
- }
2572
-
2573
3177
  // src/view-registry.ts
2574
3178
  var viewClassRegistry = {};
2575
3179
  function getViewClass(path) {
@@ -2716,9 +3320,15 @@ var Frame = class _Frame extends EventEmitter {
2716
3320
  */
2717
3321
  doMountView(ViewClass, params, node, sign) {
2718
3322
  if (sign !== this.signature) return;
2719
- const mixinCtors = View.prepare(ViewClass);
2720
- const Ctor = ViewClass;
2721
- const view = new Ctor(this.id, this, params, node, mixinCtors);
3323
+ const mixinConstructors = View.prepare(ViewClass);
3324
+ const Constructor = ViewClass;
3325
+ const view = new Constructor(
3326
+ this.id,
3327
+ this,
3328
+ params,
3329
+ node,
3330
+ mixinConstructors
3331
+ );
2722
3332
  this.viewInstance = view;
2723
3333
  view.signature = 1;
2724
3334
  View.delegateEvents(view);
@@ -2879,8 +3489,7 @@ var Frame = class _Frame extends EventEmitter {
2879
3489
  let result;
2880
3490
  const view = this.view;
2881
3491
  if (view && view.rendered) {
2882
- const lookup = view;
2883
- const fn = lookup[name];
3492
+ const fn = Reflect.get(view, name);
2884
3493
  if (typeof fn === "function") {
2885
3494
  result = funcWithTry(fn, args || [], view, noop);
2886
3495
  }
@@ -3435,7 +4044,7 @@ var Service = class {
3435
4044
  }
3436
4045
  const cached = this._payloadCache.get(cacheKey);
3437
4046
  if (cached && cached.cacheInfo) {
3438
- if (now() - cached.cacheInfo.time > cache) {
4047
+ if (Date.now() - cached.cacheInfo.time > cache) {
3439
4048
  this._payloadCache.del(cacheKey);
3440
4049
  return void 0;
3441
4050
  }
@@ -3593,7 +4202,7 @@ function serviceSend(service, attrs, done, flag, save) {
3593
4202
  const list = pendingCacheKeys[cacheKey];
3594
4203
  const entity = list.entity;
3595
4204
  if (entity instanceof Payload && entity.cacheInfo) {
3596
- entity.cacheInfo.time = now();
4205
+ entity.cacheInfo.time = Date.now();
3597
4206
  internals.payloadCache.set(cacheKey, entity);
3598
4207
  }
3599
4208
  Reflect.deleteProperty(pendingCacheKeys, cacheKey);
@@ -3611,20 +4220,19 @@ function serviceSend(service, attrs, done, flag, save) {
3611
4220
  }
3612
4221
  }
3613
4222
 
3614
- // src/frame-visual.ts
3615
- var FrameVisualBridge = {
3616
- MSG_PING: "LARK_VIS_PING",
3617
- MSG_PONG: "LARK_VIS_PONG",
3618
- MSG_REQUEST_TREE: "LARK_VIS_REQUEST_TREE",
3619
- MSG_TREE: "LARK_VIS_TREE",
3620
- MSG_TREE_DELTA: "LARK_VIS_TREE_DELTA"
4223
+ // src/devtool.ts
4224
+ var FrameDevtoolBridge = {
4225
+ MSG_PING: "LARK_DEVTOOL_PING",
4226
+ MSG_PONG: "LARK_DEVTOOL_PONG",
4227
+ MSG_REQUEST_TREE: "LARK_DEVTOOL_REQUEST_TREE",
4228
+ MSG_TREE: "LARK_DEVTOOL_TREE",
4229
+ MSG_TREE_DELTA: "LARK_DEVTOOL_TREE_DELTA"
3621
4230
  };
3622
4231
  function serializeView(view) {
3623
4232
  const evtMap = view.eventObjectMap;
3624
4233
  const eventMethodKeys = evtMap ? Object.keys(evtMap) : [];
3625
4234
  const resourceKeys = view.resources ? Object.keys(view.resources) : [];
3626
- const lookup = view;
3627
- const hasAssign = typeof lookup["assign"] === "function";
4235
+ const hasAssign = typeof view["assign"] === "function";
3628
4236
  let updaterData = null;
3629
4237
  try {
3630
4238
  const ref = view.updater?.refData;
@@ -3702,7 +4310,7 @@ function serializeFrameTree() {
3702
4310
  }
3703
4311
  var bridgeInstalled = false;
3704
4312
  var lastTreeJson = "";
3705
- function installFrameVisualizerBridge() {
4313
+ function installFrameDevtoolBridge() {
3706
4314
  if (bridgeInstalled) return;
3707
4315
  if (typeof window === "undefined") return;
3708
4316
  bridgeInstalled = true;
@@ -3710,22 +4318,22 @@ function installFrameVisualizerBridge() {
3710
4318
  const data = event.data;
3711
4319
  if (!data || typeof data !== "object") return;
3712
4320
  const type = data.type;
3713
- if (type === FrameVisualBridge.MSG_PING) {
4321
+ if (type === FrameDevtoolBridge.MSG_PING) {
3714
4322
  const source = event.source;
3715
4323
  if (source) {
3716
4324
  source.postMessage(
3717
- { type: FrameVisualBridge.MSG_PONG },
4325
+ { type: FrameDevtoolBridge.MSG_PONG },
3718
4326
  { targetOrigin: "*" }
3719
4327
  );
3720
4328
  }
3721
4329
  return;
3722
4330
  }
3723
- if (type === FrameVisualBridge.MSG_REQUEST_TREE) {
4331
+ if (type === FrameDevtoolBridge.MSG_REQUEST_TREE) {
3724
4332
  const tree = serializeFrameTree();
3725
4333
  const source = event.source;
3726
4334
  if (source) {
3727
4335
  source.postMessage(
3728
- { type: FrameVisualBridge.MSG_TREE, data: tree },
4336
+ { type: FrameDevtoolBridge.MSG_TREE, data: tree },
3729
4337
  { targetOrigin: "*" }
3730
4338
  );
3731
4339
  }
@@ -3745,7 +4353,7 @@ function pushTreeUpdate() {
3745
4353
  if (treeJson !== lastTreeJson) {
3746
4354
  lastTreeJson = treeJson;
3747
4355
  window.parent.postMessage(
3748
- { type: FrameVisualBridge.MSG_TREE_DELTA, data: tree },
4356
+ { type: FrameDevtoolBridge.MSG_TREE_DELTA, data: tree },
3749
4357
  "*"
3750
4358
  );
3751
4359
  }
@@ -3758,7 +4366,7 @@ var taskIndex = 0;
3758
4366
  var taskScheduled = false;
3759
4367
  function executeTaskChunk(deadline) {
3760
4368
  const hasDeadline = !!deadline;
3761
- const startTime = now();
4369
+ const startTime = Date.now();
3762
4370
  while (true) {
3763
4371
  const fn = taskList[taskIndex];
3764
4372
  if (!fn) {
@@ -3772,7 +4380,7 @@ function executeTaskChunk(deadline) {
3772
4380
  scheduleTaskChunk();
3773
4381
  return;
3774
4382
  }
3775
- } else if (now() - startTime > CALL_BREAK_TIME && taskList.length > taskIndex + 3) {
4383
+ } else if (Date.now() - startTime > CALL_BREAK_TIME && taskList.length > taskIndex + 3) {
3776
4384
  scheduleTaskChunk();
3777
4385
  return;
3778
4386
  }
@@ -3904,10 +4512,10 @@ function waitZoneViewsRendered(viewId, timeout) {
3904
4512
  timeout = 30 * 1e3;
3905
4513
  }
3906
4514
  const checkFrame = Frame.get(viewId);
3907
- const endTime = now() + timeout;
4515
+ const endTime = Date.now() + timeout;
3908
4516
  return new Promise((resolve) => {
3909
4517
  const check = () => {
3910
- const currentTime = now();
4518
+ const currentTime = Date.now();
3911
4519
  if (currentTime > endTime || !checkFrame) {
3912
4520
  resolve(WAIT_TIMEOUT_OR_NOT_FOUND);
3913
4521
  } else if (checkFrame.childrenCount === checkFrame.readyCount) {
@@ -3969,7 +4577,7 @@ var Framework = {
3969
4577
  booted3 = true;
3970
4578
  markBooted();
3971
4579
  markRouterBooted();
3972
- installFrameVisualizerBridge();
4580
+ installFrameDevtoolBridge();
3973
4581
  const rootFrame2 = Frame.createRoot(config.rootId);
3974
4582
  Router._bind();
3975
4583
  const defaultView = config.defaultView || "";
@@ -4244,7 +4852,6 @@ function bindStore(view, store, selector) {
4244
4852
  EventDelegator,
4245
4853
  EventEmitter,
4246
4854
  Frame,
4247
- FrameVisualBridge,
4248
4855
  Framework,
4249
4856
  LARK_VIEW,
4250
4857
  Payload,
@@ -4261,10 +4868,10 @@ function bindStore(view, store, selector) {
4261
4868
  bindStore,
4262
4869
  computed,
4263
4870
  create,
4871
+ createVDomRef,
4264
4872
  defineView,
4265
4873
  frameworkConfig,
4266
4874
  getRouteMode,
4267
- installFrameVisualizerBridge,
4268
4875
  invalidateViewClass,
4269
4876
  mark,
4270
4877
  markBooted,
@@ -4273,8 +4880,8 @@ function bindStore(view, store, selector) {
4273
4880
  registerViewClass,
4274
4881
  resetProjectsMap,
4275
4882
  safeguard,
4276
- serializeFrameTree,
4277
4883
  unmark,
4278
4884
  use,
4279
- useUrlState
4885
+ useUrlState,
4886
+ vdomCreate
4280
4887
  });