@valbuild/core 0.143.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.
Files changed (31) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/dist/declarations/src/index.d.ts +16 -4
  3. package/dist/declarations/src/initSchema.d.ts +107 -26
  4. package/dist/declarations/src/initVal.d.ts +2 -2
  5. package/dist/declarations/src/mimeType/font.d.ts +2 -2
  6. package/dist/declarations/src/render.d.ts +39 -6
  7. package/dist/declarations/src/schema/file.d.ts +4 -4
  8. package/dist/declarations/src/schema/filedir.d.ts +83 -0
  9. package/dist/declarations/src/schema/font.d.ts +4 -4
  10. package/dist/declarations/src/schema/fontdir.d.ts +63 -0
  11. package/dist/declarations/src/schema/hasRemoteFileSchema.d.ts +3 -3
  12. package/dist/declarations/src/schema/image.d.ts +4 -4
  13. package/dist/declarations/src/schema/{imageset.d.ts → imagedir.d.ts} +63 -29
  14. package/dist/declarations/src/schema/number.d.ts +45 -5
  15. package/dist/declarations/src/schema/numberRules.d.ts +27 -0
  16. package/dist/declarations/src/schema/record.d.ts +17 -6
  17. package/dist/declarations/src/schema/video.d.ts +7 -7
  18. package/dist/declarations/src/schema/{videoset.d.ts → videodir.d.ts} +55 -27
  19. package/dist/declarations/src/source/media.d.ts +26 -3
  20. package/dist/{index-02a1ba06.esm.js → index-307b907e.esm.js} +601 -122
  21. package/dist/{index-46c72f01.cjs.prod.js → index-93763025.cjs.prod.js} +601 -122
  22. package/dist/{index-aac8c69c.cjs.dev.js → index-ee601322.cjs.dev.js} +601 -122
  23. package/dist/valbuild-core.cjs.dev.js +1 -1
  24. package/dist/valbuild-core.cjs.prod.js +1 -1
  25. package/dist/valbuild-core.esm.js +1 -1
  26. package/package.json +1 -1
  27. package/patch/dist/valbuild-core-patch.cjs.dev.js +1 -1
  28. package/patch/dist/valbuild-core-patch.cjs.prod.js +1 -1
  29. package/patch/dist/valbuild-core-patch.esm.js +2 -2
  30. package/dist/declarations/src/schema/fileset.d.ts +0 -57
  31. package/dist/declarations/src/schema/fontset.d.ts +0 -40
@@ -2846,7 +2846,7 @@ var _excluded = ["poster", "captions"];
2846
2846
  * What a video FIELD authors, on top of the file it names: the description,
2847
2847
  * the crop, the poster, the trim and the caption tracks.
2848
2848
  *
2849
- * This is the whole value of a field picked from an `s.videoset()`
2849
+ * This is the whole value of a field picked from an `s.videodir()`
2850
2850
  * (`s.video(videosetVal)`) — the mime type, size and length live in the set,
2851
2851
  * keyed by `path`, and repeating them here is how two copies of one fact get
2852
2852
  * to disagree. The poster, captions and times stay with the FIELD: one video
@@ -2858,7 +2858,7 @@ var _excluded = ["poster", "captions"];
2858
2858
  /**
2859
2859
  * What one page chooses about a video — as opposed to what is true of the
2860
2860
  * file. A field (`s.video()`) carries these for itself; the entry of a set
2861
- * (`s.videoset()`) carries them as DEFAULTS, which every field picked from the
2861
+ * (`s.videodir()`) carries them as DEFAULTS, which every field picked from the
2862
2862
  * set starts from and may override key by key. See {@link fillFromGallery}.
2863
2863
  */
2864
2864
 
@@ -3000,6 +3000,42 @@ function isMediaSchema(schema) {
3000
3000
  return _typeof(schema) === "object" && schema !== null && "type" in schema && (schema.type === "image" || schema.type === "file" || schema.type === "video");
3001
3001
  }
3002
3002
 
3003
+ /**
3004
+ * The key of a gallery (an `s.imagedir()`, `s.filedir()` or `s.videodir()`)
3005
+ * that a field's `path` names, or `null` when it names none.
3006
+ *
3007
+ * Usually the path IS the key. It is not for an image uploaded THROUGH an
3008
+ * `s.image(remoteGallery)` field in the Studio, which stores the remote ref in
3009
+ * the field and keys the entry by the local path inside it — so a path that is
3010
+ * not a key falls back to that embedded path. Exact first, because a gallery
3011
+ * can hold both shapes for one file, and the field then names the entry that
3012
+ * IS its path.
3013
+ *
3014
+ * One implementation of the question, asked by everything that has to agree on
3015
+ * the answer: reading a field (`galleryEntryOf`), validating it (`ImageSchema`
3016
+ * and `FileSchema` ask whether the gallery has it), the Studio's reference
3017
+ * scans and renames, and `val validate --fix` when it renames a key and has to
3018
+ * find the fields that hold it.
3019
+ *
3020
+ * The embedded path is tried with its leading slash (how a key is written) and
3021
+ * without (how `splitRemoteRef` returns it).
3022
+ */
3023
+ function galleryKeyOf(path, isKey) {
3024
+ if (isKey(path)) {
3025
+ return path;
3026
+ }
3027
+ var split = splitRemoteRef(path);
3028
+ if (split.status === "success") {
3029
+ for (var _i = 0, _arr = ["/".concat(split.filePath), split.filePath]; _i < _arr.length; _i++) {
3030
+ var embedded = _arr[_i];
3031
+ if (isKey(embedded)) {
3032
+ return embedded;
3033
+ }
3034
+ }
3035
+ }
3036
+ return null;
3037
+ }
3038
+
3003
3039
  /**
3004
3040
  * What a gallery entry holds as a DEFAULT for the fields picked from it, in
3005
3041
  * the groups a field overrides together.
@@ -3019,7 +3055,9 @@ var GALLERY_FILE_FACTS = ["width", "height", "mimeType", "duration"];
3019
3055
  * gallery-backed or the gallery has no such entry.
3020
3056
  *
3021
3057
  * The double lookup is load-bearing: a remote gallery keys its entries by the
3022
- * remote URL while the file itself stays on disk under its local path.
3058
+ * remote URL while the file itself stays on disk under its local path, and an
3059
+ * upload through the field does it the other way round (see
3060
+ * {@link galleryKeyOf}).
3023
3061
  */
