@valbuild/core 0.109.0 → 0.111.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.
@@ -447,6 +447,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
447
447
  var isHidden = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
448
448
  var description = arguments.length > 7 ? arguments[7] : undefined;
449
449
  var previewInput = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
450
+ var isMultiline = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
450
451
  _classCallCheck(this, StringSchema);
451
452
  _this = _callSuper(this, StringSchema);
452
453
  _this.options = options;
@@ -458,13 +459,14 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
458
459
  _this.isHidden = isHidden;
459
460
  _this.description = description;
460
461
  _this.previewInput = previewInput;
462
+ _this.isMultiline = isMultiline;
461
463
  return _this;
462
464
  }
463
465
  _inherits(StringSchema, _Schema);
464
466
  return _createClass(StringSchema, [{
465
467
  key: "describe",
466
468
  value: function describe(description) {
467
- return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput);
469
+ return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput, this.isMultiline);
468
470
  }
469
471
 
470
472
  /**
@@ -480,7 +482,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
480
482
  value: function minLength(_minLength) {
481
483
  return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
482
484
  minLength: _minLength
483
- }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description, this.previewInput);
485
+ }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description, this.previewInput, this.isMultiline);
484
486
  }
485
487
 
486
488
  /**
@@ -496,7 +498,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
496
498
  value: function maxLength(_maxLength) {
497
499
  return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
498
500
  maxLength: _maxLength
499
- }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description, this.previewInput);
501
+ }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description, this.previewInput, this.isMultiline);
500
502
  }
501
503
  }, {
502
504
  key: "regexp",
@@ -504,12 +506,12 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
504
506
  return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
505
507
  regexp: _regexp,
506
508
  regExpMessage: message
507
- }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description, this.previewInput);
509
+ }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description, this.previewInput, this.isMultiline);
508
510
  }
509
511
  }, {
510
512
  key: "validate",
511
513
  value: function validate(validationFunction) {
512
- return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions.concat(validationFunction), this.renderInput, this.isReadonly, this.isHidden, this.description, this.previewInput);
514
+ return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions.concat(validationFunction), this.renderInput, this.isReadonly, this.isHidden, this.description, this.previewInput, this.isMultiline);
513
515
  }
514
516
  }, {
515
517
  key: "executeValidate",
@@ -582,22 +584,22 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
582
584
  }, {
583
585
  key: "nullable",
584
586
  value: function nullable() {
585
- return new StringSchema(this.options, true, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description, this.previewInput);
587
+ return new StringSchema(this.options, true, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description, this.previewInput, this.isMultiline);
586
588
  }
587
589
  }, {
588
590
  key: "readonly",
589
591
  value: function readonly() {
590
- return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, true, this.isHidden, this.description, this.previewInput);
592
+ return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, true, this.isHidden, this.description, this.previewInput, this.isMultiline);
591
593
  }
592
594
  }, {
593
595
  key: "hidden",
594
596
  value: function hidden() {
595
- return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, true, this.description, this.previewInput);
597
+ return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, true, this.description, this.previewInput, this.isMultiline);
596
598
  }
597
599
  }, {
598
600
  key: "raw",
599
601
  value: function raw() {
600
- return new StringSchema(this.options, this.opt, true, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description, this.previewInput);
602
+ return new StringSchema(this.options, this.opt, true, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description, this.previewInput, this.isMultiline);
601
603
  }
602
604
  }, {
603
605
  key: "executeCustomValidateAt",
@@ -613,6 +615,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
613
615
  return {
614
616
  type: "string",
615
617
  render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
618
+ multiline: this.isMultiline ? true : undefined,
616
619
  preview: this.previewInput ? true : undefined,
617
620
  options: {
618
621
  maxLength: (_this$options4 = this.options) === null || _this$options4 === void 0 ? void 0 : _this$options4.maxLength,
@@ -634,8 +637,27 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
634
637
  }
635
638
 
636
639
  /**
637
- * How this field is laid out in the editor: a textarea, or a code editor for
638
- * the given language.
640
+ * This string holds text that may run to several lines: the editor gives it a
641
+ * growing text box instead of a single-line input.
642
+ *
643
+ * Nothing else changes — the value is still a plain string, and no validation
644
+ * is added or removed. For code, use `s.code({ language })` instead, which is
645
+ * its own schema type.
646
+ *
647
+ * @example
648
+ * const schema = s.string().multiline();
649
+ * export default c.define("/example.val.ts", schema, "Line one\nLine two");
650
+ */
651
+ }, {
652
+ key: "multiline",
653
+ value: function multiline() {
654
+ return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description, this.previewInput, true);
655
+ }
656
+
657
+ /**
658
+ * How this field is laid out in the editor when it is the item of an array or
659
+ * record: `{ as: "inline" }` renders the field itself inside each row,
660
+ * instead of a preview row that navigates to it.
639
661
  *
640
662
  * Static configuration, not a callback — see `render.ts`. What a CONTAINER
641
663
  * shows for its items is a `preview`, which is a different thing entirely.
@@ -643,7 +665,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
643
665
  }, {
644
666
  key: "render",
645
667
  value: function render(input) {
646
- return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, input, this.isReadonly, this.isHidden, this.description, this.previewInput);
668
+ return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, input, this.isReadonly, this.isHidden, this.description, this.previewInput, this.isMultiline);
647
669
  }
648
670
 
649
671
  /**
@@ -654,7 +676,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
654
676
  }, {
655
677
  key: "preview",
656
678
  value: function preview(select) {
657
- return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description, select);
679
+ return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description, select, this.isMultiline);
658
680
  }
659
681
  }, {
660
682
  key: "executePreviewItem",
@@ -2094,6 +2116,30 @@ function fillFromGallery(src, schema, getModuleSource) {
2094
2116
  } : {});
2095
2117
  }
2096
2118
 
2119
+ /**
2120
+ * How an uploaded image is re-encoded in the browser, before it is uploaded.
2121
+ *
2122
+ * Off unless a schema asks for it. When it is on, the image is converted to
2123
+ * `type` and scaled down to fit `maxWidth` x `maxHeight` - unless the result
2124
+ * would be BIGGER than the original and no downscale was needed, in which case
2125
+ * the original bytes are kept. See `architecture/media.md`.
2126
+ *
2127
+ * `type` is required so that adding a format later is additive: a schema
2128
+ * written today keeps saying exactly which format it asked for.
2129
+ */
2130
+
2131
+ /** `false` (or absent) uploads the bytes exactly as the editor picked them. */
2132
+
2133
+ /**
2134
+ * What a GALLERY-BACKED field may say for itself.
2135
+ *
2136
+ * Not `ImageOptions`: `directory` and `accept` belong to the gallery, and a
2137
+ * field repeating them is how two copies of one fact get to disagree. `encode`
2138
+ * is different — it describes what happens to the bytes on their way IN, so a
2139
+ * field that wants the original where its gallery re-encodes has to be able to
2140
+ * say `encode: false`, and there is nowhere else to say it.
2141
+ */
2142
+
2097
2143
  var ImageSchema = /*#__PURE__*/function (_Schema) {
2098
2144
  function ImageSchema(options) {
2099
2145
  var _this;
@@ -2425,7 +2471,7 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
2425
2471
 
2426
2472
  /** An image of its own, carrying its own dimensions and mime type. */
2427
2473
 
2428
- function image(options) {
2474
+ function image(options, galleryOptions) {
2429
2475
  var isModule = !!options && !!Internal.getValPath(options);
2430
2476
  if (isModule) {
2431
2477
  var allModules = {};
@@ -2437,7 +2483,9 @@ function image(options) {
2437
2483
  }
2438
2484
  allModules[modulePath] = getSource(valModule);
2439
2485
  }
2440
- return new ImageSchema({}, false, false, [], allModules);
2486
+ return new ImageSchema((galleryOptions === null || galleryOptions === void 0 ? void 0 : galleryOptions.encode) !== undefined ? {
2487
+ encode: galleryOptions.encode
2488
+ } : {}, false, false, [], allModules);
2441
2489
  }
2442
2490
  return new ImageSchema(options);
2443
2491
  }
@@ -4116,6 +4164,9 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
4116
4164
  result.accept = this.mediaOptions.accept;
4117
4165
  result.directory = this.mediaOptions.directory;
4118
4166
  result.remote = this.mediaOptions.remote;
4167
+ if (this.mediaOptions.encode !== undefined) {
4168
+ result.encode = this.mediaOptions.encode;
4169
+ }
4119
4170
  if (this.mediaOptions.altSchema) {
4120
4171
  result.alt = this.mediaOptions.altSchema["executeSerialize"]();
4121
4172
  }
@@ -6303,6 +6354,184 @@ var datetime = function datetime(options) {
6303
6354
  return new DateTimeSchema(options);
6304
6355
  };
6305
6356
 
6357
+ /**
6358
+ * The list is the declaration and {@link CodeLanguage} is derived from it, so
6359
+ * that a validator elsewhere (`shared`'s zod schema) can enumerate the same
6360
+ * languages without a second copy that drifts. Same shape as `COLOR_FORMATS`.
6361
+ */
6362
+ var CODE_LANGUAGES = ["typescript", "javascript", "javascriptreact", "typescriptreact", "json", "java", "html", "css", "xml", "markdown", "sql", "python", "rust", "php", "go", "cpp", "sass", "vue", "angular"];
6363
+ /**
6364
+ * A string edited in a code editor.
6365
+ *
6366
+ * Its own schema type rather than a layout on `s.string()`: the language is
6367
+ * part of what the content IS, not of how one field happens to be drawn, and
6368
+ * being a type is what lets the value stay out of stega encoding — invisible
6369
+ * characters woven into source code are not something a consumer can render.
6370
+ */
6371
+ var CodeSchema = /*#__PURE__*/function (_Schema) {
6372
+ function CodeSchema(options) {
6373
+ var _this;
6374
+ var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
6375
+ var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
6376
+ var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
6377
+ var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
6378
+ var description = arguments.length > 5 ? arguments[5] : undefined;
6379
+ var renderInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
6380
+ var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
6381
+ _classCallCheck(this, CodeSchema);
6382
+ _this = _callSuper(this, CodeSchema);
6383
+ _this.options = options;
6384
+ _this.opt = opt;
6385
+ _this.customValidateFunctions = customValidateFunctions;
6386
+ _this.isReadonly = isReadonly;
6387
+ _this.isHidden = isHidden;
6388
+ _this.description = description;
6389
+ _this.renderInput = renderInput;
6390
+ _this.previewInput = previewInput;
6391
+ return _this;
6392
+ }
6393
+ _inherits(CodeSchema, _Schema);
6394
+ return _createClass(CodeSchema, [{
6395
+ key: "describe",
6396
+ value: function describe(description) {
6397
+ return new CodeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.renderInput, this.previewInput);
6398
+ }
6399
+ }, {
6400
+ key: "validate",
6401
+ value: function validate(validationFunction) {
6402
+ return new CodeSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
6403
+ }
6404
+ }, {
6405
+ key: "executeCustomValidateAt",
6406
+ value: function executeCustomValidateAt(path, src) {
6407
+ return this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
6408
+ path: path
6409
+ });
6410
+ }
6411
+ }, {
6412
+ key: "executeValidate",
6413
+ value: function executeValidate(path, src) {
6414
+ var errors = this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
6415
+ path: path
6416
+ });
6417
+ if (this.opt && (src === null || src === undefined)) {
6418
+ return errors.length > 0 ? _defineProperty({}, path, errors) : false;
6419
+ }
6420
+ if (typeof src !== "string") {
6421
+ errors.push({
6422
+ message: "Expected 'string', got '".concat(src === null ? "null" : _typeof(src), "'"),
6423
+ value: src
6424
+ });
6425
+ }
6426
+ if (errors.length > 0) {
6427
+ return _defineProperty({}, path, errors);
6428
+ }
6429
+ return false;
6430
+ }
6431
+ }, {
6432
+ key: "executeAssert",
6433
+ value: function executeAssert(path, src) {
6434
+ if (this.opt && src === null) {
6435
+ return {
6436
+ success: true,
6437
+ data: src
6438
+ };
6439
+ }
6440
+ if (typeof src !== "string") {
6441
+ return {
6442
+ success: false,
6443
+ errors: _defineProperty({}, path, [{
6444
+ message: "Expected 'string', got '".concat(src === null ? "null" : _typeof(src), "'"),
6445
+ typeError: true
6446
+ }])
6447
+ };
6448
+ }
6449
+ return {
6450
+ success: true,
6451
+ data: src
6452
+ };
6453
+ }
6454
+ }, {
6455
+ key: "nullable",
6456
+ value: function nullable() {
6457
+ return new CodeSchema(this.options, true, [], this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
6458
+ }
6459
+ }, {
6460
+ key: "readonly",
6461
+ value: function readonly() {
6462
+ return new CodeSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description, this.renderInput, this.previewInput);
6463
+ }
6464
+ }, {
6465
+ key: "hidden",
6466
+ value: function hidden() {
6467
+ return new CodeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description, this.renderInput, this.previewInput);
6468
+ }
6469
+
6470
+ /**
6471
+ * How this field is laid out in the editor when it is the item of an array
6472
+ * or record: `{ as: "inline" }` renders the field itself inside each row,
6473
+ * instead of a preview row that navigates to it.
6474
+ *
6475
+ * Static configuration, not a callback — see `render.ts`.
6476
+ */
6477
+ }, {
6478
+ key: "render",
6479
+ value: function render(input) {
6480
+ return new CodeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
6481
+ }
6482
+
6483
+ /**
6484
+ * How this VALUE is shown where a preview of it is needed — a row in a
6485
+ * sortable list, a reference dropdown, a search hit. Never how the field
6486
+ * itself is edited (that is `render`). See `preview.ts`.
6487
+ */
6488
+ }, {
6489
+ key: "preview",
6490
+ value: function preview(select) {
6491
+ return new CodeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, select);
6492
+ }
6493
+ }, {
6494
+ key: "executePreviewItem",
6495
+ value: function executePreviewItem(src) {
6496
+ if (this.previewInput === null) {
6497
+ return null;
6498
+ }
6499
+ return this.previewInput({
6500
+ val: src
6501
+ });
6502
+ }
6503
+ }, {
6504
+ key: "declaresItemPreview",
6505
+ value: function declaresItemPreview() {
6506
+ return this.previewInput !== null;
6507
+ }
6508
+ }, {
6509
+ key: "executeSerialize",
6510
+ value: function executeSerialize() {
6511
+ var _this$renderInput, _this$customValidateF;
6512
+ return {
6513
+ type: "code",
6514
+ render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
6515
+ preview: this.previewInput ? true : undefined,
6516
+ options: this.options,
6517
+ opt: this.opt,
6518
+ customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
6519
+ readonly: this.isReadonly,
6520
+ hidden: this.isHidden,
6521
+ description: this.description
6522
+ };
6523
+ }
6524
+ }, {
6525
+ key: "executePreview",
6526
+ value: function executePreview() {
6527
+ return {};
6528
+ }
6529
+ }]);
6530
+ }(Schema);
6531
+ var code = function code(options) {
6532
+ return new CodeSchema(options);
6533
+ };
6534
+
6306
6535
  /**
6307
6536
  * Parsing / formatting of the CSS color strings stored by `s.color()`.
6308
6537
  *
@@ -7049,7 +7278,8 @@ var images = function images(options) {
7049
7278
  accept: (_options$accept = options.accept) !== null && _options$accept !== void 0 ? _options$accept : "image/*",
7050
7279
  directory: directory,
7051
7280
  remote: (_options$remote = options.remote) !== null && _options$remote !== void 0 ? _options$remote : false,
7052
- altSchema: altSchema
7281
+ altSchema: altSchema,
7282
+ encode: options.encode
7053
7283
  });
7054
7284
  };
7055
7285
 
@@ -7080,6 +7310,7 @@ function initSchema() {
7080
7310
  date: date,
7081
7311
  datetime: datetime,
7082
7312
  color: color,
7313
+ code: code,
7083
7314
  route: route,
7084
7315
  router: router,
7085
7316
  images: images
@@ -7893,7 +8124,7 @@ function hasRemoteFileSchema(schema) {
7893
8124
  }
7894
8125
  }
7895
8126
  return false;
7896
- } else if (schema.type === "boolean" || schema.type === "number" || schema.type === "string" || schema.type === "literal" || schema.type === "date" || schema.type === "dateTime" || schema.type === "color" || schema.type === "keyOf" || schema.type === "route") {
8127
+ } else if (schema.type === "boolean" || schema.type === "number" || schema.type === "string" || schema.type === "literal" || schema.type === "date" || schema.type === "dateTime" || schema.type === "color" || schema.type === "code" || schema.type === "keyOf" || schema.type === "route") {
7897
8128
  return false;
7898
8129
  } else {
7899
8130
  var exhaustiveCheck = schema;
@@ -8792,10 +9023,16 @@ function createRemoteRef(remoteHost, _ref) {
8792
9023
  */
