@reckona/mreact-compat 0.0.160 → 0.0.162
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/class-component.d.ts +5 -0
- package/dist/class-component.d.ts.map +1 -1
- package/dist/class-component.js +36 -11
- package/dist/class-component.js.map +1 -1
- package/dist/context.d.ts +4 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +4 -0
- package/dist/context.js.map +1 -1
- package/dist/element.d.ts +28 -0
- package/dist/element.d.ts.map +1 -1
- package/dist/element.js +21 -1
- package/dist/element.js.map +1 -1
- package/dist/event-priority.d.ts +1 -0
- package/dist/event-priority.d.ts.map +1 -1
- package/dist/event-priority.js +1 -0
- package/dist/event-priority.js.map +1 -1
- package/dist/event-replay.d.ts +6 -0
- package/dist/event-replay.d.ts.map +1 -1
- package/dist/event-replay.js +4 -0
- package/dist/event-replay.js.map +1 -1
- package/dist/flight-decoder.d.ts +1 -0
- package/dist/flight-decoder.d.ts.map +1 -1
- package/dist/flight-decoder.js.map +1 -1
- package/dist/flight-protocol.d.ts +2 -0
- package/dist/flight-protocol.d.ts.map +1 -1
- package/dist/flight-protocol.js +1 -0
- package/dist/flight-protocol.js.map +1 -1
- package/dist/flight-types.d.ts +21 -0
- package/dist/flight-types.d.ts.map +1 -1
- package/dist/flight-types.js.map +1 -1
- package/dist/flight.d.ts +7 -0
- package/dist/flight.d.ts.map +1 -1
- package/dist/flight.js +5 -0
- package/dist/flight.js.map +1 -1
- package/dist/hooks-entry.d.ts +2 -0
- package/dist/hooks-entry.d.ts.map +1 -1
- package/dist/hooks-entry.js +1 -0
- package/dist/hooks-entry.js.map +1 -1
- package/dist/hooks.d.ts +36 -0
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +42 -10
- package/dist/hooks.js.map +1 -1
- package/dist/host-reconciler.js +30 -30
- package/dist/host-reconciler.js.map +1 -1
- package/dist/hydration.d.ts +2 -0
- package/dist/hydration.d.ts.map +1 -1
- package/dist/hydration.js +1 -0
- package/dist/hydration.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +1 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -0
- package/dist/internal.js.map +1 -1
- package/dist/jsx-dev-runtime.d.ts +5 -0
- package/dist/jsx-dev-runtime.d.ts.map +1 -1
- package/dist/jsx-dev-runtime.js +3 -0
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.d.ts +13 -0
- package/dist/jsx-runtime.d.ts.map +1 -1
- package/dist/jsx-runtime.js +4 -0
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/react-default.d.ts +2 -0
- package/dist/react-default.d.ts.map +1 -1
- package/dist/react-default.js +2 -0
- package/dist/react-default.js.map +1 -1
- package/dist/root.d.ts +13 -0
- package/dist/root.d.ts.map +1 -1
- package/dist/root.js +6 -0
- package/dist/root.js.map +1 -1
- package/dist/scheduler.d.ts +23 -0
- package/dist/scheduler.d.ts.map +1 -1
- package/dist/scheduler.js +19 -0
- package/dist/scheduler.js.map +1 -1
- package/dist/server-render.d.ts +1 -0
- package/dist/server-render.d.ts.map +1 -1
- package/dist/server-render.js +1 -0
- package/dist/server-render.js.map +1 -1
- package/package.json +3 -3
- package/src/class-component.ts +47 -11
- package/src/context.ts +4 -0
- package/src/element.ts +33 -6
- package/src/event-priority.ts +1 -0
- package/src/event-replay.ts +6 -0
- package/src/flight-decoder.ts +1 -0
- package/src/flight-protocol.ts +2 -0
- package/src/flight-types.ts +21 -0
- package/src/flight.ts +7 -0
- package/src/hooks-entry.ts +2 -0
- package/src/hooks.ts +55 -15
- package/src/host-reconciler.ts +39 -38
- package/src/hydration.ts +2 -0
- package/src/index.ts +3 -0
- package/src/internal.ts +1 -0
- package/src/jsx-dev-runtime.ts +5 -0
- package/src/jsx-runtime.ts +13 -0
- package/src/react-default.ts +2 -0
- package/src/root.ts +13 -0
- package/src/scheduler.ts +23 -0
- package/src/server-render.ts +1 -0
package/dist/element.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,eAA2C,CAAC;AAClF,eAAO,MAAM,mBAAmB,eAA6C,CAAC;AAC9E,eAAO,MAAM,gBAAgB,eAAkC,CAAC;AAChE,eAAO,MAAM,SAAS,eAA2B,CAAC;AAClD,eAAO,MAAM,SAAS,eAA2B,CAAC;AAClD,eAAO,MAAM,gBAAgB,eAAkC,CAAC;AAChE,eAAO,MAAM,WAAW,eAA6B,CAAC;AAEtD,eAAO,MAAM,QAAQ,eAA+B,CAAC;AACrD,eAAO,MAAM,QAAQ,eAA+B,CAAC;AACrD,eAAO,MAAM,YAAY,eAAoC,CAAC;AAC9D,eAAO,MAAM,QAAQ,eAA+B,CAAC;AACrD,eAAO,MAAM,QAAQ,eAA+B,CAAC;AACrD,eAAO,MAAM,6BAA6B,eAEzC,CAAC;AACF,eAAO,MAAM,0BAA0B,eAEtC,CAAC;AAGF,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,mCAAmC;IAClD,QAAQ,EAAE,uBAAuB,CAAC;IAClC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAC/C,MAAM,GACN,OAAO,QAAQ,GACf,OAAO,QAAQ,GACf,OAAO,YAAY,GACnB,OAAO,QAAQ,GACf,OAAO,QAAQ,GACf,OAAO,mBAAmB,GAC1B,OAAO,gBAAgB,GACvB,mCAAmC,GACnC,uBAAuB,GACvB,cAAc,CAAC,CAAC,CAAC,GACjB,QAAQ,CAAC,CAAC,CAAC,GACX,QA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xB,kBAAkB,CAAC,oBAAoB,GAAG;IAAE,QAAQ,EAAE,eAAe,CAAA;CAAE,CAAC,CAK1E"}
|
package/dist/element.js
CHANGED
|
@@ -6,14 +6,21 @@ export const LAZY_TYPE = Symbol.for("react.lazy");
|
|
|
6
6
|
export const STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
|
|
7
7
|
export const PORTAL_TYPE = Symbol.for("react.portal");
|
|
8
8
|
const REACT_COMPAT_PROVIDER_TYPE = Symbol.for("react.context");
|
|
9
|
+
/** Symbol used to group JSX children without adding a host element. */
|
|
9
10
|
export const Fragment = Symbol.for("react.fragment");
|
|
11
|
+
/** Symbol used to suspend rendering while async content resolves. */
|
|
10
12
|
export const Suspense = Symbol.for("react.suspense");
|
|
13
|
+
/** Symbol used to coordinate multiple suspense boundaries. */
|
|
11
14
|
export const SuspenseList = Symbol.for("react.suspense_list");
|
|
15
|
+
/** Symbol used to mark activity boundaries in React-compatible trees. */
|
|
12
16
|
export const Activity = Symbol.for("react.activity");
|
|
17
|
+
/** Symbol used to measure render work with profiler callbacks. */
|
|
13
18
|
export const Profiler = Symbol.for("react.profiler");
|
|
14
19
|
export const HOST_CHILDREN_ONLY_PROPS_META = Symbol.for("modular.react.host_children_only_props_meta");
|
|
20
|
+
/** Metadata key that links a state value to a reactive text binding. */
|
|
15
21
|
export const REACTIVE_TEXT_BINDING_META = Symbol.for("modular.react.reactive_text_binding_meta");
|
|
16
22
|
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
23
|
+
/** Creates a React-compatible element from a type, config object, and children. */
|
|
17
24
|
export function createElement(type, config, ...children) {
|
|
18
25
|
if (typeof type === "string") {
|
|
19
26
|
const key = config?.key === undefined ? null : String(config.key);
|
|
@@ -55,6 +62,7 @@ export function createElement(type, config, ...children) {
|
|
|
55
62
|
props: props,
|
|
56
63
|
};
|
|
57
64
|
}
|
|
65
|
+
/** Creates a React-compatible element from JSX runtime arguments. */
|
|
58
66
|
export function createElementFromJsxConfig(type, config, keyArgument) {
|
|
59
67
|
const normalizedType = typeof type === "object" && type !== null ? normalizeElementType(type) : type;
|
|
60
68
|
const key = keyArgument !== undefined
|
|
@@ -81,11 +89,13 @@ export function createElementFromJsxConfig(type, config, keyArgument) {
|
|
|
81
89
|
props,
|
|
82
90
|
};
|
|
83
91
|
}
|
|
92
|
+
/** Returns true when a value is a React-compatible element record. */
|
|
84
93
|
export function isReactCompatElement(value) {
|
|
85
94
|
return (typeof value === "object" &&
|
|
86
95
|
value !== null &&
|
|
87
96
|
value.$$typeof === REACT_COMPAT_ELEMENT_TYPE);
|
|
88
97
|
}
|
|
98
|
+
/** Creates a portal that renders children into a DOM container outside the parent tree. */
|
|
89
99
|
export function createPortal(children, container, key) {
|
|
90
100
|
return {
|
|
91
101
|
$$typeof: PORTAL_TYPE,
|
|
@@ -94,22 +104,27 @@ export function createPortal(children, container, key) {
|
|
|
94
104
|
key: key === undefined ? null : String(key),
|
|
95
105
|
};
|
|
96
106
|
}
|
|
107
|
+
/** Returns true when a value is a React-compatible portal record. */
|
|
97
108
|
export function isReactCompatPortal(value) {
|
|
98
109
|
return (typeof value === "object" &&
|
|
99
110
|
value !== null &&
|
|
100
111
|
value.$$typeof === PORTAL_TYPE);
|
|
101
112
|
}
|
|
113
|
+
/** Creates a mutable ref object with a null initial current value. */
|
|
102
114
|
export function createRef() {
|
|
103
115
|
return { current: null };
|
|
104
116
|
}
|
|
117
|
+
/** Wraps a component so it can receive a ref as the second render argument. */
|
|
105
118
|
export function forwardRef(render) {
|
|
106
119
|
return { $$typeof: FORWARD_REF_TYPE, render: render };
|
|
107
120
|
}
|
|
121
|
+
/** Wraps an element type with optional prop comparison for memoized renders. */
|
|
108
122
|
export function memo(type, compare) {
|
|
109
123
|
return compare === undefined
|
|
110
124
|
? { $$typeof: MEMO_TYPE, type }
|
|
111
125
|
: { $$typeof: MEMO_TYPE, type, compare };
|
|
112
126
|
}
|
|
127
|
+
/** Creates a lazy element type that resolves its implementation on demand. */
|
|
113
128
|
export function lazy(load) {
|
|
114
129
|
return {
|
|
115
130
|
$$typeof: LAZY_TYPE,
|
|
@@ -117,11 +132,13 @@ export function lazy(load) {
|
|
|
117
132
|
status: "uninitialized",
|
|
118
133
|
};
|
|
119
134
|
}
|
|
135
|
+
/** Symbol used to mark a subtree for strict-mode development checks. */
|
|
120
136
|
export const StrictMode = STRICT_MODE_TYPE;
|
|
137
|
+
/** Clones an existing element with merged props and optional replacement children. */
|
|
121
138
|
export function cloneElement(element, props, ...children) {
|
|
122
139
|
const key = props === null || props.key === undefined ? element.key : String(props.key);
|
|
123
140
|
const ref = props === null || props.ref === undefined ? element.ref : props.ref;
|
|
124
|
-
const nextProps =
|
|
141
|
+
const nextProps = copyElementProps(props, element.props);
|
|
125
142
|
if (children.length === 1) {
|
|
126
143
|
nextProps.children = children[0];
|
|
127
144
|
}
|
|
@@ -209,7 +226,9 @@ function hostPropsAreChildrenOnly(props) {
|
|
|
209
226
|
}
|
|
210
227
|
return true;
|
|
211
228
|
}
|
|
229
|
+
/** Alias for checking whether a value is a React-compatible element. */
|
|
212
230
|
export const isValidElement = isReactCompatElement;
|
|
231
|
+
/** Helpers for iterating, counting, flattening, and validating children. */
|
|
213
232
|
export const Children = {
|
|
214
233
|
map(children, fn) {
|
|
215
234
|
if (children === null || children === undefined) {
|
|
@@ -248,6 +267,7 @@ function flattenChildren(children) {
|
|
|
248
267
|
}
|
|
249
268
|
return [children];
|
|
250
269
|
}
|
|
270
|
+
/** Creates an error boundary element with a fallback renderer. */
|
|
251
271
|
export function createErrorBoundary(options, children) {
|
|
252
272
|
return createElement(ERROR_BOUNDARY_TYPE, {
|
|
253
273
|
...options,
|
package/dist/element.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.js","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AAClF,MAAM,C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AAC,CAAC;QAErC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QAED,OAAO,KAAK,CAAC,CAAC,CAAyD,CAAC;IAC1E,CAAC;CACF,CAAC;AAEF,SAAS,YAAY,CACnB,QAAyB;IAEzB,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC,MAAM,CACrC,CAAC,KAAK,EAAiE,EAAE,CACvE,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,SAAS,CACtE,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,QAAyB;IAChD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,CAAC,QAAQ,CAAC,CAAC;AACpB,CAAC;AAOD,MAAM,UAAU,mBAAmB,CACjC,OAA6B,EAC7B,QAAyB;IAEzB,OAAO,aAAa,CAAC,mBAAmB,EAAE;QACxC,GAAG,OAAO;QACV,QAAQ;KACT,CAAC,CAAC;AACL,CAAC","sourcesContent":["export const REACT_COMPAT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\");\nexport const ERROR_BOUNDARY_TYPE = Symbol.for(\"modular.react.error_boundary\");\nexport const FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\");\nexport const MEMO_TYPE = Symbol.for(\"react.memo\");\nexport const LAZY_TYPE = Symbol.for(\"react.lazy\");\nexport const STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\");\nexport const PORTAL_TYPE = Symbol.for(\"react.portal\");\nconst REACT_COMPAT_PROVIDER_TYPE = Symbol.for(\"react.context\");\nexport const Fragment = Symbol.for(\"react.fragment\");\nexport const Suspense = Symbol.for(\"react.suspense\");\nexport const SuspenseList = Symbol.for(\"react.suspense_list\");\nexport const Activity = Symbol.for(\"react.activity\");\nexport const Profiler = Symbol.for(\"react.profiler\");\nexport const HOST_CHILDREN_ONLY_PROPS_META = Symbol.for(\n \"modular.react.host_children_only_props_meta\",\n);\nexport const REACTIVE_TEXT_BINDING_META = Symbol.for(\n \"modular.react.reactive_text_binding_meta\",\n);\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\n\nexport interface ReactCompatProviderType {\n $$typeof: symbol;\n context: unknown;\n}\n\nexport interface ReactCompatContextProviderShorthand {\n Provider: ReactCompatProviderType;\n Consumer: unknown;\n}\n\nexport type ElementType<P = Record<string, unknown>> =\n | string\n | typeof Fragment\n | typeof Suspense\n | typeof SuspenseList\n | typeof Activity\n | typeof Profiler\n | typeof ERROR_BOUNDARY_TYPE\n | typeof STRICT_MODE_TYPE\n | ReactCompatContextProviderShorthand\n | ReactCompatProviderType\n | ForwardRefType<P>\n | MemoType<P>\n | LazyType<P>\n | ((props: P) => ReactCompatNode | PromiseLike<ReactCompatNode>)\n | (new (props: P) => { render(): ReactCompatNode });\n\nexport type ReactCompatNode =\n | ReactCompatElement\n | ReactCompatPortal\n | string\n | number\n | boolean\n | null\n | undefined\n | ReactCompatNode[];\n\nexport interface ReactCompatElement<P = Record<string, unknown>> {\n $$typeof: typeof REACT_COMPAT_ELEMENT_TYPE;\n type: ElementType<P>;\n key: string | null;\n ref: unknown;\n props: P & { children?: ReactCompatNode };\n}\n\nexport interface ReactCompatPortal {\n $$typeof: typeof PORTAL_TYPE;\n container: Element;\n children: ReactCompatNode;\n key: string | null;\n}\n\nexport function createElement<P extends Record<string, unknown>>(\n type: ElementType<P>,\n config: (P & ReactReservedProps) | null,\n ...children: ReactCompatNode[]\n): ReactCompatElement<P> {\n if (typeof type === \"string\") {\n const key = config?.key === undefined ? null : String(config.key);\n const ref = config?.ref ?? null;\n const props = copyElementProps(config) as P & { children?: ReactCompatNode };\n\n if (children.length === 1) {\n props.children = children[0];\n } else if (children.length > 1) {\n props.children = children;\n }\n\n setHostOwnPropsMeta(props);\n\n return {\n $$typeof: REACT_COMPAT_ELEMENT_TYPE,\n type,\n key,\n ref,\n props,\n };\n }\n\n const normalizedType =\n typeof type === \"object\" && type !== null ? normalizeElementType(type) : type;\n const key = config?.key === undefined ? null : String(config.key);\n const ref = config?.ref ?? null;\n const props = applyDefaultProps(normalizedType, copyElementProps(config)) as P & {\n children?: ReactCompatNode;\n };\n\n if (children.length === 1) {\n props.children = children[0];\n } else if (children.length > 1) {\n props.children = children;\n }\n\n if (typeof normalizedType === \"string\") {\n setHostOwnPropsMeta(props);\n }\n\n return {\n $$typeof: REACT_COMPAT_ELEMENT_TYPE,\n type: normalizedType as ElementType<P>,\n key,\n ref,\n props: props as P & { children?: ReactCompatNode },\n };\n}\n\nexport function createElementFromJsxConfig<P extends Record<string, unknown>>(\n type: ElementType<P>,\n config: (P & ReactReservedProps & { children?: ReactCompatNode }) | null,\n keyArgument?: unknown,\n): ReactCompatElement<P> {\n const normalizedType =\n typeof type === \"object\" && type !== null ? normalizeElementType(type) : type;\n const key = keyArgument !== undefined\n ? String(keyArgument)\n : config?.key === undefined ? null : String(config.key);\n const ref = config?.ref ?? null;\n const hasChildren = config !== null && config !== undefined && hasOwnProperty.call(config, \"children\");\n const children = config?.children;\n const copiedProps = copyElementProps(config, undefined, true);\n const props = (typeof normalizedType === \"string\"\n ? copiedProps\n : applyDefaultProps(normalizedType, copiedProps)) as P & {\n children?: ReactCompatNode;\n };\n\n if (hasChildren) {\n props.children = children;\n }\n\n if (typeof normalizedType === \"string\") {\n setHostOwnPropsMeta(props);\n }\n\n return {\n $$typeof: REACT_COMPAT_ELEMENT_TYPE,\n type: normalizedType as ElementType<P>,\n key,\n ref,\n props,\n };\n}\n\nexport function isReactCompatElement(\n value: unknown,\n): value is ReactCompatElement {\n return (\n typeof value === \"object\" &&\n value !== null &&\n (value as { $$typeof?: unknown }).$$typeof === REACT_COMPAT_ELEMENT_TYPE\n );\n}\n\nexport function createPortal(\n children: ReactCompatNode,\n container: Element,\n key?: unknown,\n): ReactCompatPortal {\n return {\n $$typeof: PORTAL_TYPE,\n container,\n children,\n key: key === undefined ? null : String(key),\n };\n}\n\nexport function isReactCompatPortal(value: unknown): value is ReactCompatPortal {\n return (\n typeof value === \"object\" &&\n value !== null &&\n (value as { $$typeof?: unknown }).$$typeof === PORTAL_TYPE\n );\n}\n\nexport function createRef<T>(): { current: T | null } {\n return { current: null };\n}\n\nexport interface ForwardRefType<P = Record<string, unknown>> {\n $$typeof: typeof FORWARD_REF_TYPE;\n render: (props: P, ref: unknown) => ReactCompatNode;\n}\n\nexport interface MemoType<P = Record<string, unknown>> {\n $$typeof: typeof MEMO_TYPE;\n type: ElementType<P>;\n compare?: (previous: P, next: P) => boolean;\n}\n\nexport interface LazyType<P = Record<string, unknown>> {\n $$typeof: typeof LAZY_TYPE;\n load: () => Promise<{ default: ElementType<P> }>;\n status: \"uninitialized\" | \"pending\" | \"resolved\" | \"rejected\";\n promise?: Promise<void>;\n resolved?: ElementType<P>;\n error?: unknown;\n}\n\nexport function forwardRef<P, T>(\n render: (props: P, ref: { current: T | null } | ((value: T | null) => void) | null) => ReactCompatNode,\n): ForwardRefType<P & { ref?: unknown }> {\n return { $$typeof: FORWARD_REF_TYPE, render: render as ForwardRefType<P>[\"render\"] };\n}\n\nexport function memo<P>(\n type: ElementType<P>,\n compare?: (previous: P, next: P) => boolean,\n): MemoType<P> {\n return compare === undefined\n ? { $$typeof: MEMO_TYPE, type }\n : { $$typeof: MEMO_TYPE, type, compare };\n}\n\nexport function lazy<P>(\n load: () => Promise<{ default: ElementType<P> }>,\n): LazyType<P> {\n return {\n $$typeof: LAZY_TYPE,\n load,\n status: \"uninitialized\",\n };\n}\n\nexport const StrictMode = STRICT_MODE_TYPE;\n\nexport function cloneElement<P extends Record<string, unknown>>(\n element: ReactCompatElement<P>,\n props: Partial<P> | null,\n ...children: ReactCompatNode[]\n): ReactCompatElement<P> {\n const key = props === null || props.key === undefined ? element.key : String(props.key);\n const ref = props === null || props.ref === undefined ? element.ref : props.ref;\n const nextProps = applyDefaultProps(\n element.type,\n copyElementProps(props, element.props),\n ) as P & { children?: ReactCompatNode };\n\n if (children.length === 1) {\n (nextProps as P & { children?: ReactCompatNode }).children = children[0];\n } else if (children.length > 1) {\n (nextProps as P & { children?: ReactCompatNode }).children = children;\n }\n\n return {\n $$typeof: REACT_COMPAT_ELEMENT_TYPE,\n type: element.type,\n key,\n ref,\n props: nextProps as P & { children?: ReactCompatNode },\n };\n}\n\nfunction copyElementProps(\n source: Record<string, unknown> | null | undefined,\n base?: Record<string, unknown>,\n omitChildren = false,\n): Record<string, unknown> {\n const props: Record<PropertyKey, unknown> = {};\n\n if (base !== undefined) {\n copyOwnStringElementProps(base, props, omitChildren);\n }\n\n if (source === null || source === undefined) {\n return props as Record<string, unknown>;\n }\n\n copyOwnStringElementProps(source, props, omitChildren);\n copyOwnSymbolElementProps(source, props);\n return props as Record<string, unknown>;\n}\n\nfunction copyOwnStringElementProps(\n source: Record<string, unknown>,\n target: Record<string, unknown>,\n omitChildren: boolean,\n): void {\n for (const name in source) {\n if (!hasOwnProperty.call(source, name)) {\n continue;\n }\n\n if (\n name !== \"key\" &&\n name !== \"ref\" &&\n name !== \"__self\" &&\n name !== \"__source\" &&\n (!omitChildren || name !== \"children\")\n ) {\n target[name] = source[name];\n }\n }\n}\n\nfunction copyOwnSymbolElementProps(\n source: Record<string, unknown>,\n target: Record<PropertyKey, unknown>,\n): void {\n const symbolSource = source as Record<PropertyKey, unknown>;\n for (const symbol of Object.getOwnPropertySymbols(source)) {\n target[symbol] = symbolSource[symbol];\n }\n}\n\nfunction normalizeElementType<P>(type: ElementType<P>): ElementType<P> {\n return isReactCompatContextProviderShorthand(type) ? (type.Provider as ElementType<P>) : type;\n}\n\nfunction applyDefaultProps(\n type: unknown,\n props: Record<string, unknown>,\n): Record<string, unknown> {\n if (typeof type !== \"function\" && (typeof type !== \"object\" || type === null)) {\n return props;\n }\n\n const defaultProps = (type as { defaultProps?: Record<string, unknown> } | undefined)\n ?.defaultProps;\n\n if (defaultProps === undefined) {\n return props;\n }\n\n for (const [name, value] of Object.entries(defaultProps)) {\n if (props[name] === undefined) {\n props[name] = value;\n }\n }\n\n return props;\n}\n\ninterface ReactReservedProps {\n key?: unknown;\n ref?: unknown;\n __self?: unknown;\n __source?: unknown;\n}\n\nfunction isReactCompatContextProviderShorthand(\n value: unknown,\n): value is ReactCompatContextProviderShorthand {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n const provider = (value as { Provider?: unknown }).Provider;\n\n return (\n typeof provider === \"object\" &&\n provider !== null &&\n (provider as { $$typeof?: unknown }).$$typeof === REACT_COMPAT_PROVIDER_TYPE\n );\n}\n\nfunction setHostOwnPropsMeta(props: Record<string, unknown>): void {\n if (hostPropsAreChildrenOnly(props)) {\n (props as { [HOST_CHILDREN_ONLY_PROPS_META]?: true })[\n HOST_CHILDREN_ONLY_PROPS_META\n ] = true;\n }\n}\n\nfunction hostPropsAreChildrenOnly(props: Record<string, unknown>): boolean {\n for (const name in props) {\n if (hasOwnProperty.call(props, name) && name !== \"children\") {\n return false;\n }\n }\n\n return true;\n}\n\nexport const isValidElement = isReactCompatElement;\n\nexport const Children = {\n map<T>(\n children: ReactCompatNode,\n fn: (child: Exclude<ReactCompatNode, null | undefined | boolean>, index: number) => T,\n ): T[] | null {\n if (children === null || children === undefined) {\n return null;\n }\n\n return flattenChildren(children).map((child, index) =>\n fn(child as Exclude<ReactCompatNode, null | undefined | boolean>, index),\n );\n },\n forEach(\n children: ReactCompatNode,\n fn: (child: Exclude<ReactCompatNode, null | undefined | boolean>, index: number) => void,\n ): void {\n toChildArray(children).forEach((child, index) => {\n fn(child, index);\n });\n },\n count(children: ReactCompatNode): number {\n if (children === null || children === undefined) {\n return 0;\n }\n\n return flattenChildren(children).length;\n },\n toArray(children: ReactCompatNode): Exclude<ReactCompatNode, null | undefined | boolean>[] {\n return toChildArray(children);\n },\n only(children: ReactCompatNode): Exclude<ReactCompatNode, null | undefined | boolean> {\n const array = toChildArray(children);\n\n if (array.length !== 1) {\n throw new Error(\"Expected exactly one child.\");\n }\n\n return array[0] as Exclude<ReactCompatNode, null | undefined | boolean>;\n },\n};\n\nfunction toChildArray(\n children: ReactCompatNode,\n): Exclude<ReactCompatNode, null | undefined | boolean>[] {\n return flattenChildren(children).filter(\n (child): child is Exclude<ReactCompatNode, null | undefined | boolean> =>\n child !== null && child !== undefined && typeof child !== \"boolean\",\n );\n}\n\nfunction flattenChildren(children: ReactCompatNode): ReactCompatNode[] {\n if (Array.isArray(children)) {\n return children.flatMap((child) => flattenChildren(child));\n }\n\n return [children];\n}\n\nexport interface ErrorBoundaryOptions {\n fallback: (error: Error) => ReactCompatNode;\n onError?: (error: Error) => void;\n}\n\nexport function createErrorBoundary(\n options: ErrorBoundaryOptions,\n children: ReactCompatNode,\n): ReactCompatElement<ErrorBoundaryOptions & { children: ReactCompatNode }> {\n return createElement(ERROR_BOUNDARY_TYPE, {\n ...options,\n children,\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AAClF,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAChE,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AAClD,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AAClD,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CA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AC,CAAyD,CAAC;IAC1E,CAAC;CACF,CAAC;AAEF,SAAS,YAAY,CACnB,QAAyB;IAEzB,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC,MAAM,CACrC,CAAC,KAAK,EAAiE,EAAE,CACvE,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,SAAS,CACtE,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,QAAyB;IAChD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,CAAC,QAAQ,CAAC,CAAC;AACpB,CAAC;AAQD,kEAAkE;AAClE,MAAM,UAAU,mBAAmB,CACjC,OAA6B,EAC7B,QAAyB;IAEzB,OAAO,aAAa,CAAC,mBAAmB,EAAE;QACxC,GAAG,OAAO;QACV,QAAQ;KACT,CAAC,CAAC;AACL,CAAC","sourcesContent":["export const REACT_COMPAT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\");\nexport const ERROR_BOUNDARY_TYPE = Symbol.for(\"modular.react.error_boundary\");\nexport const FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\");\nexport const MEMO_TYPE = Symbol.for(\"react.memo\");\nexport const LAZY_TYPE = Symbol.for(\"react.lazy\");\nexport const STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\");\nexport const PORTAL_TYPE = Symbol.for(\"react.portal\");\nconst REACT_COMPAT_PROVIDER_TYPE = Symbol.for(\"react.context\");\n/** Symbol used to group JSX children without adding a host element. */\nexport const Fragment = Symbol.for(\"react.fragment\");\n/** Symbol used to suspend rendering while async content resolves. */\nexport const Suspense = Symbol.for(\"react.suspense\");\n/** Symbol used to coordinate multiple suspense boundaries. */\nexport const SuspenseList = Symbol.for(\"react.suspense_list\");\n/** Symbol used to mark activity boundaries in React-compatible trees. */\nexport const Activity = Symbol.for(\"react.activity\");\n/** Symbol used to measure render work with profiler callbacks. */\nexport const Profiler = Symbol.for(\"react.profiler\");\nexport const HOST_CHILDREN_ONLY_PROPS_META = Symbol.for(\n \"modular.react.host_children_only_props_meta\",\n);\n/** Metadata key that links a state value to a reactive text binding. */\nexport const REACTIVE_TEXT_BINDING_META = Symbol.for(\n \"modular.react.reactive_text_binding_meta\",\n);\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\n\nexport interface ReactCompatProviderType {\n $$typeof: symbol;\n context: unknown;\n}\n\nexport interface ReactCompatContextProviderShorthand {\n Provider: ReactCompatProviderType;\n Consumer: unknown;\n}\n\n/** Element type accepted by createElement, JSX, and renderer entrypoints. */\nexport type ElementType<P = Record<string, unknown>> =\n | string\n | typeof Fragment\n | typeof Suspense\n | typeof SuspenseList\n | typeof Activity\n | typeof Profiler\n | typeof ERROR_BOUNDARY_TYPE\n | typeof STRICT_MODE_TYPE\n | ReactCompatContextProviderShorthand\n | ReactCompatProviderType\n | ForwardRefType<P>\n | MemoType<P>\n | LazyType<P>\n | ((props: P) => ReactCompatNode | PromiseLike<ReactCompatNode>)\n | (new (props: P) => { render(): ReactCompatNode });\n\n/** Renderable value accepted by the React-compatible renderer. */\nexport type ReactCompatNode =\n | ReactCompatElement\n | ReactCompatPortal\n | string\n | number\n | boolean\n | null\n | undefined\n | ReactCompatNode[];\n\n/** React-compatible element record produced by createElement and JSX transforms. */\nexport interface ReactCompatElement<P = Record<string, unknown>> {\n $$typeof: typeof REACT_COMPAT_ELEMENT_TYPE;\n type: ElementType<P>;\n key: string | null;\n ref: unknown;\n props: P & { children?: ReactCompatNode };\n}\n\n/** Portal record that renders children into an external DOM container. */\nexport interface ReactCompatPortal {\n $$typeof: typeof PORTAL_TYPE;\n container: Element;\n children: ReactCompatNode;\n key: string | null;\n}\n\n/** Creates a React-compatible element from a type, config object, and children. */\nexport function createElement<P extends Record<string, unknown>>(\n type: ElementType<P>,\n config: (P & ReactReservedProps) | null,\n ...children: ReactCompatNode[]\n): ReactCompatElement<P> {\n if (typeof type === \"string\") {\n const key = config?.key === undefined ? null : String(config.key);\n const ref = config?.ref ?? null;\n const props = copyElementProps(config) as P & { children?: ReactCompatNode };\n\n if (children.length === 1) {\n props.children = children[0];\n } else if (children.length > 1) {\n props.children = children;\n }\n\n setHostOwnPropsMeta(props);\n\n return {\n $$typeof: REACT_COMPAT_ELEMENT_TYPE,\n type,\n key,\n ref,\n props,\n };\n }\n\n const normalizedType =\n typeof type === \"object\" && type !== null ? normalizeElementType(type) : type;\n const key = config?.key === undefined ? null : String(config.key);\n const ref = config?.ref ?? null;\n const props = applyDefaultProps(normalizedType, copyElementProps(config)) as P & {\n children?: ReactCompatNode;\n };\n\n if (children.length === 1) {\n props.children = children[0];\n } else if (children.length > 1) {\n props.children = children;\n }\n\n if (typeof normalizedType === \"string\") {\n setHostOwnPropsMeta(props);\n }\n\n return {\n $$typeof: REACT_COMPAT_ELEMENT_TYPE,\n type: normalizedType as ElementType<P>,\n key,\n ref,\n props: props as P & { children?: ReactCompatNode },\n };\n}\n\n/** Creates a React-compatible element from JSX runtime arguments. */\nexport function createElementFromJsxConfig<P extends Record<string, unknown>>(\n type: ElementType<P>,\n config: (P & ReactReservedProps & { children?: ReactCompatNode }) | null,\n keyArgument?: unknown,\n): ReactCompatElement<P> {\n const normalizedType =\n typeof type === \"object\" && type !== null ? normalizeElementType(type) : type;\n const key = keyArgument !== undefined\n ? String(keyArgument)\n : config?.key === undefined ? null : String(config.key);\n const ref = config?.ref ?? null;\n const hasChildren = config !== null && config !== undefined && hasOwnProperty.call(config, \"children\");\n const children = config?.children;\n const copiedProps = copyElementProps(config, undefined, true);\n const props = (typeof normalizedType === \"string\"\n ? copiedProps\n : applyDefaultProps(normalizedType, copiedProps)) as P & {\n children?: ReactCompatNode;\n };\n\n if (hasChildren) {\n props.children = children;\n }\n\n if (typeof normalizedType === \"string\") {\n setHostOwnPropsMeta(props);\n }\n\n return {\n $$typeof: REACT_COMPAT_ELEMENT_TYPE,\n type: normalizedType as ElementType<P>,\n key,\n ref,\n props,\n };\n}\n\n/** Returns true when a value is a React-compatible element record. */\nexport function isReactCompatElement(\n value: unknown,\n): value is ReactCompatElement {\n return (\n typeof value === \"object\" &&\n value !== null &&\n (value as { $$typeof?: unknown }).$$typeof === REACT_COMPAT_ELEMENT_TYPE\n );\n}\n\n/** Creates a portal that renders children into a DOM container outside the parent tree. */\nexport function createPortal(\n children: ReactCompatNode,\n container: Element,\n key?: unknown,\n): ReactCompatPortal {\n return {\n $$typeof: PORTAL_TYPE,\n container,\n children,\n key: key === undefined ? null : String(key),\n };\n}\n\n/** Returns true when a value is a React-compatible portal record. */\nexport function isReactCompatPortal(value: unknown): value is ReactCompatPortal {\n return (\n typeof value === \"object\" &&\n value !== null &&\n (value as { $$typeof?: unknown }).$$typeof === PORTAL_TYPE\n );\n}\n\n/** Creates a mutable ref object with a null initial current value. */\nexport function createRef<T>(): { current: T | null } {\n return { current: null };\n}\n\n/** Element type record produced by forwardRef. */\nexport interface ForwardRefType<P = Record<string, unknown>> {\n $$typeof: typeof FORWARD_REF_TYPE;\n render: (props: P, ref: unknown) => ReactCompatNode;\n}\n\n/** Element type record produced by memo. */\nexport interface MemoType<P = Record<string, unknown>> {\n $$typeof: typeof MEMO_TYPE;\n type: ElementType<P>;\n compare?: (previous: P, next: P) => boolean;\n}\n\n/** Element type record produced by lazy. */\nexport interface LazyType<P = Record<string, unknown>> {\n $$typeof: typeof LAZY_TYPE;\n load: () => Promise<{ default: ElementType<P> }>;\n status: \"uninitialized\" | \"pending\" | \"resolved\" | \"rejected\";\n promise?: Promise<void>;\n resolved?: ElementType<P>;\n error?: unknown;\n}\n\n/** Wraps a component so it can receive a ref as the second render argument. */\nexport function forwardRef<P, T>(\n render: (props: P, ref: { current: T | null } | ((value: T | null) => void) | null) => ReactCompatNode,\n): ForwardRefType<P & { ref?: unknown }> {\n return { $$typeof: FORWARD_REF_TYPE, render: render as ForwardRefType<P>[\"render\"] };\n}\n\n/** Wraps an element type with optional prop comparison for memoized renders. */\nexport function memo<P>(\n type: ElementType<P>,\n compare?: (previous: P, next: P) => boolean,\n): MemoType<P> {\n return compare === undefined\n ? { $$typeof: MEMO_TYPE, type }\n : { $$typeof: MEMO_TYPE, type, compare };\n}\n\n/** Creates a lazy element type that resolves its implementation on demand. */\nexport function lazy<P>(\n load: () => Promise<{ default: ElementType<P> }>,\n): LazyType<P> {\n return {\n $$typeof: LAZY_TYPE,\n load,\n status: \"uninitialized\",\n };\n}\n\n/** Symbol used to mark a subtree for strict-mode development checks. */\nexport const StrictMode = STRICT_MODE_TYPE;\n\n/** Clones an existing element with merged props and optional replacement children. */\nexport function cloneElement<P extends Record<string, unknown>>(\n element: ReactCompatElement<P>,\n props: Partial<P> | null,\n ...children: ReactCompatNode[]\n): ReactCompatElement<P> {\n const key = props === null || props.key === undefined ? element.key : String(props.key);\n const ref = props === null || props.ref === undefined ? element.ref : props.ref;\n const nextProps = copyElementProps(props, element.props) as P & {\n children?: ReactCompatNode;\n };\n\n if (children.length === 1) {\n (nextProps as P & { children?: ReactCompatNode }).children = children[0];\n } else if (children.length > 1) {\n (nextProps as P & { children?: ReactCompatNode }).children = children;\n }\n\n return {\n $$typeof: REACT_COMPAT_ELEMENT_TYPE,\n type: element.type,\n key,\n ref,\n props: nextProps as P & { children?: ReactCompatNode },\n };\n}\n\nfunction copyElementProps(\n source: Record<string, unknown> | null | undefined,\n base?: Record<string, unknown>,\n omitChildren = false,\n): Record<string, unknown> {\n const props: Record<PropertyKey, unknown> = {};\n\n if (base !== undefined) {\n copyOwnStringElementProps(base, props, omitChildren);\n }\n\n if (source === null || source === undefined) {\n return props as Record<string, unknown>;\n }\n\n copyOwnStringElementProps(source, props, omitChildren);\n copyOwnSymbolElementProps(source, props);\n return props as Record<string, unknown>;\n}\n\nfunction copyOwnStringElementProps(\n source: Record<string, unknown>,\n target: Record<string, unknown>,\n omitChildren: boolean,\n): void {\n for (const name in source) {\n if (!hasOwnProperty.call(source, name)) {\n continue;\n }\n\n if (\n name !== \"key\" &&\n name !== \"ref\" &&\n name !== \"__self\" &&\n name !== \"__source\" &&\n (!omitChildren || name !== \"children\")\n ) {\n target[name] = source[name];\n }\n }\n}\n\nfunction copyOwnSymbolElementProps(\n source: Record<string, unknown>,\n target: Record<PropertyKey, unknown>,\n): void {\n const symbolSource = source as Record<PropertyKey, unknown>;\n for (const symbol of Object.getOwnPropertySymbols(source)) {\n target[symbol] = symbolSource[symbol];\n }\n}\n\nfunction normalizeElementType<P>(type: ElementType<P>): ElementType<P> {\n return isReactCompatContextProviderShorthand(type) ? (type.Provider as ElementType<P>) : type;\n}\n\nfunction applyDefaultProps(\n type: unknown,\n props: Record<string, unknown>,\n): Record<string, unknown> {\n if (typeof type !== \"function\" && (typeof type !== \"object\" || type === null)) {\n return props;\n }\n\n const defaultProps = (type as { defaultProps?: Record<string, unknown> } | undefined)\n ?.defaultProps;\n\n if (defaultProps === undefined) {\n return props;\n }\n\n for (const [name, value] of Object.entries(defaultProps)) {\n if (props[name] === undefined) {\n props[name] = value;\n }\n }\n\n return props;\n}\n\ninterface ReactReservedProps {\n key?: unknown;\n ref?: unknown;\n __self?: unknown;\n __source?: unknown;\n}\n\nfunction isReactCompatContextProviderShorthand(\n value: unknown,\n): value is ReactCompatContextProviderShorthand {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n const provider = (value as { Provider?: unknown }).Provider;\n\n return (\n typeof provider === \"object\" &&\n provider !== null &&\n (provider as { $$typeof?: unknown }).$$typeof === REACT_COMPAT_PROVIDER_TYPE\n );\n}\n\nfunction setHostOwnPropsMeta(props: Record<string, unknown>): void {\n if (hostPropsAreChildrenOnly(props)) {\n (props as { [HOST_CHILDREN_ONLY_PROPS_META]?: true })[\n HOST_CHILDREN_ONLY_PROPS_META\n ] = true;\n }\n}\n\nfunction hostPropsAreChildrenOnly(props: Record<string, unknown>): boolean {\n for (const name in props) {\n if (hasOwnProperty.call(props, name) && name !== \"children\") {\n return false;\n }\n }\n\n return true;\n}\n\n/** Alias for checking whether a value is a React-compatible element. */\nexport const isValidElement = isReactCompatElement;\n\n/** Helpers for iterating, counting, flattening, and validating children. */\nexport const Children = {\n map<T>(\n children: ReactCompatNode,\n fn: (child: Exclude<ReactCompatNode, null | undefined | boolean>, index: number) => T,\n ): T[] | null {\n if (children === null || children === undefined) {\n return null;\n }\n\n return flattenChildren(children).map((child, index) =>\n fn(child as Exclude<ReactCompatNode, null | undefined | boolean>, index),\n );\n },\n forEach(\n children: ReactCompatNode,\n fn: (child: Exclude<ReactCompatNode, null | undefined | boolean>, index: number) => void,\n ): void {\n toChildArray(children).forEach((child, index) => {\n fn(child, index);\n });\n },\n count(children: ReactCompatNode): number {\n if (children === null || children === undefined) {\n return 0;\n }\n\n return flattenChildren(children).length;\n },\n toArray(children: ReactCompatNode): Exclude<ReactCompatNode, null | undefined | boolean>[] {\n return toChildArray(children);\n },\n only(children: ReactCompatNode): Exclude<ReactCompatNode, null | undefined | boolean> {\n const array = toChildArray(children);\n\n if (array.length !== 1) {\n throw new Error(\"Expected exactly one child.\");\n }\n\n return array[0] as Exclude<ReactCompatNode, null | undefined | boolean>;\n },\n};\n\nfunction toChildArray(\n children: ReactCompatNode,\n): Exclude<ReactCompatNode, null | undefined | boolean>[] {\n return flattenChildren(children).filter(\n (child): child is Exclude<ReactCompatNode, null | undefined | boolean> =>\n child !== null && child !== undefined && typeof child !== \"boolean\",\n );\n}\n\nfunction flattenChildren(children: ReactCompatNode): ReactCompatNode[] {\n if (Array.isArray(children)) {\n return children.flatMap((child) => flattenChildren(child));\n }\n\n return [children];\n}\n\n/** Options used to render and observe a React-compatible error boundary. */\nexport interface ErrorBoundaryOptions {\n fallback: (error: Error) => ReactCompatNode;\n onError?: (error: Error) => void;\n}\n\n/** Creates an error boundary element with a fallback renderer. */\nexport function createErrorBoundary(\n options: ErrorBoundaryOptions,\n children: ReactCompatNode,\n): ReactCompatElement<ErrorBoundaryOptions & { children: ReactCompatNode }> {\n return createElement(ERROR_BOUNDARY_TYPE, {\n ...options,\n children,\n });\n}\n"]}
|
package/dist/event-priority.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-priority.d.ts","sourceRoot":"","sources":["../src/event-priority.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"event-priority.d.ts","sourceRoot":"","sources":["../src/event-priority.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,OAAO,EAAE,oBAAoB,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/event-priority.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-priority.js","sourceRoot":"","sources":["../src/event-priority.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAsB,MAAM,YAAY,CAAC","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"event-priority.js","sourceRoot":"","sources":["../src/event-priority.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,OAAO,EAAE,oBAAoB,EAAsB,MAAM,YAAY,CAAC","sourcesContent":["/** Event priority helpers for React-compatible event batching. */\nexport { runWithEventPriority, type EventPriority } from \"./hooks.js\";\n"]}
|
package/dist/event-replay.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
/** Serialized map of server-rendered event handlers used for hydration replay. */
|
|
1
2
|
export interface EventHydrationManifest {
|
|
2
3
|
version: 1;
|
|
3
4
|
events: EventHydrationManifestEntry[];
|
|
4
5
|
}
|
|
6
|
+
/** Single event handler entry in a hydration replay manifest. */
|
|
5
7
|
export interface EventHydrationManifestEntry {
|
|
6
8
|
id: string;
|
|
7
9
|
event: string;
|
|
@@ -10,9 +12,13 @@ export interface EventHydrationManifestEntry {
|
|
|
10
12
|
export interface HydrationEventReplayOptions {
|
|
11
13
|
onCapturedEvent?: (event: Event, target: EventTarget) => void;
|
|
12
14
|
}
|
|
15
|
+
/** Queues a captured event so it can be replayed after hydration. */
|
|
13
16
|
export declare function queueHydrationEvent(container: Element, event: Event, target: EventTarget): void;
|
|
17
|
+
/** Captures supported events on a container until hydration can replay them. */
|
|
14
18
|
export declare function enableHydrationEventReplay(container: Element): () => void;
|
|
19
|
+
/** Reads an event hydration manifest script from a document or parent node. */
|
|
15
20
|
export declare function readEventHydrationManifest(root?: ParentNode): EventHydrationManifest | undefined;
|
|
21
|
+
/** Captures only the event types declared by a hydration manifest. */
|
|
16
22
|
export declare function enableEventHydrationManifestReplay(container: Element, manifest: EventHydrationManifest | undefined, options?: HydrationEventReplayOptions): () => void;
|
|
17
23
|
export declare function replayQueuedHydrationEvents(container: Element): void;
|
|
18
24
|
//# sourceMappingURL=event-replay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-replay.d.ts","sourceRoot":"","sources":["../src/event-replay.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,CAAC,CAAC;IACX,MAAM,EAAE,2BAA2B,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAOD,MAAM,WAAW,2BAA2B;IAC1C,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;CAC/D;AAED,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,WAAW,GAClB,IAAI,CAYN;AAED,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM,IAAI,CAEzE;AAED,wBAAgB,0BAA0B,CACxC,IAAI,GAAE,UAAqB,G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/event-replay.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const queuedHydrationEvents = new WeakMap();
|
|
2
2
|
const replayedEvents = new WeakSet();
|
|
3
3
|
const allowedReplayEventTypes = new Set(["click", "input", "change", "submit"]);
|
|
4
|
+
/** Queues a captured event so it can be replayed after hydration. */
|
|
4
5
|
export function queueHydrationEvent(container, event, target) {
|
|
5
6
|
if (!allowedReplayEventTypes.has(event.type) ||
|
|
6
7
|
!(target instanceof Node) ||
|
|
@@ -11,9 +12,11 @@ export function queueHydrationEvent(container, event, target) {
|
|
|
11
12
|
events.push({ event, target });
|
|
12
13
|
queuedHydrationEvents.set(container, events);
|
|
13
14
|
}
|
|
15
|
+
/** Captures supported events on a container until hydration can replay them. */
|
|
14
16
|
export function enableHydrationEventReplay(container) {
|
|
15
17
|
return enableHydrationEventReplayForTypes(container, allowedReplayEventTypes);
|
|
16
18
|
}
|
|
19
|
+
/** Reads an event hydration manifest script from a document or parent node. */
|
|
17
20
|
export function readEventHydrationManifest(root = document) {
|
|
18
21
|
const script = root.querySelector("script[data-mreact-event-manifest]");
|
|
19
22
|
if (script === null) {
|
|
@@ -25,6 +28,7 @@ export function readEventHydrationManifest(root = document) {
|
|
|
25
28
|
}
|
|
26
29
|
return value;
|
|
27
30
|
}
|
|
31
|
+
/** Captures only the event types declared by a hydration manifest. */
|
|
28
32
|
export function enableEventHydrationManifestReplay(container, manifest, options = {}) {
|
|
29
33
|
if (manifest === undefined) {
|
|
30
34
|
return () => undefined;
|
package/dist/event-replay.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-replay.js","sourceRoot":"","sources":["../src/event-replay.ts"],"names":[],"mappings":"AAAA,MAAM,qBAAqB,GAAG,IAAI,OAAO,EAAmC,CAAC;AAC7E,MAAM,cAAc,GAAG,IAAI,OAAO,EAAS,CAAC;AAC5C,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE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O,EAAE,KAAK,CAAC,OAAO;YACtB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,CAAC,CAAC;IACL,CAAC;IAED,IAAI,OAAO,UAAU,KAAK,WAAW,IAAI,KAAK,YAAY,UAAU,EAAE,CAAC;QACrE,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE;YAChC,GAAG,IAAI;YACP,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,SAAS,EAAE,KAAK,CAAC,SAAS;SAC3B,CAAC,CAAC;IACL,CAAC;IAED,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC","sourcesContent":["const queuedHydrationEvents = new WeakMap<Element, QueuedHydrationEvent[]>();\nconst replayedEvents = new WeakSet<Event>();\nconst allowedReplayEventTypes = new Set([\"click\", \"input\", \"change\", \"submit\"]);\n\n/** Serialized map of server-rendered event handlers used for hydration replay. */\nexport interface EventHydrationManifest {\n version: 1;\n events: EventHydrationManifestEntry[];\n}\n\n/** Single event handler entry in a hydration replay manifest. */\nexport interface EventHydrationManifestEntry {\n id: string;\n event: string;\n handler: string;\n}\n\ninterface QueuedHydrationEvent {\n target: EventTarget;\n event: Event;\n}\n\nexport interface HydrationEventReplayOptions {\n onCapturedEvent?: (event: Event, target: EventTarget) => void;\n}\n\n/** Queues a captured event so it can be replayed after hydration. */\nexport function queueHydrationEvent(\n container: Element,\n event: Event,\n target: EventTarget,\n): void {\n if (\n !allowedReplayEventTypes.has(event.type) ||\n !(target instanceof Node) ||\n !container.contains(target)\n ) {\n return;\n }\n\n const events = queuedHydrationEvents.get(container) ?? [];\n events.push({ event, target });\n queuedHydrationEvents.set(container, events);\n}\n\n/** Captures supported events on a container until hydration can replay them. */\nexport function enableHydrationEventReplay(container: Element): () => void {\n return enableHydrationEventReplayForTypes(container, allowedReplayEventTypes);\n}\n\n/** Reads an event hydration manifest script from a document or parent node. */\nexport function readEventHydrationManifest(\n root: ParentNode = document,\n): EventHydrationManifest | undefined {\n const script = root.querySelector<HTMLScriptElement>(\n \"script[data-mreact-event-manifest]\",\n );\n\n if (script === null) {\n return undefined;\n }\n\n const value = JSON.parse(script.textContent ?? \"\") as EventHydrationManifest;\n\n if (value.version !== 1 || !Array.isArray(value.events)) {\n return undefined;\n }\n\n return value;\n}\n\n/** Captures only the event types declared by a hydration manifest. */\nexport function enableEventHydrationManifestReplay(\n container: Element,\n manifest: EventHydrationManifest | undefined,\n options: HydrationEventReplayOptions = {},\n): () => void {\n if (manifest === undefined) {\n return () => undefined;\n }\n\n const eventTypes = new Set(\n manifest.events\n .map((event) => event.event)\n .filter((event) => allowedReplayEventTypes.has(event)),\n );\n\n return enableHydrationEventReplayForTypes(container, eventTypes, options);\n}\n\nexport function replayQueuedHydrationEvents(container: Element): void {\n const events = queuedHydrationEvents.get(container) ?? [];\n queuedHydrationEvents.delete(container);\n\n for (const { event, target } of events) {\n replayedEvents.add(event);\n target.dispatchEvent(event);\n }\n}\n\nfunction enableHydrationEventReplayForTypes(\n container: Element,\n eventTypes: Iterable<string>,\n options: HydrationEventReplayOptions = {},\n): () => void {\n const listeners = Array.from(eventTypes, (type) => {\n const listener = (event: Event): void => {\n if (replayedEvents.has(event) || !(event.target instanceof Node)) {\n return;\n }\n\n const replayEvent = cloneReplayableEvent(event);\n queueHydrationEvent(container, replayEvent, event.target);\n options.onCapturedEvent?.(replayEvent, event.target);\n event.stopImmediatePropagation();\n event.preventDefault();\n };\n\n container.addEventListener(type, listener, true);\n return { type, listener };\n });\n\n return () => {\n for (const { type, listener } of listeners) {\n container.removeEventListener(type, listener, true);\n }\n };\n}\n\nfunction cloneReplayableEvent(event: Event): Event {\n const init = {\n bubbles: event.bubbles,\n cancelable: event.cancelable,\n composed: event.composed,\n };\n\n if (typeof MouseEvent !== \"undefined\" && event instanceof MouseEvent) {\n return new MouseEvent(event.type, {\n ...init,\n button: event.button,\n buttons: event.buttons,\n clientX: event.clientX,\n clientY: event.clientY,\n ctrlKey: event.ctrlKey,\n metaKey: event.metaKey,\n shiftKey: event.shiftKey,\n altKey: event.altKey,\n });\n }\n\n if (typeof InputEvent !== \"undefined\" && event instanceof InputEvent) {\n return new InputEvent(event.type, {\n ...init,\n data: event.data,\n inputType: event.inputType,\n });\n }\n\n return new Event(event.type, init);\n}\n"]}
|
package/dist/flight-decoder.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ElementType } from "./element.js";
|
|
2
2
|
import type { FlightClientReference, FlightModel, FlightResponse, FlightServerReference } from "./flight-types.js";
|
|
3
|
+
/** Options used when resolving client and server references while decoding Flight models. */
|
|
3
4
|
export interface DecodeFlightOptions {
|
|
4
5
|
loadClientReference(reference: FlightClientReference): ElementType<Record<string, unknown>>;
|
|
5
6
|
callServerReference?(reference: FlightServerReference, args: unknown[]): unknown | Promise<unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flight-decoder.d.ts","sourceRoot":"","sources":["../src/flight-decoder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAKhD,OAAO,KAAK,EACV,qBAAqB,EACrB,WAAW,EACX,cAAc,EACd,qBAAqB,EAEtB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,mBAAmB;IAClC,mBAAmB,CAAC,SAAS,EAAE,qBAAqB,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC5F,mBAAmB,CAAC,CAClB,SAAS,EAAE,qBAAqB,EAChC,IAAI,EAAE,OAAO,EAAE,GACd,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC/B;AAaD,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,mBAAmB,EAC5B,KAAK,SAAI,GACR,OAAO,CA4HT"}
|
|
1
|
+
{"version":3,"file":"flight-decoder.d.ts","sourceRoot":"","sources":["../src/flight-decoder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAKhD,OAAO,KAAK,EACV,qBAAqB,EACrB,WAAW,EACX,cAAc,EACd,qBAAqB,EAEtB,MAAM,mBAAmB,CAAC;AAE3B,6FAA6F;AAC7F,MAAM,WAAW,mBAAmB;IAClC,mBAAmB,CAAC,SAAS,EAAE,qBAAqB,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC5F,mBAAmB,CAAC,CAClB,SAAS,EAAE,qBAAqB,EAChC,IAAI,EAAE,OAAO,EAAE,GACd,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC/B;AAaD,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,mBAAmB,EAC5B,KAAK,SAAI,GACR,OAAO,CA4HT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flight-decoder.js","sourceRoot":"","sources":["../src/flight-decoder.ts"],"names":[],"mappings":"AACA,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,GACzB,MAAM,6BAA6B,CAAC;AAiBrC,mEAAmE;AACnE,4CAA4C;AAC5C,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAEpC,MAAM,iBAAkB,SAAQ,KAAK;IACnC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED,MAAM,UAAU,iBAAiB,CAC/B,KAA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AK,mBAAmB;YACtB,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACvC,KAAK,YAAY;YACf,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;QAChC,KAAK,aAAa;YAChB,OAAO,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;QACjC,KAAK,YAAY;YACf,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;QAChC,KAAK,aAAa;YAChB,OAAO,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;QACjC,KAAK,cAAc;YACjB,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;QAClC,KAAK,cAAc;YACjB,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;QAClC,KAAK,eAAe;YAClB,OAAO,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;QACnC,KAAK,gBAAgB;YACnB,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;AACH,CAAC","sourcesContent":["import type { ElementType } from \"./element.js\";\nimport {\n createFlightServerReferenceStub,\n decodeFlightElementModel,\n} from \"./flight-element-builder.js\";\nimport type {\n FlightClientReference,\n FlightModel,\n FlightResponse,\n FlightServerReference,\n FlightTypedArrayName,\n} from \"./flight-types.js\";\n\nexport interface DecodeFlightOptions {\n loadClientReference(reference: FlightClientReference): ElementType<Record<string, unknown>>;\n callServerReference?(\n reference: FlightServerReference,\n args: unknown[],\n ): unknown | Promise<unknown>;\n}\n\n// Issue 079: cap recursion depth so a deeply-nested Flight payload\n// cannot stack-overflow the client decoder.\nconst MAX_FLIGHT_DECODE_DEPTH = 256;\n\nclass FlightDecodeError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"FlightDecodeError\";\n }\n}\n\nexport function decodeFlightModel(\n model: FlightModel,\n response: FlightResponse,\n options: DecodeFlightOptions,\n depth = 0,\n): unknown {\n if (depth > MAX_FLIGHT_DECODE_DEPTH) {\n throw new FlightDecodeError(\n `MR_FLIGHT_TOO_DEEP: nested deeper than ${MAX_FLIGHT_DECODE_DEPTH} levels`,\n );\n }\n if (\n model === null ||\n typeof model === \"string\" ||\n typeof model === \"number\" ||\n typeof model === \"boolean\"\n ) {\n return model;\n }\n\n if (Array.isArray(model)) {\n return model.map((item) => decodeFlightModel(item, response, options, depth + 1));\n }\n\n if (model.kind === \"undefined\") {\n return undefined;\n }\n\n if (model.kind === \"date\") {\n return new Date(model.value);\n }\n\n if (model.kind === \"bigint\") {\n return BigInt(model.value);\n }\n\n if (model.kind === \"number\") {\n switch (model.value) {\n case \"Infinity\":\n return Infinity;\n case \"-Infinity\":\n return -Infinity;\n case \"-0\":\n return -0;\n case \"NaN\":\n return Number.NaN;\n }\n }\n\n if (model.kind === \"symbol\") {\n return Symbol.for(model.name);\n }\n\n if (model.kind === \"map\") {\n return new Map(\n model.entries.map(([key, value]) => [\n decodeFlightModel(key, response, options, depth + 1),\n decodeFlightModel(value, response, options, depth + 1),\n ]),\n );\n }\n\n if (model.kind === \"set\") {\n return new Set(\n model.values.map((value) => decodeFlightModel(value, response, options, depth + 1)),\n );\n }\n\n if (model.kind === \"form-data\") {\n const formData = new FormData();\n\n for (const [name, value] of model.entries) {\n const decoded = decodeFlightModel(value, response, options, depth + 1);\n formData.append(name, decoded instanceof Blob ? decoded : String(decoded ?? \"\"));\n }\n\n return formData;\n }\n\n if (model.kind === \"iterable\") {\n return model.values.map((value) => decodeFlightModel(value, response, options, depth + 1));\n }\n\n if (model.kind === \"array-buffer\") {\n return createArrayBuffer(model.bytes);\n }\n\n if (model.kind === \"typed-array\") {\n return createTypedArray(model.arrayType, model.bytes);\n }\n\n if (model.kind === \"data-view\") {\n return new DataView(createArrayBuffer(model.bytes));\n }\n\n if (model.kind === \"error\") {\n const error = new Error(model.message);\n error.name = model.name;\n if (model.digest !== undefined) {\n (error as Error & { digest?: string }).digest = model.digest;\n }\n throw error;\n }\n\n if (model.kind === \"promise\") {\n throw new Error(`React Flight chunk ${model.id} is still pending.`);\n }\n\n if (model.kind === \"element\") {\n return decodeFlightElementModel(\n model,\n response,\n options,\n (value, childDepth = 0) => decodeFlightModel(value, response, options, childDepth),\n depth,\n assertFlightDecodeDepth,\n );\n }\n\n if (model.kind === \"server-reference\") {\n return createFlightServerReferenceStub(\n model.id,\n response,\n options,\n (value, childDepth = 0) => decodeFlightModel(value, response, options, childDepth),\n );\n }\n\n throw new Error(`Unexpected Flight model kind: ${model.kind}`);\n}\n\nfunction assertFlightDecodeDepth(depth: number): void {\n if (depth > MAX_FLIGHT_DECODE_DEPTH) {\n throw new FlightDecodeError(\n `MR_FLIGHT_TOO_DEEP: nested deeper than ${MAX_FLIGHT_DECODE_DEPTH} levels`,\n );\n }\n}\n\nfunction createArrayBuffer(bytes: number[]): ArrayBuffer {\n const array = Uint8Array.from(bytes);\n\n return array.buffer.slice(array.byteOffset, array.byteOffset + array.byteLength);\n}\n\nfunction createTypedArray(arrayType: FlightTypedArrayName, bytes: number[]): unknown {\n const buffer = createArrayBuffer(bytes);\n\n switch (arrayType) {\n case \"Int8Array\":\n return new Int8Array(buffer);\n case \"Uint8Array\":\n return new Uint8Array(buffer);\n case \"Uint8ClampedArray\":\n return new Uint8ClampedArray(buffer);\n case \"Int16Array\":\n return new Int16Array(buffer);\n case \"Uint16Array\":\n return new Uint16Array(buffer);\n case \"Int32Array\":\n return new Int32Array(buffer);\n case \"Uint32Array\":\n return new Uint32Array(buffer);\n case \"Float32Array\":\n return new Float32Array(buffer);\n case \"Float64Array\":\n return new Float64Array(buffer);\n case \"BigInt64Array\":\n return new BigInt64Array(buffer);\n case \"BigUint64Array\":\n return new BigUint64Array(buffer);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"flight-decoder.js","sourceRoot":"","sources":["../src/flight-decoder.ts"],"names":[],"mappings":"AACA,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,GACzB,MAAM,6BAA6B,CAAC;AAkBrC,mEAAmE;AACnE,4CAA4C;AAC5C,MAAM,uBAAuB,GAAG,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B,CAAC,KAAK,CAAC,CAAC;IAExC,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,WAAW;YACd,OAAO,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;QAC/B,KAAK,YAAY;YACf,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;QAChC,KAAK,mBAAmB;YACtB,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACvC,KAAK,YAAY;YACf,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;QAChC,KAAK,aAAa;YAChB,OAAO,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;QACjC,KAAK,YAAY;YACf,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;QAChC,KAAK,aAAa;YAChB,OAAO,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;QACjC,KAAK,cAAc;YACjB,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;QAClC,KAAK,cAAc;YACjB,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;QAClC,KAAK,eAAe;YAClB,OAAO,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;QACnC,KAAK,gBAAgB;YACnB,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;AACH,CAAC","sourcesContent":["import type { ElementType } from \"./element.js\";\nimport {\n createFlightServerReferenceStub,\n decodeFlightElementModel,\n} from \"./flight-element-builder.js\";\nimport type {\n FlightClientReference,\n FlightModel,\n FlightResponse,\n FlightServerReference,\n FlightTypedArrayName,\n} from \"./flight-types.js\";\n\n/** Options used when resolving client and server references while decoding Flight models. */\nexport interface DecodeFlightOptions {\n loadClientReference(reference: FlightClientReference): ElementType<Record<string, unknown>>;\n callServerReference?(\n reference: FlightServerReference,\n args: unknown[],\n ): unknown | Promise<unknown>;\n}\n\n// Issue 079: cap recursion depth so a deeply-nested Flight payload\n// cannot stack-overflow the client decoder.\nconst MAX_FLIGHT_DECODE_DEPTH = 256;\n\nclass FlightDecodeError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"FlightDecodeError\";\n }\n}\n\nexport function decodeFlightModel(\n model: FlightModel,\n response: FlightResponse,\n options: DecodeFlightOptions,\n depth = 0,\n): unknown {\n if (depth > MAX_FLIGHT_DECODE_DEPTH) {\n throw new FlightDecodeError(\n `MR_FLIGHT_TOO_DEEP: nested deeper than ${MAX_FLIGHT_DECODE_DEPTH} levels`,\n );\n }\n if (\n model === null ||\n typeof model === \"string\" ||\n typeof model === \"number\" ||\n typeof model === \"boolean\"\n ) {\n return model;\n }\n\n if (Array.isArray(model)) {\n return model.map((item) => decodeFlightModel(item, response, options, depth + 1));\n }\n\n if (model.kind === \"undefined\") {\n return undefined;\n }\n\n if (model.kind === \"date\") {\n return new Date(model.value);\n }\n\n if (model.kind === \"bigint\") {\n return BigInt(model.value);\n }\n\n if (model.kind === \"number\") {\n switch (model.value) {\n case \"Infinity\":\n return Infinity;\n case \"-Infinity\":\n return -Infinity;\n case \"-0\":\n return -0;\n case \"NaN\":\n return Number.NaN;\n }\n }\n\n if (model.kind === \"symbol\") {\n return Symbol.for(model.name);\n }\n\n if (model.kind === \"map\") {\n return new Map(\n model.entries.map(([key, value]) => [\n decodeFlightModel(key, response, options, depth + 1),\n decodeFlightModel(value, response, options, depth + 1),\n ]),\n );\n }\n\n if (model.kind === \"set\") {\n return new Set(\n model.values.map((value) => decodeFlightModel(value, response, options, depth + 1)),\n );\n }\n\n if (model.kind === \"form-data\") {\n const formData = new FormData();\n\n for (const [name, value] of model.entries) {\n const decoded = decodeFlightModel(value, response, options, depth + 1);\n formData.append(name, decoded instanceof Blob ? decoded : String(decoded ?? \"\"));\n }\n\n return formData;\n }\n\n if (model.kind === \"iterable\") {\n return model.values.map((value) => decodeFlightModel(value, response, options, depth + 1));\n }\n\n if (model.kind === \"array-buffer\") {\n return createArrayBuffer(model.bytes);\n }\n\n if (model.kind === \"typed-array\") {\n return createTypedArray(model.arrayType, model.bytes);\n }\n\n if (model.kind === \"data-view\") {\n return new DataView(createArrayBuffer(model.bytes));\n }\n\n if (model.kind === \"error\") {\n const error = new Error(model.message);\n error.name = model.name;\n if (model.digest !== undefined) {\n (error as Error & { digest?: string }).digest = model.digest;\n }\n throw error;\n }\n\n if (model.kind === \"promise\") {\n throw new Error(`React Flight chunk ${model.id} is still pending.`);\n }\n\n if (model.kind === \"element\") {\n return decodeFlightElementModel(\n model,\n response,\n options,\n (value, childDepth = 0) => decodeFlightModel(value, response, options, childDepth),\n depth,\n assertFlightDecodeDepth,\n );\n }\n\n if (model.kind === \"server-reference\") {\n return createFlightServerReferenceStub(\n model.id,\n response,\n options,\n (value, childDepth = 0) => decodeFlightModel(value, response, options, childDepth),\n );\n }\n\n throw new Error(`Unexpected Flight model kind: ${model.kind}`);\n}\n\nfunction assertFlightDecodeDepth(depth: number): void {\n if (depth > MAX_FLIGHT_DECODE_DEPTH) {\n throw new FlightDecodeError(\n `MR_FLIGHT_TOO_DEEP: nested deeper than ${MAX_FLIGHT_DECODE_DEPTH} levels`,\n );\n }\n}\n\nfunction createArrayBuffer(bytes: number[]): ArrayBuffer {\n const array = Uint8Array.from(bytes);\n\n return array.buffer.slice(array.byteOffset, array.byteOffset + array.byteLength);\n}\n\nfunction createTypedArray(arrayType: FlightTypedArrayName, bytes: number[]): unknown {\n const buffer = createArrayBuffer(bytes);\n\n switch (arrayType) {\n case \"Int8Array\":\n return new Int8Array(buffer);\n case \"Uint8Array\":\n return new Uint8Array(buffer);\n case \"Uint8ClampedArray\":\n return new Uint8ClampedArray(buffer);\n case \"Int16Array\":\n return new Int16Array(buffer);\n case \"Uint16Array\":\n return new Uint16Array(buffer);\n case \"Int32Array\":\n return new Int32Array(buffer);\n case \"Uint32Array\":\n return new Uint32Array(buffer);\n case \"Float32Array\":\n return new Float32Array(buffer);\n case \"Float64Array\":\n return new Float64Array(buffer);\n case \"BigInt64Array\":\n return new BigInt64Array(buffer);\n case \"BigUint64Array\":\n return new BigUint64Array(buffer);\n }\n}\n"]}
|
|
@@ -2,10 +2,12 @@ export declare const reactFlightBinaryRowTags: readonly ["A", "O", "o", "U", "S"
|
|
|
2
2
|
export declare const reactFlightRowTags: readonly ["C", "D", "E", "F", "H", "I", "J", "N", "P", "R", "T", "W", "X", "x", "r"];
|
|
3
3
|
export declare const reactFlightModelTokens: readonly ["$", "$$", "$@", "$D", "$E", "$F", "$I", "$K", "$L", "$N", "$Q", "$S", "$W", "$Y", "$Z", "$i", "$n", "$u", "$undefined"];
|
|
4
4
|
export type ReactFlightBinaryRowTag = (typeof reactFlightBinaryRowTags)[number];
|
|
5
|
+
/** Lists the React Flight row tags and model tokens recognized by this package. */
|
|
5
6
|
export interface ReactFlightProtocolCoverage {
|
|
6
7
|
binaryRowTags: string[];
|
|
7
8
|
modelTokens: string[];
|
|
8
9
|
rowTags: string[];
|
|
9
10
|
}
|
|
11
|
+
/** Returns the React Flight protocol markers currently covered by the decoder. */
|
|
10
12
|
export declare function getReactFlightProtocolCoverage(): ReactFlightProtocolCoverage;
|
|
11
13
|
//# sourceMappingURL=flight-protocol.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flight-protocol.d.ts","sourceRoot":"","sources":["../src/flight-protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,4EAc3B,CAAC;AAEX,eAAO,MAAM,kBAAkB,sFAgBrB,CAAC;AAEX,eAAO,MAAM,sBAAsB,oIAoBzB,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhF,MAAM,WAAW,2BAA2B;IAC1C,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,wBAAgB,8BAA8B,IAAI,2BAA2B,CAM5E"}
|
|
1
|
+
{"version":3,"file":"flight-protocol.d.ts","sourceRoot":"","sources":["../src/flight-protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,4EAc3B,CAAC;AAEX,eAAO,MAAM,kBAAkB,sFAgBrB,CAAC;AAEX,eAAO,MAAM,sBAAsB,oIAoBzB,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhF,mFAAmF;AACnF,MAAM,WAAW,2BAA2B;IAC1C,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,kFAAkF;AAClF,wBAAgB,8BAA8B,IAAI,2BAA2B,CAM5E"}
|
package/dist/flight-protocol.js
CHANGED
|
@@ -51,6 +51,7 @@ export const reactFlightModelTokens = [
|
|
|
51
51
|
"$u",
|
|
52
52
|
"$undefined",
|
|
53
53
|
];
|
|
54
|
+
/** Returns the React Flight protocol markers currently covered by the decoder. */
|
|
54
55
|
export function getReactFlightProtocolCoverage() {
|
|
55
56
|
return {
|
|
56
57
|
binaryRowTags: [...reactFlightBinaryRowTags],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flight-protocol.js","sourceRoot":"","sources":["../src/flight-protocol.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;CACK,CAAC;AAEX,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;CACK,CAAC;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jC,CAAC;AACJ,CAAC","sourcesContent":["export const reactFlightBinaryRowTags = [\n \"A\",\n \"O\",\n \"o\",\n \"U\",\n \"S\",\n \"s\",\n \"L\",\n \"l\",\n \"G\",\n \"g\",\n \"M\",\n \"m\",\n \"V\",\n] as const;\n\nexport const reactFlightRowTags = [\n \"C\",\n \"D\",\n \"E\",\n \"F\",\n \"H\",\n \"I\",\n \"J\",\n \"N\",\n \"P\",\n \"R\",\n \"T\",\n \"W\",\n \"X\",\n \"x\",\n \"r\",\n] as const;\n\nexport const reactFlightModelTokens = [\n \"$\",\n \"$$\",\n \"$@\",\n \"$D\",\n \"$E\",\n \"$F\",\n \"$I\",\n \"$K\",\n \"$L\",\n \"$N\",\n \"$Q\",\n \"$S\",\n \"$W\",\n \"$Y\",\n \"$Z\",\n \"$i\",\n \"$n\",\n \"$u\",\n \"$undefined\",\n] as const;\n\nexport type ReactFlightBinaryRowTag = (typeof reactFlightBinaryRowTags)[number];\n\n/** Lists the React Flight row tags and model tokens recognized by this package. */\nexport interface ReactFlightProtocolCoverage {\n binaryRowTags: string[];\n modelTokens: string[];\n rowTags: string[];\n}\n\n/** Returns the React Flight protocol markers currently covered by the decoder. */\nexport function getReactFlightProtocolCoverage(): ReactFlightProtocolCoverage {\n return {\n binaryRowTags: [...reactFlightBinaryRowTags],\n modelTokens: [...reactFlightModelTokens],\n rowTags: [...reactFlightRowTags],\n };\n}\n"]}
|
package/dist/flight-types.d.ts
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
|
+
/** Client module reference carried by a Flight response. */
|
|
1
2
|
export interface FlightClientReference {
|
|
2
3
|
id: number;
|
|
3
4
|
moduleId: string;
|
|
4
5
|
exportName: string;
|
|
5
6
|
chunks?: string[];
|
|
6
7
|
}
|
|
8
|
+
/** Server action reference carried by a Flight response. */
|
|
7
9
|
export interface FlightServerReference {
|
|
8
10
|
id: number;
|
|
9
11
|
moduleId: string;
|
|
10
12
|
exportName: string;
|
|
11
13
|
bound?: FlightModel[];
|
|
12
14
|
}
|
|
15
|
+
/** Parsed React Flight response with root model and reference tables. */
|
|
13
16
|
export interface FlightResponse {
|
|
14
17
|
version: 1;
|
|
15
18
|
root: FlightModel;
|
|
16
19
|
clientReferences: FlightClientReference[];
|
|
17
20
|
serverReferences: FlightServerReference[];
|
|
18
21
|
}
|
|
22
|
+
/** Serializable model value supported by the mreact Flight decoder. */
|
|
19
23
|
export type FlightModel = null | string | number | boolean | FlightModel[] | FlightObjectModel | FlightElementModel | FlightClientReferenceModel | FlightServerReferenceModel | FlightDateModel | FlightBigIntModel | FlightNumberModel | FlightSymbolModel | FlightMapModel | FlightSetModel | FlightFormDataModel | FlightIterableModel | FlightErrorModel | FlightPromiseModel | FlightArrayBufferModel | FlightTypedArrayModel | FlightDataViewModel | {
|
|
20
24
|
kind: "undefined";
|
|
21
25
|
};
|
|
@@ -23,6 +27,7 @@ export interface FlightObjectModel {
|
|
|
23
27
|
kind?: never;
|
|
24
28
|
[key: string]: FlightModel | undefined;
|
|
25
29
|
}
|
|
30
|
+
/** Flight model record for a rendered element. */
|
|
26
31
|
export interface FlightElementModel {
|
|
27
32
|
kind: "element";
|
|
28
33
|
type: string | FlightClientReferenceModel | {
|
|
@@ -31,68 +36,84 @@ export interface FlightElementModel {
|
|
|
31
36
|
key: string | null;
|
|
32
37
|
props: Record<string, FlightModel>;
|
|
33
38
|
}
|
|
39
|
+
/** Flight model record that points at a client reference table entry. */
|
|
34
40
|
export interface FlightClientReferenceModel {
|
|
35
41
|
kind: "client-reference";
|
|
36
42
|
id: number;
|
|
37
43
|
}
|
|
44
|
+
/** Flight model record that points at a server reference table entry. */
|
|
38
45
|
export interface FlightServerReferenceModel {
|
|
39
46
|
kind: "server-reference";
|
|
40
47
|
id: number;
|
|
41
48
|
}
|
|
49
|
+
/** Flight model record for a Date value. */
|
|
42
50
|
export interface FlightDateModel {
|
|
43
51
|
kind: "date";
|
|
44
52
|
value: string;
|
|
45
53
|
}
|
|
54
|
+
/** Flight model record for a bigint value. */
|
|
46
55
|
export interface FlightBigIntModel {
|
|
47
56
|
kind: "bigint";
|
|
48
57
|
value: string;
|
|
49
58
|
}
|
|
59
|
+
/** Flight model record for non-finite or negative-zero numbers. */
|
|
50
60
|
export interface FlightNumberModel {
|
|
51
61
|
kind: "number";
|
|
52
62
|
value: "Infinity" | "-Infinity" | "NaN" | "-0";
|
|
53
63
|
}
|
|
64
|
+
/** Flight model record for a global symbol. */
|
|
54
65
|
export interface FlightSymbolModel {
|
|
55
66
|
kind: "symbol";
|
|
56
67
|
name: string;
|
|
57
68
|
}
|
|
69
|
+
/** Flight model record for a Map value. */
|
|
58
70
|
export interface FlightMapModel {
|
|
59
71
|
kind: "map";
|
|
60
72
|
entries: [FlightModel, FlightModel][];
|
|
61
73
|
}
|
|
74
|
+
/** Flight model record for a Set value. */
|
|
62
75
|
export interface FlightSetModel {
|
|
63
76
|
kind: "set";
|
|
64
77
|
values: FlightModel[];
|
|
65
78
|
}
|
|
79
|
+
/** Flight model record for a FormData value. */
|
|
66
80
|
export interface FlightFormDataModel {
|
|
67
81
|
kind: "form-data";
|
|
68
82
|
entries: [string, FlightModel][];
|
|
69
83
|
}
|
|
84
|
+
/** Flight model record for an iterable value encoded as an array. */
|
|
70
85
|
export interface FlightIterableModel {
|
|
71
86
|
kind: "iterable";
|
|
72
87
|
values: FlightModel[];
|
|
73
88
|
}
|
|
89
|
+
/** Flight model record for an error thrown while decoding. */
|
|
74
90
|
export interface FlightErrorModel {
|
|
75
91
|
kind: "error";
|
|
76
92
|
name: string;
|
|
77
93
|
message: string;
|
|
78
94
|
digest?: string;
|
|
79
95
|
}
|
|
96
|
+
/** Flight model record for a pending promise chunk. */
|
|
80
97
|
export interface FlightPromiseModel {
|
|
81
98
|
kind: "promise";
|
|
82
99
|
id: number;
|
|
83
100
|
}
|
|
101
|
+
/** Flight model record for an ArrayBuffer value. */
|
|
84
102
|
export interface FlightArrayBufferModel {
|
|
85
103
|
kind: "array-buffer";
|
|
86
104
|
bytes: number[];
|
|
87
105
|
}
|
|
106
|
+
/** Flight model record for a typed array value. */
|
|
88
107
|
export interface FlightTypedArrayModel {
|
|
89
108
|
kind: "typed-array";
|
|
90
109
|
arrayType: FlightTypedArrayName;
|
|
91
110
|
bytes: number[];
|
|
92
111
|
}
|
|
112
|
+
/** Flight model record for a DataView value. */
|
|
93
113
|
export interface FlightDataViewModel {
|
|
94
114
|
kind: "data-view";
|
|
95
115
|
bytes: number[];
|
|
96
116
|
}
|
|
117
|
+
/** Typed array constructor names supported by the Flight decoder. */
|
|
97
118
|
export type FlightTypedArrayName = "Int8Array" | "Uint8Array" | "Uint8ClampedArray" | "Int16Array" | "Uint16Array" | "Int32Array" | "Uint32Array" | "Float32Array" | "Float64Array" | "BigInt64Array" | "BigUint64Array";
|
|
98
119
|
//# sourceMappingURL=flight-types.d.ts.map
|