acrylblends 0.6.1 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -6
- package/docs/framework/README.md +3 -2
- package/docs/framework/UPSTREAM.md +1 -1
- package/docs/framework/api/presets.md +0 -3
- package/docs/framework/cordis/acryl-in-a-cordis-app.md +9 -0
- package/docs/framework/getting-started/basic.md +5 -4
- package/docs/framework/getting-started/desktop.md +41 -0
- package/docs/framework/guides/jsx-dom.md +0 -3
- package/docs/framework/guides/jsx.md +1 -4
- package/docs/framework/guides/middleware.md +1 -1
- package/docs/framework/helpers/cookie.md +1 -1
- package/docs/framework/helpers/css.md +0 -3
- package/docs/framework/helpers/dev.md +0 -3
- package/docs/framework/helpers/jwt.md +1 -1
- package/docs/framework/helpers/proxy.md +0 -3
- package/docs/framework/middleware/builtin/basic-auth.md +6 -6
- package/docs/framework/middleware/builtin/cache.md +0 -3
- package/docs/framework/middleware/builtin/combine.md +1 -1
- package/docs/framework/middleware/builtin/ip-restriction.md +1 -1
- package/docs/framework/middleware/builtin/logger.md +1 -1
- package/docs/framework/middleware/builtin/mount.md +0 -3
- package/docs/framework/upstream.json +3 -3
- package/lib/accepts.d.ts +1 -1
- package/lib/acryl-base.d.ts +1 -1
- package/lib/adapter.d.ts +1 -1
- package/lib/{app-CmAYW1Al.d.ts → app-wFwpg-bt.d.ts} +1 -1
- package/lib/base-BpQy2Rk7.d.ts +783 -0
- package/lib/base-ddiVmiE7.js +721 -0
- package/lib/basic-auth.d.ts +1 -1
- package/lib/bearer-auth.d.ts +1 -1
- package/lib/body-limit.d.ts +1 -1
- package/lib/cache.d.ts +43 -0
- package/lib/cache.js +169 -0
- package/lib/client.d.ts +2 -2
- package/lib/combine.d.ts +1 -1
- package/lib/common-D8Z4JRCw.d.ts +46 -0
- package/lib/components-Ce5FRyHU.js +268 -0
- package/lib/components-DYZdxJIJ.js +24 -0
- package/lib/compress.d.ts +1 -1
- package/lib/conninfo.d.ts +2 -2
- package/lib/constants-BR9jM9BC.js +9 -0
- package/lib/{context-Bm7rI-oK.d.ts → context-DVQBjuns.d.ts} +1 -1
- package/lib/context-DxFdY_un.d.ts +250 -0
- package/lib/context-storage.d.ts +1 -1
- package/lib/{cookie-ClMaKDQf.d.ts → cookie-CCelEqky.d.ts} +1 -1
- package/lib/cookie.d.ts +3 -3
- package/lib/cors.d.ts +1 -1
- package/lib/csrf.d.ts +1 -1
- package/lib/css-D2jb7X8b.js +320 -0
- package/lib/css.d.ts +82 -0
- package/lib/css.js +134 -0
- package/lib/dev.d.ts +19 -0
- package/lib/dev.js +50 -0
- package/lib/etag.d.ts +1 -1
- package/lib/factory.d.ts +2 -2
- package/lib/hooks-Bq5q9IMl.js +762 -0
- package/lib/html-SllAe0YT.d.ts +46 -0
- package/lib/html.d.ts +1 -1
- package/lib/index-C850MeBA.d.ts +94 -0
- package/lib/{index-oOClm_Xk.d.ts → index-CUTfU69R.d.ts} +3 -3
- package/lib/{index-B-3F4wt2.d.ts → index-Cqcdluyn.d.ts} +2 -2
- package/lib/{index-UTBmM3GX.d.ts → index-CsvB-F9j.d.ts} +2 -2
- package/lib/index.d.ts +4 -4
- package/lib/ip-restriction.d.ts +2 -2
- package/lib/jsx/dom/client.d.ts +30 -0
- package/lib/jsx/dom/client.js +49 -0
- package/lib/jsx/dom/css.d.ts +84 -0
- package/lib/jsx/dom/css.js +2 -0
- package/lib/jsx/dom/jsx-dev-runtime.d.ts +3 -0
- package/lib/jsx/dom/jsx-dev-runtime.js +2 -0
- package/lib/jsx/dom/jsx-runtime.d.ts +3 -0
- package/lib/jsx/dom/jsx-runtime.js +2 -0
- package/lib/jsx/dom/server.d.ts +105 -0
- package/lib/jsx/dom/server.js +37 -0
- package/lib/jsx/dom.d.ts +5 -0
- package/lib/jsx/dom.js +74 -0
- package/lib/jsx/jsx-dev-runtime.d.ts +6 -0
- package/lib/jsx/jsx-dev-runtime.js +14 -0
- package/lib/jsx/jsx-runtime.d.ts +10 -0
- package/lib/jsx/jsx-runtime.js +30 -0
- package/lib/jsx/streaming.d.ts +2 -0
- package/lib/jsx/streaming.js +2 -0
- package/lib/jsx-dev-runtime-B22O-Npk.d.ts +7 -0
- package/lib/jsx-dev-runtime-kAhR_4C7.js +354 -0
- package/lib/jsx-runtime-BVVgDSdq.d.ts +1 -0
- package/lib/jsx.d.ts +3 -0
- package/lib/jsx.js +47 -0
- package/lib/jwk.d.ts +4 -4
- package/lib/{jwt-Dg493Tai.d.ts → jwt-BARhotDz.d.ts} +1 -1
- package/lib/jwt.d.ts +4 -4
- package/lib/language.d.ts +1 -1
- package/lib/linear-router-C3FPib6h.js +96 -0
- package/lib/logger.d.ts +1 -1
- package/lib/loopback-only.d.ts +1 -1
- package/lib/method-not-allowed.d.ts +2 -2
- package/lib/method-override.d.ts +2 -2
- package/lib/mount.d.ts +44 -0
- package/lib/mount.js +67 -0
- package/lib/node-server/conninfo.d.ts +1 -1
- package/lib/node-server/serve-static.d.ts +1 -1
- package/lib/node-server/serve-static.js +1 -1
- package/lib/node-server.d.ts +1 -1
- package/lib/node-server.js +1 -1
- package/lib/pattern-router-HZxjDGEQ.js +41 -0
- package/lib/powered-by.d.ts +1 -1
- package/lib/pretty-json.d.ts +1 -1
- package/lib/proxy.d.ts +72 -0
- package/lib/proxy.js +121 -0
- package/lib/quick.d.ts +8 -0
- package/lib/quick.js +17 -0
- package/lib/request-id.d.ts +1 -1
- package/lib/request.d.ts +1 -1
- package/lib/route.d.ts +1 -1
- package/lib/router/linear-router.js +1 -95
- package/lib/router/pattern-router.js +1 -40
- package/lib/schema-validator.d.ts +1 -1
- package/lib/secure-headers.d.ts +1 -1
- package/lib/{serve-static-Dw_m6KxR.js → serve-static-Cw23shXv.js} +1 -0
- package/lib/serve-static.d.ts +1 -1
- package/lib/streaming.d.ts +1 -1
- package/lib/testing.d.ts +4 -4
- package/lib/timeout.d.ts +1 -1
- package/lib/timing.d.ts +1 -1
- package/lib/tiny.d.ts +8 -0
- package/lib/tiny.js +15 -0
- package/lib/trailing-slash.d.ts +1 -1
- package/lib/{types-CHesD1KG.d.ts → types-CQiGmsWW.d.ts} +3 -3
- package/lib/{types-CwrQjlaM.d.ts → types-Lqx5BxQF.d.ts} +10 -1
- package/lib/{types-CDO6I3B0.d.ts → types-nEL8VPDC.d.ts} +1 -1
- package/lib/types.d.ts +1 -1
- package/lib/utils/body.d.ts +1 -1
- package/lib/utils/cookie.d.ts +1 -1
- package/lib/utils/crypto.d.ts +1 -1
- package/lib/utils/html.d.ts +1 -45
- package/lib/utils/ipaddr.d.ts +1 -1
- package/lib/utils/jwt.d.ts +1 -1
- package/lib/utils/types.d.ts +2 -2
- package/lib/validator.d.ts +2 -2
- package/lib/ws.d.ts +1 -1
- package/package.json +69 -1
- package/plugins/acryl-inspect/upstream.json +1 -1
- package/plugins/acryl-node-server/upstream.json +1 -1
- package/plugins/acryl-router/src/core/helper/css/common.case.test.tsx +506 -0
- package/plugins/acryl-router/src/core/helper/css/common.ts +337 -0
- package/plugins/acryl-router/src/core/helper/css/index.test.tsx +678 -0
- package/plugins/acryl-router/src/core/helper/css/index.ts +262 -0
- package/plugins/acryl-router/src/core/helper/dev/index.test.ts +181 -0
- package/plugins/acryl-router/src/core/helper/dev/index.ts +79 -0
- package/plugins/acryl-router/src/core/helper/proxy/index.test.ts +356 -0
- package/plugins/acryl-router/src/core/helper/proxy/index.ts +203 -0
- package/plugins/acryl-router/src/core/helper/streaming/sse.test.tsx +557 -0
- package/plugins/acryl-router/src/core/jsx/base.test.tsx +97 -0
- package/plugins/acryl-router/src/core/jsx/base.ts +490 -0
- package/plugins/acryl-router/src/core/jsx/children.test.ts +52 -0
- package/plugins/acryl-router/src/core/jsx/children.ts +20 -0
- package/plugins/acryl-router/src/core/jsx/components.test.tsx +936 -0
- package/plugins/acryl-router/src/core/jsx/components.ts +257 -0
- package/plugins/acryl-router/src/core/jsx/constants.ts +6 -0
- package/plugins/acryl-router/src/core/jsx/context-isolation.test.ts +655 -0
- package/plugins/acryl-router/src/core/jsx/context.ts +266 -0
- package/plugins/acryl-router/src/core/jsx/dom/client.test.tsx +128 -0
- package/plugins/acryl-router/src/core/jsx/dom/client.ts +89 -0
- package/plugins/acryl-router/src/core/jsx/dom/components.test.tsx +330 -0
- package/plugins/acryl-router/src/core/jsx/dom/components.ts +39 -0
- package/plugins/acryl-router/src/core/jsx/dom/context.test.tsx +184 -0
- package/plugins/acryl-router/src/core/jsx/dom/context.ts +52 -0
- package/plugins/acryl-router/src/core/jsx/dom/css.test.tsx +149 -0
- package/plugins/acryl-router/src/core/jsx/dom/css.ts +263 -0
- package/plugins/acryl-router/src/core/jsx/dom/hooks/index.test.tsx +172 -0
- package/plugins/acryl-router/src/core/jsx/dom/hooks/index.ts +91 -0
- package/plugins/acryl-router/src/core/jsx/dom/index.test.tsx +3681 -0
- package/plugins/acryl-router/src/core/jsx/dom/index.ts +170 -0
- package/plugins/acryl-router/src/core/jsx/dom/intrinsic-element/components.test.tsx +1344 -0
- package/plugins/acryl-router/src/core/jsx/dom/intrinsic-element/components.ts +438 -0
- package/plugins/acryl-router/src/core/jsx/dom/jsx-dev-runtime.ts +23 -0
- package/plugins/acryl-router/src/core/jsx/dom/jsx-runtime.ts +8 -0
- package/plugins/acryl-router/src/core/jsx/dom/render.ts +879 -0
- package/plugins/acryl-router/src/core/jsx/dom/server.test.tsx +199 -0
- package/plugins/acryl-router/src/core/jsx/dom/server.ts +76 -0
- package/plugins/acryl-router/src/core/jsx/dom/utils.ts +7 -0
- package/plugins/acryl-router/src/core/jsx/hooks/dom.test.tsx +859 -0
- package/plugins/acryl-router/src/core/jsx/hooks/index.ts +437 -0
- package/plugins/acryl-router/src/core/jsx/hooks/string.test.tsx +40 -0
- package/plugins/acryl-router/src/core/jsx/index.test.tsx +1744 -0
- package/plugins/acryl-router/src/core/jsx/index.ts +115 -0
- package/plugins/acryl-router/src/core/jsx/intrinsic-element/common.ts +23 -0
- package/plugins/acryl-router/src/core/jsx/intrinsic-element/components.test.tsx +666 -0
- package/plugins/acryl-router/src/core/jsx/intrinsic-element/components.ts +210 -0
- package/plugins/acryl-router/src/core/jsx/intrinsic-elements.ts +938 -0
- package/plugins/acryl-router/src/core/jsx/jsx-dev-runtime.ts +26 -0
- package/plugins/acryl-router/src/core/jsx/jsx-runtime.test.tsx +85 -0
- package/plugins/acryl-router/src/core/jsx/jsx-runtime.ts +51 -0
- package/plugins/acryl-router/src/core/jsx/streaming.test.tsx +1281 -0
- package/plugins/acryl-router/src/core/jsx/streaming.ts +231 -0
- package/plugins/acryl-router/src/core/jsx/types.ts +41 -0
- package/plugins/acryl-router/src/core/jsx/utils.test.ts +366 -0
- package/plugins/acryl-router/src/core/jsx/utils.ts +202 -0
- package/plugins/acryl-router/src/core/middleware/cache/index.test.ts +1211 -0
- package/plugins/acryl-router/src/core/middleware/cache/index.ts +323 -0
- package/plugins/acryl-router/src/core/middleware/mount/index.test.ts +334 -0
- package/plugins/acryl-router/src/core/middleware/mount/index.ts +108 -0
- package/plugins/acryl-router/src/core/preset/quick.test.ts +42 -0
- package/plugins/acryl-router/src/core/preset/quick.ts +24 -0
- package/plugins/acryl-router/src/core/preset/tiny.test.ts +42 -0
- package/plugins/acryl-router/src/core/preset/tiny.ts +20 -0
- package/plugins/acryl-router/src/core/utils/types.ts +9 -0
- package/plugins/acryl-router/src/helpers/index.ts +3 -0
- package/plugins/acryl-router/src/middleware/index.ts +2 -0
- package/plugins/acryl-router/src/service.ts +22 -5
- package/plugins/acryl-router/tests/jsx.spec.tsx +63 -0
- package/plugins/acryl-router/upstream.json +3 -3
- package/plugins/acryl-router-http/upstream.json +1 -1
- package/plugins/acryl-state/upstream.json +1 -1
- package/plugins/desktop/upstream.json +1 -1
- package/plugins/desktop-web/upstream.json +1 -1
- package/plugins/save/plugin.json +1 -1
- package/templates/todo/upstream.json +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region ../../plugins/acryl-router/src/core/utils/html.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* @module
|
|
4
|
+
* HTML utility.
|
|
5
|
+
*/
|
|
6
|
+
declare const HtmlEscapedCallbackPhase: {
|
|
7
|
+
readonly Stringify: 1;
|
|
8
|
+
readonly BeforeStream: 2;
|
|
9
|
+
readonly Stream: 3;
|
|
10
|
+
};
|
|
11
|
+
type HtmlEscapedCallbackOpts = {
|
|
12
|
+
buffer?: [string];
|
|
13
|
+
phase: (typeof HtmlEscapedCallbackPhase)[keyof typeof HtmlEscapedCallbackPhase];
|
|
14
|
+
context: Readonly<object>;
|
|
15
|
+
};
|
|
16
|
+
type HtmlEscapedCallback = (opts: HtmlEscapedCallbackOpts) => Promise<string> | undefined;
|
|
17
|
+
type HtmlEscaped = {
|
|
18
|
+
isEscaped: true;
|
|
19
|
+
callbacks?: HtmlEscapedCallback[];
|
|
20
|
+
};
|
|
21
|
+
type HtmlEscapedString = string & HtmlEscaped;
|
|
22
|
+
/**
|
|
23
|
+
* StringBuffer contains string and Promise<string> alternately
|
|
24
|
+
* The length of the array will be odd, the odd numbered element will be a string,
|
|
25
|
+
* and the even numbered element will be a Promise<string>.
|
|
26
|
+
* When concatenating into a single string, it must be processed from the tail.
|
|
27
|
+
* @example
|
|
28
|
+
* [
|
|
29
|
+
* 'framework.',
|
|
30
|
+
* Promise.resolve('ultra fast'),
|
|
31
|
+
* 'a ',
|
|
32
|
+
* Promise.resolve('is '),
|
|
33
|
+
* 'Acryl',
|
|
34
|
+
* ]
|
|
35
|
+
*/
|
|
36
|
+
type StringBuffer = (string | Promise<string>)[];
|
|
37
|
+
type StringBufferWithCallbacks = StringBuffer & {
|
|
38
|
+
callbacks: HtmlEscapedCallback[];
|
|
39
|
+
};
|
|
40
|
+
declare const raw: (value: unknown, callbacks?: HtmlEscapedCallback[]) => HtmlEscapedString;
|
|
41
|
+
declare const stringBufferToString: (buffer: StringBuffer, callbacks: HtmlEscapedCallback[] | undefined) => Promise<HtmlEscapedString>;
|
|
42
|
+
declare const escapeToBuffer: (str: string, buffer: StringBuffer) => void;
|
|
43
|
+
declare const resolveCallbackSync: (str: string | HtmlEscapedString) => string;
|
|
44
|
+
declare const resolveCallback: (str: string | HtmlEscapedString | Promise<string>, phase: (typeof HtmlEscapedCallbackPhase)[keyof typeof HtmlEscapedCallbackPhase], preserveCallbacks: boolean, context: object, buffer?: [string]) => Promise<string>;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { StringBuffer as a, raw as c, stringBufferToString as d, HtmlEscapedString as i, resolveCallback as l, HtmlEscapedCallback as n, StringBufferWithCallbacks as o, HtmlEscapedCallbackPhase as r, escapeToBuffer as s, HtmlEscaped as t, resolveCallbackSync as u };
|
package/lib/html.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as raw, i as HtmlEscapedString } from "./html-SllAe0YT.js";
|
|
2
2
|
|
|
3
3
|
//#region ../../plugins/acryl-router/src/core/helper/html/index.d.ts
|
|
4
4
|
declare const html: (strings: TemplateStringsArray, ...values: unknown[]) => HtmlEscapedString | Promise<HtmlEscapedString>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { C as PropsWithChildren, G as useRef, Q as FallbackRender, Z as ErrorHandler, k as RefObject, t as Context } from "./context-DxFdY_un.js";
|
|
2
|
+
import { a as JSX, o as JSXNode, r as FC, s as Props, t as Child } from "./base-BpQy2Rk7.js";
|
|
3
|
+
|
|
4
|
+
//#region ../../plugins/acryl-router/src/core/jsx/dom/components.d.ts
|
|
5
|
+
declare const ErrorBoundary: FC<PropsWithChildren<{
|
|
6
|
+
fallback?: Child;
|
|
7
|
+
fallbackRender?: FallbackRender;
|
|
8
|
+
onError?: ErrorHandler;
|
|
9
|
+
}>>;
|
|
10
|
+
declare const Suspense: FC<PropsWithChildren<{
|
|
11
|
+
fallback: any;
|
|
12
|
+
}>>;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region ../../plugins/acryl-router/src/core/jsx/dom/context.d.ts
|
|
15
|
+
declare const createContext: <T>(defaultValue: T) => Context<T>;
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region ../../plugins/acryl-router/src/core/jsx/dom/render.d.ts
|
|
18
|
+
type Container = HTMLElement | DocumentFragment;
|
|
19
|
+
declare const render: (jsxNode: Child, container: Container) => void;
|
|
20
|
+
declare const flushSync: (callback: () => void) => void;
|
|
21
|
+
declare const createPortal: (children: Child, container: HTMLElement, key?: string) => Child;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region ../../plugins/acryl-router/src/core/jsx/dom/index.d.ts
|
|
24
|
+
declare const createElement: (tag: string | ((props: Props) => JSXNode), props: Props | null, ...children: Child[]) => JSXNode;
|
|
25
|
+
declare const cloneElement: <T extends JSXNode | JSX.Element>(element: T, props: Props, ...children: Child[]) => T;
|
|
26
|
+
declare const memo: <T>(component: FC<T>, propsAreEqual?: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean) => FC<T>;
|
|
27
|
+
declare const _default: {
|
|
28
|
+
version: string;
|
|
29
|
+
useState: {
|
|
30
|
+
<T>(initialState: T | (() => T)): [T, (newState: T | ((currentState: T) => T)) => void];
|
|
31
|
+
<T = undefined>(): [T | undefined, (newState: T | ((currentState: T | undefined) => T | undefined) | undefined) => void];
|
|
32
|
+
};
|
|
33
|
+
useEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
|
|
34
|
+
useRef: typeof useRef;
|
|
35
|
+
useCallback: <T extends Function>(callback: T, deps: readonly unknown[]) => T;
|
|
36
|
+
use: <T>(promise: Promise<T>) => T;
|
|
37
|
+
startTransition: (callback: () => void) => void;
|
|
38
|
+
useTransition: () => [boolean, (callback: () => void | Promise<void>) => void];
|
|
39
|
+
useDeferredValue: <T>(value: T, initialValue?: T) => T;
|
|
40
|
+
startViewTransition: (callback: () => void) => void;
|
|
41
|
+
useViewTransition: () => [boolean, (callback: () => void) => void];
|
|
42
|
+
useMemo: <T>(factory: () => T, deps: readonly unknown[]) => T;
|
|
43
|
+
useLayoutEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
|
|
44
|
+
useInsertionEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
|
|
45
|
+
useReducer: <T, A>(reducer: (state: T, action: A) => T, initialArg: T, init?: (initialState: T) => T) => [T, (action: A) => void];
|
|
46
|
+
useId: () => string;
|
|
47
|
+
useDebugValue: (_value: unknown, _formatter?: (value: unknown) => string) => void;
|
|
48
|
+
createRef: <T>() => RefObject<T | null>;
|
|
49
|
+
forwardRef: <T, P = {}>(Component: (props: P, ref?: RefObject<T | null>) => JSX.Element) => ((props: P & {
|
|
50
|
+
ref?: RefObject<T | null>;
|
|
51
|
+
}) => JSX.Element);
|
|
52
|
+
useImperativeHandle: <T>(ref: RefObject<T | null>, createHandle: () => T, deps: readonly unknown[]) => void;
|
|
53
|
+
useSyncExternalStore: <T>(subscribe: (callback: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T) => T;
|
|
54
|
+
useFormStatus: () => {
|
|
55
|
+
pending: false;
|
|
56
|
+
data: null;
|
|
57
|
+
method: null;
|
|
58
|
+
action: null;
|
|
59
|
+
} | {
|
|
60
|
+
pending: true;
|
|
61
|
+
data: FormData;
|
|
62
|
+
method: "get" | "post";
|
|
63
|
+
action: string | ((formData: FormData) => void | Promise<void>);
|
|
64
|
+
};
|
|
65
|
+
useActionState: <T>(fn: Function, initialState: T, permalink?: string) => [T, Function];
|
|
66
|
+
useOptimistic: <T, N>(state: T, updateState: (currentState: T, action: N) => T) => [T, (action: N) => void];
|
|
67
|
+
Suspense: FC<PropsWithChildren<{
|
|
68
|
+
fallback: any;
|
|
69
|
+
}>>;
|
|
70
|
+
ErrorBoundary: FC<PropsWithChildren<{
|
|
71
|
+
fallback?: Child;
|
|
72
|
+
fallbackRender?: FallbackRender;
|
|
73
|
+
onError?: ErrorHandler;
|
|
74
|
+
}>>;
|
|
75
|
+
createContext: <T>(defaultValue: T) => Context<T>;
|
|
76
|
+
useContext: <T>(context: Context<T>) => T;
|
|
77
|
+
memo: <T>(component: FC<T>, propsAreEqual?: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean) => FC<T>;
|
|
78
|
+
isValidElement: (element: unknown) => element is JSXNode;
|
|
79
|
+
createElement: (tag: string | ((props: Props) => JSXNode), props: Props | null, ...children: Child[]) => JSXNode;
|
|
80
|
+
cloneElement: <T extends JSXNode | JSX.Element>(element: T, props: Props, ...children: Child[]) => T;
|
|
81
|
+
Children: {
|
|
82
|
+
map: (children: Child[], fn: (child: Child, index: number) => Child) => Child[];
|
|
83
|
+
forEach: (children: Child[], fn: (child: Child, index: number) => void) => void;
|
|
84
|
+
count: (children: Child[]) => number;
|
|
85
|
+
only: (_children: Child[]) => Child;
|
|
86
|
+
toArray: (children: Child) => Child[];
|
|
87
|
+
};
|
|
88
|
+
Fragment: (props: Record<string, unknown>) => JSXNode;
|
|
89
|
+
StrictMode: (props: Record<string, unknown>) => JSXNode;
|
|
90
|
+
flushSync: (callback: () => void) => void;
|
|
91
|
+
createPortal: (children: Child, container: HTMLElement, key?: string) => Child;
|
|
92
|
+
};
|
|
93
|
+
//#endregion
|
|
94
|
+
export { createPortal as a, createContext as c, memo as i, ErrorBoundary as l, cloneElement as n, flushSync as o, createElement as r, render as s, _default as t, Suspense as u };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as ContentfulStatusCode, s as ServerErrorStatusCode, t as ClientErrorStatusCode } from "./http-status-DaAwGAFL.js";
|
|
2
|
-
import {
|
|
3
|
-
import { t as Acryl } from "./app-
|
|
4
|
-
import { a as ClientResponse, i as ClientRequestOptions, n as Client, s as FilterClientResponseByStatusCode } from "./types-
|
|
2
|
+
import { D as UnionToIntersection } from "./types-Lqx5BxQF.js";
|
|
3
|
+
import { t as Acryl } from "./app-wFwpg-bt.js";
|
|
4
|
+
import { a as ClientResponse, i as ClientRequestOptions, n as Client, s as FilterClientResponseByStatusCode } from "./types-CQiGmsWW.js";
|
|
5
5
|
|
|
6
6
|
//#region ../../plugins/acryl-router/src/core/client/client.d.ts
|
|
7
7
|
declare const hc: <T extends Acryl<any, any, any>, Prefix extends string = string>(baseUrl: Prefix, options?: ClientRequestOptions) => UnionToIntersection<Client<T, Prefix>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Input, J as Schema, _ as Env, h as BlankSchema, o as AcrylRequest, p as BlankEnv } from "./context-
|
|
2
|
-
import { t as Acryl } from "./app-
|
|
1
|
+
import { A as Input, J as Schema, _ as Env, h as BlankSchema, o as AcrylRequest, p as BlankEnv } from "./context-DVQBjuns.js";
|
|
2
|
+
import { t as Acryl } from "./app-wFwpg-bt.js";
|
|
3
3
|
|
|
4
4
|
//#region ../../plugins/acryl-router/src/deprecated.d.ts
|
|
5
5
|
/** @deprecated Use `Acryl` (`new Acryl()`); `App` is the 0.4 name and goes away in the next release. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { I as MiddlewareHandler, X as TypedResponse, t as Context } from "./context-
|
|
1
|
+
import { I as MiddlewareHandler, X as TypedResponse, t as Context } from "./context-DVQBjuns.js";
|
|
2
2
|
import { c as StatusCode } from "./http-status-DaAwGAFL.js";
|
|
3
|
-
import {
|
|
3
|
+
import { b as MessageEvent, r as CloseEvent, t as BinaryType } from "./types-Lqx5BxQF.js";
|
|
4
4
|
|
|
5
5
|
//#region ../../plugins/acryl-router/src/core/helper/websocket/index.d.ts
|
|
6
6
|
/**
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Input, B as NotFoundResponse, D as Handler, I as MiddlewareHandler, J as Schema, R as Next, X as TypedResponse, Y as ToSchema, Z as ValidationTargets, _ as Env, a as ExecutionContext, n as ContextRenderer, o as AcrylRequest, r as ContextVariableMap, t as Context, v as ErrorHandler, z as NotFoundHandler } from "./context-
|
|
2
|
-
import { t as Acryl } from "./app-
|
|
3
|
-
import { c as InferRequestType, i as ClientRequestOptions, l as InferResponseType } from "./types-
|
|
4
|
-
import { n as AppRequest, t as App } from "./index-
|
|
1
|
+
import { A as Input, B as NotFoundResponse, D as Handler, I as MiddlewareHandler, J as Schema, R as Next, X as TypedResponse, Y as ToSchema, Z as ValidationTargets, _ as Env, a as ExecutionContext, n as ContextRenderer, o as AcrylRequest, r as ContextVariableMap, t as Context, v as ErrorHandler, z as NotFoundHandler } from "./context-DVQBjuns.js";
|
|
2
|
+
import { t as Acryl } from "./app-wFwpg-bt.js";
|
|
3
|
+
import { c as InferRequestType, i as ClientRequestOptions, l as InferResponseType } from "./types-CQiGmsWW.js";
|
|
4
|
+
import { n as AppRequest, t as App } from "./index-Cqcdluyn.js";
|
|
5
5
|
export { Acryl, type AcrylRequest, App, type AppRequest, type ClientRequestOptions, Context, type ContextRenderer, type ContextVariableMap, type Env, type ErrorHandler, type ExecutionContext, type Handler, type InferRequestType, type InferResponseType, type Input, type MiddlewareHandler, type Next, type NotFoundHandler, type NotFoundResponse, type Schema, type ToSchema, type TypedResponse, type ValidationTargets };
|
package/lib/ip-restriction.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as MiddlewareHandler, t as Context } from "./context-
|
|
2
|
-
import { r as GetConnInfo, t as AddressType } from "./types-
|
|
1
|
+
import { I as MiddlewareHandler, t as Context } from "./context-DVQBjuns.js";
|
|
2
|
+
import { r as GetConnInfo, t as AddressType } from "./types-nEL8VPDC.js";
|
|
3
3
|
|
|
4
4
|
//#region ../../plugins/acryl-router/src/core/middleware/ip-restriction/index.d.ts
|
|
5
5
|
/**
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { t as Child } from "../../base-BpQy2Rk7.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../plugins/acryl-router/src/core/jsx/dom/client.d.ts
|
|
4
|
+
interface Root {
|
|
5
|
+
render(children: Child): void;
|
|
6
|
+
unmount(): void;
|
|
7
|
+
}
|
|
8
|
+
type RootOptions = Record<string, unknown>;
|
|
9
|
+
/**
|
|
10
|
+
* Create a root object for rendering
|
|
11
|
+
* @param element Render target
|
|
12
|
+
* @param options Options for createRoot (not supported yet)
|
|
13
|
+
* @returns Root object has `render` and `unmount` methods
|
|
14
|
+
*/
|
|
15
|
+
declare const createRoot: (element: HTMLElement | DocumentFragment, options?: RootOptions) => Root;
|
|
16
|
+
/**
|
|
17
|
+
* Create a root object and hydrate app to the target element.
|
|
18
|
+
* In acryl-router/jsx/dom, hydrate is equivalent to render.
|
|
19
|
+
* @param element Render target
|
|
20
|
+
* @param reactNode A JSXNode to render
|
|
21
|
+
* @param options Options for createRoot (not supported yet)
|
|
22
|
+
* @returns Root object has `render` and `unmount` methods
|
|
23
|
+
*/
|
|
24
|
+
declare const hydrateRoot: (element: HTMLElement | DocumentFragment, reactNode: Child, options?: RootOptions) => Root;
|
|
25
|
+
declare const _default: {
|
|
26
|
+
createRoot: (element: HTMLElement | DocumentFragment, options?: RootOptions) => Root;
|
|
27
|
+
hydrateRoot: (element: HTMLElement | DocumentFragment, reactNode: Child, options?: RootOptions) => Root;
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { Root, RootOptions, createRoot, _default as default, hydrateRoot };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { D as renderNode, S as buildNode, _ as useState } from "../../hooks-Bq5q9IMl.js";
|
|
2
|
+
//#region ../../plugins/acryl-router/src/core/jsx/dom/client.ts
|
|
3
|
+
/**
|
|
4
|
+
* Create a root object for rendering
|
|
5
|
+
* @param element Render target
|
|
6
|
+
* @param options Options for createRoot (not supported yet)
|
|
7
|
+
* @returns Root object has `render` and `unmount` methods
|
|
8
|
+
*/
|
|
9
|
+
const createRoot = (element, options = {}) => {
|
|
10
|
+
let setJsxNode = void 0;
|
|
11
|
+
if (Object.keys(options).length > 0) console.warn("createRoot options are not supported yet");
|
|
12
|
+
return {
|
|
13
|
+
render(jsxNode) {
|
|
14
|
+
if (setJsxNode === null) throw new Error("Cannot update an unmounted root");
|
|
15
|
+
if (setJsxNode) setJsxNode(jsxNode);
|
|
16
|
+
else renderNode(buildNode({
|
|
17
|
+
tag: () => {
|
|
18
|
+
const [_jsxNode, _setJsxNode] = useState(jsxNode);
|
|
19
|
+
setJsxNode = _setJsxNode;
|
|
20
|
+
return _jsxNode;
|
|
21
|
+
},
|
|
22
|
+
props: {}
|
|
23
|
+
}), element);
|
|
24
|
+
},
|
|
25
|
+
unmount() {
|
|
26
|
+
setJsxNode?.(null);
|
|
27
|
+
setJsxNode = null;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Create a root object and hydrate app to the target element.
|
|
33
|
+
* In acryl-router/jsx/dom, hydrate is equivalent to render.
|
|
34
|
+
* @param element Render target
|
|
35
|
+
* @param reactNode A JSXNode to render
|
|
36
|
+
* @param options Options for createRoot (not supported yet)
|
|
37
|
+
* @returns Root object has `render` and `unmount` methods
|
|
38
|
+
*/
|
|
39
|
+
const hydrateRoot = (element, reactNode, options = {}) => {
|
|
40
|
+
const root = createRoot(element, options);
|
|
41
|
+
root.render(reactNode);
|
|
42
|
+
return root;
|
|
43
|
+
};
|
|
44
|
+
var client_default = {
|
|
45
|
+
createRoot,
|
|
46
|
+
hydrateRoot
|
|
47
|
+
};
|
|
48
|
+
//#endregion
|
|
49
|
+
export { createRoot, client_default as default, hydrateRoot };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { a as rawCssString, i as OnInvalidSlug, n as CssClassName, r as CssVariableType, t as ClassNameSlug } from "../../common-D8Z4JRCw.js";
|
|
2
|
+
import { C as PropsWithChildren } from "../../context-DxFdY_un.js";
|
|
3
|
+
import { r as FC } from "../../base-BpQy2Rk7.js";
|
|
4
|
+
|
|
5
|
+
//#region ../../plugins/acryl-router/src/core/jsx/dom/css.d.ts
|
|
6
|
+
interface CreateCssJsxDomObjectsType {
|
|
7
|
+
(args: {
|
|
8
|
+
id: Readonly<string>;
|
|
9
|
+
}): readonly [{
|
|
10
|
+
toString(this: CssClassName): string;
|
|
11
|
+
}, FC<PropsWithChildren<void>>];
|
|
12
|
+
}
|
|
13
|
+
declare const createCssJsxDomObjects: CreateCssJsxDomObjectsType;
|
|
14
|
+
interface CssType {
|
|
15
|
+
(strings: TemplateStringsArray, ...values: CssVariableType[]): string;
|
|
16
|
+
}
|
|
17
|
+
interface CxType {
|
|
18
|
+
(...args: (string | boolean | null | undefined)[]): string;
|
|
19
|
+
}
|
|
20
|
+
interface KeyframesType {
|
|
21
|
+
(strings: TemplateStringsArray, ...values: CssVariableType[]): CssClassName;
|
|
22
|
+
}
|
|
23
|
+
interface ViewTransitionType {
|
|
24
|
+
(strings: TemplateStringsArray, ...values: CssVariableType[]): string;
|
|
25
|
+
(content: string): string;
|
|
26
|
+
(): string;
|
|
27
|
+
}
|
|
28
|
+
interface DefaultContextType {
|
|
29
|
+
css: CssType;
|
|
30
|
+
cx: CxType;
|
|
31
|
+
keyframes: KeyframesType;
|
|
32
|
+
viewTransition: ViewTransitionType;
|
|
33
|
+
Style: FC<PropsWithChildren<void>>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @experimental
|
|
37
|
+
* `createCssContext` is an experimental feature.
|
|
38
|
+
* The API might be changed.
|
|
39
|
+
*
|
|
40
|
+
* @param options.id - The ID for the style element
|
|
41
|
+
* @param options.classNameSlug - Optional function to customize generated CSS class names
|
|
42
|
+
* @param options.onInvalidSlug - Optional callback function called when an invalid slug is returned from ClassNameSlug
|
|
43
|
+
*/
|
|
44
|
+
declare const createCssContext: ({
|
|
45
|
+
id,
|
|
46
|
+
classNameSlug,
|
|
47
|
+
onInvalidSlug
|
|
48
|
+
}: {
|
|
49
|
+
id: Readonly<string>;
|
|
50
|
+
classNameSlug?: ClassNameSlug;
|
|
51
|
+
onInvalidSlug?: OnInvalidSlug;
|
|
52
|
+
}) => DefaultContextType;
|
|
53
|
+
/**
|
|
54
|
+
* @experimental
|
|
55
|
+
* `css` is an experimental feature.
|
|
56
|
+
* The API might be changed.
|
|
57
|
+
*/
|
|
58
|
+
declare const css: CssType;
|
|
59
|
+
/**
|
|
60
|
+
* @experimental
|
|
61
|
+
* `cx` is an experimental feature.
|
|
62
|
+
* The API might be changed.
|
|
63
|
+
*/
|
|
64
|
+
declare const cx: CxType;
|
|
65
|
+
/**
|
|
66
|
+
* @experimental
|
|
67
|
+
* `keyframes` is an experimental feature.
|
|
68
|
+
* The API might be changed.
|
|
69
|
+
*/
|
|
70
|
+
declare const keyframes: KeyframesType;
|
|
71
|
+
/**
|
|
72
|
+
* @experimental
|
|
73
|
+
* `viewTransition` is an experimental feature.
|
|
74
|
+
* The API might be changed.
|
|
75
|
+
*/
|
|
76
|
+
declare const viewTransition: ViewTransitionType;
|
|
77
|
+
/**
|
|
78
|
+
* @experimental
|
|
79
|
+
* `Style` is an experimental feature.
|
|
80
|
+
* The API might be changed.
|
|
81
|
+
*/
|
|
82
|
+
declare const Style: FC<PropsWithChildren<void>>;
|
|
83
|
+
//#endregion
|
|
84
|
+
export { Style, createCssContext, createCssJsxDomObjects, css, cx, keyframes, rawCssString, viewTransition };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _ as rawCssString, a as cx, i as css, n as createCssContext, o as keyframes, r as createCssJsxDomObjects, s as viewTransition, t as Style } from "../../css-D2jb7X8b.js";
|
|
2
|
+
export { Style, createCssContext, createCssJsxDomObjects, css, cx, keyframes, rawCssString, viewTransition };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { C as PropsWithChildren, G as useRef, Q as FallbackRender, Z as ErrorHandler, k as RefObject, t as Context } from "../../context-DxFdY_un.js";
|
|
2
|
+
import { a as JSX, o as JSXNode, r as FC, s as Props, t as Child } from "../../base-BpQy2Rk7.js";
|
|
3
|
+
import { t as _default$1 } from "../../index-C850MeBA.js";
|
|
4
|
+
|
|
5
|
+
//#region ../../plugins/acryl-router/src/core/jsx/dom/server.d.ts
|
|
6
|
+
interface RenderToStringOptions {
|
|
7
|
+
identifierPrefix?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Render JSX element to string.
|
|
11
|
+
* @param element JSX element to render.
|
|
12
|
+
* @param options Options for rendering.
|
|
13
|
+
* @returns Rendered string.
|
|
14
|
+
*/
|
|
15
|
+
declare const renderToString: (element: Child, options?: RenderToStringOptions) => string;
|
|
16
|
+
interface RenderToReadableStreamOptions {
|
|
17
|
+
identifierPrefix?: string;
|
|
18
|
+
namespaceURI?: string;
|
|
19
|
+
nonce?: string;
|
|
20
|
+
bootstrapScriptContent?: string;
|
|
21
|
+
bootstrapScripts?: string[];
|
|
22
|
+
bootstrapModules?: string[];
|
|
23
|
+
progressiveChunkSize?: number;
|
|
24
|
+
signal?: AbortSignal;
|
|
25
|
+
onError?: (error: unknown) => string | void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Render JSX element to readable stream.
|
|
29
|
+
* @param element JSX element to render.
|
|
30
|
+
* @param options Options for rendering.
|
|
31
|
+
* @returns Rendered readable stream.
|
|
32
|
+
*/
|
|
33
|
+
declare const renderToReadableStream: (element: Child, options?: RenderToReadableStreamOptions) => Promise<ReadableStream<Uint8Array>>;
|
|
34
|
+
declare const _default: {
|
|
35
|
+
renderToString: (element: Child, options?: RenderToStringOptions) => string;
|
|
36
|
+
renderToReadableStream: (element: Child, options?: RenderToReadableStreamOptions) => Promise<ReadableStream<Uint8Array>>;
|
|
37
|
+
version: {
|
|
38
|
+
version: string;
|
|
39
|
+
useState: {
|
|
40
|
+
<T>(initialState: T | (() => T)): [T, (newState: T | ((currentState: T) => T)) => void];
|
|
41
|
+
<T = undefined>(): [T | undefined, (newState: T | ((currentState: T | undefined) => T | undefined) | undefined) => void];
|
|
42
|
+
};
|
|
43
|
+
useEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
|
|
44
|
+
useRef: typeof useRef;
|
|
45
|
+
useCallback: <T extends Function>(callback: T, deps: readonly unknown[]) => T;
|
|
46
|
+
use: <T>(promise: Promise<T>) => T;
|
|
47
|
+
startTransition: (callback: () => void) => void;
|
|
48
|
+
useTransition: () => [boolean, (callback: () => void | Promise<void>) => void];
|
|
49
|
+
useDeferredValue: <T>(value: T, initialValue?: T) => T;
|
|
50
|
+
startViewTransition: (callback: () => void) => void;
|
|
51
|
+
useViewTransition: () => [boolean, (callback: () => void) => void];
|
|
52
|
+
useMemo: <T>(factory: () => T, deps: readonly unknown[]) => T;
|
|
53
|
+
useLayoutEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
|
|
54
|
+
useInsertionEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
|
|
55
|
+
useReducer: <T, A>(reducer: (state: T, action: A) => T, initialArg: T, init?: (initialState: T) => T) => [T, (action: A) => void];
|
|
56
|
+
useId: () => string;
|
|
57
|
+
useDebugValue: (_value: unknown, _formatter?: (value: unknown) => string) => void;
|
|
58
|
+
createRef: <T>() => RefObject<T | null>;
|
|
59
|
+
forwardRef: <T, P = {}>(Component: (props: P, ref?: RefObject<T | null>) => JSX.Element) => ((props: P & {
|
|
60
|
+
ref?: RefObject<T | null>;
|
|
61
|
+
}) => JSX.Element);
|
|
62
|
+
useImperativeHandle: <T>(ref: RefObject<T | null>, createHandle: () => T, deps: readonly unknown[]) => void;
|
|
63
|
+
useSyncExternalStore: <T>(subscribe: (callback: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T) => T;
|
|
64
|
+
useFormStatus: () => {
|
|
65
|
+
pending: false;
|
|
66
|
+
data: null;
|
|
67
|
+
method: null;
|
|
68
|
+
action: null;
|
|
69
|
+
} | {
|
|
70
|
+
pending: true;
|
|
71
|
+
data: FormData;
|
|
72
|
+
method: "get" | "post";
|
|
73
|
+
action: string | ((formData: FormData) => void | Promise<void>);
|
|
74
|
+
};
|
|
75
|
+
useActionState: <T>(fn: Function, initialState: T, permalink?: string) => [T, Function];
|
|
76
|
+
useOptimistic: <T, N>(state: T, updateState: (currentState: T, action: N) => T) => [T, (action: N) => void];
|
|
77
|
+
Suspense: FC<PropsWithChildren<{
|
|
78
|
+
fallback: any;
|
|
79
|
+
}>>;
|
|
80
|
+
ErrorBoundary: FC<PropsWithChildren<{
|
|
81
|
+
fallback?: Child;
|
|
82
|
+
fallbackRender?: FallbackRender;
|
|
83
|
+
onError?: ErrorHandler;
|
|
84
|
+
}>>;
|
|
85
|
+
createContext: <T>(defaultValue: T) => Context<T>;
|
|
86
|
+
useContext: <T>(context: Context<T>) => T;
|
|
87
|
+
memo: <T>(component: FC<T>, propsAreEqual?: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean) => FC<T>;
|
|
88
|
+
isValidElement: (element: unknown) => element is JSXNode;
|
|
89
|
+
createElement: (tag: string | ((props: Props) => JSXNode), props: Props | null, ...children: Child[]) => JSXNode;
|
|
90
|
+
cloneElement: <T extends JSXNode | JSX.Element>(element: T, props: Props, ...children: Child[]) => T;
|
|
91
|
+
Children: {
|
|
92
|
+
map: (children: Child[], fn: (child: Child, index: number) => Child) => Child[];
|
|
93
|
+
forEach: (children: Child[], fn: (child: Child, index: number) => void) => void;
|
|
94
|
+
count: (children: Child[]) => number;
|
|
95
|
+
only: (_children: Child[]) => Child;
|
|
96
|
+
toArray: (children: Child) => Child[];
|
|
97
|
+
};
|
|
98
|
+
Fragment: (props: Record<string, unknown>) => JSXNode;
|
|
99
|
+
StrictMode: (props: Record<string, unknown>) => JSXNode;
|
|
100
|
+
flushSync: (callback: () => void) => void;
|
|
101
|
+
createPortal: (children: Child, container: HTMLElement, key?: string) => Child;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
//#endregion
|
|
105
|
+
export { RenderToReadableStreamOptions, RenderToStringOptions, _default as default, renderToReadableStream, renderToString, _default$1 as version };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { u as renderChildren } from "../../base-ddiVmiE7.js";
|
|
2
|
+
import { i as renderToReadableStream$1 } from "../../components-Ce5FRyHU.js";
|
|
3
|
+
import dom_default from "../dom.js";
|
|
4
|
+
//#region ../../plugins/acryl-router/src/core/jsx/dom/server.ts
|
|
5
|
+
const prepareRoot = (element) => typeof element === "string" || Array.isArray(element) ? renderChildren([element]) : element;
|
|
6
|
+
/**
|
|
7
|
+
* Render JSX element to string.
|
|
8
|
+
* @param element JSX element to render.
|
|
9
|
+
* @param options Options for rendering.
|
|
10
|
+
* @returns Rendered string.
|
|
11
|
+
*/
|
|
12
|
+
const renderToString = (element, options = {}) => {
|
|
13
|
+
if (Object.keys(options).length > 0) console.warn("options are not supported yet");
|
|
14
|
+
element = prepareRoot(element);
|
|
15
|
+
const res = element instanceof Promise ? element : element?.toString() ?? "";
|
|
16
|
+
if (typeof res !== "string") throw new Error("Async component is not supported in renderToString");
|
|
17
|
+
return res;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Render JSX element to readable stream.
|
|
21
|
+
* @param element JSX element to render.
|
|
22
|
+
* @param options Options for rendering.
|
|
23
|
+
* @returns Rendered readable stream.
|
|
24
|
+
*/
|
|
25
|
+
const renderToReadableStream = async (element, options = {}) => {
|
|
26
|
+
if (Object.keys(options).some((key) => key !== "onError")) console.warn("options are not supported yet, except onError");
|
|
27
|
+
element = prepareRoot(element);
|
|
28
|
+
if (!element || typeof element !== "object") element = element?.toString() ?? "";
|
|
29
|
+
return renderToReadableStream$1(element, options.onError);
|
|
30
|
+
};
|
|
31
|
+
var server_default = {
|
|
32
|
+
renderToString,
|
|
33
|
+
renderToReadableStream,
|
|
34
|
+
version: dom_default
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { server_default as default, renderToReadableStream, renderToString, dom_default as version };
|
package/lib/jsx/dom.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { A as createRef, B as useImperativeHandle, C as PropsWithChildren, D as TransitionEvent, E as TouchEvent, F as useCallback, G as useRef, H as useLayoutEffect, I as useDebugValue, J as useTransition, K as useState, L as useDeferredValue, M as startTransition, N as startViewTransition, O as WheelEvent, P as use, R as useEffect, S as PointerEvent, T as ReactNode, U as useMemo, V as useInsertionEffect, W as useReducer, Y as useViewTransition, _ as Event, b as KeyboardEvent, c as useActionState, d as Children, f as AnimationEvent, g as DragEvent, h as ComponentClass, j as forwardRef, k as RefObject, l as useFormStatus, m as ClipboardEvent, p as CSSProperties, q as useSyncExternalStore, r as useContext, t as Context, u as useOptimistic, v as FocusEvent, w as ReactElement, x as MouseEvent, y as InputEvent, z as useId } from "../context-DxFdY_un.js";
|
|
2
|
+
import { f as reactAPICompatVersion, l as isValidElement, n as DOMAttributes, o as JSXNode, r as FC, t as Child } from "../base-BpQy2Rk7.js";
|
|
3
|
+
import { a as createPortal, c as createContext, i as memo, l as ErrorBoundary, n as cloneElement, o as flushSync, r as createElement, s as render, t as _default, u as Suspense } from "../index-C850MeBA.js";
|
|
4
|
+
import { t as Fragment } from "../jsx-dev-runtime-B22O-Npk.js";
|
|
5
|
+
export { type AnimationEvent, type CSSProperties, type Child, Children, type ClipboardEvent, type ComponentClass, type Context, type DOMAttributes, type DragEvent, ErrorBoundary, type Event, type FC, type FocusEvent, Fragment, Fragment as StrictMode, type InputEvent, type JSXNode, type KeyboardEvent, type MouseEvent, type PointerEvent, type PropsWithChildren, type ReactElement, type ReactNode, type RefObject, Suspense, type TouchEvent, type TransitionEvent, type WheelEvent, cloneElement, createContext, createElement, createElement as jsx, createPortal, createRef, _default as default, flushSync, forwardRef, isValidElement, memo, render, startTransition, startViewTransition, use, useActionState, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useFormStatus, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition, useViewTransition, reactAPICompatVersion as version };
|
package/lib/jsx/dom.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { D as createContext, E as useContext, a as isValidElement, f as shallowEqual, g as Children, l as reactAPICompatVersion } from "../base-ddiVmiE7.js";
|
|
2
|
+
import { r as DOM_MEMO } from "../constants-BR9jM9BC.js";
|
|
3
|
+
import { C as createPortal, E as render, _ as useState, a as use, b as useViewTransition, c as useDeferredValue, d as useImperativeHandle, f as useInsertionEffect, g as useRef, h as useReducer, i as startViewTransition, l as useEffect, m as useMemo, n as forwardRef, o as useCallback, p as useLayoutEffect, r as startTransition, s as useDebugValue, t as createRef, u as useId, v as useSyncExternalStore, w as flushSync, y as useTransition } from "../hooks-Bq5q9IMl.js";
|
|
4
|
+
import { a as useOptimistic, i as useFormStatus, n as jsxDEV, r as useActionState, t as Fragment } from "../jsx-dev-runtime-kAhR_4C7.js";
|
|
5
|
+
import "./dom/jsx-runtime.js";
|
|
6
|
+
import { n as Suspense, t as ErrorBoundary } from "../components-DYZdxJIJ.js";
|
|
7
|
+
//#region ../../plugins/acryl-router/src/core/jsx/dom/index.ts
|
|
8
|
+
/**
|
|
9
|
+
* @module
|
|
10
|
+
* This module provides APIs for `acryl-router/jsx/dom`.
|
|
11
|
+
*/
|
|
12
|
+
const createElement = (tag, props, ...children) => {
|
|
13
|
+
const jsxProps = props ? { ...props } : {};
|
|
14
|
+
if (children.length) jsxProps.children = children.length === 1 ? children[0] : children;
|
|
15
|
+
let key = void 0;
|
|
16
|
+
if ("key" in jsxProps) {
|
|
17
|
+
key = jsxProps.key;
|
|
18
|
+
delete jsxProps.key;
|
|
19
|
+
}
|
|
20
|
+
return jsxDEV(tag, jsxProps, key);
|
|
21
|
+
};
|
|
22
|
+
const cloneElement = (element, props, ...children) => {
|
|
23
|
+
return jsxDEV(element.tag, {
|
|
24
|
+
...element.props,
|
|
25
|
+
...props,
|
|
26
|
+
children: children.length ? children : element.props.children
|
|
27
|
+
}, element.key);
|
|
28
|
+
};
|
|
29
|
+
const memo = (component, propsAreEqual = shallowEqual) => {
|
|
30
|
+
const wrapper = ((props) => component(props));
|
|
31
|
+
wrapper[DOM_MEMO] = propsAreEqual;
|
|
32
|
+
return wrapper;
|
|
33
|
+
};
|
|
34
|
+
var dom_default = {
|
|
35
|
+
version: reactAPICompatVersion,
|
|
36
|
+
useState,
|
|
37
|
+
useEffect,
|
|
38
|
+
useRef,
|
|
39
|
+
useCallback,
|
|
40
|
+
use,
|
|
41
|
+
startTransition,
|
|
42
|
+
useTransition,
|
|
43
|
+
useDeferredValue,
|
|
44
|
+
startViewTransition,
|
|
45
|
+
useViewTransition,
|
|
46
|
+
useMemo,
|
|
47
|
+
useLayoutEffect,
|
|
48
|
+
useInsertionEffect,
|
|
49
|
+
useReducer,
|
|
50
|
+
useId,
|
|
51
|
+
useDebugValue,
|
|
52
|
+
createRef,
|
|
53
|
+
forwardRef,
|
|
54
|
+
useImperativeHandle,
|
|
55
|
+
useSyncExternalStore,
|
|
56
|
+
useFormStatus,
|
|
57
|
+
useActionState,
|
|
58
|
+
useOptimistic,
|
|
59
|
+
Suspense,
|
|
60
|
+
ErrorBoundary,
|
|
61
|
+
createContext,
|
|
62
|
+
useContext,
|
|
63
|
+
memo,
|
|
64
|
+
isValidElement,
|
|
65
|
+
createElement,
|
|
66
|
+
cloneElement,
|
|
67
|
+
Children,
|
|
68
|
+
Fragment,
|
|
69
|
+
StrictMode: Fragment,
|
|
70
|
+
flushSync,
|
|
71
|
+
createPortal
|
|
72
|
+
};
|
|
73
|
+
//#endregion
|
|
74
|
+
export { Children, ErrorBoundary, Fragment, Fragment as StrictMode, Suspense, cloneElement, createContext, createElement, createElement as jsx, createPortal, createRef, dom_default as default, flushSync, forwardRef, isValidElement, memo, render, startTransition, startViewTransition, use, useActionState, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useFormStatus, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition, useViewTransition, reactAPICompatVersion as version };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { a as JSX, i as Fragment, o as JSXNode } from "../base-BpQy2Rk7.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../plugins/acryl-router/src/core/jsx/jsx-dev-runtime.d.ts
|
|
4
|
+
declare function jsxDEV(tag: string | Function, props: Record<string, unknown>, key?: string): JSXNode;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { Fragment, type JSX, jsxDEV };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { s as jsxFn, t as Fragment } from "../base-ddiVmiE7.js";
|
|
2
|
+
//#region ../../plugins/acryl-router/src/core/jsx/jsx-dev-runtime.ts
|
|
3
|
+
function jsxDEV(tag, props, key) {
|
|
4
|
+
let node;
|
|
5
|
+
if (!props || !("children" in props)) node = jsxFn(tag, props, []);
|
|
6
|
+
else {
|
|
7
|
+
const children = props.children;
|
|
8
|
+
node = Array.isArray(children) ? jsxFn(tag, props, children) : jsxFn(tag, props, [children]);
|
|
9
|
+
}
|
|
10
|
+
node.key = key;
|
|
11
|
+
return node;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Fragment, jsxDEV };
|