aktion-runtime 0.5.10 → 0.5.11

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/testing.js CHANGED
@@ -3216,33 +3216,6 @@ function mergeLibraries(base, extra) {
3216
3216
  function findComponent(library, name) {
3217
3217
  return getIndex(library).get(name);
3218
3218
  }
3219
- function findPositionalIndex(spec) {
3220
- const explicit = spec.props.findIndex((p) => p.positional === true);
3221
- if (explicit >= 0) return explicit;
3222
- return spec.props.length > 0 ? 0 : -1;
3223
- }
3224
- function findPositionalProp(spec) {
3225
- const idx = findPositionalIndex(spec);
3226
- return idx >= 0 ? spec.props[idx] : void 0;
3227
- }
3228
- function assertOnePositionalMax(specs) {
3229
- for (const spec of specs) {
3230
- const positional = spec.props.filter((p) => p.positional === true);
3231
- if (positional.length > 1) {
3232
- const names = positional.map((p) => p.name).join(", ");
3233
- throw new SyntaxError(
3234
- `Component "${spec.name}" declares ${positional.length} positional props (${names}). Aktion 0.5 §19.1 allows at most one.`
3235
- );
3236
- }
3237
- }
3238
- }
3239
- function mapPositionalArgs(spec, args) {
3240
- const out = {};
3241
- spec.props.forEach((prop, index) => {
3242
- if (index < args.length) out[prop.name] = args[index];
3243
- });
3244
- return out;
3245
- }
3246
3219
  const FONT_AWESOME_CDN_URL = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css";
3247
3220
  const FONT_AWESOME_VERSION = "6.7.2";
3248
3221
  const LINK_MARKER_ATTR = "data-rui-font-awesome";
@@ -3367,6 +3340,30 @@ function asNumber(value, fallback = 0) {
3367
3340
  }
3368
3341
  return fallback;
3369
3342
  }
3343
+ const SPACING_TOKENS = ["none", "3xs", "2xs", "xs", "sm", "md", "lg", "xl", "2xl", "3xl"];
3344
+ const LEGACY_SIZE_TOKEN_ALIASES = {
3345
+ s: "sm",
3346
+ m: "md",
3347
+ l: "lg",
3348
+ small: "sm",
3349
+ normal: "md",
3350
+ large: "lg"
3351
+ };
3352
+ function canonicalSizeToken(value) {
3353
+ const raw = typeof value === "string" ? value.trim() : "";
3354
+ return LEGACY_SIZE_TOKEN_ALIASES[raw] ?? raw;
3355
+ }
3356
+ function normalizeSpacingToken(value, fallback = "") {
3357
+ const token = canonicalSizeToken(value);
3358
+ return SPACING_TOKENS.includes(token) ? token : fallback;
3359
+ }
3360
+ function spacingCssValue(value) {
3361
+ const token = normalizeSpacingToken(value);
3362
+ if (!token) return "";
3363
+ if (token === "none") return "0";
3364
+ const varKey = token === "sm" ? "s" : token === "md" ? "m" : token === "lg" ? "l" : token;
3365
+ return `var(--rui-spacing-${varKey})`;
3366
+ }
3370
3367
  const RESPONSIVE_BREAKPOINTS = ["base", "sm", "md", "lg", "xl"];
