@benqoder/beam 0.1.2 → 0.2.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 +308 -89
- package/dist/client.d.ts +14 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +307 -129
- package/dist/collect.d.ts +1 -47
- package/dist/collect.d.ts.map +1 -1
- package/dist/collect.js +0 -64
- package/dist/createBeam.d.ts +50 -17
- package/dist/createBeam.d.ts.map +1 -1
- package/dist/createBeam.js +265 -86
- package/dist/index.d.ts +3 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/types.d.ts +83 -16
- package/dist/types.d.ts.map +1 -1
- package/dist/vite.d.ts +0 -12
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +4 -10
- package/package.json +2 -2
- package/src/beam.css +2 -0
- package/dist/DrawerFrame.d.ts +0 -16
- package/dist/DrawerFrame.d.ts.map +0 -1
- package/dist/DrawerFrame.js +0 -12
- package/dist/ModalFrame.d.ts +0 -12
- package/dist/ModalFrame.d.ts.map +0 -1
- package/dist/ModalFrame.js +0 -8
package/dist/types.d.ts
CHANGED
|
@@ -24,6 +24,10 @@ export interface BeamSession {
|
|
|
24
24
|
export interface RenderOptions {
|
|
25
25
|
/** JavaScript to execute on client after rendering */
|
|
26
26
|
script?: string;
|
|
27
|
+
/** CSS selector for target element (overrides frontend target) */
|
|
28
|
+
target?: string;
|
|
29
|
+
/** Swap mode: 'morph' | 'replace' | 'append' | 'prepend' | 'delete' */
|
|
30
|
+
swap?: string;
|
|
27
31
|
}
|
|
28
32
|
/**
|
|
29
33
|
* Context passed to all handlers
|
|
@@ -39,44 +43,102 @@ export interface BeamContext<TEnv = object> {
|
|
|
39
43
|
*/
|
|
40
44
|
script(code: string): ActionResponse;
|
|
41
45
|
/**
|
|
42
|
-
* Return HTML with optional script to execute
|
|
46
|
+
* Return HTML with optional script to execute.
|
|
47
|
+
* Accepts JSX directly (converts to string), single string, or array for multi-target rendering.
|
|
43
48
|
* @example ctx.render(<ProductList />, { script: 'playSound("ding")' })
|
|
49
|
+
* @example ctx.render([<StatsWidget />, <NotificationList />], { target: '#stats, #notifications' })
|
|
50
|
+
* @example ctx.render([<div id="stats">...</div>, <div id="notifications">...</div>]) // auto-detects targets by ID
|
|
44
51
|
*/
|
|
45
|
-
render(
|
|
52
|
+
render(content: string | Promise<string> | (string | Promise<string>)[], options?: RenderOptions): ActionResponse | Promise<ActionResponse>;
|
|
46
53
|
/**
|
|
47
54
|
* Redirect the client to a new URL
|
|
48
55
|
* @example ctx.redirect('/dashboard')
|
|
49
56
|
* @example ctx.redirect('https://example.com')
|
|
50
57
|
*/
|
|
51
58
|
redirect(url: string): ActionResponse;
|
|
59
|
+
/**
|
|
60
|
+
* Open a modal with HTML content
|
|
61
|
+
* @example ctx.modal(render(<MyModal />))
|
|
62
|
+
* @example ctx.modal(render(<MyModal />), { size: 'large', spacing: 20 })
|
|
63
|
+
*/
|
|
64
|
+
modal(html: string | Promise<string>, options?: {
|
|
65
|
+
size?: string;
|
|
66
|
+
spacing?: number;
|
|
67
|
+
}): ActionResponse | Promise<ActionResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* Open a drawer with HTML content
|
|
70
|
+
* @example ctx.drawer(render(<MyDrawer />))
|
|
71
|
+
* @example ctx.drawer(render(<MyDrawer />), { position: 'left', size: 'large', spacing: 20 })
|
|
72
|
+
*/
|
|
73
|
+
drawer(html: string | Promise<string>, options?: {
|
|
74
|
+
position?: string;
|
|
75
|
+
size?: string;
|
|
76
|
+
spacing?: number;
|
|
77
|
+
}): ActionResponse | Promise<ActionResponse>;
|
|
52
78
|
}
|
|
53
79
|
/**
|
|
54
80
|
* Auth resolver function - user provides this to extract user from request
|
|
55
81
|
*/
|
|
56
82
|
export type AuthResolver<TEnv = object> = (request: Request, env: TEnv) => Promise<BeamUser | null>;
|
|
83
|
+
/**
|
|
84
|
+
* Auth token payload - signed and short-lived
|
|
85
|
+
* Used for secure in-band WebSocket authentication
|
|
86
|
+
*/
|
|
87
|
+
export interface AuthTokenPayload {
|
|
88
|
+
/** Session ID */
|
|
89
|
+
sid: string;
|
|
90
|
+
/** User ID (null for guest) */
|
|
91
|
+
uid: string | null;
|
|
92
|
+
/** Expiration timestamp (ms) */
|
|
93
|
+
exp: number;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Auth token configuration
|
|
97
|
+
*/
|
|
98
|
+
export interface AuthTokenConfig {
|
|
99
|
+
/** Token lifetime in milliseconds (default: 5 minutes) */
|
|
100
|
+
tokenLifetime?: number;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Modal options for ActionResponse
|
|
104
|
+
*/
|
|
105
|
+
export interface ModalOptions {
|
|
106
|
+
html: string;
|
|
107
|
+
size?: string;
|
|
108
|
+
spacing?: number;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Drawer options for ActionResponse
|
|
112
|
+
*/
|
|
113
|
+
export interface DrawerOptions {
|
|
114
|
+
html: string;
|
|
115
|
+
position?: string;
|
|
116
|
+
size?: string;
|
|
117
|
+
spacing?: number;
|
|
118
|
+
}
|
|
57
119
|
/**
|
|
58
120
|
* Response type for actions - can include HTML and/or script to execute
|
|
59
121
|
*/
|
|
60
122
|
export interface ActionResponse {
|
|
61
|
-
/** HTML to render (optional) */
|
|
62
|
-
html?: string;
|
|
123
|
+
/** HTML to render (optional) - single string or array of HTML strings for multi-target rendering */
|
|
124
|
+
html?: string | string[];
|
|
63
125
|
/** JavaScript to execute on client (optional) */
|
|
64
126
|
script?: string;
|
|
65
127
|
/** URL to redirect to (optional) */
|
|
66
128
|
redirect?: string;
|
|
129
|
+
/** CSS selector for target element (optional - overrides frontend target). Can be comma-separated for array html: "#a, #b, #c" */
|
|
130
|
+
target?: string;
|
|
131
|
+
/** Swap mode: 'morph' | 'replace' | 'append' | 'prepend' | 'delete' (optional) */
|
|
132
|
+
swap?: string;
|
|
133
|
+
/** Open a modal with HTML content */
|
|
134
|
+
modal?: string | ModalOptions;
|
|
135
|
+
/** Open a drawer with HTML content */
|
|
136
|
+
drawer?: string | DrawerOptions;
|
|
67
137
|
}
|
|
68
138
|
/**
|
|
69
139
|
* Type for action handlers - receives context and data, returns ActionResponse
|
|
70
140
|
*/
|
|
71
141
|
export type ActionHandler<TEnv = object> = (ctx: BeamContext<TEnv>, data: Record<string, unknown>) => Promise<ActionResponse> | ActionResponse;
|
|
72
|
-
/**
|
|
73
|
-
* Type for modal handlers - receives context and params, returns HTML string
|
|
74
|
-
*/
|
|
75
|
-
export type ModalHandler<TEnv = object> = (ctx: BeamContext<TEnv>, params: Record<string, unknown>) => Promise<string>;
|
|
76
|
-
/**
|
|
77
|
-
* Type for drawer handlers - receives context and params, returns HTML string
|
|
78
|
-
*/
|
|
79
|
-
export type DrawerHandler<TEnv = object> = (ctx: BeamContext<TEnv>, params: Record<string, unknown>) => Promise<string>;
|
|
80
142
|
/**
|
|
81
143
|
* Factory function to create a session storage adapter.
|
|
82
144
|
* Called with the session ID and environment, returns a BeamSession implementation.
|
|
@@ -109,8 +171,6 @@ export interface SessionConfig<TEnv = object> {
|
|
|
109
171
|
*/
|
|
110
172
|
export interface BeamConfig<TEnv = object> {
|
|
111
173
|
actions: Record<string, ActionHandler<TEnv>>;
|
|
112
|
-
modals: Record<string, ModalHandler<TEnv>>;
|
|
113
|
-
drawers?: Record<string, DrawerHandler<TEnv>>;
|
|
114
174
|
auth?: AuthResolver<TEnv>;
|
|
115
175
|
/** Session config - default uses cookie storage, or provide storageFactory for custom storage */
|
|
116
176
|
session?: SessionConfig<TEnv>;
|
|
@@ -128,14 +188,14 @@ export interface BeamInitOptions {
|
|
|
128
188
|
*/
|
|
129
189
|
export interface BeamVariables<TEnv = object> {
|
|
130
190
|
beam: BeamContext<TEnv>;
|
|
191
|
+
/** Short-lived auth token for in-band WebSocket authentication */
|
|
192
|
+
beamAuthToken: string;
|
|
131
193
|
}
|
|
132
194
|
/**
|
|
133
195
|
* The Beam instance returned by createBeam
|
|
134
196
|
*/
|
|
135
197
|
export interface BeamInstance<TEnv extends object = object> {
|
|
136
198
|
actions: Record<string, ActionHandler<TEnv>>;
|
|
137
|
-
modals: Record<string, ModalHandler<TEnv>>;
|
|
138
|
-
drawers: Record<string, DrawerHandler<TEnv>>;
|
|
139
199
|
/** Auth resolver (if provided) */
|
|
140
200
|
auth: AuthResolver<TEnv> | undefined;
|
|
141
201
|
/** Init function for HonoX createApp({ init(app) { beam.init(app, options) } }) */
|
|
@@ -147,5 +207,12 @@ export interface BeamInstance<TEnv extends object = object> {
|
|
|
147
207
|
Bindings: TEnv;
|
|
148
208
|
Variables: BeamVariables<TEnv>;
|
|
149
209
|
}>;
|
|
210
|
+
/**
|
|
211
|
+
* Generate a short-lived auth token for in-band WebSocket authentication.
|
|
212
|
+
* This token should be embedded in the page and used by the client to authenticate.
|
|
213
|
+
* @param ctx - The Beam context (from authMiddleware)
|
|
214
|
+
* @returns A signed, short-lived token string
|
|
215
|
+
*/
|
|
216
|
+
generateAuthToken: (ctx: BeamContext<TEnv>) => Promise<string>;
|
|
150
217
|
}
|
|
151
218
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAA;AAEnD;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,6BAA6B;IAC7B,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;IAChD,2BAA2B;IAC3B,GA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,CAAA;KAAE,CAAC,EAAE,OAAO,CAAC,EAAE,eAAe,KAAK,IAAI,CAAA;IACxE,kFAAkF;IAClF,cAAc,EAAE,MAAM,iBAAiB,CAAC;QAAE,QAAQ,EAAE,IAAI,CAAC;QAAC,SAAS,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;KAAE,CAAC,CAAA;IAC3F;;;;;OAKG;IACH,iBAAiB,EAAE,CAAC,GAAG,EAAE,WAAW,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CAC/D"}
|
package/dist/vite.d.ts
CHANGED
|
@@ -5,16 +5,6 @@ export interface BeamPluginOptions {
|
|
|
5
5
|
* @default '/app/actions/*.tsx'
|
|
6
6
|
*/
|
|
7
7
|
actions?: string;
|
|
8
|
-
/**
|
|
9
|
-
* Glob pattern for modal handlers (must start with '/' for virtual modules)
|
|
10
|
-
* @default '/app/modals/*.tsx'
|
|
11
|
-
*/
|
|
12
|
-
modals?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Glob pattern for drawer handlers (must start with '/' for virtual modules)
|
|
15
|
-
* @default '/app/drawers/*.tsx'
|
|
16
|
-
*/
|
|
17
|
-
drawers?: string;
|
|
18
8
|
/**
|
|
19
9
|
* Path to auth resolver module (must export default AuthResolver function)
|
|
20
10
|
* @example '/app/auth.ts'
|
|
@@ -55,8 +45,6 @@ export interface BeamPluginOptions {
|
|
|
55
45
|
* plugins: [
|
|
56
46
|
* beamPlugin({
|
|
57
47
|
* actions: '/app/actions/*.tsx',
|
|
58
|
-
* modals: '/app/modals/*.tsx',
|
|
59
|
-
* drawers: '/app/drawers/*.tsx',
|
|
60
48
|
* })
|
|
61
49
|
* ]
|
|
62
50
|
* })
|
package/dist/vite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG;QAClB,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,wFAAwF;QACxF,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB,CAAA;CACF;AAKD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,MAAM,CA0DlE;AAED,eAAe,UAAU,CAAA"}
|
package/dist/vite.js
CHANGED
|
@@ -12,8 +12,6 @@ const RESOLVED_VIRTUAL_MODULE_ID = '\0' + VIRTUAL_MODULE_ID;
|
|
|
12
12
|
* plugins: [
|
|
13
13
|
* beamPlugin({
|
|
14
14
|
* actions: '/app/actions/*.tsx',
|
|
15
|
-
* modals: '/app/modals/*.tsx',
|
|
16
|
-
* drawers: '/app/drawers/*.tsx',
|
|
17
15
|
* })
|
|
18
16
|
* ]
|
|
19
17
|
* })
|
|
@@ -25,7 +23,7 @@ const RESOLVED_VIRTUAL_MODULE_ID = '\0' + VIRTUAL_MODULE_ID;
|
|
|
25
23
|
* ```
|
|
26
24
|
*/
|
|
27
25
|
export function beamPlugin(options = {}) {
|
|
28
|
-
const { actions = '/app/actions/*.tsx',
|
|
26
|
+
const { actions = '/app/actions/*.tsx', auth, session, } = options;
|
|
29
27
|
return {
|
|
30
28
|
name: 'beam-plugin',
|
|
31
29
|
resolveId(id) {
|
|
@@ -60,17 +58,13 @@ export function beamPlugin(options = {}) {
|
|
|
60
58
|
}
|
|
61
59
|
// Generate plain JavaScript - TypeScript types are handled via virtual-beam.d.ts
|
|
62
60
|
return `
|
|
63
|
-
import { createBeam,
|
|
61
|
+
import { createBeam, collectActions } from '@benqoder/beam'
|
|
64
62
|
${authImport}
|
|
65
63
|
${storageImport}
|
|
66
64
|
|
|
67
|
-
const {
|
|
68
|
-
actions: import.meta.glob('${actions}', { eager: true }),
|
|
69
|
-
modals: import.meta.glob('${modals}', { eager: true }),
|
|
70
|
-
drawers: import.meta.glob('${drawers}', { eager: true }),
|
|
71
|
-
})
|
|
65
|
+
const actions = collectActions(import.meta.glob('${actions}', { eager: true }))
|
|
72
66
|
|
|
73
|
-
export const beam = createBeam({ actions
|
|
67
|
+
export const beam = createBeam({ actions${authConfig}${sessionConfig} })
|
|
74
68
|
`;
|
|
75
69
|
}
|
|
76
70
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@benqoder/beam",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@cloudflare/workers-types": "^4.
|
|
54
|
+
"@cloudflare/workers-types": "^4.20260124.0",
|
|
55
55
|
"capnweb": "^0.4.0",
|
|
56
56
|
"hono": "^4.6.0",
|
|
57
57
|
"honox": "^0.1.0",
|
package/src/beam.css
CHANGED
|
@@ -127,6 +127,7 @@
|
|
|
127
127
|
transform: scale(0.95);
|
|
128
128
|
opacity: 0;
|
|
129
129
|
transition: transform 200ms ease-out, opacity 200ms ease-out;
|
|
130
|
+
padding: 15px;
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
#modal-backdrop.open #modal-content {
|
|
@@ -175,6 +176,7 @@
|
|
|
175
176
|
max-height: 100vh;
|
|
176
177
|
overflow: auto;
|
|
177
178
|
transition: transform 200ms ease-out;
|
|
179
|
+
padding: 15px;
|
|
178
180
|
}
|
|
179
181
|
|
|
180
182
|
/* Drawer positions */
|
package/dist/DrawerFrame.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Child } from 'hono/jsx';
|
|
2
|
-
type Props = {
|
|
3
|
-
title: string;
|
|
4
|
-
children: Child;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Reusable drawer wrapper component.
|
|
8
|
-
* Provides consistent header with title and close button.
|
|
9
|
-
*
|
|
10
|
-
* Note: The position (left/right) and size (small/medium/large) are
|
|
11
|
-
* controlled by the client via beam-position and beam-size attributes
|
|
12
|
-
* on the trigger element.
|
|
13
|
-
*/
|
|
14
|
-
export declare function DrawerFrame({ title, children }: Props): import("hono/jsx/jsx-dev-runtime").JSX.Element;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=DrawerFrame.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerFrame.d.ts","sourceRoot":"","sources":["../src/DrawerFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAErC,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,KAAK,CAAA;CAChB,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,KAAK,kDAcrD"}
|
package/dist/DrawerFrame.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "hono/jsx/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* Reusable drawer wrapper component.
|
|
4
|
-
* Provides consistent header with title and close button.
|
|
5
|
-
*
|
|
6
|
-
* Note: The position (left/right) and size (small/medium/large) are
|
|
7
|
-
* controlled by the client via beam-position and beam-size attributes
|
|
8
|
-
* on the trigger element.
|
|
9
|
-
*/
|
|
10
|
-
export function DrawerFrame({ title, children }) {
|
|
11
|
-
return (_jsxs(_Fragment, { children: [_jsxs("header", { class: "drawer-header", children: [_jsx("h2", { children: title }), _jsx("button", { type: "button", "beam-close": true, "aria-label": "Close", class: "drawer-close", children: "\u00D7" })] }), _jsx("div", { class: "drawer-body", children: children })] }));
|
|
12
|
-
}
|
package/dist/ModalFrame.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Child } from 'hono/jsx';
|
|
2
|
-
type Props = {
|
|
3
|
-
title: string;
|
|
4
|
-
children: Child;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Reusable modal wrapper component.
|
|
8
|
-
* Provides consistent header with title and close button.
|
|
9
|
-
*/
|
|
10
|
-
export declare function ModalFrame({ title, children }: Props): import("hono/jsx/jsx-dev-runtime").JSX.Element;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=ModalFrame.d.ts.map
|
package/dist/ModalFrame.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModalFrame.d.ts","sourceRoot":"","sources":["../src/ModalFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAErC,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,KAAK,CAAA;CAChB,CAAA;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,KAAK,kDAcpD"}
|
package/dist/ModalFrame.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "hono/jsx/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* Reusable modal wrapper component.
|
|
4
|
-
* Provides consistent header with title and close button.
|
|
5
|
-
*/
|
|
6
|
-
export function ModalFrame({ title, children }) {
|
|
7
|
-
return (_jsxs(_Fragment, { children: [_jsxs("header", { class: "modal-header", children: [_jsx("h2", { children: title }), _jsx("button", { type: "button", "beam-close": true, "aria-label": "Close", class: "modal-close", children: "\u00D7" })] }), _jsx("div", { class: "modal-body", children: children })] }));
|
|
8
|
-
}
|