bitboss-ui 3.0.0-beta.72 → 3.0.0-beta.73

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.
@@ -159,5 +159,8 @@ buttons (`text`, `variant`, `size`, icons, `iconOnly`, `block`).
159
159
 
160
160
  The Inertia helpers' `usePromiseRouter` / `usePromiseForm` reject with a
161
161
  `BbValidationError` on a validation error (the bag under `.errors`) instead of
162
- the bare bag; a `.catch` that read the bag reads `error.errors`. Their
162
+ the bare bag; a `.catch` that read the bag reads `error.errors`.
163
+ `BbValidationError` extends `Error`, so a `.catch` that took
164
+ `error instanceof Error` to mean "not a validation error" now catches 422s
165
+ too: test `error instanceof BbValidationError` first. Their
163
166
  `useConfirmOnRouteLeave` takes `ok` / `cancel` too.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schema": 1,
3
- "version": "3.0.0-beta.72",
3
+ "version": "3.0.0-beta.73",
4
4
  "canon": "bb-canon/2",
5
5
  "folder": "inertia-helpers",
6
6
  "helpers": {
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "BbConfirm",
3
3
  "removed": [
4
- {"name":"yes","new":"ok","surface":"option","hint":"a `confirm()` option: `confirm({ ok: 'Delete' })`; same values, plus `true` for the default label","since":"3.0.0-unreleased","migration":"ai/guides/migration/components/use-confirm.md","silent":true,"fix":{"kind":"rename"}},
5
- {"name":"no","new":"cancel","surface":"option","hint":"a `confirm()` option: `confirm({ cancel: false })`; same values, plus `true` for the default label","since":"3.0.0-unreleased","migration":"ai/guides/migration/components/use-confirm.md","silent":true,"fix":{"kind":"rename"}},
6
- {"name":"dismissAsNo","new":"dismissAsCancel","surface":"option","hint":"a `confirm()` option: backdrop, Escape and the ✕ run `cancel.onClick` unless `dismissAsCancel: false`","since":"3.0.0-unreleased","migration":"ai/guides/migration/components/use-confirm.md","silent":true,"fix":{"kind":"rename"}},
7
- {"name":"actions[].icon","new":"actions[].iconOnly","surface":"option","hint":"an icon-only button writes its label and icon: `{ text: 'Close', 'prepend:icon': 'lucide:x', iconOnly: true }` (also `ok` / `cancel`); the label is the accessible name","since":"3.0.0-unreleased","migration":"ai/guides/migration/components/use-confirm.md","silent":true,"fix":{"kind":"manual"}}
4
+ {"name":"yes","new":"ok","surface":"option","hint":"a `confirm()` option: `confirm({ ok: 'Delete' })`; same values, plus `true` for the default label","since":"3.0.0-beta.72","migration":"ai/guides/migration/components/use-confirm.md","silent":true,"fix":{"kind":"rename"}},
5
+ {"name":"no","new":"cancel","surface":"option","hint":"a `confirm()` option: `confirm({ cancel: false })`; same values, plus `true` for the default label","since":"3.0.0-beta.72","migration":"ai/guides/migration/components/use-confirm.md","silent":true,"fix":{"kind":"rename"}},
6
+ {"name":"dismissAsNo","new":"dismissAsCancel","surface":"option","hint":"a `confirm()` option: backdrop, Escape and the ✕ run `cancel.onClick` unless `dismissAsCancel: false`","since":"3.0.0-beta.72","migration":"ai/guides/migration/components/use-confirm.md","silent":true,"fix":{"kind":"rename"}},
7
+ {"name":"actions[].icon","new":"actions[].iconOnly","surface":"option","hint":"an icon-only button writes its label and icon: `{ text: 'Close', 'prepend:icon': 'lucide:x', iconOnly: true }` (also `ok` / `cancel`); the label is the accessible name","since":"3.0.0-beta.72","migration":"ai/guides/migration/components/use-confirm.md","silent":true,"fix":{"kind":"manual"}}
8
8
  ]
9
9
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "BbConfirmPortal",
3
3
  "removed": [
4
- {"name":"yes","new":"ok","surface":"option","hint":"the default slot's scope: `#default=\"{ ok, cancel, data }\"`; rename the destructured name and its uses","since":"3.0.0-unreleased","migration":"ai/guides/migration/components/use-confirm.md","silent":true,"fix":{"kind":"rename"}},
5
- {"name":"no","new":"cancel","surface":"option","hint":"the default slot's scope: `#default=\"{ ok, cancel, data }\"`; rename the destructured name and its uses","since":"3.0.0-unreleased","migration":"ai/guides/migration/components/use-confirm.md","silent":true,"fix":{"kind":"rename"}}
4
+ {"name":"yes","new":"ok","surface":"option","hint":"the default slot's scope: `#default=\"{ ok, cancel, data }\"`; rename the destructured name and its uses","since":"3.0.0-beta.72","migration":"ai/guides/migration/components/use-confirm.md","silent":true,"fix":{"kind":"rename"}},
5
+ {"name":"no","new":"cancel","surface":"option","hint":"the default slot's scope: `#default=\"{ ok, cancel, data }\"`; rename the destructured name and its uses","since":"3.0.0-beta.72","migration":"ai/guides/migration/components/use-confirm.md","silent":true,"fix":{"kind":"rename"}}
6
6
  ]
7
7
  }
