@fictjs/runtime 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced.cjs +8 -8
- package/dist/advanced.d.cts +2 -0
- package/dist/advanced.d.ts +2 -0
- package/dist/advanced.js +3 -3
- package/dist/{chunk-3U7EBKEU.cjs → chunk-2U6M3LKS.cjs} +118 -111
- package/dist/chunk-2U6M3LKS.cjs.map +1 -0
- package/dist/{chunk-TEYUDPTA.js → chunk-3WD7QD5G.js} +2 -2
- package/dist/{chunk-3A4VW6AK.cjs → chunk-5YTFFAVU.cjs} +7 -7
- package/dist/{chunk-3A4VW6AK.cjs.map → chunk-5YTFFAVU.cjs.map} +1 -1
- package/dist/{chunk-LU2LD2WJ.js → chunk-UHXUEGQH.js} +2 -2
- package/dist/{chunk-URDFDRHR.cjs → chunk-W525IQWC.cjs} +16 -16
- package/dist/{chunk-URDFDRHR.cjs.map → chunk-W525IQWC.cjs.map} +1 -1
- package/dist/{chunk-YVS4WJ2W.js → chunk-YVDWXY44.js} +118 -111
- package/dist/chunk-YVDWXY44.js.map +1 -0
- package/dist/index.cjs +38 -38
- package/dist/index.dev.js +117 -110
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/internal.cjs +34 -34
- package/dist/internal.js +2 -2
- package/package.json +1 -1
- package/src/cycle-guard.ts +113 -104
- package/dist/chunk-3U7EBKEU.cjs.map +0 -1
- package/dist/chunk-YVS4WJ2W.js.map +0 -1
- /package/dist/{chunk-TEYUDPTA.js.map → chunk-3WD7QD5G.js.map} +0 -0
- /package/dist/{chunk-LU2LD2WJ.js.map → chunk-UHXUEGQH.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkW525IQWCcjs = require('./chunk-W525IQWC.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -34,7 +34,7 @@ var _chunkURDFDRHRcjs = require('./chunk-URDFDRHR.cjs');
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
var
|
|
37
|
+
var _chunk2U6M3LKScjs = require('./chunk-2U6M3LKS.cjs');
|
|
38
38
|
|
|
39
39
|
// src/ref.ts
|
|
40
40
|
function createRef() {
|
|
@@ -46,7 +46,7 @@ function ErrorBoundary(props) {
|
|
|
46
46
|
const fragment = document.createDocumentFragment();
|
|
47
47
|
const marker = document.createComment("fict:error-boundary");
|
|
48
48
|
fragment.appendChild(marker);
|
|
49
|
-
const hostRoot =
|
|
49
|
+
const hostRoot = _chunk2U6M3LKScjs.getCurrentRoot.call(void 0, );
|
|
50
50
|
let cleanup;
|
|
51
51
|
let activeNodes = [];
|
|
52
52
|
let renderingFallback = false;
|
|
@@ -64,25 +64,25 @@ function ErrorBoundary(props) {
|
|
|
64
64
|
cleanup = void 0;
|
|
65
65
|
}
|
|
66
66
|
if (activeNodes.length) {
|
|
67
|
-
|
|
67
|
+
_chunk2U6M3LKScjs.removeNodes.call(void 0, activeNodes);
|
|
68
68
|
activeNodes = [];
|
|
69
69
|
}
|
|
70
70
|
if (value == null || value === false) {
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
const root =
|
|
74
|
-
const prev =
|
|
73
|
+
const root = _chunk2U6M3LKScjs.createRootContext.call(void 0, hostRoot);
|
|
74
|
+
const prev = _chunk2U6M3LKScjs.pushRoot.call(void 0, root);
|
|
75
75
|
let nodes = [];
|
|
76
76
|
try {
|
|
77
|
-
const output =
|
|
78
|
-
nodes =
|
|
77
|
+
const output = _chunk2U6M3LKScjs.createElement.call(void 0, value);
|
|
78
|
+
nodes = _chunk2U6M3LKScjs.toNodeArray.call(void 0, output);
|
|
79
79
|
const parentNode = marker.parentNode;
|
|
80
80
|
if (parentNode) {
|
|
81
|
-
|
|
81
|
+
_chunk2U6M3LKScjs.insertNodesBefore.call(void 0, parentNode, nodes, marker);
|
|
82
82
|
}
|
|
83
83
|
} catch (err) {
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
_chunk2U6M3LKScjs.popRoot.call(void 0, prev);
|
|
85
|
+
_chunk2U6M3LKScjs.destroyRoot.call(void 0, root);
|
|
86
86
|
if (renderingFallback) {
|
|
87
87
|
throw err;
|
|
88
88
|
}
|
|
@@ -97,11 +97,11 @@ function ErrorBoundary(props) {
|
|
|
97
97
|
}
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
_chunk2U6M3LKScjs.popRoot.call(void 0, prev);
|
|
101
|
+
_chunk2U6M3LKScjs.flushOnMount.call(void 0, root);
|
|
102
102
|
cleanup = () => {
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
_chunk2U6M3LKScjs.destroyRoot.call(void 0, root);
|
|
104
|
+
_chunk2U6M3LKScjs.removeNodes.call(void 0, nodes);
|
|
105
105
|
};
|
|
106
106
|
activeNodes = nodes;
|
|
107
107
|
};
|
|
@@ -110,7 +110,7 @@ function ErrorBoundary(props) {
|
|
|
110
110
|
renderValue(toView(null));
|
|
111
111
|
};
|
|
112
112
|
renderValue(_nullishCoalesce(props.children, () => ( null)));
|
|
113
|
-
|
|
113
|
+
_chunk2U6M3LKScjs.registerErrorHandler.call(void 0, (err) => {
|
|
114
114
|
renderValue(toView(err));
|
|
115
115
|
_optionalChain([props, 'access', _5 => _5.onError, 'optionalCall', _6 => _6(err)]);
|
|
116
116
|
return true;
|
|
@@ -119,7 +119,7 @@ function ErrorBoundary(props) {
|
|
|
119
119
|
const isGetter = typeof props.resetKeys === "function" && props.resetKeys.length === 0;
|
|
120
120
|
const getter = isGetter ? props.resetKeys : void 0;
|
|
121
121
|
let prev = isGetter ? getter() : props.resetKeys;
|
|
122
|
-
|
|
122
|
+
_chunk2U6M3LKScjs.createEffect.call(void 0, () => {
|
|
123
123
|
const next = getter ? getter() : props.resetKeys;
|
|
124
124
|
if (prev !== next) {
|
|
125
125
|
prev = next;
|
|
@@ -148,10 +148,10 @@ function createSuspenseToken() {
|
|
|
148
148
|
}
|
|
149
149
|
var isThenable = (value) => typeof value === "object" && value !== null && typeof value.then === "function";
|
|
150
150
|
function Suspense(props) {
|
|
151
|
-
const pending =
|
|
151
|
+
const pending = _chunk2U6M3LKScjs.signal.call(void 0, 0);
|
|
152
152
|
let resolvedOnce = false;
|
|
153
153
|
let epoch = 0;
|
|
154
|
-
const hostRoot =
|
|
154
|
+
const hostRoot = _chunk2U6M3LKScjs.getCurrentRoot.call(void 0, );
|
|
155
155
|
const toFallback = (err) => typeof props.fallback === "function" ? props.fallback(err) : props.fallback;
|
|
156
156
|
const renderView = (view) => {
|
|
157
157
|
if (cleanup) {
|
|
@@ -159,41 +159,41 @@ function Suspense(props) {
|
|
|
159
159
|
cleanup = void 0;
|
|
160
160
|
}
|
|
161
161
|
if (activeNodes.length) {
|
|
162
|
-
|
|
162
|
+
_chunk2U6M3LKScjs.removeNodes.call(void 0, activeNodes);
|
|
163
163
|
activeNodes = [];
|
|
164
164
|
}
|
|
165
165
|
if (view == null || view === false) {
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
|
-
const root =
|
|
169
|
-
const prev =
|
|
168
|
+
const root = _chunk2U6M3LKScjs.createRootContext.call(void 0, hostRoot);
|
|
169
|
+
const prev = _chunk2U6M3LKScjs.pushRoot.call(void 0, root);
|
|
170
170
|
let nodes = [];
|
|
171
171
|
try {
|
|
172
|
-
const output =
|
|
173
|
-
nodes =
|
|
172
|
+
const output = _chunk2U6M3LKScjs.createElement.call(void 0, view);
|
|
173
|
+
nodes = _chunk2U6M3LKScjs.toNodeArray.call(void 0, output);
|
|
174
174
|
const suspendedAttempt = root.suspended || nodes.length > 0 && nodes.every((node) => node instanceof Comment && node.data === "fict:suspend");
|
|
175
175
|
if (suspendedAttempt) {
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
_chunk2U6M3LKScjs.popRoot.call(void 0, prev);
|
|
177
|
+
_chunk2U6M3LKScjs.destroyRoot.call(void 0, root);
|
|
178
178
|
return;
|
|
179
179
|
}
|
|
180
180
|
const parentNode = marker.parentNode;
|
|
181
181
|
if (parentNode) {
|
|
182
|
-
|
|
182
|
+
_chunk2U6M3LKScjs.insertNodesBefore.call(void 0, parentNode, nodes, marker);
|
|
183
183
|
}
|
|
184
184
|
} catch (err) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
if (!
|
|
185
|
+
_chunk2U6M3LKScjs.popRoot.call(void 0, prev);
|
|
186
|
+
_chunk2U6M3LKScjs.destroyRoot.call(void 0, root);
|
|
187
|
+
if (!_chunk2U6M3LKScjs.handleError.call(void 0, err, { source: "render" }, hostRoot)) {
|
|
188
188
|
throw err;
|
|
189
189
|
}
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
_chunk2U6M3LKScjs.popRoot.call(void 0, prev);
|
|
193
|
+
_chunk2U6M3LKScjs.flushOnMount.call(void 0, root);
|
|
194
194
|
cleanup = () => {
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
_chunk2U6M3LKScjs.destroyRoot.call(void 0, root);
|
|
196
|
+
_chunk2U6M3LKScjs.removeNodes.call(void 0, nodes);
|
|
197
197
|
};
|
|
198
198
|
activeNodes = nodes;
|
|
199
199
|
};
|
|
@@ -208,7 +208,7 @@ function Suspense(props) {
|
|
|
208
208
|
_optionalChain([props, 'access', _7 => _7.onResolve, 'optionalCall', _8 => _8()]);
|
|
209
209
|
}
|
|
210
210
|
};
|
|
211
|
-
|
|
211
|
+
_chunk2U6M3LKScjs.registerSuspenseHandler.call(void 0, (token) => {
|
|
212
212
|
const tokenEpoch = epoch;
|
|
213
213
|
pending(pending() + 1);
|
|
214
214
|
renderView(toFallback());
|
|
@@ -233,7 +233,7 @@ function Suspense(props) {
|
|
|
233
233
|
const newPending = Math.max(0, pending() - 1);
|
|
234
234
|
pending(newPending);
|
|
235
235
|
_optionalChain([props, 'access', _9 => _9.onReject, 'optionalCall', _10 => _10(err)]);
|
|
236
|
-
if (!
|
|
236
|
+
if (!_chunk2U6M3LKScjs.handleError.call(void 0, err, { source: "render" }, hostRoot)) {
|
|
237
237
|
throw err;
|
|
238
238
|
}
|
|
239
239
|
}
|
|
@@ -247,7 +247,7 @@ function Suspense(props) {
|
|
|
247
247
|
const isGetter = typeof props.resetKeys === "function" && props.resetKeys.length === 0;
|
|
248
248
|
const getter = isGetter ? props.resetKeys : void 0;
|
|
249
249
|
let prev = isGetter ? getter() : props.resetKeys;
|
|
250
|
-
|
|
250
|
+
_chunk2U6M3LKScjs.createEffect.call(void 0, () => {
|
|
251
251
|
const next = getter ? getter() : props.resetKeys;
|
|
252
252
|
if (prev !== next) {
|
|
253
253
|
prev = next;
|
|
@@ -284,5 +284,5 @@ function Suspense(props) {
|
|
|
284
284
|
|
|
285
285
|
|
|
286
286
|
|
|
287
|
-
exports.ErrorBoundary = ErrorBoundary; exports.Fragment =
|
|
287
|
+
exports.ErrorBoundary = ErrorBoundary; exports.Fragment = _chunk2U6M3LKScjs.Fragment; exports.Suspense = Suspense; exports.batch = _chunk2U6M3LKScjs.batch2; exports.createContext = _chunkW525IQWCcjs.createContext; exports.createEffect = _chunk2U6M3LKScjs.createEffect; exports.createElement = _chunk2U6M3LKScjs.createElement; exports.createMemo = _chunk2U6M3LKScjs.createMemo; exports.createPortal = _chunk2U6M3LKScjs.createPortal; exports.createRef = createRef; exports.createRoot = _chunk2U6M3LKScjs.createRoot; exports.createSuspenseToken = createSuspenseToken; exports.hasContext = _chunkW525IQWCcjs.hasContext; exports.mergeProps = _chunk2U6M3LKScjs.mergeProps; exports.onCleanup = _chunk2U6M3LKScjs.onCleanup; exports.onDestroy = _chunk2U6M3LKScjs.onDestroy; exports.onMount = _chunk2U6M3LKScjs.onMount; exports.prop = _chunk2U6M3LKScjs.prop; exports.render = _chunk2U6M3LKScjs.render; exports.startTransition = _chunk2U6M3LKScjs.startTransition; exports.untrack = _chunk2U6M3LKScjs.untrack2; exports.useContext = _chunkW525IQWCcjs.useContext; exports.useDeferredValue = _chunk2U6M3LKScjs.useDeferredValue; exports.useTransition = _chunk2U6M3LKScjs.useTransition;
|
|
288
288
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.dev.js
CHANGED
|
@@ -21,110 +21,117 @@ var endFlushGuard = () => {
|
|
|
21
21
|
var enterRootGuard = () => true;
|
|
22
22
|
var exitRootGuard = () => {
|
|
23
23
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
effectRunsThisFlush = 0;
|
|
78
|
-
};
|
|
79
|
-
enterRootGuard = (root) => {
|
|
80
|
-
const depth = (rootDepth.get(root) ?? 0) + 1;
|
|
81
|
-
if (depth > options.maxRootReentrantDepth) {
|
|
82
|
-
const message = `[fict] cycle protection triggered: root-reentry`;
|
|
83
|
-
if (options.devMode) {
|
|
84
|
-
throw new Error(message);
|
|
85
|
-
}
|
|
86
|
-
if (!rootWarned) {
|
|
87
|
-
rootWarned = true;
|
|
88
|
-
console.warn(message, { depth });
|
|
89
|
-
}
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
rootDepth.set(root, depth);
|
|
93
|
-
return true;
|
|
94
|
-
};
|
|
95
|
-
exitRootGuard = (root) => {
|
|
96
|
-
const depth = rootDepth.get(root);
|
|
97
|
-
if (depth === void 0) return;
|
|
98
|
-
if (depth <= 1) {
|
|
99
|
-
rootDepth.delete(root);
|
|
100
|
-
} else {
|
|
101
|
-
rootDepth.set(root, depth - 1);
|
|
24
|
+
var defaultOptions = {
|
|
25
|
+
enabled: isDev,
|
|
26
|
+
maxFlushCyclesPerMicrotask: 1e4,
|
|
27
|
+
maxEffectRunsPerFlush: 2e4,
|
|
28
|
+
windowSize: 5,
|
|
29
|
+
highUsageRatio: 0.8,
|
|
30
|
+
maxRootReentrantDepth: 10,
|
|
31
|
+
enableWindowWarning: true,
|
|
32
|
+
devMode: false
|
|
33
|
+
};
|
|
34
|
+
var enabled = defaultOptions.enabled;
|
|
35
|
+
var options = {
|
|
36
|
+
...defaultOptions
|
|
37
|
+
};
|
|
38
|
+
var effectRunsThisFlush = 0;
|
|
39
|
+
var windowUsage = [];
|
|
40
|
+
var rootDepth = /* @__PURE__ */ new WeakMap();
|
|
41
|
+
var flushWarned = false;
|
|
42
|
+
var rootWarned = false;
|
|
43
|
+
var windowWarned = false;
|
|
44
|
+
setCycleProtectionOptions = (opts) => {
|
|
45
|
+
if (typeof opts.enabled === "boolean") {
|
|
46
|
+
enabled = opts.enabled;
|
|
47
|
+
}
|
|
48
|
+
options = { ...options, ...opts };
|
|
49
|
+
};
|
|
50
|
+
resetCycleProtectionStateForTests = () => {
|
|
51
|
+
options = { ...defaultOptions };
|
|
52
|
+
enabled = defaultOptions.enabled;
|
|
53
|
+
effectRunsThisFlush = 0;
|
|
54
|
+
windowUsage = [];
|
|
55
|
+
rootDepth = /* @__PURE__ */ new WeakMap();
|
|
56
|
+
flushWarned = false;
|
|
57
|
+
rootWarned = false;
|
|
58
|
+
windowWarned = false;
|
|
59
|
+
};
|
|
60
|
+
beginFlushGuard = () => {
|
|
61
|
+
if (!enabled) return;
|
|
62
|
+
effectRunsThisFlush = 0;
|
|
63
|
+
flushWarned = false;
|
|
64
|
+
windowWarned = false;
|
|
65
|
+
};
|
|
66
|
+
beforeEffectRunGuard = () => {
|
|
67
|
+
if (!enabled) return true;
|
|
68
|
+
const next = ++effectRunsThisFlush;
|
|
69
|
+
if (next > options.maxFlushCyclesPerMicrotask || next > options.maxEffectRunsPerFlush) {
|
|
70
|
+
const message = `[fict] cycle protection triggered: flush-budget-exceeded`;
|
|
71
|
+
if (options.devMode) {
|
|
72
|
+
throw new Error(message);
|
|
73
|
+
}
|
|
74
|
+
if (!flushWarned) {
|
|
75
|
+
flushWarned = true;
|
|
76
|
+
console.warn(message, { effectRuns: next });
|
|
102
77
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
};
|
|
82
|
+
endFlushGuard = () => {
|
|
83
|
+
if (!enabled) return;
|
|
84
|
+
recordWindowUsage(effectRunsThisFlush, options.maxFlushCyclesPerMicrotask);
|
|
85
|
+
effectRunsThisFlush = 0;
|
|
86
|
+
};
|
|
87
|
+
enterRootGuard = (root) => {
|
|
88
|
+
if (!enabled) return true;
|
|
89
|
+
const depth = (rootDepth.get(root) ?? 0) + 1;
|
|
90
|
+
if (depth > options.maxRootReentrantDepth) {
|
|
91
|
+
const message = `[fict] cycle protection triggered: root-reentry`;
|
|
92
|
+
if (options.devMode) {
|
|
93
|
+
throw new Error(message);
|
|
94
|
+
}
|
|
95
|
+
if (!rootWarned) {
|
|
96
|
+
rootWarned = true;
|
|
97
|
+
console.warn(message, { depth });
|
|
120
98
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
rootDepth.set(root, depth);
|
|
102
|
+
return true;
|
|
103
|
+
};
|
|
104
|
+
exitRootGuard = (root) => {
|
|
105
|
+
if (!enabled) return;
|
|
106
|
+
const depth = rootDepth.get(root);
|
|
107
|
+
if (depth === void 0) return;
|
|
108
|
+
if (depth <= 1) {
|
|
109
|
+
rootDepth.delete(root);
|
|
110
|
+
} else {
|
|
111
|
+
rootDepth.set(root, depth - 1);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
var recordWindowUsage = (used, budget) => {
|
|
115
|
+
if (!options.enableWindowWarning) return;
|
|
116
|
+
const entry = { used, budget };
|
|
117
|
+
windowUsage.push(entry);
|
|
118
|
+
if (windowUsage.length > options.windowSize) {
|
|
119
|
+
windowUsage.shift();
|
|
120
|
+
}
|
|
121
|
+
if (windowWarned) return;
|
|
122
|
+
if (windowUsage.length >= options.windowSize && windowUsage.every((item) => item.budget > 0 && item.used / item.budget >= options.highUsageRatio)) {
|
|
123
|
+
windowWarned = true;
|
|
124
|
+
reportCycle("high-usage-window", {
|
|
125
|
+
windowSize: options.windowSize,
|
|
126
|
+
ratio: options.highUsageRatio
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
var reportCycle = (reason, detail = void 0) => {
|
|
131
|
+
const hook = getDevtoolsHook();
|
|
132
|
+
hook?.cycleDetected?.(detail ? { reason, detail } : { reason });
|
|
133
|
+
console.warn(`[fict] cycle protection triggered: ${reason}`, detail ?? "");
|
|
134
|
+
};
|
|
128
135
|
|
|
129
136
|
// src/lifecycle.ts
|
|
130
137
|
var isDev2 = true ? true : typeof process === "undefined" || process.env?.NODE_ENV !== "production";
|
|
@@ -208,8 +215,8 @@ function destroyRoot(root) {
|
|
|
208
215
|
globalSuspenseHandlers.delete(root);
|
|
209
216
|
}
|
|
210
217
|
}
|
|
211
|
-
function createRoot(fn,
|
|
212
|
-
const parent =
|
|
218
|
+
function createRoot(fn, options2) {
|
|
219
|
+
const parent = options2?.inherit ? currentRoot : void 0;
|
|
213
220
|
const root = createRootContext(parent);
|
|
214
221
|
const prev = pushRoot(root);
|
|
215
222
|
let value;
|
|
@@ -1953,11 +1960,11 @@ function globalEventHandler(e) {
|
|
|
1953
1960
|
}
|
|
1954
1961
|
retarget(oriTarget);
|
|
1955
1962
|
}
|
|
1956
|
-
function bindEvent(el, eventName, handler,
|
|
1963
|
+
function bindEvent(el, eventName, handler, options2) {
|
|
1957
1964
|
if (handler == null) return () => {
|
|
1958
1965
|
};
|
|
1959
1966
|
const rootRef = getCurrentRoot();
|
|
1960
|
-
const shouldDelegate =
|
|
1967
|
+
const shouldDelegate = options2 == null && DelegatedEvents.has(eventName);
|
|
1961
1968
|
if (shouldDelegate) {
|
|
1962
1969
|
const key = `$$${eventName}`;
|
|
1963
1970
|
delegateEvents([eventName]);
|
|
@@ -1988,8 +1995,8 @@ function bindEvent(el, eventName, handler, options) {
|
|
|
1988
1995
|
throw err;
|
|
1989
1996
|
}
|
|
1990
1997
|
};
|
|
1991
|
-
el.addEventListener(eventName, wrapped,
|
|
1992
|
-
const cleanup = () => el.removeEventListener(eventName, wrapped,
|
|
1998
|
+
el.addEventListener(eventName, wrapped, options2);
|
|
1999
|
+
const cleanup = () => el.removeEventListener(eventName, wrapped, options2);
|
|
1993
2000
|
registerRootCleanup(cleanup);
|
|
1994
2001
|
return cleanup;
|
|
1995
2002
|
}
|
|
@@ -2211,12 +2218,12 @@ function mergeProps(...sources) {
|
|
|
2211
2218
|
}
|
|
2212
2219
|
});
|
|
2213
2220
|
}
|
|
2214
|
-
function prop(getter,
|
|
2221
|
+
function prop(getter, options2) {
|
|
2215
2222
|
if (isPropGetter(getter)) {
|
|
2216
2223
|
return getter;
|
|
2217
2224
|
}
|
|
2218
2225
|
const fn = getter;
|
|
2219
|
-
const unwrap =
|
|
2226
|
+
const unwrap = options2?.unwrap !== false;
|
|
2220
2227
|
return __fictProp(
|
|
2221
2228
|
createMemo(() => {
|
|
2222
2229
|
const value = fn();
|