@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/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();
@@ -320,6 +320,7 @@ var ContextProvider = /* @__PURE__ */ Symbol.for("rectify.context_provider");
320
320
  var MemoComponent = /* @__PURE__ */ Symbol.for("rectify.memo_component");
321
321
  var LazyComponent = /* @__PURE__ */ Symbol.for("rectify.lazy_component");
322
322
  var SuspenseComponent = /* @__PURE__ */ Symbol.for("rectify.suspense_component");
323
+ var PortalComponent = /* @__PURE__ */ Symbol.for("rectify.portal_component");
323
324
  var addFlagToFiber = /* @__PURE__ */ __name((fiber, flag) => {
324
325
  if (hasFlagOnFiber(fiber, flag)) return;
325
326
  fiber.flags |= flag;
@@ -334,6 +335,8 @@ var hasFlagOnFiber = /* @__PURE__ */ __name((fiber, flag) => {
334
335
  }, "hasFlagOnFiber");
335
336
  var getFiberTagFromElement = /* @__PURE__ */ __name((element) => {
336
337
  switch (element.$$typeof) {
338
+ case RECTIFY_PORTAL_TYPE:
339
+ return PortalComponent;
337
340
  case RECTIFY_ELEMENT_TYPE:
338
341
  if (isFunction(element.type) && element.type?._context === element.type) {
339
342
  return ContextProvider;
@@ -415,6 +418,7 @@ var getParentDom = /* @__PURE__ */ __name((fiber) => {
415
418
  while (p) {
416
419
  if (p.workTag === HostComponent) return p.stateNode;
417
420
  if (p.workTag === HostRoot) return p.stateNode;
421
+ if (p.workTag === PortalComponent) return p.stateNode;
418
422
  p = p.return;
419
423
  }
420
424
  throw new Error("No parent DOM found.");
@@ -1357,6 +1361,11 @@ var beginWork = /* @__PURE__ */ __name((wip) => {
1357
1361
  }
1358
1362
  throw lazy2._promise;
1359
1363
  }
1364
+ case PortalComponent: {
1365
+ wip.stateNode = wip.pendingProps.containerInfo;
1366
+ reconcileChildren(wip, wip.pendingProps.children);
1367
+ break;
1368
+ }
1360
1369
  }
1361
1370
  return wip.child;
1362
1371
  }, "beginWork");
@@ -1767,6 +1776,18 @@ var createRoot = /* @__PURE__ */ __name((container) => {
1767
1776
  }, "unmount")
1768
1777
  };
1769
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");
1770
1791
 
1771
1792
  // src/RectifyMemo.ts
1772
1793
  function memo(Component2, compare) {
@@ -1843,6 +1864,6 @@ __name(_Component, "Component");
1843
1864
  _Component._isClassComponent = true;
1844
1865
  var Component = _Component;
1845
1866
 
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 };
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 };
1847
1868
  //# sourceMappingURL=index.js.map
1848
1869
  //# sourceMappingURL=index.js.map