mono-jsx 0.1.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +230 -63
- package/bin/mono-jsx +2 -24
- package/jsx-runtime.mjs +166 -165
- package/package.json +10 -6
- package/setup.mjs +58 -0
- package/types/css.d.ts +1 -1
- package/types/html.d.ts +3 -2
- package/types/htmx.d.ts +791 -0
- package/types/index.d.ts +1 -0
- package/types/jsx.d.ts +0 -1
- package/types/mono.d.ts +9 -4
- package/types/render.d.ts +43 -1
package/types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/types/jsx.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import type * as Mono from "./mono.d.ts";
|
|
|
4
4
|
import type { HTML } from "./html.d.ts";
|
|
5
5
|
|
|
6
6
|
export type ChildType = VNode | string | number | bigint | boolean | null;
|
|
7
|
-
export type Children = ChildType | (ChildType | ChildType[])[];
|
|
8
7
|
|
|
9
8
|
export type VNode = readonly [
|
|
10
9
|
tag: string | symbol | FC<any>,
|
package/types/mono.d.ts
CHANGED
|
@@ -66,7 +66,10 @@ export interface CSSProperties extends BaseCSSProperties, AtRuleCSSProperties, P
|
|
|
66
66
|
[key: `&${" " | "." | "["}${string}`]: CSSProperties;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
export type ChildType = JSX.Element | string | number | bigint | boolean | null;
|
|
70
|
+
|
|
69
71
|
export interface BaseAttributes {
|
|
72
|
+
children?: ChildType | (ChildType)[];
|
|
70
73
|
key?: string | number;
|
|
71
74
|
slot?: string;
|
|
72
75
|
}
|
|
@@ -98,8 +101,10 @@ export interface Elements {
|
|
|
98
101
|
}
|
|
99
102
|
|
|
100
103
|
declare global {
|
|
101
|
-
type FC<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
type FC<S = Record<string, unknown>, AppState = Record<string, unknown>, Context = Record<string, unknown>> = {
|
|
105
|
+
readonly app: AppState;
|
|
106
|
+
readonly context: Context;
|
|
107
|
+
readonly request: Request;
|
|
108
|
+
readonly computed: <V = unknown>(computeFn: () => V) => V;
|
|
109
|
+
} & Omit<S, "app" | "context" | "request" | "computed">;
|
|
105
110
|
}
|
package/types/render.d.ts
CHANGED
|
@@ -1,6 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Htmx extensions.
|
|
3
|
+
* @see https://htmx.org/docs/#extensions
|
|
4
|
+
*/
|
|
5
|
+
type HtmxExts = {
|
|
6
|
+
[key in `html-ext-${JSX.HtmxExtensions[keyof JSX.HtmxExtensions]}`]:
|
|
7
|
+
| number
|
|
8
|
+
| string
|
|
9
|
+
| boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Render options for the `render` function.
|
|
14
|
+
*/
|
|
15
|
+
export interface RenderOptions extends Partial<HtmxExts> {
|
|
16
|
+
/**
|
|
17
|
+
* Initial state of the application.
|
|
18
|
+
*/
|
|
19
|
+
appState?: Record<string, unknown>;
|
|
20
|
+
/**
|
|
21
|
+
* The context object to be passed to components.
|
|
22
|
+
*/
|
|
23
|
+
context?: Record<string, unknown>;
|
|
24
|
+
/**
|
|
25
|
+
* Current `Request` object to be passed to components.
|
|
26
|
+
*/
|
|
2
27
|
request?: Request;
|
|
28
|
+
/**
|
|
29
|
+
* The HTTP status code to be sent with the response.
|
|
30
|
+
* @defaultValue `200`
|
|
31
|
+
*/
|
|
3
32
|
status?: number;
|
|
33
|
+
/**
|
|
34
|
+
* The HTTP headers to be sent with the response.
|
|
35
|
+
*/
|
|
4
36
|
headers?: {
|
|
5
37
|
[key: string]: string | undefined;
|
|
6
38
|
contentSecurityPolicy?: string;
|
|
@@ -9,5 +41,15 @@ export interface RenderOptions {
|
|
|
9
41
|
lastModified?: string;
|
|
10
42
|
setCookie?: string;
|
|
11
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* Rendering mode.
|
|
46
|
+
* - **eager**: Render the component immediately.
|
|
47
|
+
*/
|
|
12
48
|
rendering?: "eager";
|
|
49
|
+
/**
|
|
50
|
+
* Install htmx script with the given version.
|
|
51
|
+
* @see https://htmx.org/
|
|
52
|
+
* @defaultValue `false`
|
|
53
|
+
*/
|
|
54
|
+
htmx?: number | string | boolean;
|
|
13
55
|
}
|