@datalabz_/dashboard-kit 6.0.0 → 6.0.2

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.
Files changed (5) hide show
  1. package/README.md +9 -7
  2. package/package.json +1 -1
  3. package/v4.js +1 -1
  4. package/v5.js +1 -1
  5. package/v6.js +3 -34
package/README.md CHANGED
@@ -37,10 +37,12 @@ to, never altered (see Rules). Up to `v4` a major is a `vN.js`/`vN.css` pair;
37
37
  from `v5` on it is `vN.js` alone, carrying its own CSS, because Claude artifacts
38
38
  can load scripts from jsDelivr but not stylesheets.
39
39
 
40
- - **`v5` is the current major** — what the authoring guide links and what
41
- `catalog.html` demos.
42
- - **`v4` stays live** and in every release: every dashboard made before `v5`
43
- loads it.
40
+ - **`v6` is the current major** — what the authoring guide links and what
41
+ `catalog.html` demos. It is `v4` with its stylesheet carried in the script, one
42
+ `title` option on every renderer, one item shape `{ label, value, colorClass?,
43
+ tooltip?, sub? }` for strips and grids, and the checks `v4` lacked.
44
+ - **`v5` and `v4` stay live** and in every release: every dashboard made before
45
+ `v6` loads one of them.
44
46
  - **`v1`, `v2` and `v3` are deprecated — treat them as gone.** They are not in
45
47
  this repo and are not published. Don't bring them back, don't publish them,
46
48
  don't cite them in docs or `catalog.html`, and don't copy from them when
@@ -123,13 +125,13 @@ URLs already pinned by live dashboards.
123
125
 
124
126
  Pushing a `kit-v*` tag (`kit-v4.0.3`, …) runs
125
127
  [bitbucket-pipelines.yml](../bitbucket-pipelines.yml). It publishes `v4.js`,
126
- `v4.css`, `v5.js`, `wrapper.js`, `wrapper.css` and `catalog.html` as they are
128
+ `v4.css`, `v5.js`, `v6.js`, `wrapper.js`, `wrapper.css` and `catalog.html` as they are
127
129
  in this directory, with the `__BUILD__` marker in each kit's JS replaced by the
128
130
  commit hash so System Info can say which build is live, to two places:
129
131
 
130
132
  - **Cloudflare Pages**, project `dashboard-kit` — for BackOffice dashboards,
131
- which load `https://dashboard-kit-2n2.pages.dev/v5.js` (older ones
132
- `v4.js` and `v4.css`). That is a test
133
+ which load `https://dashboard-kit-2n2.pages.dev/v6.js` (older ones
134
+ `v5.js`, or `v4.js` and `v4.css`). That is a test
133
135
  address on a test account until the company account serves
134
136
  `https://kit.<domain>/`; dashboards made before then keep the test address,
135
137
  so the test project must stay until they are rewritten. Every file is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalabz_/dashboard-kit",
3
- "version": "6.0.0",
3
+ "version": "6.0.2",
4
4
  "description": "DashboardKit runtime + styles, served from jsDelivr",
5
5
  "license": "UNLICENSED",
