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