@valbuild/core 0.144.0 → 0.145.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.
@@ -10185,6 +10185,87 @@ function patchPathToModulePath(patchPath) {
10185
10185
  }).join(".");
10186
10186
  }
10187
10187
 
10188
+ /**
10189
+ * What a number schema accepts, in one place, so the validator and the
10190
+ * Studio's "Round to …" / "Set to …" buttons cannot disagree about it.
10191
+ *
10192
+ * A button that offers a value the validator then rejects is worse than no
10193
+ * button, which is exactly what two copies of this arithmetic would drift into.
10194
+ */
10195
+
10196
+ /**
10197
+ * Division of decimals is not exact (`0.3 / 0.1` is `2.9999999999999996`), so a
10198
+ * value counts as on the grid when it is within this many steps of it.
10199
+ */
10200
+ var GRID_EPSILON = 1e-9;
10201
+
10202
+ /** Where the step grid starts: the schema's `min`, or 0 when it has none. */
10203
+ function stepOrigin(rules) {
10204
+ var _rules$min;
10205
+ return (_rules$min = rules.min) !== null && _rules$min !== void 0 ? _rules$min : 0;
10206
+ }
10207
+
10208
+ /** Is `value` one of `origin + n * step`? */
10209
+ function isOnStep(value, origin, step) {
10210
+ var steps = (value - origin) / step;
10211
+ return Math.abs(steps - Math.round(steps)) < GRID_EPSILON;
10212
+ }
10213
+
10214
+ /**
10215
+ * The allowed value closest to `value`: inside `min`/`max`, on the step grid,
10216
+ * and whole when the schema is an int.
10217
+ *
10218
+ * Returns `null` when the rules leave nothing to snap to — a `min` above
10219
+ * `max`, or a range too narrow to hold a single step or a single whole number.
10220
+ */
10221
+ function nearestAllowedNumber(value, rules) {
10222
+ var _rules$step;
10223
+ var step = (_rules$step = rules.step) !== null && _rules$step !== void 0 ? _rules$step : rules.integer ? 1 : undefined;
10224
+ var lo = rules.min;
10225
+ var hi = rules.max;
10226
+ if (lo !== undefined && hi !== undefined && lo > hi) {
10227
+ return null;
10228
+ }
10229
+ var clamp = function clamp(n) {
10230
+ return Math.min(hi !== null && hi !== void 0 ? hi : Infinity, Math.max(lo !== null && lo !== void 0 ? lo : -Infinity, n));
10231
+ };
10232
+ if (step === undefined) {
10233
+ return clamp(value);
10234
+ }
10235
+ var origin = rules.integer && rules.step === undefined ? 0 : stepOrigin(rules);
10236
+ var toGrid = function toGrid(n) {
10237
+ return roundToDecimals(origin + n * step);
10238
+ };
10239
+ var n = Math.round((clamp(value) - origin) / step);
10240
+ // Rounding can step outside the range by one; walk back in.
10241
+ if (lo !== undefined && toGrid(n) < lo) n += 1;
10242
+ if (hi !== undefined && toGrid(n) > hi) n -= 1;
10243
+ var snapped = toGrid(n);
10244
+ if (lo !== undefined && snapped < lo || hi !== undefined && snapped > hi) {
10245
+ return null;
10246
+ }
10247
+ if (rules.integer && !Number.isInteger(snapped)) {
10248
+ return null;
10249
+ }
10250
+ return snapped;
10251
+ }
10252
+
10253
+ /**
10254
+ * `0.1 + 0.2` is `0.30000000000000004`. A value offered to an editor should
10255
+ * read `0.3`, so grid values are rounded to 12 significant decimals — far below
10256
+ * any step anyone writes, far above floating point noise.
10257
+ */
10258
+ function roundToDecimals(n) {
10259
+ return Number.parseFloat(n.toFixed(12));
10260
+ }
10261
+
10262
+ /**
10263
+ * What the value has to be. `integer` is what makes a number schema an
10264
+ * `s.int()`: the source is a number either way, so an int is a number schema
10265
+ * with one more rule rather than a schema type of its own (which every walk
10266
+ * over a schema would have had to learn).
10267
+ */
10268
+
10188
10269
  var NumberSchema = /*#__PURE__*/function (_Schema) {
10189
10270
  function NumberSchema(options) {
10190
10271
  var _this;
@@ -10194,6 +10275,7 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10194
10275
  var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
10195
10276
  var description = arguments.length > 5 ? arguments[5] : undefined;
10196
10277
  var previewInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
10278
+ var renderInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
10197
10279
  _classCallCheck(this, NumberSchema);
10198
10280
  _this = _callSuper(this, NumberSchema);
10199
10281
  _this.options = options;
@@ -10203,6 +10285,8 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10203
10285
  _this.isHidden = isHidden;
10204
10286
  _this.description = description;
10205
10287
  _this.previewInput = previewInput;
10288
+ _this.renderInput = renderInput;
10289
+ assertNumberSchemaIsConsistent(_this.options, _this.renderInput);
10206
10290
  return _this;
10207
10291
  }
10208
10292
 
@@ -10227,7 +10311,7 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10227
10311
  return _createClass(NumberSchema, [{
10228
10312
  key: "describe",
10229
10313
  value: function describe(description) {
10230
- return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput);
10314
+ return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput, this.renderInput);
10231
10315
  }
10232
10316
 
10233
10317
  /**
@@ -10253,12 +10337,12 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10253
10337
  }, {
10254
10338
  key: "validate",
10255
10339
  value: function validate(validationFunction) {
10256
- return new NumberSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.previewInput);
10340
+ return new NumberSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.previewInput, this.renderInput);
10257
10341
  }
10258
10342
  }, {
10259
10343
  key: "executeValidate",
10260
10344
  value: function executeValidate(path, src) {
10261
- var _this$options, _this$options2;
10345
+ var _this$options;
10262
10346
  var customValidationErrors = this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
10263
10347
  path: path
10264
10348
  });
@@ -10271,20 +10355,35 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10271
10355
  value: src
10272
10356
  }]));
10273
10357
  }
10274
- if ((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.max && src > this.options.max) {
10275
- return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
10276
- message: "Expected 'number' less than ".concat(this.options.max),
10358
+ var errors = _toConsumableArray(customValidationErrors);
10359
+ var options = (_this$options = this.options) !== null && _this$options !== void 0 ? _this$options : {};
10360
+ // `!== undefined`, not truthiness: a bound of 0 is a bound. `.max(0)` and
10361
+ // `.min(0)` used to be ignored, which a slider from 0 makes common.
10362
+ if (options.max !== undefined && src > options.max) {
10363
+ errors.push({
10364
+ message: "Must be at most ".concat(options.max),
10277
10365
  value: src
10278
- }]));
10366
+ });
10279
10367
  }
10280
- if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.min && src < this.options.min) {
10281
- return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
10282
- message: "Expected 'number' greater than ".concat(this.options.min),
10368
+ if (options.min !== undefined && src < options.min) {
10369
+ errors.push({
10370
+ message: "Must be at least ".concat(options.min),
10283
10371
  value: src
10284
- }]));
10372
+ });
10285
10373
  }
10286
- if (customValidationErrors.length > 0) {
10287
- return _defineProperty({}, path, customValidationErrors);
10374
+ if (options.integer && !Number.isInteger(src)) {
10375
+ errors.push({
10376
+ message: "Must be a whole number",
10377
+ value: src
10378
+ });
10379
+ } else if (options.step !== undefined && !isOnStep(src, stepOrigin(options), options.step)) {
10380
+ errors.push({
10381
+ message: "Must be a multiple of ".concat(options.step, ", counted from ").concat(stepOrigin(options)),
10382
+ value: src
10383
+ });
10384
+ }
10385
+ if (errors.length > 0) {
10386
+ return _defineProperty({}, path, errors);
10288
10387
  }
10289
10388
  return false;
10290
10389
  }
@@ -10323,19 +10422,19 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10323
10422
  }, {
10324
10423
  key: "nullable",
10325
10424
  value: function nullable() {
10326
- return new NumberSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
10425
+ return new NumberSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput, this.renderInput);
10327
10426
  }
10328
10427
  }, {
10329
10428
  key: "readonly",
10330
10429
  value: function readonly() {
10331
10430
  var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
10332
- return new NumberSchema(this.options, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.previewInput);
10431
+ return new NumberSchema(this.options, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.previewInput, this.renderInput);
10333
10432
  }
10334
10433
  }, {
10335
10434
  key: "hidden",
10336
10435
  value: function hidden() {
10337
10436
  var isHidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
10338
- return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.previewInput);
10437
+ return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.previewInput, this.renderInput);
10339
10438
  }
10340
10439
 
10341
10440
  /**
@@ -10350,7 +10449,7 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10350
10449
  value: function max(_max) {
10351
10450
  return new NumberSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
10352
10451
  max: _max
10353
- }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
10452
+ }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput, this.renderInput);
10354
10453
  }
10355
10454
 
10356
10455
  /**
@@ -10365,7 +10464,50 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10365
10464
  value: function min(_min) {
10366
10465
  return new NumberSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
10367
10466
  min: _min
10368
- }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
10467
+ }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput, this.renderInput);
10468
+ }
10469
+
10470
+ /**
10471
+ * Validate that the number is on a grid of `step`: one of `min`, `min + step`,
10472
+ * `min + 2 * step` and so on, counted from 0 when there is no `.min()`.
10473
+ *
10474
+ * A slider rendered on this field moves in the same steps unless its render
10475
+ * says otherwise (and then its step has to be a multiple of this one).
10476
+ *
10477
+ * @example
10478
+ * const schema = s.int().min(0).max(100).step(5);
10479
+ * export default c.define("/example.val.ts", schema, 40);
10480
+ */
10481
+ }, {
10482
+ key: "step",
10483
+ value: function step(_step) {
10484
+ return new NumberSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
10485
+ step: _step
10486
+ }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput, this.renderInput);
10487
+ }
10488
+
10489
+ /**
10490
+ * Choose how this field is edited. `{ as: "slider", min, max }` edits it with
10491
+ * a slider from `min` to `max`, next to a box for typing an exact value.
10492
+ *
10493
+ * `min` and `max` are required — a slider without ends is not a slider — and
10494
+ * they are the slider's, not validation: use `.min()` / `.max()` for what the
10495
+ * value may be. The slider can only produce values this schema accepts, so
10496
+ * its range must lie inside `.min()`/`.max()`, its `step` (which defaults to
10497
+ * `.step()`, then 1) must be a multiple of `.step()`, and on `s.int()` all of
10498
+ * them must be whole numbers. A schema that breaks this throws here.
10499
+ *
10500
+ * Static configuration, not a callback — see `render.ts`. A second
10501
+ * `.render(...)` replaces the first.
10502
+ *
10503
+ * @example
10504
+ * const schema = s.int().render({ as: "slider", min: 0, max: 100, step: 5 });
10505
+ * export default c.define("/example.val.ts", schema, 40);
10506
+ */
10507
+ }, {
10508
+ key: "render",
10509
+ value: function render(input) {
10510
+ return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput, input);
10369
10511
  }
