Erster Docker-Stand
This commit is contained in:
77
_node_modules/hono/dist/cjs/jsx/dom/client.js
generated
vendored
Normal file
77
_node_modules/hono/dist/cjs/jsx/dom/client.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var client_exports = {};
|
||||
__export(client_exports, {
|
||||
createRoot: () => createRoot,
|
||||
default: () => client_default,
|
||||
hydrateRoot: () => hydrateRoot
|
||||
});
|
||||
module.exports = __toCommonJS(client_exports);
|
||||
var import_hooks = require("../hooks");
|
||||
var import_render = require("./render");
|
||||
const createRoot = (element, options = {}) => {
|
||||
let setJsxNode = (
|
||||
// unmounted
|
||||
void 0
|
||||
);
|
||||
if (Object.keys(options).length > 0) {
|
||||
console.warn("createRoot options are not supported yet");
|
||||
}
|
||||
return {
|
||||
render(jsxNode) {
|
||||
if (setJsxNode === null) {
|
||||
throw new Error("Cannot update an unmounted root");
|
||||
}
|
||||
if (setJsxNode) {
|
||||
setJsxNode(jsxNode);
|
||||
} else {
|
||||
(0, import_render.renderNode)(
|
||||
(0, import_render.buildNode)({
|
||||
tag: () => {
|
||||
const [_jsxNode, _setJsxNode] = (0, import_hooks.useState)(jsxNode);
|
||||
setJsxNode = _setJsxNode;
|
||||
return _jsxNode;
|
||||
},
|
||||
props: {}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
}),
|
||||
element
|
||||
);
|
||||
}
|
||||
},
|
||||
unmount() {
|
||||
setJsxNode?.(null);
|
||||
setJsxNode = null;
|
||||
}
|
||||
};
|
||||
};
|
||||
const hydrateRoot = (element, reactNode, options = {}) => {
|
||||
const root = createRoot(element, options);
|
||||
root.render(reactNode);
|
||||
return root;
|
||||
};
|
||||
var client_default = {
|
||||
createRoot,
|
||||
hydrateRoot
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
createRoot,
|
||||
hydrateRoot
|
||||
});
|
||||
56
_node_modules/hono/dist/cjs/jsx/dom/components.js
generated
vendored
Normal file
56
_node_modules/hono/dist/cjs/jsx/dom/components.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var components_exports = {};
|
||||
__export(components_exports, {
|
||||
ErrorBoundary: () => ErrorBoundary,
|
||||
Suspense: () => Suspense
|
||||
});
|
||||
module.exports = __toCommonJS(components_exports);
|
||||
var import_constants = require("../constants");
|
||||
var import_jsx_runtime = require("./jsx-runtime");
|
||||
const ErrorBoundary = (({ children, fallback, fallbackRender, onError }) => {
|
||||
const res = (0, import_jsx_runtime.Fragment)({ children });
|
||||
res[import_constants.DOM_ERROR_HANDLER] = (err) => {
|
||||
if (err instanceof Promise) {
|
||||
throw err;
|
||||
}
|
||||
onError?.(err);
|
||||
return fallbackRender?.(err) || fallback;
|
||||
};
|
||||
return res;
|
||||
});
|
||||
const Suspense = (({
|
||||
children,
|
||||
fallback
|
||||
}) => {
|
||||
const res = (0, import_jsx_runtime.Fragment)({ children });
|
||||
res[import_constants.DOM_ERROR_HANDLER] = (err, retry) => {
|
||||
if (!(err instanceof Promise)) {
|
||||
throw err;
|
||||
}
|
||||
err.finally(retry);
|
||||
return fallback;
|
||||
};
|
||||
return res;
|
||||
});
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
ErrorBoundary,
|
||||
Suspense
|
||||
});
|
||||
72
_node_modules/hono/dist/cjs/jsx/dom/context.js
generated
vendored
Normal file
72
_node_modules/hono/dist/cjs/jsx/dom/context.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var context_exports = {};
|
||||
__export(context_exports, {
|
||||
createContext: () => createContext,
|
||||
createContextProviderFunction: () => createContextProviderFunction
|
||||
});
|
||||
module.exports = __toCommonJS(context_exports);
|
||||
var import_constants = require("../constants");
|
||||
var import_context = require("../context");
|
||||
var import_utils = require("./utils");
|
||||
const createContextProviderFunction = (values) => ({ value, children }) => {
|
||||
if (!children) {
|
||||
return void 0;
|
||||
}
|
||||
const props = {
|
||||
children: [
|
||||
{
|
||||
tag: (0, import_utils.setInternalTagFlag)(() => {
|
||||
values.push(value);
|
||||
}),
|
||||
props: {}
|
||||
}
|
||||
]
|
||||
};
|
||||
if (Array.isArray(children)) {
|
||||
props.children.push(...children.flat());
|
||||
} else {
|
||||
props.children.push(children);
|
||||
}
|
||||
props.children.push({
|
||||
tag: (0, import_utils.setInternalTagFlag)(() => {
|
||||
values.pop();
|
||||
}),
|
||||
props: {}
|
||||
});
|
||||
const res = { tag: "", props, type: "" };
|
||||
res[import_constants.DOM_ERROR_HANDLER] = (err) => {
|
||||
values.pop();
|
||||
throw err;
|
||||
};
|
||||
return res;
|
||||
};
|
||||
const createContext = (defaultValue) => {
|
||||
const values = [defaultValue];
|
||||
const context = createContextProviderFunction(values);
|
||||
context.values = values;
|
||||
context.Provider = context;
|
||||
import_context.globalContexts.push(context);
|
||||
return context;
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
createContext,
|
||||
createContextProviderFunction
|
||||
});
|
||||
162
_node_modules/hono/dist/cjs/jsx/dom/css.js
generated
vendored
Normal file
162
_node_modules/hono/dist/cjs/jsx/dom/css.js
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var css_exports = {};
|
||||
__export(css_exports, {
|
||||
Style: () => Style,
|
||||
createCssContext: () => createCssContext,
|
||||
createCssJsxDomObjects: () => createCssJsxDomObjects,
|
||||
css: () => css,
|
||||
cx: () => cx,
|
||||
keyframes: () => keyframes,
|
||||
rawCssString: () => import_common2.rawCssString,
|
||||
viewTransition: () => viewTransition
|
||||
});
|
||||
module.exports = __toCommonJS(css_exports);
|
||||
var import_common = require("../../helper/css/common");
|
||||
var import_common2 = require("../../helper/css/common");
|
||||
const splitRule = (rule) => {
|
||||
const result = [];
|
||||
let startPos = 0;
|
||||
let depth = 0;
|
||||
for (let i = 0, len = rule.length; i < len; i++) {
|
||||
const char = rule[i];
|
||||
if (char === "'" || char === '"') {
|
||||
const quote = char;
|
||||
i++;
|
||||
for (; i < len; i++) {
|
||||
if (rule[i] === "\\") {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (rule[i] === quote) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (char === "{") {
|
||||
depth++;
|
||||
continue;
|
||||
}
|
||||
if (char === "}") {
|
||||
depth--;
|
||||
if (depth === 0) {
|
||||
result.push(rule.slice(startPos, i + 1));
|
||||
startPos = i + 1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
const createCssJsxDomObjects = ({ id }) => {
|
||||
let styleSheet = void 0;
|
||||
const findStyleSheet = () => {
|
||||
if (!styleSheet) {
|
||||
styleSheet = document.querySelector(`style#${id}`)?.sheet;
|
||||
if (styleSheet) {
|
||||
;
|
||||
styleSheet.addedStyles = /* @__PURE__ */ new Set();
|
||||
}
|
||||
}
|
||||
return styleSheet ? [styleSheet, styleSheet.addedStyles] : [];
|
||||
};
|
||||
const insertRule = (className, styleString) => {
|
||||
const [sheet, addedStyles] = findStyleSheet();
|
||||
if (!sheet || !addedStyles) {
|
||||
Promise.resolve().then(() => {
|
||||
if (!findStyleSheet()[0]) {
|
||||
throw new Error("style sheet not found");
|
||||
}
|
||||
insertRule(className, styleString);
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!addedStyles.has(className)) {
|
||||
addedStyles.add(className);
|
||||
(className.startsWith(import_common.PSEUDO_GLOBAL_SELECTOR) ? splitRule(styleString) : [`${className[0] === "@" ? "" : "."}${className}{${styleString}}`]).forEach((rule) => {
|
||||
sheet.insertRule(rule, sheet.cssRules.length);
|
||||
});
|
||||
}
|
||||
};
|
||||
const cssObject = {
|
||||
toString() {
|
||||
const selector = this[import_common.SELECTOR];
|
||||
insertRule(selector, this[import_common.STYLE_STRING]);
|
||||
this[import_common.SELECTORS].forEach(({ [import_common.CLASS_NAME]: className, [import_common.STYLE_STRING]: styleString }) => {
|
||||
insertRule(className, styleString);
|
||||
});
|
||||
return this[import_common.CLASS_NAME];
|
||||
}
|
||||
};
|
||||
const Style2 = ({ children, nonce }) => ({
|
||||
tag: "style",
|
||||
props: {
|
||||
id,
|
||||
nonce,
|
||||
children: children && (Array.isArray(children) ? children : [children]).map(
|
||||
(c) => c[import_common.STYLE_STRING]
|
||||
)
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
});
|
||||
return [cssObject, Style2];
|
||||
};
|
||||
const createCssContext = ({ id }) => {
|
||||
const [cssObject, Style2] = createCssJsxDomObjects({ id });
|
||||
const newCssClassNameObject = (cssClassName) => {
|
||||
cssClassName.toString = cssObject.toString;
|
||||
return cssClassName;
|
||||
};
|
||||
const css2 = (strings, ...values) => {
|
||||
return newCssClassNameObject((0, import_common.cssCommon)(strings, values));
|
||||
};
|
||||
const cx2 = (...args) => {
|
||||
args = (0, import_common.cxCommon)(args);
|
||||
return css2(Array(args.length).fill(""), ...args);
|
||||
};
|
||||
const keyframes2 = import_common.keyframesCommon;
|
||||
const viewTransition2 = ((strings, ...values) => {
|
||||
return newCssClassNameObject((0, import_common.viewTransitionCommon)(strings, values));
|
||||
});
|
||||
return {
|
||||
css: css2,
|
||||
cx: cx2,
|
||||
keyframes: keyframes2,
|
||||
viewTransition: viewTransition2,
|
||||
Style: Style2
|
||||
};
|
||||
};
|
||||
const defaultContext = createCssContext({ id: import_common.DEFAULT_STYLE_ID });
|
||||
const css = defaultContext.css;
|
||||
const cx = defaultContext.cx;
|
||||
const keyframes = defaultContext.keyframes;
|
||||
const viewTransition = defaultContext.viewTransition;
|
||||
const Style = defaultContext.Style;
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
Style,
|
||||
createCssContext,
|
||||
createCssJsxDomObjects,
|
||||
css,
|
||||
cx,
|
||||
keyframes,
|
||||
rawCssString,
|
||||
viewTransition
|
||||
});
|
||||
75
_node_modules/hono/dist/cjs/jsx/dom/hooks/index.js
generated
vendored
Normal file
75
_node_modules/hono/dist/cjs/jsx/dom/hooks/index.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var hooks_exports = {};
|
||||
__export(hooks_exports, {
|
||||
FormContext: () => FormContext,
|
||||
registerAction: () => registerAction,
|
||||
useActionState: () => useActionState,
|
||||
useFormStatus: () => useFormStatus,
|
||||
useOptimistic: () => useOptimistic
|
||||
});
|
||||
module.exports = __toCommonJS(hooks_exports);
|
||||
var import_constants = require("../../constants");
|
||||
var import_context = require("../../context");
|
||||
var import_hooks = require("../../hooks");
|
||||
var import_context2 = require("../context");
|
||||
const FormContext = (0, import_context2.createContext)({
|
||||
pending: false,
|
||||
data: null,
|
||||
method: null,
|
||||
action: null
|
||||
});
|
||||
const actions = /* @__PURE__ */ new Set();
|
||||
const registerAction = (action) => {
|
||||
actions.add(action);
|
||||
action.finally(() => actions.delete(action));
|
||||
};
|
||||
const useFormStatus = () => {
|
||||
return (0, import_context.useContext)(FormContext);
|
||||
};
|
||||
const useOptimistic = (state, updateState) => {
|
||||
const [optimisticState, setOptimisticState] = (0, import_hooks.useState)(state);
|
||||
if (actions.size > 0) {
|
||||
Promise.all(actions).finally(() => {
|
||||
setOptimisticState(state);
|
||||
});
|
||||
} else {
|
||||
setOptimisticState(state);
|
||||
}
|
||||
const cb = (0, import_hooks.useCallback)((newData) => {
|
||||
setOptimisticState((currentState) => updateState(currentState, newData));
|
||||
}, []);
|
||||
return [optimisticState, cb];
|
||||
};
|
||||
const useActionState = (fn, initialState, permalink) => {
|
||||
const [state, setState] = (0, import_hooks.useState)(initialState);
|
||||
const actionState = async (data) => {
|
||||
setState(await fn(state, data));
|
||||
};
|
||||
actionState[import_constants.PERMALINK] = permalink;
|
||||
return [state, actionState];
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
FormContext,
|
||||
registerAction,
|
||||
useActionState,
|
||||
useFormStatus,
|
||||
useOptimistic
|
||||
});
|
||||
182
_node_modules/hono/dist/cjs/jsx/dom/index.js
generated
vendored
Normal file
182
_node_modules/hono/dist/cjs/jsx/dom/index.js
generated
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var dom_exports = {};
|
||||
__export(dom_exports, {
|
||||
Children: () => import_children.Children,
|
||||
ErrorBoundary: () => import_components.ErrorBoundary,
|
||||
Fragment: () => import_jsx_runtime.Fragment,
|
||||
StrictMode: () => import_jsx_runtime.Fragment,
|
||||
Suspense: () => import_components.Suspense,
|
||||
cloneElement: () => cloneElement,
|
||||
createContext: () => import_context2.createContext,
|
||||
createElement: () => createElement,
|
||||
createPortal: () => import_render.createPortal,
|
||||
createRef: () => import_hooks.createRef,
|
||||
default: () => dom_default,
|
||||
flushSync: () => import_render.flushSync,
|
||||
forwardRef: () => import_hooks.forwardRef,
|
||||
isValidElement: () => import_base.isValidElement,
|
||||
jsx: () => createElement,
|
||||
memo: () => memo,
|
||||
render: () => import_render2.render,
|
||||
startTransition: () => import_hooks.startTransition,
|
||||
startViewTransition: () => import_hooks.startViewTransition,
|
||||
use: () => import_hooks.use,
|
||||
useActionState: () => import_hooks2.useActionState,
|
||||
useCallback: () => import_hooks.useCallback,
|
||||
useContext: () => import_context.useContext,
|
||||
useDebugValue: () => import_hooks.useDebugValue,
|
||||
useDeferredValue: () => import_hooks.useDeferredValue,
|
||||
useEffect: () => import_hooks.useEffect,
|
||||
useFormStatus: () => import_hooks2.useFormStatus,
|
||||
useId: () => import_hooks.useId,
|
||||
useImperativeHandle: () => import_hooks.useImperativeHandle,
|
||||
useInsertionEffect: () => import_hooks.useInsertionEffect,
|
||||
useLayoutEffect: () => import_hooks.useLayoutEffect,
|
||||
useMemo: () => import_hooks.useMemo,
|
||||
useOptimistic: () => import_hooks2.useOptimistic,
|
||||
useReducer: () => import_hooks.useReducer,
|
||||
useRef: () => import_hooks.useRef,
|
||||
useState: () => import_hooks.useState,
|
||||
useSyncExternalStore: () => import_hooks.useSyncExternalStore,
|
||||
useTransition: () => import_hooks.useTransition,
|
||||
useViewTransition: () => import_hooks.useViewTransition,
|
||||
version: () => import_base.reactAPICompatVersion
|
||||
});
|
||||
module.exports = __toCommonJS(dom_exports);
|
||||
var import_base = require("../base");
|
||||
var import_children = require("../children");
|
||||
var import_constants = require("../constants");
|
||||
var import_context = require("../context");
|
||||
var import_hooks = require("../hooks");
|
||||
var import_components = require("./components");
|
||||
var import_context2 = require("./context");
|
||||
var import_hooks2 = require("./hooks");
|
||||
var import_jsx_runtime = require("./jsx-runtime");
|
||||
var import_render = require("./render");
|
||||
var import_render2 = require("./render");
|
||||
const createElement = (tag, props, ...children) => {
|
||||
const jsxProps = props ? { ...props } : {};
|
||||
if (children.length) {
|
||||
jsxProps.children = children.length === 1 ? children[0] : children;
|
||||
}
|
||||
let key = void 0;
|
||||
if ("key" in jsxProps) {
|
||||
key = jsxProps.key;
|
||||
delete jsxProps.key;
|
||||
}
|
||||
return (0, import_jsx_runtime.jsx)(tag, jsxProps, key);
|
||||
};
|
||||
const cloneElement = (element, props, ...children) => {
|
||||
return (0, import_jsx_runtime.jsx)(
|
||||
element.tag,
|
||||
{
|
||||
...element.props,
|
||||
...props,
|
||||
children: children.length ? children : element.props.children
|
||||
},
|
||||
element.key
|
||||
);
|
||||
};
|
||||
const memo = (component, propsAreEqual = import_base.shallowEqual) => {
|
||||
const wrapper = ((props) => component(props));
|
||||
wrapper[import_constants.DOM_MEMO] = propsAreEqual;
|
||||
return wrapper;
|
||||
};
|
||||
var dom_default = {
|
||||
version: import_base.reactAPICompatVersion,
|
||||
useState: import_hooks.useState,
|
||||
useEffect: import_hooks.useEffect,
|
||||
useRef: import_hooks.useRef,
|
||||
useCallback: import_hooks.useCallback,
|
||||
use: import_hooks.use,
|
||||
startTransition: import_hooks.startTransition,
|
||||
useTransition: import_hooks.useTransition,
|
||||
useDeferredValue: import_hooks.useDeferredValue,
|
||||
startViewTransition: import_hooks.startViewTransition,
|
||||
useViewTransition: import_hooks.useViewTransition,
|
||||
useMemo: import_hooks.useMemo,
|
||||
useLayoutEffect: import_hooks.useLayoutEffect,
|
||||
useInsertionEffect: import_hooks.useInsertionEffect,
|
||||
useReducer: import_hooks.useReducer,
|
||||
useId: import_hooks.useId,
|
||||
useDebugValue: import_hooks.useDebugValue,
|
||||
createRef: import_hooks.createRef,
|
||||
forwardRef: import_hooks.forwardRef,
|
||||
useImperativeHandle: import_hooks.useImperativeHandle,
|
||||
useSyncExternalStore: import_hooks.useSyncExternalStore,
|
||||
useFormStatus: import_hooks2.useFormStatus,
|
||||
useActionState: import_hooks2.useActionState,
|
||||
useOptimistic: import_hooks2.useOptimistic,
|
||||
Suspense: import_components.Suspense,
|
||||
ErrorBoundary: import_components.ErrorBoundary,
|
||||
createContext: import_context2.createContext,
|
||||
useContext: import_context.useContext,
|
||||
memo,
|
||||
isValidElement: import_base.isValidElement,
|
||||
createElement,
|
||||
cloneElement,
|
||||
Children: import_children.Children,
|
||||
Fragment: import_jsx_runtime.Fragment,
|
||||
StrictMode: import_jsx_runtime.Fragment,
|
||||
flushSync: import_render.flushSync,
|
||||
createPortal: import_render.createPortal
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
Children,
|
||||
ErrorBoundary,
|
||||
Fragment,
|
||||
StrictMode,
|
||||
Suspense,
|
||||
cloneElement,
|
||||
createContext,
|
||||
createElement,
|
||||
createPortal,
|
||||
createRef,
|
||||
flushSync,
|
||||
forwardRef,
|
||||
isValidElement,
|
||||
jsx,
|
||||
memo,
|
||||
render,
|
||||
startTransition,
|
||||
startViewTransition,
|
||||
use,
|
||||
useActionState,
|
||||
useCallback,
|
||||
useContext,
|
||||
useDebugValue,
|
||||
useDeferredValue,
|
||||
useEffect,
|
||||
useFormStatus,
|
||||
useId,
|
||||
useImperativeHandle,
|
||||
useInsertionEffect,
|
||||
useLayoutEffect,
|
||||
useMemo,
|
||||
useOptimistic,
|
||||
useReducer,
|
||||
useRef,
|
||||
useState,
|
||||
useSyncExternalStore,
|
||||
useTransition,
|
||||
useViewTransition,
|
||||
version
|
||||
});
|
||||
369
_node_modules/hono/dist/cjs/jsx/dom/intrinsic-element/components.js
generated
vendored
Normal file
369
_node_modules/hono/dist/cjs/jsx/dom/intrinsic-element/components.js
generated
vendored
Normal file
@@ -0,0 +1,369 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var components_exports = {};
|
||||
__export(components_exports, {
|
||||
button: () => button,
|
||||
clearCache: () => clearCache,
|
||||
composeRef: () => composeRef,
|
||||
form: () => form,
|
||||
input: () => input,
|
||||
link: () => link,
|
||||
meta: () => meta,
|
||||
script: () => script,
|
||||
style: () => style,
|
||||
title: () => title
|
||||
});
|
||||
module.exports = __toCommonJS(components_exports);
|
||||
var import_context = require("../../context");
|
||||
var import_hooks = require("../../hooks");
|
||||
var import_common = require("../../intrinsic-element/common");
|
||||
var import_hooks2 = require("../hooks");
|
||||
var import_render = require("../render");
|
||||
const clearCache = () => {
|
||||
blockingPromiseMap = /* @__PURE__ */ Object.create(null);
|
||||
createdElements = /* @__PURE__ */ Object.create(null);
|
||||
};
|
||||
const composeRef = (ref, cb) => {
|
||||
return (0, import_hooks.useMemo)(
|
||||
() => (e) => {
|
||||
let refCleanup;
|
||||
if (ref) {
|
||||
if (typeof ref === "function") {
|
||||
refCleanup = ref(e) || (() => {
|
||||
ref(null);
|
||||
});
|
||||
} else if (ref && "current" in ref) {
|
||||
ref.current = e;
|
||||
refCleanup = () => {
|
||||
ref.current = null;
|
||||
};
|
||||
}
|
||||
}
|
||||
const cbCleanup = cb(e);
|
||||
return () => {
|
||||
cbCleanup?.();
|
||||
refCleanup?.();
|
||||
};
|
||||
},
|
||||
[ref]
|
||||
);
|
||||
};
|
||||
let blockingPromiseMap = /* @__PURE__ */ Object.create(null);
|
||||
let createdElements = /* @__PURE__ */ Object.create(null);
|
||||
const documentMetadataTag = (tag, props, preserveNodeType, supportSort, supportBlocking) => {
|
||||
if (props?.itemProp) {
|
||||
return {
|
||||
tag,
|
||||
props,
|
||||
type: tag,
|
||||
ref: props.ref
|
||||
};
|
||||
}
|
||||
const head = document.head;
|
||||
let { onLoad, onError, precedence, blocking, ...restProps } = props;
|
||||
let element = null;
|
||||
let created = false;
|
||||
const deDupeKeys = import_common.deDupeKeyMap[tag];
|
||||
let existingElements = void 0;
|
||||
if (deDupeKeys.length > 0) {
|
||||
const tags = head.querySelectorAll(tag);
|
||||
LOOP: for (const e of tags) {
|
||||
for (const key of import_common.deDupeKeyMap[tag]) {
|
||||
if (e.getAttribute(key) === props[key]) {
|
||||
element = e;
|
||||
break LOOP;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!element) {
|
||||
const cacheKey = deDupeKeys.reduce(
|
||||
(acc, key) => props[key] === void 0 ? acc : `${acc}-${key}-${props[key]}`,
|
||||
tag
|
||||
);
|
||||
created = !createdElements[cacheKey];
|
||||
element = createdElements[cacheKey] ||= (() => {
|
||||
const e = document.createElement(tag);
|
||||
for (const key of deDupeKeys) {
|
||||
if (props[key] !== void 0) {
|
||||
e.setAttribute(key, props[key]);
|
||||
}
|
||||
if (props.rel) {
|
||||
e.setAttribute("rel", props.rel);
|
||||
}
|
||||
}
|
||||
return e;
|
||||
})();
|
||||
}
|
||||
} else {
|
||||
existingElements = head.querySelectorAll(tag);
|
||||
}
|
||||
precedence = supportSort ? precedence ?? "" : void 0;
|
||||
if (supportSort) {
|
||||
restProps[import_common.dataPrecedenceAttr] = precedence;
|
||||
}
|
||||
const insert = (0, import_hooks.useCallback)(
|
||||
(e) => {
|
||||
if (deDupeKeys.length > 0) {
|
||||
let found = false;
|
||||
for (const existingElement of head.querySelectorAll(tag)) {
|
||||
if (found && existingElement.getAttribute(import_common.dataPrecedenceAttr) !== precedence) {
|
||||
head.insertBefore(e, existingElement);
|
||||
return;
|
||||
}
|
||||
if (existingElement.getAttribute(import_common.dataPrecedenceAttr) === precedence) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
head.appendChild(e);
|
||||
} else if (existingElements) {
|
||||
let found = false;
|
||||
for (const existingElement of existingElements) {
|
||||
if (existingElement === e) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
head.insertBefore(
|
||||
e,
|
||||
head.contains(existingElements[0]) ? existingElements[0] : head.querySelector(tag)
|
||||
);
|
||||
}
|
||||
existingElements = void 0;
|
||||
}
|
||||
},
|
||||
[precedence]
|
||||
);
|
||||
const ref = composeRef(props.ref, (e) => {
|
||||
const key = deDupeKeys[0];
|
||||
if (preserveNodeType === 2) {
|
||||
e.innerHTML = "";
|
||||
}
|
||||
if (created || existingElements) {
|
||||
insert(e);
|
||||
}
|
||||
if (!onError && !onLoad) {
|
||||
return;
|
||||
}
|
||||
let promise = blockingPromiseMap[e.getAttribute(key)] ||= new Promise(
|
||||
(resolve, reject) => {
|
||||
e.addEventListener("load", resolve);
|
||||
e.addEventListener("error", reject);
|
||||
}
|
||||
);
|
||||
if (onLoad) {
|
||||
promise = promise.then(onLoad);
|
||||
}
|
||||
if (onError) {
|
||||
promise = promise.catch(onError);
|
||||
}
|
||||
promise.catch(() => {
|
||||
});
|
||||
});
|
||||
if (supportBlocking && blocking === "render") {
|
||||
const key = import_common.deDupeKeyMap[tag][0];
|
||||
if (props[key]) {
|
||||
const value = props[key];
|
||||
const promise = blockingPromiseMap[value] ||= new Promise((resolve, reject) => {
|
||||
insert(element);
|
||||
element.addEventListener("load", resolve);
|
||||
element.addEventListener("error", reject);
|
||||
});
|
||||
(0, import_hooks.use)(promise);
|
||||
}
|
||||
}
|
||||
const jsxNode = {
|
||||
tag,
|
||||
type: tag,
|
||||
props: {
|
||||
...restProps,
|
||||
ref
|
||||
},
|
||||
ref
|
||||
};
|
||||
jsxNode.p = preserveNodeType;
|
||||
if (element) {
|
||||
jsxNode.e = element;
|
||||
}
|
||||
return (0, import_render.createPortal)(
|
||||
jsxNode,
|
||||
head
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
);
|
||||
};
|
||||
const title = (props) => {
|
||||
const nameSpaceContext = (0, import_render.getNameSpaceContext)();
|
||||
const ns = nameSpaceContext && (0, import_context.useContext)(nameSpaceContext);
|
||||
if (ns?.endsWith("svg")) {
|
||||
return {
|
||||
tag: "title",
|
||||
props,
|
||||
type: "title",
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
ref: props.ref
|
||||
};
|
||||
}
|
||||
return documentMetadataTag("title", props, void 0, false, false);
|
||||
};
|
||||
const script = (props) => {
|
||||
if (!props || ["src", "async"].some((k) => !props[k])) {
|
||||
return {
|
||||
tag: "script",
|
||||
props,
|
||||
type: "script",
|
||||
ref: props.ref
|
||||
};
|
||||
}
|
||||
return documentMetadataTag("script", props, 1, false, true);
|
||||
};
|
||||
const style = (props) => {
|
||||
if (!props || !["href", "precedence"].every((k) => k in props)) {
|
||||
return {
|
||||
tag: "style",
|
||||
props,
|
||||
type: "style",
|
||||
ref: props.ref
|
||||
};
|
||||
}
|
||||
props["data-href"] = props.href;
|
||||
delete props.href;
|
||||
return documentMetadataTag("style", props, 2, true, true);
|
||||
};
|
||||
const link = (props) => {
|
||||
if (!props || ["onLoad", "onError"].some((k) => k in props) || props.rel === "stylesheet" && (!("precedence" in props) || "disabled" in props)) {
|
||||
return {
|
||||
tag: "link",
|
||||
props,
|
||||
type: "link",
|
||||
ref: props.ref
|
||||
};
|
||||
}
|
||||
return documentMetadataTag("link", props, 1, "precedence" in props, true);
|
||||
};
|
||||
const meta = (props) => {
|
||||
return documentMetadataTag("meta", props, void 0, false, false);
|
||||
};
|
||||
const customEventFormAction = /* @__PURE__ */ Symbol();
|
||||
const form = (props) => {
|
||||
const { action, ...restProps } = props;
|
||||
if (typeof action !== "function") {
|
||||
;
|
||||
restProps.action = action;
|
||||
}
|
||||
const [state, setState] = (0, import_hooks.useState)([null, false]);
|
||||
const onSubmit = (0, import_hooks.useCallback)(
|
||||
async (ev) => {
|
||||
const currentAction = ev.isTrusted ? action : ev.detail[customEventFormAction];
|
||||
if (typeof currentAction !== "function") {
|
||||
return;
|
||||
}
|
||||
ev.preventDefault();
|
||||
const formData = new FormData(ev.target);
|
||||
setState([formData, true]);
|
||||
const actionRes = currentAction(formData);
|
||||
if (actionRes instanceof Promise) {
|
||||
(0, import_hooks2.registerAction)(actionRes);
|
||||
await actionRes;
|
||||
}
|
||||
setState([null, true]);
|
||||
},
|
||||
[]
|
||||
);
|
||||
const ref = composeRef(props.ref, (el) => {
|
||||
el.addEventListener("submit", onSubmit);
|
||||
return () => {
|
||||
el.removeEventListener("submit", onSubmit);
|
||||
};
|
||||
});
|
||||
const [data, isDirty] = state;
|
||||
state[1] = false;
|
||||
return {
|
||||
tag: import_hooks2.FormContext,
|
||||
props: {
|
||||
value: {
|
||||
pending: data !== null,
|
||||
data,
|
||||
method: data ? "post" : null,
|
||||
action: data ? action : null
|
||||
},
|
||||
children: {
|
||||
tag: "form",
|
||||
props: {
|
||||
...restProps,
|
||||
ref
|
||||
},
|
||||
type: "form",
|
||||
ref
|
||||
}
|
||||
},
|
||||
f: isDirty
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
};
|
||||
};
|
||||
const formActionableElement = (tag, {
|
||||
formAction,
|
||||
...props
|
||||
}) => {
|
||||
if (typeof formAction === "function") {
|
||||
const onClick = (0, import_hooks.useCallback)((ev) => {
|
||||
ev.preventDefault();
|
||||
ev.currentTarget.form.dispatchEvent(
|
||||
new CustomEvent("submit", { detail: { [customEventFormAction]: formAction } })
|
||||
);
|
||||
}, []);
|
||||
props.ref = composeRef(props.ref, (el) => {
|
||||
el.addEventListener("click", onClick);
|
||||
return () => {
|
||||
el.removeEventListener("click", onClick);
|
||||
};
|
||||
});
|
||||
}
|
||||
return {
|
||||
tag,
|
||||
props,
|
||||
type: tag,
|
||||
ref: props.ref
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
};
|
||||
};
|
||||
const input = (props) => formActionableElement("input", props);
|
||||
const button = (props) => formActionableElement("button", props);
|
||||
Object.assign(import_common.domRenderers, {
|
||||
title,
|
||||
script,
|
||||
style,
|
||||
link,
|
||||
meta,
|
||||
form,
|
||||
input,
|
||||
button
|
||||
});
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
button,
|
||||
clearCache,
|
||||
composeRef,
|
||||
form,
|
||||
input,
|
||||
link,
|
||||
meta,
|
||||
script,
|
||||
style,
|
||||
title
|
||||
});
|
||||
53
_node_modules/hono/dist/cjs/jsx/dom/jsx-dev-runtime.js
generated
vendored
Normal file
53
_node_modules/hono/dist/cjs/jsx/dom/jsx-dev-runtime.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var jsx_dev_runtime_exports = {};
|
||||
__export(jsx_dev_runtime_exports, {
|
||||
Fragment: () => Fragment,
|
||||
jsxDEV: () => jsxDEV
|
||||
});
|
||||
module.exports = __toCommonJS(jsx_dev_runtime_exports);
|
||||
var intrinsicElementTags = __toESM(require("./intrinsic-element/components"), 1);
|
||||
const jsxDEV = (tag, props, key) => {
|
||||
if (typeof tag === "string" && intrinsicElementTags[tag]) {
|
||||
tag = intrinsicElementTags[tag];
|
||||
}
|
||||
return {
|
||||
tag,
|
||||
type: tag,
|
||||
props,
|
||||
key,
|
||||
ref: props.ref
|
||||
};
|
||||
};
|
||||
const Fragment = (props) => jsxDEV("", props, void 0);
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
Fragment,
|
||||
jsxDEV
|
||||
});
|
||||
33
_node_modules/hono/dist/cjs/jsx/dom/jsx-runtime.js
generated
vendored
Normal file
33
_node_modules/hono/dist/cjs/jsx/dom/jsx-runtime.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var jsx_runtime_exports = {};
|
||||
__export(jsx_runtime_exports, {
|
||||
Fragment: () => import_jsx_dev_runtime.Fragment,
|
||||
jsx: () => import_jsx_dev_runtime.jsxDEV,
|
||||
jsxs: () => import_jsx_dev_runtime2.jsxDEV
|
||||
});
|
||||
module.exports = __toCommonJS(jsx_runtime_exports);
|
||||
var import_jsx_dev_runtime = require("./jsx-dev-runtime");
|
||||
var import_jsx_dev_runtime2 = require("./jsx-dev-runtime");
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
Fragment,
|
||||
jsx,
|
||||
jsxs
|
||||
});
|
||||
622
_node_modules/hono/dist/cjs/jsx/dom/render.js
generated
vendored
Normal file
622
_node_modules/hono/dist/cjs/jsx/dom/render.js
generated
vendored
Normal file
@@ -0,0 +1,622 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var render_exports = {};
|
||||
__export(render_exports, {
|
||||
build: () => build,
|
||||
buildDataStack: () => buildDataStack,
|
||||
buildNode: () => buildNode,
|
||||
createPortal: () => createPortal,
|
||||
flushSync: () => flushSync,
|
||||
getNameSpaceContext: () => getNameSpaceContext,
|
||||
render: () => render,
|
||||
renderNode: () => renderNode,
|
||||
update: () => update
|
||||
});
|
||||
module.exports = __toCommonJS(render_exports);
|
||||
var import_children = require("../children");
|
||||
var import_constants = require("../constants");
|
||||
var import_context = require("../context");
|
||||
var import_hooks = require("../hooks");
|
||||
var import_utils = require("../utils");
|
||||
var import_context2 = require("./context");
|
||||
const HONO_PORTAL_ELEMENT = "_hp";
|
||||
const eventAliasMap = {
|
||||
Change: "Input",
|
||||
DoubleClick: "DblClick"
|
||||
};
|
||||
const nameSpaceMap = {
|
||||
svg: "2000/svg",
|
||||
math: "1998/Math/MathML"
|
||||
};
|
||||
const buildDataStack = [];
|
||||
const refCleanupMap = /* @__PURE__ */ new WeakMap();
|
||||
let nameSpaceContext = void 0;
|
||||
const getNameSpaceContext = () => nameSpaceContext;
|
||||
const isNodeString = (node) => "t" in node;
|
||||
const eventCache = {
|
||||
// pre-define events that are used very frequently
|
||||
onClick: ["click", false]
|
||||
};
|
||||
const getEventSpec = (key) => {
|
||||
if (!key.startsWith("on")) {
|
||||
return void 0;
|
||||
}
|
||||
if (eventCache[key]) {
|
||||
return eventCache[key];
|
||||
}
|
||||
const match = key.match(/^on([A-Z][a-zA-Z]+?(?:PointerCapture)?)(Capture)?$/);
|
||||
if (match) {
|
||||
const [, eventName, capture] = match;
|
||||
return eventCache[key] = [(eventAliasMap[eventName] || eventName).toLowerCase(), !!capture];
|
||||
}
|
||||
return void 0;
|
||||
};
|
||||
const toAttributeName = (element, key) => nameSpaceContext && element instanceof SVGElement && /[A-Z]/.test(key) && (key in element.style || // Presentation attributes are findable in style object. "clip-path", "font-size", "stroke-width", etc.
|
||||
key.match(/^(?:o|pai|str|u|ve)/)) ? key.replace(/([A-Z])/g, "-$1").toLowerCase() : key;
|
||||
const applyProps = (container, attributes, oldAttributes) => {
|
||||
attributes ||= {};
|
||||
for (let key in attributes) {
|
||||
const value = attributes[key];
|
||||
if (key !== "children" && (!oldAttributes || oldAttributes[key] !== value)) {
|
||||
key = (0, import_utils.normalizeIntrinsicElementKey)(key);
|
||||
const eventSpec = getEventSpec(key);
|
||||
if (eventSpec) {
|
||||
if (oldAttributes?.[key] !== value) {
|
||||
if (oldAttributes) {
|
||||
container.removeEventListener(eventSpec[0], oldAttributes[key], eventSpec[1]);
|
||||
}
|
||||
if (value != null) {
|
||||
if (typeof value !== "function") {
|
||||
throw new Error(`Event handler for "${key}" is not a function`);
|
||||
}
|
||||
container.addEventListener(eventSpec[0], value, eventSpec[1]);
|
||||
}
|
||||
}
|
||||
} else if (key === "dangerouslySetInnerHTML" && value) {
|
||||
container.innerHTML = value.__html;
|
||||
} else if (key === "ref") {
|
||||
let cleanup;
|
||||
if (typeof value === "function") {
|
||||
cleanup = value(container) || (() => value(null));
|
||||
} else if (value && "current" in value) {
|
||||
value.current = container;
|
||||
cleanup = () => value.current = null;
|
||||
}
|
||||
refCleanupMap.set(container, cleanup);
|
||||
} else if (key === "style") {
|
||||
const style = container.style;
|
||||
if (typeof value === "string") {
|
||||
style.cssText = value;
|
||||
} else {
|
||||
style.cssText = "";
|
||||
if (value != null) {
|
||||
(0, import_utils.styleObjectForEach)(value, style.setProperty.bind(style));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (key === "value") {
|
||||
const nodeName = container.nodeName;
|
||||
if (nodeName === "INPUT" || nodeName === "TEXTAREA" || nodeName === "SELECT") {
|
||||
;
|
||||
container.value = value === null || value === void 0 || value === false ? null : value;
|
||||
if (nodeName === "TEXTAREA") {
|
||||
container.textContent = value;
|
||||
continue;
|
||||
} else if (nodeName === "SELECT") {
|
||||
if (container.selectedIndex === -1) {
|
||||
;
|
||||
container.selectedIndex = 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else if (key === "checked" && container.nodeName === "INPUT" || key === "selected" && container.nodeName === "OPTION") {
|
||||
;
|
||||
container[key] = value;
|
||||
}
|
||||
const k = toAttributeName(container, key);
|
||||
if (value === null || value === void 0 || value === false) {
|
||||
container.removeAttribute(k);
|
||||
} else if (value === true) {
|
||||
container.setAttribute(k, "");
|
||||
} else if (typeof value === "string" || typeof value === "number") {
|
||||
container.setAttribute(k, value);
|
||||
} else {
|
||||
container.setAttribute(k, value.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (oldAttributes) {
|
||||
for (let key in oldAttributes) {
|
||||
const value = oldAttributes[key];
|
||||
if (key !== "children" && !(key in attributes)) {
|
||||
key = (0, import_utils.normalizeIntrinsicElementKey)(key);
|
||||
const eventSpec = getEventSpec(key);
|
||||
if (eventSpec) {
|
||||
container.removeEventListener(eventSpec[0], value, eventSpec[1]);
|
||||
} else if (key === "ref") {
|
||||
refCleanupMap.get(container)?.();
|
||||
} else {
|
||||
container.removeAttribute(toAttributeName(container, key));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
const invokeTag = (context, node) => {
|
||||
node[import_constants.DOM_STASH][0] = 0;
|
||||
buildDataStack.push([context, node]);
|
||||
const func = node.tag[import_constants.DOM_RENDERER] || node.tag;
|
||||
const props = func.defaultProps ? {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
...func.defaultProps,
|
||||
...node.props
|
||||
} : node.props;
|
||||
try {
|
||||
return [func.call(null, props)];
|
||||
} finally {
|
||||
buildDataStack.pop();
|
||||
}
|
||||
};
|
||||
const getNextChildren = (node, container, nextChildren, childrenToRemove, callbacks) => {
|
||||
if (node.vR?.length) {
|
||||
childrenToRemove.push(...node.vR);
|
||||
delete node.vR;
|
||||
}
|
||||
if (typeof node.tag === "function") {
|
||||
node[import_constants.DOM_STASH][1][import_hooks.STASH_EFFECT]?.forEach((data) => callbacks.push(data));
|
||||
}
|
||||
node.vC.forEach((child) => {
|
||||
if (isNodeString(child)) {
|
||||
nextChildren.push(child);
|
||||
} else {
|
||||
if (typeof child.tag === "function" || child.tag === "") {
|
||||
child.c = container;
|
||||
const currentNextChildrenIndex = nextChildren.length;
|
||||
getNextChildren(child, container, nextChildren, childrenToRemove, callbacks);
|
||||
if (child.s) {
|
||||
for (let i = currentNextChildrenIndex; i < nextChildren.length; i++) {
|
||||
nextChildren[i].s = true;
|
||||
}
|
||||
child.s = false;
|
||||
}
|
||||
} else {
|
||||
nextChildren.push(child);
|
||||
if (child.vR?.length) {
|
||||
childrenToRemove.push(...child.vR);
|
||||
delete child.vR;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
const findInsertBefore = (node) => {
|
||||
for (; ; node = node.tag === HONO_PORTAL_ELEMENT || !node.vC || !node.pP ? node.nN : node.vC[0]) {
|
||||
if (!node) {
|
||||
return null;
|
||||
}
|
||||
if (node.tag !== HONO_PORTAL_ELEMENT && node.e) {
|
||||
return node.e;
|
||||
}
|
||||
}
|
||||
};
|
||||
const removeNode = (node) => {
|
||||
if (!isNodeString(node)) {
|
||||
node[import_constants.DOM_STASH]?.[1][import_hooks.STASH_EFFECT]?.forEach((data) => data[2]?.());
|
||||
refCleanupMap.get(node.e)?.();
|
||||
if (node.p === 2) {
|
||||
node.vC?.forEach((n) => n.p = 2);
|
||||
}
|
||||
node.vC?.forEach(removeNode);
|
||||
}
|
||||
if (!node.p) {
|
||||
node.e?.remove();
|
||||
delete node.e;
|
||||
}
|
||||
if (typeof node.tag === "function") {
|
||||
updateMap.delete(node);
|
||||
fallbackUpdateFnArrayMap.delete(node);
|
||||
delete node[import_constants.DOM_STASH][3];
|
||||
node.a = true;
|
||||
}
|
||||
};
|
||||
const apply = (node, container, isNew) => {
|
||||
node.c = container;
|
||||
applyNodeObject(node, container, isNew);
|
||||
};
|
||||
const findChildNodeIndex = (childNodes, child) => {
|
||||
if (!child) {
|
||||
return;
|
||||
}
|
||||
for (let i = 0, len = childNodes.length; i < len; i++) {
|
||||
if (childNodes[i] === child) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return;
|
||||
};
|
||||
const cancelBuild = /* @__PURE__ */ Symbol();
|
||||
const applyNodeObject = (node, container, isNew) => {
|
||||
const next = [];
|
||||
const remove = [];
|
||||
const callbacks = [];
|
||||
getNextChildren(node, container, next, remove, callbacks);
|
||||
remove.forEach(removeNode);
|
||||
const childNodes = isNew ? void 0 : container.childNodes;
|
||||
let offset;
|
||||
let insertBeforeNode = null;
|
||||
if (isNew) {
|
||||
offset = -1;
|
||||
} else if (!childNodes.length) {
|
||||
offset = 0;
|
||||
} else {
|
||||
const offsetByNextNode = findChildNodeIndex(childNodes, findInsertBefore(node.nN));
|
||||
if (offsetByNextNode !== void 0) {
|
||||
insertBeforeNode = childNodes[offsetByNextNode];
|
||||
offset = offsetByNextNode;
|
||||
} else {
|
||||
offset = findChildNodeIndex(childNodes, next.find((n) => n.tag !== HONO_PORTAL_ELEMENT && n.e)?.e) ?? -1;
|
||||
}
|
||||
if (offset === -1) {
|
||||
isNew = true;
|
||||
}
|
||||
}
|
||||
for (let i = 0, len = next.length; i < len; i++, offset++) {
|
||||
const child = next[i];
|
||||
let el;
|
||||
if (child.s && child.e) {
|
||||
el = child.e;
|
||||
child.s = false;
|
||||
} else {
|
||||
const isNewLocal = isNew || !child.e;
|
||||
if (isNodeString(child)) {
|
||||
if (child.e && child.d) {
|
||||
child.e.textContent = child.t;
|
||||
}
|
||||
child.d = false;
|
||||
el = child.e ||= document.createTextNode(child.t);
|
||||
} else {
|
||||
el = child.e ||= child.n ? document.createElementNS(child.n, child.tag) : document.createElement(child.tag);
|
||||
applyProps(el, child.props, child.pP);
|
||||
applyNodeObject(child, el, isNewLocal);
|
||||
}
|
||||
}
|
||||
if (child.tag === HONO_PORTAL_ELEMENT) {
|
||||
offset--;
|
||||
} else if (isNew) {
|
||||
if (!el.parentNode) {
|
||||
container.appendChild(el);
|
||||
}
|
||||
} else if (childNodes[offset] !== el && childNodes[offset - 1] !== el) {
|
||||
if (childNodes[offset + 1] === el) {
|
||||
container.appendChild(childNodes[offset]);
|
||||
} else {
|
||||
container.insertBefore(el, insertBeforeNode || childNodes[offset] || null);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (node.pP) {
|
||||
delete node.pP;
|
||||
}
|
||||
if (callbacks.length) {
|
||||
const useLayoutEffectCbs = [];
|
||||
const useEffectCbs = [];
|
||||
callbacks.forEach(([, useLayoutEffectCb, , useEffectCb, useInsertionEffectCb]) => {
|
||||
if (useLayoutEffectCb) {
|
||||
useLayoutEffectCbs.push(useLayoutEffectCb);
|
||||
}
|
||||
if (useEffectCb) {
|
||||
useEffectCbs.push(useEffectCb);
|
||||
}
|
||||
useInsertionEffectCb?.();
|
||||
});
|
||||
useLayoutEffectCbs.forEach((cb) => cb());
|
||||
if (useEffectCbs.length) {
|
||||
requestAnimationFrame(() => {
|
||||
useEffectCbs.forEach((cb) => cb());
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
const isSameContext = (oldContexts, newContexts) => !!(oldContexts && oldContexts.length === newContexts.length && oldContexts.every((ctx, i) => ctx[1] === newContexts[i][1]));
|
||||
const fallbackUpdateFnArrayMap = /* @__PURE__ */ new WeakMap();
|
||||
const build = (context, node, children) => {
|
||||
const buildWithPreviousChildren = !children && node.pC;
|
||||
if (children) {
|
||||
node.pC ||= node.vC;
|
||||
}
|
||||
let foundErrorHandler;
|
||||
try {
|
||||
children ||= typeof node.tag == "function" ? invokeTag(context, node) : (0, import_children.toArray)(node.props.children);
|
||||
if (children[0]?.tag === "" && children[0][import_constants.DOM_ERROR_HANDLER]) {
|
||||
foundErrorHandler = children[0][import_constants.DOM_ERROR_HANDLER];
|
||||
context[5].push([context, foundErrorHandler, node]);
|
||||
}
|
||||
const oldVChildren = buildWithPreviousChildren ? [...node.pC] : node.vC ? [...node.vC] : void 0;
|
||||
const vChildren = [];
|
||||
let prevNode;
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
if (Array.isArray(children[i])) {
|
||||
children.splice(i, 1, ...children[i].flat());
|
||||
}
|
||||
let child = buildNode(children[i]);
|
||||
if (child) {
|
||||
if (typeof child.tag === "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
!child.tag[import_constants.DOM_INTERNAL_TAG]) {
|
||||
if (import_context.globalContexts.length > 0) {
|
||||
child[import_constants.DOM_STASH][2] = import_context.globalContexts.map((c) => [c, c.values.at(-1)]);
|
||||
}
|
||||
if (context[5]?.length) {
|
||||
child[import_constants.DOM_STASH][3] = context[5].at(-1);
|
||||
}
|
||||
}
|
||||
let oldChild;
|
||||
if (oldVChildren && oldVChildren.length) {
|
||||
const i2 = oldVChildren.findIndex(
|
||||
isNodeString(child) ? (c) => isNodeString(c) : child.key !== void 0 ? (c) => c.key === child.key && c.tag === child.tag : (c) => c.tag === child.tag
|
||||
);
|
||||
if (i2 !== -1) {
|
||||
oldChild = oldVChildren[i2];
|
||||
oldVChildren.splice(i2, 1);
|
||||
}
|
||||
}
|
||||
if (oldChild) {
|
||||
if (isNodeString(child)) {
|
||||
if (oldChild.t !== child.t) {
|
||||
;
|
||||
oldChild.t = child.t;
|
||||
oldChild.d = true;
|
||||
}
|
||||
child = oldChild;
|
||||
} else {
|
||||
const pP = oldChild.pP = oldChild.props;
|
||||
oldChild.props = child.props;
|
||||
oldChild.f ||= child.f || node.f;
|
||||
if (typeof child.tag === "function") {
|
||||
const oldContexts = oldChild[import_constants.DOM_STASH][2];
|
||||
oldChild[import_constants.DOM_STASH][2] = child[import_constants.DOM_STASH][2] || [];
|
||||
oldChild[import_constants.DOM_STASH][3] = child[import_constants.DOM_STASH][3];
|
||||
if (!oldChild.f && ((oldChild.o || oldChild) === child.o || // The code generated by the react compiler is memoized under this condition.
|
||||
oldChild.tag[import_constants.DOM_MEMO]?.(pP, oldChild.props)) && // The `memo` function is memoized under this condition.
|
||||
isSameContext(oldContexts, oldChild[import_constants.DOM_STASH][2])) {
|
||||
oldChild.s = true;
|
||||
}
|
||||
}
|
||||
child = oldChild;
|
||||
}
|
||||
} else if (!isNodeString(child) && nameSpaceContext) {
|
||||
const ns = (0, import_context.useContext)(nameSpaceContext);
|
||||
if (ns) {
|
||||
child.n = ns;
|
||||
}
|
||||
}
|
||||
if (!isNodeString(child) && !child.s) {
|
||||
build(context, child);
|
||||
delete child.f;
|
||||
}
|
||||
vChildren.push(child);
|
||||
if (prevNode && !prevNode.s && !child.s) {
|
||||
for (let p = prevNode; p && !isNodeString(p); p = p.vC?.at(-1)) {
|
||||
p.nN = child;
|
||||
}
|
||||
}
|
||||
prevNode = child;
|
||||
}
|
||||
}
|
||||
node.vR = buildWithPreviousChildren ? [...node.vC, ...oldVChildren || []] : oldVChildren || [];
|
||||
node.vC = vChildren;
|
||||
if (buildWithPreviousChildren) {
|
||||
delete node.pC;
|
||||
}
|
||||
} catch (e) {
|
||||
node.f = true;
|
||||
if (e === cancelBuild) {
|
||||
if (foundErrorHandler) {
|
||||
return;
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
const [errorHandlerContext, errorHandler, errorHandlerNode] = node[import_constants.DOM_STASH]?.[3] || [];
|
||||
if (errorHandler) {
|
||||
const fallbackUpdateFn = () => update([0, false, context[2]], errorHandlerNode);
|
||||
const fallbackUpdateFnArray = fallbackUpdateFnArrayMap.get(errorHandlerNode) || [];
|
||||
fallbackUpdateFnArray.push(fallbackUpdateFn);
|
||||
fallbackUpdateFnArrayMap.set(errorHandlerNode, fallbackUpdateFnArray);
|
||||
const fallback = errorHandler(e, () => {
|
||||
const fnArray = fallbackUpdateFnArrayMap.get(errorHandlerNode);
|
||||
if (fnArray) {
|
||||
const i = fnArray.indexOf(fallbackUpdateFn);
|
||||
if (i !== -1) {
|
||||
fnArray.splice(i, 1);
|
||||
return fallbackUpdateFn();
|
||||
}
|
||||
}
|
||||
});
|
||||
if (fallback) {
|
||||
if (context[0] === 1) {
|
||||
context[1] = true;
|
||||
} else {
|
||||
build(context, errorHandlerNode, [fallback]);
|
||||
if ((errorHandler.length === 1 || context !== errorHandlerContext) && errorHandlerNode.c) {
|
||||
apply(errorHandlerNode, errorHandlerNode.c, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw cancelBuild;
|
||||
}
|
||||
}
|
||||
throw e;
|
||||
} finally {
|
||||
if (foundErrorHandler) {
|
||||
context[5].pop();
|
||||
}
|
||||
}
|
||||
};
|
||||
const buildNode = (node) => {
|
||||
if (node === void 0 || node === null || typeof node === "boolean") {
|
||||
return void 0;
|
||||
} else if (typeof node === "string" || typeof node === "number") {
|
||||
return { t: node.toString(), d: true };
|
||||
} else {
|
||||
if ("vR" in node) {
|
||||
node = {
|
||||
tag: node.tag,
|
||||
props: node.props,
|
||||
key: node.key,
|
||||
f: node.f,
|
||||
type: node.tag,
|
||||
ref: node.props.ref,
|
||||
o: node.o || node
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
};
|
||||
}
|
||||
if (typeof node.tag === "function") {
|
||||
;
|
||||
node[import_constants.DOM_STASH] = [0, []];
|
||||
} else {
|
||||
const ns = nameSpaceMap[node.tag];
|
||||
if (ns) {
|
||||
nameSpaceContext ||= (0, import_context2.createContext)("");
|
||||
node.props.children = [
|
||||
{
|
||||
tag: nameSpaceContext,
|
||||
props: {
|
||||
value: node.n = `http://www.w3.org/${ns}`,
|
||||
children: node.props.children
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
return node;
|
||||
}
|
||||
};
|
||||
const replaceContainer = (node, from, to) => {
|
||||
if (node.c === from) {
|
||||
node.c = to;
|
||||
node.vC.forEach((child) => replaceContainer(child, from, to));
|
||||
}
|
||||
};
|
||||
const updateSync = (context, node) => {
|
||||
node[import_constants.DOM_STASH][2]?.forEach(([c, v]) => {
|
||||
c.values.push(v);
|
||||
});
|
||||
try {
|
||||
build(context, node, void 0);
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
if (node.a) {
|
||||
delete node.a;
|
||||
return;
|
||||
}
|
||||
node[import_constants.DOM_STASH][2]?.forEach(([c]) => {
|
||||
c.values.pop();
|
||||
});
|
||||
if (context[0] !== 1 || !context[1]) {
|
||||
apply(node, node.c, false);
|
||||
}
|
||||
};
|
||||
const updateMap = /* @__PURE__ */ new WeakMap();
|
||||
const currentUpdateSets = [];
|
||||
const update = async (context, node) => {
|
||||
context[5] ||= [];
|
||||
const existing = updateMap.get(node);
|
||||
if (existing) {
|
||||
existing[0](void 0);
|
||||
}
|
||||
let resolve;
|
||||
const promise = new Promise((r) => resolve = r);
|
||||
updateMap.set(node, [
|
||||
resolve,
|
||||
() => {
|
||||
if (context[2]) {
|
||||
context[2](context, node, (context2) => {
|
||||
updateSync(context2, node);
|
||||
}).then(() => resolve(node));
|
||||
} else {
|
||||
updateSync(context, node);
|
||||
resolve(node);
|
||||
}
|
||||
}
|
||||
]);
|
||||
if (currentUpdateSets.length) {
|
||||
;
|
||||
currentUpdateSets.at(-1).add(node);
|
||||
} else {
|
||||
await Promise.resolve();
|
||||
const latest = updateMap.get(node);
|
||||
if (latest) {
|
||||
updateMap.delete(node);
|
||||
latest[1]();
|
||||
}
|
||||
}
|
||||
return promise;
|
||||
};
|
||||
const renderNode = (node, container) => {
|
||||
const context = [];
|
||||
context[5] = [];
|
||||
context[4] = true;
|
||||
build(context, node, void 0);
|
||||
context[4] = false;
|
||||
const fragment = document.createDocumentFragment();
|
||||
apply(node, fragment, true);
|
||||
replaceContainer(node, fragment, container);
|
||||
container.replaceChildren(fragment);
|
||||
};
|
||||
const render = (jsxNode, container) => {
|
||||
renderNode(buildNode({ tag: "", props: { children: jsxNode } }), container);
|
||||
};
|
||||
const flushSync = (callback) => {
|
||||
const set = /* @__PURE__ */ new Set();
|
||||
currentUpdateSets.push(set);
|
||||
callback();
|
||||
set.forEach((node) => {
|
||||
const latest = updateMap.get(node);
|
||||
if (latest) {
|
||||
updateMap.delete(node);
|
||||
latest[1]();
|
||||
}
|
||||
});
|
||||
currentUpdateSets.pop();
|
||||
};
|
||||
const createPortal = (children, container, key) => ({
|
||||
tag: HONO_PORTAL_ELEMENT,
|
||||
props: {
|
||||
children
|
||||
},
|
||||
key,
|
||||
e: container,
|
||||
p: 1
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
});
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
build,
|
||||
buildDataStack,
|
||||
buildNode,
|
||||
createPortal,
|
||||
flushSync,
|
||||
getNameSpaceContext,
|
||||
render,
|
||||
renderNode,
|
||||
update
|
||||
});
|
||||
68
_node_modules/hono/dist/cjs/jsx/dom/server.js
generated
vendored
Normal file
68
_node_modules/hono/dist/cjs/jsx/dom/server.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var server_exports = {};
|
||||
__export(server_exports, {
|
||||
default: () => server_default,
|
||||
renderToReadableStream: () => renderToReadableStream,
|
||||
renderToString: () => renderToString,
|
||||
version: () => import__.default
|
||||
});
|
||||
module.exports = __toCommonJS(server_exports);
|
||||
var import_streaming = require("../streaming");
|
||||
var import__ = __toESM(require("./"), 1);
|
||||
const renderToString = (element, options = {}) => {
|
||||
if (Object.keys(options).length > 0) {
|
||||
console.warn("options are not supported yet");
|
||||
}
|
||||
const res = element?.toString() ?? "";
|
||||
if (typeof res !== "string") {
|
||||
throw new Error("Async component is not supported in renderToString");
|
||||
}
|
||||
return res;
|
||||
};
|
||||
const renderToReadableStream = async (element, options = {}) => {
|
||||
if (Object.keys(options).some((key) => key !== "onError")) {
|
||||
console.warn("options are not supported yet, except onError");
|
||||
}
|
||||
if (!element || typeof element !== "object") {
|
||||
element = element?.toString() ?? "";
|
||||
}
|
||||
return (0, import_streaming.renderToReadableStream)(element, options.onError);
|
||||
};
|
||||
var server_default = {
|
||||
renderToString,
|
||||
renderToReadableStream,
|
||||
version: import__.default
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
renderToReadableStream,
|
||||
renderToString,
|
||||
version
|
||||
});
|
||||
33
_node_modules/hono/dist/cjs/jsx/dom/utils.js
generated
vendored
Normal file
33
_node_modules/hono/dist/cjs/jsx/dom/utils.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var utils_exports = {};
|
||||
__export(utils_exports, {
|
||||
setInternalTagFlag: () => setInternalTagFlag
|
||||
});
|
||||
module.exports = __toCommonJS(utils_exports);
|
||||
var import_constants = require("../constants");
|
||||
const setInternalTagFlag = (fn) => {
|
||||
;
|
||||
fn[import_constants.DOM_INTERNAL_TAG] = true;
|
||||
return fn;
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
setInternalTagFlag
|
||||
});
|
||||
Reference in New Issue
Block a user