@betterportal/theme-bootstrap1 0.0.1

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,10 @@
1
+ # BetterPortal Bootstrap1 Theme for Node.js
2
+
3
+ Custom BetterPortal v10 theme built on Bootstrap 5 and HTMX.
4
+
5
+ Design goals:
6
+
7
+ - modern and minimal
8
+ - clean light and dark modes
9
+ - shell-first, not app-logic-first
10
+ - HTMX included as a required runtime dependency for UI composition
@@ -0,0 +1,23 @@
1
+ {
2
+ "nodejs": [
3
+ {
4
+ "id": "service-betterportal-theme-bootstrap1",
5
+ "name": "service-betterportal-theme-bootstrap1",
6
+ "basePath": "./",
7
+ "description": "Bootstrap 5 and HTMX based BetterPortal theme",
8
+ "tags": [
9
+ "betterportal",
10
+ "theme",
11
+ "bootstrap",
12
+ "htmx"
13
+ ],
14
+ "documentation": [
15
+ "./README.md"
16
+ ],
17
+ "pluginPath": "src/plugins/service-betterportal-theme-bootstrap1/",
18
+ "links": {
19
+ "github": "git+https://github.com/BetterCorp/BetterPortal.git"
20
+ }
21
+ }
22
+ ]
23
+ }
package/bsb-tests.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "nodejs": [
3
+ {
4
+ "id": "service-betterportal-theme-bootstrap1",
5
+ "skip": true,
6
+ "default": {
7
+ "config": {},
8
+ "setup": null,
9
+ "dispose": null
10
+ },
11
+ "tests": []
12
+ }
13
+ ]
14
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./plugins/service-betterportal-theme-bootstrap1/theme/index.js";
2
+ export * from "./plugins/service-betterportal-theme-bootstrap1/index.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gEAAgE,CAAC;AAC/E,cAAc,0DAA0D,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./plugins/service-betterportal-theme-bootstrap1/theme/index.js";
2
+ export * from "./plugins/service-betterportal-theme-bootstrap1/index.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gEAAgE,CAAC;AAC/E,cAAc,0DAA0D,CAAC"}
@@ -0,0 +1,84 @@
1
+ # assets.tsx Cleanup Tracker
2
+
3
+ ## Purpose
4
+
5
+ `assets.tsx` currently mixes static asset serving with the generated browser shell runtime. The runtime owns htmx integration, service URL rewriting, BP auth headers, Bootstrap lifecycle cleanup, route UI state, and dev recovery.
6
+
7
+ ## Review Matrix
8
+
9
+ | Area | What it does | htmx duplicate? | Recommendation |
10
+ |---|---|---:|---|
11
+ | Asset path constants + `loadBootstrap1Asset` | Serves Bootstrap, htmx, htmx extensions, and shell bundle | No | Keep, maybe shorten cache helper |
12
+ | `shellRuntimeSource()` wrapping | Embeds browser runtime via `jsx-htmx/js` | No | Keep for now |
13
+ | `htmx.config.sse` | Sets global SSE defaults | No | Keep |
14
+ | DOM query helpers | Find shell/nav/error/loading elements | No | Keep, maybe inline some |
15
+ | `syncProfileMirror` | Copies profile slot into mobile mirror | No | Keep unless theme markup changes |
16
+ | `isMainTarget` / `requestTargetsMain` | Detects `#bp-main` requests | Partial htmx glue | Keep |
17
+ | chrome `Content-Type` parsing | Reads `bp-chrome-*` params and toggles shell fullscreen | No | Keep, document server contract |
18
+ | Bootstrap modal/offcanvas teleport | Moves swapped overlays to `body` | No | Keep unless services render body-level overlays |
19
+ | stale Bootstrap overlay cleanup | Removes orphaned backdrops/classes | No | Keep |
20
+ | sidebar conversion from `data-bp-sidebar` | Converts custom markup to Bootstrap offcanvas | No | Candidate removal if services emit real Bootstrap markup |
21
+ | tooltip/popover init/dispose | Initializes Bootstrap after swaps | No | Keep |
22
+ | scroll-to-top | Resets shell scroll containers after main swap | No | Keep |
23
+ | loading state | Toggles shell frame/topbar classes | htmx has indicators but not exact shell UI | Simplify later |
24
+ | error HTML builders | Client-rendered fallback errors | Mostly htmx/server status view duplicate | Remove for HTTP responses; keep only no-response fallback if needed |
25
+ | service route map | Maps service paths to tenant paths and back | No | Keep; core BP protocol |
26
+ | BP header localStorage | Stores `BP-SetHeader` auth/client headers | No | Keep; auth protocol glue |
27
+ | header refresh timers | Refreshes tokens before expiry | No | Keep |
28
+ | `attachBpHeaders` | Adds stored headers to htmx requests | Partial `hx-headers` overlap | Keep; dynamic scoped headers need JS |
29
+ | `applyBpHeaderDirectives` | Reads `BP-SetHeader` / `BP-RemoveHeader` | No | Keep |
30
+ | dev service health/reload | Polls health and reloads route on recovery | No | Keep or gate harder behind dev |
31
+ | route matching / tenant URL conversion | Keeps visible URL tenant-facing while requests go to services | No | Keep |
32
+ | `triggerShellLink` | Creates hidden anchor and processes it | Yes-ish; `htmx.ajax` exists | Replace with `htmx.ajax` after verifying v4 `push`/`replace` behavior |
33
+ | `data-bp-config` parser | Inherited shell config for rewrite/preload/service | No | Keep unless protocol changes |
34
+ | service context resolution | Finds owning service for relative URLs | No | Keep |
35
+ | `bpLoginSubmit` global fetch handler | Manual login POST and JSON parse | Mostly htmx duplicate | Replace with normal htmx form flow |
36
+ | `applyPreloadConfig` | Adds/removes `hx-preload` | No | Keep as policy |
37
+ | `bindBpPreload` | Custom authenticated prefetch/fetch reuse | No | Keep; external `hx-preload` was removed from the core bundle because it bypassed BP stored headers |
38
+ | lane/target sanitizer | Prevents fragments replacing outside their lane | No | Keep; containment guard |
39
+ | `resolveServiceLinks` | Rewrites links/forms/assets/SSE and adds htmx attrs | Partial htmx initialization overlap | Keep; BP protocol requires root-relative service URLs |
40
+ | default bare form `hx-post="this"` | Makes plain forms post to current service route | No | Keep if this convenience remains desired |
41
+ | active route management | Updates nav active state/title/breadcrumb | No | Keep |
42
+ | error action click handler | Reload/sign-in fallback buttons | Mostly fallback-only | Remove when fallback error HTML is gone |
43
+ | route click handler | Closes offcanvas before htmx nav | No | Keep |
44
+ | `DOMContentLoaded` setup | Initial processing/bootstrap/health | No | Keep |
45
+ | menu health checks | Marks service menu items down | No | Product choice |
46
+ | split-pane toggle click handler | UI state toggle | No | Keep if split-pane remains |
47
+ | `htmx.registerExtension("bp-shell")` | BP integration with htmx lifecycle | Correct htmx hook | Keep |
48
+ | `htmx_before_init` + `htmx_after_process` | Rewrites before/after processing | Some duplicate passes | Keep one path later |
49
+ | `htmx_config_request` | Accept header, service-origin rewrite, BP headers | No | Keep |
50
+ | `htmx_before_request` | lane guard, loading, invalid route guard | No | Keep |
51
+ | `htmx_before_swap` | JSON guard, 401 auth, Bootstrap dispose | Partial duplicate | Keep only BP-specific pieces |
52
+ | `htmx_after_request` | BP headers, HX-Location normalization, SSE response rewrite | Mostly BP-specific | Keep; re-check SSE text rewrite |
53
+ | `htmx_after_swap` | cleanup/init after swap | No | Keep |
54
+ | `htmx_after_settle` | backup loading cleanup | Maybe duplicate | Candidate removal after proving hooks cover it |
55
+ | history hooks | active nav update | No | Keep |
56
+ | `htmx_error` / `htmx_timeout` | fallback route errors and dev recovery | htmx has events; custom UI is duplicate | Use htmx defaults for HTTP; keep no-response/dev recovery only |
57
+
58
+ ## Actions Taken
59
+
60
+ - Added this tracker next to `assets.tsx`.
61
+ - Changed generic HTTP error handling to lean on htmx v4 defaults:
62
+ - server-rendered status HTML now swaps normally;
63
+ - generic client-rendered `Error 4xx/5xx` pages are no longer generated for HTTP responses;
64
+ - JSON responses are still blocked from swapping into HTML targets;
65
+ - 401 refresh/login handling remains custom because it is BetterPortal auth behavior.
66
+ - Added `htmx_response_error` only for BP dev recovery scheduling on `502/503/504`; it does not render custom error content.
67
+ - Removed the `htmx_timeout` extension hook. htmx v4 reports timeout through `htmx:error`.
68
+ - Removed the unused `showErrorBanner` helper.
69
+
70
+ ## Not Taken Yet
71
+
72
+ - Did not remove `renderRouteError`, `renderErrorAction`, or `handleErrorAction` yet. They still back the no-response/network fallback and invalid client-side route configuration case.
73
+ - Did not replace `triggerShellLink` with `htmx.ajax`; needs one focused behavior check for `push` versus `replace`.
74
+ - Kept `bindBpPreload`; BP needs an authenticated preloader because generic `hx-preload` can fetch service URLs without stored BP headers.
75
+ - Did not replace `bpLoginSubmit`; login should move to normal htmx v4 events and `HX-Location`, but that touches the auth service renderer too.
76
+ - Did not split the browser runtime out of `assets.tsx`; this pass only reduces duplicate error handling.
77
+ - Did not clean every mojibake comment in `assets.tsx`; a few encoded comments remain because behavior cleanup mattered more than comment churn.
78
+
79
+ ## Next Cleanup Cuts
80
+
81
+ 1. Remove `bindBpPreload`.
82
+ 2. Replace `triggerShellLink` with `htmx.ajax`.
83
+ 3. Convert login form to htmx v4 events and remove `window.bpLoginSubmit`.
84
+ 4. Move Bootstrap lifecycle/auth-header/dev-recovery helpers out of the asset loader file.
@@ -0,0 +1,6 @@
1
+ export interface ThemeAssetResponse {
2
+ body: string;
3
+ contentType: string;
4
+ }
5
+ export declare function loadBootstrap1Asset(assetPath: string): Promise<ThemeAssetResponse | null>;
6
+ //# sourceMappingURL=assets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../src/plugins/service-betterportal-theme-bootstrap1/assets.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAw/DD,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAqE/F"}