@rectify-dev/core 2.1.0 → 2.3.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 +803 -403
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +125 -3
- package/dist/index.d.ts +125 -3
- package/dist/index.js +800 -404
- 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
|
@@ -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,15 @@ 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");
|
|
267
323
|
var addFlagToFiber = /* @__PURE__ */ __name((fiber, flag) => {
|
|
268
324
|
if (hasFlagOnFiber(fiber, flag)) return;
|
|
269
325
|
fiber.flags |= flag;
|
|
@@ -285,6 +341,15 @@ var getFiberTagFromElement = /* @__PURE__ */ __name((element) => {
|
|
|
285
341
|
if (isFunction(element.type) && element.type?._isMemo === true) {
|
|
286
342
|
return MemoComponent;
|
|
287
343
|
}
|
|
344
|
+
if (element.type?._isSuspense === true) {
|
|
345
|
+
return SuspenseComponent;
|
|
346
|
+
}
|
|
347
|
+
if (element.type?._isLazy === true) {
|
|
348
|
+
return LazyComponent;
|
|
349
|
+
}
|
|
350
|
+
if (element.type?._isClassComponent === true) {
|
|
351
|
+
return ClassComponent;
|
|
352
|
+
}
|
|
288
353
|
return isFunction(element.type) ? FunctionComponent : HostComponent;
|
|
289
354
|
case RECTIFY_TEXT_TYPE:
|
|
290
355
|
return HostText;
|
|
@@ -294,12 +359,53 @@ var getFiberTagFromElement = /* @__PURE__ */ __name((element) => {
|
|
|
294
359
|
return null;
|
|
295
360
|
}
|
|
296
361
|
}, "getFiberTagFromElement");
|
|
362
|
+
var SVG_TAGS = /* @__PURE__ */ new Set([
|
|
363
|
+
"svg",
|
|
364
|
+
"circle",
|
|
365
|
+
"ellipse",
|
|
366
|
+
"line",
|
|
367
|
+
"path",
|
|
368
|
+
"polygon",
|
|
369
|
+
"polyline",
|
|
370
|
+
"rect",
|
|
371
|
+
"g",
|
|
372
|
+
"defs",
|
|
373
|
+
"use",
|
|
374
|
+
"symbol",
|
|
375
|
+
"clipPath",
|
|
376
|
+
"mask",
|
|
377
|
+
"pattern",
|
|
378
|
+
"linearGradient",
|
|
379
|
+
"radialGradient",
|
|
380
|
+
"stop",
|
|
381
|
+
"marker",
|
|
382
|
+
"image",
|
|
383
|
+
"text",
|
|
384
|
+
"tspan",
|
|
385
|
+
"textPath",
|
|
386
|
+
"foreignObject",
|
|
387
|
+
"animate",
|
|
388
|
+
"animateMotion",
|
|
389
|
+
"animateTransform",
|
|
390
|
+
"feBlend",
|
|
391
|
+
"feColorMatrix",
|
|
392
|
+
"feComposite",
|
|
393
|
+
"feGaussianBlur",
|
|
394
|
+
"feOffset",
|
|
395
|
+
"feMerge",
|
|
396
|
+
"feMergeNode",
|
|
397
|
+
"feTurbulence",
|
|
398
|
+
"feFlood"
|
|
399
|
+
]);
|
|
400
|
+
var SVG_NS2 = "http://www.w3.org/2000/svg";
|
|
297
401
|
var createDomElementFromFiber = /* @__PURE__ */ __name((fiber) => {
|
|
298
402
|
switch (fiber.workTag) {
|
|
299
403
|
case HostText:
|
|
300
404
|
return document.createTextNode(fiber.pendingProps);
|
|
301
|
-
default:
|
|
302
|
-
|
|
405
|
+
default: {
|
|
406
|
+
const tag = fiber.type;
|
|
407
|
+
return SVG_TAGS.has(tag) ? document.createElementNS(SVG_NS2, tag) : document.createElement(tag);
|
|
408
|
+
}
|
|
303
409
|
}
|
|
304
410
|
}, "createDomElementFromFiber");
|
|
305
411
|
var getParentDom = /* @__PURE__ */ __name((fiber) => {
|
|
@@ -329,8 +435,10 @@ __name(findFirstHostNode, "findFirstHostNode");
|
|
|
329
435
|
function getHostSibling(fiber) {
|
|
330
436
|
let sibling = fiber.sibling;
|
|
331
437
|
while (sibling) {
|
|
332
|
-
|
|
333
|
-
|
|
438
|
+
if (!(sibling.flags & PlacementFlag)) {
|
|
439
|
+
const node = findFirstHostNode(sibling);
|
|
440
|
+
if (node) return node;
|
|
441
|
+
}
|
|
334
442
|
sibling = sibling.sibling;
|
|
335
443
|
}
|
|
336
444
|
return null;
|
|
@@ -361,6 +469,7 @@ var createFiber = /* @__PURE__ */ __name((workTag, pendingProps, key = null) =>
|
|
|
361
469
|
sibling: null,
|
|
362
470
|
return: null,
|
|
363
471
|
stateNode: null,
|
|
472
|
+
classInstance: null,
|
|
364
473
|
deletions: null,
|
|
365
474
|
alternate: null,
|
|
366
475
|
lanes: NoLanes,
|
|
@@ -395,6 +504,7 @@ var createWorkInProgress = /* @__PURE__ */ __name((current, pendingProps) => {
|
|
|
395
504
|
}
|
|
396
505
|
wip.memoizedProps = current.memoizedProps;
|
|
397
506
|
wip.memoizedState = current.memoizedState;
|
|
507
|
+
wip.classInstance = current.classInstance;
|
|
398
508
|
wip.refCleanup = current.refCleanup;
|
|
399
509
|
wip.return = current.return;
|
|
400
510
|
wip.child = current.child;
|
|
@@ -421,6 +531,88 @@ var getScheduledFiberRoot = /* @__PURE__ */ __name(() => {
|
|
|
421
531
|
return instance.fiberRoot;
|
|
422
532
|
}, "getScheduledFiberRoot");
|
|
423
533
|
|
|
534
|
+
// ../rectify-reconciler/src/RectifyFiberScheduler.ts
|
|
535
|
+
var FRAME_BUDGET_MS = 5;
|
|
536
|
+
var frameStart = 0;
|
|
537
|
+
var shouldYield = /* @__PURE__ */ __name(() => performance.now() - frameStart > FRAME_BUDGET_MS, "shouldYield");
|
|
538
|
+
var doWork = null;
|
|
539
|
+
var setWorkCallback = /* @__PURE__ */ __name((cb) => {
|
|
540
|
+
doWork = cb;
|
|
541
|
+
}, "setWorkCallback");
|
|
542
|
+
var resumeCursor = null;
|
|
543
|
+
var setResumeCursor = /* @__PURE__ */ __name((fiber) => {
|
|
544
|
+
resumeCursor = fiber;
|
|
545
|
+
}, "setResumeCursor");
|
|
546
|
+
var getResumeCursor = /* @__PURE__ */ __name(() => resumeCursor, "getResumeCursor");
|
|
547
|
+
var clearResumeCursor = /* @__PURE__ */ __name(() => {
|
|
548
|
+
resumeCursor = null;
|
|
549
|
+
}, "clearResumeCursor");
|
|
550
|
+
var pendingLanes = NoLanes;
|
|
551
|
+
var scheduleRenderLane = /* @__PURE__ */ __name((lane) => {
|
|
552
|
+
pendingLanes |= lane;
|
|
553
|
+
if (lane & (SyncLane | InputLane)) {
|
|
554
|
+
scheduleMicrotask();
|
|
555
|
+
} else if (lane & DefaultLane) {
|
|
556
|
+
scheduleMessageTask();
|
|
557
|
+
} else if (lane & TransitionLane) {
|
|
558
|
+
scheduleTimeout();
|
|
559
|
+
} else if (lane & IdleLane) {
|
|
560
|
+
scheduleIdle();
|
|
561
|
+
}
|
|
562
|
+
}, "scheduleRenderLane");
|
|
563
|
+
var flush = /* @__PURE__ */ __name((mask) => {
|
|
564
|
+
const lanes = pendingLanes & mask;
|
|
565
|
+
if (!lanes) return;
|
|
566
|
+
pendingLanes &= ~lanes;
|
|
567
|
+
frameStart = performance.now();
|
|
568
|
+
doWork?.(lanes);
|
|
569
|
+
}, "flush");
|
|
570
|
+
var MICROTASK_MASK = SyncLane | InputLane;
|
|
571
|
+
var microtaskScheduled = false;
|
|
572
|
+
var scheduleMicrotask = /* @__PURE__ */ __name(() => {
|
|
573
|
+
if (microtaskScheduled) return;
|
|
574
|
+
microtaskScheduled = true;
|
|
575
|
+
queueMicrotask(() => {
|
|
576
|
+
microtaskScheduled = false;
|
|
577
|
+
flush(MICROTASK_MASK);
|
|
578
|
+
});
|
|
579
|
+
}, "scheduleMicrotask");
|
|
580
|
+
var DEFAULT_MASK = DefaultLane;
|
|
581
|
+
var mc = new MessageChannel();
|
|
582
|
+
var mcScheduled = false;
|
|
583
|
+
mc.port1.onmessage = () => {
|
|
584
|
+
mcScheduled = false;
|
|
585
|
+
flush(DEFAULT_MASK);
|
|
586
|
+
};
|
|
587
|
+
var scheduleMessageTask = /* @__PURE__ */ __name(() => {
|
|
588
|
+
if (mcScheduled) return;
|
|
589
|
+
mcScheduled = true;
|
|
590
|
+
mc.port2.postMessage(null);
|
|
591
|
+
}, "scheduleMessageTask");
|
|
592
|
+
var TRANSITION_MASK = TransitionLane;
|
|
593
|
+
var timeoutHandle = null;
|
|
594
|
+
var scheduleTimeout = /* @__PURE__ */ __name(() => {
|
|
595
|
+
if (timeoutHandle !== null) return;
|
|
596
|
+
timeoutHandle = setTimeout(() => {
|
|
597
|
+
timeoutHandle = null;
|
|
598
|
+
flush(TRANSITION_MASK);
|
|
599
|
+
}, 0);
|
|
600
|
+
}, "scheduleTimeout");
|
|
601
|
+
var IDLE_MASK = IdleLane;
|
|
602
|
+
var idleHandle = null;
|
|
603
|
+
var scheduleIdle = /* @__PURE__ */ __name(() => {
|
|
604
|
+
if (idleHandle !== null) return;
|
|
605
|
+
const run = /* @__PURE__ */ __name(() => {
|
|
606
|
+
idleHandle = null;
|
|
607
|
+
flush(IDLE_MASK);
|
|
608
|
+
}, "run");
|
|
609
|
+
if (typeof requestIdleCallback !== "undefined") {
|
|
610
|
+
idleHandle = requestIdleCallback(run, { timeout: 300 });
|
|
611
|
+
} else {
|
|
612
|
+
idleHandle = setTimeout(run, 300);
|
|
613
|
+
}
|
|
614
|
+
}, "scheduleIdle");
|
|
615
|
+
|
|
424
616
|
// ../rectify-hook/src/RectifyHookRenderingFiber.ts
|
|
425
617
|
var instance2 = {
|
|
426
618
|
fiberRendering: null,
|
|
@@ -466,10 +658,10 @@ var prepareToUseHooks = /* @__PURE__ */ __name((wip) => {
|
|
|
466
658
|
var finishUsingHooks = /* @__PURE__ */ __name(() => {
|
|
467
659
|
setFiberRendering(null);
|
|
468
660
|
}, "finishUsingHooks");
|
|
469
|
-
var withHooks = /* @__PURE__ */ __name((wip,
|
|
661
|
+
var withHooks = /* @__PURE__ */ __name((wip, Component2) => {
|
|
470
662
|
const NewComponent = /* @__PURE__ */ __name((props) => {
|
|
471
663
|
prepareToUseHooks(wip);
|
|
472
|
-
const result =
|
|
664
|
+
const result = Component2(props);
|
|
473
665
|
finishUsingHooks();
|
|
474
666
|
return result;
|
|
475
667
|
}, "NewComponent");
|
|
@@ -772,6 +964,30 @@ function clearContextSubscriptions(fiber) {
|
|
|
772
964
|
}
|
|
773
965
|
__name(clearContextSubscriptions, "clearContextSubscriptions");
|
|
774
966
|
|
|
967
|
+
// ../rectify-hook/src/RectifyHookUseId.ts
|
|
968
|
+
var _idCounter = 0;
|
|
969
|
+
var generateId = /* @__PURE__ */ __name(() => `_r${(_idCounter++).toString(36)}_`, "generateId");
|
|
970
|
+
var useId = /* @__PURE__ */ __name(() => {
|
|
971
|
+
const fiber = getFiberRendering();
|
|
972
|
+
if (!fiber) {
|
|
973
|
+
throw new Error("useId must be used within a function component.");
|
|
974
|
+
}
|
|
975
|
+
const hookIndex = getHookIndex();
|
|
976
|
+
nextHookIndex();
|
|
977
|
+
const { hook, prevHook } = getHookSlot(fiber, hookIndex);
|
|
978
|
+
if (!hook) {
|
|
979
|
+
const newHook = {
|
|
980
|
+
memoizedState: generateId(),
|
|
981
|
+
queue: null,
|
|
982
|
+
next: null
|
|
983
|
+
};
|
|
984
|
+
attachHook(fiber, newHook, prevHook);
|
|
985
|
+
return newHook.memoizedState;
|
|
986
|
+
}
|
|
987
|
+
return hook.memoizedState;
|
|
988
|
+
}, "useId");
|
|
989
|
+
var RectifyHookUseId_default = useId;
|
|
990
|
+
|
|
775
991
|
// ../rectify-reconciler/src/RectifyFiberRenderPriority.ts
|
|
776
992
|
var currentEventPriority = DefaultLane;
|
|
777
993
|
var setCurrentEventPriority = /* @__PURE__ */ __name((lane) => {
|
|
@@ -786,156 +1002,228 @@ var setCurrentRenderingLanes = /* @__PURE__ */ __name((lanes) => {
|
|
|
786
1002
|
currentRenderingLanes = lanes;
|
|
787
1003
|
}, "setCurrentRenderingLanes");
|
|
788
1004
|
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;
|
|
1005
|
+
var reuseOrCreate = /* @__PURE__ */ __name((oldFiber, element, wip) => {
|
|
1006
|
+
const newFiber = createWorkInProgress(oldFiber, element.props);
|
|
1007
|
+
if (hasPropsChanged(oldFiber.memoizedProps, element.props)) {
|
|
1008
|
+
addFlagToFiber(newFiber, UpdateFlag);
|
|
879
1009
|
}
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
prevSibling = prevSibling.sibling;
|
|
1010
|
+
if ((oldFiber.memoizedProps?.ref ?? null) !== (element.props?.ref ?? null)) {
|
|
1011
|
+
addFlagToFiber(newFiber, RefFlag);
|
|
883
1012
|
}
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
1013
|
+
newFiber.return = wip;
|
|
1014
|
+
return newFiber;
|
|
1015
|
+
}, "reuseOrCreate");
|
|
1016
|
+
var createAndPlace = /* @__PURE__ */ __name((element, wip) => {
|
|
1017
|
+
const newFiber = createFiberFromRectifyElement(element);
|
|
1018
|
+
newFiber.type = element.type;
|
|
1019
|
+
addFlagToFiber(newFiber, PlacementFlag);
|
|
1020
|
+
newFiber.return = wip;
|
|
1021
|
+
return newFiber;
|
|
1022
|
+
}, "createAndPlace");
|
|
1023
|
+
var appendFiber = /* @__PURE__ */ __name((fiber, prev, index, wip) => {
|
|
1024
|
+
fiber.index = index;
|
|
1025
|
+
if (!prev) wip.child = fiber;
|
|
1026
|
+
else prev.sibling = fiber;
|
|
1027
|
+
return fiber;
|
|
1028
|
+
}, "appendFiber");
|
|
1029
|
+
var buildOldFiberStructures = /* @__PURE__ */ __name((firstRemaining) => {
|
|
1030
|
+
const keyedMap = /* @__PURE__ */ new Map();
|
|
1031
|
+
const unkeyedByType = /* @__PURE__ */ new Map();
|
|
1032
|
+
let fiber = firstRemaining;
|
|
1033
|
+
while (fiber) {
|
|
1034
|
+
if (fiber.key !== null && fiber.key !== void 0) {
|
|
1035
|
+
keyedMap.set(fiber.key, fiber);
|
|
892
1036
|
} else {
|
|
893
|
-
|
|
1037
|
+
const pool = unkeyedByType.get(fiber.type);
|
|
1038
|
+
if (pool) pool.push(fiber);
|
|
1039
|
+
else unkeyedByType.set(fiber.type, [fiber]);
|
|
894
1040
|
}
|
|
1041
|
+
fiber = fiber.sibling;
|
|
895
1042
|
}
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
const
|
|
902
|
-
|
|
903
|
-
|
|
1043
|
+
return { keyedMap, unkeyedByType };
|
|
1044
|
+
}, "buildOldFiberStructures");
|
|
1045
|
+
var reconcileSequential = /* @__PURE__ */ __name((state, firstOldFiber) => {
|
|
1046
|
+
let oldFiber = firstOldFiber;
|
|
1047
|
+
for (let i = 0; i < state.newElements.length; i++) {
|
|
1048
|
+
const element = state.newElements[i];
|
|
1049
|
+
const { key: elementKey = null, type: elementType } = element;
|
|
1050
|
+
if (!oldFiber) return { stoppedAt: i, oldFiber: null };
|
|
1051
|
+
if (oldFiber.key !== elementKey) return { stoppedAt: i, oldFiber };
|
|
1052
|
+
if (oldFiber.type === elementType) {
|
|
1053
|
+
state.prev = appendFiber(
|
|
1054
|
+
reuseOrCreate(oldFiber, element, state.wip),
|
|
1055
|
+
state.prev,
|
|
1056
|
+
state.index++,
|
|
1057
|
+
state.wip
|
|
1058
|
+
);
|
|
1059
|
+
} else if (elementKey !== null) {
|
|
1060
|
+
addFlagToFiber(oldFiber, DeletionFlag);
|
|
1061
|
+
state.deletions.push(oldFiber);
|
|
1062
|
+
state.prev = appendFiber(
|
|
1063
|
+
createAndPlace(element, state.wip),
|
|
1064
|
+
state.prev,
|
|
1065
|
+
state.index++,
|
|
1066
|
+
state.wip
|
|
1067
|
+
);
|
|
904
1068
|
} else {
|
|
905
|
-
|
|
1069
|
+
return { stoppedAt: i, oldFiber };
|
|
906
1070
|
}
|
|
1071
|
+
oldFiber = oldFiber.sibling;
|
|
907
1072
|
}
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
} else {
|
|
924
|
-
|
|
1073
|
+
return { stoppedAt: state.newElements.length, oldFiber };
|
|
1074
|
+
}, "reconcileSequential");
|
|
1075
|
+
var reconcileKeyed = /* @__PURE__ */ __name((state, startAt, remainingOldFiber) => {
|
|
1076
|
+
const { keyedMap, unkeyedByType } = buildOldFiberStructures(remainingOldFiber);
|
|
1077
|
+
let lastPlacedIndex = 0;
|
|
1078
|
+
for (let i = startAt; i < state.newElements.length; i++) {
|
|
1079
|
+
const element = state.newElements[i];
|
|
1080
|
+
const { key: elementKey = null, type: elementType } = element;
|
|
1081
|
+
let matched = null;
|
|
1082
|
+
if (elementKey !== null) {
|
|
1083
|
+
const candidate = keyedMap.get(elementKey) ?? null;
|
|
1084
|
+
if (candidate && candidate.type === elementType) {
|
|
1085
|
+
keyedMap.delete(elementKey);
|
|
1086
|
+
matched = candidate;
|
|
1087
|
+
}
|
|
1088
|
+
} else {
|
|
1089
|
+
const pool = unkeyedByType.get(elementType);
|
|
1090
|
+
if (pool?.length) matched = pool.shift();
|
|
1091
|
+
}
|
|
1092
|
+
if (matched) {
|
|
1093
|
+
const newFiber = reuseOrCreate(matched, element, state.wip);
|
|
1094
|
+
if (matched.index < lastPlacedIndex) {
|
|
1095
|
+
addFlagToFiber(newFiber, MoveFlag);
|
|
1096
|
+
} else {
|
|
1097
|
+
lastPlacedIndex = matched.index;
|
|
1098
|
+
}
|
|
1099
|
+
state.prev = appendFiber(newFiber, state.prev, state.index++, state.wip);
|
|
1100
|
+
} else {
|
|
1101
|
+
state.prev = appendFiber(
|
|
1102
|
+
createAndPlace(element, state.wip),
|
|
1103
|
+
state.prev,
|
|
1104
|
+
state.index++,
|
|
1105
|
+
state.wip
|
|
1106
|
+
);
|
|
925
1107
|
}
|
|
926
|
-
if (completed) bubbleFlagsToRoot(wip);
|
|
927
|
-
return completed;
|
|
928
1108
|
}
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
1109
|
+
for (const orphan of keyedMap.values()) {
|
|
1110
|
+
addFlagToFiber(orphan, DeletionFlag);
|
|
1111
|
+
state.deletions.push(orphan);
|
|
1112
|
+
}
|
|
1113
|
+
for (const pool of unkeyedByType.values()) {
|
|
1114
|
+
for (const orphan of pool) {
|
|
1115
|
+
addFlagToFiber(orphan, DeletionFlag);
|
|
1116
|
+
state.deletions.push(orphan);
|
|
935
1117
|
}
|
|
936
1118
|
}
|
|
937
|
-
|
|
938
|
-
|
|
1119
|
+
}, "reconcileKeyed");
|
|
1120
|
+
var toChildArray = /* @__PURE__ */ __name((children) => {
|
|
1121
|
+
if (children == null || typeof children === "boolean") return [];
|
|
1122
|
+
if (isArray(children)) return children;
|
|
1123
|
+
return [children];
|
|
1124
|
+
}, "toChildArray");
|
|
1125
|
+
var reconcileChildren = /* @__PURE__ */ __name((wip, children) => {
|
|
1126
|
+
const newElements = toChildArray(children).map(createElementFromRectifyNode).filter(isValidRectifyElement);
|
|
1127
|
+
const state = {
|
|
1128
|
+
wip,
|
|
1129
|
+
newElements,
|
|
1130
|
+
deletions: [],
|
|
1131
|
+
prev: null,
|
|
1132
|
+
index: 0
|
|
1133
|
+
};
|
|
1134
|
+
const firstOldFiber = wip.alternate?.child ?? null;
|
|
1135
|
+
const { stoppedAt, oldFiber } = reconcileSequential(state, firstOldFiber);
|
|
1136
|
+
if (stoppedAt < newElements.length) {
|
|
1137
|
+
reconcileKeyed(state, stoppedAt, oldFiber);
|
|
1138
|
+
} else {
|
|
1139
|
+
let leftover = oldFiber;
|
|
1140
|
+
while (leftover) {
|
|
1141
|
+
addFlagToFiber(leftover, DeletionFlag);
|
|
1142
|
+
state.deletions.push(leftover);
|
|
1143
|
+
leftover = leftover.sibling;
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
if (state.prev) state.prev.sibling = null;
|
|
1147
|
+
if (state.deletions.length) wip.deletions = state.deletions;
|
|
1148
|
+
}, "reconcileChildren");
|
|
1149
|
+
|
|
1150
|
+
// ../rectify-reconciler/src/RectifyFiberConcurrentUpdate.ts
|
|
1151
|
+
var instance3 = {
|
|
1152
|
+
head: null,
|
|
1153
|
+
tail: null
|
|
1154
|
+
};
|
|
1155
|
+
var enqueueUpdate = /* @__PURE__ */ __name((update) => {
|
|
1156
|
+
update.next = null;
|
|
1157
|
+
if (instance3.tail === null) {
|
|
1158
|
+
instance3.head = update;
|
|
1159
|
+
instance3.tail = update;
|
|
1160
|
+
return;
|
|
1161
|
+
}
|
|
1162
|
+
instance3.tail.next = update;
|
|
1163
|
+
instance3.tail = update;
|
|
1164
|
+
}, "enqueueUpdate");
|
|
1165
|
+
var dequeueUpdate = /* @__PURE__ */ __name(() => {
|
|
1166
|
+
const first = instance3.head;
|
|
1167
|
+
if (first === null) {
|
|
1168
|
+
return null;
|
|
1169
|
+
}
|
|
1170
|
+
instance3.head = first.next;
|
|
1171
|
+
if (instance3.head === null) {
|
|
1172
|
+
instance3.tail = null;
|
|
1173
|
+
}
|
|
1174
|
+
first.next = null;
|
|
1175
|
+
return first;
|
|
1176
|
+
}, "dequeueUpdate");
|
|
1177
|
+
var hasUpdate = /* @__PURE__ */ __name(() => instance3.head !== null, "hasUpdate");
|
|
1178
|
+
|
|
1179
|
+
// ../rectify-reconciler/src/RectifyFiberSuspense.ts
|
|
1180
|
+
var suspendedBoundaries = /* @__PURE__ */ new WeakSet();
|
|
1181
|
+
var stableFiber = /* @__PURE__ */ __name((fiber) => fiber.alternate ?? fiber, "stableFiber");
|
|
1182
|
+
var isSuspendedBoundary = /* @__PURE__ */ __name((fiber) => suspendedBoundaries.has(stableFiber(fiber)), "isSuspendedBoundary");
|
|
1183
|
+
var findNearestSuspenseBoundary = /* @__PURE__ */ __name((fiber) => {
|
|
1184
|
+
let current = fiber.return;
|
|
1185
|
+
while (current) {
|
|
1186
|
+
if (current.workTag === SuspenseComponent) return current;
|
|
1187
|
+
current = current.return;
|
|
1188
|
+
}
|
|
1189
|
+
return null;
|
|
1190
|
+
}, "findNearestSuspenseBoundary");
|
|
1191
|
+
var handleSuspendedWork = /* @__PURE__ */ __name((boundary, thenable) => {
|
|
1192
|
+
const stable = stableFiber(boundary);
|
|
1193
|
+
if (suspendedBoundaries.has(stable)) return;
|
|
1194
|
+
suspendedBoundaries.add(stable);
|
|
1195
|
+
boundary.child = null;
|
|
1196
|
+
boundary.deletions = null;
|
|
1197
|
+
thenable.then(
|
|
1198
|
+
() => {
|
|
1199
|
+
suspendedBoundaries.delete(stable);
|
|
1200
|
+
enqueueUpdate({ lanes: DefaultLane, fiber: stable, next: null });
|
|
1201
|
+
scheduleRenderLane(DefaultLane);
|
|
1202
|
+
},
|
|
1203
|
+
() => {
|
|
1204
|
+
suspendedBoundaries.delete(stable);
|
|
1205
|
+
}
|
|
1206
|
+
);
|
|
1207
|
+
}, "handleSuspendedWork");
|
|
1208
|
+
var isThenable = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && typeof value.then === "function", "isThenable");
|
|
1209
|
+
|
|
1210
|
+
// ../rectify-reconciler/src/RectifyFiberBeginWork.ts
|
|
1211
|
+
var hasNoPendingWork = /* @__PURE__ */ __name((wip) => !(wip.lanes & getCurrentLanePriority()), "hasNoPendingWork");
|
|
1212
|
+
var isUpdate = /* @__PURE__ */ __name((wip) => wip.alternate !== null, "isUpdate");
|
|
1213
|
+
var flushStateQueue = /* @__PURE__ */ __name((currentState, props, queue) => {
|
|
1214
|
+
let state = currentState;
|
|
1215
|
+
for (const update of queue) {
|
|
1216
|
+
const partial = typeof update === "function" ? update(state, props) : update;
|
|
1217
|
+
state = { ...state, ...partial };
|
|
1218
|
+
}
|
|
1219
|
+
return state;
|
|
1220
|
+
}, "flushStateQueue");
|
|
1221
|
+
var renderFunctionComponent = /* @__PURE__ */ __name((wip, Component2) => {
|
|
1222
|
+
const ComponentWithHooks = withHooks(wip, Component2);
|
|
1223
|
+
const children = ComponentWithHooks(wip.pendingProps);
|
|
1224
|
+
reconcileChildren(wip, children);
|
|
1225
|
+
}, "renderFunctionComponent");
|
|
1226
|
+
var getProviderContext = /* @__PURE__ */ __name((wip) => wip.type._context, "getProviderContext");
|
|
939
1227
|
var cloneChildFibers = /* @__PURE__ */ __name((wip) => {
|
|
940
1228
|
const currentChild = wip.alternate?.child ?? null;
|
|
941
1229
|
if (!currentChild) {
|
|
@@ -958,14 +1246,6 @@ var cloneChildFibers = /* @__PURE__ */ __name((wip) => {
|
|
|
958
1246
|
if (prevNewChild) prevNewChild.sibling = null;
|
|
959
1247
|
return wip.child;
|
|
960
1248
|
}, "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
1249
|
var beginWork = /* @__PURE__ */ __name((wip) => {
|
|
970
1250
|
switch (wip.workTag) {
|
|
971
1251
|
case MemoComponent: {
|
|
@@ -980,12 +1260,12 @@ var beginWork = /* @__PURE__ */ __name((wip) => {
|
|
|
980
1260
|
break;
|
|
981
1261
|
}
|
|
982
1262
|
case FunctionComponent: {
|
|
983
|
-
const
|
|
984
|
-
if (!isFunction(
|
|
1263
|
+
const Component2 = wip.type;
|
|
1264
|
+
if (!isFunction(Component2)) break;
|
|
985
1265
|
if (isUpdate(wip) && hasNoPendingWork(wip) && shallowEqual(wip.memoizedProps, wip.pendingProps)) {
|
|
986
1266
|
return cloneChildFibers(wip);
|
|
987
1267
|
}
|
|
988
|
-
renderFunctionComponent(wip,
|
|
1268
|
+
renderFunctionComponent(wip, Component2);
|
|
989
1269
|
break;
|
|
990
1270
|
}
|
|
991
1271
|
case FragmentComponent:
|
|
@@ -1008,33 +1288,80 @@ var beginWork = /* @__PURE__ */ __name((wip) => {
|
|
|
1008
1288
|
}
|
|
1009
1289
|
break;
|
|
1010
1290
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
let completed = unit;
|
|
1016
|
-
while (completed) {
|
|
1017
|
-
bubbleProperties(completed);
|
|
1018
|
-
if (completed === stopAt) {
|
|
1019
|
-
return null;
|
|
1291
|
+
case SuspenseComponent: {
|
|
1292
|
+
const children = isSuspendedBoundary(wip) ? wip.pendingProps?.fallback : wip.pendingProps?.children;
|
|
1293
|
+
reconcileChildren(wip, children);
|
|
1294
|
+
break;
|
|
1020
1295
|
}
|
|
1021
|
-
|
|
1022
|
-
|
|
1296
|
+
case ClassComponent: {
|
|
1297
|
+
const Ctor = wip.type;
|
|
1298
|
+
const isMount = !wip.classInstance;
|
|
1299
|
+
if (isMount) {
|
|
1300
|
+
const instance4 = new Ctor(wip.pendingProps);
|
|
1301
|
+
instance4._fiber = wip;
|
|
1302
|
+
wip.classInstance = instance4;
|
|
1303
|
+
if (instance4._pendingStateQueue?.length) {
|
|
1304
|
+
instance4.state = flushStateQueue(
|
|
1305
|
+
instance4.state,
|
|
1306
|
+
instance4.props,
|
|
1307
|
+
instance4._pendingStateQueue
|
|
1308
|
+
);
|
|
1309
|
+
instance4._pendingStateQueue = [];
|
|
1310
|
+
}
|
|
1311
|
+
} else {
|
|
1312
|
+
const instance4 = wip.classInstance;
|
|
1313
|
+
if (hasNoPendingWork(wip) && !instance4._pendingStateQueue?.length && shallowEqual(instance4.props, wip.pendingProps)) {
|
|
1314
|
+
return cloneChildFibers(wip);
|
|
1315
|
+
}
|
|
1316
|
+
instance4._prevProps = instance4.props;
|
|
1317
|
+
instance4._prevState = { ...instance4.state };
|
|
1318
|
+
if (instance4._pendingStateQueue?.length) {
|
|
1319
|
+
instance4.state = flushStateQueue(
|
|
1320
|
+
instance4.state,
|
|
1321
|
+
wip.pendingProps,
|
|
1322
|
+
instance4._pendingStateQueue
|
|
1323
|
+
);
|
|
1324
|
+
instance4._pendingStateQueue = [];
|
|
1325
|
+
}
|
|
1326
|
+
instance4.props = wip.pendingProps;
|
|
1327
|
+
instance4._fiber = wip;
|
|
1328
|
+
if (isUpdate(wip) && typeof instance4.shouldComponentUpdate === "function" && !instance4.shouldComponentUpdate(wip.pendingProps, instance4.state)) {
|
|
1329
|
+
return cloneChildFibers(wip);
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
const children = wip.classInstance.render();
|
|
1333
|
+
reconcileChildren(wip, children);
|
|
1334
|
+
break;
|
|
1335
|
+
}
|
|
1336
|
+
case LazyComponent: {
|
|
1337
|
+
const lazy2 = wip.type;
|
|
1338
|
+
if (lazy2._status === "resolved") {
|
|
1339
|
+
renderFunctionComponent(wip, lazy2._result);
|
|
1340
|
+
break;
|
|
1341
|
+
}
|
|
1342
|
+
if (lazy2._status === "rejected") {
|
|
1343
|
+
throw lazy2._result;
|
|
1344
|
+
}
|
|
1345
|
+
if (lazy2._status === "uninitialized") {
|
|
1346
|
+
lazy2._status = "pending";
|
|
1347
|
+
lazy2._promise = lazy2._factory().then(
|
|
1348
|
+
(module) => {
|
|
1349
|
+
lazy2._status = "resolved";
|
|
1350
|
+
lazy2._result = module?.default ?? module;
|
|
1351
|
+
},
|
|
1352
|
+
(error) => {
|
|
1353
|
+
lazy2._status = "rejected";
|
|
1354
|
+
lazy2._result = error;
|
|
1355
|
+
}
|
|
1356
|
+
);
|
|
1357
|
+
}
|
|
1358
|
+
throw lazy2._promise;
|
|
1023
1359
|
}
|
|
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
1360
|
}
|
|
1037
|
-
|
|
1361
|
+
return wip.child;
|
|
1362
|
+
}, "beginWork");
|
|
1363
|
+
|
|
1364
|
+
// ../rectify-reconciler/src/RectifyFiberCompleteWork.ts
|
|
1038
1365
|
var bubbleProperties = /* @__PURE__ */ __name((wip) => {
|
|
1039
1366
|
wip.lanes &= ~getCurrentLanePriority();
|
|
1040
1367
|
let subtreeFlags = NoFlags;
|
|
@@ -1049,140 +1376,109 @@ var bubbleProperties = /* @__PURE__ */ __name((wip) => {
|
|
|
1049
1376
|
wip.subtreeFlags = subtreeFlags;
|
|
1050
1377
|
wip.childLanes = childLanes;
|
|
1051
1378
|
}, "bubbleProperties");
|
|
1052
|
-
var
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1379
|
+
var bubbleFlagsToRoot = /* @__PURE__ */ __name((wip) => {
|
|
1380
|
+
let current = wip;
|
|
1381
|
+
let parent = current.return;
|
|
1382
|
+
while (parent) {
|
|
1383
|
+
parent.subtreeFlags |= current.flags | current.subtreeFlags;
|
|
1384
|
+
parent.childLanes |= current.lanes | current.childLanes;
|
|
1385
|
+
current = parent;
|
|
1386
|
+
parent = parent.return;
|
|
1056
1387
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1388
|
+
}, "bubbleFlagsToRoot");
|
|
1389
|
+
var completeUnitOfWork = /* @__PURE__ */ __name((unit, stopAt) => {
|
|
1390
|
+
let completed = unit;
|
|
1391
|
+
while (completed) {
|
|
1392
|
+
bubbleProperties(completed);
|
|
1393
|
+
if (completed === stopAt) return null;
|
|
1394
|
+
if (completed.sibling) return completed.sibling;
|
|
1395
|
+
completed = completed.return;
|
|
1059
1396
|
}
|
|
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++;
|
|
1397
|
+
return null;
|
|
1398
|
+
}, "completeUnitOfWork");
|
|
1399
|
+
|
|
1400
|
+
// ../rectify-reconciler/src/RectifyFiberWorkLoop.ts
|
|
1401
|
+
var swapCurrentForWip = /* @__PURE__ */ __name((current, wip) => {
|
|
1402
|
+
const parent = wip.return;
|
|
1403
|
+
if (!parent) return;
|
|
1404
|
+
if (parent.child === current) {
|
|
1405
|
+
parent.child = wip;
|
|
1406
|
+
return;
|
|
1084
1407
|
}
|
|
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;
|
|
1408
|
+
let prevSibling = parent.child;
|
|
1409
|
+
while (prevSibling && prevSibling.sibling !== current) {
|
|
1410
|
+
prevSibling = prevSibling.sibling;
|
|
1103
1411
|
}
|
|
1104
|
-
|
|
1105
|
-
}, "
|
|
1106
|
-
var
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
lastPlacedIndex = matched.index;
|
|
1412
|
+
if (prevSibling) prevSibling.sibling = wip;
|
|
1413
|
+
}, "swapCurrentForWip");
|
|
1414
|
+
var workLoop = /* @__PURE__ */ __name((wipRoot) => {
|
|
1415
|
+
let workInProgress = wipRoot;
|
|
1416
|
+
while (workInProgress) {
|
|
1417
|
+
try {
|
|
1418
|
+
const next = beginWork(workInProgress);
|
|
1419
|
+
workInProgress = next ?? completeUnitOfWork(workInProgress, wipRoot);
|
|
1420
|
+
} catch (thrown) {
|
|
1421
|
+
if (isThenable(thrown) && workInProgress) {
|
|
1422
|
+
const boundary = findNearestSuspenseBoundary(workInProgress);
|
|
1423
|
+
if (boundary) {
|
|
1424
|
+
handleSuspendedWork(boundary, thrown);
|
|
1425
|
+
workInProgress = boundary;
|
|
1426
|
+
continue;
|
|
1427
|
+
}
|
|
1121
1428
|
}
|
|
1122
|
-
|
|
1123
|
-
} else {
|
|
1124
|
-
state.prev = appendFiber(createAndPlace(element, state.wip), state.prev, state.index++, state.wip);
|
|
1429
|
+
throw thrown;
|
|
1125
1430
|
}
|
|
1126
1431
|
}
|
|
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;
|
|
1432
|
+
}, "workLoop");
|
|
1433
|
+
var workLoopConcurrent = /* @__PURE__ */ __name((wipRoot) => {
|
|
1434
|
+
let workInProgress = getResumeCursor() ?? wipRoot;
|
|
1435
|
+
clearResumeCursor();
|
|
1436
|
+
while (workInProgress && !shouldYield()) {
|
|
1437
|
+
try {
|
|
1438
|
+
const next = beginWork(workInProgress);
|
|
1439
|
+
workInProgress = next ?? completeUnitOfWork(workInProgress, wipRoot);
|
|
1440
|
+
} catch (thrown) {
|
|
1441
|
+
if (isThenable(thrown) && workInProgress) {
|
|
1442
|
+
const boundary = findNearestSuspenseBoundary(workInProgress);
|
|
1443
|
+
if (boundary) {
|
|
1444
|
+
handleSuspendedWork(boundary, thrown);
|
|
1445
|
+
workInProgress = boundary;
|
|
1446
|
+
continue;
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
throw thrown;
|
|
1150
1450
|
}
|
|
1151
1451
|
}
|
|
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;
|
|
1452
|
+
if (workInProgress !== null) {
|
|
1453
|
+
setResumeCursor(workInProgress);
|
|
1454
|
+
return false;
|
|
1162
1455
|
}
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1456
|
+
return true;
|
|
1457
|
+
}, "workLoopConcurrent");
|
|
1458
|
+
var workLoopOnFiberLanes = /* @__PURE__ */ __name((wipRoot, renderLanes) => {
|
|
1459
|
+
if (wipRoot.lanes & renderLanes) {
|
|
1460
|
+
const wip = createWorkInProgress(wipRoot, wipRoot.pendingProps);
|
|
1461
|
+
swapCurrentForWip(wipRoot, wip);
|
|
1462
|
+
const isSync = !!(renderLanes & (SyncLane | InputLane));
|
|
1463
|
+
const completed = isSync ? (workLoop(wip), true) : workLoopConcurrent(wip);
|
|
1464
|
+
if (completed) bubbleFlagsToRoot(wip);
|
|
1465
|
+
return completed;
|
|
1166
1466
|
}
|
|
1167
|
-
if (
|
|
1168
|
-
let child =
|
|
1467
|
+
if (wipRoot.childLanes & renderLanes) {
|
|
1468
|
+
let child = wipRoot.child;
|
|
1169
1469
|
while (child) {
|
|
1170
|
-
|
|
1470
|
+
if (!workLoopOnFiberLanes(child, renderLanes)) return false;
|
|
1171
1471
|
child = child.sibling;
|
|
1172
1472
|
}
|
|
1173
1473
|
}
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
}, "commitWork");
|
|
1177
|
-
var syncMemoizedProps = /* @__PURE__ */ __name((wip) => {
|
|
1178
|
-
wip.memoizedProps = wip.pendingProps;
|
|
1179
|
-
}, "syncMemoizedProps");
|
|
1474
|
+
return true;
|
|
1475
|
+
}, "workLoopOnFiberLanes");
|
|
1180
1476
|
var attachRef = /* @__PURE__ */ __name((wip) => {
|
|
1181
1477
|
const ref = wip.pendingProps?.ref;
|
|
1182
1478
|
if (!ref) return;
|
|
1183
|
-
if (
|
|
1479
|
+
if (isFunction(ref)) {
|
|
1184
1480
|
const cleanup = ref(wip.stateNode);
|
|
1185
|
-
wip.refCleanup =
|
|
1481
|
+
wip.refCleanup = isFunction(cleanup) ? cleanup : null;
|
|
1186
1482
|
} else if (typeof ref === "object" && "current" in ref) {
|
|
1187
1483
|
ref.current = wip.stateNode;
|
|
1188
1484
|
}
|
|
@@ -1201,27 +1497,30 @@ var detachRef = /* @__PURE__ */ __name((fiber) => {
|
|
|
1201
1497
|
ref.current = null;
|
|
1202
1498
|
}
|
|
1203
1499
|
}, "detachRef");
|
|
1500
|
+
|
|
1501
|
+
// ../rectify-reconciler/src/RectifyFiberCommitPlacement.ts
|
|
1204
1502
|
var insertIntoParent = /* @__PURE__ */ __name((wip, node) => {
|
|
1205
1503
|
const parentDom = getParentDom(wip);
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1504
|
+
let cursor = wip;
|
|
1505
|
+
while (cursor) {
|
|
1506
|
+
const before = getHostSibling(cursor);
|
|
1507
|
+
if (before) {
|
|
1508
|
+
parentDom.insertBefore(node, before);
|
|
1509
|
+
return;
|
|
1510
|
+
}
|
|
1511
|
+
const parent = cursor.return;
|
|
1512
|
+
if (!parent || parent.workTag === HostComponent || parent.workTag === HostRoot) break;
|
|
1513
|
+
cursor = parent;
|
|
1514
|
+
}
|
|
1515
|
+
parentDom.appendChild(node);
|
|
1209
1516
|
}, "insertIntoParent");
|
|
1210
1517
|
var placeNode = /* @__PURE__ */ __name((wip, node) => {
|
|
1211
1518
|
insertIntoParent(wip, node);
|
|
1212
1519
|
precacheFiberNode(wip, node);
|
|
1213
1520
|
attachRef(wip);
|
|
1214
1521
|
}, "placeNode");
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
case HostComponent:
|
|
1218
|
-
commitMutationHostComponent(childFiber);
|
|
1219
|
-
break;
|
|
1220
|
-
case HostText:
|
|
1221
|
-
commitMutationHostText(childFiber);
|
|
1222
|
-
break;
|
|
1223
|
-
}
|
|
1224
|
-
}, "commitMutation");
|
|
1522
|
+
|
|
1523
|
+
// ../rectify-reconciler/src/RectifyFiberCommitMutation.ts
|
|
1225
1524
|
var commitMutationHostComponent = /* @__PURE__ */ __name((wip) => {
|
|
1226
1525
|
if (!wip.stateNode) {
|
|
1227
1526
|
const node = createDomElementFromFiber(wip);
|
|
@@ -1272,7 +1571,22 @@ var commitMutationHostText = /* @__PURE__ */ __name((wip) => {
|
|
|
1272
1571
|
removeFlagFromFiber(wip, UpdateFlag);
|
|
1273
1572
|
}
|
|
1274
1573
|
}, "commitMutationHostText");
|
|
1574
|
+
var commitMutation = /* @__PURE__ */ __name((fiber) => {
|
|
1575
|
+
switch (fiber.workTag) {
|
|
1576
|
+
case HostComponent:
|
|
1577
|
+
commitMutationHostComponent(fiber);
|
|
1578
|
+
break;
|
|
1579
|
+
case HostText:
|
|
1580
|
+
commitMutationHostText(fiber);
|
|
1581
|
+
break;
|
|
1582
|
+
}
|
|
1583
|
+
}, "commitMutation");
|
|
1584
|
+
|
|
1585
|
+
// ../rectify-reconciler/src/RectifyFiberCommitRemoval.ts
|
|
1275
1586
|
var removeHostTree = /* @__PURE__ */ __name((fiber) => {
|
|
1587
|
+
if (fiber.workTag === ClassComponent) {
|
|
1588
|
+
fiber.classInstance?.componentWillUnmount?.();
|
|
1589
|
+
}
|
|
1276
1590
|
if (fiber.memoizedState) {
|
|
1277
1591
|
runEffectCleanups(fiber);
|
|
1278
1592
|
}
|
|
@@ -1288,96 +1602,48 @@ var removeHostTree = /* @__PURE__ */ __name((fiber) => {
|
|
|
1288
1602
|
}
|
|
1289
1603
|
}, "removeHostTree");
|
|
1290
1604
|
|
|
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;
|
|
1605
|
+
// ../rectify-reconciler/src/RectifyFiberCommitWork.ts
|
|
1606
|
+
var MutationMask = PlacementFlag | UpdateFlag | MoveFlag | RefFlag;
|
|
1607
|
+
var commitWork = /* @__PURE__ */ __name((finishedWork) => {
|
|
1608
|
+
if (finishedWork.deletions?.length) {
|
|
1609
|
+
finishedWork.deletions.forEach(removeHostTree);
|
|
1610
|
+
finishedWork.deletions = null;
|
|
1314
1611
|
}
|
|
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;
|
|
1612
|
+
if (finishedWork.flags & MutationMask) {
|
|
1613
|
+
commitMutation(finishedWork);
|
|
1614
|
+
finishedWork.memoizedProps = finishedWork.pendingProps;
|
|
1335
1615
|
}
|
|
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);
|
|
1616
|
+
if (finishedWork.subtreeFlags & MutationMask) {
|
|
1617
|
+
let child = finishedWork.child;
|
|
1618
|
+
while (child) {
|
|
1619
|
+
commitWork(child);
|
|
1620
|
+
child = child.sibling;
|
|
1621
|
+
}
|
|
1348
1622
|
}
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1623
|
+
if (finishedWork.workTag === ClassComponent && finishedWork.classInstance) {
|
|
1624
|
+
const instance4 = finishedWork.classInstance;
|
|
1625
|
+
const isMount = finishedWork.alternate === null;
|
|
1626
|
+
if (isMount) {
|
|
1627
|
+
instance4.componentDidMount?.();
|
|
1628
|
+
} else if (instance4._prevState !== void 0) {
|
|
1629
|
+
instance4.componentDidUpdate?.(
|
|
1630
|
+
instance4._prevProps,
|
|
1631
|
+
instance4._prevState
|
|
1632
|
+
);
|
|
1633
|
+
instance4._prevProps = void 0;
|
|
1634
|
+
instance4._prevState = void 0;
|
|
1635
|
+
}
|
|
1361
1636
|
}
|
|
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");
|
|
1637
|
+
finishedWork.flags = NoFlags;
|
|
1638
|
+
finishedWork.subtreeFlags = NoFlags;
|
|
1639
|
+
}, "commitWork");
|
|
1640
|
+
|
|
1641
|
+
// ../rectify-reconciler/src/RectifyFiberFlushPhase.ts
|
|
1642
|
+
var _isFlushingLayoutEffects = false;
|
|
1643
|
+
var getIsFlushingLayoutEffects = /* @__PURE__ */ __name(() => _isFlushingLayoutEffects, "getIsFlushingLayoutEffects");
|
|
1644
|
+
var setIsFlushingLayoutEffects = /* @__PURE__ */ __name((value) => {
|
|
1645
|
+
_isFlushingLayoutEffects = value;
|
|
1646
|
+
}, "setIsFlushingLayoutEffects");
|
|
1381
1647
|
var passiveChannel = new MessageChannel();
|
|
1382
1648
|
var schedulePassiveEffects = /* @__PURE__ */ __name(() => {
|
|
1383
1649
|
passiveChannel.port1.onmessage = () => {
|
|
@@ -1388,10 +1654,10 @@ var schedulePassiveEffects = /* @__PURE__ */ __name(() => {
|
|
|
1388
1654
|
}, "schedulePassiveEffects");
|
|
1389
1655
|
var flushLayoutPhase = /* @__PURE__ */ __name((fiberRoot) => {
|
|
1390
1656
|
while (true) {
|
|
1391
|
-
|
|
1657
|
+
setIsFlushingLayoutEffects(true);
|
|
1392
1658
|
flushLayoutEffectCleanups();
|
|
1393
1659
|
flushLayoutEffects();
|
|
1394
|
-
|
|
1660
|
+
setIsFlushingLayoutEffects(false);
|
|
1395
1661
|
if (!hasUpdate()) break;
|
|
1396
1662
|
flushPendingUpdates();
|
|
1397
1663
|
setCurrentRenderingLanes(SyncLane);
|
|
@@ -1422,6 +1688,71 @@ var propagateLaneToAncestors = /* @__PURE__ */ __name((updateQueue) => {
|
|
|
1422
1688
|
}
|
|
1423
1689
|
}, "propagateLaneToAncestors");
|
|
1424
1690
|
|
|
1691
|
+
// ../rectify-reconciler/src/RectifyFiberHookBridge.ts
|
|
1692
|
+
var onScheduleRerender = /* @__PURE__ */ __name((fiber) => {
|
|
1693
|
+
const lane = getIsFlushingLayoutEffects() ? SyncLane : requestUpdateLane();
|
|
1694
|
+
enqueueUpdate({ lanes: lane, fiber, next: null });
|
|
1695
|
+
if (!getIsFlushingLayoutEffects()) {
|
|
1696
|
+
scheduleRenderLane(lane);
|
|
1697
|
+
}
|
|
1698
|
+
}, "onScheduleRerender");
|
|
1699
|
+
var onMarkFiberDirty = /* @__PURE__ */ __name((fiber) => {
|
|
1700
|
+
const lane = getCurrentLanePriority();
|
|
1701
|
+
fiber.lanes |= lane;
|
|
1702
|
+
const wip = fiber.alternate;
|
|
1703
|
+
if (!wip) return;
|
|
1704
|
+
wip.lanes |= lane;
|
|
1705
|
+
let parent = wip.return;
|
|
1706
|
+
while (parent) {
|
|
1707
|
+
if ((parent.childLanes & lane) === lane) break;
|
|
1708
|
+
parent.childLanes |= lane;
|
|
1709
|
+
parent = parent.return;
|
|
1710
|
+
}
|
|
1711
|
+
}, "onMarkFiberDirty");
|
|
1712
|
+
setScheduleRerender(onScheduleRerender);
|
|
1713
|
+
setMarkFiberDirty(onMarkFiberDirty);
|
|
1714
|
+
|
|
1715
|
+
// ../rectify-reconciler/src/RectifyFiberBootstrap.ts
|
|
1716
|
+
injectEventPriorityCallbacks(
|
|
1717
|
+
setCurrentEventPriority,
|
|
1718
|
+
resetCurrentEventPriority
|
|
1719
|
+
);
|
|
1720
|
+
var performWork = /* @__PURE__ */ __name((lanes) => {
|
|
1721
|
+
const fiberRoot = getScheduledFiberRoot();
|
|
1722
|
+
if (!fiberRoot) return;
|
|
1723
|
+
if (!getResumeCursor()) flushPendingUpdates();
|
|
1724
|
+
setCurrentRenderingLanes(lanes);
|
|
1725
|
+
const completed = workLoopOnFiberLanes(fiberRoot.root, lanes);
|
|
1726
|
+
if (!completed) {
|
|
1727
|
+
scheduleRenderLane(lanes);
|
|
1728
|
+
return;
|
|
1729
|
+
}
|
|
1730
|
+
clearResumeCursor();
|
|
1731
|
+
commitWork(fiberRoot.root);
|
|
1732
|
+
markContainerAsRoot(fiberRoot.root, fiberRoot.containerDom);
|
|
1733
|
+
flushLayoutPhase(fiberRoot);
|
|
1734
|
+
schedulePassiveEffects();
|
|
1735
|
+
}, "performWork");
|
|
1736
|
+
setWorkCallback(performWork);
|
|
1737
|
+
|
|
1738
|
+
// ../rectify-reconciler/src/RectifyFiberReconciler.ts
|
|
1739
|
+
var createContainer = /* @__PURE__ */ __name((container) => {
|
|
1740
|
+
return createHostRootFiber(container);
|
|
1741
|
+
}, "createContainer");
|
|
1742
|
+
var updateContainer = /* @__PURE__ */ __name((children, fiberRoot) => {
|
|
1743
|
+
fiberRoot.children = children;
|
|
1744
|
+
setScheduledFiberRoot(fiberRoot);
|
|
1745
|
+
const wipRoot = createWorkInProgress(fiberRoot.root, { children });
|
|
1746
|
+
setCurrentRenderingLanes(SyncLane);
|
|
1747
|
+
workLoop(wipRoot);
|
|
1748
|
+
commitWork(wipRoot);
|
|
1749
|
+
fiberRoot.root = wipRoot;
|
|
1750
|
+
markContainerAsRoot(wipRoot, fiberRoot.containerDom);
|
|
1751
|
+
setScheduledFiberRoot(fiberRoot);
|
|
1752
|
+
flushLayoutPhase(fiberRoot);
|
|
1753
|
+
schedulePassiveEffects();
|
|
1754
|
+
}, "updateContainer");
|
|
1755
|
+
|
|
1425
1756
|
// ../rectify-dom/src/RectifyDomRoot.ts
|
|
1426
1757
|
var createRoot = /* @__PURE__ */ __name((container) => {
|
|
1427
1758
|
const hostRoot = createContainer(container);
|
|
@@ -1438,15 +1769,80 @@ var createRoot = /* @__PURE__ */ __name((container) => {
|
|
|
1438
1769
|
}, "createRoot");
|
|
1439
1770
|
|
|
1440
1771
|
// src/RectifyMemo.ts
|
|
1441
|
-
function memo(
|
|
1772
|
+
function memo(Component2, compare) {
|
|
1442
1773
|
const wrapper = /* @__PURE__ */ __name(((_props) => null), "wrapper");
|
|
1443
1774
|
wrapper._isMemo = true;
|
|
1444
|
-
wrapper._render =
|
|
1775
|
+
wrapper._render = Component2;
|
|
1445
1776
|
wrapper._compare = compare ?? null;
|
|
1446
1777
|
return wrapper;
|
|
1447
1778
|
}
|
|
1448
1779
|
__name(memo, "memo");
|
|
1449
1780
|
|
|
1450
|
-
|
|
1781
|
+
// src/RectifyLazy.ts
|
|
1782
|
+
var lazy = /* @__PURE__ */ __name((factory) => {
|
|
1783
|
+
const stub = /* @__PURE__ */ __name((() => null), "stub");
|
|
1784
|
+
return Object.assign(stub, {
|
|
1785
|
+
_isLazy: true,
|
|
1786
|
+
_status: "uninitialized",
|
|
1787
|
+
_result: null,
|
|
1788
|
+
_promise: null,
|
|
1789
|
+
_factory: factory
|
|
1790
|
+
});
|
|
1791
|
+
}, "lazy");
|
|
1792
|
+
|
|
1793
|
+
// src/RectifySuspense.ts
|
|
1794
|
+
var Suspense = /* @__PURE__ */ __name((_props) => null, "Suspense");
|
|
1795
|
+
Suspense._isSuspense = true;
|
|
1796
|
+
|
|
1797
|
+
// src/RectifyComponent.ts
|
|
1798
|
+
var _Component = class _Component {
|
|
1799
|
+
constructor(props) {
|
|
1800
|
+
this.state = {};
|
|
1801
|
+
/**
|
|
1802
|
+
* @internal Set by the reconciler when the instance is created so
|
|
1803
|
+
* `setState` can enqueue a re-render on the correct fiber.
|
|
1804
|
+
*/
|
|
1805
|
+
this._fiber = null;
|
|
1806
|
+
/**
|
|
1807
|
+
* @internal Snapshots taken by the reconciler in beginWork before each
|
|
1808
|
+
* update render so that `componentDidUpdate` receives the correct prev values.
|
|
1809
|
+
* Cleared after `componentDidUpdate` is called.
|
|
1810
|
+
*/
|
|
1811
|
+
this._prevProps = void 0;
|
|
1812
|
+
this._prevState = void 0;
|
|
1813
|
+
/**
|
|
1814
|
+
* @internal Queue of pending setState updates, flushed by the reconciler
|
|
1815
|
+
* during beginWork so that prevState snapshots can be taken first.
|
|
1816
|
+
*/
|
|
1817
|
+
this._pendingStateQueue = [];
|
|
1818
|
+
this.props = props;
|
|
1819
|
+
}
|
|
1820
|
+
// ---------------------------------------------------------------------------
|
|
1821
|
+
// Core API
|
|
1822
|
+
// ---------------------------------------------------------------------------
|
|
1823
|
+
/**
|
|
1824
|
+
* Merges `partialState` into the current state and schedules a re-render.
|
|
1825
|
+
* Accepts either a plain partial state object or an updater function.
|
|
1826
|
+
*/
|
|
1827
|
+
setState(partialState) {
|
|
1828
|
+
this._pendingStateQueue.push(partialState);
|
|
1829
|
+
if (this._fiber) {
|
|
1830
|
+
scheduleRerender(this._fiber);
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
/**
|
|
1834
|
+
* Must be implemented by every class component.
|
|
1835
|
+
* Returns the subtree to render.
|
|
1836
|
+
*/
|
|
1837
|
+
render() {
|
|
1838
|
+
return null;
|
|
1839
|
+
}
|
|
1840
|
+
};
|
|
1841
|
+
__name(_Component, "Component");
|
|
1842
|
+
/** Marks this as a class component for the reconciler. */
|
|
1843
|
+
_Component._isClassComponent = true;
|
|
1844
|
+
var Component = _Component;
|
|
1845
|
+
|
|
1846
|
+
export { Component, Suspense, SyntheticEvent_default as SyntheticEvent, createContext, 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
1847
|
//# sourceMappingURL=index.js.map
|
|
1452
1848
|
//# sourceMappingURL=index.js.map
|