@datalabz_/dashboard-kit 4.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 +156 -0
- package/package.json +15 -0
- package/v4.css +694 -0
- package/v4.js +1093 -0
- package/wrapper.css +326 -0
- package/wrapper.js +310 -0
package/README.md
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# dashboard_kit
|
|
2
|
+
|
|
3
|
+
Source for **DashboardKit**, the hosted JS+CSS bundle every LLM-generated
|
|
4
|
+
dashboard loads from `https://html-ui-kit-master.888drafts.com/`.
|
|
5
|
+
|
|
6
|
+
## What problem it solves
|
|
7
|
+
|
|
8
|
+
An LLM authoring a dashboard re-emits the same boilerplate every time — fetch
|
|
9
|
+
wrapper, tab state, section loading/error states, table styling, CSV export,
|
|
10
|
+
System Info panel, currency formatting, color tokens. Two costs follow:
|
|
11
|
+
|
|
12
|
+
- **Output-token cost** — most of each dashboard's output doesn't vary
|
|
13
|
+
dashboard-to-dashboard.
|
|
14
|
+
- **Cross-dashboard drift** — every dashboard carries its own frozen copy of
|
|
15
|
+
the boilerplate, so a bug fix doesn't reach dashboards already generated.
|
|
16
|
+
|
|
17
|
+
The kit centralizes that boilerplate behind one `DashboardKit.init(...)` call.
|
|
18
|
+
The author writes only SQL, section `load()` functions, dashboard-specific
|
|
19
|
+
header filters, and the layout inside each panel; the kit owns the rest
|
|
20
|
+
(`postMessage` handling, tabs, render primitives, formatters, CSS tokens,
|
|
21
|
+
snapshot export).
|
|
22
|
+
|
|
23
|
+
The LLM-facing authoring contract — what to write vs. what the kit provides —
|
|
24
|
+
is [consumer_skill/dashboard-authoring-guide.md](../consumer_skill/dashboard-authoring-guide.md).
|
|
25
|
+
It must always link the **current** major (see below). This file is the
|
|
26
|
+
human-facing overview and the working rules for changing the kit; it is not an
|
|
27
|
+
API reference. The SQL gateway the kit calls is
|
|
28
|
+
[gateway_server/](../gateway_server/README.md).
|
|
29
|
+
|
|
30
|
+
## Versions
|
|
31
|
+
|
|
32
|
+
Each major is a separate, self-contained `vN.js`/`vN.css` pair, **pinned by
|
|
33
|
+
URL from every dashboard generated against it** — those dashboards keep
|
|
34
|
+
loading it indefinitely, so a shipped `vN` is a live dependency that is only
|
|
35
|
+
ever added to, never altered (see Rules).
|
|
36
|
+
|
|
37
|
+
- **`v4` is the current and only live major** — what the authoring guide
|
|
38
|
+
links, what `catalog.html` demos, and the only kit that is published.
|
|
39
|
+
- **`v1`, `v2` and `v3` are deprecated — treat them as gone.** They live in
|
|
40
|
+
`deprecatedVersions/` for reference only and are not published. Don't move
|
|
41
|
+
them back, don't publish them, don't cite them in docs or `catalog.html`,
|
|
42
|
+
and don't copy from them when cutting a new major — start from `v4`.
|
|
43
|
+
Because they are unpublished, nothing added to these files can reach a
|
|
44
|
+
browser — a runtime deprecation warning was tried and reverted for exactly
|
|
45
|
+
that reason. Whatever is live at their CDN URLs is frozen at its last
|
|
46
|
+
published state and will vanish if the publish step prunes what is no
|
|
47
|
+
longer published.
|
|
48
|
+
|
|
49
|
+
A `vN.js`/`vN.css` pair is one served bundle; the repo's per-file line budget
|
|
50
|
+
(AGENTS.md #2) does not apply to it — it cannot be split without changing the
|
|
51
|
+
URLs already pinned by live dashboards.
|
|
52
|
+
|
|
53
|
+
## Rules
|
|
54
|
+
|
|
55
|
+
- **Where a change lands — the current `vN` or a new major — is decided by
|
|
56
|
+
one question: does it make the already-shipped kit better without breaking
|
|
57
|
+
any dashboard already generated against it?** If yes, it lands in the
|
|
58
|
+
current `vN` — unless the user asked for a new major. Everything else gets a
|
|
59
|
+
new major.
|
|
60
|
+
"Better without breaking" means: an addition (a new option, a new helper, a
|
|
61
|
+
new button in kit-owned chrome, a new optional `postMessage` a parent may
|
|
62
|
+
ignore) or an improvement whose effect on an existing dashboard is only that
|
|
63
|
+
something now works better — never that its output changes. To check, trace
|
|
64
|
+
the path an existing dashboard takes — a call that omits the new option, a
|
|
65
|
+
parent that doesn't listen for the new message — and compare with today's
|
|
66
|
+
output. Rendered content the same, nothing that used to succeed now throws
|
|
67
|
+
or behaves differently → current `vN`. Anything else — including a narrow,
|
|
68
|
+
arguably-desirable fix like turning a silent no-op into a thrown error —
|
|
69
|
+
changes what a live dashboard shows, so it is a new major, no matter how
|
|
70
|
+
small or clearly-better it looks. Every live dashboard pins its `vN` by URL
|
|
71
|
+
and cannot be regenerated on demand; the current `vN` is edited in place,
|
|
72
|
+
so this is the only thing keeping them safe.
|
|
73
|
+
- **Weigh every fix from three angles: kit-side (`vN.js`/`vN.css`), doc-side
|
|
74
|
+
(the authoring guide), or both.** Don't default to whichever is cheapest to
|
|
75
|
+
touch — a doc-only patch that papers over an awkward kit API, or a kit tweak
|
|
76
|
+
that's really just a doc clarification in disguise, are both weaker than
|
|
77
|
+
fixing whatever actually owns the problem. When the right fix changes
|
|
78
|
+
behavior, a new major is the normal cost of it, not a reason to settle for
|
|
79
|
+
a kludge in the current one.
|
|
80
|
+
- **Don't bump `catalog.html` to a new version proactively** — only after the
|
|
81
|
+
user has reviewed and accepted that version.
|
|
82
|
+
- **Every LLM-generated dashboard that uses the kit must come out:**
|
|
83
|
+
(1) safe/reliable — never crashes or mismatches, no spam beyond what was
|
|
84
|
+
asked, one idiom per task (the guide's pattern, no alternates); (2) free in
|
|
85
|
+
content — what it shows is unconstrained, only the kit's wiring is fixed;
|
|
86
|
+
(3) as short as possible — no helpers or boilerplate the kit already
|
|
87
|
+
provides. Judge every kit change against these three: an API that invites a
|
|
88
|
+
second idiom, or makes the author repeat what the kit could own, fails.
|
|
89
|
+
- **The kit has no dashboard-wide currency.** `formatCurrency` takes the
|
|
90
|
+
currency per call, rows carry their own, and nothing arrives from the
|
|
91
|
+
harness — `v1`'s one-currency-per-formatter factory is exactly what was
|
|
92
|
+
retired. Don't add a global or a default; summing across currencies is the
|
|
93
|
+
query's problem to avoid, and the guide says how.
|
|
94
|
+
- **The SQL gateway is shared across every live kit major** — a wire-format
|
|
95
|
+
change can break dashboards still on older `vN`s in production, not just the
|
|
96
|
+
latest.
|
|
97
|
+
- **Open questions about a feature, change, or bug go in `TODO.md`, not a
|
|
98
|
+
unilateral decision.** If work surfaces something worth doing but not asked
|
|
99
|
+
for, ask the user whether to add it to `TODO.md` rather than deciding or
|
|
100
|
+
acting on it yourself.
|
|
101
|
+
|
|
102
|
+
## Cutting a new version (`v{N+1}`)
|
|
103
|
+
|
|
104
|
+
1. Copy `v{N}.js`/`v{N}.css` → `v{N+1}.js`/`v{N+1}.css`.
|
|
105
|
+
2. Fix the header comment to `/* DashboardKit v{N+1}.js */`.
|
|
106
|
+
3. Update the hardcoded `vN.css`/`vN.js` lines in `serve.mjs`'s startup
|
|
107
|
+
`console.log` (just the printed URLs — routing itself isn't version-aware).
|
|
108
|
+
4. Make the actual change in the new file only.
|
|
109
|
+
5. Update `catalog.html` and the authoring guide's kit links — only once the
|
|
110
|
+
user has accepted the new `vN`.
|
|
111
|
+
6. The previous `vN` stays in the root and stays published. A major moves to
|
|
112
|
+
`deprecatedVersions/` only when no dashboard loads it any more — every one
|
|
113
|
+
regenerated on a newer major or deleted — and only by the user's decision,
|
|
114
|
+
never as part of cutting the next one.
|
|
115
|
+
|
|
116
|
+
## Hosting
|
|
117
|
+
|
|
118
|
+
Served from `https://html-ui-kit-master.888drafts.com/vN.{css,js}` — CORS
|
|
119
|
+
open, `Cache-Control: immutable`. What is published is `v4.js`, `v4.css`,
|
|
120
|
+
`wrapper.js`, `wrapper.css` and `catalog.html`, as they are in this directory,
|
|
121
|
+
with `v4.js`'s `__BUILD__` marker replaced by the commit hash so System Info
|
|
122
|
+
can say which build is live. How that gets to the host is not decided yet:
|
|
123
|
+
the old repo's Bitbucket pipeline and its build script did not survive the
|
|
124
|
+
move into this monorepo, and a replacement is pending with the server team.
|
|
125
|
+
|
|
126
|
+
## Dev
|
|
127
|
+
|
|
128
|
+
No build step — edit `vN.js`/`vN.css` directly.
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
npm start # serve.mjs — dev server on :3400, CORS open
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
| URL | What it serves |
|
|
135
|
+
| -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
136
|
+
| `http://localhost:3400/vN.css` / `vN.js` | Kit stylesheet / runtime for a given major |
|
|
137
|
+
| `http://localhost:3400/catalog.html` | Component catalog — demos kit features |
|
|
138
|
+
| `http://localhost:3400/wrapper.css` / `wrapper.js` | Local harness: hosts a dashboard in a sandboxed iframe and supplies JWT + date/timezone/hierarchy via `postMessage`, standing in for the BackOffice |
|
|
139
|
+
|
|
140
|
+
To simulate the harness's boot message against a dashboard opened directly:
|
|
141
|
+
|
|
142
|
+
```js
|
|
143
|
+
window.postMessage(
|
|
144
|
+
{
|
|
145
|
+
type: "CUSTOM_DASHBOARDS_PARAMS",
|
|
146
|
+
token: "your_jwt",
|
|
147
|
+
filters: {
|
|
148
|
+
dateFrom: "2026-05-19T03:00:00.000Z",
|
|
149
|
+
dateTo: "2026-05-20T02:59:59.999Z",
|
|
150
|
+
timezone: "America/Sao_Paulo",
|
|
151
|
+
hierarchyId: null,
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
"*",
|
|
155
|
+
);
|
|
156
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@datalabz_/dashboard-kit",
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"description": "DashboardKit runtime + styles, served from jsDelivr",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"files": [
|
|
7
|
+
"v4.js",
|
|
8
|
+
"v4.css",
|
|
9
|
+
"wrapper.js",
|
|
10
|
+
"wrapper.css"
|
|
11
|
+
],
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
}
|
|
15
|
+
}
|