3024
3062
  function galleryEntryOf(src, schema, getModuleSource) {
3025
3063
  if (!isMediaSchema(schema) || !schema.referencedModule) {
@@ -3029,13 +3067,9 @@ function galleryEntryOf(src, schema, getModuleSource) {
3029
3067
  if (!isPlainObject(moduleSource)) {
3030
3068
  return null;
3031
3069
  }
3032
- var key = src.path in moduleSource ? src.path : null;
3033
- if (key === null) {
3034
- var splitRemoteRefRes = splitRemoteRef(src.path);
3035
- if (splitRemoteRefRes.status === "success" && splitRemoteRefRes.filePath in moduleSource) {
3036
- key = splitRemoteRefRes.filePath;
3037
- }
3038
- }
3070
+ var key = galleryKeyOf(src.path, function (candidate) {
3071
+ return candidate in moduleSource;
3072
+ });
3039
3073
  if (key === null) {
3040
3074
  return null;
3041
3075
  }
@@ -3896,10 +3930,10 @@ function mimeTypeMatchesAccept(mimeType, accept) {
3896
3930
  * asks the BYTES ({@link sniffFontMimeType}) rather than trusting the picker.
3897
3931
  */
3898
3932
 
3899
- /** The formats `s.fontset()` accepts unless told otherwise, best first. */
3933
+ /** The formats `s.fontdir()` accepts unless told otherwise, best first. */
3900
3934
  var FONT_MIME_TYPES = ["font/woff2", "font/woff", "font/ttf", "font/otf"];
3901
3935
 
3902
- /** `s.fontset()`'s `accept` when none is given. */
3936
+ /** `s.fontdir()`'s `accept` when none is given. */
3903
3937
  var DEFAULT_FONT_ACCEPT = FONT_MIME_TYPES.join(",");
3904
3938
 
3905
3939
  /**
@@ -4138,24 +4172,31 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
4138
4172
  value: src
4139
4173
  }]));
4140
4174
  }
4175
+ // A field picked from a gallery holds the gallery's KEY, and whether that
4176
+ // key is a local path or a remote ref is the gallery's to decide — and its
4177
+ // to fix: uploading an entry renames its key, and the fields that hold it
4178
+ // with it. So such a field only asks whether the gallery has it, below.
4179
+ // Asking here as well reported every image picked from a `.remote()`
4180
+ // gallery as one to download, because the field itself is never remote.
4181
+ var galleryEntries = this.galleryEntries();
4141
4182
  // Remote-ness is a property of the path, not of a marker on the value:
4142
4183
  // anything outside /public is remote.
4143
4184
  var isRemotePath = isRemoteMediaPath(src.path);
4144
- if (this.isRemote && !isRemotePath) {
4185
+ if (!galleryEntries && this.isRemote && !isRemotePath) {
4145
4186
  return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
4146
4187
  message: "Expected a remote image, but got a local image.",
4147
4188
  value: src,
4148
4189
  fixes: ["image:upload-remote"]
4149
4190
  }]));
4150
4191
  }
4151
- if (this.isRemote && isRemotePath) {
4192
+ if (!galleryEntries && this.isRemote && isRemotePath) {
4152
4193
  return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
4153
4194
  message: "Remote image was not checked.",
4154
4195
  value: src,
4155
4196
  fixes: ["image:check-remote"]
4156
4197
  }]));
4157
4198
  }
4158
- if (!this.isRemote && isRemotePath) {
4199
+ if (!galleryEntries && !this.isRemote && isRemotePath) {
4159
4200
  return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
4160
4201
  message: "Expected local image, but found remote.",
4161
4202
  value: src,
@@ -4170,7 +4211,6 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
4170
4211
  }]));
4171
4212
  }
4172
4213
  }
4173
- var galleryEntries = this.galleryEntries();
4174
4214
  if (galleryEntries) {
4175
4215
  // The dimensions and mime type of a gallery image are stored once, in the
4176
4216
  // gallery. Repeating them on the field is how the two get to disagree.
@@ -4183,7 +4223,11 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
4183
4223
  value: src
4184
4224
  }]));
4185
4225
  }
4186
- if (!(src.path in galleryEntries)) {
4226
+ // The same match reading the field makes (`fillFromGallery`): the key,
4227
+ // or the local path inside a ref an upload through the field stored.
4228
+ if (galleryKeyOf(src.path, function (key) {
4229
+ return key in galleryEntries;
4230
+ }) === null) {
4187
4231
  return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
4188
4232
  message: "The gallery does not have an image at '".concat(src.path, "'."),
4189
4233
  value: src
@@ -5800,7 +5844,7 @@ function missingDeclaredKeys(declared, present) {
5800
5844
  /**
5801
5845
  * The checks of what one page chose about a video — its times, focal point,
5802
5846
  * poster and captions — shared by the two places those choices are made: a
5803
- * field (`s.video()`) and the entry of a set (`s.videoset()`), which holds the
5847
+ * field (`s.video()`) and the entry of a set (`s.videodir()`), which holds the
5804
5848
  * same choices as the defaults every field picked from it starts from.
5805
5849
  */
5806
5850
 
@@ -5978,7 +6022,25 @@ function isObject(value) {
5978
6022
  return _typeof(value) === "object" && value !== null && !Array.isArray(value);
5979
6023
  }
5980
6024
 
5981
- /** What a media collection (`s.imageset`, `s.fileset`, `s.videoset`) holds. */
6025
+ /** What a media collection (`s.imagedir`, `s.filedir`, `s.videodir`) holds. */
6026
+
6027
+ /**
6028
+ * Where a media collection keeps its files: the first argument of
6029
+ * `s.imagedir()`, `s.filedir()`, `s.fontdir()` and `s.videodir()`.
6030
+ *
6031
+ * Required, and deliberately so: it decides where every uploaded file in the
6032
+ * collection lands. It used to default to "/public/val", which meant a
6033
+ * collection that had simply not said where it wanted its files silently
6034
+ * shared a directory with every other one. It is the first argument rather
6035
+ * than an option because it is the one thing every collection has to say.
6036
+ */
6037
+
6038
+ /** The factory that builds a media collection of each type, for messages. */
6039
+ var mediaDirFactory = {
6040
+ images: "imagedir",
6041
+ files: "filedir",
6042
+ videos: "videodir"
6043
+ };
5982
6044
 
5983
6045
  /**
5984
6046
  * The fix code a media collection of `type` reports for `check`.
@@ -6013,7 +6075,7 @@ function assertRenderable(router, mediaOptions, render) {
6013
6075
  throw new Error("`.render(...)` is not supported on `s.router(...)`: a router's entries are pages, which have their own UI.");
6014
6076
  }
6015
6077
  if (mediaOptions) {
6016
- throw new Error("`.render(...)` is not supported on `s.".concat(mediaOptions.type === "images" ? "imageset" : "fileset", "(...)`: media galleries have their own UI."));
6078
+ throw new Error("`.render(...)` is not supported on `s.".concat(mediaDirFactory[mediaOptions.type], "(...)`: media galleries have their own UI."));
6017
6079
  }
6018
6080
  }
6019
6081
 
@@ -6730,7 +6792,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
6730
6792
  * Allow the files in this gallery to be stored on Val's remote content host
6731
6793
  * instead of in your repository.
6732
6794
  *
6733
- * For `s.imageset()` and `s.fileset()`, which are records of media. Remote is off
6795
+ * For `s.imagedir()` and `s.filedir()`, which are records of media. Remote is off
6734
6796
  * until this is called.
6735
6797
  *
6736
6798
  * Each entry is then keyed by its URL on the content host rather than by a
@@ -6739,7 +6801,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
6739
6801
  * upload it and rewrite the key.
6740
6802
  *
6741
6803
  * @example
6742
- * const schema = s.imageset({ dir: "/public/val/images" }).remote();
6804
+ * const schema = s.imagedir("/public/val/images").remote();
6743
6805
  * export default c.define("/content/images.val.ts", schema, {
6744
6806
  * "https://remote.val.build/file/p/my-project/b/01/v/1.0.0/h/8f2a1c/f/3b9d70/p/public/val/images/hero.webp":
6745
6807
  * {
@@ -6765,7 +6827,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
6765
6827
  * which lets the runtime, the Studio and validation work one entry at a time
6766
6828
  * so a record/router can scale to many thousands of entries.
6767
6829
  *
6768
- * Not supported on image/file galleries (`s.imageset()` / `s.fileset()`).
6830
+ * Not supported on image/file galleries (`s.imagedir()` / `s.filedir()`).
6769
6831
  *
6770
6832
  * Only supported on a module's ROOT record/router — a `.jsonValues()` record
6771
6833
  * nested inside an object/array/record is rejected at startup with a module
@@ -6790,7 +6852,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
6790
6852
  key: "jsonValues",
6791
6853
  value: function jsonValues() {
6792
6854
  if (this.mediaOptions) {
6793
- throw new Error(".jsonValues() cannot be used with image/file galleries (s.imageset()/s.fileset())");
6855
+ throw new Error(".jsonValues() cannot be used with image/file galleries (s.imagedir()/s.filedir())");
6794
6856
  }
6795
6857
  if (this.customValidateFunctions.length > 0) {
6796
6858
  // `.jsonValues()` changes the source shape to JsonSource entries, so a
@@ -6819,7 +6881,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
6819
6881
  * bucket — instead of in the module.
6820
6882
  *
6821
6883
  * Available on every record-derived schema, which is `s.record()`,
6822
- * `s.router()`, `s.imageset()` and `s.fileset()` alike: a router is a
6884
+ * `s.router()`, `s.imagedir()` and `s.filedir()` alike: a router is a
6823
6885
  * `RecordSchema` with a `ValRouter`, a gallery one with media options, so all
6824
6886
  * four get external storage from this one method.
6825
6887
  *
@@ -7149,7 +7211,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
7149
7211
  * draws each entry's own editor in place, labelled by its key, instead of a
7150
7212
  * preview row that navigates to it. It reaches the direct entries only.
7151
7213
  *
7152
- * Not for `s.router(...)`, `s.imageset(...)` or `s.fileset(...)`: pages and
7214
+ * Not for `s.router(...)`, `s.imagedir(...)` or `s.filedir(...)`: pages and
7153
7215
  * media have UIs of their own, so this throws on them.
7154
7216
  *
7155
7217
  * Static configuration, not a callback — see `render.ts`.
@@ -10125,6 +10187,87 @@ function patchPathToModulePath(patchPath) {
10125
10187
  }).join(".");
10126
10188
  }
10127
10189
 
10190
+ /**
10191
+ * What a number schema accepts, in one place, so the validator and the
10192
+ * Studio's "Round to …" / "Set to …" buttons cannot disagree about it.
10193
+ *
10194
+ * A button that offers a value the validator then rejects is worse than no
10195
+ * button, which is exactly what two copies of this arithmetic would drift into.
10196
+ */
10197
+
10198
+ /**
10199
+ * Division of decimals is not exact (`0.3 / 0.1` is `2.9999999999999996`), so a
10200
+ * value counts as on the grid when it is within this many steps of it.
10201
+ */
10202
+ var GRID_EPSILON = 1e-9;
10203
+
10204
+ /** Where the step grid starts: the schema's `min`, or 0 when it has none. */
10205
+ function stepOrigin(rules) {
10206
+ var _rules$min;
10207
+ return (_rules$min = rules.min) !== null && _rules$min !== void 0 ? _rules$min : 0;
10208
+ }
10209
+
10210
+ /** Is `value` one of `origin + n * step`? */
10211
+ function isOnStep(value, origin, step) {
10212
+ var steps = (value - origin) / step;
10213
+ return Math.abs(steps - Math.round(steps)) < GRID_EPSILON;
10214
+ }
10215
+
10216
+ /**
10217
+ * The allowed value closest to `value`: inside `min`/`max`, on the step grid,
10218
+ * and whole when the schema is an int.
10219
+ *
10220
+ * Returns `null` when the rules leave nothing to snap to — a `min` above
10221
+ * `max`, or a range too narrow to hold a single step or a single whole number.
10222
+ */
10223
+ function nearestAllowedNumber(value, rules) {
10224
+ var _rules$step;
10225
+ var step = (_rules$step = rules.step) !== null && _rules$step !== void 0 ? _rules$step : rules.integer ? 1 : undefined;
10226
+ var lo = rules.min;
10227
+ var hi = rules.max;
10228
+ if (lo !== undefined && hi !== undefined && lo > hi) {
10229
+ return null;
10230
+ }
10231
+ var clamp = function clamp(n) {
10232
+ return Math.min(hi !== null && hi !== void 0 ? hi : Infinity, Math.max(lo !== null && lo !== void 0 ? lo : -Infinity, n));
10233
+ };
10234
+ if (step === undefined) {
10235
+ return clamp(value);
10236
+ }
10237
+ var origin = rules.integer && rules.step === undefined ? 0 : stepOrigin(rules);
10238
+ var toGrid = function toGrid(n) {
10239
+ return roundToDecimals(origin + n * step);
10240
+ };
10241
+ var n = Math.round((clamp(value) - origin) / step);
10242
+ // Rounding can step outside the range by one; walk back in.
10243
+ if (lo !== undefined && toGrid(n) < lo) n += 1;
10244
+ if (hi !== undefined && toGrid(n) > hi) n -= 1;
10245
+ var snapped = toGrid(n);
10246
+ if (lo !== undefined && snapped < lo || hi !== undefined && snapped > hi) {
10247
+ return null;
10248
+ }
10249
+ if (rules.integer && !Number.isInteger(snapped)) {
10250
+ return null;
10251
+ }
10252
+ return snapped;
10253
+ }
10254
+
10255
+ /**
10256
+ * `0.1 + 0.2` is `0.30000000000000004`. A value offered to an editor should
10257
+ * read `0.3`, so grid values are rounded to 12 significant decimals — far below
10258
+ * any step anyone writes, far above floating point noise.
10259
+ */
10260
+ function roundToDecimals(n) {
10261
+ return Number.parseFloat(n.toFixed(12));
10262
+ }
10263
+
10264
+ /**
10265
+ * What the value has to be. `integer` is what makes a number schema an
10266
+ * `s.int()`: the source is a number either way, so an int is a number schema
10267
+ * with one more rule rather than a schema type of its own (which every walk
10268
+ * over a schema would have had to learn).
10269
+ */
10270
+
10128
10271
  var NumberSchema = /*#__PURE__*/function (_Schema) {
10129
10272
  function NumberSchema(options) {
10130
10273
  var _this;
@@ -10134,6 +10277,7 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10134
10277
  var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
10135
10278
  var description = arguments.length > 5 ? arguments[5] : undefined;
10136
10279
  var previewInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
10280
+ var renderInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
10137
10281
  _classCallCheck(this, NumberSchema);
10138
10282
  _this = _callSuper(this, NumberSchema);
10139
10283
  _this.options = options;
@@ -10143,6 +10287,8 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10143
10287
  _this.isHidden = isHidden;
10144
10288
  _this.description = description;
10145
10289
  _this.previewInput = previewInput;
10290
+ _this.renderInput = renderInput;
10291
+ assertNumberSchemaIsConsistent(_this.options, _this.renderInput);
10146
10292
  return _this;
10147
10293
  }
10148
10294
 
@@ -10167,7 +10313,7 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10167
10313
  return _createClass(NumberSchema, [{
10168
10314
  key: "describe",
10169
10315
  value: function describe(description) {
10170
- return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput);
10316
+ return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput, this.renderInput);
10171
10317
  }
10172
10318
 
10173
10319
  /**
@@ -10193,12 +10339,12 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10193
10339
  }, {
10194
10340
  key: "validate",
10195
10341
  value: function validate(validationFunction) {
10196
- return new NumberSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.previewInput);
10342
+ return new NumberSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.previewInput, this.renderInput);
10197
10343
  }
10198
10344
  }, {
10199
10345
  key: "executeValidate",
10200
10346
  value: function executeValidate(path, src) {
10201
- var _this$options, _this$options2;
10347
+ var _this$options;
10202
10348
  var customValidationErrors = this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
10203
10349
  path: path
10204
10350
  });
@@ -10211,20 +10357,35 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10211
10357
  value: src
10212
10358
  }]));
10213
10359
  }
10214
- if ((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.max && src > this.options.max) {
10215
- return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
10216
- message: "Expected 'number' less than ".concat(this.options.max),
10360
+ var errors = _toConsumableArray(customValidationErrors);
10361
+ var options = (_this$options = this.options) !== null && _this$options !== void 0 ? _this$options : {};
10362
+ // `!== undefined`, not truthiness: a bound of 0 is a bound. `.max(0)` and
10363
+ // `.min(0)` used to be ignored, which a slider from 0 makes common.
10364
+ if (options.max !== undefined && src > options.max) {
10365
+ errors.push({
10366
+ message: "Must be at most ".concat(options.max),
10217
10367
  value: src
10218
- }]));
10368
+ });
10219
10369
  }
10220
- if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.min && src < this.options.min) {
10221
- return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
10222
- message: "Expected 'number' greater than ".concat(this.options.min),
10370
+ if (options.min !== undefined && src < options.min) {
10371
+ errors.push({
10372
+ message: "Must be at least ".concat(options.min),
10223
10373
  value: src
10224
- }]));
10374
+ });
10225
10375
  }
10226
- if (customValidationErrors.length > 0) {
10227
- return _defineProperty({}, path, customValidationErrors);
10376
+ if (options.integer && !Number.isInteger(src)) {
10377
+ errors.push({
10378
+ message: "Must be a whole number",
10379
+ value: src
10380
+ });
10381
+ } else if (options.step !== undefined && !isOnStep(src, stepOrigin(options), options.step)) {
10382
+ errors.push({
10383
+ message: "Must be a multiple of ".concat(options.step, ", counted from ").concat(stepOrigin(options)),
10384
+ value: src
10385
+ });
10386
+ }
10387
+ if (errors.length > 0) {
10388
+ return _defineProperty({}, path, errors);
10228
10389
  }
10229
10390
  return false;
10230
10391
  }
@@ -10263,19 +10424,19 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10263
10424
  }, {
10264
10425
  key: "nullable",
10265
10426
  value: function nullable() {
10266
- return new NumberSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
10427
+ return new NumberSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput, this.renderInput);
10267
10428
  }
10268
10429
  }, {
10269
10430
  key: "readonly",
10270
10431
  value: function readonly() {
10271
10432
  var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
10272
- return new NumberSchema(this.options, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.previewInput);
10433
+ return new NumberSchema(this.options, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.previewInput, this.renderInput);
10273
10434
  }
10274
10435
  }, {
10275
10436
  key: "hidden",
10276
10437
  value: function hidden() {
10277
10438
  var isHidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
10278
- return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.previewInput);
10439
+ return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.previewInput, this.renderInput);
10279
10440
  }
10280
10441
 
10281
10442
  /**
@@ -10290,7 +10451,7 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10290
10451
  value: function max(_max) {
10291
10452
  return new NumberSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
10292
10453
  max: _max
10293
- }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
10454
+ }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput, this.renderInput);
10294
10455
  }
10295
10456
 
10296
10457
  /**
@@ -10305,7 +10466,50 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10305
10466
  value: function min(_min) {
10306
10467
  return new NumberSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
10307
10468
  min: _min
10308
- }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
10469
+ }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput, this.renderInput);
10470
+ }
10471
+
10472
+ /**
10473
+ * Validate that the number is on a grid of `step`: one of `min`, `min + step`,
10474
+ * `min + 2 * step` and so on, counted from 0 when there is no `.min()`.
10475
+ *
10476
+ * A slider rendered on this field moves in the same steps unless its render
10477
+ * says otherwise (and then its step has to be a multiple of this one).
10478
+ *
10479
+ * @example
10480
+ * const schema = s.int().min(0).max(100).step(5);
10481
+ * export default c.define("/example.val.ts", schema, 40);
10482
+ */
10483
+ }, {
10484
+ key: "step",
10485
+ value: function step(_step) {
10486
+ return new NumberSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
10487
+ step: _step
10488
+ }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput, this.renderInput);
10489
+ }
10490
+
10491
+ /**
10492
+ * Choose how this field is edited. `{ as: "slider", min, max }` edits it with
10493
+ * a slider from `min` to `max`, next to a box for typing an exact value.
10494
+ *
10495
+ * `min` and `max` are required — a slider without ends is not a slider — and
10496
+ * they are the slider's, not validation: use `.min()` / `.max()` for what the
10497
+ * value may be. The slider can only produce values this schema accepts, so
10498
+ * its range must lie inside `.min()`/`.max()`, its `step` (which defaults to
10499
+ * `.step()`, then 1) must be a multiple of `.step()`, and on `s.int()` all of
10500
+ * them must be whole numbers. A schema that breaks this throws here.
10501
+ *
10502
+ * Static configuration, not a callback — see `render.ts`. A second
10503
+ * `.render(...)` replaces the first.
10504
+ *
10505
+ * @example
10506
+ * const schema = s.int().render({ as: "slider", min: 0, max: 100, step: 5 });
10507
+ * export default c.define("/example.val.ts", schema, 40);
10508
+ */
10509
+ }, {
10510
+ key: "render",
10511
+ value: function render(input) {
10512
+ return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput, input);
10309
10513
  }
10310
10514
  }, {
10311
10515
  key: "executeCustomValidateAt",
@@ -10329,7 +10533,7 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10329
10533
  }, {
10330
10534
  key: "preview",
10331
10535
  value: function preview(select) {
10332
- return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, select);
10536
+ return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, select, this.renderInput);
10333
10537
  }
10334
10538
  }, {
10335
10539
  key: "executePreviewItem",
@@ -10349,11 +10553,12 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10349
10553
  }, {
10350
10554
  key: "executeSerialize",
10351
10555
  value: function executeSerialize() {
10352
- var _this$customValidateF;
10556
+ var _this$renderInput, _this$customValidateF;
10353
10557
  return {
10354
10558
  type: "number",
10355
10559
  preview: this.previewInput ? true : undefined,
10356
10560
  options: this.options,
10561
+ render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
10357
10562
  opt: this.opt,
10358
10563
  customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
10359
10564
  readonly: this.isReadonly,
@@ -10366,6 +10571,63 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
10366
10571
  var number = function number(options) {
10367
10572
  return new NumberSchema(options);
10368
10573
  };
10574
+ var _int = function _int() {
10575
+ return new NumberSchema({
10576
+ integer: true
10577
+ });
10578
+ };
10579
+ function assertNumberSchemaIsConsistent(options, render) {
10580
+ var opts = options !== null && options !== void 0 ? options : {};
10581
+ var kind = opts.integer ? "s.int()" : "s.number()";
10582
+ if (opts.step !== undefined) {
10583
+ if (!(opts.step > 0) || !Number.isFinite(opts.step)) {
10584
+ throw new Error("".concat(kind, ".step(").concat(opts.step, "): the step must be above 0"));
10585
+ }
10586
+ if (opts.integer && !Number.isInteger(opts.step)) {
10587
+ throw new Error("".concat(kind, ".step(").concat(opts.step, "): the step of an int must be a whole number"));
10588
+ }
10589
+ }
10590
+ if (render === null) {
10591
+ return;
10592
+ }
10593
+ var where = "".concat(kind, ".render({ as: \"slider\", min: ").concat(render.min, ", max: ").concat(render.max, " })");
10594
+ if (!Number.isFinite(render.min) || !Number.isFinite(render.max)) {
10595
+ throw new Error("".concat(where, ": the slider needs a min and a max"));
10596
+ }
10597
+ if (!(render.min < render.max)) {
10598
+ throw new Error("".concat(where, ": the slider's min must be below its max"));
10599
+ }
10600
+ if (opts.min !== undefined && render.min < opts.min) {
10601
+ throw new Error("".concat(where, ": the slider's min ").concat(render.min, " is below the schema's min ").concat(opts.min));
10602
+ }
10603
+ if (opts.max !== undefined && render.max > opts.max) {
10604
+ throw new Error("".concat(where, ": the slider's max ").concat(render.max, " is above the schema's max ").concat(opts.max));
10605
+ }
10606
+ if (render.step !== undefined && !(render.step > 0)) {
10607
+ throw new Error("".concat(where, ": the slider's step must be above 0"));
10608
+ }
10609
+ if (opts.integer) {
10610
+ var sliderNumbers = [["min", render.min], ["max", render.max], ["step", render.step]];
10611
+ for (var _i = 0, _sliderNumbers = sliderNumbers; _i < _sliderNumbers.length; _i++) {
10612
+ var _sliderNumbers$_i = _slicedToArray(_sliderNumbers[_i], 2),
10613
+ name = _sliderNumbers$_i[0],
10614
+ value = _sliderNumbers$_i[1];
10615
+ if (value !== undefined && !Number.isInteger(value)) {
10616
+ throw new Error("".concat(where, ": the slider's ").concat(name, " ").concat(value, " must be a whole number on an int"));
10617
+ }
10618
+ }
10619
+ }
10620
+ if (opts.step !== undefined) {
10621
+ var _render$step;
10622
+ var sliderStep = (_render$step = render.step) !== null && _render$step !== void 0 ? _render$step : opts.step;
10623
+ if (!isOnStep(sliderStep, 0, opts.step)) {
10624
+ throw new Error("".concat(where, ": the slider's step ").concat(sliderStep, " must be a multiple of the schema's step ").concat(opts.step));
10625
+ }
10626
+ if (!isOnStep(render.min, stepOrigin(opts), opts.step)) {
10627
+ 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), ")"));
10628
+ }
10629
+ }
10630
+ }
10369
10631
 
