@trebired/frontend 8.0.0 → 8.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 CHANGED
@@ -1,97 +1,102 @@
1
- # Frontend Package
1
+ # @trebired/frontend
2
2
 
3
- Generic browser runtime systems for DOM binding, actions, overlays, theme state, live refresh, inputs, upload, layout, and React rendering.
3
+ Generic frontend framework for Trebired applications: React shell, design tokens, UI components, browser runtime, and frontend server helpers.
4
4
 
5
- The package owns reusable browser behavior, icon rendering, overlay/runtime primitives, layout chrome, and generic UI components. Callers own product routes, copy, storage keys, persistence, navigation, logging adapters, domain icon maps, and backend response contracts beyond the documented generic JSON shape.
5
+ This package owns reusable layout, theme, sidebar, header, overlay, upload, flash, tab, link, icon, and boot-script behavior. Callers own product routes, copy, persistence endpoints, domain rendering, and application design values supplied through config.
6
6
 
7
- ## Runtime
7
+ ## Install
8
8
 
9
- Bind the root runtime after the document shell exists:
9
+ Runtime support: Bun 1+.
10
10
 
11
- ```ts
12
- import { bindFrontendRuntime } from "<package-name>";
13
-
14
- bindFrontendRuntime(document, {
15
- adapters: {
16
- navigation: {
17
- navigate(url) {
18
- window.location.assign(url);
19
- },
20
- },
21
- },
22
- });
11
+ ```sh
12
+ bun i @trebired/frontend
23
13
  ```
24
14
 
25
- Feature binders such as `bindActionForms()`, `bindTooltips()`, `bindModals()`, and `bindUploads()` are idempotent and accept a `Document`, `HTMLElement`, or `DocumentFragment`.
15
+ ## Quick Start
26
16
 
27
- ## Configuration
28
-
29
- Projects configure package-owned systems through the frontend config file consumed by the bundler.
17
+ Configure the package through `.trebired/frontend/config.ts`:
30
18
 
31
19
  ```ts
32
- import { defineConfig } from "<package-name>/config";
20
+ import { defineConfig } from "@trebired/frontend/config";
33
21
 
34
22
  export default defineConfig({
35
- prefix: "tbf",
23
+ forVersion: "8.0.0",
36
24
  assets: {
37
25
  icons: {
38
26
  endpoint: "/__icons/svg",
39
- packs: ["remixicon", "simple-icons"],
40
- },
41
- },
42
- design: {
43
- interactions: {
44
- activePress: {
45
- enabled: false,
46
- brightness: 0.9,
47
- },
48
- },
49
- },
50
- runtime: {
51
- theme: {
52
- defaultMode: "dark",
53
- modes: {
54
- dark: { scheme: "dark" },
55
- light: { scheme: "light" },
56
- },
27
+ packs: ["remixicon"],
57
28
  },
58
29
  },
30
+ components: {},
31
+ design: {},
32
+ runtime: {},
59
33
  systems: {
60
- actions: true,
61
34
  flash: true,
62
35
  layout: true,
63
- modal: true,
64
36
  popover: true,
65
- sidebar: true,
66
37
  theme: true,
67
38
  },
68
39
  });
69
40
  ```
70
41
 
71
- The config entrypoint exports `defineConfig()`, `normalizeFrontendConfig()`, `loadConfig()`, `findConfig()`, `generateFrontendScss()`, `collectConfigDependencies()`, and `THEME_MODE_ATTRIBUTE`.
42
+ Bind the browser runtime after the document shell exists:
72
43
 
73
- ## Components
44
+ ```ts
45
+ import { bindFrontendRuntime } from "@trebired/frontend";
74
46
 
75
- React components render normal HTML with `data-tbf-*` attributes and `tbf-*` classes. Use the React entrypoint for package-owned default markup:
47
+ bindFrontendRuntime(document);
48
+ ```
76
49
 
77
- ```tsx
78
- import { UploadField } from "<package-name>/react";
50
+ ## Concepts
79
51
 
