@rectify-dev/core 2.3.0 → 2.4.1
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 +31 -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 +32 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _rectify_dev_shared from '@rectify-dev/shared';
|
|
2
|
-
import { RectifyNode, FC, LazyComponent, SuspenseProps, Fiber } from '@rectify-dev/shared';
|
|
3
|
-
export { AnchorHTMLAttributes, AriaAttributes, AudioHTMLAttributes, ButtonHTMLAttributes, CSSProperties, FC, FormHTMLAttributes, HTMLAttributes, IframeHTMLAttributes, ImgHTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, MetaHTMLAttributes, OptGroupHTMLAttributes, OptionHTMLAttributes, RectifyEventHandlers, RectifyIntrinsicElements, RectifyNode, ScriptHTMLAttributes, SelectHTMLAttributes, SuspenseProps, SyntheticAnimationEvent, SyntheticChangeEvent, SyntheticClipboardEvent, SyntheticDragEvent, SyntheticEvent as SyntheticEventType, SyntheticFocusEvent, SyntheticInputEvent, SyntheticKeyboardEvent, SyntheticMouseEvent, SyntheticPointerEvent, SyntheticSubmitEvent, SyntheticTouchEvent, SyntheticTransitionEvent, SyntheticWheelEvent, TextareaHTMLAttributes, VideoHTMLAttributes } from '@rectify-dev/shared';
|
|
2
|
+
import { RectifyNode, RectifyKey, RectifyPortal, FC, LazyComponent, SuspenseProps, Fiber } from '@rectify-dev/shared';
|
|
3
|
+
export { AnchorHTMLAttributes, AriaAttributes, AudioHTMLAttributes, ButtonHTMLAttributes, CSSProperties, FC, FormHTMLAttributes, HTMLAttributes, IframeHTMLAttributes, ImgHTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, MetaHTMLAttributes, OptGroupHTMLAttributes, OptionHTMLAttributes, RectifyEventHandlers, RectifyIntrinsicElements, RectifyNode, RectifyPortal, ScriptHTMLAttributes, SelectHTMLAttributes, SuspenseProps, SyntheticAnimationEvent, SyntheticChangeEvent, SyntheticClipboardEvent, SyntheticDragEvent, SyntheticEvent as SyntheticEventType, SyntheticFocusEvent, SyntheticInputEvent, SyntheticKeyboardEvent, SyntheticMouseEvent, SyntheticPointerEvent, SyntheticSubmitEvent, SyntheticTouchEvent, SyntheticTransitionEvent, SyntheticWheelEvent, TextareaHTMLAttributes, VideoHTMLAttributes } from '@rectify-dev/shared';
|
|
4
4
|
export { Fragment, jsx } from './runtime.cjs';
|
|
5
5
|
|
|
6
6
|
type RectifyDomRoot = {
|
|
@@ -9,6 +9,8 @@ type RectifyDomRoot = {
|
|
|
9
9
|
};
|
|
10
10
|
declare const createRoot: (container: Element) => RectifyDomRoot;
|
|
11
11
|
|
|
12
|
+
declare const createPortal: (children: RectifyNode, container: Element, key?: RectifyKey) => RectifyPortal;
|
|
13
|
+
|
|
12
14
|
type AnyNativeEvent = Event | KeyboardEvent | MouseEvent | TouchEvent;
|
|
13
15
|
|
|
14
16
|
declare class SyntheticEvent {
|
|
@@ -284,4 +286,4 @@ declare function useContext<T>(context: RectifyContext<T>): T;
|
|
|
284
286
|
*/
|
|
285
287
|
declare const useId: () => string;
|
|
286
288
|
|
|
287
|
-
export { Component, type Dispatch, type MemoComponent, type RectifyContext, type Reducer, type RefObject, Suspense, SyntheticEvent, createContext, createRoot, lazy, memo, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useReducer, useRef, useState };
|
|
289
|
+
export { Component, type Dispatch, type MemoComponent, type RectifyContext, type Reducer, type RefObject, Suspense, SyntheticEvent, createContext, createPortal, createRoot, lazy, memo, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useReducer, useRef, useState };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _rectify_dev_shared from '@rectify-dev/shared';
|
|
2
|
-
import { RectifyNode, FC, LazyComponent, SuspenseProps, Fiber } from '@rectify-dev/shared';
|
|
3
|
-
export { AnchorHTMLAttributes, AriaAttributes, AudioHTMLAttributes, ButtonHTMLAttributes, CSSProperties, FC, FormHTMLAttributes, HTMLAttributes, IframeHTMLAttributes, ImgHTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, MetaHTMLAttributes, OptGroupHTMLAttributes, OptionHTMLAttributes, RectifyEventHandlers, RectifyIntrinsicElements, RectifyNode, ScriptHTMLAttributes, SelectHTMLAttributes, SuspenseProps, SyntheticAnimationEvent, SyntheticChangeEvent, SyntheticClipboardEvent, SyntheticDragEvent, SyntheticEvent as SyntheticEventType, SyntheticFocusEvent, SyntheticInputEvent, SyntheticKeyboardEvent, SyntheticMouseEvent, SyntheticPointerEvent, SyntheticSubmitEvent, SyntheticTouchEvent, SyntheticTransitionEvent, SyntheticWheelEvent, TextareaHTMLAttributes, VideoHTMLAttributes } from '@rectify-dev/shared';
|
|
2
|
+
import { RectifyNode, RectifyKey, RectifyPortal, FC, LazyComponent, SuspenseProps, Fiber } from '@rectify-dev/shared';
|
|
3
|
+
export { AnchorHTMLAttributes, AriaAttributes, AudioHTMLAttributes, ButtonHTMLAttributes, CSSProperties, FC, FormHTMLAttributes, HTMLAttributes, IframeHTMLAttributes, ImgHTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, MetaHTMLAttributes, OptGroupHTMLAttributes, OptionHTMLAttributes, RectifyEventHandlers, RectifyIntrinsicElements, RectifyNode, RectifyPortal, ScriptHTMLAttributes, SelectHTMLAttributes, SuspenseProps, SyntheticAnimationEvent, SyntheticChangeEvent, SyntheticClipboardEvent, SyntheticDragEvent, SyntheticEvent as SyntheticEventType, SyntheticFocusEvent, SyntheticInputEvent, SyntheticKeyboardEvent, SyntheticMouseEvent, SyntheticPointerEvent, SyntheticSubmitEvent, SyntheticTouchEvent, SyntheticTransitionEvent, SyntheticWheelEvent, TextareaHTMLAttributes, VideoHTMLAttributes } from '@rectify-dev/shared';
|
|
4
4
|
export { Fragment, jsx } from './runtime.js';
|
|
5
5
|
|
|
6
6
|
type RectifyDomRoot = {
|
|
@@ -9,6 +9,8 @@ type RectifyDomRoot = {
|
|
|
9
9
|
};
|
|
10
10
|
declare const createRoot: (container: Element) => RectifyDomRoot;
|
|
11
11
|
|
|
12
|
+
declare const createPortal: (children: RectifyNode, container: Element, key?: RectifyKey) => RectifyPortal;
|
|
13
|
+
|
|
12
14
|
type AnyNativeEvent = Event | KeyboardEvent | MouseEvent | TouchEvent;
|
|
13
15
|
|
|
14
16
|
declare class SyntheticEvent {
|
|
@@ -284,4 +286,4 @@ declare function useContext<T>(context: RectifyContext<T>): T;
|
|
|
284
286
|
*/
|
|
285
287
|
declare const useId: () => string;
|
|
286
288
|
|
|
287
|
-
export { Component, type Dispatch, type MemoComponent, type RectifyContext, type Reducer, type RefObject, Suspense, SyntheticEvent, createContext, createRoot, lazy, memo, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useReducer, useRef, useState };
|
|
289
|
+
export { Component, type Dispatch, type MemoComponent, type RectifyContext, type Reducer, type RefObject, Suspense, SyntheticEvent, createContext, createPortal, createRoot, lazy, memo, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useReducer, useRef, useState };
|
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();
|
|
@@ -71,6 +71,10 @@ function unmarkContainerAsRoot(node) {
|
|
|
71
71
|
node[internalContainerInstanceKey] = null;
|
|
72
72
|
}
|
|
73
73
|
__name(unmarkContainerAsRoot, "unmarkContainerAsRoot");
|
|
74
|
+
function isContainerMarkedAsRoot(node) {
|
|
75
|
+
return !!node[internalContainerInstanceKey];
|
|
76
|
+
}
|
|
77
|
+
__name(isContainerMarkedAsRoot, "isContainerMarkedAsRoot");
|
|
74
78
|
var precacheFiberNode = /* @__PURE__ */ __name((fiber, node) => {
|
|
75
79
|
if (!node) return;
|
|
76
80
|
node[internalInstanceKey] = fiber;
|
|
@@ -134,6 +138,11 @@ var dispatchEvent = /* @__PURE__ */ __name((domEventName, targetContainer, nativ
|
|
|
134
138
|
const targetNode = getEventTarget(nativeEvent);
|
|
135
139
|
const targetFiber = getFiberNodeCached(targetNode);
|
|
136
140
|
if (!targetFiber) return;
|
|
141
|
+
let domCursor = targetNode.parentNode;
|
|
142
|
+
while (domCursor && domCursor !== targetContainer) {
|
|
143
|
+
if (isContainerMarkedAsRoot(domCursor)) return;
|
|
144
|
+
domCursor = domCursor.parentNode;
|
|
145
|
+
}
|
|
137
146
|
const syntheticEvent = new SyntheticEvent_default(nativeEvent);
|
|
138
147
|
const path = [];
|
|
139
148
|
let fiber = targetFiber;
|
|
@@ -320,6 +329,7 @@ var ContextProvider = /* @__PURE__ */ Symbol.for("rectify.context_provider");
|
|
|
320
329
|
var MemoComponent = /* @__PURE__ */ Symbol.for("rectify.memo_component");
|
|
321
330
|
var LazyComponent = /* @__PURE__ */ Symbol.for("rectify.lazy_component");
|
|
322
331
|
var SuspenseComponent = /* @__PURE__ */ Symbol.for("rectify.suspense_component");
|
|
332
|
+
var PortalComponent = /* @__PURE__ */ Symbol.for("rectify.portal_component");
|
|
323
333
|
var addFlagToFiber = /* @__PURE__ */ __name((fiber, flag) => {
|
|
324
334
|
if (hasFlagOnFiber(fiber, flag)) return;
|
|
325
335
|
fiber.flags |= flag;
|
|
@@ -334,6 +344,8 @@ var hasFlagOnFiber = /* @__PURE__ */ __name((fiber, flag) => {
|
|
|
334
344
|
}, "hasFlagOnFiber");
|
|
335
345
|
var getFiberTagFromElement = /* @__PURE__ */ __name((element) => {
|
|
336
346
|
switch (element.$$typeof) {
|
|
347
|
+
case RECTIFY_PORTAL_TYPE:
|
|
348
|
+
return PortalComponent;
|
|
337
349
|
case RECTIFY_ELEMENT_TYPE:
|
|
338
350
|
if (isFunction(element.type) && element.type?._context === element.type) {
|
|
339
351
|
return ContextProvider;
|
|
@@ -415,6 +427,7 @@ var getParentDom = /* @__PURE__ */ __name((fiber) => {
|
|
|
415
427
|
while (p) {
|
|
416
428
|
if (p.workTag === HostComponent) return p.stateNode;
|
|
417
429
|
if (p.workTag === HostRoot) return p.stateNode;
|
|
430
|
+
if (p.workTag === PortalComponent) return p.stateNode;
|
|
418
431
|
p = p.return;
|
|
419
432
|
}
|
|
420
433
|
throw new Error("No parent DOM found.");
|
|
@@ -1357,6 +1370,11 @@ var beginWork = /* @__PURE__ */ __name((wip) => {
|
|
|
1357
1370
|
}
|
|
1358
1371
|
throw lazy2._promise;
|
|
1359
1372
|
}
|
|
1373
|
+
case PortalComponent: {
|
|
1374
|
+
wip.stateNode = wip.pendingProps.containerInfo;
|
|
1375
|
+
reconcileChildren(wip, wip.pendingProps.children);
|
|
1376
|
+
break;
|
|
1377
|
+
}
|
|
1360
1378
|
}
|
|
1361
1379
|
return wip.child;
|
|
1362
1380
|
}, "beginWork");
|
|
@@ -1767,6 +1785,18 @@ var createRoot = /* @__PURE__ */ __name((container) => {
|
|
|
1767
1785
|
}, "unmount")
|
|
1768
1786
|
};
|
|
1769
1787
|
}, "createRoot");
|
|
1788
|
+
var createPortal = /* @__PURE__ */ __name((children, container, key = null) => {
|
|
1789
|
+
listenToAllEventSupported(container);
|
|
1790
|
+
return {
|
|
1791
|
+
$$typeof: RECTIFY_PORTAL_TYPE,
|
|
1792
|
+
type: null,
|
|
1793
|
+
key,
|
|
1794
|
+
props: {
|
|
1795
|
+
children,
|
|
1796
|
+
containerInfo: container
|
|
1797
|
+
}
|
|
1798
|
+
};
|
|
1799
|
+
}, "createPortal");
|
|
1770
1800
|
|
|
1771
1801
|
// src/RectifyMemo.ts
|
|
1772
1802
|
function memo(Component2, compare) {
|
|
@@ -1843,6 +1873,6 @@ __name(_Component, "Component");
|
|
|
1843
1873
|
_Component._isClassComponent = true;
|
|
1844
1874
|
var Component = _Component;
|
|
1845
1875
|
|
|
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 };
|
|
1876
|
+
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 };
|
|
1847
1877
|
//# sourceMappingURL=index.js.map
|
|
1848
1878
|
//# sourceMappingURL=index.js.map
|