@@ -5,6 +5,6 @@
5
5
  {"name":"theme","new":"variant","surface":"option","hint":"a `toast()` / `useToast().toast()` option, not a prop: `toast({ variant: 'success' })` (plus an `icon` for the tone to show)","since":"3.0.0-alpha.1","migration":"ai/guides/migration/components/bb-toast.md","silent":true,"fix":{"kind":"manual"}},
6
6
  {"name":"timeout","new":"duration","surface":"option","hint":"a `toast()` option: `toast({ duration: 4000 })`; the default fell from 6000 to 4000 ms","since":"3.0.0-alpha.1","migration":"ai/guides/migration/components/bb-toast.md","silent":true,"fix":{"kind":"manual"}},
7
7
  {"name":"showClose","new":"hideClose","surface":"option","hint":"a `toast()` option, polarity inverted: `showClose: false` → `hideClose: true`; `showClose: true` was the default, delete it","since":"3.0.0-alpha.1","migration":"ai/guides/migration/components/bb-toast.md","silent":true,"fix":{"kind":"manual"}},
8
- {"name":"actions[].icon","new":"actions[].iconOnly","surface":"option","hint":"an icon-only action writes its label and icon: `{ text: 'Undo', 'prepend:icon': 'lucide:undo-2', iconOnly: true }`; the label is the accessible name","since":"3.0.0-unreleased","migration":"ai/guides/migration/components/bb-toast.md","silent":true,"fix":{"kind":"manual"}}
8
+ {"name":"actions[].icon","new":"actions[].iconOnly","surface":"option","hint":"an icon-only action writes its label and icon: `{ text: 'Undo', 'prepend:icon': 'lucide:undo-2', iconOnly: true }`; the label is the accessible name","since":"3.0.0-beta.72","migration":"ai/guides/migration/components/bb-toast.md","silent":true,"fix":{"kind":"manual"}}
9
9
  ]
10
10
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "library": "bitboss-ui",
4
- "version": "3.0.0-beta.72",
5
- "generatedAt": "2026-11-12T02:24:42.000Z",
4
+ "version": "3.0.0-beta.73",
5
+ "generatedAt": "2026-11-12T12:19:38.000Z",
6
6
  "about": "The bitboss-ui API for agents: open components/<Name>.json for one component (every prop, event, slot, v-model, pt part and state, and the public types its API uses; one member per line; a row or pt part written { name, common: true } is whole once in common.json, read it once). components/<Name>.tree.json has its component tree and CSS internals; files.removed the old names. The machine file with everything in one place is ../components.json.",
