@rectify-dev/core 2.1.0 → 2.4.0
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/README.md +445 -0
- package/dist/index.cjs +825 -403
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +127 -3
- package/dist/index.d.ts +127 -3
- package/dist/index.js +822 -405
- package/dist/index.js.map +1 -1
- package/dist/jsx-runtime.d.cts +6 -0
- package/dist/jsx-runtime.d.ts +6 -0
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __name } from './chunk-2FA4QXYL.js';
|
|
2
2
|
export { Fragment, jsx } from './chunk-2FA4QXYL.js';
|
|
3
|
-
import { isFunction, shallowEqual, createElementFromRectifyNode, isValidRectifyElement, isArray, isPlainObject, omit, RECTIFY_FRAGMENT_TYPE, RECTIFY_TEXT_TYPE, RECTIFY_ELEMENT_TYPE } from '@rectify-dev/shared';
|
|
3
|
+
import { isFunction, shallowEqual, createElementFromRectifyNode, isValidRectifyElement, isArray, isPlainObject, omit, RECTIFY_FRAGMENT_TYPE, RECTIFY_TEXT_TYPE, RECTIFY_ELEMENT_TYPE, RECTIFY_PORTAL_TYPE } from '@rectify-dev/shared';
|
|
4
4
|
|
|
5
5
|
// ../rectify-dom-binding/src/events/RectifyEventRegistry.ts
|
|
6
6
|
var allNativeEvents = /* @__PURE__ */ new Set();
|
|
@@ -189,6 +189,48 @@ var listenToNativeEvent = /* @__PURE__ */ __name((domEventName, target) => {
|
|
|
189
189
|
// ../rectify-dom-binding/src/clients/RectifyDomProperties.ts
|
|
190
190
|
var isEvent = /* @__PURE__ */ __name((k) => k.startsWith("on"), "isEvent");
|
|
191
191
|
var isProperty = /* @__PURE__ */ __name((k) => k !== "children" && k !== "ref" && !isEvent(k), "isProperty");
|
|
192
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
193
|
+
var SVG_CAMEL_ATTRS = /* @__PURE__ */ new Set([
|
|
194
|
+
"viewBox",
|
|
195
|
+
"preserveAspectRatio",
|
|
196
|
+
"gradientTransform",
|
|
197
|
+
"gradientUnits",
|
|
198
|
+
"patternTransform",
|
|
199
|
+
"patternUnits",
|
|
200
|
+
"patternContentUnits",
|
|
201
|
+
"clipPathUnits",
|
|
202
|
+
"markerUnits",
|
|
203
|
+
"markerWidth",
|
|
204
|
+
"markerHeight",
|
|
205
|
+
"refX",
|
|
206
|
+
"refY",
|
|
207
|
+
"textLength",
|
|
208
|
+
"startOffset",
|
|
209
|
+
"baseFrequency",
|
|
210
|
+
"numOctaves",
|
|
211
|
+
"stdDeviation",
|
|
212
|
+
"filterUnits",
|
|
213
|
+
"primitiveUnits",
|
|
214
|
+
"tableValues",
|
|
215
|
+
"kernelMatrix",
|
|
216
|
+
"kernelUnitLength",
|
|
217
|
+
"targetX",
|
|
218
|
+
"targetY",
|
|
219
|
+
"xChannelSelector",
|
|
220
|
+
"yChannelSelector",
|
|
221
|
+
"diffuseConstant",
|
|
222
|
+
"surfaceScale",
|
|
223
|
+
"specularConstant",
|
|
224
|
+
"specularExponent",
|
|
225
|
+
"limitingConeAngle",
|
|
226
|
+
"pointsAtX",
|
|
227
|
+
"pointsAtY",
|
|
228
|
+
"pointsAtZ",
|
|
229
|
+
"repeatX",
|
|
230
|
+
"repeatY"
|
|
231
|
+
]);
|
|
232
|
+
var camelToKebab = /* @__PURE__ */ __name((s) => s.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase()), "camelToKebab");
|
|
233
|
+
var svgAttrName = /* @__PURE__ */ __name((k) => SVG_CAMEL_ATTRS.has(k) ? k : camelToKebab(k), "svgAttrName");
|
|
192
234
|
var unitlessProperties = /* @__PURE__ */ new Set([
|
|
193
235
|
"zIndex",
|
|
194
236
|
"opacity",
|
|
@@ -211,14 +253,16 @@ function convertStyleObjectToString(styleObj) {
|
|
|
211
253
|
__name(convertStyleObjectToString, "convertStyleObjectToString");
|
|
212
254
|
var applyPropsToDom = /* @__PURE__ */ __name((node, prevProps = {}, nextProps = {}) => {
|
|
213
255
|
const element = node;
|
|
256
|
+
const isSvg = element.namespaceURI === SVG_NS;
|
|
214
257
|
const eventNode = getEventHandlerListeners(element) || /* @__PURE__ */ new Map();
|
|
215
258
|
for (const k in prevProps) {
|
|
216
259
|
if (isEvent(k) && !(k in nextProps)) {
|
|
217
260
|
eventNode.delete(k);
|
|
218
261
|
}
|
|
219
262
|
if (isProperty(k) && !(k in nextProps)) {
|
|
263
|
+
const attrName = isSvg ? svgAttrName(k) : k;
|
|
220
264
|
element[k] = "";
|
|
221
|
-
element.removeAttribute(
|
|
265
|
+
element.removeAttribute(attrName);
|
|
222
266
|
}
|
|
223
267
|
}
|
|
224
268
|
for (const k in nextProps) {
|
|
@@ -228,13 +272,22 @@ var applyPropsToDom = /* @__PURE__ */ __name((node, prevProps = {}, nextProps =
|
|
|
228
272
|
eventNode.set(k, nextProps[k]);
|
|
229
273
|
}
|
|
230
274
|
} else if (k === "style") {
|
|
231
|
-
|
|
275
|
+
if (typeof nextProps[k] === "string") {
|
|
276
|
+
element.setAttribute("style", nextProps[k]);
|
|
277
|
+
} else {
|
|
278
|
+
element.setAttribute("style", convertStyleObjectToString(nextProps[k]));
|
|
279
|
+
}
|
|
232
280
|
} else {
|
|
233
281
|
const v = nextProps[k];
|
|
234
|
-
if (k === "className")
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
282
|
+
if (k === "className") {
|
|
283
|
+
element.setAttribute("class", v ?? "");
|
|
284
|
+
} else if (v === false || v === null || v === void 0) {
|
|
285
|
+
const attrName = isSvg ? svgAttrName(k) : k;
|
|
286
|
+
element.removeAttribute(attrName);
|
|
287
|
+
} else {
|
|
288
|
+
const attrName = isSvg ? svgAttrName(k) : k;
|
|
289
|
+
element.setAttribute(attrName, String(v));
|
|
290
|
+
}
|
|
238
291
|
}
|
|
239
292
|
}
|
|
240
293
|
setEventHandlerListeners(element, eventNode);
|
|
@@ -258,12 +311,16 @@ var IdleLane = 16;
|
|
|
258
311
|
|
|
259
312
|
// ../rectify-reconciler/src/RectifyFiberWorkTags.ts
|
|
260
313
|
var FunctionComponent = /* @__PURE__ */ Symbol.for("rectify.function_component");
|
|
314
|
+
var ClassComponent = /* @__PURE__ */ Symbol.for("rectify.class_component");
|
|
261
315
|
var HostComponent = /* @__PURE__ */ Symbol.for("rectify.host_component");
|
|
262
316
|
var HostText = /* @__PURE__ */ Symbol.for("rectify.host_text");
|
|
263
317
|
var HostRoot = /* @__PURE__ */ Symbol.for("rectify.host_root");
|
|
264
318
|
var FragmentComponent = /* @__PURE__ */ Symbol.for("rectify.fragment_component");
|
|
265
319
|
var ContextProvider = /* @__PURE__ */ Symbol.for("rectify.context_provider");
|
|
266
320
|
var MemoComponent = /* @__PURE__ */ Symbol.for("rectify.memo_component");
|
|
321
|
+
var LazyComponent = /* @__PURE__ */ Symbol.for("rectify.lazy_component");
|
|
322
|
+
var SuspenseComponent = /* @__PURE__ */ Symbol.for("rectify.suspense_component");
|
|
323
|
+
var PortalComponent = /* @__PURE__ */ Symbol.for("rectify.portal_component");
|
|
267
324
|
var addFlagToFiber = /* @__PURE__ */ __name((fiber, flag) => {
|
|
268
325
|
if (hasFlagOnFiber(fiber, flag)) return;
|
|
269
326
|
fiber.flags |= flag;
|
|
@@ -278,6 +335,8 @@ var hasFlagOnFiber = /* @__PURE__ */ __name((fiber, flag) => {
|
|
|
278
335
|
}, "hasFlagOnFiber");
|
|
279
336
|
var getFiberTagFromElement = /* @__PURE__ */ __name((element) => {
|
|
280
337
|
switch (element.$$typeof) {
|
|
338
|
+
case RECTIFY_PORTAL_TYPE:
|
|
339
|
+
return PortalComponent;
|
|
281
340
|
case RECTIFY_ELEMENT_TYPE:
|
|
282
341
|
if (isFunction(element.type) && element.type?._context === element.type) {
|
|
283
342
|
return ContextProvider;
|
|
@@ -285,6 +344,15 @@ var getFiberTagFromElement = /* @__PURE__ */ __name((element) => {
|
|
|
285
344
|
if (isFunction(element.type) && element.type?._isMemo === true) {
|
|
286
345
|
return MemoComponent;
|
|
287
346
|
}
|
|
347
|
+
if (element.type?._isSuspense === true) {
|
|
348
|
+
return SuspenseComponent;
|
|
349
|
+
}
|
|
350
|
+
if (element.type?._isLazy === true) {
|
|
351
|
+
return LazyComponent;
|
|
352
|
+
}
|
|
353
|
+
if (element.type?._isClassComponent === true) {
|
|
354
|
+
return ClassComponent;
|
|
355
|
+
}
|
|
288
356
|
return isFunction(element.type) ? FunctionComponent : HostComponent;
|
|
289
357
|
case RECTIFY_TEXT_TYPE:
|
|
290
358
|
return HostText;
|
|
@@ -294,12 +362,53 @@ var getFiberTagFromElement = /* @__PURE__ */ __name((element) => {
|
|
|
294
362
|
return null;
|
|
295
363
|
}
|
|
296
364
|
}, "getFiberTagFromElement");
|
|
365
|
+
var SVG_TAGS = /* @__PURE__ */ new Set([
|
|
366
|
+
"svg",
|
|
367
|
+
"circle",
|
|
368
|
+
"ellipse",
|
|
369
|
+
"line",
|
|
370
|
+
"path",
|
|
371
|
+
"polygon",
|
|
372
|
+
"polyline",
|
|
373
|
+
"rect",
|
|
374
|
+
"g",
|
|
375
|
+
"defs",
|
|
376
|
+
"use",
|
|
377
|
+
"symbol",
|
|
378
|
+
"clipPath",
|
|
379
|
+
"mask",
|
|
380
|
+
"pattern",
|
|
381
|
+
"linearGradient",
|
|
382
|
+
"radialGradient",
|
|
383
|
+
"stop",
|
|
384
|
+
"marker",
|
|
385
|
+
"image",
|
|
386
|
+
"text",
|
|
387
|
+
"tspan",
|
|
388
|
+
"textPath",
|
|
389
|
+
"foreignObject",
|
|
390
|
+
"animate",
|
|
391
|
+
"animateMotion",
|
|
392
|
+
"animateTransform",
|
|
393
|
+
"feBlend",
|
|
394
|
+
"feColorMatrix",
|
|
395
|
+
"feComposite",
|
|
396
|
+
"feGaussianBlur",
|
|
397
|
+
"feOffset",
|
|
398
|
+
"feMerge",
|
|
399
|
+
"feMergeNode",
|
|
400
|
+
"feTurbulence",
|
|
401
|
+
"feFlood"
|
|
402
|
+
]);
|
|
403
|
+
var SVG_NS2 = "http://www.w3.org/2000/svg";
|
|
297
404
|
var createDomElementFromFiber = /* @__PURE__ */ __name((fiber) => {
|
|
298
405
|
switch (fiber.workTag) {
|
|
299
406
|
case HostText:
|
|
300
407
|
return document.createTextNode(fiber.pendingProps);
|
|
301
|
-
default:
|
|
302
|
-
|
|
408
|
+
default: {
|
|
409
|
+
const tag = fiber.type;
|
|
410
|
+
return SVG_TAGS.has(tag) ? document.createElementNS(SVG_NS2, tag) : document.createElement(tag);
|
|
411
|
+
}
|
|
303
412
|
}
|
|
304
413
|
}, "createDomElementFromFiber");
|
|
305
414
|
var getParentDom = /* @__PURE__ */ __name((fiber) => {
|
|
@@ -309,6 +418,7 @@ var getParentDom = /* @__PURE__ */ __name((fiber) => {
|
|
|
309
418
|
while (p) {
|
|
310
419
|
if (p.workTag === HostComponent) return p.stateNode;
|
|
311
420
|
if (p.workTag === HostRoot) return p.stateNode;
|
|
421
|
+
if (p.workTag === PortalComponent) return p.stateNode;
|
|
312
422
|
p = p.return;
|
|
313
423
|
}
|
|
314
424
|
throw new Error("No parent DOM found.");
|
|
@@ -329,8 +439,10 @@ __name(findFirstHostNode, "findFirstHostNode");
|
|
|
329
439
|
function getHostSibling(fiber) {
|
|
330
440
|
let sibling = fiber.sibling;
|
|
331
441
|
while (sibling) {
|
|
332
|
-
|
|
333
|
-
|
|
442
|
+
if (!(sibling.flags & PlacementFlag)) {
|
|
443
|
+
const node = findFirstHostNode(sibling);
|
|
444
|
+
if (node) return node;
|
|
445
|
+
}
|
|
334
446
|
sibling = sibling.sibling;
|
|
335
447
|
}
|
|
336
448
|
return null;
|
|
@@ -361,6 +473,7 @@ var createFiber = /* @__PURE__ */ __name((workTag, pendingProps, key = null) =>
|
|
|
361
473
|
sibling: null,
|
|
362
474
|
return: null,
|
|
363
475
|
stateNode: null,
|
|
476
|
+
classInstance: null,
|
|
364
477
|
deletions: null,
|
|
365
478
|
alternate: null,
|
|
366
479
|
lanes: NoLanes,
|
|
@@ -395,6 +508,7 @@ var createWorkInProgress = /* @__PURE__ */ __name((current, pendingProps) => {
|
|
|
395
508
|
}
|
|
396
509
|
wip.memoizedProps = current.memoizedProps;
|
|
397
510
|
wip.memoizedState = current.memoizedState;
|
|
511
|
+
wip.classInstance = current.classInstance;
|
|
398
512
|
wip.refCleanup = current.refCleanup;
|
|
399
513
|
wip.return = current.return;
|
|
400
514
|
wip.child = current.child;
|
|
@@ -421,6 +535,88 @@ var getScheduledFiberRoot = /* @__PURE__ */ __name(() => {
|
|
|
421
535
|
return instance.fiberRoot;
|
|
422
536
|
}, "getScheduledFiberRoot");
|
|
423
537
|
|
|
538
|
+
// ../rectify-reconciler/src/RectifyFiberScheduler.ts
|
|
539
|
+
var FRAME_BUDGET_MS = 5;
|
|
540
|
+
var frameStart = 0;
|
|
541
|
+
var shouldYield = /* @__PURE__ */ __name(() => performance.now() - frameStart > FRAME_BUDGET_MS, "shouldYield");
|
|
542
|
+
var doWork = null;
|
|
543
|
+
var setWorkCallback = /* @__PURE__ */ __name((cb) => {
|
|
544
|
+
doWork = cb;
|
|
545
|
+
}, "setWorkCallback");
|
|
546
|
+
var resumeCursor = null;
|
|
547
|
+
var setResumeCursor = /* @__PURE__ */ __name((fiber) => {
|
|
548
|
+
resumeCursor = fiber;
|
|
549
|
+
}, "setResumeCursor");
|
|
550
|
+
var getResumeCursor = /* @__PURE__ */ __name(() => resumeCursor, "getResumeCursor");
|
|
551
|
+
var clearResumeCursor = /* @__PURE__ */ __name(() => {
|
|
552
|
+
resumeCursor = null;
|
|
553
|
+
}, "clearResumeCursor");
|
|
554
|
+
var pendingLanes = NoLanes;
|
|
555
|
+
var scheduleRenderLane = /* @__PURE__ */ __name((lane) => {
|
|
556
|
+
pendingLanes |= lane;
|
|
557
|
+
if (lane & (SyncLane | InputLane)) {
|
|
558
|
+
scheduleMicrotask();
|
|
559
|
+
} else if (lane & DefaultLane) {
|
|
560
|
+
scheduleMessageTask();
|
|
561
|
+
} else if (lane & TransitionLane) {
|
|
562
|
+
scheduleTimeout();
|
|
563
|
+
} else if (lane & IdleLane) {
|
|
564
|
+
scheduleIdle();
|
|
565
|
+
}
|
|
566
|
+
}, "scheduleRenderLane");
|
|
567
|
+
var flush = /* @__PURE__ */ __name((mask) => {
|
|
568
|
+
const lanes = pendingLanes & mask;
|
|
569
|
+
if (!lanes) return;
|
|
570
|
+
pendingLanes &= ~lanes;
|
|
571
|
+
frameStart = performance.now();
|
|
572
|
+
doWork?.(lanes);
|
|
573
|
+
}, "flush");
|
|
574
|
+
var MICROTASK_MASK = SyncLane | InputLane;
|
|
575
|
+
var microtaskScheduled = false;
|
|
576
|
+
var scheduleMicrotask = /* @__PURE__ */ __name(() => {
|
|
577
|
+
if (microtaskScheduled) return;
|
|
578
|
+
microtaskScheduled = true;
|
|
579
|
+
queueMicrotask(() => {
|
|
580
|
+
microtaskScheduled = false;
|
|
581
|
+
flush(MICROTASK_MASK);
|
|
582
|
+
});
|
|
583
|
+
}, "scheduleMicrotask");
|
|
584
|
+
var DEFAULT_MASK = DefaultLane;
|
|
585
|
+
var mc = new MessageChannel();
|
|
586
|
+
var mcScheduled = false;
|
|
587
|
+
mc.port1.onmessage = () => {
|
|
588
|
+
mcScheduled = false;
|
|
589
|
+
flush(DEFAULT_MASK);
|
|
590
|
+
};
|
|
591
|
+
var scheduleMessageTask = /* @__PURE__ */ __name(() => {
|
|
592
|
+
if (mcScheduled) return;
|
|
593
|
+
mcScheduled = true;
|
|
594
|
+
mc.port2.postMessage(null);
|
|
595
|
+
}, "scheduleMessageTask");
|
|
596
|
+
var TRANSITION_MASK = TransitionLane;
|
|
597
|
+
var timeoutHandle = null;
|
|
598
|
+
var scheduleTimeout = /* @__PURE__ */ __name(() => {
|
|
599
|
+
if (timeoutHandle !== null) return;
|
|
600
|
+
timeoutHandle = setTimeout(() => {
|
|
601
|
+
timeoutHandle = null;
|
|
602
|
+
flush(TRANSITION_MASK);
|
|
603
|
+
}, 0);
|
|
604
|
+
}, "scheduleTimeout");
|
|
605
|
+
var IDLE_MASK = IdleLane;
|
|
606
|
+
var idleHandle = null;
|
|
607
|
+
var scheduleIdle = /* @__PURE__ */ __name(() => {
|
|
608
|
+
if (idleHandle !== null) return;
|
|
609
|
+
const run = /* @__PURE__ */ __name(() => {
|
|
610
|
+
idleHandle = null;
|
|
611
|
+
flush(IDLE_MASK);
|
|
612
|
+
}, "run");
|
|
613
|
+
if (typeof requestIdleCallback !== "undefined") {
|
|
614
|
+
idleHandle = requestIdleCallback(run, { timeout: 300 });
|
|
615
|
+
} else {
|
|
616
|
+
idleHandle = setTimeout(run, 300);
|
|
617
|
+
}
|
|
618
|
+
}, "scheduleIdle");
|
|
619
|
+
|
|
424
620
|
// ../rectify-hook/src/RectifyHookRenderingFiber.ts
|
|
425
621
|
var instance2 = {
|
|
426
622
|
fiberRendering: null,
|
|
@@ -466,10 +662,10 @@ var prepareToUseHooks = /* @__PURE__ */ __name((wip) => {
|
|
|
466
662
|
var finishUsingHooks = /* @__PURE__ */ __name(() => {
|
|
467
663
|
setFiberRendering(null);
|
|
468
664
|
}, "finishUsingHooks");
|
|
469
|
-
var withHooks = /* @__PURE__ */ __name((wip,
|
|
665
|
+
var withHooks = /* @__PURE__ */ __name((wip, Component2) => {
|
|
470
666
|
const NewComponent = /* @__PURE__ */ __name((props) => {
|
|
471
667
|
prepareToUseHooks(wip);
|
|
472
|
-
const result =
|
|
668
|
+
const result = Component2(props);
|
|
473
669
|
finishUsingHooks();
|
|
474
670
|
return result;
|
|
475
671
|
}, "NewComponent");
|
|
@@ -772,6 +968,30 @@ function clearContextSubscriptions(fiber) {
|
|
|
772
968
|
}
|
|
773
969
|
__name(clearContextSubscriptions, "clearContextSubscriptions");
|
|
774
970
|
|
|
971
|
+
// ../rectify-hook/src/RectifyHookUseId.ts
|
|
972
|
+
var _idCounter = 0;
|
|
973
|
+
var generateId = /* @__PURE__ */ __name(() => `_r${(_idCounter++).toString(36)}_`, "generateId");
|
|
974
|
+
var useId = /* @__PURE__ */ __name(() => {
|
|
975
|
+
const fiber = getFiberRendering();
|
|
976
|
+
if (!fiber) {
|
|
977
|
+
throw new Error("useId must be used within a function component.");
|
|
978
|
+
}
|
|
979
|
+
const hookIndex = getHookIndex();
|
|
980
|
+
nextHookIndex();
|
|
981
|
+
const { hook, prevHook } = getHookSlot(fiber, hookIndex);
|
|
982
|
+
if (!hook) {
|
|
983
|
+
const newHook = {
|
|
984
|
+
memoizedState: generateId(),
|
|
985
|
+
queue: null,
|
|
986
|
+
next: null
|
|
987
|
+
};
|
|
988
|
+
attachHook(fiber, newHook, prevHook);
|
|
989
|
+
return newHook.memoizedState;
|
|
990
|
+
}
|
|
991
|
+
return hook.memoizedState;
|
|
992
|
+
}, "useId");
|
|
993
|
+
var RectifyHookUseId_default = useId;
|
|
994
|
+
|
|
775
995
|
// ../rectify-reconciler/src/RectifyFiberRenderPriority.ts
|
|
776
996
|
var currentEventPriority = DefaultLane;
|
|
777
997
|
var setCurrentEventPriority = /* @__PURE__ */ __name((lane) => {
|
|
@@ -786,156 +1006,228 @@ var setCurrentRenderingLanes = /* @__PURE__ */ __name((lanes) => {
|
|
|
786
1006
|
currentRenderingLanes = lanes;
|
|
787
1007
|
}, "setCurrentRenderingLanes");
|
|
788
1008
|
var getCurrentLanePriority = /* @__PURE__ */ __name(() => currentRenderingLanes, "getCurrentLanePriority");
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
var shouldYield = /* @__PURE__ */ __name(() => performance.now() - frameStart > FRAME_BUDGET_MS, "shouldYield");
|
|
794
|
-
var doWork = null;
|
|
795
|
-
var setWorkCallback = /* @__PURE__ */ __name((cb) => {
|
|
796
|
-
doWork = cb;
|
|
797
|
-
}, "setWorkCallback");
|
|
798
|
-
var resumeCursor = null;
|
|
799
|
-
var setResumeCursor = /* @__PURE__ */ __name((fiber) => {
|
|
800
|
-
resumeCursor = fiber;
|
|
801
|
-
}, "setResumeCursor");
|
|
802
|
-
var getResumeCursor = /* @__PURE__ */ __name(() => resumeCursor, "getResumeCursor");
|
|
803
|
-
var clearResumeCursor = /* @__PURE__ */ __name(() => {
|
|
804
|
-
resumeCursor = null;
|
|
805
|
-
}, "clearResumeCursor");
|
|
806
|
-
var pendingLanes = NoLanes;
|
|
807
|
-
var scheduleRenderLane = /* @__PURE__ */ __name((lane) => {
|
|
808
|
-
pendingLanes |= lane;
|
|
809
|
-
if (lane & (SyncLane | InputLane)) {
|
|
810
|
-
scheduleMicrotask();
|
|
811
|
-
} else if (lane & DefaultLane) {
|
|
812
|
-
scheduleMessageTask();
|
|
813
|
-
} else if (lane & TransitionLane) {
|
|
814
|
-
scheduleTimeout();
|
|
815
|
-
} else if (lane & IdleLane) {
|
|
816
|
-
scheduleIdle();
|
|
817
|
-
}
|
|
818
|
-
}, "scheduleRenderLane");
|
|
819
|
-
var flush = /* @__PURE__ */ __name((mask) => {
|
|
820
|
-
const lanes = pendingLanes & mask;
|
|
821
|
-
if (!lanes) return;
|
|
822
|
-
pendingLanes &= ~lanes;
|
|
823
|
-
frameStart = performance.now();
|
|
824
|
-
doWork?.(lanes);
|
|
825
|
-
}, "flush");
|
|
826
|
-
var MICROTASK_MASK = SyncLane | InputLane;
|
|
827
|
-
var microtaskScheduled = false;
|
|
828
|
-
var scheduleMicrotask = /* @__PURE__ */ __name(() => {
|
|
829
|
-
if (microtaskScheduled) return;
|
|
830
|
-
microtaskScheduled = true;
|
|
831
|
-
queueMicrotask(() => {
|
|
832
|
-
microtaskScheduled = false;
|
|
833
|
-
flush(MICROTASK_MASK);
|
|
834
|
-
});
|
|
835
|
-
}, "scheduleMicrotask");
|
|
836
|
-
var DEFAULT_MASK = DefaultLane;
|
|
837
|
-
var mc = new MessageChannel();
|
|
838
|
-
var mcScheduled = false;
|
|
839
|
-
mc.port1.onmessage = () => {
|
|
840
|
-
mcScheduled = false;
|
|
841
|
-
flush(DEFAULT_MASK);
|
|
842
|
-
};
|
|
843
|
-
var scheduleMessageTask = /* @__PURE__ */ __name(() => {
|
|
844
|
-
if (mcScheduled) return;
|
|
845
|
-
mcScheduled = true;
|
|
846
|
-
mc.port2.postMessage(null);
|
|
847
|
-
}, "scheduleMessageTask");
|
|
848
|
-
var TRANSITION_MASK = TransitionLane;
|
|
849
|
-
var timeoutHandle = null;
|
|
850
|
-
var scheduleTimeout = /* @__PURE__ */ __name(() => {
|
|
851
|
-
if (timeoutHandle !== null) return;
|
|
852
|
-
timeoutHandle = setTimeout(() => {
|
|
853
|
-
timeoutHandle = null;
|
|
854
|
-
flush(TRANSITION_MASK);
|
|
855
|
-
}, 0);
|
|
856
|
-
}, "scheduleTimeout");
|
|
857
|
-
var IDLE_MASK = IdleLane;
|
|
858
|
-
var idleHandle = null;
|
|
859
|
-
var scheduleIdle = /* @__PURE__ */ __name(() => {
|
|
860
|
-
if (idleHandle !== null) return;
|
|
861
|
-
const run = /* @__PURE__ */ __name(() => {
|
|
862
|
-
idleHandle = null;
|
|
863
|
-
flush(IDLE_MASK);
|
|
864
|
-
}, "run");
|
|
865
|
-
if (typeof requestIdleCallback !== "undefined") {
|
|
866
|
-
idleHandle = requestIdleCallback(run, { timeout: 300 });
|
|
867
|
-
} else {
|
|
868
|
-
idleHandle = setTimeout(run, 300);
|
|
869
|
-
}
|
|
870
|
-
}, "scheduleIdle");
|
|
871
|
-
|
|
872
|
-
// ../rectify-reconciler/src/RectifyFiberWorkLoop.ts
|
|
873
|
-
var swapCurrentForWip = /* @__PURE__ */ __name((current, wip) => {
|
|
874
|
-
const parent = wip.return;
|
|
875
|
-
if (!parent) return;
|
|
876
|
-
if (parent.child === current) {
|
|
877
|
-
parent.child = wip;
|
|
878
|
-
return;
|
|
1009
|
+
var reuseOrCreate = /* @__PURE__ */ __name((oldFiber, element, wip) => {
|
|
1010
|
+
const newFiber = createWorkInProgress(oldFiber, element.props);
|
|
1011
|
+
if (hasPropsChanged(oldFiber.memoizedProps, element.props)) {
|
|
1012
|
+
addFlagToFiber(newFiber, UpdateFlag);
|
|
879
1013
|
}
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
prevSibling = prevSibling.sibling;
|
|
1014
|
+
if ((oldFiber.memoizedProps?.ref ?? null) !== (element.props?.ref ?? null)) {
|
|
1015
|
+
addFlagToFiber(newFiber, RefFlag);
|
|
883
1016
|
}
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
1017
|
+
newFiber.return = wip;
|
|
1018
|
+
return newFiber;
|
|
1019
|
+
}, "reuseOrCreate");
|
|
1020
|
+
var createAndPlace = /* @__PURE__ */ __name((element, wip) => {
|
|
1021
|
+
const newFiber = createFiberFromRectifyElement(element);
|
|
1022
|
+
newFiber.type = element.type;
|
|
1023
|
+
addFlagToFiber(newFiber, PlacementFlag);
|
|
1024
|
+
newFiber.return = wip;
|
|
1025
|
+
return newFiber;
|
|
1026
|
+
}, "createAndPlace");
|
|
1027
|
+
var appendFiber = /* @__PURE__ */ __name((fiber, prev, index, wip) => {
|
|
1028
|
+
fiber.index = index;
|
|
1029
|
+
if (!prev) wip.child = fiber;
|
|
1030
|
+
else prev.sibling = fiber;
|
|
1031
|
+
return fiber;
|
|
1032
|
+
}, "appendFiber");
|
|
1033
|
+
var buildOldFiberStructures = /* @__PURE__ */ __name((firstRemaining) => {
|
|
1034
|
+
const keyedMap = /* @__PURE__ */ new Map();
|
|
1035
|
+
const unkeyedByType = /* @__PURE__ */ new Map();
|
|
1036
|
+
let fiber = firstRemaining;
|
|
1037
|
+
while (fiber) {
|
|
1038
|
+
if (fiber.key !== null && fiber.key !== void 0) {
|
|
1039
|
+
keyedMap.set(fiber.key, fiber);
|
|
892
1040
|
} else {
|
|
893
|
-
|
|
1041
|
+
const pool = unkeyedByType.get(fiber.type);
|
|
1042
|
+
if (pool) pool.push(fiber);
|
|
1043
|
+
else unkeyedByType.set(fiber.type, [fiber]);
|
|
894
1044
|
}
|
|
1045
|
+
fiber = fiber.sibling;
|
|
895
1046
|
}
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
const
|
|
902
|
-
|
|
903
|
-
|
|
1047
|
+
return { keyedMap, unkeyedByType };
|
|
1048
|
+
}, "buildOldFiberStructures");
|
|
1049
|
+
var reconcileSequential = /* @__PURE__ */ __name((state, firstOldFiber) => {
|
|
1050
|
+
let oldFiber = firstOldFiber;
|
|
1051
|
+
for (let i = 0; i < state.newElements.length; i++) {
|
|
1052
|
+
const element = state.newElements[i];
|
|
1053
|
+
const { key: elementKey = null, type: elementType } = element;
|
|
1054
|
+
if (!oldFiber) return { stoppedAt: i, oldFiber: null };
|
|
1055
|
+
if (oldFiber.key !== elementKey) return { stoppedAt: i, oldFiber };
|
|
1056
|
+
if (oldFiber.type === elementType) {
|
|
1057
|
+
state.prev = appendFiber(
|
|
1058
|
+
reuseOrCreate(oldFiber, element, state.wip),
|
|
1059
|
+
state.prev,
|
|
1060
|
+
state.index++,
|
|
1061
|
+
state.wip
|
|
1062
|
+
);
|
|
1063
|
+
} else if (elementKey !== null) {
|
|
1064
|
+
addFlagToFiber(oldFiber, DeletionFlag);
|
|
1065
|
+
state.deletions.push(oldFiber);
|
|
1066
|
+
state.prev = appendFiber(
|
|
1067
|
+
createAndPlace(element, state.wip),
|
|
1068
|
+
state.prev,
|
|
1069
|
+
state.index++,
|
|
1070
|
+
state.wip
|
|
1071
|
+
);
|
|
904
1072
|
} else {
|
|
905
|
-
|
|
1073
|
+
return { stoppedAt: i, oldFiber };
|
|
906
1074
|
}
|
|
1075
|
+
oldFiber = oldFiber.sibling;
|
|
907
1076
|
}
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
} else {
|
|
924
|
-
|
|
1077
|
+
return { stoppedAt: state.newElements.length, oldFiber };
|
|
1078
|
+
}, "reconcileSequential");
|
|
1079
|
+
var reconcileKeyed = /* @__PURE__ */ __name((state, startAt, remainingOldFiber) => {
|
|
1080
|
+
const { keyedMap, unkeyedByType } = buildOldFiberStructures(remainingOldFiber);
|
|
1081
|
+
let lastPlacedIndex = 0;
|
|
1082
|
+
for (let i = startAt; i < state.newElements.length; i++) {
|
|
1083
|
+
const element = state.newElements[i];
|
|
1084
|
+
const { key: elementKey = null, type: elementType } = element;
|
|
1085
|
+
let matched = null;
|
|
1086
|
+
if (elementKey !== null) {
|
|
1087
|
+
const candidate = keyedMap.get(elementKey) ?? null;
|
|
1088
|
+
if (candidate && candidate.type === elementType) {
|
|
1089
|
+
keyedMap.delete(elementKey);
|
|
1090
|
+
matched = candidate;
|
|
1091
|
+
}
|
|
1092
|
+
} else {
|
|
1093
|
+
const pool = unkeyedByType.get(elementType);
|
|
1094
|
+
if (pool?.length) matched = pool.shift();
|
|
1095
|
+
}
|
|
1096
|
+
if (matched) {
|
|
1097
|
+
const newFiber = reuseOrCreate(matched, element, state.wip);
|
|
1098
|
+
if (matched.index < lastPlacedIndex) {
|
|
1099
|
+
addFlagToFiber(newFiber, MoveFlag);
|
|
1100
|
+
} else {
|
|
1101
|
+
lastPlacedIndex = matched.index;
|
|
1102
|
+
}
|
|
1103
|
+
state.prev = appendFiber(newFiber, state.prev, state.index++, state.wip);
|
|
1104
|
+
} else {
|
|
1105
|
+
state.prev = appendFiber(
|
|
1106
|
+
createAndPlace(element, state.wip),
|
|
1107
|
+
state.prev,
|
|
1108
|
+
state.index++,
|
|
1109
|
+
state.wip
|
|
1110
|
+
);
|
|
925
1111
|
}
|
|
926
|
-
if (completed) bubbleFlagsToRoot(wip);
|
|
927
|
-
return completed;
|
|
928
1112
|
}
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
1113
|
+
for (const orphan of keyedMap.values()) {
|
|
1114
|
+
addFlagToFiber(orphan, DeletionFlag);
|
|
1115
|
+
state.deletions.push(orphan);
|
|
1116
|
+
}
|
|
1117
|
+
for (const pool of unkeyedByType.values()) {
|
|
1118
|
+
for (const orphan of pool) {
|
|
1119
|
+
addFlagToFiber(orphan, DeletionFlag);
|
|
1120
|
+
state.deletions.push(orphan);
|
|
935
1121
|
}
|
|
936
1122
|
}
|
|
937
|
-
|
|
938
|
-
|
|
1123
|
+
}, "reconcileKeyed");
|
|
1124
|
+
var toChildArray = /* @__PURE__ */ __name((children) => {
|
|
1125
|
+
if (children == null || typeof children === "boolean") return [];
|
|
1126
|
+
if (isArray(children)) return children;
|
|
1127
|
+
return [children];
|
|
1128
|
+
}, "toChildArray");
|
|
1129
|
+
var reconcileChildren = /* @__PURE__ */ __name((wip, children) => {
|
|
1130
|
+
const newElements = toChildArray(children).map(createElementFromRectifyNode).filter(isValidRectifyElement);
|
|
1131
|
+
const state = {
|
|
1132
|
+
wip,
|
|
1133
|
+
newElements,
|
|
1134
|
+
deletions: [],
|
|
1135
|
+
prev: null,
|
|
1136
|
+
index: 0
|
|
1137
|
+
};
|
|
1138
|
+
const firstOldFiber = wip.alternate?.child ?? null;
|
|
1139
|
+
const { stoppedAt, oldFiber } = reconcileSequential(state, firstOldFiber);
|
|
1140
|
+
if (stoppedAt < newElements.length) {
|
|
1141
|
+
reconcileKeyed(state, stoppedAt, oldFiber);
|
|
1142
|
+
} else {
|
|
1143
|
+
let leftover = oldFiber;
|
|
1144
|
+
while (leftover) {
|
|
1145
|
+
addFlagToFiber(leftover, DeletionFlag);
|
|
1146
|
+
state.deletions.push(leftover);
|
|
1147
|
+
leftover = leftover.sibling;
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
if (state.prev) state.prev.sibling = null;
|
|
1151
|
+
if (state.deletions.length) wip.deletions = state.deletions;
|
|
1152
|
+
}, "reconcileChildren");
|
|
1153
|
+
|
|
1154
|
+
// ../rectify-reconciler/src/RectifyFiberConcurrentUpdate.ts
|
|
1155
|
+
var instance3 = {
|
|
1156
|
+
head: null,
|
|
1157
|
+
tail: null
|
|
1158
|
+
};
|
|
1159
|
+
var enqueueUpdate = /* @__PURE__ */ __name((update) => {
|
|
1160
|
+
update.next = null;
|
|
1161
|
+
if (instance3.tail === null) {
|
|
1162
|
+
instance3.head = update;
|
|
1163
|
+
instance3.tail = update;
|
|
1164
|
+
return;
|
|
1165
|
+
}
|
|
1166
|
+
instance3.tail.next = update;
|
|
1167
|
+
instance3.tail = update;
|
|
1168
|
+
}, "enqueueUpdate");
|
|
1169
|
+
var dequeueUpdate = /* @__PURE__ */ __name(() => {
|
|
1170
|
+
const first = instance3.head;
|
|
1171
|
+
if (first === null) {
|
|
1172
|
+
return null;
|
|
1173
|
+
}
|
|
1174
|
+
instance3.head = first.next;
|
|
1175
|
+
if (instance3.head === null) {
|
|
1176
|
+
instance3.tail = null;
|
|
1177
|
+
}
|
|
1178
|
+
first.next = null;
|
|
1179
|
+
return first;
|
|
1180
|
+
}, "dequeueUpdate");
|
|
1181
|
+
var hasUpdate = /* @__PURE__ */ __name(() => instance3.head !== null, "hasUpdate");
|
|
1182
|
+
|
|
1183
|
+
// ../rectify-reconciler/src/RectifyFiberSuspense.ts
|
|
1184
|
+
var suspendedBoundaries = /* @__PURE__ */ new WeakSet();
|
|
1185
|
+
var stableFiber = /* @__PURE__ */ __name((fiber) => fiber.alternate ?? fiber, "stableFiber");
|
|
1186
|
+
var isSuspendedBoundary = /* @__PURE__ */ __name((fiber) => suspendedBoundaries.has(stableFiber(fiber)), "isSuspendedBoundary");
|
|
1187
|
+
var findNearestSuspenseBoundary = /* @__PURE__ */ __name((fiber) => {
|
|
1188
|
+
let current = fiber.return;
|
|
1189
|
+
while (current) {
|
|
1190
|
+
if (current.workTag === SuspenseComponent) return current;
|
|
1191
|
+
current = current.return;
|
|
1192
|
+
}
|
|
1193
|
+
return null;
|
|
1194
|
+
}, "findNearestSuspenseBoundary");
|
|
1195
|
+
var handleSuspendedWork = /* @__PURE__ */ __name((boundary, thenable) => {
|
|
1196
|
+
const stable = stableFiber(boundary);
|
|
1197
|
+
if (suspendedBoundaries.has(stable)) return;
|
|
1198
|
+
suspendedBoundaries.add(stable);
|
|
1199
|
+
boundary.child = null;
|
|
1200
|
+
boundary.deletions = null;
|
|
1201
|
+
thenable.then(
|
|
1202
|
+
() => {
|
|
1203
|
+
suspendedBoundaries.delete(stable);
|
|
1204
|
+
enqueueUpdate({ lanes: DefaultLane, fiber: stable, next: null });
|
|
1205
|
+
scheduleRenderLane(DefaultLane);
|
|
1206
|
+
},
|
|
1207
|
+
() => {
|
|
1208
|
+
suspendedBoundaries.delete(stable);
|
|
1209
|
+
}
|
|
1210
|
+
);
|
|
1211
|
+
}, "handleSuspendedWork");
|
|
1212
|
+
var isThenable = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && typeof value.then === "function", "isThenable");
|
|
1213
|
+
|
|
1214
|
+
// ../rectify-reconciler/src/RectifyFiberBeginWork.ts
|
|
1215
|
+
var hasNoPendingWork = /* @__PURE__ */ __name((wip) => !(wip.lanes & getCurrentLanePriority()), "hasNoPendingWork");
|
|
1216
|
+
var isUpdate = /* @__PURE__ */ __name((wip) => wip.alternate !== null, "isUpdate");
|
|
1217
|
+
var flushStateQueue = /* @__PURE__ */ __name((currentState, props, queue) => {
|
|
1218
|
+
let state = currentState;
|
|
1219
|
+
for (const update of queue) {
|
|
1220
|
+
const partial = typeof update === "function" ? update(state, props) : update;
|
|
1221
|
+
state = { ...state, ...partial };
|
|
1222
|
+
}
|
|
1223
|
+
return state;
|
|
1224
|
+
}, "flushStateQueue");
|
|
1225
|
+
var renderFunctionComponent = /* @__PURE__ */ __name((wip, Component2) => {
|
|
1226
|
+
const ComponentWithHooks = withHooks(wip, Component2);
|
|
1227
|
+
const children = ComponentWithHooks(wip.pendingProps);
|
|
1228
|
+
reconcileChildren(wip, children);
|
|
1229
|
+
}, "renderFunctionComponent");
|
|
1230
|
+
var getProviderContext = /* @__PURE__ */ __name((wip) => wip.type._context, "getProviderContext");
|
|
939
1231
|
var cloneChildFibers = /* @__PURE__ */ __name((wip) => {
|
|
940
1232
|
const currentChild = wip.alternate?.child ?? null;
|
|
941
1233
|
if (!currentChild) {
|
|
@@ -958,14 +1250,6 @@ var cloneChildFibers = /* @__PURE__ */ __name((wip) => {
|
|
|
958
1250
|
if (prevNewChild) prevNewChild.sibling = null;
|
|
959
1251
|
return wip.child;
|
|
960
1252
|
}, "cloneChildFibers");
|
|
961
|
-
var hasNoPendingWork = /* @__PURE__ */ __name((wip) => !(wip.lanes & getCurrentLanePriority()), "hasNoPendingWork");
|
|
962
|
-
var isUpdate = /* @__PURE__ */ __name((wip) => wip.alternate !== null, "isUpdate");
|
|
963
|
-
var renderFunctionComponent = /* @__PURE__ */ __name((wip, Component) => {
|
|
964
|
-
const ComponentWithHooks = withHooks(wip, Component);
|
|
965
|
-
const children = ComponentWithHooks(wip.pendingProps);
|
|
966
|
-
reconcileChildren(wip, children);
|
|
967
|
-
}, "renderFunctionComponent");
|
|
968
|
-
var getProviderContext = /* @__PURE__ */ __name((wip) => wip.type._context, "getProviderContext");
|
|
969
1253
|
var beginWork = /* @__PURE__ */ __name((wip) => {
|
|
970
1254
|
switch (wip.workTag) {
|
|
971
1255
|
case MemoComponent: {
|
|
@@ -980,12 +1264,12 @@ var beginWork = /* @__PURE__ */ __name((wip) => {
|
|
|
980
1264
|
break;
|
|
981
1265
|
}
|
|
982
1266
|
case FunctionComponent: {
|
|
983
|
-
const
|
|
984
|
-
if (!isFunction(
|
|
1267
|
+
const Component2 = wip.type;
|
|
1268
|
+
if (!isFunction(Component2)) break;
|
|
985
1269
|
if (isUpdate(wip) && hasNoPendingWork(wip) && shallowEqual(wip.memoizedProps, wip.pendingProps)) {
|
|
986
1270
|
return cloneChildFibers(wip);
|
|
987
1271
|
}
|
|
988
|
-
renderFunctionComponent(wip,
|
|
1272
|
+
renderFunctionComponent(wip, Component2);
|
|
989
1273
|
break;
|
|
990
1274
|
}
|
|
991
1275
|
case FragmentComponent:
|
|
@@ -1008,33 +1292,85 @@ var beginWork = /* @__PURE__ */ __name((wip) => {
|
|
|
1008
1292
|
}
|
|
1009
1293
|
break;
|
|
1010
1294
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
let completed = unit;
|
|
1016
|
-
while (completed) {
|
|
1017
|
-
bubbleProperties(completed);
|
|
1018
|
-
if (completed === stopAt) {
|
|
1019
|
-
return null;
|
|
1295
|
+
case SuspenseComponent: {
|
|
1296
|
+
const children = isSuspendedBoundary(wip) ? wip.pendingProps?.fallback : wip.pendingProps?.children;
|
|
1297
|
+
reconcileChildren(wip, children);
|
|
1298
|
+
break;
|
|
1020
1299
|
}
|
|
1021
|
-
|
|
1022
|
-
|
|
1300
|
+
case ClassComponent: {
|
|
1301
|
+
const Ctor = wip.type;
|
|
1302
|
+
const isMount = !wip.classInstance;
|
|
1303
|
+
if (isMount) {
|
|
1304
|
+
const instance4 = new Ctor(wip.pendingProps);
|
|
1305
|
+
instance4._fiber = wip;
|
|
1306
|
+
wip.classInstance = instance4;
|
|
1307
|
+
if (instance4._pendingStateQueue?.length) {
|
|
1308
|
+
instance4.state = flushStateQueue(
|
|
1309
|
+
instance4.state,
|
|
1310
|
+
instance4.props,
|
|
1311
|
+
instance4._pendingStateQueue
|
|
1312
|
+
);
|
|
1313
|
+
instance4._pendingStateQueue = [];
|
|
1314
|
+
}
|
|
1315
|
+
} else {
|
|
1316
|
+
const instance4 = wip.classInstance;
|
|
1317
|
+
if (hasNoPendingWork(wip) && !instance4._pendingStateQueue?.length && shallowEqual(instance4.props, wip.pendingProps)) {
|
|
1318
|
+
return cloneChildFibers(wip);
|
|
1319
|
+
}
|
|
1320
|
+
instance4._prevProps = instance4.props;
|
|
1321
|
+
instance4._prevState = { ...instance4.state };
|
|
1322
|
+
if (instance4._pendingStateQueue?.length) {
|
|
1323
|
+
instance4.state = flushStateQueue(
|
|
1324
|
+
instance4.state,
|
|
1325
|
+
wip.pendingProps,
|
|
1326
|
+
instance4._pendingStateQueue
|
|
1327
|
+
);
|
|
1328
|
+
instance4._pendingStateQueue = [];
|
|
1329
|
+
}
|
|
1330
|
+
instance4.props = wip.pendingProps;
|
|
1331
|
+
instance4._fiber = wip;
|
|
1332
|
+
if (isUpdate(wip) && typeof instance4.shouldComponentUpdate === "function" && !instance4.shouldComponentUpdate(wip.pendingProps, instance4.state)) {
|
|
1333
|
+
return cloneChildFibers(wip);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
const children = wip.classInstance.render();
|
|
1337
|
+
reconcileChildren(wip, children);
|
|
1338
|
+
break;
|
|
1339
|
+
}
|
|
1340
|
+
case LazyComponent: {
|
|
1341
|
+
const lazy2 = wip.type;
|
|
1342
|
+
if (lazy2._status === "resolved") {
|
|
1343
|
+
renderFunctionComponent(wip, lazy2._result);
|
|
1344
|
+
break;
|
|
1345
|
+
}
|
|
1346
|
+
if (lazy2._status === "rejected") {
|
|
1347
|
+
throw lazy2._result;
|
|
1348
|
+
}
|
|
1349
|
+
if (lazy2._status === "uninitialized") {
|
|
1350
|
+
lazy2._status = "pending";
|
|
1351
|
+
lazy2._promise = lazy2._factory().then(
|
|
1352
|
+
(module) => {
|
|
1353
|
+
lazy2._status = "resolved";
|
|
1354
|
+
lazy2._result = module?.default ?? module;
|
|
1355
|
+
},
|
|
1356
|
+
(error) => {
|
|
1357
|
+
lazy2._status = "rejected";
|
|
1358
|
+
lazy2._result = error;
|
|
1359
|
+
}
|
|
1360
|
+
);
|
|
1361
|
+
}
|
|
1362
|
+
throw lazy2._promise;
|
|
1363
|
+
}
|
|
1364
|
+
case PortalComponent: {
|
|
1365
|
+
wip.stateNode = wip.pendingProps.containerInfo;
|
|
1366
|
+
reconcileChildren(wip, wip.pendingProps.children);
|
|
1367
|
+
break;
|
|
1023
1368
|
}
|
|
1024
|
-
completed = completed.return;
|
|
1025
|
-
}
|
|
1026
|
-
return null;
|
|
1027
|
-
}, "completeUnitOfWork");
|
|
1028
|
-
var bubbleFlagsToRoot = /* @__PURE__ */ __name((wip) => {
|
|
1029
|
-
let current = wip;
|
|
1030
|
-
let parent = current.return;
|
|
1031
|
-
while (parent) {
|
|
1032
|
-
parent.subtreeFlags |= current.flags | current.subtreeFlags;
|
|
1033
|
-
parent.childLanes |= current.lanes | current.childLanes;
|
|
1034
|
-
current = parent;
|
|
1035
|
-
parent = parent.return;
|
|
1036
1369
|
}
|
|
1037
|
-
|
|
1370
|
+
return wip.child;
|
|
1371
|
+
}, "beginWork");
|
|
1372
|
+
|
|
1373
|
+
// ../rectify-reconciler/src/RectifyFiberCompleteWork.ts
|
|
1038
1374
|
var bubbleProperties = /* @__PURE__ */ __name((wip) => {
|
|
1039
1375
|
wip.lanes &= ~getCurrentLanePriority();
|
|
1040
1376
|
let subtreeFlags = NoFlags;
|
|
@@ -1049,140 +1385,109 @@ var bubbleProperties = /* @__PURE__ */ __name((wip) => {
|
|
|
1049
1385
|
wip.subtreeFlags = subtreeFlags;
|
|
1050
1386
|
wip.childLanes = childLanes;
|
|
1051
1387
|
}, "bubbleProperties");
|
|
1052
|
-
var
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1388
|
+
var bubbleFlagsToRoot = /* @__PURE__ */ __name((wip) => {
|
|
1389
|
+
let current = wip;
|
|
1390
|
+
let parent = current.return;
|
|
1391
|
+
while (parent) {
|
|
1392
|
+
parent.subtreeFlags |= current.flags | current.subtreeFlags;
|
|
1393
|
+
parent.childLanes |= current.lanes | current.childLanes;
|
|
1394
|
+
current = parent;
|
|
1395
|
+
parent = parent.return;
|
|
1056
1396
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1397
|
+
}, "bubbleFlagsToRoot");
|
|
1398
|
+
var completeUnitOfWork = /* @__PURE__ */ __name((unit, stopAt) => {
|
|
1399
|
+
let completed = unit;
|
|
1400
|
+
while (completed) {
|
|
1401
|
+
bubbleProperties(completed);
|
|
1402
|
+
if (completed === stopAt) return null;
|
|
1403
|
+
if (completed.sibling) return completed.sibling;
|
|
1404
|
+
completed = completed.return;
|
|
1059
1405
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
var appendFiber = /* @__PURE__ */ __name((fiber, prev, index, wip) => {
|
|
1071
|
-
fiber.index = index;
|
|
1072
|
-
if (!prev) wip.child = fiber;
|
|
1073
|
-
else prev.sibling = fiber;
|
|
1074
|
-
return fiber;
|
|
1075
|
-
}, "appendFiber");
|
|
1076
|
-
var buildOldFiberMap = /* @__PURE__ */ __name((firstRemaining, startIndex) => {
|
|
1077
|
-
const map = /* @__PURE__ */ new Map();
|
|
1078
|
-
let fiber = firstRemaining;
|
|
1079
|
-
let i = startIndex;
|
|
1080
|
-
while (fiber) {
|
|
1081
|
-
map.set(fiber.key ?? i, fiber);
|
|
1082
|
-
fiber = fiber.sibling;
|
|
1083
|
-
i++;
|
|
1406
|
+
return null;
|
|
1407
|
+
}, "completeUnitOfWork");
|
|
1408
|
+
|
|
1409
|
+
// ../rectify-reconciler/src/RectifyFiberWorkLoop.ts
|
|
1410
|
+
var swapCurrentForWip = /* @__PURE__ */ __name((current, wip) => {
|
|
1411
|
+
const parent = wip.return;
|
|
1412
|
+
if (!parent) return;
|
|
1413
|
+
if (parent.child === current) {
|
|
1414
|
+
parent.child = wip;
|
|
1415
|
+
return;
|
|
1084
1416
|
}
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
let oldFiber = firstOldFiber;
|
|
1089
|
-
let i = 0;
|
|
1090
|
-
for (; i < state.newElements.length; i++) {
|
|
1091
|
-
const element = state.newElements[i];
|
|
1092
|
-
const { key: elementKey = null, type: elementType } = element;
|
|
1093
|
-
if (!oldFiber) break;
|
|
1094
|
-
if (oldFiber.key !== elementKey) break;
|
|
1095
|
-
if (oldFiber.type === elementType) {
|
|
1096
|
-
state.prev = appendFiber(reuseOrCreate(oldFiber, element, state.wip), state.prev, state.index++, state.wip);
|
|
1097
|
-
} else {
|
|
1098
|
-
addFlagToFiber(oldFiber, DeletionFlag);
|
|
1099
|
-
state.deletions.push(oldFiber);
|
|
1100
|
-
state.prev = appendFiber(createAndPlace(element, state.wip), state.prev, state.index++, state.wip);
|
|
1101
|
-
}
|
|
1102
|
-
oldFiber = oldFiber.sibling;
|
|
1417
|
+
let prevSibling = parent.child;
|
|
1418
|
+
while (prevSibling && prevSibling.sibling !== current) {
|
|
1419
|
+
prevSibling = prevSibling.sibling;
|
|
1103
1420
|
}
|
|
1104
|
-
|
|
1105
|
-
}, "
|
|
1106
|
-
var
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
lastPlacedIndex = matched.index;
|
|
1421
|
+
if (prevSibling) prevSibling.sibling = wip;
|
|
1422
|
+
}, "swapCurrentForWip");
|
|
1423
|
+
var workLoop = /* @__PURE__ */ __name((wipRoot) => {
|
|
1424
|
+
let workInProgress = wipRoot;
|
|
1425
|
+
while (workInProgress) {
|
|
1426
|
+
try {
|
|
1427
|
+
const next = beginWork(workInProgress);
|
|
1428
|
+
workInProgress = next ?? completeUnitOfWork(workInProgress, wipRoot);
|
|
1429
|
+
} catch (thrown) {
|
|
1430
|
+
if (isThenable(thrown) && workInProgress) {
|
|
1431
|
+
const boundary = findNearestSuspenseBoundary(workInProgress);
|
|
1432
|
+
if (boundary) {
|
|
1433
|
+
handleSuspendedWork(boundary, thrown);
|
|
1434
|
+
workInProgress = boundary;
|
|
1435
|
+
continue;
|
|
1436
|
+
}
|
|
1121
1437
|
}
|
|
1122
|
-
|
|
1123
|
-
} else {
|
|
1124
|
-
state.prev = appendFiber(createAndPlace(element, state.wip), state.prev, state.index++, state.wip);
|
|
1438
|
+
throw thrown;
|
|
1125
1439
|
}
|
|
1126
1440
|
}
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
let leftover = oldFiber;
|
|
1146
|
-
while (leftover) {
|
|
1147
|
-
addFlagToFiber(leftover, DeletionFlag);
|
|
1148
|
-
state.deletions.push(leftover);
|
|
1149
|
-
leftover = leftover.sibling;
|
|
1441
|
+
}, "workLoop");
|
|
1442
|
+
var workLoopConcurrent = /* @__PURE__ */ __name((wipRoot) => {
|
|
1443
|
+
let workInProgress = getResumeCursor() ?? wipRoot;
|
|
1444
|
+
clearResumeCursor();
|
|
1445
|
+
while (workInProgress && !shouldYield()) {
|
|
1446
|
+
try {
|
|
1447
|
+
const next = beginWork(workInProgress);
|
|
1448
|
+
workInProgress = next ?? completeUnitOfWork(workInProgress, wipRoot);
|
|
1449
|
+
} catch (thrown) {
|
|
1450
|
+
if (isThenable(thrown) && workInProgress) {
|
|
1451
|
+
const boundary = findNearestSuspenseBoundary(workInProgress);
|
|
1452
|
+
if (boundary) {
|
|
1453
|
+
handleSuspendedWork(boundary, thrown);
|
|
1454
|
+
workInProgress = boundary;
|
|
1455
|
+
continue;
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
throw thrown;
|
|
1150
1459
|
}
|
|
1151
1460
|
}
|
|
1152
|
-
if (
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
// ../rectify-reconciler/src/RectifyFiberCommitWork.ts
|
|
1157
|
-
var MutationMask = PlacementFlag | UpdateFlag | MoveFlag | RefFlag;
|
|
1158
|
-
var commitWork = /* @__PURE__ */ __name((finishedWork) => {
|
|
1159
|
-
if (finishedWork.deletions?.length) {
|
|
1160
|
-
finishedWork.deletions.forEach(removeHostTree);
|
|
1161
|
-
finishedWork.deletions = null;
|
|
1461
|
+
if (workInProgress !== null) {
|
|
1462
|
+
setResumeCursor(workInProgress);
|
|
1463
|
+
return false;
|
|
1162
1464
|
}
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1465
|
+
return true;
|
|
1466
|
+
}, "workLoopConcurrent");
|
|
1467
|
+
var workLoopOnFiberLanes = /* @__PURE__ */ __name((wipRoot, renderLanes) => {
|
|
1468
|
+
if (wipRoot.lanes & renderLanes) {
|
|
1469
|
+
const wip = createWorkInProgress(wipRoot, wipRoot.pendingProps);
|
|
1470
|
+
swapCurrentForWip(wipRoot, wip);
|
|
1471
|
+
const isSync = !!(renderLanes & (SyncLane | InputLane));
|
|
1472
|
+
const completed = isSync ? (workLoop(wip), true) : workLoopConcurrent(wip);
|
|
1473
|
+
if (completed) bubbleFlagsToRoot(wip);
|
|
1474
|
+
return completed;
|
|
1166
1475
|
}
|
|
1167
|
-
if (
|
|
1168
|
-
let child =
|
|
1476
|
+
if (wipRoot.childLanes & renderLanes) {
|
|
1477
|
+
let child = wipRoot.child;
|
|
1169
1478
|
while (child) {
|
|
1170
|
-
|
|
1479
|
+
if (!workLoopOnFiberLanes(child, renderLanes)) return false;
|
|
1171
1480
|
child = child.sibling;
|
|
1172
1481
|
}
|
|
1173
1482
|
}
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
}, "commitWork");
|
|
1177
|
-
var syncMemoizedProps = /* @__PURE__ */ __name((wip) => {
|
|
1178
|
-
wip.memoizedProps = wip.pendingProps;
|
|
1179
|
-
}, "syncMemoizedProps");
|
|
1483
|
+
return true;
|
|
1484
|
+
}, "workLoopOnFiberLanes");
|
|
1180
1485
|
var attachRef = /* @__PURE__ */ __name((wip) => {
|
|
1181
1486
|
const ref = wip.pendingProps?.ref;
|
|
1182
1487
|
if (!ref) return;
|
|
1183
|
-
if (
|
|
1488
|
+
if (isFunction(ref)) {
|
|
1184
1489
|
const cleanup = ref(wip.stateNode);
|
|
1185
|
-
wip.refCleanup =
|
|
1490
|
+
wip.refCleanup = isFunction(cleanup) ? cleanup : null;
|
|
1186
1491
|
} else if (typeof ref === "object" && "current" in ref) {
|
|
1187
1492
|
ref.current = wip.stateNode;
|
|
1188
1493
|
}
|
|
@@ -1201,27 +1506,30 @@ var detachRef = /* @__PURE__ */ __name((fiber) => {
|
|
|
1201
1506
|
ref.current = null;
|
|
1202
1507
|
}
|
|
1203
1508
|
}, "detachRef");
|
|
1509
|
+
|
|
1510
|
+
// ../rectify-reconciler/src/RectifyFiberCommitPlacement.ts
|
|
1204
1511
|
var insertIntoParent = /* @__PURE__ */ __name((wip, node) => {
|
|
1205
1512
|
const parentDom = getParentDom(wip);
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1513
|
+
let cursor = wip;
|
|
1514
|
+
while (cursor) {
|
|
1515
|
+
const before = getHostSibling(cursor);
|
|
1516
|
+
if (before) {
|
|
1517
|
+
parentDom.insertBefore(node, before);
|
|
1518
|
+
return;
|
|
1519
|
+
}
|
|
1520
|
+
const parent = cursor.return;
|
|
1521
|
+
if (!parent || parent.workTag === HostComponent || parent.workTag === HostRoot) break;
|
|
1522
|
+
cursor = parent;
|
|
1523
|
+
}
|
|
1524
|
+
parentDom.appendChild(node);
|
|
1209
1525
|
}, "insertIntoParent");
|
|
1210
1526
|
var placeNode = /* @__PURE__ */ __name((wip, node) => {
|
|
1211
1527
|
insertIntoParent(wip, node);
|
|
1212
1528
|
precacheFiberNode(wip, node);
|
|
1213
1529
|
attachRef(wip);
|
|
1214
1530
|
}, "placeNode");
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
case HostComponent:
|
|
1218
|
-
commitMutationHostComponent(childFiber);
|
|
1219
|
-
break;
|
|
1220
|
-
case HostText:
|
|
1221
|
-
commitMutationHostText(childFiber);
|
|
1222
|
-
break;
|
|
1223
|
-
}
|
|
1224
|
-
}, "commitMutation");
|
|
1531
|
+
|
|
1532
|
+
// ../rectify-reconciler/src/RectifyFiberCommitMutation.ts
|
|
1225
1533
|
var commitMutationHostComponent = /* @__PURE__ */ __name((wip) => {
|
|
1226
1534
|
if (!wip.stateNode) {
|
|
1227
1535
|
const node = createDomElementFromFiber(wip);
|
|
@@ -1272,7 +1580,22 @@ var commitMutationHostText = /* @__PURE__ */ __name((wip) => {
|
|
|
1272
1580
|
removeFlagFromFiber(wip, UpdateFlag);
|
|
1273
1581
|
}
|
|
1274
1582
|
}, "commitMutationHostText");
|
|
1583
|
+
var commitMutation = /* @__PURE__ */ __name((fiber) => {
|
|
1584
|
+
switch (fiber.workTag) {
|
|
1585
|
+
case HostComponent:
|
|
1586
|
+
commitMutationHostComponent(fiber);
|
|
1587
|
+
break;
|
|
1588
|
+
case HostText:
|
|
1589
|
+
commitMutationHostText(fiber);
|
|
1590
|
+
break;
|
|
1591
|
+
}
|
|
1592
|
+
}, "commitMutation");
|
|
1593
|
+
|
|
1594
|
+
// ../rectify-reconciler/src/RectifyFiberCommitRemoval.ts
|
|
1275
1595
|
var removeHostTree = /* @__PURE__ */ __name((fiber) => {
|
|
1596
|
+
if (fiber.workTag === ClassComponent) {
|
|
1597
|
+
fiber.classInstance?.componentWillUnmount?.();
|
|
1598
|
+
}
|
|
1276
1599
|
if (fiber.memoizedState) {
|
|
1277
1600
|
runEffectCleanups(fiber);
|
|
1278
1601
|
}
|
|
@@ -1288,96 +1611,48 @@ var removeHostTree = /* @__PURE__ */ __name((fiber) => {
|
|
|
1288
1611
|
}
|
|
1289
1612
|
}, "removeHostTree");
|
|
1290
1613
|
|
|
1291
|
-
// ../rectify-reconciler/src/
|
|
1292
|
-
var
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
update.next = null;
|
|
1298
|
-
if (instance3.tail === null) {
|
|
1299
|
-
instance3.head = update;
|
|
1300
|
-
instance3.tail = update;
|
|
1301
|
-
return;
|
|
1302
|
-
}
|
|
1303
|
-
instance3.tail.next = update;
|
|
1304
|
-
instance3.tail = update;
|
|
1305
|
-
}, "enqueueUpdate");
|
|
1306
|
-
var dequeueUpdate = /* @__PURE__ */ __name(() => {
|
|
1307
|
-
const first = instance3.head;
|
|
1308
|
-
if (first === null) {
|
|
1309
|
-
return null;
|
|
1310
|
-
}
|
|
1311
|
-
instance3.head = first.next;
|
|
1312
|
-
if (instance3.head === null) {
|
|
1313
|
-
instance3.tail = null;
|
|
1614
|
+
// ../rectify-reconciler/src/RectifyFiberCommitWork.ts
|
|
1615
|
+
var MutationMask = PlacementFlag | UpdateFlag | MoveFlag | RefFlag;
|
|
1616
|
+
var commitWork = /* @__PURE__ */ __name((finishedWork) => {
|
|
1617
|
+
if (finishedWork.deletions?.length) {
|
|
1618
|
+
finishedWork.deletions.forEach(removeHostTree);
|
|
1619
|
+
finishedWork.deletions = null;
|
|
1314
1620
|
}
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
var hasUpdate = /* @__PURE__ */ __name(() => instance3.head !== null, "hasUpdate");
|
|
1319
|
-
|
|
1320
|
-
// ../rectify-reconciler/src/RectifyFiberReconciler.ts
|
|
1321
|
-
injectEventPriorityCallbacks(
|
|
1322
|
-
setCurrentEventPriority,
|
|
1323
|
-
resetCurrentEventPriority
|
|
1324
|
-
);
|
|
1325
|
-
var isFlushingLayoutEffects = false;
|
|
1326
|
-
var performWork = /* @__PURE__ */ __name((lanes) => {
|
|
1327
|
-
const fiberRoot = getScheduledFiberRoot();
|
|
1328
|
-
if (!fiberRoot) return;
|
|
1329
|
-
if (!getResumeCursor()) flushPendingUpdates();
|
|
1330
|
-
setCurrentRenderingLanes(lanes);
|
|
1331
|
-
const completed = workLoopOnFiberLanes(fiberRoot.root, lanes);
|
|
1332
|
-
if (!completed) {
|
|
1333
|
-
scheduleRenderLane(lanes);
|
|
1334
|
-
return;
|
|
1621
|
+
if (finishedWork.flags & MutationMask) {
|
|
1622
|
+
commitMutation(finishedWork);
|
|
1623
|
+
finishedWork.memoizedProps = finishedWork.pendingProps;
|
|
1335
1624
|
}
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
}
|
|
1342
|
-
setWorkCallback(performWork);
|
|
1343
|
-
var onScheduleRerender = /* @__PURE__ */ __name((fiber) => {
|
|
1344
|
-
const lane = isFlushingLayoutEffects ? SyncLane : requestUpdateLane();
|
|
1345
|
-
enqueueUpdate({ lanes: lane, fiber, next: null });
|
|
1346
|
-
if (!isFlushingLayoutEffects) {
|
|
1347
|
-
scheduleRenderLane(lane);
|
|
1625
|
+
if (finishedWork.subtreeFlags & MutationMask) {
|
|
1626
|
+
let child = finishedWork.child;
|
|
1627
|
+
while (child) {
|
|
1628
|
+
commitWork(child);
|
|
1629
|
+
child = child.sibling;
|
|
1630
|
+
}
|
|
1348
1631
|
}
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1632
|
+
if (finishedWork.workTag === ClassComponent && finishedWork.classInstance) {
|
|
1633
|
+
const instance4 = finishedWork.classInstance;
|
|
1634
|
+
const isMount = finishedWork.alternate === null;
|
|
1635
|
+
if (isMount) {
|
|
1636
|
+
instance4.componentDidMount?.();
|
|
1637
|
+
} else if (instance4._prevState !== void 0) {
|
|
1638
|
+
instance4.componentDidUpdate?.(
|
|
1639
|
+
instance4._prevProps,
|
|
1640
|
+
instance4._prevState
|
|
1641
|
+
);
|
|
1642
|
+
instance4._prevProps = void 0;
|
|
1643
|
+
instance4._prevState = void 0;
|
|
1644
|
+
}
|
|
1361
1645
|
}
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
var
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
setCurrentRenderingLanes(SyncLane);
|
|
1373
|
-
workLoop(wipRoot);
|
|
1374
|
-
commitWork(wipRoot);
|
|
1375
|
-
fiberRoot.root = wipRoot;
|
|
1376
|
-
markContainerAsRoot(wipRoot, fiberRoot.containerDom);
|
|
1377
|
-
setScheduledFiberRoot(fiberRoot);
|
|
1378
|
-
flushLayoutPhase(fiberRoot);
|
|
1379
|
-
schedulePassiveEffects();
|
|
1380
|
-
}, "updateContainer");
|
|
1646
|
+
finishedWork.flags = NoFlags;
|
|
1647
|
+
finishedWork.subtreeFlags = NoFlags;
|
|
1648
|
+
}, "commitWork");
|
|
1649
|
+
|
|
1650
|
+
// ../rectify-reconciler/src/RectifyFiberFlushPhase.ts
|
|
1651
|
+
var _isFlushingLayoutEffects = false;
|
|
1652
|
+
var getIsFlushingLayoutEffects = /* @__PURE__ */ __name(() => _isFlushingLayoutEffects, "getIsFlushingLayoutEffects");
|
|
1653
|
+
var setIsFlushingLayoutEffects = /* @__PURE__ */ __name((value) => {
|
|
1654
|
+
_isFlushingLayoutEffects = value;
|
|
1655
|
+
}, "setIsFlushingLayoutEffects");
|
|
1381
1656
|
var passiveChannel = new MessageChannel();
|
|
1382
1657
|
var schedulePassiveEffects = /* @__PURE__ */ __name(() => {
|
|
1383
1658
|
passiveChannel.port1.onmessage = () => {
|
|
@@ -1388,10 +1663,10 @@ var schedulePassiveEffects = /* @__PURE__ */ __name(() => {
|
|
|
1388
1663
|
}, "schedulePassiveEffects");
|
|
1389
1664
|
var flushLayoutPhase = /* @__PURE__ */ __name((fiberRoot) => {
|
|
1390
1665
|
while (true) {
|
|
1391
|
-
|
|
1666
|
+
setIsFlushingLayoutEffects(true);
|
|
1392
1667
|
flushLayoutEffectCleanups();
|
|
1393
1668
|
flushLayoutEffects();
|
|
1394
|
-
|
|
1669
|
+
setIsFlushingLayoutEffects(false);
|
|
1395
1670
|
if (!hasUpdate()) break;
|
|
1396
1671
|
flushPendingUpdates();
|
|
1397
1672
|
setCurrentRenderingLanes(SyncLane);
|
|
@@ -1422,6 +1697,71 @@ var propagateLaneToAncestors = /* @__PURE__ */ __name((updateQueue) => {
|
|
|
1422
1697
|
}
|
|
1423
1698
|
}, "propagateLaneToAncestors");
|
|
1424
1699
|
|
|
1700
|
+
// ../rectify-reconciler/src/RectifyFiberHookBridge.ts
|
|
1701
|
+
var onScheduleRerender = /* @__PURE__ */ __name((fiber) => {
|
|
1702
|
+
const lane = getIsFlushingLayoutEffects() ? SyncLane : requestUpdateLane();
|
|
1703
|
+
enqueueUpdate({ lanes: lane, fiber, next: null });
|
|
1704
|
+
if (!getIsFlushingLayoutEffects()) {
|
|
1705
|
+
scheduleRenderLane(lane);
|
|
1706
|
+
}
|
|
1707
|
+
}, "onScheduleRerender");
|
|
1708
|
+
var onMarkFiberDirty = /* @__PURE__ */ __name((fiber) => {
|
|
1709
|
+
const lane = getCurrentLanePriority();
|
|
1710
|
+
fiber.lanes |= lane;
|
|
1711
|
+
const wip = fiber.alternate;
|
|
1712
|
+
if (!wip) return;
|
|
1713
|
+
wip.lanes |= lane;
|
|
1714
|
+
let parent = wip.return;
|
|
1715
|
+
while (parent) {
|
|
1716
|
+
if ((parent.childLanes & lane) === lane) break;
|
|
1717
|
+
parent.childLanes |= lane;
|
|
1718
|
+
parent = parent.return;
|
|
1719
|
+
}
|
|
1720
|
+
}, "onMarkFiberDirty");
|
|
1721
|
+
setScheduleRerender(onScheduleRerender);
|
|
1722
|
+
setMarkFiberDirty(onMarkFiberDirty);
|
|
1723
|
+
|
|
1724
|
+
// ../rectify-reconciler/src/RectifyFiberBootstrap.ts
|
|
1725
|
+
injectEventPriorityCallbacks(
|
|
1726
|
+
setCurrentEventPriority,
|
|
1727
|
+
resetCurrentEventPriority
|
|
1728
|
+
);
|
|
1729
|
+
var performWork = /* @__PURE__ */ __name((lanes) => {
|
|
1730
|
+
const fiberRoot = getScheduledFiberRoot();
|
|
1731
|
+
if (!fiberRoot) return;
|
|
1732
|
+
if (!getResumeCursor()) flushPendingUpdates();
|
|
1733
|
+
setCurrentRenderingLanes(lanes);
|
|
1734
|
+
const completed = workLoopOnFiberLanes(fiberRoot.root, lanes);
|
|
1735
|
+
if (!completed) {
|
|
1736
|
+
scheduleRenderLane(lanes);
|
|
1737
|
+
return;
|
|
1738
|
+
}
|
|
1739
|
+
clearResumeCursor();
|
|
1740
|
+
commitWork(fiberRoot.root);
|
|
1741
|
+
markContainerAsRoot(fiberRoot.root, fiberRoot.containerDom);
|
|
1742
|
+
flushLayoutPhase(fiberRoot);
|
|
1743
|
+
schedulePassiveEffects();
|
|
1744
|
+
}, "performWork");
|
|
1745
|
+
setWorkCallback(performWork);
|
|
1746
|
+
|
|
1747
|
+
// ../rectify-reconciler/src/RectifyFiberReconciler.ts
|
|
1748
|
+
var createContainer = /* @__PURE__ */ __name((container) => {
|
|
1749
|
+
return createHostRootFiber(container);
|
|
1750
|
+
}, "createContainer");
|
|
1751
|
+
var updateContainer = /* @__PURE__ */ __name((children, fiberRoot) => {
|
|
1752
|
+
fiberRoot.children = children;
|
|
1753
|
+
setScheduledFiberRoot(fiberRoot);
|
|
1754
|
+
const wipRoot = createWorkInProgress(fiberRoot.root, { children });
|
|
1755
|
+
setCurrentRenderingLanes(SyncLane);
|
|
1756
|
+
workLoop(wipRoot);
|
|
1757
|
+
commitWork(wipRoot);
|
|
1758
|
+
fiberRoot.root = wipRoot;
|
|
1759
|
+
markContainerAsRoot(wipRoot, fiberRoot.containerDom);
|
|
1760
|
+
setScheduledFiberRoot(fiberRoot);
|
|
1761
|
+
flushLayoutPhase(fiberRoot);
|
|
1762
|
+
schedulePassiveEffects();
|
|
1763
|
+
}, "updateContainer");
|
|
1764
|
+
|
|
1425
1765
|
// ../rectify-dom/src/RectifyDomRoot.ts
|
|
1426
1766
|
var createRoot = /* @__PURE__ */ __name((container) => {
|
|
1427
1767
|
const hostRoot = createContainer(container);
|
|
@@ -1436,17 +1776,94 @@ var createRoot = /* @__PURE__ */ __name((container) => {
|
|
|
1436
1776
|
}, "unmount")
|
|
1437
1777
|
};
|
|
1438
1778
|
}, "createRoot");
|
|
1779
|
+
var createPortal = /* @__PURE__ */ __name((children, container, key = null) => {
|
|
1780
|
+
listenToAllEventSupported(container);
|
|
1781
|
+
return {
|
|
1782
|
+
$$typeof: RECTIFY_PORTAL_TYPE,
|
|
1783
|
+
type: null,
|
|
1784
|
+
key,
|
|
1785
|
+
props: {
|
|
1786
|
+
children,
|
|
1787
|
+
containerInfo: container
|
|
1788
|
+
}
|
|
1789
|
+
};
|
|
1790
|
+
}, "createPortal");
|
|
1439
1791
|
|
|
1440
1792
|
// src/RectifyMemo.ts
|
|
1441
|
-
function memo(
|
|
1793
|
+
function memo(Component2, compare) {
|
|
1442
1794
|
const wrapper = /* @__PURE__ */ __name(((_props) => null), "wrapper");
|
|
1443
1795
|
wrapper._isMemo = true;
|
|
1444
|
-
wrapper._render =
|
|
1796
|
+
wrapper._render = Component2;
|
|
1445
1797
|
wrapper._compare = compare ?? null;
|
|
1446
1798
|
return wrapper;
|
|
1447
1799
|
}
|
|
1448
1800
|
__name(memo, "memo");
|
|
1449
1801
|
|
|
1450
|
-
|
|
1802
|
+
// src/RectifyLazy.ts
|
|
1803
|
+
var lazy = /* @__PURE__ */ __name((factory) => {
|
|
1804
|
+
const stub = /* @__PURE__ */ __name((() => null), "stub");
|
|
1805
|
+
return Object.assign(stub, {
|
|
1806
|
+
_isLazy: true,
|
|
1807
|
+
_status: "uninitialized",
|
|
1808
|
+
_result: null,
|
|
1809
|
+
_promise: null,
|
|
1810
|
+
_factory: factory
|
|
1811
|
+
});
|
|
1812
|
+
}, "lazy");
|
|
1813
|
+
|
|
1814
|
+
// src/RectifySuspense.ts
|
|
1815
|
+
var Suspense = /* @__PURE__ */ __name((_props) => null, "Suspense");
|
|
1816
|
+
Suspense._isSuspense = true;
|
|
1817
|
+
|
|
1818
|
+
// src/RectifyComponent.ts
|
|
1819
|
+
var _Component = class _Component {
|
|
1820
|
+
constructor(props) {
|
|
1821
|
+
this.state = {};
|
|
1822
|
+
/**
|
|
1823
|
+
* @internal Set by the reconciler when the instance is created so
|
|
1824
|
+
* `setState` can enqueue a re-render on the correct fiber.
|
|
1825
|
+
*/
|
|
1826
|
+
this._fiber = null;
|
|
1827
|
+
/**
|
|
1828
|
+
* @internal Snapshots taken by the reconciler in beginWork before each
|
|
1829
|
+
* update render so that `componentDidUpdate` receives the correct prev values.
|
|
1830
|
+
* Cleared after `componentDidUpdate` is called.
|
|
1831
|
+
*/
|
|
1832
|
+
this._prevProps = void 0;
|
|
1833
|
+
this._prevState = void 0;
|
|
1834
|
+
/**
|
|
1835
|
+
* @internal Queue of pending setState updates, flushed by the reconciler
|
|
1836
|
+
* during beginWork so that prevState snapshots can be taken first.
|
|
1837
|
+
*/
|
|
1838
|
+
this._pendingStateQueue = [];
|
|
1839
|
+
this.props = props;
|
|
1840
|
+
}
|
|
1841
|
+
// ---------------------------------------------------------------------------
|
|
1842
|
+
// Core API
|
|
1843
|
+
// ---------------------------------------------------------------------------
|
|
1844
|
+
/**
|
|
1845
|
+
* Merges `partialState` into the current state and schedules a re-render.
|
|
1846
|
+
* Accepts either a plain partial state object or an updater function.
|
|
1847
|
+
*/
|
|
1848
|
+
setState(partialState) {
|
|
1849
|
+
this._pendingStateQueue.push(partialState);
|
|
1850
|
+
if (this._fiber) {
|
|
1851
|
+
scheduleRerender(this._fiber);
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
/**
|
|
1855
|
+
* Must be implemented by every class component.
|
|
1856
|
+
* Returns the subtree to render.
|
|
1857
|
+
*/
|
|
1858
|
+
render() {
|
|
1859
|
+
return null;
|
|
1860
|
+
}
|
|
1861
|
+
};
|
|
1862
|
+
__name(_Component, "Component");
|
|
1863
|
+
/** Marks this as a class component for the reconciler. */
|
|
1864
|
+
_Component._isClassComponent = true;
|
|
1865
|
+
var Component = _Component;
|
|
1866
|
+
|
|
1867
|
+
export { Component, Suspense, SyntheticEvent_default as SyntheticEvent, createContext, createPortal, createRoot, lazy, memo, RectifyHookUseCallback_default as useCallback, useContext, RectifyHookUseEffect_default as useEffect, RectifyHookUseId_default as useId, RectifyHookUseLayoutEffect_default as useLayoutEffect, RectifyHookUseMemo_default as useMemo, RectifyHookUseReducer_default as useReducer, RectifyHookUseRef_default as useRef, RectifyHookUseState_default as useState };
|
|
1451
1868
|
//# sourceMappingURL=index.js.map
|
|
1452
1869
|
//# sourceMappingURL=index.js.map
|