3371
3368
  function readResponsiveProp(value) {
3372
3369
  if (value == null || typeof value !== "object" || Array.isArray(value)) {
@@ -3632,6 +3629,8 @@ function stateClassFor(groups) {
3632
3629
  }
3633
3630
  const SPACING = {
3634
3631
  none: "0",
3632
+ "3xs": "var(--rui-spacing-3xs)",
3633
+ "2xs": "var(--rui-spacing-2xs)",
3635
3634
  xs: "var(--rui-spacing-xs)",
3636
3635
  s: "var(--rui-spacing-s)",
3637
3636
  sm: "var(--rui-spacing-s)",
@@ -4278,13 +4277,135 @@ function applyUniversal(node, universal) {
4278
4277
  }
4279
4278
  }
4280
4279
  }
4280
+ function findPositionalIndex(spec) {
4281
+ const explicit = spec.props.findIndex((p) => p.positional === true);
4282
+ if (explicit >= 0) return explicit;
4283
+ return spec.props.length > 0 ? 0 : -1;
4284
+ }
4285
+ function findPositionalProp(spec) {
4286
+ const idx = findPositionalIndex(spec);
4287
+ return idx >= 0 ? spec.props[idx] : void 0;
4288
+ }
4289
+ function assertOnePositionalMax(specs) {
4290
+ for (const spec of specs) {
4291
+ const positional = spec.props.filter((p) => p.positional === true);
4292
+ if (positional.length > 1) {
4293
+ const names = positional.map((p) => p.name).join(", ");
4294
+ throw new SyntaxError(
4295
+ `Component "${spec.name}" declares ${positional.length} positional props (${names}). Aktion 0.5 §19.1 allows at most one.`
4296
+ );
4297
+ }
4298
+ }
4299
+ }
4300
+ function propExpectsObject(prop) {
4301
+ return /\bobject\b|\bRecord\b|\{|\bany\b/i.test(prop.type);
4302
+ }
4303
+ function knownPropNames(spec) {
4304
+ const names = /* @__PURE__ */ new Set();
4305
+ for (const p of spec.props) {
4306
+ names.add(p.name);
4307
+ if (p.aliases) for (const alias of p.aliases) names.add(alias);
4308
+ }
4309
+ names.add("key");
4310
+ return names;
4311
+ }
4312
+ function slotForNthPositional(spec, n) {
4313
+ const positionalIndex = findPositionalIndex(spec);
4314
+ if (positionalIndex < 0) return null;
4315
+ const filled = /* @__PURE__ */ new Set();
4316
+ let target = -1;
4317
+ for (let i = 0; i <= n; i += 1) {
4318
+ if (i === 0) {
4319
+ target = positionalIndex;
4320
+ } else {
4321
+ let cursor = 0;
4322
+ while (cursor < spec.props.length && filled.has(cursor)) cursor += 1;
4323
+ if (cursor >= spec.props.length) return null;
4324
+ target = cursor;
4325
+ }
4326
+ filled.add(target);
4327
+ }
4328
+ return spec.props[target] ?? null;
4329
+ }
4330
+ function chooseNamedBagIndex(args, spec) {
4331
+ let lastObj = -1;
4332
+ for (let i = args.length - 1; i >= 0; i -= 1) {
4333
+ if (args[i].objectKeys !== null) {
4334
+ lastObj = i;
4335
+ break;
4336
+ }
4337
+ }
4338
+ if (lastObj < 0) return -1;
4339
+ const keys = args[lastObj].objectKeys;
4340
+ const known = knownPropNames(spec);
4341
+ const knownCount = keys.reduce(
4342
+ (count, k) => count + (known.has(k) || UNIVERSAL_PROP_NAMES.has(k) ? 1 : 0),
4343
+ 0
4344
+ );
4345
+ const allKnown = keys.length > 0 && knownCount === keys.length;
4346
+ const anyKnown = knownCount > 0;
4347
+ const positionalProp = findPositionalProp(spec);
4348
+ if (args.length === 1) {
4349
+ if (spec.props.length === 1) {
4350
+ return propExpectsObject(spec.props[0]) ? -1 : allKnown ? 0 : -1;
4351
+ }
4352
+ if (allKnown) return 0;
4353
+ if (!anyKnown && positionalProp && propExpectsObject(positionalProp)) return -1;
4354
+ return 0;
4355
+ }
4356
+ if (lastObj !== args.length - 1) {
4357
+ return anyKnown ? lastObj : -1;
4358
+ }
4359
+ if (anyKnown || keys.length === 0) return lastObj;
4360
+ const slot = slotForNthPositional(spec, args.length - 1);
4361
+ if (slot && propExpectsObject(slot)) return -1;
4362
+ return lastObj;
4363
+ }
4364
+ function callArgShapes(args) {
4365
+ return args.map((arg) => ({
4366
+ objectKeys: arg.kind === "Object" && arg.properties ? arg.properties.filter((p) => !p.spread).map((p) => p.key) : null
4367
+ }));
4368
+ }
4369
+ function mapPositionalArgs(spec, args) {
4370
+ const out = {};
4371
+ spec.props.forEach((prop, index) => {
4372
+ if (index < args.length) out[prop.name] = args[index];
4373
+ });
4374
+ return out;
4375
+ }
4281
4376
  function validateProgramSchema(program, library) {
4282
4377
  const errors = [];
4283
- for (const stmt of program.statements) {
4284
- walkStatement(stmt, library, errors);
4378
+ currentDeclaredComponents = collectDeclaredComponentNames(program);
4379
+ try {
4380
+ for (const stmt of program.statements) {
4381
+ walkStatement(stmt, library, errors);
4382
+ }
4383
+ } finally {
4384
+ currentDeclaredComponents = EMPTY_NAME_SET;
4285
4385
  }
4286
4386
  return errors;
4287
4387
  }
4388
+ const EMPTY_NAME_SET = /* @__PURE__ */ new Set();
4389
+ let currentDeclaredComponents = EMPTY_NAME_SET;
4390
+ function collectDeclaredComponentNames(program) {
4391
+ const names = /* @__PURE__ */ new Set();
4392
+ const scan = (node) => {
4393
+ if (!node || typeof node !== "object") return;
4394
+ if (Array.isArray(node)) {
4395
+ for (const entry of node) scan(entry);
4396
+ return;
4397
+ }
4398
+ const rec = node;
4399
+ if (rec.kind === "ComponentDeclaration" && typeof rec.name === "string") {
4400
+ names.add(rec.name);
4401
+ }
4402
+ for (const key of Object.keys(rec)) {
4403
+ if (key !== "loc") scan(rec[key]);
4404
+ }
4405
+ };
4406
+ scan(program.statements);
4407
+ return names;
4408
+ }
4288
4409
  function walkStatement(stmt, library, out) {
4289
4410
  switch (stmt.kind) {
4290
4411
  case "Assignment":
@@ -4294,6 +4415,9 @@ function walkStatement(stmt, library, out) {
4294
4415
  walkExpression(stmt.expression, library, out);
4295
4416
  return;
4296
4417
  case "ComponentDeclaration":
4418
+ validateComponentDeclarationName(stmt, library, out);
4419
+ for (const inner of stmt.body.body) walkStatement(inner, library, out);
4420
+ return;
4297
4421
  case "ActionDeclaration":
4298
4422
  case "EffectDeclaration":
4299
4423
  case "HookDeclaration":
@@ -4430,7 +4554,28 @@ function walkExpression(expr, library, out) {
4430
4554
  return;
4431
4555
  }
4432
4556
  }
4557
+ function validateComponentDeclarationName(stmt, library, out) {
4558
+ if (!findComponent(library, stmt.name)) return;
4559
+ if (subtreeCallsName(stmt.body, stmt.name)) return;
4560
+ out.push({
4561
+ message: `function ${stmt.name}(...) — "${stmt.name}" is a built-in component name. Rename the custom component (e.g. "App${stmt.name}"), or call ${stmt.name}(...) inside the body to wrap the built-in (inside its own body the name refers to the built-in component).`,
4562
+ line: stmt.loc?.line ?? 0,
4563
+ column: stmt.loc?.column ?? 0
4564
+ });
4565
+ }
4566
+ function subtreeCallsName(node, name) {
4567
+ if (!node || typeof node !== "object") return false;
4568
+ if (Array.isArray(node)) return node.some((entry) => subtreeCallsName(entry, name));
4569
+ const rec = node;
4570
+ if (rec.kind === "Call" && rec.callee === name) return true;
4571
+ for (const key of Object.keys(rec)) {
4572
+ if (key === "loc") continue;
4573
+ if (subtreeCallsName(rec[key], name)) return true;
4574
+ }
4575
+ return false;
4576
+ }
4433
4577
  function validateCall(expr, library, out) {
4578
+ if (currentDeclaredComponents.has(expr.callee)) return;
4434
4579
  const spec = findComponent(library, expr.callee);
4435
4580
  if (!spec) return;
4436
4581
  const propNames = /* @__PURE__ */ new Set();
@@ -4442,31 +4587,41 @@ function validateCall(expr, library, out) {
4442
4587
  }
4443
4588
  propNames.add("key");
4444
4589
  const args = expr.arguments;
4445
- let trailingObjIdx = -1;
4446
- for (let i = args.length - 1; i >= 0; i -= 1) {
4447
- if (args[i].kind === "Object") {
4448
- trailingObjIdx = i;
4449
- break;
4450
- }
4451
- }
4590
+ const trailingObjIdx = chooseNamedBagIndex(callArgShapes(args), spec);
4452
4591
  const trailingObj = trailingObjIdx >= 0 ? args[trailingObjIdx] : null;
4453
4592
  const positionalArgs = [];
4454
4593
  for (let i = 0; i < args.length; i++) {
4455
4594
  if (i === trailingObjIdx) continue;
4456
4595
  positionalArgs.push(args[i]);
4457
4596
  }
4458
- if (positionalArgs.length > 1) {
4459
- const positionalProp = findPositionalProp(spec);
4460
- const positionalName = positionalProp?.name ?? "(none)";
4461
- const namedNames = collectNamedPropNames(args, trailingObj);
4462
- const extras = spec.props.filter((p) => p.name !== positionalName && !namedNames.has(p.name)).slice(0, positionalArgs.length - 1).map((p) => p.name);
4463
- const hints = extras.length > 0 ? extras.map((n) => `${n}: …`).join(", ") : "use a trailing { prop: value } object";
4597
+ if (positionalArgs.length > spec.props.length) {
4464
4598
  out.push({
4465
- message: `${expr.callee}(...) — Aktion 0.5 §19.1 allows at most one positional argument (the "${positionalName}" prop). The extra ${positionalArgs.length - 1} positional argument(s) must be passed inside a trailing object: ${hints}. Multi-positional calls are removed.`,
4599
+ message: `${expr.callee}(...) — takes at most ${spec.props.length} positional argument${spec.props.length === 1 ? "" : "s"} (${spec.props.map((p) => p.name).join(", ")}); got ${positionalArgs.length}.`,
4466
4600
  line: expr.loc?.line ?? 0,
4467
4601
  column: expr.loc?.column ?? 0
4468
4602
  });
4469
4603
  }
4604
+ positionalArgs.forEach((arg, n) => {
4605
+ const prop = slotForNthPositional(spec, n);
4606
+ if (!prop) return;
4607
+ if (prop.enum && arg.kind === "Literal" && typeof arg.value === "string") {
4608
+ const value = arg.value;
4609
+ if (!prop.enum.includes(value) && !prop.enum.includes(canonicalSizeToken(value))) {
4610
+ out.push({
4611
+ message: `<${expr.callee}> ${prop.name}="${value}" — must be one of ${prop.enum.map((v) => `"${v}"`).join(", ")}.`,
4612
+ line: arg.loc?.line ?? expr.loc?.line ?? 0,
4613
+ column: arg.loc?.column ?? expr.loc?.column ?? 0
4614
+ });
4615
+ }
4616
+ }
4617
+ if (arg.kind === "Object" && !propExpectsObject(prop)) {
4618
+ out.push({
4619
+ message: `<${expr.callee}> — object passed positionally for "${prop.name}" (${prop.type}). Use named props from: ${spec.props.map((p) => p.name).join(", ")}.`,
4620
+ line: arg.loc?.line ?? expr.loc?.line ?? 0,
4621
+ column: arg.loc?.column ?? expr.loc?.column ?? 0
4622
+ });
4623
+ }
4624
+ });
4470
4625
  const namedEntries = [];
4471
4626
  if (trailingObj) {
4472
4627
  for (const prop of trailingObj.properties) {
@@ -4493,7 +4648,7 @@ function validateCall(expr, library, out) {
4493
4648
  );
4494
4649
  if (prop?.enum && entry.value.kind === "Literal" && typeof entry.value.value === "string") {
4495
4650
  const value = entry.value.value;
4496
- if (!prop.enum.includes(value)) {
4651
+ if (!prop.enum.includes(value) && !prop.enum.includes(canonicalSizeToken(value))) {
4497
4652
  out.push({
4498
4653
  message: `<${expr.callee}> ${entry.name}="${value}" — must be one of ${prop.enum.map((v) => `"${v}"`).join(", ")}.`,
4499
4654
  line: entry.loc?.line ?? expr.loc?.line ?? 0,
@@ -4503,15 +4658,6 @@ function validateCall(expr, library, out) {
4503
4658
  }
4504
4659
  }
4505
4660
  }
4506
- function collectNamedPropNames(_args, trailingObj) {
4507
- const names = /* @__PURE__ */ new Set();
4508
- if (trailingObj) {
4509
- for (const prop of trailingObj.properties) {
4510
- if (!prop.spread) names.add(prop.key);
4511
- }
4512
- }
4513
- return names;
4514
- }
4515
4661
  const STRUCTURED_THEME_GROUPS$1 = /* @__PURE__ */ new Set(["colors", "radius", "font", "fonts", "spacing", "shadows", "gradients", "icons", "zIndex", "motion"]);
4516
4662
  const THEME_METADATA_KEYS$1 = /* @__PURE__ */ new Set(["name", "direction"]);
4517
4663
  function validateThemeCall(expr, out) {
@@ -4755,7 +4901,7 @@ function applyDirectionWithReverse(value, reverse) {
4755
4901
  function emitResponsiveSpacingVars(styleParts, prop, cssPrefix) {
4756
4902
  for (const bp of RESPONSIVE_BREAKPOINTS) {
4757
4903
  const v = prop.values[bp];
4758
- if (v) styleParts.push(`${cssPrefix}-${bp}:var(--rui-spacing-${v}, ${v})`);
4904
+ if (v) styleParts.push(`${cssPrefix}-${bp}:${spacingCssValue(v) || `var(--rui-spacing-${v}, ${v})`}`);
4759
4905
  }
4760
4906
  }
4761
4907
  function emitResponsiveFlexVars(styleParts, prop, cssPrefix, mapper) {
@@ -4857,7 +5003,7 @@ function renderFlexContainer(directionValue, uniform, alignDefault, props, helpe
4857
5003
  }
4858
5004
  }
4859
5005
  if (gap.kind === "single") {
4860
- attrs["data-gap"] = gap.value ? String(gap.value) : "m";
5006
+ attrs["data-gap"] = gap.value ? normalizeSpacingToken(gap.value, String(gap.value)) : "md";
4861
5007
  } else {
4862
5008
  attrs["data-gap"] = "responsive";
4863
5009
  attrs["data-responsive-gap"] = "true";
@@ -4880,7 +5026,7 @@ function renderFlexContainer(directionValue, uniform, alignDefault, props, helpe
4880
5026
  const alignContent = asString$1(props.alignContent);
4881
5027
  if (alignContent) attrs["data-align-content"] = alignContent;
4882
5028
  if (padding.kind === "single") {
4883
- const pad = padding.value ? String(padding.value) : null;
5029
+ const pad = padding.value ? normalizeSpacingToken(padding.value, String(padding.value)) : null;
4884
5030
  if (pad) attrs["data-padding"] = pad;
4885
5031
  } else {
4886
5032
  attrs["data-padding"] = "responsive";
@@ -4894,11 +5040,11 @@ function renderFlexContainer(directionValue, uniform, alignDefault, props, helpe
4894
5040
  }
4895
5041
  return root;
4896
5042
  }
4897
- const FLEX_GAP_PROP = { name: "gap", type: "string | object", optional: true, enum: ["xs", "s", "m", "l", "xl"], description: "Spacing between children. May be a responsive map." };
5043
+ const FLEX_GAP_PROP = { name: "gap", type: "string | object", optional: true, enum: SPACING_TOKENS, description: "Spacing between children. May be a responsive map." };
4898
5044
  const FLEX_JUSTIFY_PROP = { name: "justify", type: "string | object", optional: true, enum: ["start", "center", "end", "between", "around", "evenly"], description: "Main-axis distribution. May be a responsive map." };
4899
5045
  const FLEX_WRAP_PROP = { name: "wrap", type: "boolean", optional: true, description: "Wrap children onto multiple lines when they overflow" };
4900
5046
  const FLEX_REVERSE_PROP = { name: "reverse", type: "boolean", optional: true, description: "Reverse the visual order of children" };
4901
- const FLEX_PADDING_PROP = { name: "padding", type: "string | object", optional: true, enum: ["xs", "s", "m", "l", "xl"], description: "Inner padding token. May be a responsive map." };
5047
+ const FLEX_PADDING_PROP = { name: "padding", type: "string | object", optional: true, enum: SPACING_TOKENS, description: "Inner padding token. May be a responsive map." };
4902
5048
  const FLEX_INLINE_PROP = { name: "inline", type: "boolean", optional: true, description: "Use inline-flex (shrink-to-fit) instead of a full-width block" };
4903
5049
  const FLEX_ALIGN_CONTENT_PROP = { name: "alignContent", type: "string", optional: true, enum: ["start", "center", "end", "between", "around", "stretch"], description: "Alignment of wrapped lines (only when `wrap` is on)" };
4904
5050
  const Row = {
@@ -4906,7 +5052,7 @@ const Row = {
4906
5052
  description: "Lay children out horizontally (left → right) with even spacing. The developer-friendly default: children keep their natural width and are vertically centered. Set `grow=true` to make children share the row equally (for equal-width columns prefer `Grid(columns: N)`); drop a `Spacer()` between children to push them apart; wrap a child in `StackItem` for per-child grow/shrink/alignment. Use `wrap=true` for chips/tags that should flow onto multiple lines.",
4907
5053
  props: [
4908
5054
  { name: "children", type: "Node[]", description: "Children laid out left → right" },
4909
- { name: "gap", type: "string | object", optional: true, enum: ["xs", "s", "m", "l", "xl"], description: "Horizontal spacing between children (default `m`). May be a responsive map." },
5055
+ { name: "gap", type: "string | object", optional: true, enum: SPACING_TOKENS, description: "Horizontal spacing between children (default `md`). May be a responsive map." },
4910
5056
  { name: "align", type: "string | object", optional: true, enum: ["start", "center", "end", "stretch"], description: "Vertical alignment of children (default `center`). May be a responsive map." },
4911
5057
  { ...FLEX_JUSTIFY_PROP },
4912
5058
  { name: "grow", type: "boolean", optional: true, description: "Children share the row width equally (replaces the old `uniform`)" },
@@ -4923,7 +5069,7 @@ const Column = {
4923
5069
  description: "Lay children out vertically (top → bottom) with even spacing — the most common page/section layout. Children stretch to the full width by default; set `align` to `start`/`center`/`end` to change that. This is the recommended root container for a page or a card body.",
4924
5070
  props: [
4925
5071
  { name: "children", type: "Node[]", description: "Children laid out top → bottom" },
4926
- { name: "gap", type: "string | object", optional: true, enum: ["xs", "s", "m", "l", "xl"], description: "Vertical spacing between children (default `m`). May be a responsive map." },
5072
+ { name: "gap", type: "string | object", optional: true, enum: SPACING_TOKENS, description: "Vertical spacing between children (default `md`). May be a responsive map." },
4927
5073
  { name: "align", type: "string | object", optional: true, enum: ["start", "center", "end", "stretch"], description: "Horizontal alignment of children (default `stretch`). May be a responsive map." },
4928
5074
  { ...FLEX_JUSTIFY_PROP },
4929
5075
  { ...FLEX_WRAP_PROP },
@@ -4963,18 +5109,18 @@ const Center = {
4963
5109
  { name: "children", type: "Node[]", description: "Content to center" },
4964
5110
  { name: "axis", type: "string", optional: true, enum: ["both", "horizontal", "vertical"], description: "Which axis to center on (default both)" },
4965
5111
  { name: "minHeight", type: "string", optional: true, description: "CSS min-height — set to center vertically inside a tall region (e.g. `60vh`, `400px`)" },
4966
- { name: "gap", type: "string", optional: true, enum: ["xs", "s", "m", "l", "xl"], description: "Spacing between stacked children (default `m`)" },
4967
- { name: "padding", type: "string", optional: true, enum: ["xs", "s", "m", "l", "xl"], description: "Inner padding token" },
5112
+ { name: "gap", type: "string", optional: true, enum: SPACING_TOKENS, description: "Spacing between stacked children (default `md`)" },
5113
+ { name: "padding", type: "string", optional: true, enum: SPACING_TOKENS, description: "Inner padding token" },
4968
5114
  { name: "inline", type: "boolean", optional: true, description: "Shrink to fit content instead of filling the available width" }
4969
5115
  ],
4970
5116
  render: (_node, props, helpers) => {
4971
5117
  const attrs = {
4972
5118
  class: "rui-center",
4973
5119
  "data-axis": asString$1(props.axis, "both"),
4974
- "data-gap": asString$1(props.gap, "m"),
5120
+ "data-gap": normalizeSpacingToken(props.gap, "md"),
4975
5121
  "data-inline": asBoolean$1(props.inline) ? "true" : null
4976
5122
  };
4977
- const padding = asString$1(props.padding);
5123
+ const padding = normalizeSpacingToken(props.padding, asString$1(props.padding));
4978
5124
  if (padding) attrs["data-padding"] = padding;
4979
5125
  const styleParts = [];
4980
5126
  const minHeight = asString$1(props.minHeight);
@@ -5336,8 +5482,8 @@ const Box = {
5336
5482
  description: "Spacing and surface wrapper for padding, margin, borders, semantic backgrounds, and max-width constraints. Use when a `Card` is too heavy but the content needs a subtle surface or inset.",
5337
5483
  props: [
5338
5484
  { name: "children", type: "Node[]" },
5339
- { name: "padding", type: "string | object", optional: true, enum: ["xs", "s", "m", "l", "xl"], description: "Inner padding. May be a responsive map." },
5340
- { name: "margin", type: "string | object", optional: true, enum: ["xs", "s", "m", "l", "xl"], description: "Outer margin. May be a responsive map." },
5485
+ { name: "padding", type: "string | object", optional: true, enum: SPACING_TOKENS, description: "Inner padding. May be a responsive map." },
5486
+ { name: "margin", type: "string | object", optional: true, enum: SPACING_TOKENS, description: "Outer margin. May be a responsive map." },
5341
5487
  { name: "border", type: "string", optional: true, enum: ["none", "subtle", "default"], description: "Border preset (default none)" },
5342
5488
  { name: "background", type: "string", optional: true, enum: ["none", "surface", "muted", "primary", "success", "warning", "danger", "info"], description: "Semantic background token" },
5343
5489
  { name: "maxWidth", type: "string", optional: true, description: "CSS max-width" }
@@ -5354,7 +5500,7 @@ const Box = {
5354
5500
  const maxWidth = asString$1(props.maxWidth);
5355
5501
  if (maxWidth) styleParts.push(`max-width:${sanitiseCssLength(maxWidth, maxWidth)}`);
5356
5502
  if (padding.kind === "single") {
5357
- const pad = padding.value ? String(padding.value) : null;
5503
+ const pad = padding.value ? normalizeSpacingToken(padding.value, String(padding.value)) : null;
5358
5504
  if (pad) attrs["data-padding"] = pad;
5359
5505
  } else {
5360
5506
  attrs["data-padding"] = "responsive";
@@ -5362,7 +5508,7 @@ const Box = {
5362
5508
  emitResponsiveSpacingVars(styleParts, padding, "--rui-box-padding");
5363
5509
  }
5364
5510
  if (margin.kind === "single") {
5365
- const mar = margin.value ? String(margin.value) : null;
5511
+ const mar = margin.value ? normalizeSpacingToken(margin.value, String(margin.value)) : null;
5366
5512
  if (mar) attrs["data-margin"] = mar;
5367
5513
  } else {
5368
5514
  attrs["data-margin"] = "responsive";
@@ -5393,9 +5539,9 @@ const Grid = {
5393
5539
  props: [
5394
5540
  { name: "children", type: "Node[]" },
5395
5541
  { name: "columns", type: "number | object", optional: true, description: "Fixed column count 1–12. Omit for auto-fit; `12` (or `GridItem` children) enables the 12-track span system. May be a responsive map like `{base: 1, md: 3}`." },
5396
- { name: "gap", type: "string | object", optional: true, enum: ["xs", "s", "m", "l", "xl"], description: "Gap on both axes (default `m`). May be a responsive map." },
5397
- { name: "rowGap", type: "string | object", optional: true, enum: ["xs", "s", "m", "l", "xl"], description: "Row gap override. May be a responsive map." },
5398
- { name: "columnGap", type: "string | object", optional: true, enum: ["xs", "s", "m", "l", "xl"], description: "Column gap override. May be a responsive map." },
5542
+ { name: "gap", type: "string | object", optional: true, enum: SPACING_TOKENS, description: "Gap on both axes (default `md`). May be a responsive map." },
5543
+ { name: "rowGap", type: "string | object", optional: true, enum: SPACING_TOKENS, description: "Row gap override. May be a responsive map." },
5544
+ { name: "columnGap", type: "string | object", optional: true, enum: SPACING_TOKENS, description: "Column gap override. May be a responsive map." },
5399
5545
  { name: "minChildWidth", type: "string", optional: true, aliases: ["minItemWidth"], description: 'Minimum column width for AUTO-FIT mode, e.g. `"240px"` (default 220px). Also caps the floor in FIXED mode.' },
5400
5546
  { name: "alignItems", type: "string", optional: true, enum: ["start", "center", "end", "stretch"], description: "Vertical alignment of items within their cells" },
5401
5547
  { name: "justifyItems", type: "string", optional: true, enum: ["start", "center", "end", "stretch"], description: "Horizontal alignment of items within their cells" },
@@ -5449,21 +5595,21 @@ const Grid = {
5449
5595
  if (hasGridItems && !explicitNonTwelve) twelveColMode = true;
5450
5596
  if (twelveColMode) attrs["data-grid-mode"] = "12";
5451
5597
  if (gap.kind === "single") {
5452
- attrs["data-gap"] = gap.value ? String(gap.value) : "m";
5598
+ attrs["data-gap"] = gap.value ? normalizeSpacingToken(gap.value, String(gap.value)) : "md";
5453
5599
  } else {
5454
5600
  attrs["data-gap"] = "responsive";
5455
5601
  attrs["data-responsive-gap"] = "true";
5456
5602
  emitResponsiveSpacingVars(styleParts, gap, "--rui-grid-gap");
5457
5603
  }
5458
5604
  if (rowGap.kind === "single" && rowGap.value) {
5459
- attrs["data-row-gap"] = String(rowGap.value);
5605
+ attrs["data-row-gap"] = normalizeSpacingToken(rowGap.value, String(rowGap.value));
5460
5606
  } else if (rowGap.kind === "responsive") {
5461
5607
  attrs["data-row-gap"] = "responsive";
5462
5608
  attrs["data-responsive-row-gap"] = "true";
5463
5609
  emitResponsiveSpacingVars(styleParts, rowGap, "--rui-grid-row-gap");
5464
5610
  }
5465
5611
  if (columnGap.kind === "single" && columnGap.value) {
5466
- attrs["data-column-gap"] = String(columnGap.value);
5612
+ attrs["data-column-gap"] = normalizeSpacingToken(columnGap.value, String(columnGap.value));
5467
5613
  } else if (columnGap.kind === "responsive") {
5468
5614
  attrs["data-column-gap"] = "responsive";
5469
5615
  attrs["data-responsive-column-gap"] = "true";
@@ -5925,6 +6071,7 @@ const TEXT_PROPS = [
5925
6071
  { name: "value", type: "string" },
5926
6072
  { name: "variant", type: "string", optional: true, enum: TEXT_VARIANTS },
5927
6073
  { name: "tone", type: "string", optional: true, enum: ["default", "muted", "primary", "success", "warning", "danger"], description: "Visual accent" },
6074
+ { name: "align", type: "string", optional: true, enum: ["left", "center", "right"], description: "Horizontal text alignment — the text becomes its own block-level line" },
5928
6075
  {
5929
6076
  name: "style",
5930
6077
  type: "string",
@@ -5935,17 +6082,19 @@ const TEXT_PROPS = [
5935
6082
  const renderText = (_node, props) => {
5936
6083
  const variant = asString$1(props.variant, "body");
5937
6084
  const tone = asString$1(props.tone, "default");
6085
+ const align = asString$1(props.align);
5938
6086
  const style = sanitiseInlineStyle$1(props.style);
5939
6087
  return el("span", {
5940
6088
  class: "rui-text",
5941
6089
  "data-variant": variant,
5942
6090
  "data-color": tone,
6091
+ "data-align": align || null,
5943
6092
  style: style || null
5944
6093
  }, [asString$1(props.value)]);
5945
6094
  };
5946
6095
  const Text = {
5947
6096
  name: "Text",
5948
- description: 'Renders plain text with a typographic variant. Optional `style` prop accepts a CSS declaration string (e.g. "font-size: 16px; color: #000;") applied directly to the rendered element.',
6097
+ description: 'Renders plain text with a typographic variant. `align` (left|center|right) sets the horizontal alignment (the text renders as its own block). Optional `style` prop accepts a CSS declaration string (e.g. "font-size: 16px; color: #000;") applied directly to the rendered element.',
5949
6098
  props: TEXT_PROPS,
5950
6099
  render: renderText
5951
6100
  };
@@ -6344,13 +6493,13 @@ const Container = {
6344
6493
  { name: "children", type: "Node[]" },
6345
6494
  { name: "size", type: "string", optional: true, enum: ["sm", "md", "lg", "xl", "full"], description: "sm=640 / md=820 / lg=1040 / xl=1280 / full=100% (default lg)" },
6346
6495
  { name: "maxWidth", type: "string", optional: true, description: "Custom CSS max-width (overrides `size`)" },
6347
- { name: "padding", type: "string", optional: true, enum: ["none", "s", "m", "l"], description: "Horizontal padding (default m)" }
6496
+ { name: "padding", type: "string", optional: true, enum: SPACING_TOKENS, description: "Horizontal padding (default md)" }
6348
6497
  ],
6349
6498
  render: (_node, props, helpers) => {
6350
6499
  const root = el("div", {
6351
6500
  class: "rui-container",
6352
6501
  "data-size": asString$1(props.size, "lg"),
6353
- "data-padding": asString$1(props.padding, "m"),
6502
+ "data-padding": normalizeSpacingToken(props.padding, "md"),
6354
6503
  style: props.maxWidth ? `max-width:${sanitiseCssLength(props.maxWidth, "auto")};` : null
6355
6504
  });
6356
6505
  for (const child of asArray(props.children)) root.append(helpers.renderNode(child));
@@ -6361,11 +6510,11 @@ const Spacer = {
6361
6510
  name: "Spacer",
6362
6511
  description: 'Explicit space element for fine layout control. By default acts as a flex spacer that pushes following content to the far edge (use inside `Stack(direction="row")`). Pass `size` to render a fixed vertical/horizontal gap instead.',
6363
6512
  props: [
6364
- { name: "size", type: "string", optional: true, enum: ["xs", "s", "m", "l", "xl"], description: "Fixed gap; omit to flex-grow" },
6513
+ { name: "size", type: "string", optional: true, enum: SPACING_TOKENS, description: "Fixed gap; omit to flex-grow" },
6365
6514
  { name: "flex", type: "boolean", optional: true, description: "Flex-grow even when size is set (default true when size omitted)" }
6366
6515
  ],
6367
6516
  render: (_node, props) => {
6368
- const size2 = asString$1(props.size);
6517
+ const size2 = normalizeSpacingToken(props.size, asString$1(props.size));
6369
6518
  const flex = props.flex === void 0 ? !size2 : asBoolean$1(props.flex);
6370
6519
  return el("span", {
6371
6520
  class: "rui-spacer",
@@ -7164,7 +7313,7 @@ function attachOnChange(element, callback, helpers, options) {
7164
7313
  helpers.invoke(callback, options.getValue(element));
7165
7314
  });
7166
7315
  }
7167
- const BUTTON_VARIANTS$1 = ["primary", "secondary", "ghost", "danger"];
7316
+ const BUTTON_VARIANTS$1 = ["primary", "secondary", "outline", "ghost", "link", "danger", "default"];
7168
7317
  const BUTTON_SIZES$1 = ["xs", "sm", "md", "lg", "xl"];
7169
7318
  const INPUT_TYPES = ["text", "email", "password", "number", "tel", "url", "date"];
7170
7319
  function normaliseButtonSize$1(value) {
@@ -7192,7 +7341,7 @@ const Button = {
7192
7341
  props: [
7193
7342
  { name: "label", type: "string" },
7194
7343
  { name: "onClick", type: "callable", optional: true, aliases: ["action", "onclick"], description: "Callable invoked when the button is clicked" },
7195
- { name: "variant", type: "string", optional: true, aliases: ["tone"], enum: BUTTON_VARIANTS$1 },
7344
+ { name: "variant", type: "string", optional: true, aliases: ["tone"], enum: BUTTON_VARIANTS$1, description: "Visual style — `primary` solid brand button (`default` is its alias), `secondary` surface + border, `outline` transparent with primary border, `ghost` bare, `link` text-only (underlines on hover), `danger` destructive" },
7196
7345
  { name: "type", type: "string", optional: true, enum: ["button", "submit"], description: "HTML button type" },
7197
7346
  { name: "size", type: "string", optional: true, enum: BUTTON_SIZES$1, description: "Size token `xs|sm|md|lg|xl`" },
7198
7347
  { name: "icon", type: "string", optional: true, description: "Optional Font Awesome icon name" },
@@ -14856,11 +15005,11 @@ const MasonryGrid = {
14856
15005
  props: [
14857
15006
  { name: "items", type: "Node[]" },
14858
15007
  { name: "columns", type: "number", optional: true, description: "Preferred column count (default 3)" },
14859
- { name: "gap", type: "string", optional: true, enum: ["xs", "s", "m", "l", "xl"] }
15008
+ { name: "gap", type: "string", optional: true, enum: SPACING_TOKENS }
14860
15009
  ],
14861
15010
  render: (_node, props, helpers) => {
14862
15011
  const columns = Math.max(1, Math.min(6, Math.floor(asNumber(props.columns, 3))));
14863
- const gap = asString$1(props.gap, "m");
15012
+ const gap = normalizeSpacingToken(props.gap, "md");
14864
15013
  const root = el("div", {
14865
15014
  class: "rui-masonry-grid",
14866
15015
  "data-columns": String(columns),
@@ -15043,7 +15192,7 @@ const NavLink = {
15043
15192
  }
15044
15193
  };
15045
15194
  const BUTTON_VARIANTS = ["primary", "secondary", "ghost", "danger"];
15046
- const BUTTON_SIZES = ["xs", "sm", "md", "lg", "xl", "small", "normal", "large"];
15195
+ const BUTTON_SIZES = ["xs", "sm", "md", "lg", "xl"];
15047
15196
  function normaliseButtonSize(value) {
15048
15197
  const v = asString$1(value).trim().toLowerCase();
15049
15198
  if (v === "xs" || v === "extra-small") return "xs";
@@ -16335,7 +16484,7 @@ const Section = {
16335
16484
  { name: "children", type: "Node[]", positional: true, required: true },
16336
16485
  { name: "background", type: "string", optional: true, enum: ["base", "soft", "surface", "muted", "brand"], aliases: ["bg"] },
16337
16486
  { name: "width", type: "string", optional: true, enum: ["sm", "md", "lg", "xl", "full"] },
16338
- { name: "padding", type: "string", optional: true, enum: ["sm", "md", "lg"] },
16487
+ { name: "padding", type: "string", optional: true, enum: ["none", "xs", "sm", "md", "lg", "xl"], description: "Band padding preset (default md)" },
16339
16488
  { name: "align", type: "string", optional: true, enum: ["left", "center"] },
16340
16489
  { name: "eyebrow", type: "string", optional: true },
16341
16490
  { name: "title", type: "string | Node[]", optional: true },
@@ -16347,7 +16496,7 @@ const Section = {
16347
16496
  const root = el("section", {
16348
16497
  class: "rui-section",
16349
16498
  "data-bg": bg2 !== "base" ? bg2 : null,
16350
- "data-pad": asString$1(props.padding) || null,
16499
+ "data-pad": normalizeSpacingToken(props.padding, asString$1(props.padding)) || null,
16351
16500
  "data-align": asString$1(props.align) || null,
16352
16501
  id: asString$1(props.id) || null
16353
16502
  });
@@ -16412,7 +16561,7 @@ const Brand = {
16412
16561
  description: "Logo + product name (+ optional version pill), linking home. Use in NavBar/Footer.",
16413
16562
  props: [
16414
16563
  { name: "name", type: "string", positional: true, required: true, aliases: ["label"] },
16415
- { name: "logo", type: "string", optional: true, description: "Logo image src" },
16564
+ { name: "logo", type: "string", optional: true, description: "Logo image src URL, e.g. https://example.com/logo.png" },
16416
16565
  { name: "version", type: "string", optional: true },
16417
16566
  { name: "href", type: "string", optional: true }
16418
16567
  ],
@@ -17006,7 +17155,7 @@ const Backdrop = {
17006
17155
  ].filter(Boolean).join(";");
17007
17156
  root.append(el("div", { class: "rui-backdrop-blob", style }));
17008
17157
  });
17009
- const count = Math.max(0, Math.min(120, Math.round(asNumber(props.particles, 0))));
17158
+ const count = Math.max(0, Math.min(120, Math.round(asNumber(props.particles || 50, 0))));
17010
17159
  if (count > 0) {
17011
17160
  const typeRaw = asString$1(props.type, "network");
17012
17161
  const palette = asArray(props.particleColors).map((c) => safeCssColor(asString$1(c), "")).filter(Boolean).slice(0, 8);
@@ -17485,7 +17634,7 @@ const Split = {
17485
17634
  { name: "left", type: "Node", positional: true, required: true, aliases: ["primary"] },
17486
17635
  { name: "right", type: "Node", required: true, aliases: ["secondary"] },
17487
17636
  { name: "ratio", type: "string", optional: true, description: "Column ratio: 1/1, 3/2, 2/3, 1/3, 2/1, etc." },
17488
- { name: "gap", type: "string", optional: true, enum: ["none", "s", "m", "l", "xl"] },
17637
+ { name: "gap", type: "string", optional: true, enum: SPACING_TOKENS },
17489
17638
  { name: "divider", type: "boolean", optional: true },
17490
17639
  { name: "sticky", type: "string", optional: true, enum: ["left", "right"], description: "Pin one pane while the other scrolls" },
17491
17640
  { name: "stackAt", type: "string", optional: true, enum: ["sm", "md", "lg"], description: "Breakpoint below which it stacks (default md)" },
@@ -17493,8 +17642,7 @@ const Split = {
17493
17642
  ],
17494
17643
  render: (_node, props, helpers) => {
17495
17644
  const ratio = RATIO_MAP[asString$1(props.ratio, "1/1")] ?? "1fr 1fr";
17496
- const gapKey = asString$1(props.gap, "l");
17497
- const gap = gapKey === "none" ? "0" : `var(--rui-spacing-${gapKey === "s" ? "s" : gapKey === "m" ? "m" : gapKey === "xl" ? "xl" : "l"})`;
17645
+ const gap = spacingCssValue(asString$1(props.gap, "lg")) || "var(--rui-spacing-l)";
17498
17646
  const root = el("div", {
17499
17647
  class: "rui-split",
17500
17648
  "data-divider": asBoolean$1(props.divider) ? "true" : null,
@@ -17538,10 +17686,10 @@ function parseBentoSpan(span) {
17538
17686
  }
17539
17687
  const BentoCell = {
17540
17688
  name: "BentoCell",
17541
- description: 'A single cell in a Bento grid. `span` is a named size (tile|wide|tall|hero|full), a "CxR" string like "2x1", a bare column-span number, or `{ col, row }`. The child stretches to fill the cell.',
17689
+ description: 'A single cell in a Bento grid. `span` names a size — `tile` 1×1, `wide` 2×1 (2 columns), `tall` 1×2 (2 rows), `hero` 2×2, `full` (a whole row) — or use a "CxR" string ("2x1"), a bare column-span number, or `{ col, row }`; `rowSpan` adds rows to a named/numeric span. The child stretches to fill the cell, so images/cards crop to the cell\'s shape. Pick spans that tile the parent Bento with no leftover tracks.',
17542
17690
  props: [
17543
17691
  { name: "child", type: "Node", positional: true, required: true, aliases: ["children"] },
17544
- { name: "span", type: "string | number | object", optional: true, description: 'tile|wide|tall|hero|full, "2x1", 2, or { col, row }' },
17692
+ { name: "span", type: "string | number | object", optional: true, description: 'tile (1×1) | wide (2×1) | tall (1×2) | hero (2×2) | full (whole row), "2x1", 2, or { col, row }' },
17545
17693
  { name: "rowSpan", type: "number", optional: true, description: "Rows to span (combines with a numeric/named span)" }
17546
17694
  ],
17547
17695
  render: (_node, props, helpers) => {
@@ -17560,18 +17708,17 @@ const BentoCell = {
17560
17708
  };
17561
17709
  const Bento = {
17562
17710
  name: "Bento",
17563
- description: "Asymmetric 'bento box' grid where cells span varied widths/heights — the marquee feature-section layout. Children should be BentoCell nodes (plain nodes are treated as 1×1). `columns` sets the track count (default 6), `rowHeight` sizes the implicit rows so `tall`/`hero` cells actually grow, and `dense` (default true) backfills gaps. Collapses to 2 columns below 920px and 1 below 640px.",
17711
+ description: "Asymmetric 'bento box' grid — the marquee feature-section layout. Children must be BentoCell nodes (a plain node becomes a 1×1 tile). Two rules make it look right: (1) spans must tile the grid exactly — each row's column spans sum to `columns` and row-spans pair up with neighbouring cells, never leaving a dangling track (e.g. `columns: 3` with 4 cells: hero 2×2 + tall 1×2 fill rows 1–2, wide 2×1 + tile fill row 3); (2) set a fixed `rowHeight` (e.g. \"180px\") whenever cells hold images or cards — the default auto row stretches to the tallest cell and makes the mosaic ragged. Give 1–2 standout cells a big span (hero/wide/tall) and keep the rest 1×1 tiles. `dense` (default true) backfills gaps. Collapses to 2 columns below 920px and 1 below 640px.",
17564
17712
  props: [
17565
17713
  { name: "items", type: "BentoCell[]", positional: true, required: true, aliases: ["children", "cells"] },
17566
- { name: "columns", type: "number", optional: true, description: "Track count 1–8 (default 6)" },
17567
- { name: "gap", type: "string", optional: true, enum: ["s", "m", "l", "xl"] },
17568
- { name: "rowHeight", type: "string", optional: true, description: "grid-auto-rows track size (CSS length, default minmax(110px, auto))" },
17714
+ { name: "columns", type: "number", optional: true, description: "Track count 1–8 (default 6) — pick it so the cell spans in every row can sum to it" },
17715
+ { name: "gap", type: "string", optional: true, enum: SPACING_TOKENS },
17716
+ { name: "rowHeight", type: "string", optional: true, description: 'Fixed row track size, e.g. "180px" — set it whenever any cell spans rows or holds images (default minmax(110px, auto) stretches rows to content)' },
17569
17717
  { name: "dense", type: "boolean", optional: true, description: "Backfill holes with later cells (default true)" }
17570
17718
  ],
17571
17719
  render: (_node, props, helpers) => {
17572
17720
  const cols = Math.max(1, Math.min(8, Math.round(asNumber(props.columns, 6))));
17573
- const gapRaw = asString$1(props.gap, "m");
17574
- const gapKey = ["s", "m", "l", "xl"].includes(gapRaw) ? gapRaw : "m";
17721
+ const gapKey = normalizeSpacingToken(props.gap, "md");
17575
17722
  const rowHeight = sanitiseCssLength(props.rowHeight, "");
17576
17723
  const dense = props.dense === void 0 ? true : asBoolean$1(props.dense);
17577
17724
  const root = el("div", {
@@ -20013,7 +20160,7 @@ const componentGroups = [
20013
20160
  "- `Container([...], { size })` centers a wide page within a comfortable max-width (sm/md/lg/xl/full) — landing pages, articles, marketing sections.",
20014
20161
  "- `Box([...], { padding?, margin?, border?, background?, maxWidth? })` is a plain spacing/surface wrapper for when a `Card` is too heavy.",
20015
20162
  '- `Separator(orientation?, label?)` adds a visual break between sections; pass a `label` for a centered "OR"-style divider.',
20016
- "- `gap`/`padding` spacing tokens are `xs|s|m|l|xl`; `align`/`justify`/`columns`/`direction`/`gap` all accept responsive maps like `{base: …, md: …, lg: …}`.",
20163
+ "- `gap`/`padding` spacing tokens are `none|3xs|2xs|xs|sm|md|lg|xl|2xl|3xl` (`none` = 0); `align`/`justify`/`columns`/`direction`/`gap` all accept responsive maps like `{base: …, md: …, lg: …}`.",
20017
20164
  "- Use `Drawer` for side-panel detail views and `Modal` for centered dialogs. `Sticky(children, side?, offset?)` pins a toolbar/banner while content scrolls. `ResizablePanels(primary, secondary)` gives a user-resizable two-pane split. `MasonryGrid([...])` is for Pinterest-style mixed-height walls."
20018
20165
  ]
20019
20166
  },
@@ -22928,6 +23075,8 @@ const TOKEN_TO_CSS = {
22928
23075
  shadowSm: "--rui-shadow-sm",
22929
23076
  shadowMd: "--rui-shadow-md",
22930
23077
  shadowLg: "--rui-shadow-lg",
23078
+ spacing3xs: "--rui-spacing-3xs",
23079
+ spacing2xs: "--rui-spacing-2xs",
22931
23080
  spacingXs: "--rui-spacing-xs",
22932
23081
  spacingS: "--rui-spacing-s",
22933
23082
  spacingM: "--rui-spacing-m",
@@ -24026,6 +24175,9 @@ function leaveUserComponent(ctx) {
24026
24175
  if (!budget) return;
24027
24176
  if (budget.componentDepth > 0) budget.componentDepth -= 1;
24028
24177
  }
24178
+ function isSelfShadowingLibraryName(name, ctx) {
24179
+ return ctx.activeComponentDecls.length > 0 && ctx.activeComponentDecls.includes(name) && Boolean(ctx.library && findComponent(ctx.library, name));
24180
+ }
24029
24181
  const isComponentNode = (value) => {
24030
24182
  return Boolean(
24031
24183
  value && typeof value === "object" && value.__kind === "Component"
@@ -24053,6 +24205,7 @@ function createContext(state, options = {}) {
24053
24205
  router: options.router,
24054
24206
  library: options.library,
24055
24207
  componentDecls: /* @__PURE__ */ new Map(),
24208
+ activeComponentDecls: [],
24056
24209
  effectDecls: /* @__PURE__ */ new Map(),
24057
24210
  componentEffectStack: [],
24058
24211
  actionDecls: /* @__PURE__ */ new Map(),
@@ -24484,9 +24637,10 @@ function evaluate(expr, ctx) {
24484
24637
  ctx.mutableBindings.set(expr.name, value);
24485
24638
  return value;
24486
24639
  }
24487
- const action = ctx.actionDecls.get(expr.name);
24640
+ const refShadowsBuiltin = isSelfShadowingLibraryName(expr.name, ctx);
24641
+ const action = refShadowsBuiltin ? void 0 : ctx.actionDecls.get(expr.name);
24488
24642
  if (action) return makeSyncActionCallable(action, ctx);
24489
- const userComponent = ctx.componentDecls.get(expr.name);
24643
+ const userComponent = refShadowsBuiltin ? void 0 : ctx.componentDecls.get(expr.name);
24490
24644
  if (userComponent) return makeUserComponentCallable(userComponent);
24491
24645
  if (Object.prototype.hasOwnProperty.call(GLOBAL_NAMESPACES, expr.name)) {
24492
24646
  return GLOBAL_NAMESPACES[expr.name];
@@ -25793,10 +25947,11 @@ function evaluateMethodCall(expr, ctx) {
25793
25947
  }
25794
25948
  function evaluateComponentCall(callee, args, ctx, loc) {
25795
25949
  const componentDecl = ctx.componentDecls.get(callee);
25796
- if (componentDecl) {
25950
+ const selfShadowsBuiltin = componentDecl !== void 0 && isSelfShadowingLibraryName(callee, ctx);
25951
+ if (componentDecl && !selfShadowsBuiltin) {
25797
25952
  return invokeComponentDecl(componentDecl, args, ctx, loc);
25798
25953
  }
25799
- const actionDecl = ctx.actionDecls.get(callee);
25954
+ const actionDecl = selfShadowsBuiltin ? void 0 : ctx.actionDecls.get(callee);
25800
25955
  if (actionDecl) {
25801
25956
  const evaluated2 = args.map((a) => evaluate(a, ctx));
25802
25957
  return runActionDeclSync(actionDecl, evaluated2, ctx);
@@ -25941,13 +26096,7 @@ function resolveLibraryCallArgs(ctx, callee, propArgs) {
25941
26096
  }));
25942
26097
  let universal;
25943
26098
  const positionals = [];
25944
- let trailingObjIdx = -1;
25945
- for (let i = propArgs.length - 1; i >= 0; i -= 1) {
25946
- if (propArgs[i].kind === "Object") {
25947
- trailingObjIdx = i;
25948
- break;
25949
- }
25950
- }
26099
+ const trailingObjIdx = chooseNamedBagIndex(callArgShapes(propArgs), spec);
25951
26100
  for (let i = 0; i < propArgs.length; i += 1) {
25952
26101
  if (i === trailingObjIdx) continue;
25953
26102
  const arg = propArgs[i];
@@ -26165,10 +26314,12 @@ function evaluateUserComponent(node, ctx, instanceKey) {
26165
26314
  const prevHookScope = ctx.hookScope;
26166
26315
  const hookScope = { instanceKey, cursor: 0 };
26167
26316
  ctx.hookScope = hookScope;
26317
+ ctx.activeComponentDecls.push(decl.name);
26168
26318
  try {
26169
26319
  const value = evaluateBlock(decl.body, ctx, { stateAsDeclaration: true });
26170
26320
  return { value, effects: effectsFrame, hooks: hookScope.cursor };
26171
26321
  } finally {
26322
+ ctx.activeComponentDecls.pop();
26172
26323
  ctx.hookScope = prevHookScope;
26173
26324
  ctx.componentEffectStack.pop();
26174
26325
  ctx.stateAliases.pop();
@@ -26179,16 +26330,24 @@ function evaluateUserComponent(node, ctx, instanceKey) {
26179
26330
  }
26180
26331
  }
26181
26332
  function runActionDeclSync(decl, args, ctx) {
26182
- if (!ctx.errorHook) return runDeclBodySync(decl.params, decl.body, args, ctx);
26333
+ const shadowsBuiltin = Boolean(
26334
+ decl.name && ctx.componentDecls.has(decl.name) && ctx.library && findComponent(ctx.library, decl.name)
26335
+ );
26336
+ if (shadowsBuiltin) ctx.activeComponentDecls.push(decl.name);
26183
26337
  try {
26184
- return runDeclBodySync(decl.params, decl.body, args, ctx);
26185
- } catch (err) {
26186
- if (err instanceof ReturnSignal || err instanceof BreakSignal || err instanceof ContinueSignal) throw err;
26338
+ if (!ctx.errorHook) return runDeclBodySync(decl.params, decl.body, args, ctx);
26187
26339
  try {
26188
- ctx.errorHook({ error: err, source: decl.name ?? "action" });
26189
- } catch {
26340
+ return runDeclBodySync(decl.params, decl.body, args, ctx);
26341
+ } catch (err) {
26342
+ if (err instanceof ReturnSignal || err instanceof BreakSignal || err instanceof ContinueSignal) throw err;
26343
+ try {
26344
+ ctx.errorHook({ error: err, source: decl.name ?? "action" });
26345
+ } catch {
26346
+ }
26347
+ throw err;
26190
26348
  }
26191
- throw err;
26349
+ } finally {
26350
+ if (shadowsBuiltin) ctx.activeComponentDecls.pop();
26192
26351
  }
26193
26352
  }
26194
26353
  function runOptimistic(fnExpr, ctx) {
@@ -26787,6 +26946,11 @@ const STRUCTURED_THEME_GROUPS = /* @__PURE__ */ new Set([
26787
26946
  "motion"
26788
26947
  ]);
26789
26948
  const THEME_METADATA_KEYS = /* @__PURE__ */ new Set(["name", "direction"]);
26949
+ const SPACING_THEME_KEY_ALIASES = {
26950
+ sm: "s",
26951
+ md: "m",
26952
+ lg: "l"
26953
+ };
26790
26954
  const THEME_GROUP_PREFIX = {
26791
26955
  colors: "color",
26792
26956
  radius: "radius",
@@ -26819,7 +26983,8 @@ function collectThemeTokens(value) {
26819
26983
  const isGradient = key === "gradients";
26820
26984
  for (const [innerKey, innerValue] of Object.entries(raw)) {
26821
26985
  if (innerValue == null) continue;
26822
- const flatKey = prefix + capitalise(innerKey);
26986
+ const normalisedKey = key === "spacing" ? SPACING_THEME_KEY_ALIASES[innerKey] ?? innerKey : innerKey;
26987
+ const flatKey = prefix + capitalise(normalisedKey);
26823
26988
  const str = isGradient ? gradientToCss(innerValue) : stringifyTokenValue(innerValue);
26824
26989
  if (str) out[flatKey] = str;
26825
26990
  }
@@ -28059,15 +28224,17 @@ $effect(() => $console.log($count), [$count]) // declarative
28059
28224
 
28060
28225
  ### Two rules, broken constantly — always check
28061
28226
  1. **Invoke components with parentheses.** A component is a function; the bare name is just its value. Render it by calling it, even with no args: \`$app(MyApp())\` not \`$app(MyApp)\`; \`Column([Header(), Body()])\` not \`Column([Header, Body])\`. (Exception: passing a component as a callback, e.g. \`render: UserCard\`.)
28062
- 2. **One positional argument max** (the trailing-object rule): each call takes at most one bare positional arg; all other props go in a trailing \`{ }\` object.
28227
+ 2. **Argument forms** (per call, pick ONE): the canonical form is one bare positional — the prop tagged \`(positional)\` in the signature — plus a trailing \`{ }\` object for every other prop. Also supported: ALL-positional (arguments bind to the signature's props in listed order, so only use it for adjacent leading props), and ALL-named (a single \`{ }\` object naming every prop). Never split one object between roles.
28063
28228
 
28064
28229
  \`\`\`
28065
- Button("Save", { variant: "primary", loading: $isSaving })
28230
+ Button("Save", { variant: "primary", loading: $isSaving }) // canonical: positional + trailing object
28066
28231
  StatCard("Revenue", { value: "$48k", trend: "up", delta: "+12%" })
28067
- Row([Card1(), Card2()], { gap: "m" })
28232
+ StatCard("Revenue", "$48k", "up") // all-positional, signature order
28233
+ Button({ label: "Save", variant: "primary" }) // all-named single object
28234
+ Row([Card1(), Card2()], { gap: "md" })
28068
28235
  \`\`\`
28069
28236
 
28070
- \`Button("Save", "primary")\` is a schema error — use the named-prop form. Any call also accepts \`{ key: ... }\` to pin per-instance state across reorders.
28237
+ Mind the signature order with all-positional calls: \`Button("Save", "primary")\` puts \`"primary"\` in the second slot (\`onClick\`), NOT \`variant\` — prefer the trailing object for non-adjacent props. A lone object argument to a component whose positional prop is itself object-typed is that prop's payload, not named props. Any call also accepts \`{ key: ... }\` to pin per-instance state across reorders.
28071
28238
 
28072
28239
  ### Reserved top-level names
28073
28240
  - \`$app(...)\` — registers the UI root (REQUIRED).
@@ -28505,7 +28672,7 @@ function fullUniversalProps() {
28505
28672
  EVERY component accepts a universal style/behaviour channel as named props, in addition to its own props. These are **bounded** (tokens & enums, never raw CSS) so they stay theme-safe — prefer them over the \`Css\`/\`Styles\`/\`HTMLTag\` escape hatches.
28506
28673
 
28507
28674
  - **\`sx: { … }\`** — token-aware inline styling. Keys (all optional):
28508
- - Spacing (\`xs|s|m|l|xl|2xl|3xl|none|auto\`, the \`safe\`/\`safe-top\`/\`safe-right\`/\`safe-bottom\`/\`safe-left\` notch insets, or a CSS length): \`p px py pt pr pb pl\`, \`m mx my mt mr mb ml\`, \`gap\`. \`px\`/\`mx\` are logical (\`padding-inline\`) and \`ps pe ms me\` set the inline start/end sides, so RTL apps mirror automatically.
28675
+ - Spacing (\`none|3xs|2xs|xs|sm|md|lg|xl|2xl|3xl|auto\` (\`none\` = 0), the \`safe\`/\`safe-top\`/\`safe-right\`/\`safe-bottom\`/\`safe-left\` notch insets, or a CSS length): \`p px py pt pr pb pl\`, \`m mx my mt mr mb ml\`, \`gap\`. \`px\`/\`mx\` are logical (\`padding-inline\`) and \`ps pe ms me\` set the inline start/end sides, so RTL apps mirror automatically.
28509
28676
  - Sizing (\`full|half|screen|dvh|min|max|fit|auto\` or length): \`w h minW maxW minH maxH\`.
28510
28677
  - Color (token \`surface|bg|text|text-muted|primary|accent|success|warning|danger|border\`, a gradient ref \`gradient.brand|accent|warm|cool|success|danger\`, or a raw color): \`bg color borderColor\`.
28511
28678
  - Surface: \`border: none|subtle|strong|<color>\`, \`radius: xs|sm|md|lg|pill|full\`, \`shadow: sm|md|lg|none\`, \`opacity\`, \`backdrop: "blur"\`, \`bgImage\` (http(s)/relative/data:image only) + \`bgOverlay\` (color or \`gradient.*\` wash over the image), \`bgSize: cover|contain\`.
@@ -28602,7 +28769,7 @@ function fullComponentLibrary(library) {
28602
28769
  const byName = new Map(library.components.map((c) => [c.name, c]));
28603
28770
  const lines = [];
28604
28771
  lines.push("## Component library");
28605
- lines.push("Use only these components. Each signature lists props in declaration order; optional props end with `?`. The prop tagged `(positional)` is the canonical positional slot — pass it bare; every other prop goes in a trailing `{ prop: value }` object.");
28772
+ lines.push("Use only these components. Each signature lists props in declaration order; optional props end with `?`. The prop tagged `(positional)` is the canonical positional slot. Canonical call: pass it bare and put every other prop in a trailing `{ prop: value }` object. Also valid: all-positional in the listed order (the first positional fills the `(positional)` slot, the rest fill the remaining slots top-to-bottom), or a single `{ prop: value }` object naming every prop.");
28606
28773
  lines.push("");
28607
28774
  for (const group of groups) {
28608
28775
  lines.push(`### ${group.name}`);
@@ -28658,7 +28825,7 @@ row = task => Card([Row([
28658
28825
  Badge(task.done ? "done" : "open", { tone: task.done ? "success" : "neutral" }),
28659
28826
  StackItem(Text(task.title, { tone: task.done ? "muted" : "default" }), { grow: 1 }),
28660
28827
  Button(task.done ? "Reopen" : "Done", { onClick: () => toggle(task), size: "sm" })
28661
- ], { gap: "m" })])
28828
+ ], { gap: "md" })])
28662
28829
 
28663
28830
  $app(Column([
28664
28831
  PageHeader("Tasks", { subtitle: \`\${$tasks.data.length} items\`, actions: [Button("Refresh", { onClick: $tasks.refetch, variant: "ghost" })] }),
@@ -28666,9 +28833,9 @@ $app(Column([
28666
28833
  loading: LoadingState("Loading tasks…"),
28667
28834
  error: ErrorState("Couldn't fetch tasks"),
28668
28835
  empty: EmptyState("No tasks yet"),
28669
- data: Column($tasks.data.map(t => row(t)), { gap: "s" })
28836
+ data: Column($tasks.data.map(t => row(t)), { gap: "sm" })
28670
28837
  })
28671
- ], { gap: "l" }))`
28838
+ ], { gap: "lg" }))`
28672
28839
  ];
28673
28840
  }
28674
28841
  const CHAT_COMPONENT_ALLOWLIST = [
@@ -28783,7 +28950,7 @@ A program is a flat list of \`name = expression\` statements in standard JavaScr
28783
28950
  ### Component calls
28784
28951
  - **Case doesn't matter** — \`Card\` and \`card\` are equivalent.
28785
28952
  - **Always invoke with parentheses** — \`Column([Header(), Body()])\`, never \`Column([Header, Body])\`; write \`Hero()\` even with no args.
28786
- - **One positional arg, the rest in a trailing object** — \`Callout("info", { title: "Heads up", icon: "circle-info" })\`, \`Badge("Live", { tone: "success" })\`.
28953
+ - **Canonical call: one positional arg, the rest in a trailing object** — \`Callout("info", { title: "Heads up", icon: "circle-info" })\`, \`Badge("Live", { tone: "success" })\`. All-positional (signature order) and all-named (single \`{ }\` object) calls also work.
28787
28954
 
28788
28955
  ### Build UI from data — JS is fully supported
28789
28956
  \`.map\` / \`.filter\` arrays into nodes (\`rows.map(r => ListItem(r.title))\`), ternaries for branching, and the array-pluck shortcut \`rows.title\` → \`[each row.title]\` to feed columns (\`Col("Title", rows.title)\`) and chart series (\`PieChart(rows.label, rows.value)\`). \`if\` / \`for\` are statements — not usable on the right of \`=\`.
@@ -28879,7 +29046,7 @@ function chatFinalVerification() {
28879
29046
  2. Every component is invoked with \`()\` — \`Hero()\`, never bare \`Hero\`.
28880
29047
  3. Only the read-only display components above — no forms, clickable buttons, state writes, actions, effects, HTTP, or routing.
28881
29048
  4. Tables are column-oriented (\`Table([Col("Label", arr)])\`, cells may be components via \`rows.map(r => Badge(r.status))\`); charts take numeric arrays (array-pluck \`rows.value\`).
28882
- 5. One positional arg per call, everything else in a trailing \`{ }\` object; no statement split across lines outside an unmatched bracket.`;
29049
+ 5. Prefer one positional arg per call with everything else in a trailing \`{ }\` object; no statement split across lines outside an unmatched bracket.`;
28883
29050
  }
28884
29051
  function formatComponentSignature(spec) {
28885
29052
  const positional = findPositionalProp(spec);
@@ -28917,6 +29084,24 @@ ${argsLine}`);
28917
29084
  }
28918
29085
  return lines.join("\n");
28919
29086
  }
29087
+ const SPACING_ATTR_TOKENS = [
29088
+ ["none", "0"],
29089
+ ["3xs", "var(--rui-spacing-3xs)"],
29090
+ ["2xs", "var(--rui-spacing-2xs)"],
29091
+ ["xs", "var(--rui-spacing-xs)"],
29092
+ ["sm", "var(--rui-spacing-s)"],
29093
+ ["md", "var(--rui-spacing-m)"],
29094
+ ["lg", "var(--rui-spacing-l)"],
29095
+ ["xl", "var(--rui-spacing-xl)"],
29096
+ ["2xl", "var(--rui-spacing-2xl)"],
29097
+ ["3xl", "var(--rui-spacing-3xl)"],
29098
+ ["s", "var(--rui-spacing-s)"],
29099
+ ["m", "var(--rui-spacing-m)"],
29100
+ ["l", "var(--rui-spacing-l)"]
29101
+ ];
29102
+ function spacingAttrRules(selector, attr, decl) {
29103
+ return SPACING_ATTR_TOKENS.map(([token, css]) => `${selector}[${attr}="${token}"] { ${decl(css)} }`).join("\n");
29104
+ }
28920
29105
  const componentStyles = `
28921
29106
  :host {
28922
29107
  display: block;
@@ -28974,7 +29159,12 @@ const componentStyles = `
28974
29159
  --rui-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
28975
29160
  --rui-shadow-md: 0 6px 24px rgba(15, 23, 42, 0.08);
28976
29161
  --rui-shadow-lg: 0 18px 60px rgba(15, 23, 42, 0.12);
28977
- /* Spacing */
29162
+ /* Spacing — canonical scale none/3xs/2xs/xs/sm/md/lg/xl/2xl/3xl. The
29163
+ sm/md/lg storage vars keep their historical short names (-s/-m/-l) so
29164
+ existing theme overrides keep working; the canonical spellings alias
29165
+ onto them for direct var() access ({spacing.md}, style.token, user CSS). */
29166
+ --rui-spacing-3xs: 1px;
29167
+ --rui-spacing-2xs: 2px;
28978
29168
  --rui-spacing-xs: 4px;
28979
29169
  --rui-spacing-s: 8px;
28980
29170
  --rui-spacing-m: 12px;
@@ -28982,6 +29172,10 @@ const componentStyles = `
28982
29172
  --rui-spacing-xl: 32px;
28983
29173
  --rui-spacing-2xl: 48px;
28984
29174
  --rui-spacing-3xl: 80px;
29175
+ --rui-spacing-sm: var(--rui-spacing-s);
29176
+ --rui-spacing-md: var(--rui-spacing-m);
29177
+ --rui-spacing-lg: var(--rui-spacing-l);
29178
+ --rui-spacing-none: 0px;
28985
29179
  /* Named gradients (brandable via $theme({ gradients: {...} })) */
28986
29180
  --rui-gradient-brand: linear-gradient(120deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
28987
29181
  --rui-gradient-accent: linear-gradient(120deg, #22d3ee 0%, #6366f1 100%);
@@ -29072,11 +29266,7 @@ input, textarea, select, button { color: inherit; font-family: inherit; }
29072
29266
  }
29073
29267
  .rui-stack[data-direction="row"] { flex-direction: row; }
29074
29268
  .rui-stack[data-direction="column"] { flex-direction: column; }
29075
- .rui-stack[data-gap="xs"] { gap: var(--rui-spacing-xs); }
29076
- .rui-stack[data-gap="s"] { gap: var(--rui-spacing-s); }
29077
- .rui-stack[data-gap="m"] { gap: var(--rui-spacing-m); }
29078
- .rui-stack[data-gap="l"] { gap: var(--rui-spacing-l); }
29079
- .rui-stack[data-gap="xl"] { gap: var(--rui-spacing-xl); }
29269
+ ${spacingAttrRules(".rui-stack", "data-gap", (v) => `gap: ${v};`)}
29080
29270
  .rui-stack[data-align="start"] { align-items: flex-start; }
29081
29271
  .rui-stack[data-align="center"] { align-items: center; }
29082
29272
  .rui-stack[data-align="end"] { align-items: flex-end; }
@@ -29097,11 +29287,7 @@ input, textarea, select, button { color: inherit; font-family: inherit; }
29097
29287
  .rui-stack[data-inline="true"] { display: inline-flex; }
29098
29288
  .rui-stack[data-direction="row-reverse"] { flex-direction: row-reverse; }
29099
29289
  .rui-stack[data-direction="column-reverse"] { flex-direction: column-reverse; }
29100
- .rui-stack[data-padding="xs"] { padding: var(--rui-spacing-xs); }
29101
- .rui-stack[data-padding="s"] { padding: var(--rui-spacing-s); }
29102
- .rui-stack[data-padding="m"] { padding: var(--rui-spacing-m); }
29103
- .rui-stack[data-padding="l"] { padding: var(--rui-spacing-l); }
29104
- .rui-stack[data-padding="xl"] { padding: var(--rui-spacing-xl); }
29290
+ ${spacingAttrRules(".rui-stack", "data-padding", (v) => `padding: ${v};`)}
29105
29291
  .rui-stack[data-direction="row"][data-uniform="true"] > *:not(.rui-stack-item) { flex: 1 1 auto; min-width: 0; }
29106
29292
  .rui-stack[data-direction="row-reverse"][data-uniform="true"] > *:not(.rui-stack-item) { flex: 1 1 auto; min-width: 0; }
29107
29293
  /* Compact inline pills should hug their content, even inside a row Stack
@@ -29148,16 +29334,8 @@ input, textarea, select, button { color: inherit; font-family: inherit; }
29148
29334
  .rui-center[data-inline="true"] { display: inline-flex; width: auto; }
29149
29335
  .rui-center[data-axis="horizontal"] { justify-content: flex-start; }
29150
29336
  .rui-center[data-axis="vertical"] { align-items: stretch; text-align: left; }
29151
- .rui-center[data-gap="xs"] { gap: var(--rui-spacing-xs); }
29152
- .rui-center[data-gap="s"] { gap: var(--rui-spacing-s); }
29153
- .rui-center[data-gap="m"] { gap: var(--rui-spacing-m); }
29154
- .rui-center[data-gap="l"] { gap: var(--rui-spacing-l); }
29155
- .rui-center[data-gap="xl"] { gap: var(--rui-spacing-xl); }
29156
- .rui-center[data-padding="xs"] { padding: var(--rui-spacing-xs); }
29157
- .rui-center[data-padding="s"] { padding: var(--rui-spacing-s); }
29158
- .rui-center[data-padding="m"] { padding: var(--rui-spacing-m); }
29159
- .rui-center[data-padding="l"] { padding: var(--rui-spacing-l); }
29160
- .rui-center[data-padding="xl"] { padding: var(--rui-spacing-xl); }
29337
+ ${spacingAttrRules(".rui-center", "data-gap", (v) => `gap: ${v};`)}
29338
+ ${spacingAttrRules(".rui-center", "data-padding", (v) => `padding: ${v};`)}
29161
29339
 
29162
29340
  /* Section */
29163
29341
  .rui-section { display: flex; flex-direction: column; gap: var(--rui-spacing-s); }
@@ -29251,6 +29429,11 @@ input, textarea, select, button { color: inherit; font-family: inherit; }
29251
29429
  .rui-text[data-color="success"] { color: var(--rui-color-success); }
29252
29430
  .rui-text[data-color="warning"] { color: var(--rui-color-warning); }
29253
29431
  .rui-text[data-color="danger"] { color: var(--rui-color-danger); }
29432
+ /* align only works on a block box — the span is inline by default. */
29433
+ .rui-text[data-align] { display: block; }
29434
+ .rui-text[data-align="left"] { text-align: left; }
29435
+ .rui-text[data-align="center"] { text-align: center; }
29436
+ .rui-text[data-align="right"] { text-align: right; }
29254
29437
 
29255
29438
  /* Image */
29256
29439
  .rui-image { margin: 0; display: flex; flex-direction: column; gap: var(--rui-spacing-xs); }
@@ -29839,6 +30022,11 @@ input, textarea, select, button { color: inherit; font-family: inherit; }
29839
30022
  .rui-button[data-variant="ghost"]:hover:not(:disabled) { background: var(--rui-color-surface-muted); }
29840
30023
  .rui-button[data-variant="danger"] { background: var(--rui-color-danger); color: #fff; }
29841
30024
  .rui-button[data-variant="danger"]:hover:not(:disabled) { background: color-mix(in srgb, var(--rui-color-danger) 80%, black); }
30025
+ /* "default" is an alias for the base (primary) look — no override needed. */
30026
+ .rui-button[data-variant="outline"] { background: transparent; color: var(--rui-color-primary); border-color: color-mix(in srgb, var(--rui-color-primary) 55%, transparent); }
30027
+ .rui-button[data-variant="outline"]:hover:not(:disabled) { background: color-mix(in srgb, var(--rui-color-primary) 10%, transparent); border-color: var(--rui-color-primary); }
30028
+ .rui-button[data-variant="link"] { background: transparent; color: var(--rui-color-primary); border-color: transparent; text-underline-offset: 3px; }
30029
+ .rui-button[data-variant="link"]:hover:not(:disabled) { background: transparent; color: var(--rui-color-primary-hover); text-decoration: underline; }
29842
30030
  .rui-button[data-size="xs"] { padding: calc(var(--rui-button-padding-y) * 0.45) calc(var(--rui-button-padding-x) * 0.6); font-size: 11px; }
29843
30031
  .rui-button[data-size="sm"] { padding: calc(var(--rui-button-padding-y) * 0.55) calc(var(--rui-button-padding-x) * 0.7); font-size: var(--rui-font-size-sm); }
29844
30032
  .rui-button[data-size="lg"] { padding: calc(var(--rui-button-padding-y) * 1.4) calc(var(--rui-button-padding-x) * 1.3); font-size: var(--rui-font-size-lg); }
@@ -30047,11 +30235,7 @@ input, textarea, select, button { color: inherit; font-family: inherit; }
30047
30235
  .rui-grid[data-columns="10"] { grid-template-columns: repeat(10, minmax(0, 1fr)); }
30048
30236
  .rui-grid[data-columns="11"] { grid-template-columns: repeat(11, minmax(0, 1fr)); }
30049
30237
  .rui-grid[data-columns="12"] { grid-template-columns: repeat(12, minmax(0, 1fr)); }
30050
- .rui-grid[data-gap="xs"] { gap: var(--rui-spacing-xs); }
30051
- .rui-grid[data-gap="s"] { gap: var(--rui-spacing-s); }
30052
- .rui-grid[data-gap="m"] { gap: var(--rui-spacing-m); }
30053
- .rui-grid[data-gap="l"] { gap: var(--rui-spacing-l); }
30054
- .rui-grid[data-gap="xl"] { gap: var(--rui-spacing-xl); }
30238
+ ${spacingAttrRules(".rui-grid", "data-gap", (v) => `gap: ${v};`)}
30055
30239
 
30056
30240
  /* Responsive prop maps for Grid columns/gap and Stack direction/gap.
30057
30241
  * Components set --rui-grid-cols-{bp} / --rui-stack-dir-{bp} CSS vars for
@@ -30193,16 +30377,8 @@ input, textarea, select, button { color: inherit; font-family: inherit; }
30193
30377
  .rui-grid[data-columns="10"][data-min-child-width] { --rui-grid-col-count: 10; }
30194
30378
  .rui-grid[data-columns="11"][data-min-child-width] { --rui-grid-col-count: 11; }
30195
30379
  .rui-grid[data-columns="12"][data-min-child-width] { --rui-grid-col-count: 12; }
30196
- .rui-grid[data-row-gap="xs"] { row-gap: var(--rui-spacing-xs); }
30197
- .rui-grid[data-row-gap="s"] { row-gap: var(--rui-spacing-s); }
30198
- .rui-grid[data-row-gap="m"] { row-gap: var(--rui-spacing-m); }
30199
- .rui-grid[data-row-gap="l"] { row-gap: var(--rui-spacing-l); }
30200
- .rui-grid[data-row-gap="xl"] { row-gap: var(--rui-spacing-xl); }
30201
- .rui-grid[data-column-gap="xs"] { column-gap: var(--rui-spacing-xs); }
30202
- .rui-grid[data-column-gap="s"] { column-gap: var(--rui-spacing-s); }
30203
- .rui-grid[data-column-gap="m"] { column-gap: var(--rui-spacing-m); }
30204
- .rui-grid[data-column-gap="l"] { column-gap: var(--rui-spacing-l); }
30205
- .rui-grid[data-column-gap="xl"] { column-gap: var(--rui-spacing-xl); }
30380
+ ${spacingAttrRules(".rui-grid", "data-row-gap", (v) => `row-gap: ${v};`)}
30381
+ ${spacingAttrRules(".rui-grid", "data-column-gap", (v) => `column-gap: ${v};`)}
30206
30382
  .rui-grid[data-align-items="start"] { align-items: start; }
30207
30383
  .rui-grid[data-align-items="center"] { align-items: center; }
30208
30384
  .rui-grid[data-align-items="end"] { align-items: end; }
@@ -30246,16 +30422,8 @@ input, textarea, select, button { color: inherit; font-family: inherit; }
30246
30422
 
30247
30423
  /* Box — spacing / surface wrapper */
30248
30424
  .rui-box { box-sizing: border-box; }
30249
- .rui-box[data-padding="xs"] { padding: var(--rui-spacing-xs); }
30250
- .rui-box[data-padding="s"] { padding: var(--rui-spacing-s); }
30251
- .rui-box[data-padding="m"] { padding: var(--rui-spacing-m); }
30252
- .rui-box[data-padding="l"] { padding: var(--rui-spacing-l); }
30253
- .rui-box[data-padding="xl"] { padding: var(--rui-spacing-xl); }
30254
- .rui-box[data-margin="xs"] { margin: var(--rui-spacing-xs); }
30255
- .rui-box[data-margin="s"] { margin: var(--rui-spacing-s); }
30256
- .rui-box[data-margin="m"] { margin: var(--rui-spacing-m); }
30257
- .rui-box[data-margin="l"] { margin: var(--rui-spacing-l); }
30258
- .rui-box[data-margin="xl"] { margin: var(--rui-spacing-xl); }
30425
+ ${spacingAttrRules(".rui-box", "data-padding", (v) => `padding: ${v};`)}
30426
+ ${spacingAttrRules(".rui-box", "data-margin", (v) => `margin: ${v};`)}
30259
30427
  .rui-box[data-border="subtle"] { border: 1px solid color-mix(in srgb, var(--rui-color-border) 60%, transparent); border-radius: var(--rui-radius-md); }
30260
30428
  .rui-box[data-border="default"] { border: 1px solid var(--rui-color-border); border-radius: var(--rui-radius-md); }
30261
30429
  .rui-box[data-background="surface"] { background: var(--rui-color-surface); }
@@ -31063,6 +31231,7 @@ input, textarea, select, button { color: inherit; font-family: inherit; }
31063
31231
  display: grid;
31064
31232
  gap: var(--rui-spacing-l);
31065
31233
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
31234
+ margin: var(--rui-spacing-l) 0;
31066
31235
  }
31067
31236
  .rui-feature-grid[data-columns="1"] { grid-template-columns: 1fr; }
31068
31237
  .rui-feature-grid[data-columns="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@@ -31552,6 +31721,7 @@ input, textarea, select, button { color: inherit; font-family: inherit; }
31552
31721
  gap: var(--rui-spacing-l);
31553
31722
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
31554
31723
  align-items: stretch;
31724
+ margin: var(--rui-spacing-l) 0;
31555
31725
  }
31556
31726
  .rui-pricing-table[data-columns="1"] { grid-template-columns: 1fr; }
31557
31727
  .rui-pricing-table[data-columns="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@@ -31667,19 +31837,12 @@ input, textarea, select, button { color: inherit; font-family: inherit; }
31667
31837
  .rui-container[data-size="lg"] { max-width: 1040px; }
31668
31838
  .rui-container[data-size="xl"] { max-width: 1280px; }
31669
31839
  .rui-container[data-size="full"] { max-width: 100%; }
31670
- .rui-container[data-padding="none"] { padding-left: 0; padding-right: 0; }
31671
- .rui-container[data-padding="s"] { padding-left: var(--rui-spacing-s); padding-right: var(--rui-spacing-s); }
31672
- .rui-container[data-padding="m"] { padding-left: var(--rui-spacing-m); padding-right: var(--rui-spacing-m); }
31673
- .rui-container[data-padding="l"] { padding-left: var(--rui-spacing-l); padding-right: var(--rui-spacing-l); }
31840
+ ${spacingAttrRules(".rui-container", "data-padding", (v) => `padding-left: ${v}; padding-right: ${v};`)}
31674
31841
 
31675
31842
  /* Spacer */
31676
31843
  .rui-spacer { display: block; }
31677
31844
  .rui-spacer[data-flex="true"] { flex: 1 1 auto; }
31678
- .rui-spacer[data-size="xs"] { min-width: var(--rui-spacing-xs); min-height: var(--rui-spacing-xs); }
31679
- .rui-spacer[data-size="s"] { min-width: var(--rui-spacing-s); min-height: var(--rui-spacing-s); }
31680
- .rui-spacer[data-size="m"] { min-width: var(--rui-spacing-m); min-height: var(--rui-spacing-m); }
31681
- .rui-spacer[data-size="l"] { min-width: var(--rui-spacing-l); min-height: var(--rui-spacing-l); }
31682
- .rui-spacer[data-size="xl"] { min-width: var(--rui-spacing-xl); min-height: var(--rui-spacing-xl); }
31845
+ ${spacingAttrRules(".rui-spacer", "data-size", (v) => `min-width: ${v}; min-height: ${v};`)}
31683
31846
 
31684
31847
  /* Cover */
31685
31848
  .rui-cover {
@@ -36516,7 +36679,7 @@ th[data-active="true"] .rui-data-grid-sort-icon { opacity: 1; }
36516
36679
 
36517
36680
  .rui-masonry-grid {
36518
36681
  column-count: var(--rui-masonry-columns, 3);
36519
- column-gap: 12px;
36682
+ column-gap: var(--rui-masonry-gap, var(--rui-spacing-m));
36520
36683
  }
36521
36684
  .rui-masonry-grid[data-columns="1"] { --rui-masonry-columns: 1; }
36522
36685
  .rui-masonry-grid[data-columns="2"] { --rui-masonry-columns: 2; }
@@ -36524,16 +36687,12 @@ th[data-active="true"] .rui-data-grid-sort-icon { opacity: 1; }
36524
36687
  .rui-masonry-grid[data-columns="4"] { --rui-masonry-columns: 4; }
36525
36688
  .rui-masonry-grid[data-columns="5"] { --rui-masonry-columns: 5; }
36526
36689
  .rui-masonry-grid[data-columns="6"] { --rui-masonry-columns: 6; }
36527
- .rui-masonry-grid[data-gap="xs"] { column-gap: 4px; }
36528
- .rui-masonry-grid[data-gap="s"] { column-gap: 8px; }
36529
- .rui-masonry-grid[data-gap="m"] { column-gap: 12px; }
36530
- .rui-masonry-grid[data-gap="l"] { column-gap: 16px; }
36531
- .rui-masonry-grid[data-gap="xl"] { column-gap: 24px; }
36690
+ ${spacingAttrRules(".rui-masonry-grid", "data-gap", (v) => `--rui-masonry-gap: ${v};`)}
36532
36691
  .rui-masonry-grid > * {
36533
36692
  display: inline-block;
36534
36693
  width: 100%;
36535
36694
  break-inside: avoid;
36536
- margin-bottom: 12px;
36695
+ margin-bottom: var(--rui-masonry-gap, var(--rui-spacing-m));
36537
36696
  }
36538
36697
  @media (max-width: 720px) {
36539
36698
  .rui-masonry-grid { column-count: min(var(--rui-masonry-columns, 3), 2); }
@@ -36972,7 +37131,7 @@ th[data-active="true"] .rui-data-grid-sort-icon { opacity: 1; }
36972
37131
  margin: 0;
36973
37132
  color: var(--rui-color-text);
36974
37133
  }
36975
- .rui-heading[data-size="section"] { font-size: clamp(24px, 3.4vw, 38px); font-weight: 800; letter-spacing: -0.02em; }
37134
+ .rui-heading[data-size="section"] { font-size: clamp(24px, 3.4vw, 38px); font-weight: 800; letter-spacing: -0.02em; margin: var(--rui-spacing-l) 0; }
36976
37135
  .rui-heading[data-size="lg"] { font-size: 24px; }
36977
37136
  .rui-heading[data-size="md"] { font-size: 19px; }
36978
37137
  .rui-heading[data-size="sm"] { font-size: 16px; }
@@ -36990,8 +37149,12 @@ th[data-active="true"] .rui-data-grid-sort-icon { opacity: 1; }
36990
37149
  * Section page-band (Part II.1)
36991
37150
  * ====================================================================== */
36992
37151
  .rui-section { padding: var(--rui-spacing-3xl) var(--rui-spacing-l); position: relative; }
37152
+ .rui-section[data-pad="none"] { padding: 0; }
37153
+ .rui-section[data-pad="xs"] { padding: var(--rui-spacing-l) var(--rui-spacing-l); }
36993
37154
  .rui-section[data-pad="sm"] { padding: var(--rui-spacing-xl) var(--rui-spacing-l); }
37155
+ .rui-section[data-pad="md"] { padding: var(--rui-spacing-3xl) var(--rui-spacing-l); }
36994
37156
  .rui-section[data-pad="lg"] { padding: calc(var(--rui-spacing-3xl) * 1.3) var(--rui-spacing-l); }
37157
+ .rui-section[data-pad="xl"] { padding: calc(var(--rui-spacing-3xl) * 1.6) var(--rui-spacing-l); }
36995
37158
  .rui-section[data-bg="soft"] { background: color-mix(in srgb, var(--rui-color-primary) 4%, var(--rui-color-bg)); }
36996
37159
  .rui-section[data-bg="surface"] { background: var(--rui-color-surface); }
36997
37160
  .rui-section[data-bg="muted"] { background: var(--rui-color-surface-muted); }
@@ -37063,7 +37226,7 @@ th[data-active="true"] .rui-data-grid-sort-icon { opacity: 1; }
37063
37226
  .rui-logochip:hover { transform: translateY(-3px); box-shadow: var(--rui-shadow-md); }
37064
37227
  .rui-logochip .rui-icon { font-size: 20px; }
37065
37228
 
37066
- .rui-metricstrip { display: grid; grid-template-columns: repeat(var(--ak-metric-cols, 4), minmax(0, 1fr)); gap: var(--rui-spacing-m); }
37229
+ .rui-metricstrip { display: grid; grid-template-columns: repeat(var(--ak-metric-cols, 4), minmax(0, 1fr)); gap: var(--rui-spacing-m); margin: var(--rui-spacing-l) 0; }
37067
37230
  @media (max-width: 720px) { .rui-metricstrip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
37068
37231
  .rui-metric { border: 1px solid var(--rui-color-border); background: var(--rui-color-surface); border-radius: var(--rui-radius-lg); padding: 26px 22px; position: relative; overflow: hidden; }
37069
37232
  .rui-metric-value { font-size: clamp(28px, 4vw, 42px); font-weight: 900; letter-spacing: -0.03em; line-height: 1; }
@@ -37215,9 +37378,7 @@ th[data-active="true"] .rui-data-grid-sort-icon { opacity: 1; }
37215
37378
  collapse below can re-shape the grid without fighting inline styles. */
37216
37379
  .rui-bento { display: grid; grid-template-columns: repeat(var(--rui-bento-cols, 6), minmax(0, 1fr)); gap: var(--rui-spacing-m); grid-auto-rows: var(--rui-bento-row, minmax(110px, auto)); }
37217
37380
  .rui-bento[data-dense="true"] { grid-auto-flow: dense; }
37218
- .rui-bento[data-gap="s"] { gap: var(--rui-spacing-s); }
37219
- .rui-bento[data-gap="l"] { gap: var(--rui-spacing-l); }
37220
- .rui-bento[data-gap="xl"] { gap: var(--rui-spacing-xl); }
37381
+ ${spacingAttrRules(".rui-bento", "data-gap", (v) => `gap: ${v};`)}
37221
37382
  .rui-bento[data-cols="1"] { --rui-bento-cols: 1; }
37222
37383
  .rui-bento[data-cols="2"] { --rui-bento-cols: 2; }
37223
37384
  .rui-bento[data-cols="3"] { --rui-bento-cols: 3; }