8793
9024
  function getValidationBasis(coreVersion, schema, fileExt, metadata, fileHash) {
8794
9025
  var metadataValidationBasis = "".concat((metadata === null || metadata === void 0 ? void 0 : metadata.width) || "").concat((metadata === null || metadata === void 0 ? void 0 : metadata.height) || "").concat(metadata === null || metadata === void 0 ? void 0 : metadata.mimeType);
9026
+ var options = _objectSpread2({}, schema.options);
9027
+ // Ignore options that do not affect the validation basis below:
9028
+ // `encode` says how the bytes were PRODUCED in the browser, not whether the
9029
+ // bytes that arrived are valid. Leaving it in would mean that changing a
9030
+ // quality setting re-validates every remote file in the project.
9031
+ delete options.encode;
8795
9032
  var schemaValidationBasis = {
8796
9033
  type: schema.type,
8797
9034
  opt: schema.opt,
8798
- options: _objectSpread2({}, schema.options)
9035
+ options: options
8799
9036
  };
8800
9037
  return coreVersion + JSON.stringify(schemaValidationBasis) + fileExt + metadataValidationBasis + fileHash;
8801
9038
  }
@@ -8822,7 +9059,7 @@ function deserializeSchema(serialized) {
8822
9059
  return schema;
8823
9060
  }