6
6
  "files": [
package/v4.js CHANGED
@@ -20,7 +20,7 @@
20
20
  let _activeTabId = '';
21
21
  let _sections = []; // { id, label, load, loaded, errors }
22
22
  let _title = '';
23
- let _gitVer = '572aefd'; // replaced at deploy: sed -i "s/572aefd/$(git rev-parse --short HEAD)/g" v4.js
23
+ let _gitVer = 'b3d1c2d'; // replaced at deploy: sed -i "s/b3d1c2d/$(git rev-parse --short HEAD)/g" v4.js
24
24
  let _calls = []; // System Info call log
25
25
  let _sectionErrors = {}; // sectionId → error count
26
26
  let _generation = 0;
package/v5.js CHANGED
@@ -20,7 +20,7 @@
20
20
  let _activeTabId = '';
21
21
  let _sections = []; // { id, label, load, loaded, errors }
22
22
  let _title = '';
23
- let _gitVer = '572aefd'; // replaced at deploy: sed -i "s/572aefd/$(git rev-parse --short HEAD)/g" v4.js
23
+ let _gitVer = 'b3d1c2d'; // replaced at deploy: sed -i "s/b3d1c2d/$(git rev-parse --short HEAD)/g" v4.js
24
24
  let _calls = []; // System Info call log
25
25
  let _sectionErrors = {}; // sectionId → error count
26
26
  let _generation = 0;
package/v6.js CHANGED
@@ -20,7 +20,7 @@
20
20
  let _activeTabId = '';
21
21
  let _sections = []; // { id, label, load, loaded, errors }
22
22
  let _title = '';
23
- let _gitVer = '572aefd'; // replaced at deploy: sed -i "s/572aefd/$(git rev-parse --short HEAD)/g" v6.js
23
+ let _gitVer = 'b3d1c2d'; // replaced at deploy: sed -i "s/b3d1c2d/$(git rev-parse --short HEAD)/g" v6.js
24
24
  let _calls = []; // System Info call log
25
25
  let _sectionErrors = {}; // sectionId → error count
26
26
  let _generation = 0;
@@ -1143,20 +1143,6 @@ details.dk-call summary::-webkit-details-marker {
1143
1143
  }
1144
1144
 
1145
1145
  // ── runQuery ──────────────────────────────────────────────────────────────────
1146
- // Text a `$n` can sit in without being a placeholder: 'USD $10', "col$1", comments,
1147
- // $tag$…$tag$ bodies. Blanked before counting, or a valid query is refused locally.
1148
- const NOT_SQL_CODE =
1149
- /'(?:[^']|'')*'|"(?:[^"]|"")*"|--[^\n]*|\/\*[\s\S]*?\*\/|\$([A-Za-z_]\w*)?\$[\s\S]*?\$\1\$/g;
1150
-
1151
- function _maxPlaceholder(sql) {
1152
- let m, max = 0;
1153
- // A `$n` glued to a word is an identifier ("price$1"), so it needs a non-word char before it.
1154
- const re = /(^|[^\w$])\$(\d+)/g;
1155
- const code = String(sql).replace(NOT_SQL_CODE, ' ');
1156
- while ((m = re.exec(code)) !== null) max = Math.max(max, +m[2]);
1157
- return max;
1158
- }
1159
-
1160
1146
  // One retry, only where _isRetryable says the same request may succeed.
1161
1147
  async function runQuery(sectionId, callLabel, sql, args, params) {
1162
1148
  const t0 = performance.now();
@@ -1172,24 +1158,7 @@ details.dk-call summary::-webkit-details-marker {
1172
1158
  };
1173
1159
  _calls.push(entry);
1174
1160
 
1175
- // Preflight: $n count vs args, after the log so it shows in System Info with its SQL.
1176
- // Never reaches the gateway, so no dkCall — it reports as kind 'script': the document
1177
- // is wrong. Never retried. `local` keeps it out of the CORS hint and the NET label.
1178
- const need = _maxPlaceholder(sql);
1179
- const got = (args || []).length;
1180
- if (need !== got) {
1181
- entry.state = 'error';
1182
- entry.local = true;
1183
- entry.clientMs = Math.round(performance.now() - t0);
1184
- entry.error =
1185
- 'SQL uses ' + (need ? '$1..$' + need : 'no placeholders') +
1186
- ' but received ' + got + ' arg' + (got === 1 ? '' : 's') +
1187
- ' — each query takes exactly the args its own placeholders use, never a shared array.';
1188
- _sectionErrors[sectionId] = (_sectionErrors[sectionId] || 0) + 1;
1189
- throw new Error(entry.error);
1190
- }
1191
-
1192
- const body = { sql };
1161
+ const body = { query: sql };
1193
1162
  if (args && args.length) body.args = args;
1194
1163
  if (params && params.hierarchy_id != null) body.hierarchy_id = params.hierarchy_id;
1195
1164
  else if (_hierarchyId != null) body.hierarchy_id = _hierarchyId;
@@ -1763,7 +1732,7 @@ details.dk-call summary::-webkit-details-marker {
1763
1732
  (c.error ? '<div class="dk-s-err" style="margin-bottom:6px">' + esc(c.error) + '</div>' : '') +
1764
1733
  '<p style="font-size:11px;color:var(--muted);margin:0 0 4px">Data Request:</p>' +
1765
1734
  '<pre>' + esc(c.sql) + '</pre>' +
1766
- (c.args && c.args.length ? '<p style="font-size:11px;color:var(--muted);margin:8px 0 4px">Args:</p><pre>' + esc(JSON.stringify(c.args, null, 2)) + '</pre>' : '') +
1735
+ (c.args && c.args.length ? '<p style="font-size:11px;color:var(--muted);margin:8px 0 4px">Filters:</p><pre>' + esc(JSON.stringify(c.args, null, 2)) + '</pre>' : '') +
1767
1736
  '<div class="dk-resp-head">' +
1768
1737
  '<span>Response:</span><button type="button" class="dk-resp-toggle" aria-label="Toggle response">−</button>' +
1769
1738
  '</div>' +