@bettercms-ai/types 1.49.0 → 1.50.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/dist/index.d.ts CHANGED
@@ -54,6 +54,11 @@ interface NumberFieldFormat {
54
54
  decimal?: "." | ",";
55
55
  /** Fraction digits always shown (`2` for `£3.20`). A value with more keeps its own, up to six. */
56
56
  decimals?: number;
57
+ /**
58
+ * How the integer digits are grouped: `"3"` (absent) in threes, `"3;2"` the Indian way, the last
59
+ * three then pairs (`₹1,20,000`). Only meaningful with a `group` mark.
60
+ */
61
+ grouping?: "3" | "3;2";
57
62
  }
58
63
  /** The format a stored `config.format` holds, with anything malformed dropped: a bad row never throws at publish. */
59
64
  declare function readNumberFormat(raw: unknown): NumberFieldFormat;
@@ -513,6 +518,11 @@ interface ContentModelFieldUi {
513
518
  };
514
519
  /** V2 `valueShape`: a link / image / button writes a plain string or the object. */
515
520
  valueShape?: "string" | "object";
521
+ /** A live reference to a vendor item (custom integrations): the integration's slug and reference key. */
522
+ reference?: {
523
+ integration: string;
524
+ key: string;
525
+ };
516
526
  /** V2 field access (D58): who sees and who changes it. The editor gates; the backend stores. */
517
527
  access?: {
518
528
  view?: "schema.view";
@@ -2596,6 +2606,8 @@ interface Component {
2596
2606
  icon?: DockIconName | null;
2597
2607
  /** Declared tabs no top-level prop sits in. Null/absent = none. @see ComponentTab */
2598
2608
  tabs?: ComponentTab[] | null;
2609
+ /** The bettercms://kit entry its V2 dock UI was built from (a kit-catalog id). Null/absent = none named. */
2610
+ kitEntry?: string | null;
2599
2611
  status: ComponentStatus;
2600
2612
  /** When it left the working set, or null/absent while active. @see ComponentStatus */
2601
2613
  archivedAt?: string | Date | null;
package/dist/index.js CHANGED
@@ -94,20 +94,23 @@ function readNumberFormat(raw) {
94
94
  const group = typeof o.group === "string" && GROUPS.includes(o.group) ? o.group : void 0;
95
95
  const decimal = o.decimal === "," ? "," : void 0;
96
96
  const decimals = typeof o.decimals === "number" && Number.isInteger(o.decimals) && o.decimals > 0 && o.decimals <= 6 ? o.decimals : void 0;
97
+ const grouping = o.grouping === "3;2" ? "3;2" : void 0;
97
98
  return {
98
99
  ...prefix ? { prefix } : {},
99
100
  ...suffix ? { suffix } : {},
100
101
  // A group mark that is also the decimal mark would print a number nobody can read back.
101
102
  ...group && group !== (decimal ?? ".") ? { group } : {},
102
103
  ...decimal ? { decimal } : {},
103
- ...decimals ? { decimals } : {}
104
+ ...decimals ? { decimals } : {},
105
+ ...grouping ? { grouping } : {}
104
106
  };
105
107
  }
108
+ var groupDigits = (int, mark, grouping) => grouping === "3;2" && int.length > 3 ? `${int.slice(0, -3).replace(/\B(?=(\d{2})+(?!\d))/g, mark)}${mark}${int.slice(-3)}` : int.replace(/\B(?=(\d{3})+(?!\d))/g, mark);
106
109
  function formatNumber(value, format = {}) {
107
110
  if (typeof value !== "number" || !Number.isFinite(value)) return "";
108
111
  const places = Math.max(format.decimals ?? 0, Math.min(6, fractionDigits(value)));
109
112
  const [int, frac] = Math.abs(value).toFixed(places).split(".");
110
- const grouped = format.group ? int.replace(/\B(?=(\d{3})+(?!\d))/g, format.group) : int;
113
+ const grouped = format.group ? groupDigits(int, format.group, format.grouping) : int;
111
114
  return `${value < 0 ? "-" : ""}${format.prefix ?? ""}${grouped}${frac ? `${format.decimal ?? "."}${frac}` : ""}${format.suffix ?? ""}`;
112
115
  }
113
116
  function parseNumberText(text, opts = {}) {