@benqoder/beam 0.1.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/LICENSE +21 -0
- package/README.md +1574 -0
- package/dist/DrawerFrame.d.ts +16 -0
- package/dist/DrawerFrame.d.ts.map +1 -0
- package/dist/DrawerFrame.js +12 -0
- package/dist/ModalFrame.d.ts +12 -0
- package/dist/ModalFrame.d.ts.map +1 -0
- package/dist/ModalFrame.js +8 -0
- package/dist/client.d.ts +41 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +1847 -0
- package/dist/collect.d.ts +68 -0
- package/dist/collect.d.ts.map +1 -0
- package/dist/collect.js +90 -0
- package/dist/createBeam.d.ts +104 -0
- package/dist/createBeam.d.ts.map +1 -0
- package/dist/createBeam.js +421 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/render.d.ts +7 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +7 -0
- package/dist/types.d.ts +151 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/vite.d.ts +72 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +79 -0
- package/package.json +62 -0
- package/src/beam.css +288 -0
- package/src/virtual-beam.d.ts +4 -0
|
@@ -0,0 +1,16 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type RpcStub } from 'capnweb';
|
|
2
|
+
interface ActionResponse {
|
|
3
|
+
html?: string;
|
|
4
|
+
script?: string;
|
|
5
|
+
redirect?: string;
|
|
6
|
+
}
|
|
7
|
+
interface BeamServer {
|
|
8
|
+
call(action: string, data?: Record<string, unknown>): Promise<ActionResponse>;
|
|
9
|
+
modal(modalId: string, data?: Record<string, unknown>): Promise<string>;
|
|
10
|
+
drawer(drawerId: string, data?: Record<string, unknown>): Promise<string>;
|
|
11
|
+
registerCallback(callback: (event: string, data: unknown) => void): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
type BeamServerStub = RpcStub<BeamServer>;
|
|
14
|
+
declare function closeModal(): void;
|
|
15
|
+
declare function closeDrawer(): void;
|
|
16
|
+
declare function showToast(message: string, type?: 'success' | 'error'): void;
|
|
17
|
+
declare function clearCache(action?: string): void;
|
|
18
|
+
interface CallOptions {
|
|
19
|
+
target?: string;
|
|
20
|
+
swap?: string;
|
|
21
|
+
}
|
|
22
|
+
declare function clearScrollState(actionOrAll?: string | boolean): void;
|
|
23
|
+
declare const beamUtils: {
|
|
24
|
+
showToast: typeof showToast;
|
|
25
|
+
closeModal: typeof closeModal;
|
|
26
|
+
closeDrawer: typeof closeDrawer;
|
|
27
|
+
clearCache: typeof clearCache;
|
|
28
|
+
clearScrollState: typeof clearScrollState;
|
|
29
|
+
isOnline: () => boolean;
|
|
30
|
+
getSession: () => Promise<BeamServerStub>;
|
|
31
|
+
};
|
|
32
|
+
type ActionCaller = (data?: Record<string, unknown>, options?: string | CallOptions) => Promise<ActionResponse>;
|
|
33
|
+
declare global {
|
|
34
|
+
interface Window {
|
|
35
|
+
beam: typeof beamUtils & {
|
|
36
|
+
[action: string]: ActionCaller;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAA0B,KAAK,OAAO,EAAE,MAAM,SAAS,CAAA;AAkB9D,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAGD,UAAU,UAAU;IAClB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAA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