7
7
  "reading": {
8
8
  "components[]": "one row per component; description = its first sentence. Its API file is files.component with <Name> = name; its components/<Name>.tree.json (component tree, css classes, CSS custom properties) exists unless the row says tree: false.",
@@ -597,7 +597,7 @@ const copyValues = (): Record<string, unknown> => {
597
597
  * failed client submit does (`focusFirstInvalid`: document order, hidden /
598
598
  * inert / collapsed fields skipped). Only while focus is still the form's:
599
599
  * inside it, on one of its own controls outside it (a dialog footer's
600
- * `<BbButton form="id" type="submit">`), or on `<body>` after a submit. A response that lands while the
600
+ * `<BbButton form="id" type="submit">`, or the dialog's `ok` that submitted it), or on `<body>` after a submit. A response that lands while the
601
601
  * user is already somewhere else on the page (typing in a search box) does
602
602
  * not pull them back, and errors put on a form nobody has submitted (a page
603
603
  * that loads with errors in its props) do not grab focus either.
@@ -615,6 +615,7 @@ const focusServerErrors = async (
615
615
  const ours =
616
616
  !!root &&
617
617
  (root.contains(active) ||
618
+ (!!active && active === overlaySubmitter) ||
618
619
  (active as Partial<HTMLButtonElement> | null)?.form === root);
619
620
  if (onBody ? submitCount.value === 0 : !ours) return;
620
621
  focusFirstInvalid(landed);
@@ -802,9 +803,15 @@ provide(BB_FORM_SUBMIT_LOCK, {
802
803
  });
803
804
  // the BbDialog / BbOffCanvas around the form refuses user closes
804
805
  // while the lock is on (so `disable-submit-lock` releases it too).
806
+ // Its `ok` button submits from outside the form (no `form=`): it counts as
807
+ // one of the form's own controls for `focusServerErrors`.
808
+ let overlaySubmitter: Element | undefined;
805
809
  const tellOverlay = joinOverlaySubmitGuard({
806
810
  locked: submitLocked,
807
- submit: async () => (await onSubmitEvent()) === true,
811
+ submit: async (submitter) => {
812
+ overlaySubmitter = submitter;
813
+ return (await onSubmitEvent()) === true;
814
+ },
808
815
  });
809
816
 
810
817
  type SubmitListener = (
@@ -54,15 +54,15 @@ var m = Symbol.for("bitboss-ui:overlay-action-attrs"), h = (e) => e === !0 || e
54
54
  let n = t.value === void 0 ? t.values : t.value;
55
55
  O = _.complete(n).catch(D);
56
56
  };
57
- let k = p(null), A = async (e) => {
57
+ let k = p(null), A = async (e, t) => {
58
58
  if (k.value === null) {
59
59
  k.value = e.key;
60
60
  try {
61
61
  if (e.onClick && await e.onClick() === !1) return;
62
62
  if (e.kind === "cancel") return _.close();
63
- let t = e.kind === "ok" ? E() : null;
64
- if (t) {
65
- O = null, await t.submit() && await O;
63
+ let n = e.kind === "ok" ? E() : null;
64
+ if (n) {
65
+ O = null, await n.submit(t) && await O;
66
66
  return;
67
67
  }
68
68
  await _.complete(_.data());
@@ -82,7 +82,7 @@ var m = Symbol.for("bitboss-ui:overlay-action-attrs"), h = (e) => e === !0 || e
82
82
  ...g(a(t)),
83
83
  loading: k.value === t.key,
84
84
  disabled: k.value !== null && k.value !== t.key,
85
- onClick: () => A(t)
85
+ onClick: (e) => A(t, e?.currentTarget ?? void 0)
86
86
  }, S?.() ?? {})))
87
87
  };
88
88
  }, v = (e) => {
@@ -88,7 +88,7 @@ var Ce = ["id"], we = /*@__PURE__*/ f({
88
88
  read: (e) => G(_.model, e),
89
89
  write: (e, t) => {
90
90
  let n = _.model;
91
- n && !s(G(n, e), t) && ft(n, e, t);
91
+ n && !s(G(n, e), t) && pt(n, e, t);
92
92
  }
93
93
  });
94
94
  let O = d(() => {
@@ -158,9 +158,9 @@ var Ce = ["id"], we = /*@__PURE__*/ f({
158
158
  }
159
159
  }, qe = async (e, t) => {
160
160
  await p();
161
- let n = _t.value, r = document.activeElement;
161
+ let n = vt.value, r = document.activeElement;
162
162
  if (r !== t && r && r !== document.body) return;
163
- let i = !r || r === document.body, a = !!n && (n.contains(r) || r?.form === n);
163
+ let i = !r || r === document.body, a = !!n && (n.contains(r) || !!r && r === rt || r?.form === n);
164
164
  (i ? v.value === 0 : !a) || $e(e);
165
165
  }, Je = e(_.fieldErrors), Ye = v.value;
166
166
  be(() => e(_.fieldErrors), (e) => {
@@ -202,7 +202,7 @@ var Ce = ["id"], we = /*@__PURE__*/ f({
202
202
  }
203
203
  return n;
204
204
  }, Qe = (e) => !!e && typeof e == "object" && Object.getPrototypeOf(e) === Object.prototype, $e = (e) => {
205
- let t = _t.value;
205
+ let t = vt.value;
206
206
  if (!t) return;
207
207
  let n = [...C].filter((t) => e[t.name()] !== void 0).map((e) => e.el()).filter((e) => !!e && t.contains(e)).sort(ne);
208
208
  for (let e of n) {
@@ -237,33 +237,33 @@ var Ce = ["id"], we = /*@__PURE__*/ f({
237
237
  saving: () => N.value > 0,
238
238
  savingFor: nt
239
239
  });
240
- let I = ee({
240
+ let rt, I = ee({
241
241
  locked: P,
242
- submit: async () => await Z() === !0
243
- }), rt = !1, L = (e) => {
242
+ submit: async (e) => (rt = e, await Z() === !0)
243
+ }), it = !1, L = (e) => {
244
244
  let t = M?.appContext.config.errorHandler;
245
245
  t ? t(e, M?.proxy ?? null, "component event handler") : console.error(e);
246
- }, it = (e) => typeof e?.then == "function", at = ae("BbForm", "isValidationError"), ot = (e) => {
246
+ }, at = (e) => typeof e?.then == "function", ot = ae("BbForm", "isValidationError"), st = (e) => {
247
247
  let t = {};
248
248
  for (let [n, i] of Object.entries(e)) {
249
249
  let e = D(r(n));
250
250
  i.every((t) => e.includes(t)) || (t[n] = i);
251
251
  }
252
252
  Object.keys(t).length ? He(t, {}, e, "rejection") : A(e, "rejection");
253
- }, st = (e) => {
253
+ }, ct = (e) => {
254
254
  let t = M?.vnode.props?.onSubmitError, n = Array.isArray(t) ? t : t ? [t] : [];
255
255
  if (!n.length) return L(e);
256
256
  for (let t of n) try {
257
257
  let n = t(e);
258
- it(n) && Promise.resolve(n).catch(L);
258
+ at(n) && Promise.resolve(n).catch(L);
259
259
  } catch (e) {
260
260
  L(e);
261
261
  }
262
- }, ct = (e, t) => {
262
+ }, lt = (e, t) => {
263
263
  let n = M?.vnode.props, r = (e) => Array.isArray(e) ? e : typeof e == "function" ? [e] : [], i = r(n?.onSubmit);
264
- if (!rt) {
264
+ if (!it) {
265
265
  let e = r(n?.onSubmitOnce);
266
- e.length && (rt = !0, i.push(...e));
266
+ e.length && (it = !0, i.push(...e));
267
267
  }
268
268
  if (!i.length) return I({
269
269
  value: void 0,
@@ -273,15 +273,15 @@ var Ce = ["id"], we = /*@__PURE__*/ f({
273
273
  e === !1 ? a = !0 : o === void 0 && e !== void 0 && (o = e);
274
274
  }, c = (e) => {
275
275
  a = !0;
276
- let t = ie(e, at());
277
- t ? ot(t) : st(e);
276
+ let t = ie(e, ot());
277
+ t ? st(t) : ct(e);
278
278
  }, l = () => !a && {
279
279
  value: o,
280
280
  values: e
281
281
  }, u = [];
282
282
  for (let n of i) try {
283
283
  let r = n(e, { submitter: t });
284
- it(r) ? u.push(Promise.resolve(r).then(s, c)) : s(r);
284
+ at(r) ? u.push(Promise.resolve(r).then(s, c)) : s(r);
285
285
  } catch (e) {
286
286
  c(e);
287
287
  }
@@ -290,7 +290,7 @@ var Ce = ["id"], we = /*@__PURE__*/ f({
290
290
  return N.value++, tt(t, 1), ee.finally(() => {
291
291
  N.value--, tt(t, -1);
292
292
  }).then(() => (I(l()), !a));
293
- }, lt = Oe((e, t) => ct(e, t?.evt?.submitter ?? null), et), R = (e) => e.split(/\.|\[(\d+)\]/).filter((e) => e !== void 0 && e !== ""), z = (e, t) => e === t || e.startsWith(`${t}.`) || e.startsWith(`${t}[`), B = (e) => Array.isArray(e) ? e.map(B) : e && Object.getPrototypeOf(e) === Object.prototype ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e, B(t)])) : e, V = (e) => {
293
+ }, ut = Oe((e, t) => lt(e, t?.evt?.submitter ?? null), et), R = (e) => e.split(/\.|\[(\d+)\]/).filter((e) => e !== void 0 && e !== ""), z = (e, t) => e === t || e.startsWith(`${t}.`) || e.startsWith(`${t}[`), B = (e) => Array.isArray(e) ? e.map(B) : e && Object.getPrototypeOf(e) === Object.prototype ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e, B(t)])) : e, V = (e) => {
294
294
  let t = S(r(e)), n = R(t);
295
295
  if (!n.length) return;
296
296
  let [i, ...a] = n, o = b[i];
@@ -314,14 +314,14 @@ var Ce = ["id"], we = /*@__PURE__*/ f({
314
314
  index: Number(t[e])
315
315
  };
316
316
  return null;
317
- }, ut = (e) => e.split(".").reduce((e, t) => e && typeof e == "object" ? e[t] : void 0, b), W = (e) => {
317
+ }, dt = (e) => e.split(".").reduce((e, t) => e && typeof e == "object" ? e[t] : void 0, b), W = (e) => {
318
318
  let t = H(e);
319
319
  return [...C].some((e) => {
320
320
  let n = H(e.name());
321
321
  return n === t || n.startsWith(`${t}.`);
322
322
  });
323
- }, dt = (e) => {
324
- let t = ut(e);
323
+ }, ft = (e) => {
324
+ let t = dt(e);
325
325
  if (!Array.isArray(t)) return;
326
326
  let n = -1;
327
327
  for (let t of C) {
@@ -331,18 +331,18 @@ var Ce = ["id"], we = /*@__PURE__*/ f({
331
331
  let r = G(_.model, e);
332
332
  Array.isArray(r) && (n = Math.max(n, r.length - 1));
333
333
  for (let r = t.length - 1; r > n; r--) V(`${e}.${r}`);
334
- }, G = (e, t) => R(r(t)).reduce((e, t) => e && typeof e == "object" ? e[t] : void 0, e), ft = (e, t, n) => {
334
+ }, G = (e, t) => R(r(t)).reduce((e, t) => e && typeof e == "object" ? e[t] : void 0, e), pt = (e, t, n) => {
335
335
  let i = R(r(t)), a = e;
336
336
  i.slice(0, -1).forEach((e, t) => {
337
337
  let n = a[e];
338
338
  n && typeof n == "object" || (a[e] = /^(0|[1-9]\d*)$/.test(i[t + 1]) ? [] : {}), a = a[e];
339
339
  }), a[i[i.length - 1]] = n;
340
- }, pt = (e, t) => {
340
+ }, mt = (e, t) => {
341
341
  let n = R(r(t)), i = G(e, n.slice(0, -1).join(".")), a = n[n.length - 1];
342
342
  i && typeof i == "object" && !Array.isArray(i) && a in i && delete i[a];
343
343
  }, K = /* @__PURE__ */ new Set(), q = /* @__PURE__ */ new Set(), J = /* @__PURE__ */ new Set(), Y = !1, X = () => {
344
- Y || (Y = !0, p().then(() => p()).then(mt));
345
- }, mt = () => {
344
+ Y || (Y = !0, p().then(() => p()).then(ht));
345
+ }, ht = () => {
346
346
  Y = !1;
347
347
  for (let e of C) e.reassert();
348
348
  let e = !!g(_.keepValuesOnUnmount), t = /* @__PURE__ */ new Set();
@@ -362,15 +362,15 @@ var Ce = ["id"], we = /*@__PURE__*/ f({
362
362
  }
363
363
  for (let r of K) {
364
364
  let i = U(r);
365
- i ? t.add(i.container) : !e && !W(r) && pt(n, r);
365
+ i ? t.add(i.container) : !e && !W(r) && mt(n, r);
366
366
  }
367
367
  }
368
368
  K.clear(), q.clear(), J.clear();
369
- for (let e of t) dt(e);
369
+ for (let e of t) ft(e);
370
370
  $();
371
- }, ht = (e) => {
371
+ }, gt = (e) => {
372
372
  J.add(e), X();
373
- }, Z = (e) => (k.value = {}, lt(e)), gt = (e, t) => {
373
+ }, Z = (e) => (k.value = {}, ut(e)), _t = (e, t) => {
374
374
  let n = e;
375
375
  for (let e of t.split(/\.|\[(\d+)\]/).filter(Boolean)) {
376
376
  if (!n || typeof n != "object" || !(e in n)) return !1;
@@ -379,11 +379,11 @@ var Ce = ["id"], we = /*@__PURE__*/ f({
379
379
  return !0;
380
380
  }, Q = (...e) => {
381
381
  Ae(...e), k.value = {}, Pe();
382
- for (let [e, t] of Object.entries(w)) gt(b, e) ? Object.assign(t, {
382
+ for (let [e, t] of Object.entries(w)) _t(b, e) ? Object.assign(t, {
383
383
  dirty: !1,
384
384
  touched: !1
385
385
  }) : delete w[e];
386
- }, _t = ye("form-el"), $ = t(() => _.id, {
386
+ }, vt = ye("form-el"), $ = t(() => _.id, {
387
387
  state: () => ({
388
388
  valid: y.value.valid,
389
389
  dirty: y.value.dirty,
@@ -404,10 +404,10 @@ var Ce = ["id"], we = /*@__PURE__*/ f({
404
404
  snapshot: Xe,
405
405
  validate: async () => (await Me()).valid,
406
406
  setErrors: Ve,
407
- removeField: ht
407
+ removeField: gt
408
408
  }
409
409
  });
410
- return we({ $el: _t }), (e, t) => (m(), ce("form", {
410
+ return we({ $el: vt }), (e, t) => (m(), ce("form", {
411
411
  id: f.id,
412
412
  ref: "form-el",
413
413
  novalidate: "",
@@ -417,7 +417,7 @@ var Ce = ["id"], we = /*@__PURE__*/ f({
417
417
  errors: ze.value,
418
418
  fields: O.value,
419
419
  isSubmitting: g(ke),
420
- removeField: ht,
420
+ removeField: gt,
421
421
  resetForm: Q,
422
422
  setErrors: Ve,
423
423
  snapshot: Xe,