@valbuild/core 0.110.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.
- package/dist/declarations/src/index.d.ts +2 -1
- package/dist/declarations/src/initSchema.d.ts +19 -0
- package/dist/declarations/src/render.d.ts +8 -22
- package/dist/declarations/src/schema/code.d.ts +85 -0
- package/dist/declarations/src/schema/index.d.ts +2 -1
- package/dist/declarations/src/schema/string.d.ts +31 -6
- package/dist/{index-409a38c3.cjs.dev.js → index-9f6baa46.cjs.dev.js} +228 -33
- package/dist/{index-6652ab3c.esm.js → index-af98fc7c.esm.js} +228 -34
- package/dist/{index-62ef4533.cjs.prod.js → index-f1992b0f.cjs.prod.js} +228 -33
- package/dist/valbuild-core.cjs.dev.js +2 -1
- package/dist/valbuild-core.cjs.prod.js +2 -1
- package/dist/valbuild-core.esm.js +1 -1
- package/package.json +1 -1
- package/patch/dist/valbuild-core-patch.cjs.dev.js +1 -1
- package/patch/dist/valbuild-core-patch.cjs.prod.js +1 -1
- package/patch/dist/valbuild-core-patch.esm.js +2 -2
|
@@ -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
|
-
*
|
|
638
|
-
*
|
|
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",
|
|
@@ -6332,6 +6354,184 @@ var datetime = function datetime(options) {
|
|
|
6332
6354
|
return new DateTimeSchema(options);
|
|
6333
6355
|
};
|
|
6334
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
|
+
|
|
6335
6535
|
/**
|
|
6336
6536
|
* Parsing / formatting of the CSS color strings stored by `s.color()`.
|
|
6337
6537
|
*
|
|
@@ -7110,6 +7310,7 @@ function initSchema() {
|
|
|
7110
7310
|
date: date,
|
|
7111
7311
|
datetime: datetime,
|
|
7112
7312
|
color: color,
|
|
7313
|
+
code: code,
|
|
7113
7314
|
route: route,
|
|
7114
7315
|
router: router,
|
|
7115
7316
|
images: images
|
|
@@ -7923,7 +8124,7 @@ function hasRemoteFileSchema(schema) {
|
|
|
7923
8124
|
}
|
|
7924
8125
|
}
|
|
7925
8126
|
return false;
|
|
7926
|
-
} 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") {
|
|
7927
8128
|
return false;
|
|
7928
8129
|
} else {
|
|
7929
8130
|
var exhaustiveCheck = schema;
|
|
@@ -8858,7 +9059,7 @@ function deserializeSchema(serialized) {
|
|
|
8858
9059
|
return schema;
|
|
8859
9060
|
}
|
|
8860
9061
|
function deserializeSchemaImpl(serialized) {
|
|
8861
|
-
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;
|
|
8862
9063
|
switch (serialized.type) {
|
|
8863
9064
|
case "string":
|
|
8864
9065
|
return new StringSchema(_objectSpread2(_objectSpread2({}, serialized.options), {}, {
|
|
@@ -8867,7 +9068,7 @@ function deserializeSchemaImpl(serialized) {
|
|
|
8867
9068
|
}), serialized.opt, serialized.raw, [], // A render is static data, so it survives serialization and must be
|
|
8868
9069
|
// carried back: it is the schema's own configuration now, not something
|
|
8869
9070
|
// recomputed from an instance.
|
|
8870
|
-
(_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);
|
|
8871
9072
|
case "literal":
|
|
8872
9073
|
return new LiteralSchema(serialized.value, serialized.opt, [], false, false, serialized.description, (_serialized$render2 = serialized.render) !== null && _serialized$render2 !== void 0 ? _serialized$render2 : null);
|
|
8873
9074
|
case "boolean":
|
|
@@ -8936,6 +9137,8 @@ function deserializeSchemaImpl(serialized) {
|
|
|
8936
9137
|
return new DateTimeSchema(serialized.options, serialized.opt, [], false, false, serialized.description, (_serialized$render13 = serialized.render) !== null && _serialized$render13 !== void 0 ? _serialized$render13 : null);
|
|
8937
9138
|
case "color":
|
|
8938
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);
|
|
8939
9142
|
default:
|
|
8940
9143
|
{
|
|
8941
9144
|
var exhaustiveCheck = serialized;
|
|
@@ -9088,10 +9291,14 @@ function previewScope(paths) {
|
|
|
9088
9291
|
|
|
9089
9292
|
/**
|
|
9090
9293
|
* A RENDER is how the FIELD ITSELF is laid out in the editor, and it applies
|
|
9091
|
-
* only when you are looking at the field:
|
|
9092
|
-
* })`, `.render({ as: "code", language })`, `.render({ as: "inline" })` on an
|
|
9294
|
+
* only when you are looking at the field: `.render({ as: "inline" })` on an
|
|
9093
9295
|
* array/record item.
|
|
9094
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
|
+
*
|
|
9095
9302
|
* A PREVIEW (`preview.ts`) is the other thing: how the VALUE is shown wherever
|
|
9096
9303
|
* a preview of it is needed — a list row, a reference dropdown, a search hit —
|
|
9097
9304
|
* that is, wherever the value is navigable to rather than open. The two never
|
|
@@ -9112,13 +9319,6 @@ function previewScope(paths) {
|
|
|
9112
9319
|
* `render` its own execute/store pair again. It is NOT to re-merge the two:
|
|
9113
9320
|
* conflating them is what this file was split up to undo.
|
|
9114
9321
|
*/
|
|
9115
|
-
/**
|
|
9116
|
-
* The list is the declaration and {@link CodeLanguage} is derived from it, so
|
|
9117
|
-
* that a validator elsewhere (`shared`'s zod schema) can enumerate the same
|
|
9118
|
-
* languages without a second copy that drifts. Same shape as `COLOR_FORMATS`.
|
|
9119
|
-
*/
|
|
9120
|
-
var CODE_LANGUAGES = ["typescript", "javascript", "javascriptreact", "typescriptreact", "json", "java", "html", "css", "xml", "markdown", "sql", "python", "rust", "php", "go", "cpp", "sass", "vue", "angular"];
|
|
9121
|
-
|
|
9122
9322
|
/**
|
|
9123
9323
|
* `{ as: "inline" }` on a field that is the ITEM of an array or record: the
|
|
9124
9324
|
* container renders the field itself inside each (sortable) row, instead of a
|
|
@@ -9134,14 +9334,8 @@ var CODE_LANGUAGES = ["typescript", "javascript", "javascriptreact", "typescript
|
|
|
9134
9334
|
*/
|
|
9135
9335
|
|
|
9136
9336
|
/**
|
|
9137
|
-
* What `.render(...)` takes on every field
|
|
9138
|
-
*
|
|
9139
|
-
*/
|
|
9140
|
-
|
|
9141
|
-
/**
|
|
9142
|
-
* What `s.string().render(...)` takes, and what the serialized schema carries
|
|
9143
|
-
* verbatim. A string has editor layouts of its own (textarea, code) in
|
|
9144
|
-
* addition to the container-facing `inline`.
|
|
9337
|
+
* What `.render(...)` takes on every field, and what the serialized schema
|
|
9338
|
+
* carries verbatim.
|
|
9145
9339
|
*/
|
|
9146
9340
|
|
|
9147
9341
|
/**
|
|
@@ -9546,4 +9740,4 @@ function tryJsonParse(str) {
|
|
|
9546
9740
|
}
|
|
9547
9741
|
}
|
|
9548
9742
|
|
|
9549
|
-
export { ArraySchema as A, BooleanSchema as B, ColorSchema as C, DEFAULT_CONTENT_HOST as D,
|
|
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 };
|