10370
10512
  }, {
10371
10513
  key: "executeCustomValidateAt",
@@ -10389,7 +10531,7 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10389
10531
  }, {
10390
10532
  key: "preview",
10391
10533
  value: function preview(select) {
10392
- return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, select);
10534
+ return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, select, this.renderInput);
10393
10535
  }
10394
10536
  }, {
10395
10537
  key: "executePreviewItem",
@@ -10409,11 +10551,12 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10409
10551
  }, {
10410
10552
  key: "executeSerialize",
10411
10553
  value: function executeSerialize() {
10412
- var _this$customValidateF;
10554
+ var _this$renderInput, _this$customValidateF;
10413
10555
  return {
10414
10556
  type: "number",
10415
10557
  preview: this.previewInput ? true : undefined,
10416
10558
  options: this.options,
10559
+ render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
10417
10560
  opt: this.opt,
10418
10561
  customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
10419
10562
  readonly: this.isReadonly,
@@ -10426,6 +10569,63 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10426
10569
  var number = function number(options) {
10427
10570
  return new NumberSchema(options);
10428
10571
  };
10572
+ var _int = function _int() {
10573
+ return new NumberSchema({
10574
+ integer: true
10575
+ });
10576
+ };
10577
+ function assertNumberSchemaIsConsistent(options, render) {
10578
+ var opts = options !== null && options !== void 0 ? options : {};
10579
+ var kind = opts.integer ? "s.int()" : "s.number()";
10580
+ if (opts.step !== undefined) {
10581
+ if (!(opts.step > 0) || !Number.isFinite(opts.step)) {
10582
+ throw new Error("".concat(kind, ".step(").concat(opts.step, "): the step must be above 0"));
10583
+ }
10584
+ if (opts.integer && !Number.isInteger(opts.step)) {
10585
+ throw new Error("".concat(kind, ".step(").concat(opts.step, "): the step of an int must be a whole number"));
10586
+ }
10587
+ }
10588
+ if (render === null) {
10589
+ return;
10590
+ }
10591
+ var where = "".concat(kind, ".render({ as: \"slider\", min: ").concat(render.min, ", max: ").concat(render.max, " })");
10592
+ if (!Number.isFinite(render.min) || !Number.isFinite(render.max)) {
10593
+ throw new Error("".concat(where, ": the slider needs a min and a max"));
10594
+ }
10595
+ if (!(render.min < render.max)) {
10596
+ throw new Error("".concat(where, ": the slider's min must be below its max"));
10597
+ }
10598
+ if (opts.min !== undefined && render.min < opts.min) {
10599
+ throw new Error("".concat(where, ": the slider's min ").concat(render.min, " is below the schema's min ").concat(opts.min));
10600
+ }
10601
+ if (opts.max !== undefined && render.max > opts.max) {
10602
+ throw new Error("".concat(where, ": the slider's max ").concat(render.max, " is above the schema's max ").concat(opts.max));
10603
+ }
10604
+ if (render.step !== undefined && !(render.step > 0)) {
10605
+ throw new Error("".concat(where, ": the slider's step must be above 0"));
10606
+ }
10607
+ if (opts.integer) {
10608
+ var sliderNumbers = [["min", render.min], ["max", render.max], ["step", render.step]];
10609
+ for (var _i = 0, _sliderNumbers = sliderNumbers; _i < _sliderNumbers.length; _i++) {
10610
+ var _sliderNumbers$_i = _slicedToArray(_sliderNumbers[_i], 2),
10611
+ name = _sliderNumbers$_i[0],
10612
+ value = _sliderNumbers$_i[1];
10613
+ if (value !== undefined && !Number.isInteger(value)) {
10614
+ throw new Error("".concat(where, ": the slider's ").concat(name, " ").concat(value, " must be a whole number on an int"));
10615
+ }
10616
+ }
10617
+ }
10618
+ if (opts.step !== undefined) {
10619
+ var _render$step;
10620
+ var sliderStep = (_render$step = render.step) !== null && _render$step !== void 0 ? _render$step : opts.step;
10621
+ if (!isOnStep(sliderStep, 0, opts.step)) {
10622
+ throw new Error("".concat(where, ": the slider's step ").concat(sliderStep, " must be a multiple of the schema's step ").concat(opts.step));
10623
+ }
10624
+ if (!isOnStep(render.min, stepOrigin(opts), opts.step)) {
10625
+ throw new Error("".concat(where, ": the slider's min ").concat(render.min, " is not one of the schema's steps (").concat(opts.step, ", counted from ").concat(stepOrigin(opts), ")"));
10626
+ }
10627
+ }
10628
+ }
10429
10629
 
10430
10630
  /**
10431
10631
  * @deprecated Use {@link SerializedDiscriminatedUnionSchema} or
@@ -13204,6 +13404,7 @@ function initSchema(options) {
13204
13404
  array: array,
13205
13405
  object: object,
13206
13406
  number: number,
13407
+ "int": _int,
13207
13408
  discriminatedUnion: discriminatedUnion,
13208
13409
  "enum": enumSchema,
13209
13410
  union: union,
@@ -15114,7 +15315,7 @@ function deserializeSchema(serialized) {
15114
15315
  return schema;
15115
15316
  }
15116
15317
  function deserializeSchemaImpl(serialized) {
15117
- var _serialized$options, _serialized$options2, _serialized$multiline, _serialized$render, _serialized$accept, _serialized$dir, _serialized$remote, _serialized$jsonValue, _serialized$render2, _serialized$external, _serialized$render3, _serialized$render4, _serialized$remote2, _serialized$readonly, _serialized$hidden;
15318
+ var _serialized$options, _serialized$options2, _serialized$multiline, _serialized$render, _serialized$render2, _serialized$accept, _serialized$dir, _serialized$remote, _serialized$jsonValue, _serialized$render3, _serialized$external, _serialized$render4, _serialized$render5, _serialized$remote2, _serialized$readonly, _serialized$hidden;
15118
15319
  switch (serialized.type) {
15119
15320
  case "string":
15120
15321
  return new StringSchema(_objectSpread2(_objectSpread2({}, serialized.options), {}, {
@@ -15126,7 +15327,7 @@ function deserializeSchemaImpl(serialized) {
15126
15327
  case "boolean":
15127
15328
  return new BooleanSchema(serialized.opt, [], false, false, serialized.description);
15128
15329
  case "number":
15129
- return new NumberSchema(serialized.options, serialized.opt, [], false, false, serialized.description);
15330
+ return new NumberSchema(serialized.options, serialized.opt, [], false, false, serialized.description, null, (_serialized$render = serialized.render) !== null && _serialized$render !== void 0 ? _serialized$render : null);
15130
15331
  case "object":
15131
15332
  return new ObjectSchema(Object.fromEntries(Object.entries(serialized.items).map(function (_ref) {
15132
15333
  var _ref2 = _slicedToArray(_ref, 2),
@@ -15149,7 +15350,7 @@ function deserializeSchemaImpl(serialized) {
15149
15350
  case "array":
15150
15351
  return new ArraySchema(deserializeSchema(serialized.item), serialized.opt, [], false, false, serialized.description,
15151
15352
  // The preview closure cannot survive serialization; the render can.
15152
- null, (_serialized$render = serialized.render) !== null && _serialized$render !== void 0 ? _serialized$render : null);
15353
+ null, (_serialized$render2 = serialized.render) !== null && _serialized$render2 !== void 0 ? _serialized$render2 : null);
15153
15354
  case "discriminated-union":
15154
15355
  return new DiscriminatedUnionSchema(serialized.key,
15155
15356
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -15178,12 +15379,12 @@ function deserializeSchemaImpl(serialized) {
15178
15379
  altSchema: serialized.alt ? deserializeSchema(serialized.alt) : undefined
15179
15380
  } : undefined, false, false, serialized.description, (_serialized$jsonValue = serialized.jsonValues) !== null && _serialized$jsonValue !== void 0 ? _serialized$jsonValue : false,
15180
15381
  // The preview closure cannot survive serialization; the render can.
15181
- null, (_serialized$render2 = serialized.render) !== null && _serialized$render2 !== void 0 ? _serialized$render2 : null, // The external label is static data, so it survives serialization and
15382
+ null, (_serialized$render3 = serialized.render) !== null && _serialized$render3 !== void 0 ? _serialized$render3 : null, // The external label is static data, so it survives serialization and
15182
15383
  // must be carried back: a deserialized schema that forgot it would walk
15183
15384
  // an external record as if its entries were local.
15184
15385
  (_serialized$external = serialized.external) !== null && _serialized$external !== void 0 ? _serialized$external : null);
15185
15386
  case "keyOf":
15186
- return new KeyOfSchema(serialized.schema, serialized.path, serialized.opt, [], false, false, serialized.description, (_serialized$render3 = serialized.render) !== null && _serialized$render3 !== void 0 ? _serialized$render3 : null);
15387
+ return new KeyOfSchema(serialized.schema, serialized.path, serialized.opt, [], false, false, serialized.description, (_serialized$render4 = serialized.render) !== null && _serialized$render4 !== void 0 ? _serialized$render4 : null);
15187
15388
  case "locale":
15188
15389
  {
15189
15390
  return new LocaleSchema(serialized.opt, [], false, false, serialized.description);
@@ -15201,7 +15402,7 @@ function deserializeSchemaImpl(serialized) {
15201
15402
  case "image":
15202
15403
  return new ImageSchema(serialized.options, serialized.opt, serialized.remote, [], {}, false, false, serialized.description);
15203
15404
  case "video":
15204
- return new VideoSchema(serialized.options, serialized.opt, serialized.remote, [], false, false, serialized.description, (_serialized$render4 = serialized.render) !== null && _serialized$render4 !== void 0 ? _serialized$render4 : null, null, serialized.referencedModule ? {
15405
+ return new VideoSchema(serialized.options, serialized.opt, serialized.remote, [], false, false, serialized.description, (_serialized$render5 = serialized.render) !== null && _serialized$render5 !== void 0 ? _serialized$render5 : null, null, serialized.referencedModule ? {
15205
15406
  modulePath: serialized.referencedModule,
15206
15407
  entries: null,
15207
15408
  remote: (_serialized$remote2 = serialized.remote) !== null && _serialized$remote2 !== void 0 ? _serialized$remote2 : false
@@ -15260,11 +15461,12 @@ function deserializeSchemaImpl(serialized) {
15260
15461
  */
15261
15462
  /**
15262
15463
  * A RENDER is how a field is laid out in the editor, and it applies only when
15263
- * you are looking at the field. It is declared by a CONTAINER about its
15264
- * children, never by a child about itself: `s.array(item).render({ as: "inline" })`
15265
- * and `s.record(item).render({ as: "inline" })`. The one other schema that takes
15266
- * a render is `s.keyOf(...)`, where it means something of its own (see
15267
- * `KeyOfSchema.render`).
15464
+ * you are looking at the field. On a list it is declared by the CONTAINER about
15465
+ * its children, never by a child about itself: `s.array(item).render({ as: "inline" })`
15466
+ * and `s.record(item).render({ as: "inline" })`. Two other schemas take a
15467
+ * render, each meaning something of its own: `s.keyOf(...)` (see
15468
+ * `KeyOfSchema.render`) and `s.number()` / `s.int()`, whose `{ as: "slider" }`
15469
+ * is a different input for the same value (see {@link SliderRender}).
15268
15470
  *
15269
15471
  * Why the container: inline is a property of the LIST — "my items are edited in
15270
15472
  * their rows" — and the item schema is the wrong place to say it. An item can be
@@ -15320,6 +15522,33 @@ function deserializeSchemaImpl(serialized) {
15320
15522
  * What `.render(...)` takes, and what the serialized schema carries verbatim.
15321
15523
  */
15322
15524
 
15525
+ /**
15526
+ * `{ as: "slider", min, max }` on `s.int()` or `s.number()`: the value is
15527
+ * edited with a slider from `min` to `max`, next to a box that takes a typed
15528
+ * value.
15529
+ *
15530
+ * `min` and `max` are REQUIRED, because a slider without ends is not a slider.
15531
+ * They are the slider's own and are not validation: a value outside them is
15532
+ * still valid content (if the schema allows it), and the field says it is out
15533
+ * of the slider's reach and offers to bring it back. What the schema accepts is
15534
+ * `.min()`, `.max()` and `.step()` on the schema itself.
15535
+ *
15536
+ * The one rule tying the two together: **the slider may only produce values
15537
+ * the schema accepts.** So its range has to lie inside the schema's, its step
15538
+ * has to be a multiple of the schema's step and its `min` on the schema's grid,
15539
+ * and on `s.int()` all of them have to be whole numbers. A schema that breaks
15540
+ * that throws where it is defined — see `NumberSchema`.
15541
+ *
15542
+ * `step` defaults to the schema's `.step()`, and to 1 when there is none.
15543
+ *
15544
+ * Unlike `inline` this is about the field itself — no list reads it, and
15545
+ * {@link isInlineRender} answers `false` for it.
15546
+ */
15547
+
15548
+ /**
15549
+ * What `s.number().render(...)` and `s.int().render(...)` take.
15550
+ */
15551
+
15323
15552
  /**
15324
15553
  * Does this CONTAINER edit its items inside their list rows, rather than behind
15325
15554
  * clickable preview rows that navigate to them?
@@ -15901,7 +16130,7 @@ function isPageRouter(routerId) {
15901
16130
 
15902
16131
  var corePackageJson = {
15903
16132
  name: "@valbuild/core",
15904
- version: "0.144.0",
16133
+ version: "0.145.0",
15905
16134
  "private": false,
15906
16135
  description: "Val - supercharged hard-coded content",
15907
16136
  repository: {
@@ -16028,6 +16257,11 @@ var Internal = {
16028
16257
  rejectScheme: rejectScheme,
16029
16258
  schemeOf: schemeOf,
16030
16259
  UNSAFE_URL_SCHEMES: UNSAFE_URL_SCHEMES,
16260
+ number: {
16261
+ nearestAllowedNumber: nearestAllowedNumber,
16262
+ isOnStep: isOnStep,
16263
+ stepOrigin: stepOrigin
16264
+ },
16031
16265
  color: {
16032
16266
  parseColor: parseColor,
16033
16267
  formatColor: formatColor,