10370
10632
  /**
10371
10633
  * @deprecated Use {@link SerializedDiscriminatedUnionSchema} or
@@ -10922,31 +11184,37 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
10922
11184
  value: src
10923
11185
  }]));
10924
11186
  }
11187
+ // A field picked from a gallery holds the gallery's KEY, and whether that
11188
+ // key is a local path or a remote ref is the gallery's to decide — and its
11189
+ // to fix: uploading an entry renames its key, and the fields that hold it
11190
+ // with it. So such a field only asks whether the gallery has it, below.
11191
+ // Asking here as well reported every file picked from a `.remote()`
11192
+ // gallery as one to download, because the field itself is never remote.
11193
+ var galleryEntries = this.galleryEntries();
10925
11194
  // Remote-ness is a property of the path, not of a marker on the value:
10926
11195
  // anything outside /public is remote.
10927
11196
  var isRemotePath = isRemoteMediaPath(src.path);
10928
- if (this.isRemote && !isRemotePath) {
11197
+ if (!galleryEntries && this.isRemote && !isRemotePath) {
10929
11198
  return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
10930
11199
  message: "Expected a remote file, but got a local file.",
10931
11200
  value: src,
10932
11201
  fixes: ["file:upload-remote"]
10933
11202
  }]));
10934
11203
  }
10935
- if (this.isRemote && isRemotePath) {
11204
+ if (!galleryEntries && this.isRemote && isRemotePath) {
10936
11205
  return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
10937
11206
  message: "Remote file was not checked.",
10938
11207
  value: src,
10939
11208
  fixes: ["file:check-remote"]
10940
11209
  }]));
10941
11210
  }
10942
- if (!this.isRemote && isRemotePath) {
11211
+ if (!galleryEntries && !this.isRemote && isRemotePath) {
10943
11212
  return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
10944
11213
  message: "Expected local file, but found remote.",
10945
11214
  value: src,
10946
11215
  fixes: ["file:download-remote"]
10947
11216
  }]));
10948
11217
  }
10949
- var galleryEntries = this.galleryEntries();
10950
11218
  if (galleryEntries) {
10951
11219
  if (src.mimeType !== undefined) {
10952
11220
  return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
@@ -10954,7 +11222,11 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
10954
11222
  value: src
10955
11223
  }]));
10956
11224
  }
10957
- if (!(src.path in galleryEntries)) {
11225
+ // The same match reading the field makes (`fillFromGallery`): the key,
11226
+ // or the local path inside a ref an upload through the field stored.
11227
+ if (galleryKeyOf(src.path, function (key) {
11228
+ return key in galleryEntries;
11229
+ }) === null) {
10958
11230
  return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
10959
11231
  message: "The gallery does not have a file at '".concat(src.path, "'."),
10960
11232
  value: src
@@ -11190,7 +11462,7 @@ function fileOf(remote, options) {
11190
11462
  }
11191
11463
 
11192
11464
  /**
11193
- * A font picked from an `s.fontset()`.
11465
+ * A font picked from an `s.fontdir()`.
11194
11466
  *
11195
11467
  * The same field `s.file(fontsVal)` is — it stores `{ path }` and serializes
11196
11468
  * identically — with one thing more: it refuses a set that is not a font set,
@@ -11217,7 +11489,7 @@ function assertFontset(fontsetModule) {
11217
11489
  return isFontMimeType(type.trim());
11218
11490
  });
11219
11491
  if (!isFontset) {
11220
- throw new Error("s.font(".concat(modulePath !== null && modulePath !== void 0 ? modulePath : "?", "): the module must be an s.fontset(). Use s.file() to pick from a set of other files."));
11492
+ throw new Error("s.font(".concat(modulePath !== null && modulePath !== void 0 ? modulePath : "?", "): the module must be an s.fontdir(). Use s.file() to pick from a set of other files."));
11221
11493
  }
11222
11494
  }
11223
11495
 
@@ -11756,7 +12028,7 @@ function stripQuery(path) {
11756
12028
  }
11757
12029
 
11758
12030
  /**
11759
- * A video picked from a set (`s.videoset()`). What is true of the file —
12031
+ * A video picked from a set (`s.videodir()`). What is true of the file —
11760
12032
  * its type, size and length — lives in the set; the field carries what one
11761
12033
  * page chose about it.
11762
12034
  */
