@valbuild/shared 0.128.0 → 0.130.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var core = require('@valbuild/core');
6
- var getSitemapTree = require('../../dist/getSitemapTree-b320d033.cjs.prod.js');
6
+ var getSitemapTree = require('../../dist/getSitemapTree-99839b02.cjs.prod.js');
7
7
  var zod = require('zod');
8
8
  var zodValidationError = require('zod-validation-error');
9
9
  var FlexSearch = require('flexsearch');
@@ -4610,6 +4610,18 @@ function clampDateTimeString(value, options) {
4610
4610
  * validation then reports, rather than wrong ones.
4611
4611
  */
4612
4612
 
4613
+ /**
4614
+ * The empty value for a schema — the thing a "create this" affordance writes.
4615
+ *
4616
+ * Returns `JSONValue`, the MUTABLE shape, rather than `Json`. Every value here
4617
+ * is built fresh on the way out — `Object.fromEntries`, a new array, a
4618
+ * primitive — and none of it aliases anything a caller could then mutate out
4619
+ * from under someone. Saying `Json` instead made the type readonly, which is
4620
+ * a claim about sharing that is not true of anything this returns, and left
4621
+ * every caller asserting `as JSONValue` at the point of writing a patch. A
4622
+ * `JSONValue` is still assignable to `Json`, so a reader of the value loses
4623
+ * nothing.
4624
+ */
4613
4625
  function emptyOf(schema, context) {
4614
4626
  if (schema.type === "object") {
4615
4627
  return Object.fromEntries(Object.keys(schema.items).map(function (key) {
@@ -6119,6 +6131,501 @@ function performSearch(searchIndex, query) {
6119
6131
  };
6120
6132
  }
6121
6133
 
6134
+ /**
6135
+ * The Studio's chrome, generated from one colour.
6136
+ *
6137
+ * `s.settings()`'s `theme.accent` is a single hex, and what it has to replace is
6138
+ * a TEN-STEP RAMP: `index.css` declares `--colors-brand-green-100` through
6139
+ * `-1000` and every brand token points into it, picking different steps in light
6140
+ * and in dark (a tinted surface is step 200 in light and 800 in dark; the text
6141
+ * on it is 1000 and 100). So the accent is not a colour to place, it is a ramp
6142
+ * to build — which is also why one accent drives both modes with nothing to keep
6143
+ * in sync.
6144
+ *
6145
+ * ## Why an arbitrary hex is safe
6146
+ *
6147
+ * The obvious worry is `contrast.test.ts`, which holds every foreground /
6148
+ * background pair the chrome renders to WCAG AA. A hex typed by an editor never
6149
+ * goes near that test.
6150
+ *
6151
+ * It holds anyway, because of how the ramp is built: **green's lightness at each
6152
+ * step is reused unchanged, and only the hue moves.** WCAG relative luminance is
6153
+ * almost entirely a function of lightness, so a ramp that keeps green's L
6154
+ * profile keeps green's contrast relationships. Chroma is scaled to the accent's
6155
+ * own saturation and then reduced — never L — until each step fits sRGB.
6156
+ *
6157
+ * "Almost entirely" is doing real work in that sentence: at equal OKLCH
6158
+ * lightness a saturated yellow has a higher relative luminance than a blue, so
6159
+ * the ratios do move a little. {@link BRAND_CONTRAST_PAIRS} is the list of pairs
6160
+ * that have to survive it, and `accentRamp.test.ts` runs them over the hue
6161
+ * circle rather than trusting the argument.
6162
+ *
6163
+ * ## What is NOT generated
6164
+ *
6165
+ * With no accent set, the hand-tuned ramp in `index.css` is used as it is. This
6166
+ * module reproduces it to within a step or two, and re-deriving a value somebody
6167
+ * tuned by eye is a silent regression rather than a simplification.
6168
+ */
6169
+
6170
+ /** The steps `index.css` declares, smallest (lightest) first. */
6171
+ var RAMP_STEPS = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000];
6172
+ /**
6173
+ * Val's own brand ramp, and the lightness profile every generated ramp borrows.
6174
+ *
6175
+ * A copy of what `index.css` declares, because this package cannot read the UI
6176
+ * package's stylesheet — so the two are held together by a test instead:
6177
+ * `contrast.test.ts` resolves the ramp out of the real CSS and asserts it equals
6178
+ * this. If that test fails, the stylesheet moved and this did not.
6179
+ */
6180
+ var VAL_GREEN_RAMP = {
6181
+ 100: "#dcfae6",
6182
+ 200: "#abefc6",
6183
+ 300: "#75e0a7",
6184
+ 400: "#47cd89",
6185
+ 500: "#17b26a",
6186
+ 600: "#079455",
6187
+ 700: "#067647",
6188
+ 800: "#085d3a",
6189
+ 900: "#074d31",
6190
+ 1000: "#053321"
6191
+ };
6192
+
6193
+ /**
6194
+ * The step the accent itself becomes, and therefore the step the whole ramp's
6195
+ * chroma is scaled against.
6196
+ *
6197
+ * 500 rather than 600: it is the most saturated step in the green ramp, so an
6198
+ * accent anchored there is reproduced about as faithfully as the ramp allows,
6199
+ * and the steps either side of it stay in the same relationship to it that
6200
+ * green's do.
6201
+ */
6202
+ var ANCHOR_STEP = 500;
6203
+
6204
+ /**
6205
+ * The step drawn on the CUSTOMER's page, as an outline around every editable
6206
+ * element.
6207
+ *
6208
+ * 600 is the step `index.css` pins the page-selection tokens to, for a reason
6209
+ * worth keeping: it clears 3:1 against both white and black, so the outlines
6210
+ * stay visible whatever the site behind them looks like. A generated ramp
6211
+ * inherits that because it inherits green-600's lightness — and
6212
+ * `accentRamp.test.ts` checks it on both grounds rather than assuming.
6213
+ */
6214
+ var PAGE_SELECTION_STEP = 600;
6215
+
6216
+ // ---------------------------------------------------------------------------
6217
+ // sRGB <-> OKLCH
6218
+ //
6219
+ // Written out rather than taken from a dependency: it is thirty lines, it runs
6220
+ // on every Studio render that has an accent, and `s.color()` already carries
6221
+ // its own copy of the neighbouring maths (`schema/colorFormat.ts`) for the same
6222
+ // reason.
6223
+ // ---------------------------------------------------------------------------
6224
+
6225
+ /** OKLCH: lightness 0-1, chroma, hue in degrees. */
6226
+
6227
+ /**
6228
+ * Every hex form `s.color({ format: "hex" })` accepts.
6229
+ *
6230
+ * Three and four digits as well as six and eight, because that is what the
6231
+ * schema validates — `detectColorFormat` calls anything starting with `#` hex,
6232
+ * and `#fff` parses. A generator that took only six digits left a
6233
+ * schema-VALID accent doing nothing at all: no ramp, no error, and a Studio
6234
+ * still on Val green with a colour sitting in the settings module.
6235
+ */
6236
+ var HEX = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
6237
+ function srgbToLinear(c) {
6238
+ return c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
6239
+ }
6240
+ function linearToSrgb(c) {
6241
+ return c <= 0.0031308 ? 12.92 * c : 1.055 * Math.pow(c, 1 / 2.4) - 0.055;
6242
+ }
6243
+
6244
+ /**
6245
+ * `null` for anything that is not a hex colour.
6246
+ *
6247
+ * Alpha is read and discarded. The ramp is a set of opaque surfaces and text
6248
+ * colours, and `s.color()` rejects a non-opaque value anyway unless the field
6249
+ * enabled alpha — which `theme.accent` does not. So `#0f08` is the same accent
6250
+ * as `#0f0`, rather than nothing at all.
6251
+ */
6252
+ function hexToRgb(hex) {
6253
+ var trimmed = hex.trim();
6254
+ if (!HEX.test(trimmed)) {
6255
+ return null;
6256
+ }
6257
+ var digits = trimmed.slice(1);
6258
+ var _short = digits.length <= 4;
6259
+ var channel = function channel(index) {
6260
+ var slice = _short ? digits[index].repeat(2) : digits.slice(index * 2, index * 2 + 2);
6261
+ return parseInt(slice, 16) / 255;
6262
+ };
6263
+ return [channel(0), channel(1), channel(2)];
6264
+ }
6265
+ function rgbToHex(rgb) {
6266
+ return "#" + rgb.map(function (c) {
6267
+ return Math.round(Math.min(1, Math.max(0, c)) * 255).toString(16).padStart(2, "0");
6268
+ }).join("");
6269
+ }
6270
+ function rgbToOklch(rgb) {
6271
+ var r = srgbToLinear(rgb[0]);
6272
+ var g = srgbToLinear(rgb[1]);
6273
+ var b = srgbToLinear(rgb[2]);
6274
+ var l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
6275
+ var m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);
6276
+ var s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
6277
+ var okL = 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s;
6278
+ var okA = 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s;
6279
+ var okB = 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s;
6280
+ return [okL, Math.hypot(okA, okB), Math.atan2(okB, okA) * 180 / Math.PI];
6281
+ }
6282
+ function oklchToRgb(lch) {
6283
+ var okA = lch[1] * Math.cos(lch[2] * Math.PI / 180);
6284
+ var okB = lch[1] * Math.sin(lch[2] * Math.PI / 180);
6285
+ var l = Math.pow(lch[0] + 0.3963377774 * okA + 0.2158037573 * okB, 3);
6286
+ var m = Math.pow(lch[0] - 0.1055613458 * okA - 0.0638541728 * okB, 3);
6287
+ var s = Math.pow(lch[0] - 0.0894841775 * okA - 1.291485548 * okB, 3);
6288
+ return [linearToSrgb(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s), linearToSrgb(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s), linearToSrgb(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s)];
6289
+ }
6290
+
6291
+ /** A hair of slack, so a colour that is exactly at the edge is not clamped. */
6292
+ var GAMUT_EPSILON = 0.0005;
6293
+ function inGamut(rgb) {
6294
+ return rgb.every(function (c) {
6295
+ return c >= -GAMUT_EPSILON && c <= 1 + GAMUT_EPSILON;
6296
+ });
6297
+ }
6298
+
6299
+ /**
6300
+ * Bring a colour inside sRGB by reducing its CHROMA, never its lightness.
6301
+ *
6302
+ * That restriction is the whole reason the contrast argument holds: clipping
6303
+ * RGB channels (which is what naive conversion does) moves lightness, and a
6304
+ * step that has drifted lighter is a step whose contrast guarantee is gone.
6305
+ * Twenty-four bisections is well past single-byte precision.
6306
+ */
6307
+ function clampChromaToGamut(lch) {
6308
+ if (inGamut(oklchToRgb(lch))) {
6309
+ return lch;
6310
+ }
6311
+ var lo = 0;
6312
+ var hi = lch[1];
6313
+ for (var i = 0; i < 24; i++) {
6314
+ var mid = (lo + hi) / 2;
6315
+ if (inGamut(oklchToRgb([lch[0], mid, lch[2]]))) {
6316
+ lo = mid;
6317
+ } else {
6318
+ hi = mid;
6319
+ }
6320
+ }
6321
+ return [lch[0], lo, lch[2]];
6322
+ }
6323
+ var GREEN_PROFILE = RAMP_STEPS.map(function (step) {
6324
+ var rgb = hexToRgb(VAL_GREEN_RAMP[step]);
6325
+ if (rgb === null) {
6326
+ // Unreachable: the ramp above is literal hex. Thrown rather than defaulted
6327
+ // because a broken profile would produce a plausible-looking wrong ramp.
6328
+ throw new Error("Val's green ramp holds a non-hex value at step ".concat(step));
6329
+ }
6330
+ return {
6331
+ step: step,
6332
+ lch: rgbToOklch(rgb)
6333
+ };
6334
+ });
6335
+
6336
+ /**
6337
+ * The ten-step ramp for one accent, or `null` if it is not a six-digit hex.
6338
+ *
6339
+ * `null` rather than a fallback: the caller knows whether it is holding a value
6340
+ * an editor picked (in which case the schema already validated it) or one that
6341
+ * came out of a hand-edited settings file, and only the caller can decide
6342
+ * whether "ignore it" or "report it" is right.
6343
+ */
6344
+ function accentRamp(accent) {
6345
+ var rgb = hexToRgb(accent);
6346
+ if (rgb === null) {
6347
+ return null;
6348
+ }
6349
+ var _rgbToOklch = rgbToOklch(rgb),
6350
+ _rgbToOklch2 = _slicedToArray(_rgbToOklch, 3),
6351
+ accentChroma = _rgbToOklch2[1],
6352
+ accentHue = _rgbToOklch2[2];
6353
+ var anchor = GREEN_PROFILE.find(function (entry) {
6354
+ return entry.step === ANCHOR_STEP;
6355
+ });
6356
+ if (anchor === undefined || anchor.lch[1] === 0) {
6357
+ throw new Error("Val's green ramp has no chroma at its anchor step");
6358
+ }
6359
+ var chromaScale = accentChroma / anchor.lch[1];
6360
+ var at = function at(step) {
6361
+ var entry = GREEN_PROFILE.find(function (candidate) {
6362
+ return candidate.step === step;
6363
+ });
6364
+ if (entry === undefined) {
6365
+ throw new Error("Val's green ramp has no step ".concat(step));
6366
+ }
6367
+ // Green's lightness and chroma, the accent's hue. Green's own hue is the
6368
+ // one thing a generated ramp does not keep.
6369
+ var _entry$lch = _slicedToArray(entry.lch, 2),
6370
+ lightness = _entry$lch[0],
6371
+ chroma = _entry$lch[1];
6372
+ return rgbToHex(oklchToRgb(clampChromaToGamut([lightness, chroma * chromaScale, accentHue])));
6373
+ };
6374
+ // Written out rather than reduced into, so the type says every step is
6375
+ // present instead of a cast saying so.
6376
+ return {
6377
+ 100: at(100),
6378
+ 200: at(200),
6379
+ 300: at(300),
6380
+ 400: at(400),
6381
+ 500: at(500),
6382
+ 600: at(600),
6383
+ 700: at(700),
6384
+ 800: at(800),
6385
+ 900: at(900),
6386
+ 1000: at(1000)
6387
+ };
6388
+ }
6389
+
6390
+ /**
6391
+ * The custom properties that restyle the chrome, ready to put on a `style`
6392
+ * attribute.
6393
+ *
6394
+ * Custom properties on the element rather than a generated stylesheet: nothing
6395
+ * has to be escaped, an inline custom property beats `@layer base` without a
6396
+ * specificity fight, and a subtree that should keep the untouched palette
6397
+ * simply is not given the object. See `useValThemeStyle` for where they go —
6398
+ * every place the Studio stamps `data-mode`, because the theme travels with it.
6399
+ *
6400
+ * Empty when nothing is set, which is what makes "no theme" cost nothing.
6401
+ */
6402
+ function themeCustomProperties(theme) {
6403
+ var properties = {};
6404
+ if (theme.accent) {
6405
+ var ramp = accentRamp(theme.accent);
6406
+ if (ramp !== null) {
6407
+ var _iterator = getSitemapTree._createForOfIteratorHelper(RAMP_STEPS),
6408
+ _step;
6409
+ try {
6410
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
6411
+ var step = _step.value;
6412
+ properties["--colors-brand-green-".concat(step)] = ramp[step];
6413
+ }
6414
+ /*
6415
+ * The page-selection trio, written OUT rather than left to follow the
6416
+ * ramp — and the first of them is the one that has to be said out loud,
6417
+ * because it looks like it should follow and does not.
6418
+ *
6419
+ * `index.css` declares `--bg-page-selection: var(--colors-brand-green-600)`,
6420
+ * so overriding the ramp looks like enough. It is not: **a `var()` inside
6421
+ * a custom property is substituted where the property is DECLARED, not
6422
+ * where it is used.** That declaration lives in the light block, whose
6423
+ * selector is `:host, :root, *[data-mode="light"]` — so on a
6424
+ * `data-mode="dark"` element the rule does not match, nothing is declared
6425
+ * there, and what the element inherits from `:host` is the value already
6426
+ * substituted to green. An override of the ramp on the element cannot
6427
+ * reach backwards into it.
6428
+ *
6429
+ * The brand tokens escape this only because the DARK block re-declares
6430
+ * them: `--bg-brand-primary: var(--colors-brand-green-800)` is computed
6431
+ * on the themed element itself, so it resolves against the override. The
6432
+ * page-selection tokens are deliberately declared once and never flipped
6433
+ * with the theme (the page underneath is not a Val surface), which is
6434
+ * exactly what puts them outside that mechanism.
6435
+ *
6436
+ * So: anything that depends on the ramp and is not re-declared per mode
6437
+ * has to be written here. `brandDerivedTokens.test.ts` scans the
6438
+ * stylesheet and fails if another one appears.
6439
+ */
6440
+ } catch (err) {
6441
+ _iterator.e(err);
6442
+ } finally {
6443
+ _iterator.f();
6444
+ }
6445
+ properties["--bg-page-selection"] = ramp[PAGE_SELECTION_STEP];
6446
+ var selection = hexToRgb(ramp[PAGE_SELECTION_STEP]);
6447
+ if (selection !== null) {
6448
+ var channels = selection.map(function (c) {
6449
+ return Math.round(c * 255);
6450
+ }).join(", ");
6451
+ properties["--bg-page-selection-fill"] = "rgba(".concat(channels, ", 0.12)");
6452
+ properties["--bg-page-selection-soft"] = "rgba(".concat(channels, ", 0.4)");
6453
+ }
6454
+ }
6455
+ }
6456
+ if (theme.radius) {
6457
+ properties["--radius"] = theme.radius;
6458
+ }
6459
+ return properties;
6460
+ }
6461
+
6462
+ /**
6463
+ * WCAG relative luminance of a six-digit hex.
6464
+ *
6465
+ * Exported so there is one implementation of the maths that decides whether a
6466
+ * theme is legible; `contrast.test.ts` had its own copy, and two copies of a
6467
+ * threshold is how a guarantee quietly stops being one.
6468
+ */
6469
+ function relativeLuminance(hex) {
6470
+ var rgb = hexToRgb(hex);
6471
+ if (rgb === null) {
6472
+ throw new Error("Not a six-digit hex colour: ".concat(hex));
6473
+ }
6474
+ var _rgb$map = rgb.map(srgbToLinear),
6475
+ _rgb$map2 = _slicedToArray(_rgb$map, 3),
6476
+ r = _rgb$map2[0],
6477
+ g = _rgb$map2[1],
6478
+ b = _rgb$map2[2];
6479
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
6480
+ }
6481
+
6482
+ /** WCAG contrast ratio between two six-digit hex colours, 1 to 21. */
6483
+ function contrastRatio(a, b) {
6484
+ var la = relativeLuminance(a);
6485
+ var lb = relativeLuminance(b);
6486
+ var hi = Math.max(la, lb);
6487
+ var lo = Math.min(la, lb);
6488
+ return (hi + 0.05) / (lo + 0.05);
6489
+ }
6490
+
6491
+ /** WCAG AA for body text. */
6492
+ var AA_TEXT = 4.5;
6493
+ /** WCAG AA for large text and for UI components such as a focus ring. */
6494
+ var AA_LARGE = 3;
6495
+
6496
+ /**
6497
+ * Where a brand pair's background comes from.
6498
+ *
6499
+ * A `RampStep` is a step of the brand ramp, so it moves with the accent. A hex
6500
+ * is a neutral surface that does not — the canvas and the floating panels are
6501
+ * grey in every theme, and a ring has to be legible against them.
6502
+ */
6503
+
6504
+ /**
6505
+ * Every foreground / background pair the chrome renders with BRAND colours.
6506
+ *
6507
+ * The list is data rather than a test body because two different things have to
6508
+ * be held to it, and one table is the only way they can agree:
6509
+ *
6510
+ * - `accentRamp.test.ts` runs it over ramps generated across the hue circle,
6511
+ * which is what makes an arbitrary accent safe.
6512
+ * - `contrast.test.ts` runs it over the ramp resolved out of the real
6513
+ * `index.css`, which is what stops someone nudging Val's own green past AA.
6514
+ *
6515
+ * The neutral pairs — muted text on a panel, a hairline on the canvas — stay in
6516
+ * `contrast.test.ts`. They have nothing to do with the accent, and a theme
6517
+ * cannot move them.
6518
+ */
6519
+ var BRAND_CONTRAST_PAIRS = [
6520
+ // Light: `--bg-brand-primary` is step 200, with `--fg-brand-primary` (1000)
6521
+ // and `--fg-brand-primary-alt` (900) on it.
6522
+ {
6523
+ what: "fg-brand-primary on bg-brand-primary",
6524
+ mode: "light",
6525
+ fg: 1000,
6526
+ bg: 200,
6527
+ min: AA_TEXT
6528
+ }, {
6529
+ what: "fg-brand-primary-alt on bg-brand-primary",
6530
+ mode: "light",
6531
+ fg: 900,
6532
+ bg: 200,
6533
+ min: AA_TEXT
6534
+ },
6535
+ // Light: `--bg-brand-secondary` is the filled step 800.
6536
+ {
6537
+ what: "fg-brand-secondary on bg-brand-secondary",
6538
+ mode: "light",
6539
+ fg: 100,
6540
+ bg: 800,
6541
+ min: AA_TEXT
6542
+ }, {
6543
+ what: "fg-brand-secondary-alt on bg-brand-secondary",
6544
+ mode: "light",
6545
+ fg: 200,
6546
+ bg: 800,
6547
+ min: AA_TEXT
6548
+ },
6549
+ // Light: `--border-focus` is step 600, and it has to read on both neutral
6550
+ // surfaces a focused control can sit on.
6551
+ {
6552
+ what: "border-focus on bg-float",
6553
+ mode: "light",
6554
+ fg: 600,
6555
+ bg: "#fcfcfc",
6556
+ min: AA_LARGE
6557
+ }, {
6558
+ what: "border-focus on bg-canvas",
6559
+ mode: "light",
6560
+ fg: 600,
6561
+ bg: "#f4f4f5",
6562
+ min: AA_LARGE
6563
+ },
6564
+ // The outlines drawn on the customer's own page. Not a Val surface at all,
6565
+ // which is why the grounds are pure white and pure black: the site behind
6566
+ // them can be anything.
6567
+ {
6568
+ what: "bg-page-selection on a white site",
6569
+ mode: "light",
6570
+ fg: 600,
6571
+ bg: "#ffffff",
6572
+ min: AA_LARGE
6573
+ }, {
6574
+ what: "bg-page-selection on a black site",
6575
+ mode: "light",
6576
+ fg: 600,
6577
+ bg: "#000000",
6578
+ min: AA_LARGE
6579
+ },
6580
+ // Dark inverts which step is the surface and which is the text.
6581
+ {
6582
+ what: "fg-brand-primary on bg-brand-primary",
6583
+ mode: "dark",
6584
+ fg: 100,
6585
+ bg: 800,
6586
+ min: AA_TEXT
6587
+ }, {
6588
+ what: "fg-brand-primary-alt on bg-brand-primary",
6589
+ mode: "dark",
6590
+ fg: 200,
6591
+ bg: 800,
6592
+ min: AA_TEXT
6593
+ }, {
6594
+ what: "fg-brand-secondary on bg-brand-secondary",
6595
+ mode: "dark",
6596
+ fg: 1000,
6597
+ bg: 200,
6598
+ min: AA_TEXT
6599
+ }, {
6600
+ what: "fg-brand-secondary-alt on bg-brand-secondary",
6601
+ mode: "dark",
6602
+ fg: 900,
6603
+ bg: 200,
6604
+ min: AA_TEXT
6605
+ },
6606
+ // Dark's focus ring lightens rather than mirroring: step 600 is nearly
6607
+ // invisible against the dark canvas.
6608
+ {
6609
+ what: "border-focus on bg-canvas",
6610
+ mode: "dark",
6611
+ fg: 400,
6612
+ bg: "#08080a",
6613
+ min: AA_LARGE
6614
+ }, {
6615
+ what: "border-focus on bg-float",
6616
+ mode: "dark",
6617
+ fg: 400,
6618
+ bg: "#131316",
6619
+ min: AA_LARGE
6620
+ }];
6621
+
6622
+ /** Resolve one side of a {@link BRAND_CONTRAST_PAIRS} entry against a ramp. */
6623
+ function resolvePairGround(ground, ramp) {
6624
+ return typeof ground === "number" ? ramp[ground] : ground;
6625
+ }
6626
+
6627
+ exports.DEFAULT_CANVAS_SELECTION = getSitemapTree.DEFAULT_CANVAS_SELECTION;
6628
+ exports.DEFAULT_CANVAS_SELECTION_SOFT = getSitemapTree.DEFAULT_CANVAS_SELECTION_SOFT;
6122
6629
  exports.VAL_AI_SESSION_STORAGE_KEY = getSitemapTree.VAL_AI_SESSION_STORAGE_KEY;
6123
6630
  exports.VAL_CANVAS_MESSAGE = getSitemapTree.VAL_CANVAS_MESSAGE;
6124
6631
  exports.VAL_CANVAS_PARAM = getSitemapTree.VAL_CANVAS_PARAM;
@@ -6135,7 +6642,10 @@ exports.isValCanvasPageMessage = getSitemapTree.isValCanvasPageMessage;
6135
6642
  exports.isValCanvasStudioMessage = getSitemapTree.isValCanvasStudioMessage;
6136
6643
  exports.parseRoutePattern = getSitemapTree.parseRoutePattern;
6137
6644
  exports.withValCanvasParam = getSitemapTree.withValCanvasParam;
6645
+ exports.AA_LARGE = AA_LARGE;
6646
+ exports.AA_TEXT = AA_TEXT;
6138
6647
  exports.Api = Api;
6648
+ exports.BRAND_CONTRAST_PAIRS = BRAND_CONTRAST_PAIRS;
6139
6649
  exports.BinaryFileRef = BinaryFileRef;
6140
6650
  exports.CodeOptions = CodeOptions;
6141
6651
  exports.ColorOptions = ColorOptions;
@@ -6160,6 +6670,7 @@ exports.PatchBlock = PatchBlock;
6160
6670
  exports.PatchGroup = PatchGroup;
6161
6671
  exports.PatchId = PatchId;
6162
6672
  exports.PatchJSON = PatchJSON;
6673
+ exports.RAMP_STEPS = RAMP_STEPS;
6163
6674
  exports.RemirrorBr = RemirrorBr;
6164
6675
  exports.RemirrorBulletList = RemirrorBulletList;
6165
6676
  exports.RemirrorHeading = RemirrorHeading;
@@ -6197,10 +6708,12 @@ exports.SerializedSettingsSchema = SerializedSettingsSchema;
6197
6708
  exports.SerializedStringSchema = SerializedStringSchema;
6198
6709
  exports.SharedValConfig = SharedValConfig;
6199
6710
  exports.VAL_ENABLE_COOKIE_NAME = VAL_ENABLE_COOKIE_NAME;
6711
+ exports.VAL_GREEN_RAMP = VAL_GREEN_RAMP;
6200
6712
  exports.VAL_SESSION_COOKIE = VAL_SESSION_COOKIE;
6201
6713
  exports.VAL_STATE_COOKIE = VAL_STATE_COOKIE;
6202
6714
  exports.ValCommit = ValCommit;
6203
6715
  exports.ValDeployment = ValDeployment;
6716
+ exports.accentRamp = accentRamp;
6204
6717
  exports.buildDuplicatePatch = buildDuplicatePatch;
6205
6718
  exports.buildEmptyAtPathPatch = buildEmptyAtPathPatch;
6206
6719
  exports.buildFileRefValue = buildFileRefValue;
@@ -6210,6 +6723,7 @@ exports.buildSearchIndex = buildSearchIndex;
6210
6723
  exports.checkCompatibility = checkCompatibility;
6211
6724
  exports.chooseEncoded = chooseEncoded;
6212
6725
  exports.concatModulePath = concatModulePath;
6726
+ exports.contrastRatio = contrastRatio;
6213
6727
  exports.createRegExpFromPattern = createRegExpFromPattern;
6214
6728
  exports.createSearchIndex = createSearchIndex;
6215
6729
  exports.createValClient = createValClient;
@@ -6241,15 +6755,18 @@ exports.localeAt = localeAt;
6241
6755
  exports.newestCommitSha = newestCommitSha;
6242
6756
  exports.partitionValidationErrors = partitionValidationErrors;
6243
6757
  exports.performSearch = performSearch;
6758
+ exports.relativeLuminance = relativeLuminance;
6244
6759
  exports.remirrorToRichTextSource = remirrorToRichTextSource;
6245
6760
  exports.removeModule = removeModule;
6246
6761
  exports.resolveEncodeSettings = resolveEncodeSettings;
6762
+ exports.resolvePairGround = resolvePairGround;
6247
6763
  exports.resolveSchemaSourceFixForError = resolveSchemaSourceFixForError;
6248
6764
  exports.resolveSchemaSourceFixes = resolveSchemaSourceFixes;
6249
6765
  exports.resolveSerializedSchemaAtPath = resolveSerializedSchemaAtPath;
6250
6766
  exports.richTextToRemirror = richTextToRemirror;
6251
6767
  exports.safeParsePatch = safeParsePatch;
6252
6768
  exports.sourcePathOfChild = sourcePathOfChild;
6769
+ exports.themeCustomProperties = themeCustomProperties;
6253
6770
  exports.toolNames = toolNames;
6254
6771
  exports.traverseSchemaSource = traverseSchemaSource;
6255
6772
  exports.urlOf = urlOf;