@rectify-dev/core 2.3.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 +1 -1
- package/dist/index.cjs +22 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +23 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ A lightweight React-like UI library built from scratch — fiber reconciler, con
|
|
|
13
13
|
| `useRef` (object + callback refs) | ✅ |
|
|
14
14
|
| `useMemo`, `useCallback` | ✅ |
|
|
15
15
|
| `useContext` + `createContext` | ✅ |
|
|
16
|
-
| `useId
|
|
16
|
+
| `useId` | ✅ |
|
|
17
17
|
| `memo()` with custom comparator | ✅ |
|
|
18
18
|
| `lazy()` + `<Suspense>` | ✅ |
|
|
19
19
|
| SVG elements | ✅ |
|
package/dist/index.cjs
CHANGED
|
@@ -321,6 +321,7 @@ var ContextProvider = /* @__PURE__ */ Symbol.for("rectify.context_provider");
|
|
|
321
321
|
var MemoComponent = /* @__PURE__ */ Symbol.for("rectify.memo_component");
|
|
322
322
|
var LazyComponent = /* @__PURE__ */ Symbol.for("rectify.lazy_component");
|
|
323
323
|
var SuspenseComponent = /* @__PURE__ */ Symbol.for("rectify.suspense_component");
|
|
324
|
+
var PortalComponent = /* @__PURE__ */ Symbol.for("rectify.portal_component");
|
|
324
325
|
var addFlagToFiber = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber, flag) => {
|
|
325
326
|
if (hasFlagOnFiber(fiber, flag)) return;
|
|
326
327
|
fiber.flags |= flag;
|
|
@@ -335,6 +336,8 @@ var hasFlagOnFiber = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber, flag) => {
|
|
|
335
336
|
}, "hasFlagOnFiber");
|
|
336
337
|
var getFiberTagFromElement = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((element) => {
|
|
337
338
|
switch (element.$$typeof) {
|
|
339
|
+
case shared.RECTIFY_PORTAL_TYPE:
|
|
340
|
+
return PortalComponent;
|
|
338
341
|
case shared.RECTIFY_ELEMENT_TYPE:
|
|
339
342
|
if (shared.isFunction(element.type) && element.type?._context === element.type) {
|
|
340
343
|
return ContextProvider;
|
|
@@ -416,6 +419,7 @@ var getParentDom = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber) => {
|
|
|
416
419
|
while (p) {
|
|
417
420
|
if (p.workTag === HostComponent) return p.stateNode;
|
|
418
421
|
if (p.workTag === HostRoot) return p.stateNode;
|
|
422
|
+
if (p.workTag === PortalComponent) return p.stateNode;
|
|
419
423
|
p = p.return;
|
|
420
424
|
}
|
|
421
425
|
throw new Error("No parent DOM found.");
|
|
@@ -1358,6 +1362,11 @@ var beginWork = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => {
|
|
|
1358
1362
|
}
|
|
1359
1363
|
throw lazy2._promise;
|
|
1360
1364
|
}
|
|
1365
|
+
case PortalComponent: {
|
|
1366
|
+
wip.stateNode = wip.pendingProps.containerInfo;
|
|
1367
|
+
reconcileChildren(wip, wip.pendingProps.children);
|
|
1368
|
+
break;
|
|
1369
|
+
}
|
|
1361
1370
|
}
|
|
1362
1371
|
return wip.child;
|
|
1363
1372
|
}, "beginWork");
|
|
@@ -1768,6 +1777,18 @@ var createRoot = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((container) => {
|
|
|
1768
1777
|
}, "unmount")
|
|
1769
1778
|
};
|
|
1770
1779
|
}, "createRoot");
|
|
1780
|
+
var createPortal = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((children, container, key = null) => {
|
|
1781
|
+
listenToAllEventSupported(container);
|
|
1782
|
+
return {
|
|
1783
|
+
$$typeof: shared.RECTIFY_PORTAL_TYPE,
|
|
1784
|
+
type: null,
|
|
1785
|
+
key,
|
|
1786
|
+
props: {
|
|
1787
|
+
children,
|
|
1788
|
+
containerInfo: container
|
|
1789
|
+
}
|
|
1790
|
+
};
|
|
1791
|
+
}, "createPortal");
|
|
1771
1792
|
|
|
1772
1793
|
// src/RectifyMemo.ts
|
|
1773
1794
|
function memo(Component2, compare) {
|
|
@@ -1856,6 +1877,7 @@ exports.Component = Component;
|
|
|
1856
1877
|
exports.Suspense = Suspense;
|
|
1857
1878
|
exports.SyntheticEvent = SyntheticEvent_default;
|
|
1858
1879
|
exports.createContext = createContext;
|
|
1880
|
+
exports.createPortal = createPortal;
|
|
1859
1881
|
exports.createRoot = createRoot;
|
|
1860
1882
|
exports.lazy = lazy;
|
|
1861
1883
|
exports.memo = memo;
|