80
- export function AvatarUpload() {
81
- return (
82
- <UploadField
83
- name="avatar"
84
- accept="image/png,image/jpeg"
85
- crop={true}
86
- preview={true}
87
- drop={true}
88
- />
89
- );
90
- }
91
- ```
52
+ ### Package Namespace
53
+
54
+ Frontend source-visible class names, data attributes, CSS variables, tokens, and events are created through `@trebired/bundler` namespace helpers. The package's own `.trebired/bundler/config.ts` declares the `tbf` prefix. Applications do not set a frontend prefix to consume this package.
55
+
56
+ ### React Shell
57
+
58
+ The React entrypoint renders package-owned document, layout, header, sidebar, portal, upload, tabs, tooltip, popover, modal, fullscreen, flash, text-link, language, and theme controls. The markup is generic and configured through `.trebired/frontend/config.ts`.
59
+
60
+ ## Configuration
61
+
62
+ ### Design
63
+
64
+ `design` config owns palette, semantic tokens, scales, active feedback, shadows, and component styling values. The package stays style-generic and does not hardcode application colors.
65
+
66
+ ### Runtime
67
+
68
+ `runtime` config owns browser systems such as theme state, navigation hooks, boot scripts, and runtime adapters.
69
+
70
+ ### Systems
71
+
72
+ `systems` config enables package-owned binders. Disabled systems do not emit their boot scripts.
73
+
74
+ ## Runtime
75
+
76
+ Feature binders are idempotent and accept a `Document`, `HTMLElement`, or `DocumentFragment`. Runtime binding syncs newly added DOM without resetting document-level state such as the active theme.
77
+
78
+ Frontend server helpers own package static assets, icon SVG endpoints, React document rendering support, and frontend middleware that is generic across Trebired applications.
79
+
80
+ ## Public API
81
+
82
+ Entrypoints:
83
+
84
+ - `@trebired/frontend`
85
+ - `@trebired/frontend/config`
86
+ - `@trebired/frontend/react`
87
+ - `@trebired/frontend/server`
88
+
89
+ The root entrypoint exports browser runtime binders and namespace helpers. The config entrypoint exports config loading, normalization, generated CSS, and dependency collection. The React entrypoint exports generic UI components. The server entrypoint exports frontend-related backend helpers.
90
+
91
+ ## Migration Notes
92
+
93
+ Applications import public APIs only from the package root, `/config`, `/react`, and `/server`. There is no public Sass, style, or internal component subpath API.
92
94
 
93
- ## Styling
95
+ ## What It Does Not Do
94
96
 
95
- There is no public Sass subpath API. Package-owned CSS is selected by the frontend config, then emitted by the config entrypoint as SCSS for the bundler to compile in memory.
97
+ This package does not:
96
98
 
97
- Generic app UI such as headers, mobile nav, breadcrumb, disclosure, tabs, dropdown/search controls, graph shells, cards, canvas panels, flash messages, and sidebar link lists is available from the React entrypoint.
99
+ - Own product routes, copy, data, or persistence policy.
100
+ - Own application colors outside the supplied frontend config.
101
+ - Provide compatibility bridges for removed application-local UI attributes.
102
+ - Expose package Sass or internal component subpaths as public API.
@@ -76,6 +76,23 @@
76
76
  flex: 0 0 auto;
77
77
  }
78
78
 
79
+ #{ns.class("button")}.icon {
80
+ #{ns.css-var("icon-color")}: currentColor;
81
+ #{ns.css-var("ui-action-current-icon")}: currentColor;
82
+ }
83
+
84
+ #{ns.class("button")}.icon > i,
85
+
86
+ #{ns.class("button")}.icon > svg,
87
+
88
+ #{ns.class("button")}.icon > i svg,
89
+
90
+ #{ns.class("button")}.icon > [data-icon],
91
+
92
+ #{ns.class("button")}.icon > [data-icon] svg {
93
+ color: currentColor;
94
+ }
95
+
79
96
  #{ns.modifier("button", "strong")} {
80
97
  #{ns.css-var("ui-action-current-icon")}: var(
81
98
  #{ns.css-var("ui-action-tone-highlight-icon")},
@@ -140,6 +140,7 @@
140
140
  }
141
141
 
142
142
  &.icon {
143
+ #{ns.css-var("icon-color")}: currentColor;
143
144
  display: inline-flex;
144
145
  align-items: center;
145
146
  justify-content: center;
@@ -161,6 +162,7 @@
161
162
  > img {
162
163
  display: block;
163
164
  margin: 0;
165
+ color: currentColor;
164
166
  flex: 0 0 auto;
165
167
  font-size: inherit;
166
168
  }
@@ -73,6 +73,23 @@
73
73
  flex: 0 0 auto;
74
74
  }
75
75
 
76
+ #{ns.class("button")}.icon {
77
+ #{ns.css-var("icon-color")}: currentColor;
78
+ #{ns.css-var("surf-btn-current-icon")}: currentColor;
79
+ }
80
+
81
+ #{ns.class("button")}.icon > i,
82
+
83
+ #{ns.class("button")}.icon > svg,
84
+
85
+ #{ns.class("button")}.icon > i svg,
86
+
87
+ #{ns.class("button")}.icon > [data-icon],
88
+
89
+ #{ns.class("button")}.icon > [data-icon] svg {
90
+ color: currentColor;
91
+ }
92
+
76
93
  #{ns.modifier("button", "strong")} {
77
94
  #{ns.css-var("surf-btn-current-icon")}: var(
78
95
  #{ns.css-var("surf-btn-tone-highlight-icon")},
package/package.json CHANGED
@@ -1,16 +1,21 @@
1
1
  {
2
- "name": "@trebired/frontend",
3
- "version": "8.0.0",
4
- "description": "Generic browser runtime systems for Trebired frontend packages and applications.",
5
- "type": "module",
6
- "private": false,
7
- "license": "AGPL-3.0-only",
8
2
  "author": "Miroslav Machynka (Trebired)",
9
3
  "config": {
10
4
  "organization": {
11
- "name": "trebired"
5
+ "displayName": "Trebired",
6
+ "name": "trebired",
7
+ "website": "https://trebired.com"
8
+ },
9
+ "creator": {
10
+ "name": "Miroslav Machynka"
12
11
  }
13
12
  },
13
+ "name": "@trebired/frontend",
14
+ "version": "8.0.1",
15
+ "description": "Generic browser runtime systems for Trebired frontend packages and applications.",
16
+ "type": "module",
17
+ "private": false,
18
+ "license": "AGPL-3.0-only",
14
19
  "packageManager": "bun@1.3.12",
15
20
  "engines": {
16
21
  "bun": ">=1.0.0"
@@ -53,7 +58,7 @@
53
58
  },
54
59
  "dependencies": {
55
60
  "@package/logger-adapter": "npm:@trebired/logger-adapter@^0.4.9",
56
- "@trebired/utils": "^0.4.4",
61
+ "@trebired/utils": "^0.4.5",
57
62
  "chart.js": "^4.5.1",
58
63
  "country-flag-icons": "^1.6.20",
59
64
  "cropperjs": "^1.6.2",