@qwik.dev/core 2.0.0-alpha.5 → 2.0.0-alpha.7
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/bindings/qwik.darwin-arm64.node +0 -0
- package/bindings/qwik.darwin-x64.node +0 -0
- package/bindings/qwik.linux-x64-gnu.node +0 -0
- package/bindings/qwik.win32-x64-msvc.node +0 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- package/dist/build/package.json +1 -1
- package/dist/cli.cjs +65 -63
- package/dist/core-internal.d.ts +78 -77
- package/dist/core.cjs +1770 -1517
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +1768 -1517
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +985 -848
- package/dist/core.prod.mjs +1210 -1032
- package/dist/insights/index.qwik.cjs +3658 -160
- package/dist/insights/index.qwik.mjs +3658 -160
- package/dist/loader/index.cjs +2 -2
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +230 -5691
- package/dist/optimizer.mjs +192 -5992
- package/dist/prefetch/package.json +1 -1
- package/dist/qwikloader.debug.js +12 -15
- package/dist/qwikloader.js +2 -2
- package/dist/server.cjs +754 -7067
- package/dist/server.mjs +771 -7062
- package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +2 -0
- package/dist/starters/features/cypress/package.json +1 -1
- package/dist/starters/features/drizzle/drizzle/schema.ts +6 -18
- package/dist/starters/features/drizzle/drizzle.config.ts +5 -4
- package/dist/starters/features/drizzle/package.json +14 -11
- package/dist/starters/features/pandacss/package.json +1 -1
- package/dist/starters/features/partytown/package.json +1 -1
- package/dist/starters/features/postcss/package.json +1 -1
- package/dist/starters/features/prisma/package.json +1 -1
- package/dist/starters/features/react/package.json +1 -1
- package/dist/starters/features/storybook/package.json +1 -1
- package/dist/starters/features/styled-vanilla-extract/package.json +2 -1
- package/dist/starters/features/tailwind/package.json +15 -9
- package/dist/starters/features/tailwind/src/global.css +1 -7
- package/dist/starters/features/turso/package.json +1 -1
- package/dist/starters/features/turso/src/utils/turso.ts +1 -1
- package/dist/starters/features/vitest/package.json +1 -1
- package/dist/testing/index.cjs +1445 -1252
- package/dist/testing/index.mjs +1455 -1256
- package/dist/testing/package.json +1 -1
- package/handlers.mjs +9 -0
- package/package.json +7 -5
- package/public.d.ts +2 -0
- package/dist/starters/features/tailwind/.vscode/settings.json +0 -3
- package/dist/starters/features/tailwind/postcss.config.cjs +0 -6
- package/dist/starters/features/tailwind/tailwind.config.js +0 -8
package/dist/core.prod.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core 2.0.0-alpha.
|
|
3
|
+
* @qwik.dev/core 2.0.0-alpha.7-dev+a26598a
|
|
4
4
|
* Copyright QwikDev. All Rights Reserved.
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
}
|
|
41
41
|
var QError;
|
|
42
42
|
!function(QError) {
|
|
43
|
-
QError[QError.stringifyClassOrStyle = 0] = "stringifyClassOrStyle", QError[QError.
|
|
44
|
-
QError[QError.
|
|
43
|
+
QError[QError.stringifyClassOrStyle = 0] = "stringifyClassOrStyle", QError[QError.schedulerNotFound = 1] = "schedulerNotFound",
|
|
44
|
+
QError[QError.trackObjectWithoutProp = 2] = "trackObjectWithoutProp", QError[QError.verifySerializable = 3] = "verifySerializable",
|
|
45
45
|
QError[QError.UNUSED_4 = 4] = "UNUSED_4", QError[QError.cannotRenderOverExistingContainer = 5] = "cannotRenderOverExistingContainer",
|
|
46
46
|
QError[QError.UNUSED_6 = 6] = "UNUSED_6", QError[QError.UNUSED_7 = 7] = "UNUSED_7",
|
|
47
47
|
QError[QError.UNUSED_8 = 8] = "UNUSED_8", QError[QError.UNUSED_9 = 9] = "UNUSED_9",
|
|
@@ -64,15 +64,51 @@
|
|
|
64
64
|
QError[QError.serializeErrorMissingChunk = 39] = "serializeErrorMissingChunk", QError[QError.wrongTextareaValue = 40] = "wrongTextareaValue",
|
|
65
65
|
QError[QError.containerNotFound = 41] = "containerNotFound", QError[QError.elementWithoutContainer = 42] = "elementWithoutContainer",
|
|
66
66
|
QError[QError.invalidVNodeType = 43] = "invalidVNodeType", QError[QError.materializeVNodeDataError = 44] = "materializeVNodeDataError",
|
|
67
|
-
QError[QError.
|
|
68
|
-
QError[QError.
|
|
69
|
-
QError[QError.
|
|
70
|
-
QError[QError.unsafeAttr = 51] = "unsafeAttr";
|
|
67
|
+
QError[QError.cannotCoerceSignal = 45] = "cannotCoerceSignal", QError[QError.computedNotSync = 46] = "computedNotSync",
|
|
68
|
+
QError[QError.computedReadOnly = 47] = "computedReadOnly", QError[QError.wrappedReadOnly = 48] = "wrappedReadOnly",
|
|
69
|
+
QError[QError.unsafeAttr = 49] = "unsafeAttr";
|
|
71
70
|
}(QError || (QError = {}));
|
|
72
71
|
const qError = (code, errorMessageArgs = []) => {
|
|
73
72
|
const text = (code => `Code(Q${code}) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L${8 + code}`)(code, ...errorMessageArgs);
|
|
74
73
|
return ((message, ...optionalParams) => createAndLogError(!0, message, ...optionalParams))(text, ...errorMessageArgs);
|
|
75
74
|
};
|
|
75
|
+
const isQrl$1 = value => "function" == typeof value && "function" == typeof value.getSymbol;
|
|
76
|
+
function assertQrl(qrl) {
|
|
77
|
+
if (build.isDev && !isQrl$1(qrl)) {
|
|
78
|
+
throw new Error("Not a QRL");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const getSymbolHash = symbolName => {
|
|
82
|
+
const index = symbolName.lastIndexOf("_");
|
|
83
|
+
return index > -1 ? symbolName.slice(index + 1) : symbolName;
|
|
84
|
+
};
|
|
85
|
+
var VirtualType;
|
|
86
|
+
!function(VirtualType) {
|
|
87
|
+
VirtualType.Virtual = "V", VirtualType.Fragment = "F", VirtualType.WrappedSignal = "S",
|
|
88
|
+
VirtualType.Awaited = "A", VirtualType.Component = "C", VirtualType.InlineComponent = "I",
|
|
89
|
+
VirtualType.Projection = "P";
|
|
90
|
+
}(VirtualType || (VirtualType = {}));
|
|
91
|
+
const VirtualTypeName = {
|
|
92
|
+
[VirtualType.Virtual]: "[34mVirtual[0m",
|
|
93
|
+
[VirtualType.Fragment]: "[34mFragment[0m",
|
|
94
|
+
[VirtualType.WrappedSignal]: "[34mSignal[0m",
|
|
95
|
+
[VirtualType.Awaited]: "[34mAwaited[0m",
|
|
96
|
+
[VirtualType.Component]: "[34mComponent[0m",
|
|
97
|
+
[VirtualType.InlineComponent]: "[34mInlineComponent[0m",
|
|
98
|
+
[VirtualType.Projection]: "[34mProjection[0m"
|
|
99
|
+
};
|
|
100
|
+
var QContainerValue;
|
|
101
|
+
!function(QContainerValue) {
|
|
102
|
+
QContainerValue.PAUSED = "paused", QContainerValue.RESUMED = "resumed", QContainerValue.HTML = "html",
|
|
103
|
+
QContainerValue.TEXT = "text";
|
|
104
|
+
}(QContainerValue || (QContainerValue = {}));
|
|
105
|
+
const QSlot = "q:slot";
|
|
106
|
+
const QSlotS = "q:s";
|
|
107
|
+
const getQFuncs = (document, hash) => document["qFuncs_" + hash] || [];
|
|
108
|
+
const QContainerSelector = "[q\\:container]:not([q\\:container=" + QContainerValue.HTML + "]):not([q\\:container=" + QContainerValue.TEXT + "])";
|
|
109
|
+
const HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
110
|
+
const SVG_NS = "http://www.w3.org/2000/svg";
|
|
111
|
+
const MATH_NS = "http://www.w3.org/1998/Math/MathML";
|
|
76
112
|
const createPlatform = () => ({
|
|
77
113
|
isServer: build.isServer,
|
|
78
114
|
importSymbol(containerEl, url, symbolName) {
|
|
@@ -133,13 +169,17 @@
|
|
|
133
169
|
setTimeout(resolve, timeout);
|
|
134
170
|
}));
|
|
135
171
|
function retryOnPromise(fn, retryCount = 0) {
|
|
136
|
-
|
|
137
|
-
return fn();
|
|
138
|
-
} catch (e) {
|
|
172
|
+
const retryOrThrow = e => {
|
|
139
173
|
if (isPromise(e) && retryCount < 100) {
|
|
140
174
|
return e.then(retryOnPromise.bind(null, fn, retryCount++));
|
|
141
175
|
}
|
|
142
176
|
throw e;
|
|
177
|
+
};
|
|
178
|
+
try {
|
|
179
|
+
const result = fn();
|
|
180
|
+
return isPromise(result) ? result.catch((e => retryOrThrow(e))) : result;
|
|
181
|
+
} catch (e) {
|
|
182
|
+
return retryOrThrow(e);
|
|
143
183
|
}
|
|
144
184
|
}
|
|
145
185
|
const isSerializableObject = v => {
|
|
@@ -151,39 +191,12 @@
|
|
|
151
191
|
const isString = v => "string" == typeof v;
|
|
152
192
|
const isFunction = v => "function" == typeof v;
|
|
153
193
|
var VNodeDataFlag;
|
|
194
|
+
let _locale;
|
|
154
195
|
!function(VNodeDataFlag) {
|
|
155
196
|
VNodeDataFlag[VNodeDataFlag.NONE = 0] = "NONE", VNodeDataFlag[VNodeDataFlag.TEXT_DATA = 1] = "TEXT_DATA",
|
|
156
197
|
VNodeDataFlag[VNodeDataFlag.VIRTUAL_NODE = 2] = "VIRTUAL_NODE", VNodeDataFlag[VNodeDataFlag.ELEMENT_NODE = 4] = "ELEMENT_NODE",
|
|
157
198
|
VNodeDataFlag[VNodeDataFlag.REFERENCE = 8] = "REFERENCE", VNodeDataFlag[VNodeDataFlag.SERIALIZE = 16] = "SERIALIZE";
|
|
158
199
|
}(VNodeDataFlag || (VNodeDataFlag = {}));
|
|
159
|
-
var VirtualType;
|
|
160
|
-
!function(VirtualType) {
|
|
161
|
-
VirtualType.Virtual = "V", VirtualType.Fragment = "F", VirtualType.WrappedSignal = "S",
|
|
162
|
-
VirtualType.Awaited = "A", VirtualType.Component = "C", VirtualType.InlineComponent = "I",
|
|
163
|
-
VirtualType.Projection = "P";
|
|
164
|
-
}(VirtualType || (VirtualType = {}));
|
|
165
|
-
const VirtualTypeName = {
|
|
166
|
-
[VirtualType.Virtual]: "[34mVirtual[0m",
|
|
167
|
-
[VirtualType.Fragment]: "[34mFragment[0m",
|
|
168
|
-
[VirtualType.WrappedSignal]: "[34mSignal[0m",
|
|
169
|
-
[VirtualType.Awaited]: "[34mAwaited[0m",
|
|
170
|
-
[VirtualType.Component]: "[34mComponent[0m",
|
|
171
|
-
[VirtualType.InlineComponent]: "[34mInlineComponent[0m",
|
|
172
|
-
[VirtualType.Projection]: "[34mProjection[0m"
|
|
173
|
-
};
|
|
174
|
-
var QContainerValue;
|
|
175
|
-
!function(QContainerValue) {
|
|
176
|
-
QContainerValue.PAUSED = "paused", QContainerValue.RESUMED = "resumed", QContainerValue.HTML = "html",
|
|
177
|
-
QContainerValue.TEXT = "text";
|
|
178
|
-
}(QContainerValue || (QContainerValue = {}));
|
|
179
|
-
const QSlot = "q:slot";
|
|
180
|
-
const QSlotS = "q:s";
|
|
181
|
-
const getQFuncs = (document, hash) => document["qFuncs_" + hash] || [];
|
|
182
|
-
const QContainerSelector = "[q\\:container]:not([q\\:container=" + QContainerValue.HTML + "]):not([q\\:container=" + QContainerValue.TEXT + "])";
|
|
183
|
-
const HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
184
|
-
const SVG_NS = "http://www.w3.org/2000/svg";
|
|
185
|
-
const MATH_NS = "http://www.w3.org/1998/Math/MathML";
|
|
186
|
-
let _locale;
|
|
187
200
|
const EMPTY_ARRAY = [];
|
|
188
201
|
const EMPTY_OBJ = {};
|
|
189
202
|
Object.freeze(EMPTY_ARRAY), Object.freeze(EMPTY_OBJ);
|
|
@@ -220,12 +233,45 @@
|
|
|
220
233
|
chunk = chunkOrFn;
|
|
221
234
|
}
|
|
222
235
|
return announcedQRL.has(symbol) || (announcedQRL.add(symbol), emitEvent("qprefetch", {
|
|
223
|
-
symbols: [
|
|
236
|
+
symbols: [ symbol ],
|
|
224
237
|
bundles: chunk && [ chunk ]
|
|
225
|
-
})), createQRL(chunk, symbol, null, symbolFn, null, lexicalScopeCapture
|
|
238
|
+
})), createQRL(chunk, symbol, null, symbolFn, null, lexicalScopeCapture);
|
|
239
|
+
};
|
|
240
|
+
const inlinedQrl = (symbol, symbolName, lexicalScopeCapture = EMPTY_ARRAY) => createQRL(null, symbolName, symbol, null, null, lexicalScopeCapture);
|
|
241
|
+
const _noopQrl = (symbolName, lexicalScopeCapture = EMPTY_ARRAY) => createQRL(null, symbolName, null, null, null, lexicalScopeCapture);
|
|
242
|
+
var ChoreType;
|
|
243
|
+
!function(ChoreType) {
|
|
244
|
+
ChoreType[ChoreType.MACRO = 240] = "MACRO", ChoreType[ChoreType.MICRO = 15] = "MICRO",
|
|
245
|
+
ChoreType[ChoreType.QRL_RESOLVE = 1] = "QRL_RESOLVE", ChoreType[ChoreType.RUN_QRL = 2] = "RUN_QRL",
|
|
246
|
+
ChoreType[ChoreType.TASK = 3] = "TASK", ChoreType[ChoreType.NODE_DIFF = 4] = "NODE_DIFF",
|
|
247
|
+
ChoreType[ChoreType.NODE_PROP = 5] = "NODE_PROP", ChoreType[ChoreType.COMPONENT = 6] = "COMPONENT",
|
|
248
|
+
ChoreType[ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS = 7] = "RECOMPUTE_AND_SCHEDULE_EFFECTS",
|
|
249
|
+
ChoreType[ChoreType.JOURNAL_FLUSH = 16] = "JOURNAL_FLUSH", ChoreType[ChoreType.VISIBLE = 32] = "VISIBLE",
|
|
250
|
+
ChoreType[ChoreType.CLEANUP_VISIBLE = 48] = "CLEANUP_VISIBLE", ChoreType[ChoreType.WAIT_FOR_ALL = 255] = "WAIT_FOR_ALL";
|
|
251
|
+
}(ChoreType || (ChoreType = {}));
|
|
252
|
+
const useLexicalScope = () => {
|
|
253
|
+
const context = getInvokeContext();
|
|
254
|
+
let qrl = context.$qrl$;
|
|
255
|
+
if (qrl) {
|
|
256
|
+
assertQrl(qrl), assertDefined();
|
|
257
|
+
} else {
|
|
258
|
+
const el = context.$element$;
|
|
259
|
+
assertDefined();
|
|
260
|
+
const containerElement = _getQContainerElement(el);
|
|
261
|
+
assertDefined();
|
|
262
|
+
qrl = getDomContainer(containerElement).parseQRL(decodeURIComponent(String(context.$url$)));
|
|
263
|
+
}
|
|
264
|
+
return qrl.$captureRef$;
|
|
265
|
+
};
|
|
266
|
+
const queueQRL = (...args) => {
|
|
267
|
+
const [runQrl] = useLexicalScope();
|
|
268
|
+
const hostElement = getInvokeContext().$hostElement$;
|
|
269
|
+
const scheduler = getDomContainer(hostElement).$scheduler$;
|
|
270
|
+
if (!scheduler) {
|
|
271
|
+
throw qError(QError.schedulerNotFound);
|
|
272
|
+
}
|
|
273
|
+
return scheduler(ChoreType.RUN_QRL, hostElement, runQrl, args);
|
|
226
274
|
};
|
|
227
|
-
const inlinedQrl = (symbol, symbolName, lexicalScopeCapture = EMPTY_ARRAY) => createQRL(null, symbolName, symbol, null, null, lexicalScopeCapture, null);
|
|
228
|
-
const _noopQrl = (symbolName, lexicalScopeCapture = EMPTY_ARRAY) => createQRL(null, symbolName, null, null, null, lexicalScopeCapture, null);
|
|
229
275
|
const Slot = props => _jsxSorted(Virtual, null, {
|
|
230
276
|
[QSlotS]: ""
|
|
231
277
|
}, props.children, 0, props.name ?? "");
|
|
@@ -280,6 +326,34 @@
|
|
|
280
326
|
function isPreventDefault(key) {
|
|
281
327
|
return key.startsWith("preventdefault:");
|
|
282
328
|
}
|
|
329
|
+
function getFileLocationFromJsx(jsxDev) {
|
|
330
|
+
if (!jsxDev) {
|
|
331
|
+
return null;
|
|
332
|
+
}
|
|
333
|
+
const sanitizedFileName = jsxDev.fileName?.replace(/\\/g, "/");
|
|
334
|
+
return sanitizedFileName ? `${sanitizedFileName}:${jsxDev.lineNumber}:${jsxDev.columnNumber}` : null;
|
|
335
|
+
}
|
|
336
|
+
const styleContent = styleId => "⚡️" + styleId;
|
|
337
|
+
function hasClassAttr(props) {
|
|
338
|
+
for (const key in props) {
|
|
339
|
+
if (Object.prototype.hasOwnProperty.call(props, key) && isClassAttr(key)) {
|
|
340
|
+
return !0;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return !1;
|
|
344
|
+
}
|
|
345
|
+
function isClassAttr(key) {
|
|
346
|
+
return "class" === key || "className" === key;
|
|
347
|
+
}
|
|
348
|
+
const addComponentStylePrefix = styleId => {
|
|
349
|
+
if (styleId) {
|
|
350
|
+
let idx = 0;
|
|
351
|
+
do {
|
|
352
|
+
styleId = styleId.substring(0, idx) + styleContent(styleId.substring(idx));
|
|
353
|
+
} while (0 !== (idx = styleId.indexOf(" ", idx) + 1));
|
|
354
|
+
}
|
|
355
|
+
return styleId || null;
|
|
356
|
+
};
|
|
283
357
|
const unitlessNumbers = new Set([ "animationIterationCount", "aspectRatio", "borderImageOutset", "borderImageSlice", "borderImageWidth", "boxFlex", "boxFlexGroup", "boxOrdinalGroup", "columnCount", "columns", "flex", "flexGrow", "flexShrink", "gridArea", "gridRow", "gridRowEnd", "gridRowStart", "gridColumn", "gridColumnEnd", "gridColumnStart", "fontWeight", "lineClamp", "lineHeight", "opacity", "order", "orphans", "scale", "tabSize", "widows", "zIndex", "zoom", "MozAnimationIterationCount", "MozBoxFlex", "msFlex", "msFlexPositive", "WebkitAnimationIterationCount", "WebkitBoxFlex", "WebkitBoxOrdinalGroup", "WebkitColumnCount", "WebkitColumns", "WebkitFlex", "WebkitFlexGrow", "WebkitFlexShrink", "WebkitLineClamp" ]);
|
|
284
358
|
const hashCode = (text, hash = 0) => {
|
|
285
359
|
for (let i = 0; i < text.length; i++) {
|
|
@@ -340,27 +414,6 @@
|
|
|
340
414
|
return value;
|
|
341
415
|
}
|
|
342
416
|
const setValueForStyle = (styleName, value) => "number" != typeof value || 0 === value || unitlessNumbers.has(styleName) ? value : value + "px";
|
|
343
|
-
const styleContent = styleId => "⭐️" + styleId;
|
|
344
|
-
function hasClassAttr(props) {
|
|
345
|
-
for (const key in props) {
|
|
346
|
-
if (Object.prototype.hasOwnProperty.call(props, key) && isClassAttr(key)) {
|
|
347
|
-
return !0;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
return !1;
|
|
351
|
-
}
|
|
352
|
-
function isClassAttr(key) {
|
|
353
|
-
return "class" === key || "className" === key;
|
|
354
|
-
}
|
|
355
|
-
const addComponentStylePrefix = styleId => {
|
|
356
|
-
if (styleId) {
|
|
357
|
-
let idx = 0;
|
|
358
|
-
do {
|
|
359
|
-
styleId = styleId.substring(0, idx) + styleContent(styleId.substring(idx));
|
|
360
|
-
} while (0 !== (idx = styleId.indexOf(" ", idx) + 1));
|
|
361
|
-
}
|
|
362
|
-
return styleId || null;
|
|
363
|
-
};
|
|
364
417
|
const STORE_TARGET = Symbol("store.target");
|
|
365
418
|
const STORE_HANDLER = Symbol("store.handler");
|
|
366
419
|
const STORE_ARRAY_PROP = Symbol("store.array");
|
|
@@ -453,27 +506,89 @@
|
|
|
453
506
|
Reflect.ownKeys(target);
|
|
454
507
|
}
|
|
455
508
|
getOwnPropertyDescriptor(target, prop) {
|
|
456
|
-
|
|
509
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
|
|
510
|
+
return Array.isArray(target) || "symbol" == typeof prop || descriptor && !descriptor.configurable ? descriptor : {
|
|
457
511
|
enumerable: !0,
|
|
458
512
|
configurable: !0
|
|
459
513
|
};
|
|
460
514
|
}
|
|
461
515
|
}
|
|
462
|
-
function addEffect(target, prop, store,
|
|
463
|
-
const effectsMap = store.$effects$ ||=
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
516
|
+
function addEffect(target, prop, store, effectSubscription) {
|
|
517
|
+
const effectsMap = store.$effects$ ||= new Map;
|
|
518
|
+
let effects = effectsMap.get(prop);
|
|
519
|
+
effects || (effects = new Set, effectsMap.set(prop, effects)), ensureContainsSubscription(effects, effectSubscription),
|
|
520
|
+
ensureContainsBackRef(effectSubscription, target), addQrlToSerializationCtx(effectSubscription, store.$container$);
|
|
467
521
|
}
|
|
468
522
|
function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
|
|
469
523
|
target[prop] = value, triggerEffects(currentStore.$container$, currentStore, getEffects(target, prop, currentStore.$effects$));
|
|
470
524
|
}
|
|
471
525
|
function getEffects(target, prop, storeEffects) {
|
|
472
|
-
let effectsToTrigger
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
526
|
+
let effectsToTrigger;
|
|
527
|
+
if (storeEffects) {
|
|
528
|
+
if (Array.isArray(target)) {
|
|
529
|
+
for (const effects of storeEffects.values()) {
|
|
530
|
+
effectsToTrigger ||= new Set;
|
|
531
|
+
for (const effect of effects) {
|
|
532
|
+
effectsToTrigger.add(effect);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
} else {
|
|
536
|
+
effectsToTrigger = storeEffects.get(prop);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
const storeArrayValue = storeEffects?.get(STORE_ARRAY_PROP);
|
|
540
|
+
if (storeArrayValue) {
|
|
541
|
+
effectsToTrigger ||= new Set;
|
|
542
|
+
for (const effect of storeArrayValue) {
|
|
543
|
+
effectsToTrigger.add(effect);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
return effectsToTrigger || null;
|
|
547
|
+
}
|
|
548
|
+
const NEEDS_COMPUTATION = Symbol("invalid");
|
|
549
|
+
const _EFFECT_BACK_REF = Symbol("backRef");
|
|
550
|
+
class BackRef {
|
|
551
|
+
[_EFFECT_BACK_REF]=null;
|
|
552
|
+
}
|
|
553
|
+
function clearAllEffects(container, consumer) {
|
|
554
|
+
vnode_isVNode(consumer) && vnode_isElementVNode(consumer) && ensureMaterialized(consumer);
|
|
555
|
+
const effects = consumer[_EFFECT_BACK_REF];
|
|
556
|
+
if (effects) {
|
|
557
|
+
for (const [, effect] of effects) {
|
|
558
|
+
const backRefs = effect[EffectSubscriptionProp.BACK_REF];
|
|
559
|
+
if (!backRefs) {
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
for (const producer of backRefs) {
|
|
563
|
+
if (producer instanceof Signal) {
|
|
564
|
+
clearSignal(container, producer, effect);
|
|
565
|
+
} else if (container.$storeProxyMap$.has(producer)) {
|
|
566
|
+
const target = container.$storeProxyMap$.get(producer);
|
|
567
|
+
clearStore(getStoreHandler(target), effect);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
476
572
|
}
|
|
573
|
+
function clearSignal(container, producer, effect) {
|
|
574
|
+
const effects = producer.$effects$;
|
|
575
|
+
effects && effects.delete(effect), producer instanceof WrappedSignal && (producer.$hostElement$ = null,
|
|
576
|
+
clearAllEffects(container, producer));
|
|
577
|
+
}
|
|
578
|
+
function clearStore(producer, effect) {
|
|
579
|
+
const effects = producer?.$effects$;
|
|
580
|
+
if (effects) {
|
|
581
|
+
for (const propEffects of effects.values()) {
|
|
582
|
+
propEffects.delete(effect);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
const implicit$FirstArg = fn => function(first, ...rest) {
|
|
587
|
+
return fn.call(null, dollar(first), ...rest);
|
|
588
|
+
};
|
|
589
|
+
const createSignal = value => new Signal(null, value);
|
|
590
|
+
const createComputedQrl = qrl => (throwIfQRLNotResolved(qrl), new ComputedSignal(null, qrl));
|
|
591
|
+
const createComputed$ = /*#__PURE__*/ implicit$FirstArg(createComputedQrl);
|
|
477
592
|
const useSequentialScope = () => {
|
|
478
593
|
const iCtx = useInvokeContext();
|
|
479
594
|
const host = iCtx.$hostElement$;
|
|
@@ -490,185 +605,104 @@
|
|
|
490
605
|
iCtx
|
|
491
606
|
};
|
|
492
607
|
};
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
vnode_isElementVNode(value) && ensureMaterialized(value);
|
|
501
|
-
const effects = vnode_getProp(value, "q:subs", container.$getObjectById$);
|
|
502
|
-
if (effects) {
|
|
503
|
-
for (let i = effects.length - 1; i >= 0; i--) {
|
|
504
|
-
clearEffects(effects[i], value, effects, i, container);
|
|
505
|
-
}
|
|
506
|
-
0 === effects.length && vnode_setProp(value, "q:subs", null);
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
function clearSubscriberEffectDependencies(container, value) {
|
|
510
|
-
if (value.$effectDependencies$) {
|
|
511
|
-
for (let i = value.$effectDependencies$.length - 1; i >= 0; i--) {
|
|
512
|
-
clearEffects(value.$effectDependencies$[i], value, value.$effectDependencies$, i, container);
|
|
513
|
-
}
|
|
514
|
-
0 === value.$effectDependencies$.length && (value.$effectDependencies$ = null);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
function clearEffects(subscriber, value, effectArray, indexToRemove, container) {
|
|
518
|
-
let subscriptionRemoved = !1;
|
|
519
|
-
const seenSet = new Set;
|
|
520
|
-
if (subscriber instanceof WrappedSignal) {
|
|
521
|
-
subscriptionRemoved = clearSignalEffects(subscriber, value, seenSet);
|
|
522
|
-
} else if (container.$storeProxyMap$.has(subscriber)) {
|
|
523
|
-
const store = container.$storeProxyMap$.get(subscriber);
|
|
524
|
-
subscriptionRemoved = clearStoreEffects(getStoreHandler(store), value);
|
|
525
|
-
}
|
|
526
|
-
subscriptionRemoved && effectArray.splice(indexToRemove, 1);
|
|
527
|
-
}
|
|
528
|
-
function clearSignalEffects(subscriber, value, seenSet) {
|
|
529
|
-
const effectSubscriptions = subscriber.$effects$;
|
|
530
|
-
let subscriptionRemoved = !1;
|
|
531
|
-
if (effectSubscriptions) {
|
|
532
|
-
for (let i = effectSubscriptions.length - 1; i >= 0; i--) {
|
|
533
|
-
effectSubscriptions[i][EffectSubscriptionsProp.EFFECT] === value && (effectSubscriptions.splice(i, 1),
|
|
534
|
-
subscriptionRemoved = !0);
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
if (subscriber instanceof WrappedSignal) {
|
|
538
|
-
const hostElement = subscriber.$hostElement$;
|
|
539
|
-
hostElement && hostElement === value && (subscriber.$hostElement$ = null);
|
|
540
|
-
const args = subscriber.$args$;
|
|
541
|
-
args && clearArgsEffects(args, subscriber, seenSet);
|
|
542
|
-
}
|
|
543
|
-
return subscriptionRemoved;
|
|
544
|
-
}
|
|
545
|
-
function clearStoreEffects(storeHandler, value) {
|
|
546
|
-
const effectSubscriptions = storeHandler.$effects$;
|
|
547
|
-
if (!effectSubscriptions) {
|
|
548
|
-
return !1;
|
|
549
|
-
}
|
|
550
|
-
let subscriptionRemoved = !1;
|
|
551
|
-
for (const key in effectSubscriptions) {
|
|
552
|
-
const effects = effectSubscriptions[key];
|
|
553
|
-
for (let i = effects.length - 1; i >= 0; i--) {
|
|
554
|
-
effects[i][EffectSubscriptionsProp.EFFECT] === value && (effects.splice(i, 1), subscriptionRemoved = !0);
|
|
555
|
-
}
|
|
556
|
-
0 === effects.length && delete effectSubscriptions[key];
|
|
557
|
-
}
|
|
558
|
-
return subscriptionRemoved;
|
|
559
|
-
}
|
|
560
|
-
function clearArgsEffects(args, subscriber, seenSet) {
|
|
561
|
-
for (let i = args.length - 1; i >= 0; i--) {
|
|
562
|
-
clearArgEffect(args[i], subscriber, seenSet);
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
function clearArgEffect(arg, subscriber, seenSet) {
|
|
566
|
-
if (!seenSet.has(arg)) {
|
|
567
|
-
if (seenSet.add(arg), isSignal(arg)) {
|
|
568
|
-
clearSignalEffects(arg, subscriber, seenSet);
|
|
569
|
-
} else if ("object" == typeof arg && null !== arg) {
|
|
570
|
-
if (isStore(arg)) {
|
|
571
|
-
clearStoreEffects(getStoreHandler(arg), subscriber);
|
|
572
|
-
} else {
|
|
573
|
-
for (const key in arg) {
|
|
574
|
-
clearArgEffect(arg[key], subscriber, seenSet);
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
} else {
|
|
578
|
-
Array.isArray(arg) && clearArgsEffects(arg, subscriber, seenSet);
|
|
579
|
-
}
|
|
580
|
-
}
|
|
608
|
+
function getSubscriber(effect, prop, data) {
|
|
609
|
+
var value;
|
|
610
|
+
effect[_EFFECT_BACK_REF] || (build.isServer && ("__brand__" in (value = effect) && "currentComponentNode" in value) ? effect.setProp("q:brefs", new Map) : effect[_EFFECT_BACK_REF] = new Map);
|
|
611
|
+
const subMap = effect[_EFFECT_BACK_REF];
|
|
612
|
+
let sub = subMap.get(prop);
|
|
613
|
+
return sub || (sub = [ effect, prop ], subMap.set(prop, sub)), data && (sub[EffectSubscriptionProp.DATA] = data),
|
|
614
|
+
sub;
|
|
581
615
|
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
616
|
+
var TaskFlags;
|
|
617
|
+
!function(TaskFlags) {
|
|
618
|
+
TaskFlags[TaskFlags.VISIBLE_TASK = 1] = "VISIBLE_TASK", TaskFlags[TaskFlags.TASK = 2] = "TASK",
|
|
619
|
+
TaskFlags[TaskFlags.RESOURCE = 4] = "RESOURCE", TaskFlags[TaskFlags.DIRTY = 8] = "DIRTY";
|
|
620
|
+
}(TaskFlags || (TaskFlags = {}));
|
|
621
|
+
const useTaskQrl = qrl => {
|
|
622
|
+
const {val, set, iCtx, i} = useSequentialScope();
|
|
623
|
+
if (val) {
|
|
624
|
+
return;
|
|
586
625
|
}
|
|
587
|
-
assertQrl(qrl);
|
|
588
|
-
const
|
|
589
|
-
|
|
590
|
-
const
|
|
591
|
-
|
|
592
|
-
};
|
|
593
|
-
const createResourceReturn = (container, opts, initialPromise) => {
|
|
594
|
-
const result = (opts => ({
|
|
595
|
-
__brand: "resource",
|
|
596
|
-
value: void 0,
|
|
597
|
-
loading: !isServerPlatform(),
|
|
598
|
-
_resolved: void 0,
|
|
599
|
-
_error: void 0,
|
|
600
|
-
_state: "pending",
|
|
601
|
-
_timeout: opts?.timeout ?? -1,
|
|
602
|
-
_cache: 0
|
|
603
|
-
}))(opts);
|
|
604
|
-
return result.value = initialPromise, createStore(container, result, StoreFlags.RECURSIVE);
|
|
626
|
+
assertQrl(qrl), set(1);
|
|
627
|
+
const task = new Task(TaskFlags.DIRTY | TaskFlags.TASK, i, iCtx.$hostElement$, qrl, void 0, null);
|
|
628
|
+
set(task);
|
|
629
|
+
const promise = iCtx.$container$.$scheduler$(ChoreType.TASK, task);
|
|
630
|
+
isPromise(promise) && promise.catch((() => {}));
|
|
605
631
|
};
|
|
606
|
-
const
|
|
607
|
-
const runResource = (task, container, host) => {
|
|
632
|
+
const runTask = (task, container, host) => {
|
|
608
633
|
task.$flags$ &= ~TaskFlags.DIRTY, cleanupTask(task);
|
|
609
|
-
const iCtx = newInvokeContext(container.$locale$, host, void 0, "
|
|
634
|
+
const iCtx = newInvokeContext(container.$locale$, host, void 0, "qTask");
|
|
610
635
|
iCtx.$container$ = container;
|
|
611
|
-
const taskFn = task.$qrl$.getFn(iCtx, (() =>
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
}
|
|
622
|
-
})),
|
|
623
|
-
}
|
|
624
|
-
const
|
|
625
|
-
const opts = {
|
|
636
|
+
const taskFn = task.$qrl$.getFn(iCtx, (() => clearAllEffects(container, task)));
|
|
637
|
+
let cleanupFns = null;
|
|
638
|
+
const cleanup = fn => {
|
|
639
|
+
"function" == typeof fn && (cleanupFns || (cleanupFns = [], task.$destroy$ = noSerialize((() => {
|
|
640
|
+
task.$destroy$ = null, cleanupFns.forEach((fn => {
|
|
641
|
+
try {
|
|
642
|
+
fn();
|
|
643
|
+
} catch (err) {
|
|
644
|
+
container.handleError(err, host);
|
|
645
|
+
}
|
|
646
|
+
}));
|
|
647
|
+
}))), cleanupFns.push(fn));
|
|
648
|
+
};
|
|
649
|
+
const taskApi = {
|
|
626
650
|
track: (obj, prop) => {
|
|
627
651
|
const ctx = newInvokeContext();
|
|
628
|
-
return ctx.$effectSubscriber$ =
|
|
629
|
-
invoke(ctx, (() =>
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
652
|
+
return ctx.$effectSubscriber$ = getSubscriber(task, EffectProperty.COMPONENT), ctx.$container$ = container,
|
|
653
|
+
invoke(ctx, (() => {
|
|
654
|
+
if (isFunction(obj)) {
|
|
655
|
+
return obj();
|
|
656
|
+
}
|
|
657
|
+
if (prop) {
|
|
658
|
+
return obj[prop];
|
|
659
|
+
}
|
|
660
|
+
if (isSignal(obj)) {
|
|
661
|
+
return obj.value;
|
|
662
|
+
}
|
|
663
|
+
throw qError(QError.trackObjectWithoutProp);
|
|
664
|
+
}));
|
|
637
665
|
},
|
|
638
|
-
|
|
666
|
+
cleanup
|
|
639
667
|
};
|
|
640
|
-
|
|
641
|
-
let reject;
|
|
642
|
-
let done = !1;
|
|
643
|
-
const setState = (resolved, value) => !done && (done = !0, resolved ? (done = !0,
|
|
644
|
-
resource.loading = !1, resource._state = "resolved", resource._resolved = value,
|
|
645
|
-
resource._error = void 0, resolve(value)) : (done = !0, resource.loading = !1, resource._state = "rejected",
|
|
646
|
-
resource._error = value, reject(value)), !0);
|
|
647
|
-
cleanups.push((() => {
|
|
648
|
-
if (!0 === untrack((() => resource.loading))) {
|
|
649
|
-
const value = untrack((() => resource._resolved));
|
|
650
|
-
setState(!0, value);
|
|
651
|
-
}
|
|
652
|
-
})), invoke(iCtx, (() => {
|
|
653
|
-
resource._state = "pending", resource.loading = !isServerPlatform();
|
|
654
|
-
(resource.value = new Promise(((r, re) => {
|
|
655
|
-
resolve = r, reject = re;
|
|
656
|
-
}))).catch(ignoreErrorToPreventNodeFromCrashing);
|
|
657
|
-
}));
|
|
658
|
-
const promise = safeCall((() => Promise.resolve(taskFn(opts))), (value => {
|
|
659
|
-
setState(!0, value);
|
|
660
|
-
}), (err => {
|
|
668
|
+
return safeCall((() => taskFn(taskApi)), cleanup, (err => {
|
|
661
669
|
if (isPromise(err)) {
|
|
662
|
-
return err.then((() =>
|
|
670
|
+
return err.then((() => runTask(task, container, host)));
|
|
663
671
|
}
|
|
664
|
-
|
|
672
|
+
throw err;
|
|
665
673
|
}));
|
|
666
|
-
const timeout = resourceTarget._timeout;
|
|
667
|
-
return timeout > 0 ? Promise.race([ promise, delay(timeout).then((() => {
|
|
668
|
-
setState(!1, new Error("timeout")) && cleanupTask(task);
|
|
669
|
-
})) ]) : promise;
|
|
670
674
|
};
|
|
671
|
-
const
|
|
675
|
+
const cleanupTask = task => {
|
|
676
|
+
const destroy = task.$destroy$;
|
|
677
|
+
if (destroy) {
|
|
678
|
+
task.$destroy$ = null;
|
|
679
|
+
try {
|
|
680
|
+
destroy();
|
|
681
|
+
} catch (err) {
|
|
682
|
+
((message, ...optionalParams) => {
|
|
683
|
+
createAndLogError(!1, message, ...optionalParams);
|
|
684
|
+
})(err);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
};
|
|
688
|
+
class Task extends BackRef {
|
|
689
|
+
$flags$;
|
|
690
|
+
$index$;
|
|
691
|
+
$el$;
|
|
692
|
+
$qrl$;
|
|
693
|
+
$state$;
|
|
694
|
+
$destroy$;
|
|
695
|
+
constructor($flags$, $index$, $el$, $qrl$, $state$, $destroy$) {
|
|
696
|
+
super(), this.$flags$ = $flags$, this.$index$ = $index$, this.$el$ = $el$, this.$qrl$ = $qrl$,
|
|
697
|
+
this.$state$ = $state$, this.$destroy$ = $destroy$;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
const isTask = value => value instanceof Task;
|
|
701
|
+
const scheduleTask = (_event, element) => {
|
|
702
|
+
const [task] = useLexicalScope();
|
|
703
|
+
const type = task.$flags$ & TaskFlags.VISIBLE_TASK ? ChoreType.VISIBLE : ChoreType.TASK;
|
|
704
|
+
getDomContainer(element).$scheduler$(type, task);
|
|
705
|
+
};
|
|
672
706
|
var VNodeFlags;
|
|
673
707
|
var VNodeFlagsIndex;
|
|
674
708
|
var VNodeProps;
|
|
@@ -701,9 +735,29 @@
|
|
|
701
735
|
VirtualVNodeProps[VirtualVNodeProps.firstChild = 4] = "firstChild", VirtualVNodeProps[VirtualVNodeProps.lastChild = 5] = "lastChild",
|
|
702
736
|
VirtualVNodeProps[VirtualVNodeProps.PROPS_OFFSET = 6] = "PROPS_OFFSET";
|
|
703
737
|
}(VirtualVNodeProps || (VirtualVNodeProps = {}));
|
|
704
|
-
const
|
|
705
|
-
|
|
706
|
-
|
|
738
|
+
const mapApp_findIndx = (elementVNode, key, start) => {
|
|
739
|
+
assertTrue();
|
|
740
|
+
let bottom = start >> 1;
|
|
741
|
+
let top = elementVNode.length - 2 >> 1;
|
|
742
|
+
for (;bottom <= top; ) {
|
|
743
|
+
const mid = bottom + (top - bottom >> 1);
|
|
744
|
+
const midKey = elementVNode[mid << 1];
|
|
745
|
+
if (midKey === key) {
|
|
746
|
+
return mid << 1;
|
|
747
|
+
}
|
|
748
|
+
midKey < key ? bottom = mid + 1 : top = mid - 1;
|
|
749
|
+
}
|
|
750
|
+
return ~(bottom << 1);
|
|
751
|
+
};
|
|
752
|
+
const mapArray_set = (elementVNode, key, value, start) => {
|
|
753
|
+
const indx = mapApp_findIndx(elementVNode, key, start);
|
|
754
|
+
indx >= 0 ? null == value ? elementVNode.splice(indx, 2) : elementVNode[indx + 1] = value : null != value && elementVNode.splice(~indx, 0, key, value);
|
|
755
|
+
};
|
|
756
|
+
const mapArray_get = (elementVNode, key, start) => {
|
|
757
|
+
const indx = mapApp_findIndx(elementVNode, key, start);
|
|
758
|
+
return indx >= 0 ? elementVNode[indx + 1] : null;
|
|
759
|
+
};
|
|
760
|
+
const isForeignObjectElement = elementName => build.isDev ? "foreignobject" === elementName.toLowerCase() : "foreignObject" === elementName;
|
|
707
761
|
function cloneElementWithNamespace(element, elementName, namespace) {
|
|
708
762
|
const newElement = element.ownerDocument.createElementNS(namespace, elementName);
|
|
709
763
|
const attributes = element.attributes;
|
|
@@ -774,6 +828,10 @@
|
|
|
774
828
|
}
|
|
775
829
|
return rootElement;
|
|
776
830
|
}
|
|
831
|
+
function isSvg(tagOrVNode) {
|
|
832
|
+
return "string" == typeof tagOrVNode ? "svg" === (elementName = tagOrVNode) || isForeignObjectElement(elementName) : !!(tagOrVNode[VNodeProps.flags] & VNodeFlags.NS_svg);
|
|
833
|
+
var elementName;
|
|
834
|
+
}
|
|
777
835
|
function getNewElementNamespaceData(domParentVNode, tagOrVNode) {
|
|
778
836
|
const parentIsDefaultNamespace = !domParentVNode || !(!vnode_getElementName(domParentVNode) || (vnode = domParentVNode,
|
|
779
837
|
vnode[VNodeProps.flags] & VNodeFlags.NAMESPACE_MASK));
|
|
@@ -782,12 +840,10 @@
|
|
|
782
840
|
let elementNamespace = HTML_NS;
|
|
783
841
|
let elementNamespaceFlag = VNodeFlags.NS_html;
|
|
784
842
|
const isElementVNodeOrString = "string" == typeof tagOrVNode || vnode_isElementVNode(tagOrVNode);
|
|
785
|
-
if (isElementVNodeOrString &&
|
|
786
|
-
return "string" == typeof tagOrVNode ? isSvgElement(tagOrVNode) : !!(tagOrVNode[VNodeProps.flags] & VNodeFlags.NS_svg);
|
|
787
|
-
}(tagOrVNode)) {
|
|
843
|
+
if (isElementVNodeOrString && isSvg(tagOrVNode)) {
|
|
788
844
|
elementNamespace = SVG_NS, elementNamespaceFlag = VNodeFlags.NS_svg;
|
|
789
845
|
} else if (isElementVNodeOrString && function(tagOrVNode) {
|
|
790
|
-
return "string" == typeof tagOrVNode ?
|
|
846
|
+
return "string" == typeof tagOrVNode ? "math" === tagOrVNode : !!(tagOrVNode[VNodeProps.flags] & VNodeFlags.NS_math);
|
|
791
847
|
}(tagOrVNode)) {
|
|
792
848
|
elementNamespace = MATH_NS, elementNamespaceFlag = VNodeFlags.NS_math;
|
|
793
849
|
} else if (domParentVNode && !parentIsForeignObject && !parentIsDefaultNamespace) {
|
|
@@ -835,14 +891,14 @@
|
|
|
835
891
|
};
|
|
836
892
|
};
|
|
837
893
|
const executeComponent = (container, renderHost, subscriptionHost, componentQRL, props) => {
|
|
838
|
-
const iCtx = newInvokeContext(container.$locale$, subscriptionHost, void 0, "qRender");
|
|
894
|
+
const iCtx = newInvokeContext(container.$locale$, subscriptionHost || void 0, void 0, "qRender");
|
|
839
895
|
let componentFn;
|
|
840
|
-
iCtx.$effectSubscriber$ =
|
|
841
|
-
container.ensureProjectionResolved(renderHost);
|
|
896
|
+
subscriptionHost && (iCtx.$effectSubscriber$ = getSubscriber(subscriptionHost, EffectProperty.COMPONENT),
|
|
897
|
+
iCtx.$container$ = container), container.ensureProjectionResolved(renderHost);
|
|
842
898
|
let isInlineComponent = !1;
|
|
843
|
-
if (null === componentQRL && (componentQRL =
|
|
844
|
-
assertDefined()), isQrl(componentQRL)) {
|
|
845
|
-
(props = props || container.getHostProp(renderHost, "q:props") || EMPTY_OBJ)
|
|
899
|
+
if (null === componentQRL && (componentQRL = container.getHostProp(renderHost, "q:renderFn"),
|
|
900
|
+
assertDefined()), isQrl$1(componentQRL)) {
|
|
901
|
+
(props = props || container.getHostProp(renderHost, "q:props") || EMPTY_OBJ).children && delete props.children,
|
|
846
902
|
componentFn = componentQRL.getFn(iCtx);
|
|
847
903
|
} else if (isQwikComponent(componentQRL)) {
|
|
848
904
|
const qComponentFn = componentQRL;
|
|
@@ -853,21 +909,35 @@
|
|
|
853
909
|
componentFn = () => invokeApply(iCtx, inlineComponent, [ props || EMPTY_OBJ ]);
|
|
854
910
|
}
|
|
855
911
|
const executeComponentWithPromiseExceptionRetry = (retryCount = 0) => safeCall((() => (isInlineComponent || (container.setHostProp(renderHost, "q:seqIdx", null),
|
|
856
|
-
container.setHostProp(renderHost, ":onIdx", null), container.
|
|
857
|
-
vnode_isVNode(renderHost) &&
|
|
858
|
-
componentFn(props))), (jsx => {
|
|
912
|
+
container.setHostProp(renderHost, ":onIdx", null), container.setHostProp(renderHost, "q:props", props)),
|
|
913
|
+
vnode_isVNode(renderHost) && clearAllEffects(container, renderHost), componentFn(props))), (jsx => {
|
|
859
914
|
const useOnEvents = container.getHostProp(renderHost, ":on");
|
|
860
|
-
return useOnEvents ?
|
|
915
|
+
return useOnEvents ? function(jsx, useOnEvents) {
|
|
861
916
|
const jsxElement = findFirstStringJSX(jsx);
|
|
917
|
+
let jsxResult = jsx;
|
|
862
918
|
return maybeThen(jsxElement, (jsxElement => {
|
|
863
919
|
let isInvisibleComponent = !1;
|
|
864
920
|
jsxElement || (isInvisibleComponent = !0);
|
|
865
921
|
for (const key in useOnEvents) {
|
|
866
|
-
Object.prototype.hasOwnProperty.call(useOnEvents, key)
|
|
922
|
+
if (Object.prototype.hasOwnProperty.call(useOnEvents, key)) {
|
|
923
|
+
if (isInvisibleComponent) {
|
|
924
|
+
if ("onQvisible$" === key) {
|
|
925
|
+
const [jsxElement, jsx] = addScriptNodeForInvisibleComponents(jsxResult);
|
|
926
|
+
jsxResult = jsx, jsxElement && addUseOnEvent(jsxElement, "document:onQinit$", useOnEvents[key]);
|
|
927
|
+
} else if (key.startsWith("document:") || key.startsWith("window:")) {
|
|
928
|
+
const [jsxElement, jsx] = addScriptNodeForInvisibleComponents(jsxResult);
|
|
929
|
+
jsxResult = jsx, jsxElement && addUseOnEvent(jsxElement, key, useOnEvents[key]);
|
|
930
|
+
} else {
|
|
931
|
+
build.isDev && logWarn('You are trying to add an event "' + key + '" using `useOn` hook, but a node to which you can add an event is not found. Please make sure that the component has a valid element node. ');
|
|
932
|
+
}
|
|
933
|
+
} else {
|
|
934
|
+
jsxElement && addUseOnEvent(jsxElement, key, useOnEvents[key]);
|
|
935
|
+
}
|
|
936
|
+
}
|
|
867
937
|
}
|
|
868
|
-
return
|
|
938
|
+
return jsxResult;
|
|
869
939
|
}));
|
|
870
|
-
}(jsx, useOnEvents)
|
|
940
|
+
}(jsx, useOnEvents) : jsx;
|
|
871
941
|
}), (err => {
|
|
872
942
|
if (isPromise(err) && retryCount < 100) {
|
|
873
943
|
return err.then((() => executeComponentWithPromiseExceptionRetry(retryCount++)));
|
|
@@ -911,11 +981,18 @@
|
|
|
911
981
|
type: "placeholder",
|
|
912
982
|
hidden: ""
|
|
913
983
|
}, null, 3);
|
|
914
|
-
return null == jsx.children ? jsx.children = jsxElement : Array.isArray(jsx.children) ? jsx.children.push(jsxElement) : jsx.children = [ jsx.children, jsxElement ],
|
|
915
|
-
jsxElement;
|
|
984
|
+
return jsx.type === Slot ? [ jsxElement, _jsxSorted(Fragment, null, null, [ jsx, jsxElement ], 0, null) ] : (null == jsx.children ? jsx.children = jsxElement : Array.isArray(jsx.children) ? jsx.children.push(jsxElement) : jsx.children = [ jsx.children, jsxElement ],
|
|
985
|
+
[ jsxElement, jsx ]);
|
|
916
986
|
}
|
|
917
|
-
|
|
987
|
+
if (Array.isArray(jsx) && jsx.length) {
|
|
988
|
+
const [jsxElement, _] = addScriptNodeForInvisibleComponents(jsx[0]);
|
|
989
|
+
return [ jsxElement, jsx ];
|
|
990
|
+
}
|
|
991
|
+
return [ null, null ];
|
|
918
992
|
}
|
|
993
|
+
const _CONST_PROPS = Symbol("CONST");
|
|
994
|
+
const _VAR_PROPS = Symbol("VAR");
|
|
995
|
+
const _IMMUTABLE = Symbol("IMMUTABLE");
|
|
919
996
|
function isSlotProp(prop) {
|
|
920
997
|
return !prop.startsWith("q:") && !prop.startsWith(":");
|
|
921
998
|
}
|
|
@@ -944,13 +1021,6 @@
|
|
|
944
1021
|
}
|
|
945
1022
|
return 0 === lastIdx ? html : escapedHTML + html.substring(lastIdx);
|
|
946
1023
|
}
|
|
947
|
-
function getFileLocationFromJsx(jsxDev) {
|
|
948
|
-
if (!jsxDev) {
|
|
949
|
-
return null;
|
|
950
|
-
}
|
|
951
|
-
const sanitizedFileName = jsxDev.fileName?.replace(/\\/g, "/");
|
|
952
|
-
return sanitizedFileName ? `${sanitizedFileName}:${jsxDev.lineNumber}:${jsxDev.columnNumber}` : null;
|
|
953
|
-
}
|
|
954
1024
|
const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
955
1025
|
let journal = container.$journal$;
|
|
956
1026
|
const stack = [];
|
|
@@ -988,7 +1058,7 @@
|
|
|
988
1058
|
if (Array.isArray(jsxValue)) {
|
|
989
1059
|
descend(jsxValue, !1);
|
|
990
1060
|
} else if (isSignal(jsxValue)) {
|
|
991
|
-
vCurrent &&
|
|
1061
|
+
vCurrent && clearAllEffects(container, vCurrent), expectVirtual(VirtualType.WrappedSignal, null),
|
|
992
1062
|
descend(trackSignalAndAssignHost(jsxValue, vNewNode || vCurrent, EffectProperty.VNODE, container), !0);
|
|
993
1063
|
} else if (isPromise(jsxValue)) {
|
|
994
1064
|
expectVirtual(VirtualType.Awaited, null), asyncQueue.push(jsxValue, vNewNode || vCurrent);
|
|
@@ -1127,8 +1197,12 @@
|
|
|
1127
1197
|
if (isJsxPropertyAnEventName(key)) {
|
|
1128
1198
|
const eventName = getEventNameFromJsxProp(key);
|
|
1129
1199
|
const scope = getEventNameScopeFromJsxProp(key);
|
|
1130
|
-
vnode_setProp(vNewNode, HANDLER_PREFIX + ":" + scope + ":" + eventName, value),
|
|
1131
|
-
|
|
1200
|
+
if (eventName && (vnode_setProp(vNewNode, HANDLER_PREFIX + ":" + scope + ":" + eventName, value),
|
|
1201
|
+
registerQwikLoaderEvent(eventName)), scope) {
|
|
1202
|
+
const htmlEvent = convertEventNameFromJsxPropToHtmlAttr(key);
|
|
1203
|
+
htmlEvent && vnode_setAttr(journal, vNewNode, htmlEvent, "");
|
|
1204
|
+
}
|
|
1205
|
+
needsQDispatchEventPatch = !0;
|
|
1132
1206
|
} else {
|
|
1133
1207
|
if ("ref" === key) {
|
|
1134
1208
|
if (isSignal(value)) {
|
|
@@ -1139,10 +1213,13 @@
|
|
|
1139
1213
|
value(element);
|
|
1140
1214
|
continue;
|
|
1141
1215
|
}
|
|
1216
|
+
if (null == value) {
|
|
1217
|
+
continue;
|
|
1218
|
+
}
|
|
1142
1219
|
throw qError(QError.invalidRefValue, [ currentFile ]);
|
|
1143
1220
|
}
|
|
1144
1221
|
if (isSignal(value)) {
|
|
1145
|
-
const signalData = new
|
|
1222
|
+
const signalData = new SubscriptionData({
|
|
1146
1223
|
$scopedStyleIdPrefix$: scopedStyleIdPrefix,
|
|
1147
1224
|
$isConst$: !0
|
|
1148
1225
|
});
|
|
@@ -1189,10 +1266,10 @@
|
|
|
1189
1266
|
const vNode = vNewNode || vCurrent;
|
|
1190
1267
|
if (needsQDispatchEventPatch = function(vnode, srcAttrs, currentFile) {
|
|
1191
1268
|
vnode_ensureElementInflated(vnode);
|
|
1192
|
-
const dstAttrs = vnode;
|
|
1269
|
+
const dstAttrs = vnode_getProps(vnode);
|
|
1193
1270
|
let srcIdx = 0;
|
|
1194
1271
|
const srcLength = srcAttrs.length;
|
|
1195
|
-
let dstIdx =
|
|
1272
|
+
let dstIdx = 0;
|
|
1196
1273
|
let dstLength = dstAttrs.length;
|
|
1197
1274
|
let srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null;
|
|
1198
1275
|
let dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
|
|
@@ -1209,10 +1286,13 @@
|
|
|
1209
1286
|
if ("function" == typeof value) {
|
|
1210
1287
|
return void value(element);
|
|
1211
1288
|
}
|
|
1289
|
+
if (null == value) {
|
|
1290
|
+
return;
|
|
1291
|
+
}
|
|
1212
1292
|
throw qError(QError.invalidRefValue, [ currentFile ]);
|
|
1213
1293
|
}
|
|
1214
1294
|
if (isSignal(value)) {
|
|
1215
|
-
const signalData = new
|
|
1295
|
+
const signalData = new SubscriptionData({
|
|
1216
1296
|
$scopedStyleIdPrefix$: scopedStyleIdPrefix,
|
|
1217
1297
|
$isConst$: !1
|
|
1218
1298
|
});
|
|
@@ -1224,12 +1304,12 @@
|
|
|
1224
1304
|
};
|
|
1225
1305
|
const recordJsxEvent = (key, value) => {
|
|
1226
1306
|
const eventName = getEventNameFromJsxProp(key);
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1307
|
+
const scope = getEventNameScopeFromJsxProp(key);
|
|
1308
|
+
if (eventName && (record(":" + scope + ":" + eventName, value), registerQwikLoaderEvent(eventName)),
|
|
1309
|
+
scope) {
|
|
1310
|
+
const htmlEvent = convertEventNameFromJsxPropToHtmlAttr(key);
|
|
1311
|
+
htmlEvent && record(htmlEvent, "");
|
|
1230
1312
|
}
|
|
1231
|
-
const htmlEvent = convertEventNameFromJsxPropToHtmlAttr(key);
|
|
1232
|
-
htmlEvent && record(htmlEvent, ""), eventName && registerQwikLoaderEvent(eventName);
|
|
1233
1313
|
};
|
|
1234
1314
|
for (;null !== srcKey || null !== dstKey; ) {
|
|
1235
1315
|
if (dstKey?.startsWith(HANDLER_PREFIX) || dstKey?.startsWith("q:")) {
|
|
@@ -1261,7 +1341,7 @@
|
|
|
1261
1341
|
let returnValue = !1;
|
|
1262
1342
|
return qrls.flat(2).forEach((qrl => {
|
|
1263
1343
|
if (qrl) {
|
|
1264
|
-
const value = qrl
|
|
1344
|
+
const value = container.$scheduler$(ChoreType.RUN_QRL, vNode, qrl, [ event, element ]);
|
|
1265
1345
|
returnValue = returnValue || !0 === value;
|
|
1266
1346
|
}
|
|
1267
1347
|
})), returnValue;
|
|
@@ -1310,16 +1390,16 @@
|
|
|
1310
1390
|
const vNodeComponentHash = getComponentHash(host, container.$getObjectById$);
|
|
1311
1391
|
const lookupKey = jsxNode.key || componentHash;
|
|
1312
1392
|
if (lookupKey === (getKey(host) || vNodeComponentHash) ? componentHash === vNodeComponentHash || (insertNewComponent(host, componentQRL, jsxProps),
|
|
1313
|
-
vNewNode && (host
|
|
1314
|
-
|
|
1393
|
+
vNewNode && (host = vNewNode, shouldRender = !0)) : (vNewNode = retrieveChildWithKey(null, lookupKey),
|
|
1394
|
+
vNewNode ? vnode_insertBefore(journal, vParent, vNewNode, vCurrent) : insertNewComponent(host, componentQRL, jsxProps),
|
|
1315
1395
|
host = vNewNode, shouldRender = !0), host) {
|
|
1316
1396
|
const vNodeProps = vnode_getProp(host, "q:props", container.$getObjectById$);
|
|
1317
1397
|
shouldRender = shouldRender || function(src, dst) {
|
|
1318
1398
|
if (!src || !dst) {
|
|
1319
1399
|
return !0;
|
|
1320
1400
|
}
|
|
1321
|
-
let srcKeys = removePropsKeys(Object.keys(src), [ "children", "q:
|
|
1322
|
-
let dstKeys = removePropsKeys(Object.keys(dst), [ "children", "q:
|
|
1401
|
+
let srcKeys = removePropsKeys(Object.keys(src), [ "children", "q:brefs" ]);
|
|
1402
|
+
let dstKeys = removePropsKeys(Object.keys(dst), [ "children", "q:brefs" ]);
|
|
1323
1403
|
if (srcKeys.length !== dstKeys.length) {
|
|
1324
1404
|
return !0;
|
|
1325
1405
|
}
|
|
@@ -1340,8 +1420,9 @@
|
|
|
1340
1420
|
const createProjectionJSXNode = slotName => new JSXNodeImpl(Projection, EMPTY_OBJ, null, [], 0, slotName);
|
|
1341
1421
|
const projections = [];
|
|
1342
1422
|
if (host) {
|
|
1343
|
-
|
|
1344
|
-
|
|
1423
|
+
const props = vnode_getProps(host);
|
|
1424
|
+
for (let i = 0; i < props.length; i += 2) {
|
|
1425
|
+
const prop = props[i];
|
|
1345
1426
|
if (isSlotProp(prop)) {
|
|
1346
1427
|
const slotName = prop;
|
|
1347
1428
|
projections.push(slotName), projections.push(createProjectionJSXNode(slotName));
|
|
@@ -1382,7 +1463,7 @@
|
|
|
1382
1463
|
}
|
|
1383
1464
|
}
|
|
1384
1465
|
function insertNewComponent(host, componentQRL, jsxProps) {
|
|
1385
|
-
host &&
|
|
1466
|
+
host && clearAllEffects(container, host), vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore());
|
|
1386
1467
|
const jsxNode = jsxValue;
|
|
1387
1468
|
build.isDev && vnode_setProp(vNewNode, "q:type", VirtualType.Component), container.setHostProp(vNewNode, "q:renderFn", componentQRL),
|
|
1388
1469
|
container.setHostProp(vNewNode, "q:props", jsxProps), container.setHostProp(vNewNode, "q:key", jsxNode.key);
|
|
@@ -1423,22 +1504,21 @@
|
|
|
1423
1504
|
for (;;) {
|
|
1424
1505
|
const type = vCursor[VNodeProps.flags];
|
|
1425
1506
|
if (type & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK) {
|
|
1426
|
-
if (
|
|
1427
|
-
type & VNodeFlags.Virtual) {
|
|
1507
|
+
if (clearAllEffects(container, vCursor), markVNodeAsDeleted(vCursor), type & VNodeFlags.Virtual) {
|
|
1428
1508
|
const seq = container.getHostProp(vCursor, "q:seq");
|
|
1429
1509
|
if (seq) {
|
|
1430
1510
|
for (let i = 0; i < seq.length; i++) {
|
|
1431
1511
|
const obj = seq[i];
|
|
1432
1512
|
if (isTask(obj)) {
|
|
1433
1513
|
const task = obj;
|
|
1434
|
-
|
|
1514
|
+
clearAllEffects(container, task), task.$flags$ & TaskFlags.VISIBLE_TASK ? container.$scheduler$(ChoreType.CLEANUP_VISIBLE, task) : cleanupTask(task);
|
|
1435
1515
|
}
|
|
1436
1516
|
}
|
|
1437
1517
|
}
|
|
1438
1518
|
}
|
|
1439
1519
|
if (type & VNodeFlags.Virtual && null !== vnode_getProp(vCursor, "q:renderFn", null)) {
|
|
1440
|
-
const attrs = vCursor;
|
|
1441
|
-
for (let i =
|
|
1520
|
+
const attrs = vnode_getProps(vCursor);
|
|
1521
|
+
for (let i = 0; i < attrs.length; i += 2) {
|
|
1442
1522
|
const key = attrs[i];
|
|
1443
1523
|
if (!key.startsWith(":") && isSlotProp(key)) {
|
|
1444
1524
|
const value = attrs[i + 1];
|
|
@@ -1510,29 +1590,117 @@
|
|
|
1510
1590
|
SiblingsArray[SiblingsArray.VNode = 2] = "VNode", SiblingsArray[SiblingsArray.Size = 3] = "Size",
|
|
1511
1591
|
SiblingsArray[SiblingsArray.NextVNode = 5] = "NextVNode";
|
|
1512
1592
|
}(SiblingsArray || (SiblingsArray = {}));
|
|
1513
|
-
const
|
|
1514
|
-
|
|
1593
|
+
const useResourceQrl = (qrl, opts) => {
|
|
1594
|
+
const {val, set, i, iCtx} = useSequentialScope();
|
|
1595
|
+
if (null != val) {
|
|
1596
|
+
return val;
|
|
1597
|
+
}
|
|
1598
|
+
assertQrl(qrl);
|
|
1599
|
+
const container = iCtx.$container$;
|
|
1600
|
+
const resource = createResourceReturn(container, opts);
|
|
1601
|
+
const task = new Task(TaskFlags.DIRTY | TaskFlags.RESOURCE, i, iCtx.$hostElement$, qrl, resource, null);
|
|
1602
|
+
return container.$scheduler$(ChoreType.TASK, task), set(resource), resource;
|
|
1515
1603
|
};
|
|
1516
|
-
const
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
}
|
|
1604
|
+
const createResourceReturn = (container, opts, initialPromise) => {
|
|
1605
|
+
const result = (opts => ({
|
|
1606
|
+
__brand: "resource",
|
|
1607
|
+
value: void 0,
|
|
1608
|
+
loading: !isServerPlatform(),
|
|
1609
|
+
_resolved: void 0,
|
|
1610
|
+
_error: void 0,
|
|
1611
|
+
_state: "pending",
|
|
1612
|
+
_timeout: opts?.timeout ?? -1,
|
|
1613
|
+
_cache: 0
|
|
1614
|
+
}))(opts);
|
|
1615
|
+
return result.value = initialPromise, createStore(container, result, StoreFlags.RECURSIVE);
|
|
1616
|
+
};
|
|
1617
|
+
const isResourceReturn = obj => isObject(obj) && "resource" === (getStoreTarget(obj) || obj).__brand;
|
|
1618
|
+
const runResource = (task, container, host) => {
|
|
1619
|
+
task.$flags$ &= ~TaskFlags.DIRTY, cleanupTask(task);
|
|
1620
|
+
const iCtx = newInvokeContext(container.$locale$, host, void 0, "qResource");
|
|
1621
|
+
iCtx.$container$ = container;
|
|
1622
|
+
const taskFn = task.$qrl$.getFn(iCtx, (() => clearAllEffects(container, task)));
|
|
1623
|
+
const resource = task.$state$;
|
|
1624
|
+
assertDefined();
|
|
1625
|
+
const cleanups = [];
|
|
1626
|
+
task.$destroy$ = noSerialize((() => {
|
|
1627
|
+
cleanups.forEach((fn => {
|
|
1628
|
+
try {
|
|
1629
|
+
fn();
|
|
1630
|
+
} catch (err) {
|
|
1631
|
+
container.handleError(err, host);
|
|
1632
|
+
}
|
|
1633
|
+
})), done = !0;
|
|
1634
|
+
}));
|
|
1635
|
+
const resourceTarget = unwrapStore(resource);
|
|
1636
|
+
const opts = {
|
|
1637
|
+
track: (obj, prop) => {
|
|
1638
|
+
const ctx = newInvokeContext();
|
|
1639
|
+
return ctx.$effectSubscriber$ = getSubscriber(task, EffectProperty.COMPONENT), ctx.$container$ = container,
|
|
1640
|
+
invoke(ctx, (() => isFunction(obj) ? obj() : prop ? obj[prop] : isSignal(obj) ? obj.value : obj));
|
|
1641
|
+
},
|
|
1642
|
+
cleanup(fn) {
|
|
1643
|
+
"function" == typeof fn && cleanups.push(fn);
|
|
1644
|
+
},
|
|
1645
|
+
cache(policy) {
|
|
1646
|
+
let milliseconds = 0;
|
|
1647
|
+
milliseconds = "immutable" === policy ? 1 / 0 : policy, resource._cache = milliseconds;
|
|
1648
|
+
},
|
|
1649
|
+
previous: resourceTarget._resolved
|
|
1650
|
+
};
|
|
1651
|
+
let resolve;
|
|
1652
|
+
let reject;
|
|
1653
|
+
let done = !1;
|
|
1654
|
+
const setState = (resolved, value) => !done && (done = !0, resolved ? (done = !0,
|
|
1655
|
+
resource.loading = !1, resource._state = "resolved", resource._resolved = value,
|
|
1656
|
+
resource._error = void 0, resolve(value)) : (done = !0, resource.loading = !1, resource._state = "rejected",
|
|
1657
|
+
resource._error = value, reject(value)), !0);
|
|
1658
|
+
cleanups.push((() => {
|
|
1659
|
+
if (!0 === untrack((() => resource.loading))) {
|
|
1660
|
+
const value = untrack((() => resource._resolved));
|
|
1661
|
+
setState(!0, value);
|
|
1662
|
+
}
|
|
1663
|
+
})), invoke(iCtx, (() => {
|
|
1664
|
+
resource._state = "pending", resource.loading = !isServerPlatform();
|
|
1665
|
+
(resource.value = new Promise(((r, re) => {
|
|
1666
|
+
resolve = r, reject = re;
|
|
1667
|
+
}))).catch(ignoreErrorToPreventNodeFromCrashing);
|
|
1668
|
+
}));
|
|
1669
|
+
const promise = safeCall((() => Promise.resolve(taskFn(opts))), (value => {
|
|
1670
|
+
setState(!0, value);
|
|
1671
|
+
}), (err => {
|
|
1672
|
+
if (isPromise(err)) {
|
|
1673
|
+
return err.then((() => runResource(task, container, host)));
|
|
1674
|
+
}
|
|
1675
|
+
setState(!1, err);
|
|
1676
|
+
}));
|
|
1677
|
+
const timeout = resourceTarget._timeout;
|
|
1678
|
+
return timeout > 0 ? Promise.race([ promise, delay(timeout).then((() => {
|
|
1679
|
+
setState(!1, new Error("timeout")) && cleanupTask(task);
|
|
1680
|
+
})) ]) : promise;
|
|
1681
|
+
};
|
|
1682
|
+
const ignoreErrorToPreventNodeFromCrashing = () => {};
|
|
1683
|
+
const aVNodePath = [];
|
|
1684
|
+
const bVNodePath = [];
|
|
1685
|
+
const aSsrNodePath = [];
|
|
1686
|
+
const bSsrNodePath = [];
|
|
1687
|
+
const getPromise = chore => chore.$promise$ ||= new Promise((resolve => {
|
|
1688
|
+
chore.$resolve$ = resolve;
|
|
1689
|
+
}));
|
|
1529
1690
|
const createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
1530
1691
|
const choreQueue = [];
|
|
1692
|
+
const qrlRuns = [];
|
|
1531
1693
|
let currentChore = null;
|
|
1532
|
-
let
|
|
1694
|
+
let drainScheduled = !1;
|
|
1533
1695
|
return function schedule(type, hostOrTask = null, targetOrQrl = null, payload = null) {
|
|
1534
|
-
const
|
|
1535
|
-
const
|
|
1696
|
+
const isServer = !isDomContainer(container);
|
|
1697
|
+
const isComponentSsr = isServer && type === ChoreType.COMPONENT;
|
|
1698
|
+
const runLater = type !== ChoreType.WAIT_FOR_ALL && !isComponentSsr && type !== ChoreType.RUN_QRL;
|
|
1699
|
+
const isTask = type === ChoreType.TASK || type === ChoreType.VISIBLE || type === ChoreType.CLEANUP_VISIBLE;
|
|
1700
|
+
const isClientOnly = type === ChoreType.JOURNAL_FLUSH || type === ChoreType.NODE_DIFF || type === ChoreType.NODE_PROP;
|
|
1701
|
+
if (isServer && isClientOnly) {
|
|
1702
|
+
return;
|
|
1703
|
+
}
|
|
1536
1704
|
isTask && (hostOrTask.$flags$ |= TaskFlags.DIRTY);
|
|
1537
1705
|
let chore = {
|
|
1538
1706
|
$type$: type,
|
|
@@ -1545,13 +1713,13 @@
|
|
|
1545
1713
|
$returnValue$: null,
|
|
1546
1714
|
$executed$: !1
|
|
1547
1715
|
};
|
|
1548
|
-
chore
|
|
1716
|
+
chore = function(sortedArray, value, rootVNode) {
|
|
1549
1717
|
const idx = function(sortedArray, value, rootVNode) {
|
|
1550
1718
|
let bottom = 0;
|
|
1551
1719
|
let top = sortedArray.length;
|
|
1552
1720
|
for (;bottom < top; ) {
|
|
1553
1721
|
const middle = bottom + (top - bottom >> 1);
|
|
1554
|
-
const comp = choreComparator(value, sortedArray[middle], rootVNode
|
|
1722
|
+
const comp = choreComparator(value, sortedArray[middle], rootVNode);
|
|
1555
1723
|
if (comp < 0) {
|
|
1556
1724
|
top = middle;
|
|
1557
1725
|
} else {
|
|
@@ -1567,141 +1735,219 @@
|
|
|
1567
1735
|
return sortedArray.splice(~idx, 0, value), value;
|
|
1568
1736
|
}
|
|
1569
1737
|
const existing = sortedArray[idx];
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1738
|
+
existing.$type$ === ChoreType.NODE_DIFF && (existing.$payload$ = value.$payload$);
|
|
1739
|
+
existing.$executed$ && (existing.$executed$ = !1);
|
|
1740
|
+
return existing;
|
|
1741
|
+
}(choreQueue, chore, container.rootVNode || null), !drainScheduled && runLater && (drainScheduled = !0,
|
|
1742
|
+
schedule(ChoreType.JOURNAL_FLUSH), scheduleDrain()?.catch?.((() => {})));
|
|
1743
|
+
return runLater ? getPromise(chore) : drainUpTo(chore, isServer);
|
|
1574
1744
|
};
|
|
1575
|
-
function drainUpTo(runUptoChore,
|
|
1576
|
-
|
|
1577
|
-
return runUptoChore.$returnValue$;
|
|
1578
|
-
}
|
|
1579
|
-
if (currentChore) {
|
|
1580
|
-
return runUptoChore.$promise$;
|
|
1581
|
-
}
|
|
1745
|
+
function drainUpTo(runUptoChore, isServer) {
|
|
1746
|
+
let maxRetries = 5e3;
|
|
1582
1747
|
for (;choreQueue.length; ) {
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
if (null === order) {
|
|
1586
|
-
continue;
|
|
1587
|
-
}
|
|
1588
|
-
if (order > 0) {
|
|
1589
|
-
break;
|
|
1748
|
+
if (maxRetries-- < 0) {
|
|
1749
|
+
throw new Error("drainUpTo: max retries reached");
|
|
1590
1750
|
}
|
|
1591
|
-
if (
|
|
1592
|
-
|
|
1751
|
+
if (currentChore) {
|
|
1752
|
+
return getPromise(currentChore).then((() => drainUpTo(runUptoChore, isServer))).catch((e => {
|
|
1753
|
+
container.handleError(e, currentChore?.$host$);
|
|
1754
|
+
}));
|
|
1593
1755
|
}
|
|
1594
|
-
const
|
|
1595
|
-
if (
|
|
1596
|
-
|
|
1756
|
+
const nextChore = choreQueue[0];
|
|
1757
|
+
if (nextChore.$executed$) {
|
|
1758
|
+
if (choreQueue.shift(), nextChore === runUptoChore) {
|
|
1759
|
+
break;
|
|
1760
|
+
}
|
|
1761
|
+
} else {
|
|
1762
|
+
(chore = nextChore).$host$ && vnode_isVNode(chore.$host$) && chore.$host$[VNodeProps.flags] & VNodeFlags.Deleted && nextChore.$type$ !== ChoreType.CLEANUP_VISIBLE ? choreQueue.shift() : executeChore(nextChore, isServer);
|
|
1597
1763
|
}
|
|
1598
1764
|
}
|
|
1599
1765
|
var chore;
|
|
1600
1766
|
return runUptoChore.$returnValue$;
|
|
1601
1767
|
}
|
|
1602
|
-
function executeChore(chore) {
|
|
1768
|
+
function executeChore(chore, isServer) {
|
|
1603
1769
|
const host = chore.$host$;
|
|
1604
1770
|
assertEqual(), currentChore = chore;
|
|
1605
1771
|
let returnValue = null;
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1772
|
+
try {
|
|
1773
|
+
switch (chore.$type$) {
|
|
1774
|
+
case ChoreType.WAIT_FOR_ALL:
|
|
1775
|
+
isServer && (drainScheduled = !1);
|
|
1776
|
+
break;
|
|
1610
1777
|
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
if (chore.$type$ === ChoreType.COMPONENT) {
|
|
1615
|
-
const styleScopedId = container.getHostProp(host, "q:sstyle");
|
|
1616
|
-
return vnode_diff(container, jsx, host, addComponentStylePrefix(styleScopedId));
|
|
1617
|
-
}
|
|
1618
|
-
return jsx;
|
|
1619
|
-
}), (err => container.handleError(err, host)));
|
|
1620
|
-
break;
|
|
1778
|
+
case ChoreType.JOURNAL_FLUSH:
|
|
1779
|
+
returnValue = journalFlush(), drainScheduled = !1;
|
|
1780
|
+
break;
|
|
1621
1781
|
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1782
|
+
case ChoreType.COMPONENT:
|
|
1783
|
+
returnValue = safeCall((() => executeComponent(container, host, host, chore.$target$, chore.$payload$)), (jsx => {
|
|
1784
|
+
if (isServer) {
|
|
1785
|
+
return jsx;
|
|
1786
|
+
}
|
|
1787
|
+
{
|
|
1788
|
+
const styleScopedId = container.getHostProp(host, "q:sstyle");
|
|
1789
|
+
return retryOnPromise((() => vnode_diff(container, jsx, host, addComponentStylePrefix(styleScopedId))));
|
|
1790
|
+
}
|
|
1791
|
+
}), (err => container.handleError(err, host)));
|
|
1792
|
+
break;
|
|
1626
1793
|
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1794
|
+
case ChoreType.RUN_QRL:
|
|
1795
|
+
{
|
|
1796
|
+
const fn = chore.$target$.getFn();
|
|
1797
|
+
const result = retryOnPromise((() => fn(...chore.$payload$)));
|
|
1798
|
+
if (isPromise(result)) {
|
|
1799
|
+
const handled = result.finally((() => {
|
|
1800
|
+
qrlRuns.splice(qrlRuns.indexOf(handled), 1);
|
|
1801
|
+
})).catch((error => {
|
|
1802
|
+
container.handleError(error, chore.$host$);
|
|
1803
|
+
}));
|
|
1804
|
+
return qrlRuns.push(handled), chore.$returnValue$ = handled, chore.$resolve$?.(handled),
|
|
1805
|
+
currentChore = null, void (chore.$executed$ = !0);
|
|
1806
|
+
}
|
|
1807
|
+
returnValue = null;
|
|
1808
|
+
}
|
|
1809
|
+
break;
|
|
1631
1810
|
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1811
|
+
case ChoreType.TASK:
|
|
1812
|
+
case ChoreType.VISIBLE:
|
|
1813
|
+
{
|
|
1814
|
+
const payload = chore.$payload$;
|
|
1815
|
+
if (payload.$flags$ & TaskFlags.RESOURCE) {
|
|
1816
|
+
const result = runResource(payload, container, host);
|
|
1817
|
+
returnValue = isServer ? result : null;
|
|
1818
|
+
} else {
|
|
1819
|
+
returnValue = runTask(payload, container, host);
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
break;
|
|
1635
1823
|
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
isSignal(jsx) && (jsx = jsx.value), returnValue = vnode_diff(container, jsx, parentVirtualNode, null);
|
|
1640
|
-
break;
|
|
1824
|
+
case ChoreType.CLEANUP_VISIBLE:
|
|
1825
|
+
cleanupTask(chore.$payload$);
|
|
1826
|
+
break;
|
|
1641
1827
|
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
const property = chore.$idx$;
|
|
1650
|
-
const serializedValue = serializeAttribute(property, value, payload.$scopedStyleIdPrefix$);
|
|
1651
|
-
if (isConst) {
|
|
1652
|
-
journal.push(VNodeJournalOpCode.SetAttribute, virtualNode[ElementVNodeProps.element], property, serializedValue);
|
|
1653
|
-
} else {
|
|
1654
|
-
vnode_setAttr(journal, virtualNode, property, serializedValue);
|
|
1655
|
-
}
|
|
1656
|
-
break;
|
|
1828
|
+
case ChoreType.NODE_DIFF:
|
|
1829
|
+
{
|
|
1830
|
+
const parentVirtualNode = chore.$target$;
|
|
1831
|
+
let jsx = chore.$payload$;
|
|
1832
|
+
isSignal(jsx) && (jsx = jsx.value), returnValue = retryOnPromise((() => vnode_diff(container, jsx, parentVirtualNode, null)));
|
|
1833
|
+
}
|
|
1834
|
+
break;
|
|
1657
1835
|
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1836
|
+
case ChoreType.NODE_PROP:
|
|
1837
|
+
{
|
|
1838
|
+
const virtualNode = chore.$host$;
|
|
1839
|
+
const payload = chore.$payload$;
|
|
1840
|
+
let value = payload.$value$;
|
|
1841
|
+
isSignal(value) && (value = value.value);
|
|
1842
|
+
const isConst = payload.$isConst$;
|
|
1843
|
+
const journal = container.$journal$;
|
|
1844
|
+
const property = chore.$idx$;
|
|
1845
|
+
const serializedValue = serializeAttribute(property, value, payload.$scopedStyleIdPrefix$);
|
|
1846
|
+
if (isConst) {
|
|
1847
|
+
journal.push(VNodeJournalOpCode.SetAttribute, virtualNode[ElementVNodeProps.element], property, serializedValue);
|
|
1848
|
+
} else {
|
|
1849
|
+
vnode_setAttr(journal, virtualNode, property, serializedValue);
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1662
1852
|
break;
|
|
1663
|
-
}
|
|
1664
1853
|
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
if (target.$forceRunEffects$ = !1, !target.$effects$?.length) {
|
|
1670
|
-
break;
|
|
1854
|
+
case ChoreType.QRL_RESOLVE:
|
|
1855
|
+
{
|
|
1856
|
+
const target = chore.$target$;
|
|
1857
|
+
returnValue = target.resolved ? null : target.resolve();
|
|
1671
1858
|
}
|
|
1672
|
-
returnValue = retryOnPromise((() => {
|
|
1673
|
-
(target.$computeIfNeeded$() || forceRunEffects) && triggerEffects(container, target, target.$effects$);
|
|
1674
|
-
}));
|
|
1675
1859
|
break;
|
|
1860
|
+
|
|
1861
|
+
case ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS:
|
|
1862
|
+
{
|
|
1863
|
+
const target = chore.$target$;
|
|
1864
|
+
const forceRunEffects = target.$forceRunEffects$;
|
|
1865
|
+
if (target.$forceRunEffects$ = !1, !target.$effects$?.size) {
|
|
1866
|
+
break;
|
|
1867
|
+
}
|
|
1868
|
+
returnValue = retryOnPromise((() => {
|
|
1869
|
+
(target.$computeIfNeeded$() || forceRunEffects) && triggerEffects(container, target, target.$effects$);
|
|
1870
|
+
}));
|
|
1871
|
+
}
|
|
1676
1872
|
}
|
|
1873
|
+
} catch (e) {
|
|
1874
|
+
returnValue = Promise.reject(e);
|
|
1677
1875
|
}
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
const choreUpdate = (existing, newChore) => {
|
|
1685
|
-
existing.$type$ === ChoreType.NODE_DIFF && (existing.$payload$ = newChore.$payload$);
|
|
1686
|
-
};
|
|
1687
|
-
function choreComparator(a, b, rootVNode, shouldThrowOnHostMismatch) {
|
|
1688
|
-
const macroTypeDiff = (a.$type$ & ChoreType.MACRO) - (b.$type$ & ChoreType.MACRO);
|
|
1689
|
-
if (0 !== macroTypeDiff) {
|
|
1690
|
-
return macroTypeDiff;
|
|
1876
|
+
const after = (value, error) => {
|
|
1877
|
+
currentChore = null, chore.$executed$ = !0, error ? container.handleError(error, host) : (chore.$returnValue$ = value,
|
|
1878
|
+
chore.$resolve$?.(value));
|
|
1879
|
+
};
|
|
1880
|
+
isPromise(returnValue) ? (chore.$promise$ = returnValue.then(after, (error => after(void 0, error))),
|
|
1881
|
+
chore.$resolve$?.(chore.$promise$), chore.$resolve$ = void 0) : after(returnValue);
|
|
1691
1882
|
}
|
|
1692
|
-
|
|
1883
|
+
function choreComparator(a, b, rootVNode) {
|
|
1884
|
+
const macroTypeDiff = (a.$type$ & ChoreType.MACRO) - (b.$type$ & ChoreType.MACRO);
|
|
1885
|
+
if (0 !== macroTypeDiff) {
|
|
1886
|
+
return macroTypeDiff;
|
|
1887
|
+
}
|
|
1693
1888
|
const aHost = a.$host$;
|
|
1694
1889
|
const bHost = b.$host$;
|
|
1695
1890
|
if (aHost !== bHost && null !== aHost && null !== bHost) {
|
|
1696
|
-
if (
|
|
1697
|
-
const
|
|
1698
|
-
|
|
1699
|
-
|
|
1891
|
+
if (vnode_isVNode(aHost) && vnode_isVNode(bHost)) {
|
|
1892
|
+
const hostDiff = ((a, b, rootVNode) => {
|
|
1893
|
+
if (a === b) {
|
|
1894
|
+
return 0;
|
|
1895
|
+
}
|
|
1896
|
+
let aDepth = -1;
|
|
1897
|
+
let bDepth = -1;
|
|
1898
|
+
for (;a; ) {
|
|
1899
|
+
a = (aVNodePath[++aDepth] = a)[VNodeProps.parent] || rootVNode && vnode_getProp(a, ":", (id => vnode_locate(rootVNode, id)));
|
|
1900
|
+
}
|
|
1901
|
+
for (;b; ) {
|
|
1902
|
+
b = (bVNodePath[++bDepth] = b)[VNodeProps.parent] || rootVNode && vnode_getProp(b, ":", (id => vnode_locate(rootVNode, id)));
|
|
1903
|
+
}
|
|
1904
|
+
for (;aDepth >= 0 && bDepth >= 0; ) {
|
|
1905
|
+
if ((a = aVNodePath[aDepth]) !== (b = bVNodePath[bDepth])) {
|
|
1906
|
+
let cursor = b;
|
|
1907
|
+
do {
|
|
1908
|
+
if (cursor = vnode_getNextSibling(cursor), cursor === a) {
|
|
1909
|
+
return 1;
|
|
1910
|
+
}
|
|
1911
|
+
} while (cursor);
|
|
1912
|
+
cursor = b;
|
|
1913
|
+
do {
|
|
1914
|
+
if (cursor = vnode_getPreviousSibling(cursor), cursor === a) {
|
|
1915
|
+
return -1;
|
|
1916
|
+
}
|
|
1917
|
+
} while (cursor);
|
|
1918
|
+
return rootVNode && vnode_getProp(b, ":", (id => vnode_locate(rootVNode, id))) ? -1 : 1;
|
|
1919
|
+
}
|
|
1920
|
+
aDepth--, bDepth--;
|
|
1921
|
+
}
|
|
1922
|
+
return aDepth < bDepth ? -1 : 1;
|
|
1923
|
+
})(aHost, bHost, rootVNode);
|
|
1924
|
+
if (0 !== hostDiff) {
|
|
1925
|
+
return hostDiff;
|
|
1700
1926
|
}
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1927
|
+
} else {
|
|
1928
|
+
assertFalse(vnode_isVNode(aHost)), assertFalse(vnode_isVNode(bHost));
|
|
1929
|
+
const errorMessage = `SERVER: during HTML streaming, re-running tasks on a different host is not allowed.\n You are attempting to change a state that has already been streamed to the client.\n This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).\n Problematic Node: ${aHost.toString()}`;
|
|
1930
|
+
logWarn(errorMessage);
|
|
1931
|
+
const hostDiff = ((a, b) => {
|
|
1932
|
+
if (a === b) {
|
|
1933
|
+
return 0;
|
|
1934
|
+
}
|
|
1935
|
+
let aDepth = -1;
|
|
1936
|
+
let bDepth = -1;
|
|
1937
|
+
for (;a; ) {
|
|
1938
|
+
a = (aSsrNodePath[++aDepth] = a).currentComponentNode;
|
|
1939
|
+
}
|
|
1940
|
+
for (;b; ) {
|
|
1941
|
+
b = (bSsrNodePath[++bDepth] = b).currentComponentNode;
|
|
1942
|
+
}
|
|
1943
|
+
for (;aDepth >= 0 && bDepth >= 0; ) {
|
|
1944
|
+
if ((a = aSsrNodePath[aDepth]) !== (b = bSsrNodePath[bDepth])) {
|
|
1945
|
+
return 1;
|
|
1946
|
+
}
|
|
1947
|
+
aDepth--, bDepth--;
|
|
1948
|
+
}
|
|
1949
|
+
return aDepth < bDepth ? -1 : 1;
|
|
1950
|
+
})(aHost, bHost);
|
|
1705
1951
|
if (0 !== hostDiff) {
|
|
1706
1952
|
return hostDiff;
|
|
1707
1953
|
}
|
|
@@ -1712,134 +1958,28 @@
|
|
|
1712
1958
|
return microTypeDiff;
|
|
1713
1959
|
}
|
|
1714
1960
|
const idxDiff = toNumber(a.$idx$) - toNumber(b.$idx$);
|
|
1715
|
-
|
|
1716
|
-
return idxDiff;
|
|
1717
|
-
}
|
|
1718
|
-
if (a.$target$ !== b.$target$ && (a.$type$ === ChoreType.QRL_RESOLVE && b.$type$ === ChoreType.QRL_RESOLVE || a.$type$ === ChoreType.NODE_PROP && b.$type$ === ChoreType.NODE_PROP || a.$type$ === ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS && b.$type$ === ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS)) {
|
|
1719
|
-
return 1;
|
|
1720
|
-
}
|
|
1721
|
-
}
|
|
1722
|
-
return 0;
|
|
1723
|
-
}
|
|
1724
|
-
const useLexicalScope = () => {
|
|
1725
|
-
const context = getInvokeContext();
|
|
1726
|
-
let qrl = context.$qrl$;
|
|
1727
|
-
if (qrl) {
|
|
1728
|
-
assertQrl(qrl), assertDefined();
|
|
1729
|
-
} else {
|
|
1730
|
-
const el = context.$element$;
|
|
1731
|
-
assertDefined();
|
|
1732
|
-
const containerElement = _getQContainerElement(el);
|
|
1733
|
-
assertDefined();
|
|
1734
|
-
qrl = getDomContainer(containerElement).parseQRL(decodeURIComponent(String(context.$url$)));
|
|
1735
|
-
}
|
|
1736
|
-
return qrl.$captureRef$;
|
|
1737
|
-
};
|
|
1738
|
-
var TaskFlags;
|
|
1739
|
-
!function(TaskFlags) {
|
|
1740
|
-
TaskFlags[TaskFlags.VISIBLE_TASK = 1] = "VISIBLE_TASK", TaskFlags[TaskFlags.TASK = 2] = "TASK",
|
|
1741
|
-
TaskFlags[TaskFlags.RESOURCE = 4] = "RESOURCE", TaskFlags[TaskFlags.DIRTY = 8] = "DIRTY";
|
|
1742
|
-
}(TaskFlags || (TaskFlags = {}));
|
|
1743
|
-
const useTaskQrl = (qrl, opts) => {
|
|
1744
|
-
const {val, set, iCtx, i} = useSequentialScope();
|
|
1745
|
-
if (val) {
|
|
1746
|
-
return;
|
|
1747
|
-
}
|
|
1748
|
-
assertQrl(qrl), set(1);
|
|
1749
|
-
const host = iCtx.$hostElement$;
|
|
1750
|
-
const task = new Task(TaskFlags.DIRTY | TaskFlags.TASK, i, iCtx.$hostElement$, qrl, void 0, null);
|
|
1751
|
-
set(task);
|
|
1752
|
-
const result = runTask(task, iCtx.$container$, host);
|
|
1753
|
-
if (isPromise(result)) {
|
|
1754
|
-
throw result;
|
|
1755
|
-
}
|
|
1756
|
-
qrl.$resolveLazy$(iCtx.$element$), isServerPlatform() && useRunTask(task, opts?.eagerness);
|
|
1757
|
-
};
|
|
1758
|
-
const runTask = (task, container, host) => {
|
|
1759
|
-
task.$flags$ &= ~TaskFlags.DIRTY, cleanupTask(task);
|
|
1760
|
-
const iCtx = newInvokeContext(container.$locale$, host, void 0, "qTask");
|
|
1761
|
-
iCtx.$container$ = container;
|
|
1762
|
-
const taskFn = task.$qrl$.getFn(iCtx, (() => clearSubscriberEffectDependencies(container, task)));
|
|
1763
|
-
const handleError = reason => container.handleError(reason, host);
|
|
1764
|
-
let cleanupFns = null;
|
|
1765
|
-
const cleanup = fn => {
|
|
1766
|
-
"function" == typeof fn && (cleanupFns || (cleanupFns = [], task.$destroy$ = noSerialize((() => {
|
|
1767
|
-
task.$destroy$ = null, cleanupFns.forEach((fn => {
|
|
1768
|
-
try {
|
|
1769
|
-
fn();
|
|
1770
|
-
} catch (err) {
|
|
1771
|
-
handleError(err);
|
|
1772
|
-
}
|
|
1773
|
-
}));
|
|
1774
|
-
}))), cleanupFns.push(fn));
|
|
1775
|
-
};
|
|
1776
|
-
const taskApi = {
|
|
1777
|
-
track: (obj, prop) => {
|
|
1778
|
-
const ctx = newInvokeContext();
|
|
1779
|
-
return ctx.$effectSubscriber$ = [ task, EffectProperty.COMPONENT ], ctx.$container$ = container,
|
|
1780
|
-
invoke(ctx, (() => isFunction(obj) ? obj() : prop ? obj[prop] : isSignal(obj) ? obj.value : obj));
|
|
1781
|
-
},
|
|
1782
|
-
cleanup
|
|
1783
|
-
};
|
|
1784
|
-
return safeCall((() => taskFn(taskApi)), cleanup, (err => isPromise(err) ? err.then((() => runTask(task, container, host))) : handleError(err)));
|
|
1785
|
-
};
|
|
1786
|
-
const cleanupTask = task => {
|
|
1787
|
-
const destroy = task.$destroy$;
|
|
1788
|
-
if (destroy) {
|
|
1789
|
-
task.$destroy$ = null;
|
|
1790
|
-
try {
|
|
1791
|
-
destroy();
|
|
1792
|
-
} catch (err) {
|
|
1793
|
-
((message, ...optionalParams) => {
|
|
1794
|
-
createAndLogError(!1, message, ...optionalParams);
|
|
1795
|
-
})(err);
|
|
1796
|
-
}
|
|
1797
|
-
}
|
|
1798
|
-
};
|
|
1799
|
-
const useRunTask = (task, eagerness) => {
|
|
1800
|
-
"visible" === eagerness || "intersection-observer" === eagerness ? useOn("qvisible", getTaskHandlerQrl(task)) : "load" === eagerness || "document-ready" === eagerness ? useOnDocument("qinit", getTaskHandlerQrl(task)) : "idle" !== eagerness && "document-idle" !== eagerness || useOnDocument("qidle", getTaskHandlerQrl(task));
|
|
1801
|
-
};
|
|
1802
|
-
const getTaskHandlerQrl = task => {
|
|
1803
|
-
const taskQrl = task.$qrl$;
|
|
1804
|
-
const taskHandler = createQRL(taskQrl.$chunk$, "_hW", _hW, null, null, [ task ], taskQrl.$symbol$);
|
|
1805
|
-
return taskQrl.dev && (taskHandler.dev = taskQrl.dev), taskHandler;
|
|
1806
|
-
};
|
|
1807
|
-
class Task extends Subscriber {
|
|
1808
|
-
$flags$;
|
|
1809
|
-
$index$;
|
|
1810
|
-
$el$;
|
|
1811
|
-
$qrl$;
|
|
1812
|
-
$state$;
|
|
1813
|
-
$destroy$;
|
|
1814
|
-
constructor($flags$, $index$, $el$, $qrl$, $state$, $destroy$) {
|
|
1815
|
-
super(), this.$flags$ = $flags$, this.$index$ = $index$, this.$el$ = $el$, this.$qrl$ = $qrl$,
|
|
1816
|
-
this.$state$ = $state$, this.$destroy$ = $destroy$;
|
|
1961
|
+
return 0 !== idxDiff ? idxDiff : a.$target$ !== b.$target$ || a.$payload$ !== b.$payload$ || b === currentChore ? 1 : 0;
|
|
1817
1962
|
}
|
|
1818
|
-
}
|
|
1819
|
-
const isTask = value => value instanceof Task;
|
|
1820
|
-
const _hW = () => {
|
|
1821
|
-
const [task] = useLexicalScope();
|
|
1822
|
-
getDomContainer(task.$el$).$scheduler$(task.$flags$ & TaskFlags.VISIBLE_TASK ? ChoreType.VISIBLE : ChoreType.TASK, task);
|
|
1823
1963
|
};
|
|
1824
|
-
const
|
|
1964
|
+
const toNumber = value => "number" == typeof value ? value : -1;
|
|
1825
1965
|
const throwIfQRLNotResolved = qrl => {
|
|
1826
1966
|
if (!qrl.resolved) {
|
|
1827
1967
|
throw qrl.resolve();
|
|
1828
1968
|
}
|
|
1829
1969
|
};
|
|
1830
1970
|
const isSignal = value => value instanceof Signal;
|
|
1831
|
-
class
|
|
1971
|
+
class SubscriptionData {
|
|
1832
1972
|
data;
|
|
1833
1973
|
constructor(data) {
|
|
1834
1974
|
this.data = data;
|
|
1835
1975
|
}
|
|
1836
1976
|
}
|
|
1837
|
-
var
|
|
1977
|
+
var EffectSubscriptionProp;
|
|
1838
1978
|
var EffectProperty;
|
|
1839
|
-
!function(
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
}(
|
|
1979
|
+
!function(EffectSubscriptionProp) {
|
|
1980
|
+
EffectSubscriptionProp[EffectSubscriptionProp.CONSUMER = 0] = "CONSUMER", EffectSubscriptionProp[EffectSubscriptionProp.PROPERTY = 1] = "PROPERTY",
|
|
1981
|
+
EffectSubscriptionProp[EffectSubscriptionProp.BACK_REF = 2] = "BACK_REF", EffectSubscriptionProp[EffectSubscriptionProp.DATA = 3] = "DATA";
|
|
1982
|
+
}(EffectSubscriptionProp || (EffectSubscriptionProp = {})), function(EffectProperty) {
|
|
1843
1983
|
EffectProperty.COMPONENT = ":", EffectProperty.VNODE = ".";
|
|
1844
1984
|
}(EffectProperty || (EffectProperty = {}));
|
|
1845
1985
|
class Signal {
|
|
@@ -1868,9 +2008,9 @@
|
|
|
1868
2008
|
}
|
|
1869
2009
|
const effectSubscriber = ctx.$effectSubscriber$;
|
|
1870
2010
|
if (effectSubscriber) {
|
|
1871
|
-
const effects = this.$effects$ ||=
|
|
1872
|
-
|
|
1873
|
-
|
|
2011
|
+
const effects = this.$effects$ ||= new Set;
|
|
2012
|
+
ensureContainsSubscription(effects, effectSubscriber), ensureContainsBackRef(effectSubscriber, this),
|
|
2013
|
+
addQrlToSerializationCtx(effectSubscriber, this.$container$);
|
|
1874
2014
|
}
|
|
1875
2015
|
}
|
|
1876
2016
|
return this.untrackedValue;
|
|
@@ -1882,7 +2022,7 @@
|
|
|
1882
2022
|
qDev;
|
|
1883
2023
|
}
|
|
1884
2024
|
toString() {
|
|
1885
|
-
return `[${this.constructor.name}${this.$invalid$ ? " INVALID" : ""} ${String(this.$untrackedValue$)}]` + (this.$effects
|
|
2025
|
+
return `[${this.constructor.name}${this.$invalid$ ? " INVALID" : ""} ${String(this.$untrackedValue$)}]` + (Array.from(this.$effects$ || []).map((e => "\n -> " + pad(qwikDebugToString(e[0]), " "))).join("\n") || "");
|
|
1886
2026
|
}
|
|
1887
2027
|
toJSON() {
|
|
1888
2028
|
return {
|
|
@@ -1890,80 +2030,58 @@
|
|
|
1890
2030
|
};
|
|
1891
2031
|
}
|
|
1892
2032
|
}
|
|
1893
|
-
const
|
|
1894
|
-
|
|
1895
|
-
};
|
|
1896
|
-
const ensureContainsEffect = (array, effectSubscriptions) => {
|
|
1897
|
-
for (let i = 0; i < array.length; i++) {
|
|
1898
|
-
const existingEffect = array[i];
|
|
1899
|
-
if (existingEffect[0] === effectSubscriptions[0] && existingEffect[1] === effectSubscriptions[1]) {
|
|
1900
|
-
return;
|
|
1901
|
-
}
|
|
1902
|
-
}
|
|
1903
|
-
array.push(effectSubscriptions);
|
|
2033
|
+
const ensureContainsSubscription = (array, effectSubscription) => {
|
|
2034
|
+
array.add(effectSubscription);
|
|
1904
2035
|
};
|
|
1905
|
-
const
|
|
1906
|
-
|
|
1907
|
-
if (effect.$effectDependencies$ ||= [], subscriberExistInSubscribers(effect.$effectDependencies$, subscriber)) {
|
|
1908
|
-
return;
|
|
1909
|
-
}
|
|
1910
|
-
effect.$effectDependencies$.push(subscriber);
|
|
1911
|
-
} else if (vnode_isVNode(effect) && !vnode_isTextVNode(effect)) {
|
|
1912
|
-
let subscribers = vnode_getProp(effect, "q:subs", container ? container.$getObjectById$ : null);
|
|
1913
|
-
if (subscribers ||= [], subscriberExistInSubscribers(subscribers, subscriber)) {
|
|
1914
|
-
return;
|
|
1915
|
-
}
|
|
1916
|
-
subscribers.push(subscriber), vnode_setProp(effect, "q:subs", subscribers);
|
|
1917
|
-
} else if (isSSRNode(effect)) {
|
|
1918
|
-
let subscribers = effect.getProp("q:subs");
|
|
1919
|
-
if (subscribers ||= [], subscriberExistInSubscribers(subscribers, subscriber)) {
|
|
1920
|
-
return;
|
|
1921
|
-
}
|
|
1922
|
-
subscribers.push(subscriber), effect.setProp("q:subs", subscribers);
|
|
1923
|
-
}
|
|
2036
|
+
const ensureContainsBackRef = (array, value) => {
|
|
2037
|
+
array[EffectSubscriptionProp.BACK_REF] ||= new Set, array[EffectSubscriptionProp.BACK_REF].add(value);
|
|
1924
2038
|
};
|
|
1925
|
-
const
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
2039
|
+
const addQrlToSerializationCtx = (effectSubscriber, container) => {
|
|
2040
|
+
if (container && !isDomContainer(container)) {
|
|
2041
|
+
const effect = effectSubscriber[EffectSubscriptionProp.CONSUMER];
|
|
2042
|
+
const property = effectSubscriber[EffectSubscriptionProp.PROPERTY];
|
|
2043
|
+
let qrl = null;
|
|
2044
|
+
isTask(effect) ? qrl = effect.$qrl$ : effect instanceof ComputedSignal ? qrl = effect.$computeQrl$ : property === EffectProperty.COMPONENT && (qrl = container.getHostProp(effect, "q:renderFn")),
|
|
2045
|
+
qrl && container.serializationCtx.$eventQrls$.add(qrl);
|
|
1931
2046
|
}
|
|
1932
|
-
return !1;
|
|
1933
2047
|
};
|
|
1934
2048
|
const triggerEffects = (container, signal, effects) => {
|
|
2049
|
+
const isBrowser = isDomContainer(container);
|
|
1935
2050
|
if (effects) {
|
|
1936
|
-
const scheduleEffect =
|
|
1937
|
-
const
|
|
1938
|
-
const property =
|
|
1939
|
-
if (assertDefined(), isTask(
|
|
1940
|
-
|
|
2051
|
+
const scheduleEffect = effectSubscription => {
|
|
2052
|
+
const consumer = effectSubscription[EffectSubscriptionProp.CONSUMER];
|
|
2053
|
+
const property = effectSubscription[EffectSubscriptionProp.PROPERTY];
|
|
2054
|
+
if (assertDefined(), isTask(consumer)) {
|
|
2055
|
+
consumer.$flags$ |= TaskFlags.DIRTY;
|
|
1941
2056
|
let choreType = ChoreType.TASK;
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
effect.$invalidate$();
|
|
2057
|
+
consumer.$flags$ & TaskFlags.VISIBLE_TASK && (choreType = ChoreType.VISIBLE), container.$scheduler$(choreType, consumer);
|
|
2058
|
+
} else if (consumer instanceof Signal) {
|
|
2059
|
+
consumer instanceof ComputedSignal && (consumer.$computeQrl$.resolved || container.$scheduler$(ChoreType.QRL_RESOLVE, null, consumer.$computeQrl$)),
|
|
2060
|
+
consumer.$invalidate$();
|
|
1947
2061
|
} else if (property === EffectProperty.COMPONENT) {
|
|
1948
|
-
const host =
|
|
2062
|
+
const host = consumer;
|
|
1949
2063
|
const qrl = container.getHostProp(host, "q:renderFn");
|
|
1950
2064
|
assertDefined();
|
|
1951
2065
|
const props = container.getHostProp(host, "q:props");
|
|
1952
2066
|
container.$scheduler$(ChoreType.COMPONENT, host, qrl, props);
|
|
1953
|
-
} else if (
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
2067
|
+
} else if (isBrowser) {
|
|
2068
|
+
if (property === EffectProperty.VNODE) {
|
|
2069
|
+
container.$scheduler$(ChoreType.NODE_DIFF, consumer, consumer, signal);
|
|
2070
|
+
} else {
|
|
2071
|
+
const effectData = effectSubscription[EffectSubscriptionProp.DATA];
|
|
2072
|
+
if (effectData instanceof SubscriptionData) {
|
|
2073
|
+
const payload = {
|
|
2074
|
+
...effectData.data,
|
|
2075
|
+
$value$: signal
|
|
2076
|
+
};
|
|
2077
|
+
container.$scheduler$(ChoreType.NODE_PROP, consumer, property, payload);
|
|
2078
|
+
}
|
|
1963
2079
|
}
|
|
1964
2080
|
}
|
|
1965
2081
|
};
|
|
1966
|
-
effects
|
|
2082
|
+
for (const effect of effects) {
|
|
2083
|
+
scheduleEffect(effect);
|
|
2084
|
+
}
|
|
1967
2085
|
}
|
|
1968
2086
|
};
|
|
1969
2087
|
class ComputedSignal extends Signal {
|
|
@@ -1991,7 +2109,7 @@
|
|
|
1991
2109
|
throwIfQRLNotResolved(computeQrl);
|
|
1992
2110
|
const ctx = tryGetInvokeContext();
|
|
1993
2111
|
const previousEffectSubscription = ctx?.$effectSubscriber$;
|
|
1994
|
-
ctx && (ctx.$effectSubscriber$ =
|
|
2112
|
+
ctx && (ctx.$effectSubscriber$ = getSubscriber(this, EffectProperty.VNODE));
|
|
1995
2113
|
try {
|
|
1996
2114
|
const untrackedValue = computeQrl.getFn(ctx)();
|
|
1997
2115
|
if (isPromise(untrackedValue)) {
|
|
@@ -2016,9 +2134,9 @@
|
|
|
2016
2134
|
$func$;
|
|
2017
2135
|
$funcStr$;
|
|
2018
2136
|
$invalid$=!0;
|
|
2019
|
-
$effectDependencies$=null;
|
|
2020
2137
|
$hostElement$=null;
|
|
2021
2138
|
$forceRunEffects$=!1;
|
|
2139
|
+
[_EFFECT_BACK_REF]=null;
|
|
2022
2140
|
constructor(container, fn, args, fnStr) {
|
|
2023
2141
|
super(container, NEEDS_COMPUTATION), this.$args$ = args, this.$func$ = fn, this.$funcStr$ = fnStr;
|
|
2024
2142
|
}
|
|
@@ -2054,18 +2172,10 @@
|
|
|
2054
2172
|
this.$scopedStyle$ = $scopedStyle$, this.$componentFrame$ = $componentFrame$;
|
|
2055
2173
|
}
|
|
2056
2174
|
}
|
|
2057
|
-
function _walkJSX(ssr, value, options) {
|
|
2175
|
+
async function _walkJSX(ssr, value, options) {
|
|
2058
2176
|
const stack = [ value ];
|
|
2059
|
-
let resolveDrain;
|
|
2060
|
-
let rejectDrain;
|
|
2061
|
-
const drained = options.allowPromises && new Promise(((res, rej) => {
|
|
2062
|
-
resolveDrain = res, rejectDrain = rej;
|
|
2063
|
-
}));
|
|
2064
2177
|
const enqueue = value => stack.push(value);
|
|
2065
|
-
|
|
2066
|
-
stack.push(value), drain();
|
|
2067
|
-
};
|
|
2068
|
-
const drain = () => {
|
|
2178
|
+
await (async () => {
|
|
2069
2179
|
for (;stack.length; ) {
|
|
2070
2180
|
const value = stack.pop();
|
|
2071
2181
|
if (value instanceof ParentComponentData) {
|
|
@@ -2077,23 +2187,13 @@
|
|
|
2077
2187
|
});
|
|
2078
2188
|
} else {
|
|
2079
2189
|
if (value === Promise) {
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
}
|
|
2083
|
-
return void stack.pop().then(resolveValue, rejectDrain);
|
|
2084
|
-
}
|
|
2085
|
-
const waitOn = value.apply(ssr);
|
|
2086
|
-
if (waitOn) {
|
|
2087
|
-
if (!options.allowPromises) {
|
|
2088
|
-
throw qError(QError.promisesNotExpected);
|
|
2089
|
-
}
|
|
2090
|
-
return void waitOn.then(drain, rejectDrain);
|
|
2190
|
+
stack.push(await stack.pop());
|
|
2191
|
+
continue;
|
|
2091
2192
|
}
|
|
2193
|
+
await value.apply(ssr);
|
|
2092
2194
|
}
|
|
2093
2195
|
}
|
|
2094
|
-
|
|
2095
|
-
};
|
|
2096
|
-
return drain(), drained;
|
|
2196
|
+
})();
|
|
2097
2197
|
}
|
|
2098
2198
|
function processJSXNode(ssr, enqueue, value, options) {
|
|
2099
2199
|
if (null == value) {
|
|
@@ -2122,7 +2222,6 @@
|
|
|
2122
2222
|
enqueue((async () => {
|
|
2123
2223
|
for await (const chunk of value) {
|
|
2124
2224
|
await _walkJSX(ssr, chunk, {
|
|
2125
|
-
allowPromises: !0,
|
|
2126
2225
|
currentStyleScoped: options.styleScoped,
|
|
2127
2226
|
parentComponentFrame: options.parentComponentFrame
|
|
2128
2227
|
}), ssr.commentNode("qkssr-f");
|
|
@@ -2189,7 +2288,6 @@
|
|
|
2189
2288
|
value = isFunction(generator) ? generator({
|
|
2190
2289
|
async write(chunk) {
|
|
2191
2290
|
await _walkJSX(ssr, chunk, {
|
|
2192
|
-
allowPromises: !0,
|
|
2193
2291
|
currentStyleScoped: options.styleScoped,
|
|
2194
2292
|
parentComponentFrame: options.parentComponentFrame
|
|
2195
2293
|
}), ssr.commentNode("qkssr-f");
|
|
@@ -2209,7 +2307,7 @@
|
|
|
2209
2307
|
srcProps && srcProps.children && delete srcProps.children;
|
|
2210
2308
|
const scheduler = ssr.$scheduler$;
|
|
2211
2309
|
return host.setProp("q:renderFn", componentQrl), host.setProp("q:props", srcProps),
|
|
2212
|
-
null !== jsx.key && host.setProp("q:key", jsx.key), scheduler(ChoreType.
|
|
2310
|
+
null !== jsx.key && host.setProp("q:key", jsx.key), scheduler(ChoreType.COMPONENT, host, componentQrl, srcProps);
|
|
2213
2311
|
})(ssr, jsx, type);
|
|
2214
2312
|
const compStyleComponentId = addComponentStylePrefix(host.getProp("q:sstyle"));
|
|
2215
2313
|
enqueue(new ParentComponentData(options.styleScoped, options.parentComponentFrame)),
|
|
@@ -2276,18 +2374,20 @@
|
|
|
2276
2374
|
const appendToValue = valueToAppend => {
|
|
2277
2375
|
value = (null == value ? "" : value + "\n") + valueToAppend;
|
|
2278
2376
|
};
|
|
2377
|
+
const getQrlString = qrl => (qrl.$symbol$.startsWith("_") || !qrl.$captureRef$ && !qrl.$capture$ || (qrl = createQRL(null, "_run", queueQRL, null, null, [ qrl ])),
|
|
2378
|
+
qrlToString(serializationCtx, qrl));
|
|
2279
2379
|
if (Array.isArray(qrls)) {
|
|
2280
2380
|
for (let i = 0; i <= qrls.length; i++) {
|
|
2281
2381
|
const qrl = qrls[i];
|
|
2282
|
-
if (isQrl(qrl)) {
|
|
2283
|
-
appendToValue(
|
|
2382
|
+
if (isQrl$1(qrl)) {
|
|
2383
|
+
appendToValue(getQrlString(qrl)), addQwikEventToSerializationContext(serializationCtx, key, qrl);
|
|
2284
2384
|
} else if (null != qrl) {
|
|
2285
2385
|
const nestedValue = setEvent(serializationCtx, key, qrl);
|
|
2286
2386
|
nestedValue && appendToValue(nestedValue);
|
|
2287
2387
|
}
|
|
2288
2388
|
}
|
|
2289
2389
|
} else {
|
|
2290
|
-
isQrl(qrls) && (value =
|
|
2390
|
+
isQrl$1(qrls) && (value = getQrlString(qrls), addQwikEventToSerializationContext(serializationCtx, key, qrls));
|
|
2291
2391
|
}
|
|
2292
2392
|
return value;
|
|
2293
2393
|
}
|
|
@@ -2299,7 +2399,7 @@
|
|
|
2299
2399
|
const eventName = key.substring(15);
|
|
2300
2400
|
eventName && serializationCtx.$eventNames$.add(eventName);
|
|
2301
2401
|
}
|
|
2302
|
-
const version = "2.0.0-alpha.
|
|
2402
|
+
const version = "2.0.0-alpha.7-dev+a26598a";
|
|
2303
2403
|
class _SharedContainer {
|
|
2304
2404
|
$version$;
|
|
2305
2405
|
$scheduler$;
|
|
@@ -2322,9 +2422,6 @@
|
|
|
2322
2422
|
return createSerializationContext(NodeConstructor, DomRefConstructor, symbolToChunkResolver, this.getHostProp.bind(this), this.setHostProp.bind(this), this.$storeProxyMap$, writer, prepVNodeData);
|
|
2323
2423
|
}
|
|
2324
2424
|
}
|
|
2325
|
-
const _CONST_PROPS = Symbol("CONST");
|
|
2326
|
-
const _VAR_PROPS = Symbol("VAR");
|
|
2327
|
-
const _IMMUTABLE = Symbol("IMMUTABLE");
|
|
2328
2425
|
const getValueProp = p0 => p0.value;
|
|
2329
2426
|
const getProp = (p0, p1) => p0[p1];
|
|
2330
2427
|
const getWrapped = args => new WrappedSignal(null, 1 === args.length ? getValueProp : getProp, args, null);
|
|
@@ -2529,7 +2626,7 @@
|
|
|
2529
2626
|
return String(value);
|
|
2530
2627
|
};
|
|
2531
2628
|
const VNodeDataSeparator_REFERENCE = 126, VNodeDataSeparator_ADVANCE_1 = 33, VNodeDataSeparator_ADVANCE_8192 = 46;
|
|
2532
|
-
const VNodeDataChar_OPEN = 123, VNodeDataChar_CLOSE = 125, VNodeDataChar_SCOPED_STYLE = 59, VNodeDataChar_RENDER_FN = 60, VNodeDataChar_ID = 61, VNodeDataChar_PROPS = 62, VNodeDataChar_SLOT_REF = 63, VNodeDataChar_KEY = 64, VNodeDataChar_SEQ = 91, VNodeDataChar_CONTEXT = 93, VNodeDataChar_SEQ_IDX = 94,
|
|
2629
|
+
const VNodeDataChar_OPEN = 123, VNodeDataChar_CLOSE = 125, VNodeDataChar_SCOPED_STYLE = 59, VNodeDataChar_RENDER_FN = 60, VNodeDataChar_ID = 61, VNodeDataChar_PROPS = 62, VNodeDataChar_SLOT_REF = 63, VNodeDataChar_KEY = 64, VNodeDataChar_SEQ = 91, VNodeDataChar_CONTEXT = 93, VNodeDataChar_SEQ_IDX = 94, VNodeDataChar_BACK_REFS = 96, VNodeDataChar_SEPARATOR = 124, VNodeDataChar_SLOT = 126;
|
|
2533
2630
|
var VNodeJournalOpCode;
|
|
2534
2631
|
!function(VNodeJournalOpCode) {
|
|
2535
2632
|
VNodeJournalOpCode[VNodeJournalOpCode.SetText = 1] = "SetText", VNodeJournalOpCode[VNodeJournalOpCode.SetAttribute = 2] = "SetAttribute",
|
|
@@ -2608,6 +2705,7 @@
|
|
|
2608
2705
|
elementVNode[VNodeProps.flags] ^= VNodeFlags.Inflated;
|
|
2609
2706
|
const element = elementVNode[ElementVNodeProps.element];
|
|
2610
2707
|
const attributes = element.attributes;
|
|
2708
|
+
const props = vnode_getProps(elementVNode);
|
|
2611
2709
|
for (let idx = 0; idx < attributes.length; idx++) {
|
|
2612
2710
|
const attr = attributes[idx];
|
|
2613
2711
|
const key = attr.name;
|
|
@@ -2615,9 +2713,9 @@
|
|
|
2615
2713
|
break;
|
|
2616
2714
|
}
|
|
2617
2715
|
if (key.startsWith("q:container")) {
|
|
2618
|
-
attr.value === QContainerValue.HTML ? mapArray_set(
|
|
2716
|
+
attr.value === QContainerValue.HTML ? mapArray_set(props, "dangerouslySetInnerHTML", element.innerHTML, 0) : attr.value === QContainerValue.TEXT && "value" in element && mapArray_set(props, "value", element.value, 0);
|
|
2619
2717
|
} else if (!key.startsWith("on:")) {
|
|
2620
|
-
mapArray_set(
|
|
2718
|
+
mapArray_set(props, key, attr.value, 0);
|
|
2621
2719
|
}
|
|
2622
2720
|
}
|
|
2623
2721
|
}
|
|
@@ -2868,30 +2966,9 @@
|
|
|
2868
2966
|
}
|
|
2869
2967
|
journal.length = 0;
|
|
2870
2968
|
};
|
|
2871
|
-
const mapApp_findIndx = (elementVNode, key, start) => {
|
|
2872
|
-
assertTrue();
|
|
2873
|
-
let bottom = start >> 1;
|
|
2874
|
-
let top = elementVNode.length - 2 >> 1;
|
|
2875
|
-
for (;bottom <= top; ) {
|
|
2876
|
-
const mid = bottom + (top - bottom >> 1);
|
|
2877
|
-
const midKey = elementVNode[mid << 1];
|
|
2878
|
-
if (midKey === key) {
|
|
2879
|
-
return mid << 1;
|
|
2880
|
-
}
|
|
2881
|
-
midKey < key ? bottom = mid + 1 : top = mid - 1;
|
|
2882
|
-
}
|
|
2883
|
-
return ~(bottom << 1);
|
|
2884
|
-
};
|
|
2885
|
-
const mapArray_set = (elementVNode, key, value, start) => {
|
|
2886
|
-
const indx = mapApp_findIndx(elementVNode, key, start);
|
|
2887
|
-
indx >= 0 ? null == value ? elementVNode.splice(indx, 2) : elementVNode[indx + 1] = value : null != value && elementVNode.splice(~indx, 0, key, value);
|
|
2888
|
-
};
|
|
2889
|
-
const mapArray_get = (elementVNode, key, start) => {
|
|
2890
|
-
const indx = mapApp_findIndx(elementVNode, key, start);
|
|
2891
|
-
return indx >= 0 ? elementVNode[indx + 1] : null;
|
|
2892
|
-
};
|
|
2893
2969
|
const vnode_insertBefore = (journal, parent, newChild, insertBefore) => {
|
|
2894
|
-
ensureElementOrVirtualVNode(parent), vnode_isElementVNode(parent) && ensureMaterialized(parent)
|
|
2970
|
+
ensureElementOrVirtualVNode(parent), vnode_isElementVNode(parent) && ensureMaterialized(parent),
|
|
2971
|
+
newChild === insertBefore && (insertBefore = null);
|
|
2895
2972
|
let adjustedInsertBefore = null;
|
|
2896
2973
|
null == insertBefore ? vnode_isVirtualVNode(parent) && (adjustedInsertBefore = vnode_getDomSibling(parent, !0, !1)) : adjustedInsertBefore = vnode_isVirtualVNode(insertBefore) ? vnode_getDomSibling(insertBefore, !0, !0) : insertBefore,
|
|
2897
2974
|
adjustedInsertBefore && ((journal, vNode) => {
|
|
@@ -2969,9 +3046,23 @@
|
|
|
2969
3046
|
const vnode_getElementName = vnode => {
|
|
2970
3047
|
const elementVNode = ensureElementVNode(vnode);
|
|
2971
3048
|
let elementName = elementVNode[ElementVNodeProps.elementName];
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
3049
|
+
if (void 0 === elementName) {
|
|
3050
|
+
const element = elementVNode[ElementVNodeProps.element];
|
|
3051
|
+
const nodeName = build.isDev ? fastNodeName(element).toLowerCase() : fastNodeName(element);
|
|
3052
|
+
elementName = elementVNode[ElementVNodeProps.elementName] = nodeName, elementVNode[VNodeProps.flags] |= (element => {
|
|
3053
|
+
switch (fastNamespaceURI(element)) {
|
|
3054
|
+
case SVG_NS:
|
|
3055
|
+
return VNodeFlags.NS_svg;
|
|
3056
|
+
|
|
3057
|
+
case MATH_NS:
|
|
3058
|
+
return VNodeFlags.NS_math;
|
|
3059
|
+
|
|
3060
|
+
default:
|
|
3061
|
+
return VNodeFlags.NS_html;
|
|
3062
|
+
}
|
|
3063
|
+
})(element);
|
|
3064
|
+
}
|
|
3065
|
+
return elementName;
|
|
2975
3066
|
};
|
|
2976
3067
|
const vnode_getText = vnode => {
|
|
2977
3068
|
const textVNode = ensureTextVNode(vnode);
|
|
@@ -3055,8 +3146,8 @@
|
|
|
3055
3146
|
vnode_setAttr(null, vParent, "q:seq", consumeValue());
|
|
3056
3147
|
} else if (peek() === VNodeDataChar_SEQ_IDX) {
|
|
3057
3148
|
vnode_setAttr(null, vParent, "q:seqIdx", consumeValue());
|
|
3058
|
-
} else if (peek() ===
|
|
3059
|
-
|
|
3149
|
+
} else if (peek() === VNodeDataChar_BACK_REFS) {
|
|
3150
|
+
container || (container = getDomContainer(element)), setEffectBackRefFromVNodeData(vParent, consumeValue(), container);
|
|
3060
3151
|
} else if (peek() === VNodeDataChar_CONTEXT) {
|
|
3061
3152
|
vnode_setAttr(null, vParent, "q:ctx", consumeValue());
|
|
3062
3153
|
} else if (peek() === VNodeDataChar_OPEN) {
|
|
@@ -3160,6 +3251,12 @@
|
|
|
3160
3251
|
}
|
|
3161
3252
|
return node;
|
|
3162
3253
|
};
|
|
3254
|
+
let _fastNamespaceURI = null;
|
|
3255
|
+
const fastNamespaceURI = element => (_fastNamespaceURI || (_fastNamespaceURI = fastGetter(element, "namespaceURI")),
|
|
3256
|
+
_fastNamespaceURI.call(element));
|
|
3257
|
+
let _fastNodeName = null;
|
|
3258
|
+
const fastNodeName = element => (_fastNodeName || (_fastNodeName = fastGetter(element, "nodeName")),
|
|
3259
|
+
_fastNodeName.call(element));
|
|
3163
3260
|
const fastGetter = (prototype, name) => {
|
|
3164
3261
|
let getter;
|
|
3165
3262
|
for (;prototype && !(getter = Object.getOwnPropertyDescriptor(prototype, name)?.get); ) {
|
|
@@ -3197,12 +3294,27 @@
|
|
|
3197
3294
|
const id = consumeValue();
|
|
3198
3295
|
container.$setRawState$(parseInt(id), vParent), build.isDev && vnode_setAttr(null, vParent, "q:id", id);
|
|
3199
3296
|
} else {
|
|
3200
|
-
peek() ===
|
|
3297
|
+
peek() === VNodeDataChar_BACK_REFS ? (container || (container = getDomContainer(vParent[ElementVNodeProps.element])),
|
|
3298
|
+
setEffectBackRefFromVNodeData(vParent, consumeValue(), container)) : consumeValue();
|
|
3201
3299
|
}
|
|
3202
3300
|
}));
|
|
3203
3301
|
}
|
|
3204
3302
|
return vFirstChild;
|
|
3205
3303
|
};
|
|
3304
|
+
function setEffectBackRefFromVNodeData(vParent, value, container) {
|
|
3305
|
+
const deserializedSubMap = container.$getObjectById$(value);
|
|
3306
|
+
if (vParent[_EFFECT_BACK_REF]) {
|
|
3307
|
+
((map1, map2) => {
|
|
3308
|
+
for (const [k, v] of map2) {
|
|
3309
|
+
map1.set(k, v);
|
|
3310
|
+
}
|
|
3311
|
+
})(vParent[_EFFECT_BACK_REF], deserializedSubMap);
|
|
3312
|
+
} else {
|
|
3313
|
+
Object.defineProperty(vParent, _EFFECT_BACK_REF, {
|
|
3314
|
+
value: deserializedSubMap
|
|
3315
|
+
});
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3206
3318
|
const processVNodeData$1 = (vData, callback) => {
|
|
3207
3319
|
let nextToConsumeIdx = 0;
|
|
3208
3320
|
let ch = 0;
|
|
@@ -3222,12 +3334,14 @@
|
|
|
3222
3334
|
}
|
|
3223
3335
|
};
|
|
3224
3336
|
const vnode_getNextSibling = vnode => vnode[VNodeProps.nextSibling];
|
|
3337
|
+
const vnode_getPreviousSibling = vnode => vnode[VNodeProps.previousSibling];
|
|
3225
3338
|
const vnode_getAttrKeys = vnode => {
|
|
3226
3339
|
if (vnode[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK) {
|
|
3227
3340
|
vnode_ensureElementInflated(vnode);
|
|
3228
3341
|
const keys = [];
|
|
3229
|
-
|
|
3230
|
-
|
|
3342
|
+
const props = vnode_getProps(vnode);
|
|
3343
|
+
for (let i = 0; i < props.length; i += 2) {
|
|
3344
|
+
const key = props[i];
|
|
3231
3345
|
key.startsWith(":") || keys.push(key);
|
|
3232
3346
|
}
|
|
3233
3347
|
return keys;
|
|
@@ -3238,27 +3352,35 @@
|
|
|
3238
3352
|
const type = vnode[VNodeProps.flags];
|
|
3239
3353
|
if (type & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK) {
|
|
3240
3354
|
vnode_ensureElementInflated(vnode);
|
|
3241
|
-
const
|
|
3355
|
+
const props = vnode_getProps(vnode);
|
|
3356
|
+
const idx = mapApp_findIndx(props, key, 0);
|
|
3242
3357
|
if (idx >= 0) {
|
|
3243
|
-
if (
|
|
3358
|
+
if (props[idx + 1] != value && type & VNodeFlags.Element) {
|
|
3244
3359
|
journal && journal.push(VNodeJournalOpCode.SetAttribute, vnode[ElementVNodeProps.element], key, value);
|
|
3245
3360
|
}
|
|
3246
|
-
null == value ?
|
|
3247
|
-
} else if (null != value && (
|
|
3361
|
+
null == value ? props.splice(idx, 2) : props[idx + 1] = value;
|
|
3362
|
+
} else if (null != value && (props.splice(~idx, 0, key, value), type & VNodeFlags.Element)) {
|
|
3248
3363
|
journal && journal.push(VNodeJournalOpCode.SetAttribute, vnode[ElementVNodeProps.element], key, value);
|
|
3249
3364
|
}
|
|
3250
3365
|
}
|
|
3251
3366
|
};
|
|
3252
|
-
const vnode_getAttr = (vnode, key) =>
|
|
3253
|
-
|
|
3367
|
+
const vnode_getAttr = (vnode, key) => {
|
|
3368
|
+
if (vnode[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK) {
|
|
3369
|
+
vnode_ensureElementInflated(vnode);
|
|
3370
|
+
const props = vnode_getProps(vnode);
|
|
3371
|
+
return mapArray_get(props, key, 0);
|
|
3372
|
+
}
|
|
3373
|
+
return null;
|
|
3374
|
+
};
|
|
3254
3375
|
const vnode_getProp = (vnode, key, getObject) => {
|
|
3255
3376
|
const type = vnode[VNodeProps.flags];
|
|
3256
3377
|
if (type & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK) {
|
|
3257
3378
|
type & VNodeFlags.Element && vnode_ensureElementInflated(vnode);
|
|
3258
|
-
const
|
|
3379
|
+
const props = vnode_getProps(vnode);
|
|
3380
|
+
const idx = mapApp_findIndx(props, key, 0);
|
|
3259
3381
|
if (idx >= 0) {
|
|
3260
|
-
let value =
|
|
3261
|
-
return "string" == typeof value && getObject && (
|
|
3382
|
+
let value = props[idx + 1];
|
|
3383
|
+
return "string" == typeof value && getObject && (props[idx + 1] = value = getObject(value)),
|
|
3262
3384
|
value;
|
|
3263
3385
|
}
|
|
3264
3386
|
}
|
|
@@ -3266,10 +3388,11 @@
|
|
|
3266
3388
|
};
|
|
3267
3389
|
const vnode_setProp = (vnode, key, value) => {
|
|
3268
3390
|
ensureElementOrVirtualVNode(vnode);
|
|
3269
|
-
const
|
|
3270
|
-
|
|
3391
|
+
const props = vnode_getProps(vnode);
|
|
3392
|
+
const idx = mapApp_findIndx(props, key, 0);
|
|
3393
|
+
idx >= 0 ? props[idx + 1] = value : null != value && props.splice(~idx, 0, key, value);
|
|
3271
3394
|
};
|
|
3272
|
-
const
|
|
3395
|
+
const vnode_getProps = vnode => vnode[(vnode => {
|
|
3273
3396
|
const type = vnode[VNodeProps.flags] & VNodeFlags.TYPE_MASK;
|
|
3274
3397
|
if (type === VNodeFlags.Element) {
|
|
3275
3398
|
return ElementVNodeProps.PROPS_OFFSET;
|
|
@@ -3278,7 +3401,7 @@
|
|
|
3278
3401
|
return VirtualVNodeProps.PROPS_OFFSET;
|
|
3279
3402
|
}
|
|
3280
3403
|
throw qError(QError.invalidVNodeType, [ type ]);
|
|
3281
|
-
};
|
|
3404
|
+
})(vnode)];
|
|
3282
3405
|
const vnode_getParent = vnode => vnode[VNodeProps.parent] || null;
|
|
3283
3406
|
const vnode_getNode = vnode => null === vnode || vnode_isVirtualVNode(vnode) ? null : vnode_isElementVNode(vnode) ? vnode[ElementVNodeProps.element] : (assertTrue(vnode_isTextVNode(vnode)),
|
|
3284
3407
|
vnode[TextVNodeProps.node]);
|
|
@@ -3357,40 +3480,6 @@
|
|
|
3357
3480
|
throw qError(QError.invalidVNodeType, [ type ]);
|
|
3358
3481
|
};
|
|
3359
3482
|
const isElement = node => node && "object" == typeof node && 1 === fastNodeType(node);
|
|
3360
|
-
const aPath = [];
|
|
3361
|
-
const bPath = [];
|
|
3362
|
-
const vnode_documentPosition = (a, b, rootVNode) => {
|
|
3363
|
-
if (a === b) {
|
|
3364
|
-
return 0;
|
|
3365
|
-
}
|
|
3366
|
-
let aDepth = -1;
|
|
3367
|
-
let bDepth = -1;
|
|
3368
|
-
for (;a; ) {
|
|
3369
|
-
a = (aPath[++aDepth] = a)[VNodeProps.parent] || rootVNode && vnode_getProp(a, ":", (id => vnode_locate(rootVNode, id)));
|
|
3370
|
-
}
|
|
3371
|
-
for (;b; ) {
|
|
3372
|
-
b = (bPath[++bDepth] = b)[VNodeProps.parent] || rootVNode && vnode_getProp(b, ":", (id => vnode_locate(rootVNode, id)));
|
|
3373
|
-
}
|
|
3374
|
-
for (;aDepth >= 0 && bDepth >= 0; ) {
|
|
3375
|
-
if ((a = aPath[aDepth]) !== (b = bPath[bDepth])) {
|
|
3376
|
-
let cursor = b;
|
|
3377
|
-
do {
|
|
3378
|
-
if (cursor = vnode_getNextSibling(cursor), cursor === a) {
|
|
3379
|
-
return 1;
|
|
3380
|
-
}
|
|
3381
|
-
} while (cursor);
|
|
3382
|
-
cursor = b;
|
|
3383
|
-
do {
|
|
3384
|
-
if (cursor = cursor[VNodeProps.previousSibling], cursor === a) {
|
|
3385
|
-
return -1;
|
|
3386
|
-
}
|
|
3387
|
-
} while (cursor);
|
|
3388
|
-
return rootVNode && vnode_getProp(b, ":", (id => vnode_locate(rootVNode, id))) ? -1 : 1;
|
|
3389
|
-
}
|
|
3390
|
-
aDepth--, bDepth--;
|
|
3391
|
-
}
|
|
3392
|
-
return aDepth < bDepth ? -1 : 1;
|
|
3393
|
-
};
|
|
3394
3483
|
const vnode_getProjectionParentComponent = (vHost, rootVNode) => {
|
|
3395
3484
|
let projectionDepth = 1;
|
|
3396
3485
|
for (;projectionDepth--; ) {
|
|
@@ -3405,19 +3494,16 @@
|
|
|
3405
3494
|
};
|
|
3406
3495
|
const VNodeArray = class VNode extends Array {
|
|
3407
3496
|
static createElement(flags, parent, previousSibling, nextSibling, firstChild, lastChild, element, elementName) {
|
|
3408
|
-
|
|
3409
|
-
return vnode.push(firstChild, lastChild, element, elementName), vnode;
|
|
3497
|
+
return new VNode(flags, parent, previousSibling, nextSibling, firstChild, lastChild, element, elementName, []);
|
|
3410
3498
|
}
|
|
3411
3499
|
static createText(flags, parent, previousSibling, nextSibling, textNode, text) {
|
|
3412
|
-
|
|
3413
|
-
return vnode.push(textNode, text), vnode;
|
|
3500
|
+
return new VNode(flags, parent, previousSibling, nextSibling, textNode, text);
|
|
3414
3501
|
}
|
|
3415
3502
|
static createVirtual(flags, parent, previousSibling, nextSibling, firstChild, lastChild) {
|
|
3416
|
-
|
|
3417
|
-
return vnode.push(firstChild, lastChild), vnode;
|
|
3503
|
+
return new VNode(flags, parent, previousSibling, nextSibling, firstChild, lastChild, []);
|
|
3418
3504
|
}
|
|
3419
|
-
constructor(flags, parent, previousSibling, nextSibling) {
|
|
3420
|
-
super(
|
|
3505
|
+
constructor(flags, parent, previousSibling, nextSibling, ...rest) {
|
|
3506
|
+
super(flags, parent, previousSibling, nextSibling, ...rest), build.isDev && (this.toString = vnode_toString);
|
|
3421
3507
|
}
|
|
3422
3508
|
};
|
|
3423
3509
|
let _context;
|
|
@@ -3468,11 +3554,13 @@
|
|
|
3468
3554
|
return returnValue;
|
|
3469
3555
|
}
|
|
3470
3556
|
const newInvokeContextFromTuple = ([element, event, url]) => {
|
|
3471
|
-
const
|
|
3557
|
+
const domContainer = getDomContainer(element);
|
|
3558
|
+
const container = domContainer.element;
|
|
3559
|
+
const vNode = container ? vnode_locate(domContainer.rootVNode, element) : void 0;
|
|
3472
3560
|
const locale = container?.getAttribute("q:locale") || void 0;
|
|
3473
3561
|
return locale && function(locale) {
|
|
3474
3562
|
_locale = locale;
|
|
3475
|
-
}(locale), newInvokeContext(locale,
|
|
3563
|
+
}(locale), newInvokeContext(locale, vNode, element, event, url);
|
|
3476
3564
|
};
|
|
3477
3565
|
const newInvokeContext = (locale, hostElement, element, event, url) => {
|
|
3478
3566
|
const ctx = {
|
|
@@ -3494,7 +3582,7 @@
|
|
|
3494
3582
|
const previousSubscriber = trackInvocation.$effectSubscriber$;
|
|
3495
3583
|
const previousContainer = trackInvocation.$container$;
|
|
3496
3584
|
try {
|
|
3497
|
-
return trackInvocation.$effectSubscriber$ =
|
|
3585
|
+
return trackInvocation.$effectSubscriber$ = getSubscriber(subscriber, property, data),
|
|
3498
3586
|
trackInvocation.$container$ = container, invoke(trackInvocation, fn);
|
|
3499
3587
|
} finally {
|
|
3500
3588
|
trackInvocation.$effectSubscriber$ = previousSubscriber, trackInvocation.$container$ = previousContainer;
|
|
@@ -3556,9 +3644,9 @@
|
|
|
3556
3644
|
$storeProxyMap$=new WeakMap;
|
|
3557
3645
|
$qFuncs$;
|
|
3558
3646
|
$instanceHash$;
|
|
3559
|
-
|
|
3647
|
+
vNodeLocate=id => vnode_locate(this.rootVNode, id);
|
|
3648
|
+
$stateData$;
|
|
3560
3649
|
$styleIds$=null;
|
|
3561
|
-
$vnodeLocate$=id => vnode_locate(this.rootVNode, id);
|
|
3562
3650
|
$renderCount$=0;
|
|
3563
3651
|
constructor(element) {
|
|
3564
3652
|
if (super((() => this.scheduleRender()), (() => vnode_applyJournal(this.$journal$)), {}, element.getAttribute("q:locale")),
|
|
@@ -3568,7 +3656,7 @@
|
|
|
3568
3656
|
this.$journal$ = [ VNodeJournalOpCode.HoistStyles, element.ownerDocument ], this.document = element.ownerDocument,
|
|
3569
3657
|
this.element = element, this.qBase = element.getAttribute("q:base"), this.$instanceHash$ = element.getAttribute("q:instance"),
|
|
3570
3658
|
this.qManifestHash = element.getAttribute("q:manifest-hash"), this.rootVNode = vnode_newUnMaterializedElement(this.element),
|
|
3571
|
-
this.$rawStateData$ = null, this
|
|
3659
|
+
this.$rawStateData$ = null, this.$stateData$ = null;
|
|
3572
3660
|
const document = this.element.ownerDocument;
|
|
3573
3661
|
document.qVNodeData || function(document) {
|
|
3574
3662
|
const vNodeDataMap = document.qVNodeData || (document.qVNodeData = new WeakMap);
|
|
@@ -3726,22 +3814,22 @@
|
|
|
3726
3814
|
};
|
|
3727
3815
|
const walker = document.createTreeWalker(document, 129);
|
|
3728
3816
|
walkContainer(walker, null, walker.firstChild(), null, "", null);
|
|
3729
|
-
}(document), this.$rawStateData$ = [], this
|
|
3817
|
+
}(document), this.$rawStateData$ = [], this.$stateData$ = [];
|
|
3730
3818
|
const qwikStates = element.querySelectorAll('script[type="qwik/state"]');
|
|
3731
3819
|
if (0 !== qwikStates.length) {
|
|
3732
3820
|
this.$rawStateData$ = JSON.parse(qwikStates[qwikStates.length - 1].textContent),
|
|
3733
|
-
this
|
|
3821
|
+
this.$stateData$ = wrapDeserializerProxy(this, this.$rawStateData$);
|
|
3734
3822
|
}
|
|
3735
3823
|
this.$qFuncs$ = getQFuncs(document, this.$instanceHash$) || EMPTY_ARRAY;
|
|
3736
3824
|
}
|
|
3737
3825
|
$setRawState$(id, vParent) {
|
|
3738
|
-
this
|
|
3826
|
+
this.$stateData$[id] = vParent;
|
|
3739
3827
|
}
|
|
3740
3828
|
parseQRL(qrl) {
|
|
3741
3829
|
return inflateQRL(this, parseQRL(qrl));
|
|
3742
3830
|
}
|
|
3743
3831
|
handleError(err, host) {
|
|
3744
|
-
const errorStore = this.resolveContext(host, ERROR_CONTEXT);
|
|
3832
|
+
const errorStore = host && this.resolveContext(host, ERROR_CONTEXT);
|
|
3745
3833
|
if (!errorStore) {
|
|
3746
3834
|
throw err;
|
|
3747
3835
|
}
|
|
@@ -3770,7 +3858,7 @@
|
|
|
3770
3858
|
if (null !== vnode_getProp(vNode, "q:renderFn", null)) {
|
|
3771
3859
|
return vNode;
|
|
3772
3860
|
}
|
|
3773
|
-
vNode = vnode_getParent(vNode) || vnode_getProp(vNode, ":", this
|
|
3861
|
+
vNode = vnode_getParent(vNode) || vnode_getProp(vNode, ":", this.vNodeLocate);
|
|
3774
3862
|
} else {
|
|
3775
3863
|
vNode = vnode_getParent(vNode);
|
|
3776
3864
|
}
|
|
@@ -3788,7 +3876,7 @@
|
|
|
3788
3876
|
case "q:props":
|
|
3789
3877
|
case "q:renderFn":
|
|
3790
3878
|
case "q:ctx":
|
|
3791
|
-
case "q:
|
|
3879
|
+
case "q:brefs":
|
|
3792
3880
|
getObjectById = this.$getObjectById$;
|
|
3793
3881
|
break;
|
|
3794
3882
|
|
|
@@ -3800,7 +3888,10 @@
|
|
|
3800
3888
|
}
|
|
3801
3889
|
scheduleRender() {
|
|
3802
3890
|
return this.$renderCount$++, this.renderDone ||= getPlatform().nextTick((() => this.processChores())),
|
|
3803
|
-
this.renderDone
|
|
3891
|
+
this.renderDone.finally((() => emitEvent("qrender", {
|
|
3892
|
+
instanceHash: this.$instanceHash$,
|
|
3893
|
+
renderCount: this.$renderCount$
|
|
3894
|
+
})));
|
|
3804
3895
|
}
|
|
3805
3896
|
processChores() {
|
|
3806
3897
|
let renderCount = this.$renderCount$;
|
|
@@ -3818,16 +3909,17 @@
|
|
|
3818
3909
|
ensureProjectionResolved(vNode) {
|
|
3819
3910
|
if (!(vNode[VNodeProps.flags] & VNodeFlags.Resolved)) {
|
|
3820
3911
|
vNode[VNodeProps.flags] |= VNodeFlags.Resolved;
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3912
|
+
const props = vnode_getProps(vNode);
|
|
3913
|
+
for (let i = 0; i < props.length; i += 2) {
|
|
3914
|
+
if (isSlotProp(props[i])) {
|
|
3915
|
+
const value = props[i + 1];
|
|
3916
|
+
"string" == typeof value && (props[i + 1] = this.vNodeLocate(value));
|
|
3825
3917
|
}
|
|
3826
3918
|
}
|
|
3827
3919
|
}
|
|
3828
3920
|
}
|
|
3829
3921
|
$getObjectById$=id => ("string" == typeof id && (id = parseFloat(id)), assertTrue(),
|
|
3830
|
-
this
|
|
3922
|
+
this.$stateData$[id]);
|
|
3831
3923
|
getSyncFn(id) {
|
|
3832
3924
|
const fn = this.$qFuncs$[id];
|
|
3833
3925
|
return assertTrue(), fn;
|
|
@@ -3953,7 +4045,7 @@
|
|
|
3953
4045
|
const task = target;
|
|
3954
4046
|
const v = data;
|
|
3955
4047
|
task.$qrl$ = inflateQRL(container, v[0]), task.$flags$ = v[1], task.$index$ = v[2],
|
|
3956
|
-
task.$el$ = v[3], task
|
|
4048
|
+
task.$el$ = v[3], task[_EFFECT_BACK_REF] = v[4], task.$state$ = v[5];
|
|
3957
4049
|
break;
|
|
3958
4050
|
|
|
3959
4051
|
case TypeIds.Resource:
|
|
@@ -3971,11 +4063,9 @@
|
|
|
3971
4063
|
case TypeIds.Store:
|
|
3972
4064
|
case TypeIds.StoreArray:
|
|
3973
4065
|
{
|
|
3974
|
-
const [value, flags, effects
|
|
4066
|
+
const [value, flags, effects] = data;
|
|
3975
4067
|
const store = getOrCreateStore(value, flags, container);
|
|
3976
|
-
|
|
3977
|
-
storeEffect && (effects[STORE_ARRAY_PROP] = storeEffect), storeHandler.$effects$ = effects,
|
|
3978
|
-
target = store;
|
|
4068
|
+
getStoreHandler(store).$effects$ = effects, target = store;
|
|
3979
4069
|
break;
|
|
3980
4070
|
}
|
|
3981
4071
|
|
|
@@ -3983,7 +4073,7 @@
|
|
|
3983
4073
|
{
|
|
3984
4074
|
const signal = target;
|
|
3985
4075
|
const d = data;
|
|
3986
|
-
signal.$untrackedValue$ = d[0], signal.$effects$ = d.slice(1);
|
|
4076
|
+
signal.$untrackedValue$ = d[0], signal.$effects$ = new Set(d.slice(1));
|
|
3987
4077
|
break;
|
|
3988
4078
|
}
|
|
3989
4079
|
|
|
@@ -3991,8 +4081,8 @@
|
|
|
3991
4081
|
{
|
|
3992
4082
|
const signal = target;
|
|
3993
4083
|
const d = data;
|
|
3994
|
-
signal.$func$ = container.getSyncFn(d[0]), signal.$args$ = d[1], signal
|
|
3995
|
-
signal.$untrackedValue$ = d[3], signal.$hostElement$ = d[4], signal.$effects$ = d.slice(5);
|
|
4084
|
+
signal.$func$ = container.getSyncFn(d[0]), signal.$args$ = d[1], signal[_EFFECT_BACK_REF] = d[2],
|
|
4085
|
+
signal.$untrackedValue$ = d[3], signal.$hostElement$ = d[4], signal.$effects$ = new Set(d.slice(5));
|
|
3996
4086
|
break;
|
|
3997
4087
|
}
|
|
3998
4088
|
|
|
@@ -4095,7 +4185,7 @@
|
|
|
4095
4185
|
}
|
|
4096
4186
|
return target;
|
|
4097
4187
|
};
|
|
4098
|
-
const _constants = [ void 0, null, !0, !1, "", EMPTY_ARRAY, EMPTY_OBJ, NEEDS_COMPUTATION, Slot, Fragment, NaN, 1 / 0, -1 / 0, Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER - 1, Number.MIN_SAFE_INTEGER ];
|
|
4188
|
+
const _constants = [ void 0, null, !0, !1, "", EMPTY_ARRAY, EMPTY_OBJ, NEEDS_COMPUTATION, STORE_ARRAY_PROP, Slot, Fragment, NaN, 1 / 0, -1 / 0, Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER - 1, Number.MIN_SAFE_INTEGER ];
|
|
4099
4189
|
const allocate = (container, typeId, value) => {
|
|
4100
4190
|
if (void 0 === value) {
|
|
4101
4191
|
return typeId;
|
|
@@ -4184,7 +4274,7 @@
|
|
|
4184
4274
|
const promise = new Promise(((res, rej) => {
|
|
4185
4275
|
resolve = res, reject = rej;
|
|
4186
4276
|
}));
|
|
4187
|
-
return resolvers.set(promise, [ resolve, reject ]), promise;
|
|
4277
|
+
return resolvers.set(promise, [ resolve, reject ]), promise.catch((() => {})), promise;
|
|
4188
4278
|
|
|
4189
4279
|
case TypeIds.Uint8Array:
|
|
4190
4280
|
const encodedLength = value.length;
|
|
@@ -4194,12 +4284,10 @@
|
|
|
4194
4284
|
case TypeIds.PropsProxy:
|
|
4195
4285
|
return createPropsProxy(null, null);
|
|
4196
4286
|
|
|
4197
|
-
case TypeIds.RefVNode:
|
|
4198
4287
|
case TypeIds.VNode:
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
}
|
|
4288
|
+
return retrieveVNodeOrDocument(container, value);
|
|
4289
|
+
|
|
4290
|
+
case TypeIds.RefVNode:
|
|
4203
4291
|
const vNode = retrieveVNodeOrDocument(container, value);
|
|
4204
4292
|
if (vnode_isVNode(vNode)) {
|
|
4205
4293
|
return vnode_getNode(vNode);
|
|
@@ -4207,7 +4295,7 @@
|
|
|
4207
4295
|
throw qError(QError.serializeErrorExpectedVNode, [ typeof vNode ]);
|
|
4208
4296
|
|
|
4209
4297
|
case TypeIds.EffectData:
|
|
4210
|
-
return new
|
|
4298
|
+
return new SubscriptionData({});
|
|
4211
4299
|
|
|
4212
4300
|
default:
|
|
4213
4301
|
throw qError(QError.serializeErrorCannotAllocate, [ typeId ]);
|
|
@@ -4228,7 +4316,7 @@
|
|
|
4228
4316
|
const backChannel = globalThis[QRL_RUNTIME_CHUNK];
|
|
4229
4317
|
assertDefined(), qrlRef = backChannel.get(symbol);
|
|
4230
4318
|
}
|
|
4231
|
-
return createQRL(chunk, symbol, qrlRef, null, captureIds, null
|
|
4319
|
+
return createQRL(chunk, symbol, qrlRef, null, captureIds, null);
|
|
4232
4320
|
}
|
|
4233
4321
|
function inflateQRL(container, qrl) {
|
|
4234
4322
|
const captureIds = qrl.$capture$;
|
|
@@ -4295,7 +4383,7 @@
|
|
|
4295
4383
|
output(TypeIds.Constant, Constants.Slot);
|
|
4296
4384
|
} else if (value === Fragment) {
|
|
4297
4385
|
output(TypeIds.Constant, Constants.Fragment);
|
|
4298
|
-
} else if (isQrl(value)) {
|
|
4386
|
+
} else if (isQrl$1(value)) {
|
|
4299
4387
|
const qrl = qrlToString(serializationContext, value);
|
|
4300
4388
|
const id = serializationContext.$addRoot$(qrl);
|
|
4301
4389
|
output(TypeIds.QRL, id);
|
|
@@ -4321,11 +4409,13 @@
|
|
|
4321
4409
|
}
|
|
4322
4410
|
} else if (void 0 === value) {
|
|
4323
4411
|
output(TypeIds.Constant, Constants.Undefined);
|
|
4412
|
+
} else if (value === NEEDS_COMPUTATION) {
|
|
4413
|
+
output(TypeIds.Constant, Constants.NEEDS_COMPUTATION);
|
|
4324
4414
|
} else {
|
|
4325
|
-
if (value !==
|
|
4415
|
+
if (value !== STORE_ARRAY_PROP) {
|
|
4326
4416
|
throw qError(QError.serializeErrorUnknownType, [ typeof value ]);
|
|
4327
4417
|
}
|
|
4328
|
-
output(TypeIds.Constant, Constants.
|
|
4418
|
+
output(TypeIds.Constant, Constants.STORE_ARRAY_PROP);
|
|
4329
4419
|
}
|
|
4330
4420
|
};
|
|
4331
4421
|
const writeObjectValue = (value, idx) => {
|
|
@@ -4341,7 +4431,7 @@
|
|
|
4341
4431
|
const constProps = value[_CONST_PROPS];
|
|
4342
4432
|
const out = constProps ? [ varProps, constProps ] : Object.keys(varProps).length ? [ varProps ] : 0;
|
|
4343
4433
|
output(TypeIds.PropsProxy, out);
|
|
4344
|
-
} else if (value instanceof
|
|
4434
|
+
} else if (value instanceof SubscriptionData) {
|
|
4345
4435
|
output(TypeIds.EffectData, [ value.data.$scopedStyleIdPrefix$, value.data.$isConst$ ]);
|
|
4346
4436
|
} else if (isStore(value)) {
|
|
4347
4437
|
if (function(value) {
|
|
@@ -4358,7 +4448,6 @@
|
|
|
4358
4448
|
const storeTarget = getStoreTarget(value);
|
|
4359
4449
|
const flags = storeHandler.$flags$;
|
|
4360
4450
|
const effects = storeHandler.$effects$;
|
|
4361
|
-
const storeEffect = effects?.[STORE_ARRAY_PROP] ?? null;
|
|
4362
4451
|
const innerStores = [];
|
|
4363
4452
|
for (const prop in storeTarget) {
|
|
4364
4453
|
const propValue = storeTarget[prop];
|
|
@@ -4367,7 +4456,7 @@
|
|
|
4367
4456
|
innerStores.push(innerStore), serializationContext.$addRoot$(innerStore);
|
|
4368
4457
|
}
|
|
4369
4458
|
}
|
|
4370
|
-
const out = [ storeTarget, flags, effects,
|
|
4459
|
+
const out = [ storeTarget, flags, effects, ...innerStores ];
|
|
4371
4460
|
for (;null == out[out.length - 1]; ) {
|
|
4372
4461
|
out.pop();
|
|
4373
4462
|
}
|
|
@@ -4388,7 +4477,7 @@
|
|
|
4388
4477
|
} else if (value instanceof Signal) {
|
|
4389
4478
|
const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
|
|
4390
4479
|
if (value instanceof WrappedSignal) {
|
|
4391
|
-
output(TypeIds.WrappedSignal, [ ...serializeWrappingFn(serializationContext, value), value
|
|
4480
|
+
output(TypeIds.WrappedSignal, [ ...serializeWrappingFn(serializationContext, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), v, value.$hostElement$, ...value.$effects$ || [] ]);
|
|
4392
4481
|
} else if (value instanceof ComputedSignal) {
|
|
4393
4482
|
const out = [ value.$computeQrl$, value.$effects$ ];
|
|
4394
4483
|
v !== NEEDS_COMPUTATION && out.push(v), output(TypeIds.ComputedSignal, out);
|
|
@@ -4436,7 +4525,7 @@
|
|
|
4436
4525
|
} else if (isJSXNode(value)) {
|
|
4437
4526
|
output(TypeIds.JSXNode, [ value.type, value.varProps, value.constProps, value.children, value.flags, value.key ]);
|
|
4438
4527
|
} else if (value instanceof Task) {
|
|
4439
|
-
const out = [ value.$qrl$, value.$flags$, value.$index$, value.$el$, value
|
|
4528
|
+
const out = [ value.$qrl$, value.$flags$, value.$index$, value.$el$, value[_EFFECT_BACK_REF], value.$state$ ];
|
|
4440
4529
|
for (;null == out[out.length - 1]; ) {
|
|
4441
4530
|
out.pop();
|
|
4442
4531
|
}
|
|
@@ -4447,18 +4536,18 @@
|
|
|
4447
4536
|
throw qError(QError.serializeErrorUnvisited, [ "promise" ]);
|
|
4448
4537
|
}
|
|
4449
4538
|
output(TypeIds.Promise, res);
|
|
4539
|
+
} else if (value instanceof Uint8Array) {
|
|
4540
|
+
let buf = "";
|
|
4541
|
+
for (const c of value) {
|
|
4542
|
+
buf += String.fromCharCode(c);
|
|
4543
|
+
}
|
|
4544
|
+
const out = btoa(buf).replace(/=+$/, "");
|
|
4545
|
+
output(TypeIds.Uint8Array, out);
|
|
4450
4546
|
} else {
|
|
4451
|
-
if (!(value
|
|
4547
|
+
if (!vnode_isVNode(value)) {
|
|
4452
4548
|
throw qError(QError.serializeErrorUnknownType, [ typeof value ]);
|
|
4453
4549
|
}
|
|
4454
|
-
|
|
4455
|
-
let buf = "";
|
|
4456
|
-
for (const c of value) {
|
|
4457
|
-
buf += String.fromCharCode(c);
|
|
4458
|
-
}
|
|
4459
|
-
const out = btoa(buf).replace(/=+$/, "");
|
|
4460
|
-
output(TypeIds.Uint8Array, out);
|
|
4461
|
-
}
|
|
4550
|
+
output(TypeIds.Constant, Constants.Undefined);
|
|
4462
4551
|
}
|
|
4463
4552
|
};
|
|
4464
4553
|
writeValue(serializationContext.$roots$, -1);
|
|
@@ -4506,18 +4595,18 @@
|
|
|
4506
4595
|
const promises = [];
|
|
4507
4596
|
const visit = obj => {
|
|
4508
4597
|
if ("function" == typeof obj) {
|
|
4509
|
-
if (isQrl(obj)) {
|
|
4598
|
+
if (isQrl$1(obj)) {
|
|
4510
4599
|
obj.$captureRef$ && discoveredValues.push(...obj.$captureRef$);
|
|
4511
4600
|
} else if (isQwikComponent(obj)) {
|
|
4512
4601
|
const [qrl] = obj[SERIALIZABLE_STATE];
|
|
4513
4602
|
discoveredValues.push(qrl);
|
|
4514
4603
|
}
|
|
4515
|
-
} else if ("object" != typeof obj || null === obj || obj instanceof URL || obj instanceof Date || obj instanceof RegExp || obj instanceof Uint8Array || obj instanceof URLSearchParams || "undefined" != typeof FormData && obj instanceof FormData || fastSkipSerialize(obj)) {} else if (obj instanceof Error) {
|
|
4604
|
+
} else if ("object" != typeof obj || null === obj || obj instanceof URL || obj instanceof Date || obj instanceof RegExp || obj instanceof Uint8Array || obj instanceof URLSearchParams || vnode_isVNode(obj) || "undefined" != typeof FormData && obj instanceof FormData || fastSkipSerialize(obj)) {} else if (obj instanceof Error) {
|
|
4516
4605
|
discoveredValues.push(...Object.values(obj));
|
|
4517
4606
|
} else if (isStore(obj)) {
|
|
4518
4607
|
const target = getStoreTarget(obj);
|
|
4519
4608
|
const effects = getStoreHandler(obj).$effects$;
|
|
4520
|
-
discoveredValues.push(target, effects
|
|
4609
|
+
discoveredValues.push(target, effects);
|
|
4521
4610
|
for (const prop in target) {
|
|
4522
4611
|
const propValue = target[prop];
|
|
4523
4612
|
storeProxyMap.has(propValue) && discoveredValues.push(prop, storeProxyMap.get(propValue));
|
|
@@ -4531,10 +4620,10 @@
|
|
|
4531
4620
|
} else if (obj instanceof Signal) {
|
|
4532
4621
|
const v = obj instanceof WrappedSignal ? obj.untrackedValue : obj instanceof ComputedSignal && (obj.$invalid$ || fastSkipSerialize(obj)) ? NEEDS_COMPUTATION : obj.$untrackedValue$;
|
|
4533
4622
|
v !== NEEDS_COMPUTATION && discoveredValues.push(v), obj.$effects$ && discoveredValues.push(...obj.$effects$),
|
|
4534
|
-
obj instanceof WrappedSignal ? (obj
|
|
4623
|
+
obj instanceof WrappedSignal ? (discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues),
|
|
4535
4624
|
obj.$args$ && discoveredValues.push(...obj.$args$), obj.$hostElement$ && discoveredValues.push(obj.$hostElement$)) : obj instanceof ComputedSignal && discoveredValues.push(obj.$computeQrl$);
|
|
4536
4625
|
} else if (obj instanceof Task) {
|
|
4537
|
-
discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state
|
|
4626
|
+
discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$), discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues);
|
|
4538
4627
|
} else if (isSsrNode(obj)) {
|
|
4539
4628
|
if (discoverValuesForVNodeData(obj.vnodeData, discoveredValues), obj.childrenVNodeData && obj.childrenVNodeData.length) {
|
|
4540
4629
|
for (const data of obj.childrenVNodeData) {
|
|
@@ -4547,7 +4636,7 @@
|
|
|
4547
4636
|
discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
|
|
4548
4637
|
} else if (Array.isArray(obj)) {
|
|
4549
4638
|
discoveredValues.push(...obj);
|
|
4550
|
-
} else if (isQrl(obj)) {
|
|
4639
|
+
} else if (isQrl$1(obj)) {
|
|
4551
4640
|
obj.$captureRef$ && obj.$captureRef$.length && discoveredValues.push(...obj.$captureRef$);
|
|
4552
4641
|
} else if (isPropsProxy(obj)) {
|
|
4553
4642
|
discoveredValues.push(obj[_VAR_PROPS], obj[_CONST_PROPS]);
|
|
@@ -4557,7 +4646,7 @@
|
|
|
4557
4646
|
}), (error => {
|
|
4558
4647
|
promiseResults.set(obj, [ !1, error ]), discoveredValues.push(error);
|
|
4559
4648
|
})), promises.push(obj);
|
|
4560
|
-
} else if (obj instanceof
|
|
4649
|
+
} else if (obj instanceof SubscriptionData) {
|
|
4561
4650
|
discoveredValues.push(obj.data);
|
|
4562
4651
|
} else {
|
|
4563
4652
|
if (!isObjectLiteral(obj)) {
|
|
@@ -4598,15 +4687,35 @@
|
|
|
4598
4687
|
for (const value of vnodeData) {
|
|
4599
4688
|
if (isSsrAttrs(value)) {
|
|
4600
4689
|
for (let i = 1; i < value.length; i += 2) {
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4690
|
+
const attrValue = value[i];
|
|
4691
|
+
"string" != typeof attrValue && discoveredValues.push(attrValue);
|
|
4692
|
+
}
|
|
4693
|
+
}
|
|
4694
|
+
}
|
|
4695
|
+
};
|
|
4696
|
+
const discoverEffectBackRefs = (effectsBackRefs, discoveredValues) => {
|
|
4697
|
+
if (effectsBackRefs) {
|
|
4698
|
+
let hasBackRefs = !1;
|
|
4699
|
+
for (const [, effect] of effectsBackRefs) {
|
|
4700
|
+
if (effect[EffectSubscriptionProp.BACK_REF]) {
|
|
4701
|
+
hasBackRefs = !0;
|
|
4702
|
+
break;
|
|
4605
4703
|
}
|
|
4606
4704
|
}
|
|
4705
|
+
hasBackRefs && discoveredValues.push(effectsBackRefs);
|
|
4607
4706
|
}
|
|
4608
4707
|
};
|
|
4609
4708
|
const promiseResults = new WeakMap;
|
|
4709
|
+
function filterEffectBackRefs(effectBackRef) {
|
|
4710
|
+
let effectBackRefToSerialize = null;
|
|
4711
|
+
if (effectBackRef) {
|
|
4712
|
+
for (const [effectProp, effect] of effectBackRef) {
|
|
4713
|
+
effect[EffectSubscriptionProp.BACK_REF] && (effectBackRefToSerialize ||= new Map,
|
|
4714
|
+
effectBackRefToSerialize.set(effectProp, effect));
|
|
4715
|
+
}
|
|
4716
|
+
}
|
|
4717
|
+
return effectBackRefToSerialize;
|
|
4718
|
+
}
|
|
4610
4719
|
function serializeWrappingFn(serializationContext, value) {
|
|
4611
4720
|
value.$funcStr$ && "{" === value.$funcStr$[0] && (value.$funcStr$ = `(${value.$funcStr$})`);
|
|
4612
4721
|
return [ serializationContext.$addSyncFn$(value.$funcStr$, value.$args$.length, value.$func$), value.$args$ ];
|
|
@@ -4614,13 +4723,13 @@
|
|
|
4614
4723
|
function qrlToString(serializationContext, value) {
|
|
4615
4724
|
let symbol = value.$symbol$;
|
|
4616
4725
|
let chunk = value.$chunk$;
|
|
4617
|
-
const refSymbol = value.$refSymbol$ ?? symbol;
|
|
4618
4726
|
const platform = getPlatform();
|
|
4619
4727
|
if (platform) {
|
|
4620
|
-
const result = platform.chunkForSymbol(
|
|
4621
|
-
result && (chunk = result[1],
|
|
4728
|
+
const result = platform.chunkForSymbol(symbol, chunk, value.dev?.file);
|
|
4729
|
+
result && (chunk = result[1], symbol = result[0]);
|
|
4622
4730
|
}
|
|
4623
|
-
|
|
4731
|
+
const isSync = (value => isQrl$1(value) && "<sync>" == value.$symbol$)(value);
|
|
4732
|
+
if (isSync) {
|
|
4624
4733
|
chunk = "", symbol = String(serializationContext.$addSyncFn$(null, 0, value.resolved));
|
|
4625
4734
|
} else {
|
|
4626
4735
|
chunk || (chunk = serializationContext.$symbolToChunkResolver$(value.$hash$));
|
|
@@ -4674,16 +4783,20 @@
|
|
|
4674
4783
|
const prototype = Object.getPrototypeOf(obj);
|
|
4675
4784
|
return null == prototype || prototype === Object.prototype || prototype === Array.prototype;
|
|
4676
4785
|
}
|
|
4677
|
-
const frameworkType = obj => "object" == typeof obj && null !== obj && (obj instanceof Signal || obj instanceof Task || isJSXNode(obj)) || isQrl(obj);
|
|
4678
|
-
const canSerialize = value => {
|
|
4786
|
+
const frameworkType = obj => "object" == typeof obj && null !== obj && (obj instanceof Signal || obj instanceof Task || isJSXNode(obj)) || isQrl$1(obj);
|
|
4787
|
+
const canSerialize = (value, seen = new WeakSet) => {
|
|
4679
4788
|
if (null == value || "string" == typeof value || "number" == typeof value || "boolean" == typeof value || "bigint" == typeof value) {
|
|
4680
4789
|
return !0;
|
|
4681
4790
|
}
|
|
4682
4791
|
if ("object" == typeof value) {
|
|
4792
|
+
if (seen.has(value)) {
|
|
4793
|
+
return !0;
|
|
4794
|
+
}
|
|
4795
|
+
seen.add(value);
|
|
4683
4796
|
const proto = Object.getPrototypeOf(value);
|
|
4684
4797
|
if (isStore(value) && (value = getStoreTarget(value)), proto == Object.prototype) {
|
|
4685
4798
|
for (const key in value) {
|
|
4686
|
-
if (!canSerialize(untrack((() => value[key])))) {
|
|
4799
|
+
if (!canSerialize(untrack((() => value[key])), seen)) {
|
|
4687
4800
|
return !1;
|
|
4688
4801
|
}
|
|
4689
4802
|
}
|
|
@@ -4691,7 +4804,7 @@
|
|
|
4691
4804
|
}
|
|
4692
4805
|
if (proto == Array.prototype) {
|
|
4693
4806
|
for (let i = 0; i < value.length; i++) {
|
|
4694
|
-
if (!canSerialize(value[i])) {
|
|
4807
|
+
if (!canSerialize(value[i], seen)) {
|
|
4695
4808
|
return !1;
|
|
4696
4809
|
}
|
|
4697
4810
|
}
|
|
@@ -4739,7 +4852,7 @@
|
|
|
4739
4852
|
if (isDomRef?.(value)) {
|
|
4740
4853
|
return !0;
|
|
4741
4854
|
}
|
|
4742
|
-
} else if ("function" == typeof value && (isQrl(value) || isQwikComponent(value))) {
|
|
4855
|
+
} else if ("function" == typeof value && (isQrl$1(value) || isQwikComponent(value))) {
|
|
4743
4856
|
return !0;
|
|
4744
4857
|
}
|
|
4745
4858
|
return !1;
|
|
@@ -4767,13 +4880,14 @@
|
|
|
4767
4880
|
Constants[Constants.True = 2] = "True", Constants[Constants.False = 3] = "False",
|
|
4768
4881
|
Constants[Constants.EmptyString = 4] = "EmptyString", Constants[Constants.EMPTY_ARRAY = 5] = "EMPTY_ARRAY",
|
|
4769
4882
|
Constants[Constants.EMPTY_OBJ = 6] = "EMPTY_OBJ", Constants[Constants.NEEDS_COMPUTATION = 7] = "NEEDS_COMPUTATION",
|
|
4770
|
-
Constants[Constants.
|
|
4771
|
-
Constants[Constants.
|
|
4772
|
-
Constants[Constants.
|
|
4773
|
-
Constants[Constants.
|
|
4883
|
+
Constants[Constants.STORE_ARRAY_PROP = 8] = "STORE_ARRAY_PROP", Constants[Constants.Slot = 9] = "Slot",
|
|
4884
|
+
Constants[Constants.Fragment = 10] = "Fragment", Constants[Constants.NaN = 11] = "NaN",
|
|
4885
|
+
Constants[Constants.PositiveInfinity = 12] = "PositiveInfinity", Constants[Constants.NegativeInfinity = 13] = "NegativeInfinity",
|
|
4886
|
+
Constants[Constants.MaxSafeInt = 14] = "MaxSafeInt", Constants[Constants.AlmostMaxSafeInt = 15] = "AlmostMaxSafeInt",
|
|
4887
|
+
Constants[Constants.MinSafeInt = 16] = "MinSafeInt";
|
|
4774
4888
|
}(Constants || (Constants = {}));
|
|
4775
4889
|
const verifySerializable = (value, preMessage) => {
|
|
4776
|
-
const seen = new
|
|
4890
|
+
const seen = new WeakSet;
|
|
4777
4891
|
return _verifySerializable(value, seen, "_", preMessage);
|
|
4778
4892
|
};
|
|
4779
4893
|
const _verifySerializable = (value, seen, ctx, preMessage) => {
|
|
@@ -4782,10 +4896,13 @@
|
|
|
4782
4896
|
return value;
|
|
4783
4897
|
}
|
|
4784
4898
|
if (shouldSerialize(unwrapped)) {
|
|
4785
|
-
if (
|
|
4786
|
-
|
|
4899
|
+
if ("object" == typeof unwrapped) {
|
|
4900
|
+
if (seen.has(unwrapped)) {
|
|
4901
|
+
return value;
|
|
4902
|
+
}
|
|
4903
|
+
seen.add(unwrapped);
|
|
4787
4904
|
}
|
|
4788
|
-
if (
|
|
4905
|
+
if (isSignal(unwrapped)) {
|
|
4789
4906
|
return value;
|
|
4790
4907
|
}
|
|
4791
4908
|
if (canSerialize(unwrapped)) {
|
|
@@ -4839,9 +4956,7 @@
|
|
|
4839
4956
|
const shouldSerialize = obj => !isObject(obj) && !isFunction(obj) || !noSerializeSet.has(obj);
|
|
4840
4957
|
const fastSkipSerialize = obj => noSerializeSet.has(obj);
|
|
4841
4958
|
const noSerialize = input => (null != input && noSerializeSet.add(input), input);
|
|
4842
|
-
const
|
|
4843
|
-
const isSyncQrl = value => isQrl(value) && "<sync>" == value.$symbol$;
|
|
4844
|
-
const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSymbol) => {
|
|
4959
|
+
const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef) => {
|
|
4845
4960
|
let _containerEl;
|
|
4846
4961
|
const qrl = async function(...args) {
|
|
4847
4962
|
const boundedFn = bindFnToContext.call(this, tryGetInvokeContext());
|
|
@@ -4849,9 +4964,14 @@
|
|
|
4849
4964
|
};
|
|
4850
4965
|
const setContainer = el => (_containerEl || (_containerEl = el), _containerEl);
|
|
4851
4966
|
function bindFnToContext(currentCtx, beforeFn) {
|
|
4852
|
-
|
|
4853
|
-
if (!
|
|
4854
|
-
|
|
4967
|
+
const bound = (...args) => {
|
|
4968
|
+
if (!qrl.resolved) {
|
|
4969
|
+
return qrl.resolve().then((fn => {
|
|
4970
|
+
if (!isFunction(fn)) {
|
|
4971
|
+
throw qError(QError.qrlIsNotFunction);
|
|
4972
|
+
}
|
|
4973
|
+
return bound(...args);
|
|
4974
|
+
}));
|
|
4855
4975
|
}
|
|
4856
4976
|
if (beforeFn && !1 === beforeFn()) {
|
|
4857
4977
|
return;
|
|
@@ -4861,17 +4981,29 @@
|
|
|
4861
4981
|
const prevEvent = context.$event$;
|
|
4862
4982
|
context.$qrl$ = qrl, context.$event$ ||= this;
|
|
4863
4983
|
try {
|
|
4864
|
-
return invoke.call(this, context,
|
|
4984
|
+
return invoke.call(this, context, symbolRef, ...args);
|
|
4865
4985
|
} finally {
|
|
4866
4986
|
context.$qrl$ = prevQrl, context.$event$ = prevEvent;
|
|
4867
4987
|
}
|
|
4868
|
-
}
|
|
4988
|
+
};
|
|
4989
|
+
return bound;
|
|
4869
4990
|
}
|
|
4870
|
-
const resolveLazy = containerEl => null !== symbolRef ? symbolRef : resolve(containerEl);
|
|
4871
4991
|
const wrapFn = fn => "function" != typeof fn || !capture?.length && !captureRef?.length ? fn : function(...args) {
|
|
4872
4992
|
let context = tryGetInvokeContext();
|
|
4873
|
-
|
|
4874
|
-
|
|
4993
|
+
if (context) {
|
|
4994
|
+
if (context.$qrl$?.$symbol$ === qrl.$symbol$) {
|
|
4995
|
+
return fn.apply(this, args);
|
|
4996
|
+
}
|
|
4997
|
+
const prevQrl = context.$qrl$;
|
|
4998
|
+
context.$qrl$ = qrl;
|
|
4999
|
+
try {
|
|
5000
|
+
return fn.apply(this, args);
|
|
5001
|
+
} finally {
|
|
5002
|
+
context.$qrl$ = prevQrl;
|
|
5003
|
+
}
|
|
5004
|
+
}
|
|
5005
|
+
return context = newInvokeContext(), context.$qrl$ = qrl, context.$event$ = this,
|
|
5006
|
+
invoke.call(this, context, fn, ...args);
|
|
4875
5007
|
};
|
|
4876
5008
|
const resolve = async containerEl => {
|
|
4877
5009
|
if (null !== symbolRef) {
|
|
@@ -4886,46 +5018,37 @@
|
|
|
4886
5018
|
const start = now();
|
|
4887
5019
|
const ctx = tryGetInvokeContext();
|
|
4888
5020
|
if (null !== symbolFn) {
|
|
4889
|
-
symbolRef = symbolFn().then((module => qrl.resolved = symbolRef =
|
|
5021
|
+
symbolRef = symbolFn().then((module => qrl.resolved = wrapFn(symbolRef = module[symbol])));
|
|
4890
5022
|
} else {
|
|
4891
5023
|
const imported = getPlatform().importSymbol(_containerEl, chunk, symbol);
|
|
4892
|
-
symbolRef = maybeThen(imported, (ref => qrl.resolved = symbolRef =
|
|
5024
|
+
symbolRef = maybeThen(imported, (ref => qrl.resolved = wrapFn(symbolRef = ref)));
|
|
4893
5025
|
}
|
|
4894
5026
|
return "object" == typeof symbolRef && isPromise(symbolRef) && symbolRef.then((() => emitUsedSymbol(symbol, ctx?.$element$, start)), (err => {
|
|
4895
5027
|
throw console.error(`qrl ${symbol} failed to load`, err), symbolRef = null, err;
|
|
4896
5028
|
})), symbolRef;
|
|
4897
5029
|
};
|
|
4898
5030
|
const createOrReuseInvocationContext = invoke => null == invoke ? newInvokeContext() : isArray(invoke) ? newInvokeContextFromTuple(invoke) : invoke;
|
|
4899
|
-
const
|
|
4900
|
-
const hash = getSymbolHash(resolvedSymbol);
|
|
5031
|
+
const hash = getSymbolHash(symbol);
|
|
4901
5032
|
return Object.assign(qrl, {
|
|
4902
|
-
getSymbol: () =>
|
|
5033
|
+
getSymbol: () => symbol,
|
|
4903
5034
|
getHash: () => hash,
|
|
4904
5035
|
getCaptured: () => captureRef,
|
|
4905
5036
|
resolve,
|
|
4906
|
-
$resolveLazy$:
|
|
5037
|
+
$resolveLazy$: containerEl => null !== symbolRef ? symbolRef : resolve(containerEl),
|
|
4907
5038
|
$setContainer$: setContainer,
|
|
4908
5039
|
$chunk$: chunk,
|
|
4909
5040
|
$symbol$: symbol,
|
|
4910
|
-
$refSymbol$: refSymbol,
|
|
4911
5041
|
$hash$: hash,
|
|
4912
5042
|
getFn: bindFnToContext,
|
|
4913
5043
|
$capture$: capture,
|
|
4914
5044
|
$captureRef$: captureRef,
|
|
4915
5045
|
dev: null,
|
|
4916
5046
|
resolved: void 0
|
|
4917
|
-
}), symbolRef && (symbolRef = maybeThen(symbolRef, (resolved => qrl.resolved = symbolRef =
|
|
5047
|
+
}), symbolRef && (symbolRef = maybeThen(symbolRef, (resolved => qrl.resolved = wrapFn(symbolRef = resolved)))),
|
|
4918
5048
|
build.isDev && Object.defineProperty(qrl, "_devOnlySymbolRef", {
|
|
4919
5049
|
get: () => symbolRef
|
|
4920
5050
|
}), qrl;
|
|
4921
5051
|
};
|
|
4922
|
-
const getSymbolHash = symbolName => {
|
|
4923
|
-
const index = symbolName.lastIndexOf("_");
|
|
4924
|
-
return index > -1 ? symbolName.slice(index + 1) : symbolName;
|
|
4925
|
-
};
|
|
4926
|
-
function assertQrl() {
|
|
4927
|
-
qDev;
|
|
4928
|
-
}
|
|
4929
5052
|
const EMITTED = /*#__PURE__*/ new Set;
|
|
4930
5053
|
const emitUsedSymbol = (symbol, element, reqTime) => {
|
|
4931
5054
|
EMITTED.has(symbol) || (EMITTED.add(symbol), emitEvent("qsymbol", {
|
|
@@ -4942,12 +5065,12 @@
|
|
|
4942
5065
|
};
|
|
4943
5066
|
const now = () => isServerPlatform() ? 0 : "object" == typeof performance ? performance.now() : 0;
|
|
4944
5067
|
let runtimeSymbolId = 0;
|
|
4945
|
-
const $ = expression => createQRL(null, "s" + runtimeSymbolId++, expression, null, null, null
|
|
5068
|
+
const $ = expression => createQRL(null, "s" + runtimeSymbolId++, expression, null, null, null);
|
|
4946
5069
|
const dollar = $;
|
|
4947
5070
|
const eventQrl = qrl => qrl;
|
|
4948
5071
|
const componentQrl = componentQrl => {
|
|
4949
5072
|
function QwikComponent(props, key, flags = 0) {
|
|
4950
|
-
assertQrl();
|
|
5073
|
+
assertQrl(componentQrl);
|
|
4951
5074
|
const finalKey = componentQrl.$hash$.slice(0, 4) + ":" + (key || "");
|
|
4952
5075
|
const InnerCmp = () => {};
|
|
4953
5076
|
return InnerCmp[SERIALIZABLE_STATE] = [ componentQrl ], _jsxSplit(InnerCmp, props, null, props.children, flags, finalKey);
|
|
@@ -5027,7 +5150,7 @@
|
|
|
5027
5150
|
out.push(css.substring(lastIdx, idx)), lastIdx = idx;
|
|
5028
5151
|
}
|
|
5029
5152
|
function insertScopingSelector(idx) {
|
|
5030
|
-
mode === pseudoGlobal || shouldNotInsertScoping() || (flush(idx), out.push(".", "
|
|
5153
|
+
mode === pseudoGlobal || shouldNotInsertScoping() || (flush(idx), out.push(".", "⚡️", scopeId));
|
|
5031
5154
|
}
|
|
5032
5155
|
function lookAhead(arc) {
|
|
5033
5156
|
let prefix = 0;
|
|
@@ -5097,16 +5220,16 @@
|
|
|
5097
5220
|
});
|
|
5098
5221
|
const useStyles$ = /*#__PURE__*/ implicit$FirstArg(useStylesQrl);
|
|
5099
5222
|
const useStylesScopedQrl = styles => ({
|
|
5100
|
-
scopeId: "
|
|
5223
|
+
scopeId: "⚡️" + _useStyles(styles, getScopedStyles, !0)
|
|
5101
5224
|
});
|
|
5102
5225
|
const useStylesScoped$ = /*#__PURE__*/ implicit$FirstArg(useStylesScopedQrl);
|
|
5103
5226
|
const _useStyles = (styleQrl, transform, scoped) => {
|
|
5104
|
-
assertQrl();
|
|
5227
|
+
assertQrl(styleQrl);
|
|
5105
5228
|
const {val, set, iCtx, i} = useSequentialScope();
|
|
5106
5229
|
if (val) {
|
|
5107
5230
|
return val;
|
|
5108
5231
|
}
|
|
5109
|
-
const styleId = (
|
|
5232
|
+
const styleId = (index = i, assertQrl(qStyles = styleQrl), `${hashCode(qStyles.$hash$)}-${index}`);
|
|
5110
5233
|
var qStyles, index;
|
|
5111
5234
|
const host = iCtx.$hostElement$;
|
|
5112
5235
|
set(styleId);
|
|
@@ -5127,7 +5250,7 @@
|
|
|
5127
5250
|
if (val) {
|
|
5128
5251
|
return val;
|
|
5129
5252
|
}
|
|
5130
|
-
assertQrl();
|
|
5253
|
+
assertQrl(qrl);
|
|
5131
5254
|
const signal = new ComputedSignal(null, qrl);
|
|
5132
5255
|
return set(signal), throwIfQRLNotResolved(qrl), signal;
|
|
5133
5256
|
};
|
|
@@ -5137,11 +5260,15 @@
|
|
|
5137
5260
|
if (val) {
|
|
5138
5261
|
return void (isServerPlatform() && useRunTask(val, eagerness));
|
|
5139
5262
|
}
|
|
5140
|
-
assertQrl();
|
|
5263
|
+
assertQrl(qrl);
|
|
5141
5264
|
const task = new Task(TaskFlags.VISIBLE_TASK, i, iCtx.$hostElement$, qrl, void 0, null);
|
|
5142
5265
|
set(task), useRunTask(task, eagerness), isServerPlatform() || (qrl.$resolveLazy$(iCtx.$element$),
|
|
5143
5266
|
iCtx.$container$.$scheduler$(ChoreType.VISIBLE, task));
|
|
5144
5267
|
};
|
|
5268
|
+
const useRunTask = (task, eagerness) => {
|
|
5269
|
+
"intersection-observer" === eagerness ? useOn("qvisible", getTaskHandlerQrl(task)) : "document-ready" === eagerness ? useOnDocument("qinit", getTaskHandlerQrl(task)) : "document-idle" === eagerness && useOnDocument("qidle", getTaskHandlerQrl(task));
|
|
5270
|
+
};
|
|
5271
|
+
const getTaskHandlerQrl = task => createQRL(null, "_task", scheduleTask, null, null, [ task ]);
|
|
5145
5272
|
const useTask$ = /*#__PURE__*/ implicit$FirstArg(useTaskQrl);
|
|
5146
5273
|
const useVisibleTask$ = /*#__PURE__*/ implicit$FirstArg(useVisibleTaskQrl);
|
|
5147
5274
|
const useComputed$ = implicit$FirstArg(useComputedQrl);
|
|
@@ -5215,7 +5342,7 @@
|
|
|
5215
5342
|
return _jsxSorted("script", null, props, null, 0, "prefetch-service-worker");
|
|
5216
5343
|
}, exports.RenderOnce = RenderOnce, exports.Resource = props => _jsxSorted(Fragment, null, null, function(props) {
|
|
5217
5344
|
const resource = props.value;
|
|
5218
|
-
if (isResourceReturn(resource)) {
|
|
5345
|
+
if (isResourceReturn(resource) && resource.value) {
|
|
5219
5346
|
if (!isServerPlatform()) {
|
|
5220
5347
|
const state = resource._state;
|
|
5221
5348
|
if ("pending" === state && props.onPending) {
|
|
@@ -5240,9 +5367,9 @@
|
|
|
5240
5367
|
}), props.children, jsx(SSRComment, {
|
|
5241
5368
|
data: "qkssr-po"
|
|
5242
5369
|
}) ], exports.SkipRender = SkipRender, exports.Slot = Slot, exports._CONST_PROPS = _CONST_PROPS,
|
|
5243
|
-
exports._DomContainer = DomContainer, exports.
|
|
5244
|
-
exports.
|
|
5245
|
-
exports._deserialize = function(rawStateData, element) {
|
|
5370
|
+
exports._DomContainer = DomContainer, exports._EFFECT_BACK_REF = _EFFECT_BACK_REF,
|
|
5371
|
+
exports._EMPTY_ARRAY = EMPTY_ARRAY, exports._EffectData = SubscriptionData, exports._IMMUTABLE = _IMMUTABLE,
|
|
5372
|
+
exports._SharedContainer = _SharedContainer, exports._VAR_PROPS = _VAR_PROPS, exports._deserialize = function(rawStateData, element) {
|
|
5246
5373
|
if (null == rawStateData) {
|
|
5247
5374
|
return [];
|
|
5248
5375
|
}
|
|
@@ -5263,7 +5390,7 @@
|
|
|
5263
5390
|
if (iCtx) {
|
|
5264
5391
|
const hostElement = iCtx.$hostElement$;
|
|
5265
5392
|
let element = null;
|
|
5266
|
-
return vnode_isVNode(hostElement)
|
|
5393
|
+
return null != hostElement && (vnode_isVNode(hostElement) ? vnode_isElementVNode(hostElement) && (element = vnode_getNode(hostElement)) : element = hostElement),
|
|
5267
5394
|
element ?? iCtx.$qrl$?.$setContainer$(void 0);
|
|
5268
5395
|
}
|
|
5269
5396
|
}, exports._getContextEvent = () => {
|
|
@@ -5272,7 +5399,7 @@
|
|
|
5272
5399
|
return iCtx.$event$;
|
|
5273
5400
|
}
|
|
5274
5401
|
}, exports._getDomContainer = getDomContainer, exports._getQContainerElement = _getQContainerElement,
|
|
5275
|
-
exports.
|
|
5402
|
+
exports._isJSXNode = isJSXNode, exports._isStringifiable = function(value) {
|
|
5276
5403
|
return null === value || "string" == typeof value || "number" == typeof value || "boolean" == typeof value;
|
|
5277
5404
|
}, exports._jsxBranch = input => input, exports._jsxC = (type, mutable, _flags, key) => jsx(type, mutable, key),
|
|
5278
5405
|
exports._jsxQ = (type, mutable, immutable, children, _flags, key) => jsx(type, {
|
|
@@ -5288,21 +5415,31 @@
|
|
|
5288
5415
|
return newQrl.dev = opts, newQrl;
|
|
5289
5416
|
}, exports._qrlSync = function(fn, serializedFn) {
|
|
5290
5417
|
return void 0 === serializedFn && (serializedFn = fn.toString()), fn.serialized = serializedFn,
|
|
5291
|
-
createQRL("", "<sync>", fn, null, null, null
|
|
5418
|
+
createQRL("", "<sync>", fn, null, null, null);
|
|
5292
5419
|
}, exports._regSymbol = (symbol, hash) => (void 0 === globalThis.__qwik_reg_symbols && (globalThis.__qwik_reg_symbols = new Map),
|
|
5293
5420
|
globalThis.__qwik_reg_symbols.set(hash, symbol), symbol), exports._restProps = (props, omit, target = {}) => {
|
|
5294
|
-
|
|
5295
|
-
|
|
5421
|
+
let constPropsTarget = null;
|
|
5422
|
+
const constProps = props[_CONST_PROPS];
|
|
5423
|
+
if (constProps) {
|
|
5424
|
+
for (const key in constProps) {
|
|
5425
|
+
omit.includes(key) || (constPropsTarget ||= {}, constPropsTarget[key] = constProps[key]);
|
|
5426
|
+
}
|
|
5296
5427
|
}
|
|
5297
|
-
|
|
5298
|
-
|
|
5428
|
+
const varPropsTarget = target;
|
|
5429
|
+
const varProps = props[_VAR_PROPS];
|
|
5430
|
+
for (const key in varProps) {
|
|
5431
|
+
omit.includes(key) || (varPropsTarget[key] = varProps[key]);
|
|
5432
|
+
}
|
|
5433
|
+
return createPropsProxy(varPropsTarget, constPropsTarget);
|
|
5434
|
+
}, exports._run = queueQRL, exports._serialize = async function(data) {
|
|
5299
5435
|
const serializationContext = createSerializationContext(null, null, (() => ""), (() => ""), (() => {}), new WeakMap);
|
|
5300
5436
|
for (const root of data) {
|
|
5301
5437
|
serializationContext.$addRoot$(root);
|
|
5302
5438
|
}
|
|
5303
5439
|
return await serializationContext.$breakCircularDepsAndAwaitPromises$(), serializationContext.$serialize$(),
|
|
5304
5440
|
serializationContext.$writer$.toString();
|
|
5305
|
-
}, exports.
|
|
5441
|
+
}, exports._task = scheduleTask, exports._verifySerializable = verifySerializable,
|
|
5442
|
+
exports._waitUntilRendered = elm => {
|
|
5306
5443
|
const containerEl = _getQContainerElement(elm);
|
|
5307
5444
|
if (!containerEl) {
|
|
5308
5445
|
return Promise.resolve();
|
|
@@ -5366,7 +5503,7 @@
|
|
|
5366
5503
|
cleanup(container, container.rootVNode);
|
|
5367
5504
|
}
|
|
5368
5505
|
};
|
|
5369
|
-
}, exports.setPlatform = plt => _platform = plt, exports.sync$ = fn => createQRL("", "<sync>", fn, null, null, null
|
|
5506
|
+
}, exports.setPlatform = plt => _platform = plt, exports.sync$ = fn => createQRL("", "<sync>", fn, null, null, null),
|
|
5370
5507
|
exports.untrack = untrack, exports.unwrapStore = unwrapStore, exports.useComputed$ = useComputed$,
|
|
5371
5508
|
exports.useComputedQrl = useComputedQrl, exports.useConstant = useConstant, exports.useContext = (context, defaultValue) => {
|
|
5372
5509
|
const {val, set, iCtx} = useSequentialScope();
|