mono-jsx 0.2.0 → 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/types/mono.d.ts CHANGED
@@ -101,9 +101,10 @@ export interface Elements {
101
101
  }
102
102
 
103
103
  declare global {
104
- type FC<T = Record<string, unknown>, Context = Record<string, unknown>> = {
105
- context: Context;
106
- request: Request;
107
- computed: <V = unknown>(fn: () => V) => V;
108
- } & Omit<T, "request" | "computed">;
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">;
109
110
  }
package/types/render.d.ts CHANGED
@@ -1,7 +1,38 @@
1
- export interface RenderOptions {
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
+ */
2
23
  context?: Record<string, unknown>;
24
+ /**
25
+ * Current `Request` object to be passed to components.
26
+ */
3
27
  request?: Request;
28
+ /**
29
+ * The HTTP status code to be sent with the response.
30
+ * @defaultValue `200`
31
+ */
4
32
  status?: number;
33
+ /**
34
+ * The HTTP headers to be sent with the response.
35
+ */
5
36
  headers?: {
6
37
  [key: string]: string | undefined;
7
38
  contentSecurityPolicy?: string;
@@ -10,5 +41,15 @@ export interface RenderOptions {
10
41
  lastModified?: string;
11
42
  setCookie?: string;
12
43
  };
44
+ /**
45
+ * Rendering mode.
46
+ * - **eager**: Render the component immediately.
47
+ */
13
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;
14
55
  }