@@ -11791,7 +12063,7 @@ function videoOf(options, galleryOptions) {
11791
12063
  var setSchema = (_options$GetSchema = options[GetSchema]) === null || _options$GetSchema === void 0 ? void 0 : _options$GetSchema["executeSerialize"]();
11792
12064
  if ((setSchema === null || setSchema === void 0 ? void 0 : setSchema.type) !== "record" || setSchema.mediaType !== "videos") {
11793
12065
  var _setSchema$mediaType, _setSchema$type;
11794
- throw new Error("s.video(".concat(modulePath, "): the module must be an s.videoset(). Got ").concat((setSchema === null || setSchema === void 0 ? void 0 : setSchema.type) === "record" ? "a record of ".concat((_setSchema$mediaType = setSchema.mediaType) !== null && _setSchema$mediaType !== void 0 ? _setSchema$mediaType : "values") : (_setSchema$type = setSchema === null || setSchema === void 0 ? void 0 : setSchema.type) !== null && _setSchema$type !== void 0 ? _setSchema$type : "no schema", "."));
12066
+ throw new Error("s.video(".concat(modulePath, "): the module must be an s.videodir(). Got ").concat((setSchema === null || setSchema === void 0 ? void 0 : setSchema.type) === "record" ? "a record of ".concat((_setSchema$mediaType = setSchema.mediaType) !== null && _setSchema$mediaType !== void 0 ? _setSchema$mediaType : "values") : (_setSchema$type = setSchema === null || setSchema === void 0 ? void 0 : setSchema.type) !== null && _setSchema$type !== void 0 ? _setSchema$type : "no schema", "."));
11795
12067
  }
11796
12068
  return new VideoSchema((galleryOptions === null || galleryOptions === void 0 ? void 0 : galleryOptions.stream) !== undefined ? {
11797
12069
  stream: galleryOptions.stream
@@ -11806,23 +12078,37 @@ function isVideosetModule(value) {
11806
12078
  }
11807
12079
 
11808
12080
  /**
11809
- * Options for s.fileset()
12081
+ * Options for `s.filedir(dir, options)`: everything but the directory, which
12082
+ * is the first argument.
12083
+ */
12084
+
12085
+ /**
12086
+ * Options for the deprecated `s.fileset(options)`, which took the directory
12087
+ * as `dir`.
12088
+ *
12089
+ * @deprecated Use `s.filedir(dir, options)` and `FiledirOptions`.
11810
12090
  */
11811
12091
 
11812
12092
  /**
11813
12093
  * Metadata for a file entry in the files record
11814
12094
  */
11815
12095
 
12096
+ /** @deprecated Use `FiledirEntryMetadata`. */
12097
+
12098
+ /** @deprecated Use `SerializedFiledirSchema`. */
12099
+
11816
12100
  /**
11817
- * Define a collection of files.
12101
+ * Define a directory of files: a whole module that holds many files, keyed by
12102
+ * their file path, that fields pick from with `s.file(filesVal)`.
11818
12103
  *
11819
- * Remote is off by default: call `.remote()` on the result to allow remote files.
12104
+ * The directory is the first argument and is required — it decides where
12105
+ * uploads land. Remote is off by default: call `.remote()` on the result to
12106
+ * allow remote files.
11820
12107
  *
11821
12108
  * @example
11822
12109
  * ```typescript
11823
- * const schema = s.fileset({
12110
+ * const schema = s.filedir("/public/val/documents", {
11824
12111
  * accept: "application/pdf",
11825
- * dir: "/public/val/documents",
11826
12112
  * });
11827
12113
  * export default c.define("/content/documents.val.ts", schema, {
11828
12114
  * "/public/val/documents/report.pdf": {
@@ -11831,8 +12117,7 @@ function isVideosetModule(value) {
11831
12117
  * });
11832
12118
  * ```
11833
12119
  */
11834
- var fileset = function fileset(options) {
11835
- var dir = options.dir;
12120
+ var filedir = function filedir(dir, options) {
11836
12121
  var itemSchema = new ObjectSchema({
11837
12122
  mimeType: new StringSchema({}, false)
11838
12123
  }, false);
@@ -11845,23 +12130,49 @@ var fileset = function fileset(options) {
11845
12130
  };
11846
12131
 
11847
12132
  /**
11848
- * Options for s.fontset()
12133
+ * Define a collection of files.
12134
+ *
12135
+ * @deprecated Use `s.filedir(dir, options)`: the directory moved out of the
12136
+ * options and into the first argument, and nothing else changed.
12137
+ *
12138
+ * @example
12139
+ * ```typescript
12140
+ * // was: s.fileset({ dir: "/public/val/documents", accept: "application/pdf" })
12141
+ * const schema = s.filedir("/public/val/documents", {
12142
+ * accept: "application/pdf",
12143
+ * });
12144
+ * ```
12145
+ */
12146
+ var fileset = function fileset(options) {
12147
+ return filedir(options.dir, options);
12148
+ };
12149
+
12150
+ /**
12151
+ * Options for `s.fontdir(dir, options)`: everything but the directory, which
12152
+ * is the first argument.
11849
12153
  */
11850
12154
 
11851
12155
  /**
11852
- * Define a collection of fonts.
12156
+ * Options for the deprecated `s.fontset(options)`, which took the directory
12157
+ * as `dir`.
12158
+ *
12159
+ * @deprecated Use `s.fontdir(dir, options)` and `FontdirOptions`.
12160
+ */
12161
+
12162
+ /**
12163
+ * Define a directory of fonts.
11853
12164
  *
11854
- * A fontset IS a fileset — the same source, the same `s.file(fontsVal)` field
12165
+ * A fontdir IS a filedir — the same source, the same `s.font(fontsVal)` field
11855
12166
  * to pick from it, the same checks and fixes — with `accept` defaulting to the
11856
12167
  * web font formats. What a font gets that any other file does not is decided
11857
- * by its mime type rather than by the set: the Studio previews any file it
11858
- * knows is a font, wherever it is shown.
12168
+ * by its mime type rather than by the directory: the Studio previews any file
12169
+ * it knows is a font, wherever it is shown.
11859
12170
  *
11860
12171
  * Remote is off by default: call `.remote()` on the result to allow remote files.
11861
12172
  *
11862
12173
  * @example
11863
12174
  * ```typescript
11864
- * const schema = s.fontset({ dir: "/public/val/fonts" });
12175
+ * const schema = s.fontdir("/public/val/fonts");
11865
12176
  * export default c.define("/content/fonts.val.ts", schema, {
11866
12177
  * "/public/val/fonts/inter_a1b2c.woff2": {
11867
12178
  * mimeType: "font/woff2",
@@ -11869,25 +12180,40 @@ var fileset = function fileset(options) {
11869
12180
  * });
11870
12181
  * ```
11871
12182
  */
11872
- var fontset = function fontset(options) {
12183
+ var fontdir = function fontdir(dir, options) {
11873
12184
  var _options$accept;
11874
- var accept = (_options$accept = options.accept) !== null && _options$accept !== void 0 ? _options$accept : DEFAULT_FONT_ACCEPT;
12185
+ var accept = (_options$accept = options === null || options === void 0 ? void 0 : options.accept) !== null && _options$accept !== void 0 ? _options$accept : DEFAULT_FONT_ACCEPT;
11875
12186
  var notFonts = accept.split(",").map(function (type) {
11876
12187
  return type.trim();
11877
12188
  }).filter(function (type) {
11878
12189
  return !isFontMimeType(type);
11879
12190
  });
11880
12191
  if (notFonts.length > 0) {
11881
- // A fontset that took a PDF would be a fileset under a name that says
12192
+ // A fontdir that took a PDF would be a filedir under a name that says
11882
12193
  // otherwise, and the Studio would draw a specimen of nothing.
11883
- throw new Error("s.fontset(): 'accept' may only name font types (font/woff2, font/woff, font/ttf, font/otf or font/*). Got: ".concat(notFonts.join(", "), ". Use s.fileset() for other files."));
12194
+ throw new Error("s.fontdir(): 'accept' may only name font types (font/woff2, font/woff, font/ttf, font/otf or font/*). Got: ".concat(notFonts.join(", "), ". Use s.filedir() for other files."));
11884
12195
  }
11885
- return fileset({
11886
- dir: options.dir,
12196
+ return filedir(dir, {
11887
12197
  accept: accept
11888
12198
  });
11889
12199
  };
11890
12200
 
12201
+ /**
12202
+ * Define a collection of fonts.
12203
+ *
12204
+ * @deprecated Use `s.fontdir(dir, options)`: the directory moved out of the
12205
+ * options and into the first argument, and nothing else changed.
12206
+ *
12207
+ * @example
12208
+ * ```typescript
12209
+ * // was: s.fontset({ dir: "/public/val/fonts" })
12210
+ * const schema = s.fontdir("/public/val/fonts");
12211
+ * ```
12212
+ */
12213
+ var fontset = function fontset(options) {
12214
+ return fontdir(options.dir, options);
12215
+ };
12216
+
11891
12217
  var DateSchema = /*#__PURE__*/function (_Schema) {
11892
12218
  function DateSchema(options) {
11893
12219
  var _this;
@@ -12754,39 +13080,58 @@ function router(router, keyOrItem, maybeItem) {
12754
13080
  /** Every `alt` value any `AltSchema` can produce. */
12755
13081
 
12756
13082
  /**
12757
- * Options for s.imageset()
13083
+ * Options for `s.imagedir(dir, options)`: everything but the directory, which
13084
+ * is the first argument.
13085
+ */
13086
+
13087
+ /**
13088
+ * Options for the deprecated `s.imageset(options)`, which took the directory
13089
+ * as `dir`.
13090
+ *
13091
+ * @deprecated Use `s.imagedir(dir, options)` and `ImagedirOptions`.
12758
13092
  */
12759
13093
 
12760
13094
  /**
12761
13095
  * `alt` is optional only when it is the default schema.
12762
13096
  *
12763
13097
  * Naming a different `Alt` and then leaving `alt` out would make the fallback
12764
- * in `imageset()` a lie — `Alt` would say `s.string()` while the value was a
13098
+ * in `imagedir()` a lie — `Alt` would say `s.string()` while the value was a
12765
13099
  * nullable one. Requiring it in that case is what makes the fallback sound:
12766
13100
  * the branch that uses it is reachable only when `Alt` IS the default.
12767
13101
  */
12768
13102
 
13103
+ /**
13104
+ * The options argument of `s.imagedir()`: optional only when `alt` is, for
13105
+ * the reason `ImagedirAltOption` gives — leaving the whole object out leaves
13106
+ * `alt` out with it.
13107
+ */
13108
+
12769
13109
  /**
12770
13110
  * Metadata for an image entry in the images record.
12771
13111
  *
12772
13112
  * `alt` follows the schema's `alt` option, so it defaults to `string | null`
12773
13113
  * and becomes `string` under `s.string()` or `Record<string, string>` under
12774
- * `s.record(s.string())`. Write `ImagesetEntryMetadata<AltSource>` where a
13114
+ * `s.record(s.string())`. Write `ImagedirEntryMetadata<AltSource>` where a
12775
13115
  * gallery of any alt shape is acceptable.
12776
13116
  */
12777
13117
 
13118
+ /** @deprecated Use `ImagedirEntryMetadata`. */
13119
+
13120
+ /** @deprecated Use `SerializedImagedirSchema`. */
13121
+
12778
13122
  /**
12779
- * Define a collection of images.
13123
+ * Define a directory of images: a whole module that holds many images, keyed
13124
+ * by their file path, that fields pick from with `s.image(galleryVal)`.
12780
13125
  *
12781
- * `directory` is required — it decides where uploads land, so it is not something
12782
- * to be inferred. The rest defaults: any image type (`"image/*"`), nullable alt
12783
- * text, remote disabled. Call `.remote()` on the result to allow remote images.
13126
+ * The directory is the first argument and is required — it decides where
13127
+ * uploads land, so it is not something to be inferred. The rest defaults: any
13128
+ * image type (`"image/*"`), nullable alt text, remote disabled. Call
13129
+ * `.remote()` on the result to allow remote images.
12784
13130
  *
12785
13131
  * @example
12786
13132
  * ```typescript
12787
- * const schema = s.imageset({
13133
+ * const schema = s.imagedir("/public/val/images", {
12788
13134
  * accept: "image/webp",
12789
- * dir: "/public/val/images",
12790
13135
  * alt: s.string().minLength(4),
12791
13136
  * });
12792
13137
  * export default c.define("/content/images.val.ts", schema, {
@@ -12799,19 +13144,26 @@ function router(router, keyOrItem, maybeItem) {
12799
13144
  * });
12800
13145
  * ```
12801
13146
  */
12802
- var imageset = function imageset(options) {
13147
+ var imagedir = function imagedir(dir) {
13148
+ for (var _len = arguments.length, _ref = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
13149
+ _ref[_key - 1] = arguments[_key];
13150
+ }
13151
+ var options = _ref[0];
13152
+ return imagedirOf(dir, options);
13153
+ };
13154
+ function imagedirOf(dir, options) {
12803
13155
  var _options$alt, _options$accept;
12804
- var dir = options.dir;
12805
- // `options.alt` is `Alt | undefined`, and the fallback is exactly the schema
13156
+ // `options?.alt` is `Alt | undefined`, and the fallback is exactly the schema
12806
13157
  // `Alt` defaults to when `alt` is omitted. TypeScript will not narrow a type
12807
13158
  // parameter from the absence of a value, so it cannot see that the two agree,
12808
13159
  // and the fallback is asserted here.
12809
13160
  //
12810
- // Sound, not merely convenient: `ImagesetAltOption` makes `alt` REQUIRED
12811
- // unless `Alt` is the default, so this branch is unreachable for any other
13161
+ // Sound, not merely convenient: `ImagedirAltOption` makes `alt` REQUIRED
13162
+ // unless `Alt` is the default, and `ImagedirOptionsArg` makes the options
13163
+ // object required with it, so this branch is unreachable for any other
12812
13164
  // `Alt`. The one assertion in this file, and it replaces the wider one that
12813
13165
  // used to sit on the ObjectSchema below.
12814
- var altSchema = (_options$alt = options.alt) !== null && _options$alt !== void 0 ? _options$alt : string().nullable();
13166
+ var altSchema = (_options$alt = options === null || options === void 0 ? void 0 : options.alt) !== null && _options$alt !== void 0 ? _options$alt : string().nullable();
12815
13167
  var itemSchema = new ObjectSchema({
12816
13168
  width: new NumberSchema(undefined, false),
12817
13169
  height: new NumberSchema(undefined, false),
@@ -12820,19 +13172,57 @@ var imageset = function imageset(options) {
12820
13172
  }, false);
12821
13173
  return new RecordSchema(itemSchema, false, [], null, null, {
12822
13174
  type: "images",
12823
- accept: (_options$accept = options.accept) !== null && _options$accept !== void 0 ? _options$accept : "image/*",
13175
+ accept: (_options$accept = options === null || options === void 0 ? void 0 : options.accept) !== null && _options$accept !== void 0 ? _options$accept : "image/*",
12824
13176
  dir: dir,
12825
13177
  remote: false,
12826
13178
  altSchema: altSchema,
12827
- encode: options.encode
13179
+ encode: options === null || options === void 0 ? void 0 : options.encode
12828
13180
  });
13181
+ }
13182
+
13183
+ /**
13184
+ * `s.imagedir()` with `.remote()` applied: what `s.imagedir` is under
13185
+ * `files: { remote: true }`.
13186
+ */
13187
+ var remoteImagedir = function remoteImagedir(dir) {
13188
+ for (var _len2 = arguments.length, _ref2 = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
13189
+ _ref2[_key2 - 1] = arguments[_key2];
13190
+ }
13191
+ var options = _ref2[0];
13192
+ return imagedirOf(dir, options).remote();
13193
+ };
13194
+
13195
+ /**
13196
+ * Define a collection of images.
13197
+ *
13198
+ * @deprecated Use `s.imagedir(dir, options)`: the directory moved out of the
13199
+ * options and into the first argument, and nothing else changed.
13200
+ *
13201
+ * @example
13202
+ * ```typescript
13203
+ * // was: s.imageset({ dir: "/public/val/images", accept: "image/webp" })
13204
+ * const schema = s.imagedir("/public/val/images", { accept: "image/webp" });
13205
+ * ```
13206
+ */
13207
+ var imageset = function imageset(options) {
13208
+ return imagedirOf(options.dir, options);
12829
13209
  };
12830
13210
 
12831
13211
  /**
12832
- * Options for s.videoset()
13212
+ * Options for `s.videodir(dir, options)`: everything but the directory, which
13213
+ * is the first argument.
12833
13214
  */
12834
13215
 
12835
- /** See `ImagesetAltOption`: `alt` is optional only when it is the default. */
13216
+ /**
13217
+ * Options for the deprecated `s.videoset(options)`, which took the directory
13218
+ * as `dir`.
13219
+ *
13220
+ * @deprecated Use `s.videodir(dir, options)` and `VideodirOptions`.
13221
+ */
13222
+
13223
+ /** See `ImagedirAltOption`: `alt` is optional only when it is the default. */
13224
+
13225
+ /** See `ImagedirOptionsArg`: the options are optional only when `alt` is. */
12836
13226
 
12837
13227
  /**
12838
13228
  * One video of a set, keyed by its file path (an HLS stream by its master
@@ -12850,19 +13240,22 @@ var imageset = function imageset(options) {
12850
13240
  * still for the gallery, because two stills of one video would disagree.
12851
13241
  */
12852
13242
 
13243
+ /** @deprecated Use `VideodirEntryMetadata`. */
13244
+
13245
+ /** @deprecated Use `SerializedVideodirSchema`. */
13246
+
12853
13247
  /**
12854
- * Define a collection of videos — the video twin of `s.imageset()`.
13248
+ * Define a directory of videos — the video twin of `s.imagedir()`.
12855
13249
  *
12856
13250
  * A field picks from it with `s.video(videosVal)`. An entry may hold the
12857
13251
  * description, poster, start and end, focal point and captions as defaults,
12858
13252
  * and a field overrides any of them by setting its own. Uploading in such a
12859
- * field adds to the set. Call `.remote()` on the result
12860
- * to store the set on Val Remote.
13253
+ * field adds to the directory. Call `.remote()` on the result to store the
13254
+ * videos on Val Remote.
12861
13255
  *
12862
13256
  * @example
12863
13257
  * ```typescript
12864
- * const schema = s.videoset({
12865
- * dir: "/public/val/videos",
13258
+ * const schema = s.videodir("/public/val/videos", {
12866
13259
  * stream: { type: "hls" },
12867
13260
  * });
12868
13261
  * export default c.define("/content/videos.val.ts", schema, {
@@ -12877,11 +13270,46 @@ var imageset = function imageset(options) {
12877
13270
  * });
12878
13271
  * ```
12879
13272
  */
13273
+ var videodir = function videodir(dir) {
13274
+ for (var _len = arguments.length, _ref = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
13275
+ _ref[_key - 1] = arguments[_key];
13276
+ }
13277
+ var options = _ref[0];
13278
+ return videodirOf(dir, options);
13279
+ };
13280
+
13281
+ /**
13282
+ * `s.videodir()` with `.remote()` applied: what `s.videodir` is under
13283
+ * `files: { remote: true }`.
13284
+ */
13285
+ var remoteVideodir = function remoteVideodir(dir) {
13286
+ for (var _len2 = arguments.length, _ref2 = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
13287
+ _ref2[_key2 - 1] = arguments[_key2];
13288
+ }
13289
+ var options = _ref2[0];
13290
+ return videodirOf(dir, options).remote();
13291
+ };
13292
+
13293
+ /**
13294
+ * Define a collection of videos.
13295
+ *
13296
+ * @deprecated Use `s.videodir(dir, options)`: the directory moved out of the
13297
+ * options and into the first argument, and nothing else changed.
13298
+ *
13299
+ * @example
13300
+ * ```typescript
13301
+ * // was: s.videoset({ dir: "/public/val/videos", stream: { type: "hls" } })
13302
+ * const schema = s.videodir("/public/val/videos", { stream: { type: "hls" } });
13303
+ * ```
13304
+ */
12880
13305
  var videoset = function videoset(options) {
13306
+ return videodirOf(options.dir, options);
13307
+ };
13308
+ function videodirOf(dir, options) {
12881
13309
  var _options$alt, _options$accept;
12882
- // The same assertion as in `imageset()`, and sound for the same reason:
12883
- // `VideosetAltOption` makes `alt` required unless `Alt` is the default.
12884
- var altSchema = (_options$alt = options.alt) !== null && _options$alt !== void 0 ? _options$alt : string().nullable();
13310
+ // The same assertion as in `imagedir()`, and sound for the same reason:
13311
+ // `VideodirAltOption` makes `alt` required unless `Alt` is the default.
13312
+ var altSchema = (_options$alt = options === null || options === void 0 ? void 0 : options.alt) !== null && _options$alt !== void 0 ? _options$alt : string().nullable();
12885
13313
  var itemSchema = new ObjectSchema({
12886
13314
  mimeType: new StringSchema({}, false),
12887
13315
  width: new NumberSchema(undefined, false),
@@ -12891,13 +13319,13 @@ var videoset = function videoset(options) {
12891
13319
  }, false);
12892
13320
  return new RecordSchema(itemSchema, false, [], null, null, {
12893
13321
  type: "videos",
12894
- accept: (_options$accept = options.accept) !== null && _options$accept !== void 0 ? _options$accept : DEFAULT_VIDEO_ACCEPT,
12895
- dir: options.dir,
13322
+ accept: (_options$accept = options === null || options === void 0 ? void 0 : options.accept) !== null && _options$accept !== void 0 ? _options$accept : DEFAULT_VIDEO_ACCEPT,
13323
+ dir: dir,
12896
13324
  remote: false,
12897
13325
  altSchema: altSchema,
12898
- stream: options.stream
13326
+ stream: options === null || options === void 0 ? void 0 : options.stream
12899
13327
  });
12900
- };
13328
+ }
12901
13329
 
12902
13330
  /**
12903
13331
  * The video schema a set's entry is hashed against, for a remote ref.
@@ -12936,6 +13364,14 @@ function initSchema(options) {
12936
13364
  font: remoteFont,
12937
13365
  video: remoteVideo,
12938
13366
  richtext: remoteRichtext,
13367
+ imagedir: remoteImagedir,
13368
+ filedir: function (dir, options) {
13369
+ return filedir(dir, options).remote();
13370
+ },
13371
+ fontdir: function (dir, options) {
13372
+ return fontdir(dir, options).remote();
13373
+ },
13374
+ videodir: remoteVideodir,
12939
13375
  imageset: function (options) {
12940
13376
  return imageset(options).remote();
12941
13377
  },
@@ -12954,6 +13390,10 @@ function initSchema(options) {
12954
13390
  font: font,
12955
13391
  video: video,
12956
13392
  richtext: richtext,
13393
+ imagedir: imagedir,
13394
+ filedir: filedir,
13395
+ fontdir: fontdir,
13396
+ videodir: videodir,
12957
13397
  imageset: imageset,
12958
13398
  fileset: fileset,
12959
13399
  fontset: fontset,
@@ -12966,6 +13406,7 @@ function initSchema(options) {
12966
13406
  array: array,
12967
13407
  object: object,
12968
13408
  number: number,
13409
+ "int": _int,
12969
13410
  discriminatedUnion: discriminatedUnion,
12970
13411
  "enum": enumSchema,
12971
13412
  union: union,
@@ -12979,6 +13420,8 @@ function initSchema(options) {
12979
13420
  file: media.file,
12980
13421
  font: media.font,
12981
13422
  video: media.video,
13423
+ filedir: media.filedir,
13424
+ fontdir: media.fontdir,
12982
13425
  fileset: media.fileset,
12983
13426
  fontset: media.fontset,
12984
13427
  date: date,
@@ -12988,6 +13431,8 @@ function initSchema(options) {
12988
13431
  locale: locale,
12989
13432
  route: route,
12990
13433
  router: router,
13434
+ imagedir: media.imagedir,
13435
+ videodir: media.videodir,
12991
13436
  imageset: media.imageset,
12992
13437
  videoset: media.videoset,
12993
13438
  settings: settings
@@ -14084,7 +14529,7 @@ function _extractValModules() {
14084
14529
  * The one answer to that question. There used to be two — `hasRemoteFileSchema`
14085
14530
  * in the server, gating whether `/save` demands remote credentials, and
14086
14531
  * `findRequiredRemoteFiles` in the Studio, gating the `/remote/settings` fetch —
14087
- * and they disagreed about `s.imageset({ ... }).remote()`: the Studio's version
14532
+ * and they disagreed about `s.imagedir(dir, { ... }).remote()`: the Studio's version
14088
14533
  * counted a remote media record, the server's did not, because a media
14089
14534
  * collection serializes as a `record` of metadata rather than as an image
14090
14535
  * schema.
@@ -14124,7 +14569,7 @@ function hasRemoteFileSchema(schema) {
14124
14569
  return hasRemoteFileSchema(schema.item);
14125
14570
  } else if (schema.type === "record") {
14126
14571
  /**
14127
- * A media collection — `s.imageset()` / `s.fileset()` — is the case both of the
14572
+ * A media collection — `s.imagedir()` / `s.filedir()` — is the case both of the
14128
14573
  * old functions were written around, and the one they disagreed on.
14129
14574
  *
14130
14575
  * It has no file or image schema inside it to find: `item` is an object of
@@ -14184,8 +14629,8 @@ function hasRemoteFileSchema(schema) {
14184
14629
  *
14185
14630
  * It is a walk over the SERIALIZED schema for the reasons given above, and for
14186
14631
  * one more that is specific to this question: the two cases most likely to be
14187
- * missed are invisible to a value type. A media collection (`s.imageset()` /
14188
- * `s.fileset()`) serializes as a record of metadata with no image schema inside
14632
+ * missed are invisible to a value type. A media collection (`s.imagedir()` /
14633
+ * `s.filedir()`) serializes as a record of metadata with no image schema inside
14189
14634
  * it, and a richtext inline image lives in a constructor argument. A check
14190
14635
  * written against the item TYPE would silently pass both — and the gallery case
14191
14636
  * already has a data-loss incident attached to it (see above).
@@ -14872,7 +15317,7 @@ function deserializeSchema(serialized) {
14872
15317
  return schema;
14873
15318
  }
14874
15319
  function deserializeSchemaImpl(serialized) {
14875
- 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;
15320
+ 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;
14876
15321
  switch (serialized.type) {
14877
15322
  case "string":
14878
15323
  return new StringSchema(_objectSpread2(_objectSpread2({}, serialized.options), {}, {
@@ -14884,7 +15329,7 @@ function deserializeSchemaImpl(serialized) {
14884
15329
  case "boolean":
14885
15330
  return new BooleanSchema(serialized.opt, [], false, false, serialized.description);
14886
15331
  case "number":
14887
- return new NumberSchema(serialized.options, serialized.opt, [], false, false, serialized.description);
15332
+ return new NumberSchema(serialized.options, serialized.opt, [], false, false, serialized.description, null, (_serialized$render = serialized.render) !== null && _serialized$render !== void 0 ? _serialized$render : null);
14888
15333
  case "object":
14889
15334
  return new ObjectSchema(Object.fromEntries(Object.entries(serialized.items).map(function (_ref) {
14890
15335
  var _ref2 = _slicedToArray(_ref, 2),
@@ -14907,7 +15352,7 @@ function deserializeSchemaImpl(serialized) {
14907
15352
  case "array":
14908
15353
  return new ArraySchema(deserializeSchema(serialized.item), serialized.opt, [], false, false, serialized.description,
14909
15354
  // The preview closure cannot survive serialization; the render can.
14910
- null, (_serialized$render = serialized.render) !== null && _serialized$render !== void 0 ? _serialized$render : null);
15355
+ null, (_serialized$render2 = serialized.render) !== null && _serialized$render2 !== void 0 ? _serialized$render2 : null);
14911
15356
  case "discriminated-union":
14912
15357
  return new DiscriminatedUnionSchema(serialized.key,
14913
15358
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -14936,12 +15381,12 @@ function deserializeSchemaImpl(serialized) {
14936
15381
  altSchema: serialized.alt ? deserializeSchema(serialized.alt) : undefined
14937
15382
  } : undefined, false, false, serialized.description, (_serialized$jsonValue = serialized.jsonValues) !== null && _serialized$jsonValue !== void 0 ? _serialized$jsonValue : false,
14938
15383
  // The preview closure cannot survive serialization; the render can.
14939
- null, (_serialized$render2 = serialized.render) !== null && _serialized$render2 !== void 0 ? _serialized$render2 : null, // The external label is static data, so it survives serialization and
15384
+ null, (_serialized$render3 = serialized.render) !== null && _serialized$render3 !== void 0 ? _serialized$render3 : null, // The external label is static data, so it survives serialization and
14940
15385
  // must be carried back: a deserialized schema that forgot it would walk
14941
15386
  // an external record as if its entries were local.
14942
15387
  (_serialized$external = serialized.external) !== null && _serialized$external !== void 0 ? _serialized$external : null);
14943
15388
  case "keyOf":
14944
- 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);
15389
+ 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);
14945
15390
  case "locale":
14946
15391
  {
14947
15392
  return new LocaleSchema(serialized.opt, [], false, false, serialized.description);
@@ -14959,7 +15404,7 @@ function deserializeSchemaImpl(serialized) {
14959
15404
  case "image":
14960
15405
  return new ImageSchema(serialized.options, serialized.opt, serialized.remote, [], {}, false, false, serialized.description);
14961
15406
  case "video":
14962
- 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 ? {
15407
+ 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 ? {
14963
15408
  modulePath: serialized.referencedModule,
14964
15409
  entries: null,
14965
15410
  remote: (_serialized$remote2 = serialized.remote) !== null && _serialized$remote2 !== void 0 ? _serialized$remote2 : false
@@ -15018,11 +15463,12 @@ function deserializeSchemaImpl(serialized) {
15018
15463
  */
15019
15464
  /**
15020
15465
  * A RENDER is how a field is laid out in the editor, and it applies only when
15021
- * you are looking at the field. It is declared by a CONTAINER about its
15022
- * children, never by a child about itself: `s.array(item).render({ as: "inline" })`
15023
- * and `s.record(item).render({ as: "inline" })`. The one other schema that takes
15024
- * a render is `s.keyOf(...)`, where it means something of its own (see
15025
- * `KeyOfSchema.render`).
15466
+ * you are looking at the field. On a list it is declared by the CONTAINER about
15467
+ * its children, never by a child about itself: `s.array(item).render({ as: "inline" })`
15468
+ * and `s.record(item).render({ as: "inline" })`. Two other schemas take a
15469
+ * render, each meaning something of its own: `s.keyOf(...)` (see
15470
+ * `KeyOfSchema.render`) and `s.number()` / `s.int()`, whose `{ as: "slider" }`
15471
+ * is a different input for the same value (see {@link SliderRender}).
15026
15472
  *
15027
15473
  * Why the container: inline is a property of the LIST — "my items are edited in
15028
15474
  * their rows" — and the item schema is the wrong place to say it. An item can be
@@ -15066,7 +15512,7 @@ function deserializeSchemaImpl(serialized) {
15066
15512
  * `s.array(s.object({ tags: s.array(s.string()) })).render({ as: "inline" })`
15067
15513
  * the objects are inline and `tags` keeps its own default.
15068
15514
  *
15069
- * Not available on `s.router(...)`, `s.imageset(...)` or `s.fileset(...)`:
15515
+ * Not available on `s.router(...)`, `s.imagedir(...)` or `s.filedir(...)`:
15070
15516
  * pages and media have UIs of their own, and `RecordSchema.render` throws there.
15071
15517
  *
15072
15518
  * On `s.keyOf(...)` the same value means something else: the selected entry's
@@ -15078,6 +15524,33 @@ function deserializeSchemaImpl(serialized) {
15078
15524
  * What `.render(...)` takes, and what the serialized schema carries verbatim.
15079
15525
  */
15080
15526
 
15527
+ /**
15528
+ * `{ as: "slider", min, max }` on `s.int()` or `s.number()`: the value is
15529
+ * edited with a slider from `min` to `max`, next to a box that takes a typed
15530
+ * value.
15531
+ *
15532
+ * `min` and `max` are REQUIRED, because a slider without ends is not a slider.
15533
+ * They are the slider's own and are not validation: a value outside them is
15534
+ * still valid content (if the schema allows it), and the field says it is out
15535
+ * of the slider's reach and offers to bring it back. What the schema accepts is
15536
+ * `.min()`, `.max()` and `.step()` on the schema itself.
15537
+ *
15538
+ * The one rule tying the two together: **the slider may only produce values
15539
+ * the schema accepts.** So its range has to lie inside the schema's, its step
15540
+ * has to be a multiple of the schema's step and its `min` on the schema's grid,
15541
+ * and on `s.int()` all of them have to be whole numbers. A schema that breaks
15542
+ * that throws where it is defined — see `NumberSchema`.
15543
+ *
15544
+ * `step` defaults to the schema's `.step()`, and to 1 when there is none.
15545
+ *
15546
+ * Unlike `inline` this is about the field itself — no list reads it, and
15547
+ * {@link isInlineRender} answers `false` for it.
15548
+ */
15549
+
15550
+ /**
15551
+ * What `s.number().render(...)` and `s.int().render(...)` take.
15552
+ */
15553
+
15081
15554
  /**
15082
15555
  * Does this CONTAINER edit its items inside their list rows, rather than behind
15083
15556
  * clickable preview rows that navigate to them?
@@ -15659,7 +16132,7 @@ function isPageRouter(routerId) {
15659
16132
 
15660
16133
  var corePackageJson = {
15661
16134
  name: "@valbuild/core",
15662
- version: "0.143.0",
16135
+ version: "0.145.0",
15663
16136
  "private": false,
15664
16137
  description: "Val - supercharged hard-coded content",
15665
16138
  repository: {
@@ -15765,6 +16238,7 @@ var Internal = {
15765
16238
  fillFromGallery: fillFromGallery,
15766
16239
  galleriesOf: galleriesOf,
15767
16240
  galleryEntryOf: galleryEntryOf,
16241
+ galleryKeyOf: galleryKeyOf,
15768
16242
  GALLERY_DEFAULT_GROUPS: GALLERY_DEFAULT_GROUPS,
15769
16243
  isHlsVideo: isHlsVideo,
15770
16244
  HLS_MIME_TYPE: HLS_MIME_TYPE
@@ -15785,6 +16259,11 @@ var Internal = {
15785
16259
  rejectScheme: rejectScheme,
15786
16260
  schemeOf: schemeOf,
15787
16261
  UNSAFE_URL_SCHEMES: UNSAFE_URL_SCHEMES,
16262
+ number: {
16263
+ nearestAllowedNumber: nearestAllowedNumber,
16264
+ isOnStep: isOnStep,
16265
+ stepOrigin: stepOrigin
16266
+ },
15788
16267
  color: {
15789
16268
  parseColor: parseColor,
15790
16269
  formatColor: formatColor,