@betterportal/theme-runtime 1.0.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 ADDED
@@ -0,0 +1,25 @@
1
+ # @betterportal/theme-runtime
2
+
3
+ Shared browser-shell runtime for BetterPortal Node theme packages.
4
+
5
+ The package assembles one JavaScript asset on the backend in this order:
6
+
7
+ 1. HTMX core from the installed `htmx.org` package.
8
+ 2. The theme's presentation adapter.
9
+ 3. The BetterPortal `bp-shell` runtime.
10
+ 4. The bundled HTMX SSE extension.
11
+
12
+ The browser never discovers or loads extensions dynamically. Required assets are resolved by the backend and missing assets fail bundle creation.
13
+
14
+ ```ts
15
+ import { buildBetterPortalThemeRuntimeAsset } from "@betterportal/theme-runtime";
16
+
17
+ const asset = await buildBetterPortalThemeRuntimeAsset({
18
+ themeId: "my-theme",
19
+ adapterSource
20
+ });
21
+ ```
22
+
23
+ The shared shell owns service/app URL rewriting, native API allowlist links, managed BP headers, header-aware preload, HTMX lifecycle handling, downloads, history, authentication failures, SSE, and background fragments. The fixed HTMX extension allowlist is `bp-shell, sse`.
24
+
25
+ Theme adapters are presentation-only. They may implement loading/error UI, component initialization and disposal, overlay cleanup, and scrolling. Do not bundle the stock preload extension: BetterPortal's preload implementation is part of `bp-shell` so it can attach scoped BP headers and reuse the prefetched response.
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./runtime.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./runtime.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -0,0 +1,13 @@
1
+ export interface ThemeRuntimeAsset {
2
+ body: string;
3
+ contentType: string;
4
+ }
5
+ export declare const BETTERPORTAL_HTMX_EXTENSIONS = "bp-shell, sse";
6
+ export declare function betterPortalShellRuntimeSource(themeId: string): string;
7
+ export interface BuildBetterPortalThemeRuntimeOptions {
8
+ themeId: string;
9
+ adapterSource?: string;
10
+ }
11
+ export declare function buildBetterPortalThemeRuntimeAsset(options: BuildBetterPortalThemeRuntimeOptions): Promise<ThemeRuntimeAsset>;
12
+ export declare function loadThemeRuntimeVendorAsset(assetPath: string): Promise<ThemeRuntimeAsset | null>;
13
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAqBD,eAAO,MAAM,4BAA4B,kBAAkB,CAAC;AAE5D,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAu9DtE;AAGD,MAAM,WAAW,oCAAoC;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAsB,kCAAkC,CACtD,OAAO,EAAE,oCAAoC,GAC5C,OAAO,CAAC,iBAAiB,CAAC,CAQ5B;AAED,wBAAsB,2BAA2B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAUtG"}