8824
9061
  function deserializeSchemaImpl(serialized) {
8825
- var _serialized$options, _serialized$options2, _serialized$render, _serialized$render2, _serialized$render3, _serialized$render4, _serialized$render5, _serialized$render6, _serialized$render7, _serialized$accept, _serialized$directory, _serialized$remote, _serialized$jsonValue, _serialized$render9, _serialized$render0, _serialized$render10, _serialized$render11, _serialized$render12, _serialized$render13, _serialized$render14;
9062
+ var _serialized$options, _serialized$options2, _serialized$render, _serialized$multiline, _serialized$render2, _serialized$render3, _serialized$render4, _serialized$render5, _serialized$render6, _serialized$render7, _serialized$accept, _serialized$directory, _serialized$remote, _serialized$jsonValue, _serialized$render9, _serialized$render0, _serialized$render10, _serialized$render11, _serialized$render12, _serialized$render13, _serialized$render14, _serialized$render15;
8826
9063
  switch (serialized.type) {
8827
9064
  case "string":
8828
9065
  return new StringSchema(_objectSpread2(_objectSpread2({}, serialized.options), {}, {
@@ -8831,7 +9068,7 @@ function deserializeSchemaImpl(serialized) {
8831
9068
  }), serialized.opt, serialized.raw, [], // A render is static data, so it survives serialization and must be
8832
9069
  // carried back: it is the schema's own configuration now, not something
8833
9070
  // recomputed from an instance.
8834
- (_serialized$render = serialized.render) !== null && _serialized$render !== void 0 ? _serialized$render : null, false, false, serialized.description);
9071
+ (_serialized$render = serialized.render) !== null && _serialized$render !== void 0 ? _serialized$render : null, false, false, serialized.description, null, (_serialized$multiline = serialized.multiline) !== null && _serialized$multiline !== void 0 ? _serialized$multiline : false);
8835
9072
  case "literal":
8836
9073
  return new LiteralSchema(serialized.value, serialized.opt, [], false, false, serialized.description, (_serialized$render2 = serialized.render) !== null && _serialized$render2 !== void 0 ? _serialized$render2 : null);
8837
9074
  case "boolean":
@@ -8900,6 +9137,8 @@ function deserializeSchemaImpl(serialized) {
8900
9137
  return new DateTimeSchema(serialized.options, serialized.opt, [], false, false, serialized.description, (_serialized$render13 = serialized.render) !== null && _serialized$render13 !== void 0 ? _serialized$render13 : null);
8901
9138
  case "color":
8902
9139
  return new ColorSchema(serialized.options, serialized.opt, [], false, false, serialized.description, (_serialized$render14 = serialized.render) !== null && _serialized$render14 !== void 0 ? _serialized$render14 : null);
9140
+ case "code":
9141
+ return new CodeSchema(serialized.options, serialized.opt, [], false, false, serialized.description, (_serialized$render15 = serialized.render) !== null && _serialized$render15 !== void 0 ? _serialized$render15 : null);
8903
9142
  default:
8904
9143
  {
8905
9144
  var exhaustiveCheck = serialized;
@@ -9052,10 +9291,14 @@ function previewScope(paths) {
9052
9291
 
9053
9292
  /**
9054
9293
  * A RENDER is how the FIELD ITSELF is laid out in the editor, and it applies
9055
- * only when you are looking at the field: `s.string().render({ as: "textarea"
9056
- * })`, `.render({ as: "code", language })`, `.render({ as: "inline" })` on an
9294
+ * only when you are looking at the field: `.render({ as: "inline" })` on an
9057
9295
  * array/record item.
9058
9296
  *
9297
+ * It is deliberately the ONE thing a render can say. What a string looks like
9298
+ * when it holds more than a line is the schema's own business — `.multiline()`
9299
+ * for a text box, `s.code({ language })` for a code editor — not a layout
9300
+ * bolted onto `s.string()` from outside.
9301
+ *
9059
9302
  * A PREVIEW (`preview.ts`) is the other thing: how the VALUE is shown wherever
9060
9303
  * a preview of it is needed — a list row, a reference dropdown, a search hit —
9061
9304
  * that is, wherever the value is navigable to rather than open. The two never
@@ -9076,13 +9319,6 @@ function previewScope(paths) {
9076
9319
  * `render` its own execute/store pair again. It is NOT to re-merge the two:
9077
9320
  * conflating them is what this file was split up to undo.
9078
9321
  */
9079
- /**
9080
- * The list is the declaration and {@link CodeLanguage} is derived from it, so
9081
- * that a validator elsewhere (`shared`'s zod schema) can enumerate the same
9082
- * languages without a second copy that drifts. Same shape as `COLOR_FORMATS`.
9083
- */
9084
- var CODE_LANGUAGES = ["typescript", "javascript", "javascriptreact", "typescriptreact", "json", "java", "html", "css", "xml", "markdown", "sql", "python", "rust", "php", "go", "cpp", "sass", "vue", "angular"];
9085
-
9086
9322
  /**
9087
9323
  * `{ as: "inline" }` on a field that is the ITEM of an array or record: the
9088
9324
  * container renders the field itself inside each (sortable) row, instead of a
@@ -9098,15 +9334,47 @@ var CODE_LANGUAGES = ["typescript", "javascript", "javascriptreact", "typescript
9098
9334
  */
9099
9335
 
9100
9336
  /**
9101
- * What `.render(...)` takes on every field except `s.string()`, and what the
9102
- * serialized schema carries verbatim.
9337
+ * What `.render(...)` takes on every field, and what the serialized schema
9338
+ * carries verbatim.
9103
9339
  */
9104
9340
 
9105
9341
  /**
9106
- * What `s.string().render(...)` takes, and what the serialized schema carries
9107
- * verbatim. A string has editor layouts of its own (textarea, code) in
9108
- * addition to the container-facing `inline`.
9342
+ * Is this item schema edited INSIDE its list row, rather than behind a
9343
+ * clickable preview row that navigates to it?
9344
+ *
9345
+ * The one answer, so that the list rows, the nav-stop rule (`getNavPath`) and
9346
+ * the add buttons cannot drift apart — they are three readings of the same
9347
+ * question, and a disagreement between them is a row you can edit in place but
9348
+ * that "add" navigates away from.
9349
+ *
9350
+ * A tagged union counts as inline when the union itself declares it OR when
9351
+ * ANY of its variants does. A page-builder list is `s.array(s.union("type",
9352
+ * block, block, ...))` and the natural place to write the render is on the
9353
+ * blocks, one per block type — the union is a dispatch, not something the
9354
+ * author thinks of as the field. `some` rather than `every` because the row
9355
+ * draws the union's own editor (the tag selector plus the matched variant's
9356
+ * fields), which handles every variant either way: with `every`, adding one
9357
+ * variant and forgetting its `.render` would silently turn the whole list back
9358
+ * into preview rows.
9359
+ *
9360
+ * This is the ONLY place a render is allowed to be read from anywhere but the
9361
+ * schema it was declared on. It stays static (see the top of this file): the
9362
+ * answer is a function of the serialized schema alone, never of the value the
9363
+ * row happens to hold.
9109
9364
  */
9365
+ function isInlineRender(schema) {
9366
+ var _schema$render;
9367
+ if (((_schema$render = schema.render) === null || _schema$render === void 0 ? void 0 : _schema$render.as) === "inline") {
9368
+ return true;
9369
+ }
9370
+ if (schema.type === "union") {
9371
+ return schema.items.some(function (item) {
9372
+ var _item$render;
9373
+ return ((_item$render = item.render) === null || _item$render === void 0 ? void 0 : _item$render.as) === "inline";
9374
+ });
9375
+ }
9376
+ return false;
9377
+ }
9110
9378
 
9111
9379
  var externalPageRouter = {
9112
9380
  getRouterId: function getRouterId() {
@@ -9472,4 +9740,4 @@ function tryJsonParse(str) {
9472
9740
  }
9473
9741
  }
9474
9742
 
9475
- export { ArraySchema as A, BooleanSchema as B, ColorSchema as C, DEFAULT_CONTENT_HOST as D, FATAL_ERROR_TYPES as F, GenericSelector as G, Internal as I, KeyOfSchema as K, LiteralSchema as L, ModuleFilePathSep as M, NumberSchema as N, ObjectSchema as O, PatchError as P, RecordSchema as R, Schema as S, UnionSchema as U, VAL_EXTENSION as V, _typeof as _, _slicedToArray as a, _createClass as b, _classCallCheck as c, _toConsumableArray as d, DEFAULT_APP_HOST as e, extractValModules as f, computeValModuleShas as g, hasRemoteFileSchema as h, initVal as i, DEFAULT_VAL_REMOTE_HOST as j, derefPatch as k, StringSchema as l, modules as m, ImageSchema as n, FileSchema as o, DateSchema as p, COLOR_FORMATS as q, DEFAULT_COLOR_FORMAT as r, splitModuleFilePathAndModulePath as s, DateTimeSchema as t, RouteSchema as u, RichTextSchema as v, deserializeSchema as w, previewScope as x, CODE_LANGUAGES as y, getSourcePathFromRoute as z };
9743
+ export { ArraySchema as A, BooleanSchema as B, ColorSchema as C, DEFAULT_CONTENT_HOST as D, isInlineRender as E, FATAL_ERROR_TYPES as F, GenericSelector as G, getSourcePathFromRoute as H, Internal as I, KeyOfSchema as K, LiteralSchema as L, ModuleFilePathSep as M, NumberSchema as N, ObjectSchema as O, PatchError as P, RecordSchema as R, Schema as S, UnionSchema as U, VAL_EXTENSION as V, _typeof as _, _slicedToArray as a, _createClass as b, _classCallCheck as c, _toConsumableArray as d, DEFAULT_APP_HOST as e, extractValModules as f, computeValModuleShas as g, hasRemoteFileSchema as h, initVal as i, DEFAULT_VAL_REMOTE_HOST as j, derefPatch as k, StringSchema as l, modules as m, ImageSchema as n, FileSchema as o, DateSchema as p, CodeSchema as q, CODE_LANGUAGES as r, splitModuleFilePathAndModulePath as s, COLOR_FORMATS as t, DEFAULT_COLOR_FORMAT as u, DateTimeSchema as v, RouteSchema as w, RichTextSchema as x, deserializeSchema as y, previewScope as z };