@qwik.dev/core 2.0.0-alpha.3 → 2.0.0-alpha.5
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 +34 -4
- package/dist/core-internal.d.ts +39 -17
- package/dist/core.cjs +6436 -6165
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +6423 -6164
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +1714 -1494
- package/dist/core.prod.mjs +3824 -3622
- package/dist/insights/index.qwik.cjs +144 -147
- package/dist/insights/index.qwik.mjs +144 -147
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +2600 -2519
- package/dist/optimizer.mjs +1867 -1837
- package/dist/prefetch/package.json +1 -1
- package/dist/server.cjs +927 -677
- package/dist/server.mjs +842 -593
- package/dist/testing/index.cjs +3385 -3124
- package/dist/testing/index.mjs +3357 -3097
- package/dist/testing/package.json +1 -1
- package/package.json +2 -2
- package/public.d.ts +3 -0
- package/dist/index.d.ts +0 -2
|
@@ -6,15 +6,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
6
6
|
const core = require("@qwik.dev/core");
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
|
-
* @qwik.dev/core 2.0.0-alpha.
|
|
9
|
+
* @qwik.dev/core 2.0.0-alpha.5-dev+cb53bbd
|
|
10
10
|
* Copyright QwikDev. All Rights Reserved.
|
|
11
11
|
* Use of this source code is governed by an MIT-style license that can be
|
|
12
12
|
* found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
|
|
13
13
|
*/
|
|
14
|
-
const
|
|
15
|
-
const throwErrorAndStop = (message, ...optionalParams) => {
|
|
16
|
-
throw createAndLogError(false, message, ...optionalParams);
|
|
17
|
-
};
|
|
14
|
+
const logErrorAndStop = (message, ...optionalParams) => createAndLogError(true, message, ...optionalParams);
|
|
18
15
|
const createAndLogError = (asyncThrow, message, ...optionalParams) => {
|
|
19
16
|
const err = message instanceof Error ? message : new Error(message);
|
|
20
17
|
return console.error("%cQWIK ERROR", "", err.message, ...optionalParams, err.stack), asyncThrow && setTimeout(() => {
|
|
@@ -25,18 +22,21 @@ function assertTrue() {
|
|
|
25
22
|
}
|
|
26
23
|
function assertFalse() {
|
|
27
24
|
}
|
|
25
|
+
const codeToText = (code) => `Code(Q${code}) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L${8 + code}`;
|
|
26
|
+
var QError;
|
|
27
|
+
!function(QError2) {
|
|
28
|
+
QError2[QError2.stringifyClassOrStyle = 0] = "stringifyClassOrStyle", QError2[QError2.UNUSED_1 = 1] = "UNUSED_1", QError2[QError2.UNUSED_2 = 2] = "UNUSED_2", QError2[QError2.verifySerializable = 3] = "verifySerializable", QError2[QError2.UNUSED_4 = 4] = "UNUSED_4", QError2[QError2.cannotRenderOverExistingContainer = 5] = "cannotRenderOverExistingContainer", QError2[QError2.UNUSED_6 = 6] = "UNUSED_6", QError2[QError2.UNUSED_7 = 7] = "UNUSED_7", QError2[QError2.UNUSED_8 = 8] = "UNUSED_8", QError2[QError2.UNUSED_9 = 9] = "UNUSED_9", QError2[QError2.qrlIsNotFunction = 10] = "qrlIsNotFunction", QError2[QError2.dynamicImportFailed = 11] = "dynamicImportFailed", QError2[QError2.unknownTypeArgument = 12] = "unknownTypeArgument", QError2[QError2.notFoundContext = 13] = "notFoundContext", QError2[QError2.useMethodOutsideContext = 14] = "useMethodOutsideContext", QError2[QError2.UNUSED_15 = 15] = "UNUSED_15", QError2[QError2.UNUSED_16 = 16] = "UNUSED_16", QError2[QError2.UNUSED_17 = 17] = "UNUSED_17", QError2[QError2.UNUSED_18 = 18] = "UNUSED_18", QError2[QError2.UNUSED_19 = 19] = "UNUSED_19", QError2[QError2.useInvokeContext = 20] = "useInvokeContext", QError2[QError2.UNUSED_21 = 21] = "UNUSED_21", QError2[QError2.UNUSED_22 = 22] = "UNUSED_22", QError2[QError2.UNUSED_23 = 23] = "UNUSED_23", QError2[QError2.UNUSED_24 = 24] = "UNUSED_24", QError2[QError2.UNUSED_25 = 25] = "UNUSED_25", QError2[QError2.UNUSED_26 = 26] = "UNUSED_26", QError2[QError2.UNUSED_27 = 27] = "UNUSED_27", QError2[QError2.invalidContext = 28] = "invalidContext", QError2[QError2.tagError = 29] = "tagError", QError2[QError2.qrlMissingContainer = 30] = "qrlMissingContainer", QError2[QError2.qrlMissingChunk = 31] = "qrlMissingChunk", QError2[QError2.invalidRefValue = 32] = "invalidRefValue", QError2[QError2.serializeErrorNotImplemented = 33] = "serializeErrorNotImplemented", QError2[QError2.serializeErrorExpectedVNode = 34] = "serializeErrorExpectedVNode", QError2[QError2.serializeErrorCannotAllocate = 35] = "serializeErrorCannotAllocate", QError2[QError2.serializeErrorMissingRootId = 36] = "serializeErrorMissingRootId", QError2[QError2.serializeErrorUnknownType = 37] = "serializeErrorUnknownType", QError2[QError2.serializeErrorUnvisited = 38] = "serializeErrorUnvisited", QError2[QError2.serializeErrorMissingChunk = 39] = "serializeErrorMissingChunk", QError2[QError2.wrongTextareaValue = 40] = "wrongTextareaValue", QError2[QError2.containerNotFound = 41] = "containerNotFound", QError2[QError2.elementWithoutContainer = 42] = "elementWithoutContainer", QError2[QError2.invalidVNodeType = 43] = "invalidVNodeType", QError2[QError2.materializeVNodeDataError = 44] = "materializeVNodeDataError", QError2[QError2.serverHostMismatch = 45] = "serverHostMismatch", QError2[QError2.cannotCoerceSignal = 46] = "cannotCoerceSignal", QError2[QError2.computedNotSync = 47] = "computedNotSync", QError2[QError2.computedReadOnly = 48] = "computedReadOnly", QError2[QError2.wrappedReadOnly = 49] = "wrappedReadOnly", QError2[QError2.promisesNotExpected = 50] = "promisesNotExpected", QError2[QError2.unsafeAttr = 51] = "unsafeAttr";
|
|
29
|
+
}(QError || (QError = {}));
|
|
30
|
+
const qError = (code, errorMessageArgs = []) => {
|
|
31
|
+
const text = codeToText(code, ...errorMessageArgs);
|
|
32
|
+
return logErrorAndStop(text, ...errorMessageArgs);
|
|
33
|
+
};
|
|
28
34
|
const isPromise = (value) => !!value && "object" == typeof value && "function" == typeof value.then;
|
|
29
|
-
function retryOnPromise(fn, retryCount = 0) {
|
|
30
|
-
try {
|
|
31
|
-
return fn();
|
|
32
|
-
} catch (e) {
|
|
33
|
-
if (isPromise(e) && retryCount < 100) {
|
|
34
|
-
return e.then(retryOnPromise.bind(null, fn, retryCount++));
|
|
35
|
-
}
|
|
36
|
-
throw e;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
35
|
const isArray = (v) => Array.isArray(v);
|
|
36
|
+
var VNodeDataFlag;
|
|
37
|
+
!function(VNodeDataFlag2) {
|
|
38
|
+
VNodeDataFlag2[VNodeDataFlag2.NONE = 0] = "NONE", VNodeDataFlag2[VNodeDataFlag2.TEXT_DATA = 1] = "TEXT_DATA", VNodeDataFlag2[VNodeDataFlag2.VIRTUAL_NODE = 2] = "VIRTUAL_NODE", VNodeDataFlag2[VNodeDataFlag2.ELEMENT_NODE = 4] = "ELEMENT_NODE", VNodeDataFlag2[VNodeDataFlag2.REFERENCE = 8] = "REFERENCE", VNodeDataFlag2[VNodeDataFlag2.SERIALIZE = 16] = "SERIALIZE";
|
|
39
|
+
}(VNodeDataFlag || (VNodeDataFlag = {}));
|
|
40
40
|
var VirtualType;
|
|
41
41
|
!function(VirtualType2) {
|
|
42
42
|
VirtualType2.Virtual = "V", VirtualType2.Fragment = "F", VirtualType2.WrappedSignal = "S", VirtualType2.Awaited = "A", VirtualType2.Component = "C", VirtualType2.InlineComponent = "I", VirtualType2.Projection = "P";
|
|
@@ -59,6 +59,12 @@ const dangerouslySetInnerHTML = "dangerouslySetInnerHTML";
|
|
|
59
59
|
const isQrl$1 = (value) => "function" == typeof value && "function" == typeof value.getSymbol;
|
|
60
60
|
const EMPTY_OBJ = {};
|
|
61
61
|
Object.freeze(EMPTY_OBJ);
|
|
62
|
+
const STORE_TARGET = Symbol("store.target");
|
|
63
|
+
var StoreFlags;
|
|
64
|
+
!function(StoreFlags2) {
|
|
65
|
+
StoreFlags2[StoreFlags2.NONE = 0] = "NONE", StoreFlags2[StoreFlags2.RECURSIVE = 1] = "RECURSIVE", StoreFlags2[StoreFlags2.IMMUTABLE = 2] = "IMMUTABLE";
|
|
66
|
+
}(StoreFlags || (StoreFlags = {}));
|
|
67
|
+
const isStore = (value) => STORE_TARGET in value;
|
|
62
68
|
class Subscriber {
|
|
63
69
|
constructor() {
|
|
64
70
|
__publicField(this, "$effectDependencies$", null);
|
|
@@ -67,6 +73,50 @@ class Subscriber {
|
|
|
67
73
|
function isSubscriber(value) {
|
|
68
74
|
return value instanceof Subscriber || value instanceof WrappedSignal;
|
|
69
75
|
}
|
|
76
|
+
var VNodeFlags;
|
|
77
|
+
var VNodeFlagsIndex;
|
|
78
|
+
var VNodeProps;
|
|
79
|
+
var ElementVNodeProps;
|
|
80
|
+
var TextVNodeProps;
|
|
81
|
+
var VirtualVNodeProps;
|
|
82
|
+
!function(VNodeFlags2) {
|
|
83
|
+
VNodeFlags2[VNodeFlags2.Element = 1] = "Element", VNodeFlags2[VNodeFlags2.Virtual = 2] = "Virtual", VNodeFlags2[VNodeFlags2.ELEMENT_OR_VIRTUAL_MASK = 3] = "ELEMENT_OR_VIRTUAL_MASK", VNodeFlags2[VNodeFlags2.ELEMENT_OR_TEXT_MASK = 5] = "ELEMENT_OR_TEXT_MASK", VNodeFlags2[VNodeFlags2.TYPE_MASK = 7] = "TYPE_MASK", VNodeFlags2[VNodeFlags2.INFLATED_TYPE_MASK = 15] = "INFLATED_TYPE_MASK", VNodeFlags2[VNodeFlags2.Text = 4] = "Text", VNodeFlags2[VNodeFlags2.Inflated = 8] = "Inflated", VNodeFlags2[VNodeFlags2.Resolved = 16] = "Resolved", VNodeFlags2[VNodeFlags2.Deleted = 32] = "Deleted", VNodeFlags2[VNodeFlags2.NAMESPACE_MASK = 192] = "NAMESPACE_MASK", VNodeFlags2[VNodeFlags2.NEGATED_NAMESPACE_MASK = -193] = "NEGATED_NAMESPACE_MASK", VNodeFlags2[VNodeFlags2.NS_html = 0] = "NS_html", VNodeFlags2[VNodeFlags2.NS_svg = 64] = "NS_svg", VNodeFlags2[VNodeFlags2.NS_math = 128] = "NS_math";
|
|
84
|
+
}(VNodeFlags || (VNodeFlags = {})), function(VNodeFlagsIndex2) {
|
|
85
|
+
VNodeFlagsIndex2[VNodeFlagsIndex2.mask = -256] = "mask", VNodeFlagsIndex2[VNodeFlagsIndex2.negated_mask = 255] = "negated_mask", VNodeFlagsIndex2[VNodeFlagsIndex2.shift = 8] = "shift";
|
|
86
|
+
}(VNodeFlagsIndex || (VNodeFlagsIndex = {})), function(VNodeProps2) {
|
|
87
|
+
VNodeProps2[VNodeProps2.flags = 0] = "flags", VNodeProps2[VNodeProps2.parent = 1] = "parent", VNodeProps2[VNodeProps2.previousSibling = 2] = "previousSibling", VNodeProps2[VNodeProps2.nextSibling = 3] = "nextSibling";
|
|
88
|
+
}(VNodeProps || (VNodeProps = {})), function(ElementVNodeProps2) {
|
|
89
|
+
ElementVNodeProps2[ElementVNodeProps2.firstChild = 4] = "firstChild", ElementVNodeProps2[ElementVNodeProps2.lastChild = 5] = "lastChild", ElementVNodeProps2[ElementVNodeProps2.element = 6] = "element", ElementVNodeProps2[ElementVNodeProps2.elementName = 7] = "elementName", ElementVNodeProps2[ElementVNodeProps2.PROPS_OFFSET = 8] = "PROPS_OFFSET";
|
|
90
|
+
}(ElementVNodeProps || (ElementVNodeProps = {})), function(TextVNodeProps2) {
|
|
91
|
+
TextVNodeProps2[TextVNodeProps2.node = 4] = "node", TextVNodeProps2[TextVNodeProps2.text = 5] = "text";
|
|
92
|
+
}(TextVNodeProps || (TextVNodeProps = {})), function(VirtualVNodeProps2) {
|
|
93
|
+
VirtualVNodeProps2[VirtualVNodeProps2.firstChild = 4] = "firstChild", VirtualVNodeProps2[VirtualVNodeProps2.lastChild = 5] = "lastChild", VirtualVNodeProps2[VirtualVNodeProps2.PROPS_OFFSET = 6] = "PROPS_OFFSET";
|
|
94
|
+
}(VirtualVNodeProps || (VirtualVNodeProps = {}));
|
|
95
|
+
var SiblingsArray;
|
|
96
|
+
!function(SiblingsArray2) {
|
|
97
|
+
SiblingsArray2[SiblingsArray2.Name = 0] = "Name", SiblingsArray2[SiblingsArray2.Key = 1] = "Key", SiblingsArray2[SiblingsArray2.VNode = 2] = "VNode", SiblingsArray2[SiblingsArray2.Size = 3] = "Size", SiblingsArray2[SiblingsArray2.NextVNode = 5] = "NextVNode";
|
|
98
|
+
}(SiblingsArray || (SiblingsArray = {}));
|
|
99
|
+
var ChoreType;
|
|
100
|
+
!function(ChoreType2) {
|
|
101
|
+
ChoreType2[ChoreType2.MACRO = 240] = "MACRO", ChoreType2[ChoreType2.MICRO = 15] = "MICRO", ChoreType2[ChoreType2.QRL_RESOLVE = 1] = "QRL_RESOLVE", ChoreType2[ChoreType2.RESOURCE = 2] = "RESOURCE", ChoreType2[ChoreType2.TASK = 3] = "TASK", ChoreType2[ChoreType2.NODE_DIFF = 4] = "NODE_DIFF", ChoreType2[ChoreType2.NODE_PROP = 5] = "NODE_PROP", ChoreType2[ChoreType2.COMPONENT_SSR = 6] = "COMPONENT_SSR", ChoreType2[ChoreType2.COMPONENT = 7] = "COMPONENT", ChoreType2[ChoreType2.RECOMPUTE_AND_SCHEDULE_EFFECTS = 8] = "RECOMPUTE_AND_SCHEDULE_EFFECTS", ChoreType2[ChoreType2.JOURNAL_FLUSH = 16] = "JOURNAL_FLUSH", ChoreType2[ChoreType2.VISIBLE = 32] = "VISIBLE", ChoreType2[ChoreType2.CLEANUP_VISIBLE = 48] = "CLEANUP_VISIBLE", ChoreType2[ChoreType2.WAIT_FOR_ALL = 255] = "WAIT_FOR_ALL";
|
|
102
|
+
}(ChoreType || (ChoreType = {}));
|
|
103
|
+
var TaskFlags;
|
|
104
|
+
!function(TaskFlags2) {
|
|
105
|
+
TaskFlags2[TaskFlags2.VISIBLE_TASK = 1] = "VISIBLE_TASK", TaskFlags2[TaskFlags2.TASK = 2] = "TASK", TaskFlags2[TaskFlags2.RESOURCE = 4] = "RESOURCE", TaskFlags2[TaskFlags2.DIRTY = 8] = "DIRTY";
|
|
106
|
+
}(TaskFlags || (TaskFlags = {}));
|
|
107
|
+
class Task extends Subscriber {
|
|
108
|
+
constructor($flags$, $index$, $el$, $qrl$, $state$, $destroy$) {
|
|
109
|
+
super();
|
|
110
|
+
__publicField(this, "$flags$");
|
|
111
|
+
__publicField(this, "$index$");
|
|
112
|
+
__publicField(this, "$el$");
|
|
113
|
+
__publicField(this, "$qrl$");
|
|
114
|
+
__publicField(this, "$state$");
|
|
115
|
+
__publicField(this, "$destroy$");
|
|
116
|
+
this.$flags$ = $flags$, this.$index$ = $index$, this.$el$ = $el$, this.$qrl$ = $qrl$, this.$state$ = $state$, this.$destroy$ = $destroy$;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const isTask = (value) => value instanceof Task;
|
|
70
120
|
const NEEDS_COMPUTATION = Symbol("invalid");
|
|
71
121
|
const throwIfQRLNotResolved = (qrl2) => {
|
|
72
122
|
if (!qrl2.resolved) {
|
|
@@ -74,7 +124,7 @@ const throwIfQRLNotResolved = (qrl2) => {
|
|
|
74
124
|
}
|
|
75
125
|
};
|
|
76
126
|
const isSignal = (value) => value instanceof Signal;
|
|
77
|
-
class
|
|
127
|
+
class EffectPropData {
|
|
78
128
|
constructor(data) {
|
|
79
129
|
__publicField(this, "data");
|
|
80
130
|
this.data = data;
|
|
@@ -151,7 +201,7 @@ const ensureEffectContainsSubscriber = (effect, subscriber, container) => {
|
|
|
151
201
|
return;
|
|
152
202
|
}
|
|
153
203
|
effect.$effectDependencies$.push(subscriber);
|
|
154
|
-
} else if (vnode_isVNode(effect) &&
|
|
204
|
+
} else if (vnode_isVNode(effect) && !vnode_isTextVNode(effect)) {
|
|
155
205
|
let subscribers = vnode_getProp(effect, "q:subs", container ? container.$getObjectById$ : null);
|
|
156
206
|
if (subscribers || (subscribers = []), subscriberExistInSubscribers(subscribers, subscriber)) {
|
|
157
207
|
return;
|
|
@@ -184,12 +234,7 @@ const triggerEffects = (container, signal, effects) => {
|
|
|
184
234
|
let choreType = ChoreType.TASK;
|
|
185
235
|
effect.$flags$ & TaskFlags.VISIBLE_TASK ? choreType = ChoreType.VISIBLE : effect.$flags$ & TaskFlags.RESOURCE && (choreType = ChoreType.RESOURCE), container.$scheduler$(choreType, effect);
|
|
186
236
|
} else if (effect instanceof Signal) {
|
|
187
|
-
effect instanceof ComputedSignal && (effect.$computeQrl$.resolved || container.$scheduler$(ChoreType.QRL_RESOLVE, null, effect.$computeQrl$));
|
|
188
|
-
try {
|
|
189
|
-
retryOnPromise(() => effect.$invalidate$());
|
|
190
|
-
} catch (e) {
|
|
191
|
-
logError(e);
|
|
192
|
-
}
|
|
237
|
+
effect instanceof ComputedSignal && (effect.$computeQrl$.resolved || container.$scheduler$(ChoreType.QRL_RESOLVE, null, effect.$computeQrl$)), effect.$invalidate$();
|
|
193
238
|
} else if (property === EffectProperty.COMPONENT) {
|
|
194
239
|
const host = effect;
|
|
195
240
|
const qrl2 = container.getHostProp(host, "q:renderFn");
|
|
@@ -198,8 +243,8 @@ const triggerEffects = (container, signal, effects) => {
|
|
|
198
243
|
} else if (property === EffectProperty.VNODE) {
|
|
199
244
|
container.$scheduler$(ChoreType.NODE_DIFF, effect, effect, signal);
|
|
200
245
|
} else {
|
|
201
|
-
|
|
202
|
-
if (effectData instanceof
|
|
246
|
+
const effectData = effectSubscriptions[EffectSubscriptionsProp.FIRST_BACK_REF_OR_DATA];
|
|
247
|
+
if (effectData instanceof EffectPropData) {
|
|
203
248
|
const payload = {
|
|
204
249
|
...effectData.data,
|
|
205
250
|
$value$: signal
|
|
@@ -216,16 +261,18 @@ class ComputedSignal extends Signal {
|
|
|
216
261
|
super(container, NEEDS_COMPUTATION);
|
|
217
262
|
__publicField(this, "$computeQrl$");
|
|
218
263
|
__publicField(this, "$invalid$", true);
|
|
264
|
+
__publicField(this, "$forceRunEffects$", false);
|
|
219
265
|
this.$computeQrl$ = fn;
|
|
220
266
|
}
|
|
221
267
|
$invalidate$() {
|
|
222
|
-
this.$invalid$ = true, this.$
|
|
268
|
+
this.$invalid$ = true, this.$forceRunEffects$ = false, this.$container$?.$scheduler$(ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, null, this);
|
|
223
269
|
}
|
|
224
270
|
force() {
|
|
225
|
-
this.$invalid$ = true, triggerEffects(this.$container$, this, this.$effects$);
|
|
271
|
+
this.$invalid$ = true, this.$forceRunEffects$ = false, triggerEffects(this.$container$, this, this.$effects$);
|
|
226
272
|
}
|
|
227
273
|
get untrackedValue() {
|
|
228
|
-
|
|
274
|
+
const didChange = this.$computeIfNeeded$();
|
|
275
|
+
return didChange && (this.$forceRunEffects$ = didChange), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION), this.$untrackedValue$;
|
|
229
276
|
}
|
|
230
277
|
$computeIfNeeded$() {
|
|
231
278
|
if (!this.$invalid$) {
|
|
@@ -238,7 +285,10 @@ class ComputedSignal extends Signal {
|
|
|
238
285
|
ctx && (ctx.$effectSubscriber$ = [this, EffectProperty.VNODE]);
|
|
239
286
|
try {
|
|
240
287
|
const untrackedValue = computeQrl.getFn(ctx)();
|
|
241
|
-
isPromise(untrackedValue)
|
|
288
|
+
if (isPromise(untrackedValue)) {
|
|
289
|
+
throw qError(QError.computedNotSync, [computeQrl.dev ? computeQrl.dev.file : "", computeQrl.$hash$]);
|
|
290
|
+
}
|
|
291
|
+
this.$invalid$ = false;
|
|
242
292
|
const didChange = untrackedValue !== this.$untrackedValue$;
|
|
243
293
|
return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
|
|
244
294
|
} finally {
|
|
@@ -249,7 +299,7 @@ class ComputedSignal extends Signal {
|
|
|
249
299
|
return super.value;
|
|
250
300
|
}
|
|
251
301
|
set value(_) {
|
|
252
|
-
|
|
302
|
+
throw qError(QError.computedReadOnly);
|
|
253
303
|
}
|
|
254
304
|
}
|
|
255
305
|
class WrappedSignal extends Signal {
|
|
@@ -260,16 +310,19 @@ class WrappedSignal extends Signal {
|
|
|
260
310
|
__publicField(this, "$funcStr$");
|
|
261
311
|
__publicField(this, "$invalid$", true);
|
|
262
312
|
__publicField(this, "$effectDependencies$", null);
|
|
313
|
+
__publicField(this, "$hostElement$", null);
|
|
314
|
+
__publicField(this, "$forceRunEffects$", false);
|
|
263
315
|
this.$args$ = args, this.$func$ = fn, this.$funcStr$ = fnStr;
|
|
264
316
|
}
|
|
265
317
|
$invalidate$() {
|
|
266
|
-
this.$invalid$ = true, this.$
|
|
318
|
+
this.$invalid$ = true, this.$forceRunEffects$ = false, this.$container$?.$scheduler$(ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, this.$hostElement$, this);
|
|
267
319
|
}
|
|
268
320
|
force() {
|
|
269
|
-
this.$invalid$ = true, triggerEffects(this.$container$, this, this.$effects$);
|
|
321
|
+
this.$invalid$ = true, this.$forceRunEffects$ = false, triggerEffects(this.$container$, this, this.$effects$);
|
|
270
322
|
}
|
|
271
323
|
get untrackedValue() {
|
|
272
|
-
|
|
324
|
+
const didChange = this.$computeIfNeeded$();
|
|
325
|
+
return didChange && (this.$forceRunEffects$ = didChange), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION), this.$untrackedValue$;
|
|
273
326
|
}
|
|
274
327
|
$computeIfNeeded$() {
|
|
275
328
|
if (!this.$invalid$) {
|
|
@@ -283,112 +336,9 @@ class WrappedSignal extends Signal {
|
|
|
283
336
|
return super.value;
|
|
284
337
|
}
|
|
285
338
|
set value(_) {
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
var TaskFlags;
|
|
290
|
-
!function(TaskFlags2) {
|
|
291
|
-
TaskFlags2[TaskFlags2.VISIBLE_TASK = 1] = "VISIBLE_TASK", TaskFlags2[TaskFlags2.TASK = 2] = "TASK", TaskFlags2[TaskFlags2.RESOURCE = 4] = "RESOURCE", TaskFlags2[TaskFlags2.DIRTY = 8] = "DIRTY";
|
|
292
|
-
}(TaskFlags || (TaskFlags = {}));
|
|
293
|
-
class Task extends Subscriber {
|
|
294
|
-
constructor($flags$, $index$, $el$, $qrl$, $state$, $destroy$) {
|
|
295
|
-
super();
|
|
296
|
-
__publicField(this, "$flags$");
|
|
297
|
-
__publicField(this, "$index$");
|
|
298
|
-
__publicField(this, "$el$");
|
|
299
|
-
__publicField(this, "$qrl$");
|
|
300
|
-
__publicField(this, "$state$");
|
|
301
|
-
__publicField(this, "$destroy$");
|
|
302
|
-
this.$flags$ = $flags$, this.$index$ = $index$, this.$el$ = $el$, this.$qrl$ = $qrl$, this.$state$ = $state$, this.$destroy$ = $destroy$;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
const isTask = (value) => value instanceof Task;
|
|
306
|
-
const STORE_TARGET = Symbol("store.target");
|
|
307
|
-
var StoreFlags;
|
|
308
|
-
!function(StoreFlags2) {
|
|
309
|
-
StoreFlags2[StoreFlags2.NONE = 0] = "NONE", StoreFlags2[StoreFlags2.RECURSIVE = 1] = "RECURSIVE", StoreFlags2[StoreFlags2.IMMUTABLE = 2] = "IMMUTABLE";
|
|
310
|
-
}(StoreFlags || (StoreFlags = {}));
|
|
311
|
-
const isStore = (value) => STORE_TARGET in value;
|
|
312
|
-
var VNodeFlags;
|
|
313
|
-
var VNodeFlagsIndex;
|
|
314
|
-
var VNodeProps;
|
|
315
|
-
var ElementVNodeProps;
|
|
316
|
-
var TextVNodeProps;
|
|
317
|
-
var VirtualVNodeProps;
|
|
318
|
-
!function(VNodeFlags2) {
|
|
319
|
-
VNodeFlags2[VNodeFlags2.Element = 1] = "Element", VNodeFlags2[VNodeFlags2.Virtual = 2] = "Virtual", VNodeFlags2[VNodeFlags2.ELEMENT_OR_VIRTUAL_MASK = 3] = "ELEMENT_OR_VIRTUAL_MASK", VNodeFlags2[VNodeFlags2.ELEMENT_OR_TEXT_MASK = 5] = "ELEMENT_OR_TEXT_MASK", VNodeFlags2[VNodeFlags2.TYPE_MASK = 7] = "TYPE_MASK", VNodeFlags2[VNodeFlags2.INFLATED_TYPE_MASK = 15] = "INFLATED_TYPE_MASK", VNodeFlags2[VNodeFlags2.Text = 4] = "Text", VNodeFlags2[VNodeFlags2.Inflated = 8] = "Inflated", VNodeFlags2[VNodeFlags2.Resolved = 16] = "Resolved", VNodeFlags2[VNodeFlags2.Deleted = 32] = "Deleted", VNodeFlags2[VNodeFlags2.NAMESPACE_MASK = 192] = "NAMESPACE_MASK", VNodeFlags2[VNodeFlags2.NEGATED_NAMESPACE_MASK = -193] = "NEGATED_NAMESPACE_MASK", VNodeFlags2[VNodeFlags2.NS_html = 0] = "NS_html", VNodeFlags2[VNodeFlags2.NS_svg = 64] = "NS_svg", VNodeFlags2[VNodeFlags2.NS_math = 128] = "NS_math";
|
|
320
|
-
}(VNodeFlags || (VNodeFlags = {})), function(VNodeFlagsIndex2) {
|
|
321
|
-
VNodeFlagsIndex2[VNodeFlagsIndex2.mask = -256] = "mask", VNodeFlagsIndex2[VNodeFlagsIndex2.negated_mask = 255] = "negated_mask", VNodeFlagsIndex2[VNodeFlagsIndex2.shift = 8] = "shift";
|
|
322
|
-
}(VNodeFlagsIndex || (VNodeFlagsIndex = {})), function(VNodeProps2) {
|
|
323
|
-
VNodeProps2[VNodeProps2.flags = 0] = "flags", VNodeProps2[VNodeProps2.parent = 1] = "parent", VNodeProps2[VNodeProps2.previousSibling = 2] = "previousSibling", VNodeProps2[VNodeProps2.nextSibling = 3] = "nextSibling";
|
|
324
|
-
}(VNodeProps || (VNodeProps = {})), function(ElementVNodeProps2) {
|
|
325
|
-
ElementVNodeProps2[ElementVNodeProps2.firstChild = 4] = "firstChild", ElementVNodeProps2[ElementVNodeProps2.lastChild = 5] = "lastChild", ElementVNodeProps2[ElementVNodeProps2.element = 6] = "element", ElementVNodeProps2[ElementVNodeProps2.elementName = 7] = "elementName", ElementVNodeProps2[ElementVNodeProps2.PROPS_OFFSET = 8] = "PROPS_OFFSET";
|
|
326
|
-
}(ElementVNodeProps || (ElementVNodeProps = {})), function(TextVNodeProps2) {
|
|
327
|
-
TextVNodeProps2[TextVNodeProps2.node = 4] = "node", TextVNodeProps2[TextVNodeProps2.text = 5] = "text";
|
|
328
|
-
}(TextVNodeProps || (TextVNodeProps = {})), function(VirtualVNodeProps2) {
|
|
329
|
-
VirtualVNodeProps2[VirtualVNodeProps2.firstChild = 4] = "firstChild", VirtualVNodeProps2[VirtualVNodeProps2.lastChild = 5] = "lastChild", VirtualVNodeProps2[VirtualVNodeProps2.PROPS_OFFSET = 6] = "PROPS_OFFSET";
|
|
330
|
-
}(VirtualVNodeProps || (VirtualVNodeProps = {}));
|
|
331
|
-
var SiblingsArray;
|
|
332
|
-
var ChoreType;
|
|
333
|
-
!function(SiblingsArray2) {
|
|
334
|
-
SiblingsArray2[SiblingsArray2.Name = 0] = "Name", SiblingsArray2[SiblingsArray2.Key = 1] = "Key", SiblingsArray2[SiblingsArray2.VNode = 2] = "VNode", SiblingsArray2[SiblingsArray2.Size = 3] = "Size", SiblingsArray2[SiblingsArray2.NextVNode = 5] = "NextVNode";
|
|
335
|
-
}(SiblingsArray || (SiblingsArray = {})), function(ChoreType2) {
|
|
336
|
-
ChoreType2[ChoreType2.MACRO = 112] = "MACRO", ChoreType2[ChoreType2.MICRO = 15] = "MICRO", ChoreType2[ChoreType2.QRL_RESOLVE = 1] = "QRL_RESOLVE", ChoreType2[ChoreType2.RESOURCE = 2] = "RESOURCE", ChoreType2[ChoreType2.TASK = 3] = "TASK", ChoreType2[ChoreType2.NODE_DIFF = 4] = "NODE_DIFF", ChoreType2[ChoreType2.NODE_PROP = 5] = "NODE_PROP", ChoreType2[ChoreType2.COMPONENT_SSR = 6] = "COMPONENT_SSR", ChoreType2[ChoreType2.COMPONENT = 7] = "COMPONENT", ChoreType2[ChoreType2.WAIT_FOR_COMPONENTS = 16] = "WAIT_FOR_COMPONENTS", ChoreType2[ChoreType2.JOURNAL_FLUSH = 48] = "JOURNAL_FLUSH", ChoreType2[ChoreType2.VISIBLE = 64] = "VISIBLE", ChoreType2[ChoreType2.CLEANUP_VISIBLE = 80] = "CLEANUP_VISIBLE", ChoreType2[ChoreType2.WAIT_FOR_ALL = 127] = "WAIT_FOR_ALL";
|
|
337
|
-
}(ChoreType || (ChoreType = {}));
|
|
338
|
-
let _context;
|
|
339
|
-
const tryGetInvokeContext = () => {
|
|
340
|
-
if (!_context) {
|
|
341
|
-
const context = "undefined" != typeof document && document && document.__q_context__;
|
|
342
|
-
if (!context) {
|
|
343
|
-
return;
|
|
344
|
-
}
|
|
345
|
-
return isArray(context) ? document.__q_context__ = newInvokeContextFromTuple(context) : context;
|
|
339
|
+
throw qError(QError.wrappedReadOnly);
|
|
346
340
|
}
|
|
347
|
-
return _context;
|
|
348
|
-
};
|
|
349
|
-
function invoke(context, fn, ...args) {
|
|
350
|
-
return invokeApply.call(this, context, fn, args);
|
|
351
341
|
}
|
|
352
|
-
function invokeApply(context, fn, args) {
|
|
353
|
-
const previousContext = _context;
|
|
354
|
-
let returnValue;
|
|
355
|
-
try {
|
|
356
|
-
_context = context, returnValue = fn.apply(this, args);
|
|
357
|
-
} finally {
|
|
358
|
-
_context = previousContext;
|
|
359
|
-
}
|
|
360
|
-
return returnValue;
|
|
361
|
-
}
|
|
362
|
-
const newInvokeContextFromTuple = ([element, event, url]) => {
|
|
363
|
-
const container = element.closest(QContainerSelector);
|
|
364
|
-
const locale = container?.getAttribute("q:locale") || void 0;
|
|
365
|
-
return newInvokeContext(locale, void 0, element, event, url);
|
|
366
|
-
};
|
|
367
|
-
const newInvokeContext = (locale, hostElement, element, event, url) => {
|
|
368
|
-
const ctx = {
|
|
369
|
-
$url$: url,
|
|
370
|
-
$i$: 0,
|
|
371
|
-
$hostElement$: hostElement,
|
|
372
|
-
$element$: element,
|
|
373
|
-
$event$: event,
|
|
374
|
-
$qrl$: void 0,
|
|
375
|
-
$effectSubscriber$: void 0,
|
|
376
|
-
$locale$: locale || ("object" == typeof event && event && "locale" in event ? event.locale : void 0),
|
|
377
|
-
$container$: void 0
|
|
378
|
-
};
|
|
379
|
-
return ctx;
|
|
380
|
-
};
|
|
381
|
-
const untrack = (fn) => invoke(void 0, fn);
|
|
382
|
-
const trackInvocation = /* @__PURE__ */ newInvokeContext(void 0, void 0, void 0, "qRender");
|
|
383
|
-
const trackSignal = (fn, subscriber, property, container, data) => {
|
|
384
|
-
const previousSubscriber = trackInvocation.$effectSubscriber$;
|
|
385
|
-
const previousContainer = trackInvocation.$container$;
|
|
386
|
-
try {
|
|
387
|
-
return trackInvocation.$effectSubscriber$ = [subscriber, property], data && trackInvocation.$effectSubscriber$.push(data), trackInvocation.$container$ = container, invoke(trackInvocation, fn);
|
|
388
|
-
} finally {
|
|
389
|
-
trackInvocation.$effectSubscriber$ = previousSubscriber, trackInvocation.$container$ = previousContainer;
|
|
390
|
-
}
|
|
391
|
-
};
|
|
392
342
|
const _CONST_PROPS = Symbol("CONST");
|
|
393
343
|
const _VAR_PROPS = Symbol("VAR");
|
|
394
344
|
const _jsxSorted = (type, varProps, constProps, children, flags, key) => {
|
|
@@ -541,8 +491,8 @@ var VNodeJournalOpCode;
|
|
|
541
491
|
VNodeJournalOpCode2[VNodeJournalOpCode2.SetText = 1] = "SetText", VNodeJournalOpCode2[VNodeJournalOpCode2.SetAttribute = 2] = "SetAttribute", VNodeJournalOpCode2[VNodeJournalOpCode2.HoistStyles = 3] = "HoistStyles", VNodeJournalOpCode2[VNodeJournalOpCode2.Remove = 4] = "Remove", VNodeJournalOpCode2[VNodeJournalOpCode2.Insert = 5] = "Insert";
|
|
542
492
|
}(VNodeJournalOpCode || (VNodeJournalOpCode = {}));
|
|
543
493
|
const vnode_isVNode = (vNode) => vNode instanceof VNodeArray;
|
|
544
|
-
const
|
|
545
|
-
return (vNode[VNodeProps.flags] & VNodeFlags.
|
|
494
|
+
const vnode_isTextVNode = (vNode) => {
|
|
495
|
+
return (vNode[VNodeProps.flags] & VNodeFlags.Text) === VNodeFlags.Text;
|
|
546
496
|
};
|
|
547
497
|
const ensureElementOrVirtualVNode = (vNode) => {
|
|
548
498
|
assertTrue(!!(vNode[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK), "Expecting ElementVNode or VirtualVNode was: " + vnode_getNodeTypeName(vNode));
|
|
@@ -622,7 +572,7 @@ const vnode_getPropStartIndex = (vnode) => {
|
|
|
622
572
|
if (type === VNodeFlags.Virtual) {
|
|
623
573
|
return VirtualVNodeProps.PROPS_OFFSET;
|
|
624
574
|
}
|
|
625
|
-
throw
|
|
575
|
+
throw qError(QError.invalidVNodeType, [type]);
|
|
626
576
|
};
|
|
627
577
|
const VNodeArray = class VNode extends Array {
|
|
628
578
|
static createElement(flags, parent, previousSibling, nextSibling, firstChild, lastChild, element, elementName) {
|
|
@@ -641,13 +591,60 @@ const VNodeArray = class VNode extends Array {
|
|
|
641
591
|
super(), this.push(flags, parent, previousSibling, nextSibling);
|
|
642
592
|
}
|
|
643
593
|
};
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
!
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
}
|
|
594
|
+
let _context;
|
|
595
|
+
const tryGetInvokeContext = () => {
|
|
596
|
+
if (!_context) {
|
|
597
|
+
const context = "undefined" != typeof document && document && document.__q_context__;
|
|
598
|
+
if (!context) {
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
return isArray(context) ? document.__q_context__ = newInvokeContextFromTuple(context) : context;
|
|
602
|
+
}
|
|
603
|
+
return _context;
|
|
604
|
+
};
|
|
605
|
+
function invoke(context, fn, ...args) {
|
|
606
|
+
return invokeApply.call(this, context, fn, args);
|
|
607
|
+
}
|
|
608
|
+
function invokeApply(context, fn, args) {
|
|
609
|
+
const previousContext = _context;
|
|
610
|
+
let returnValue;
|
|
611
|
+
try {
|
|
612
|
+
_context = context, returnValue = fn.apply(this, args);
|
|
613
|
+
} finally {
|
|
614
|
+
_context = previousContext;
|
|
615
|
+
}
|
|
616
|
+
return returnValue;
|
|
617
|
+
}
|
|
618
|
+
const newInvokeContextFromTuple = ([element, event, url]) => {
|
|
619
|
+
const container = element.closest(QContainerSelector);
|
|
620
|
+
const locale = container?.getAttribute("q:locale") || void 0;
|
|
621
|
+
return newInvokeContext(locale, void 0, element, event, url);
|
|
622
|
+
};
|
|
623
|
+
const newInvokeContext = (locale, hostElement, element, event, url) => {
|
|
624
|
+
const ctx = {
|
|
625
|
+
$url$: url,
|
|
626
|
+
$i$: 0,
|
|
627
|
+
$hostElement$: hostElement,
|
|
628
|
+
$element$: element,
|
|
629
|
+
$event$: event,
|
|
630
|
+
$qrl$: void 0,
|
|
631
|
+
$effectSubscriber$: void 0,
|
|
632
|
+
$locale$: locale || ("object" == typeof event && event && "locale" in event ? event.locale : void 0),
|
|
633
|
+
$container$: void 0
|
|
634
|
+
};
|
|
635
|
+
return ctx;
|
|
636
|
+
};
|
|
637
|
+
const untrack = (fn) => invoke(void 0, fn);
|
|
638
|
+
const trackInvocation = /* @__PURE__ */ newInvokeContext(void 0, void 0, void 0, "qRender");
|
|
639
|
+
const trackSignal = (fn, subscriber, property, container, data) => {
|
|
640
|
+
const previousSubscriber = trackInvocation.$effectSubscriber$;
|
|
641
|
+
const previousContainer = trackInvocation.$container$;
|
|
642
|
+
try {
|
|
643
|
+
return trackInvocation.$effectSubscriber$ = [subscriber, property], data && trackInvocation.$effectSubscriber$.push(data), trackInvocation.$container$ = container, invoke(trackInvocation, fn);
|
|
644
|
+
} finally {
|
|
645
|
+
trackInvocation.$effectSubscriber$ = previousSubscriber, trackInvocation.$container$ = previousContainer;
|
|
646
|
+
}
|
|
647
|
+
};
|
|
651
648
|
var TypeIds;
|
|
652
649
|
var Constants;
|
|
653
650
|
!function(TypeIds2) {
|