@valbuild/core 0.129.0 → 0.130.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/CHANGELOG.md +116 -0
- package/dist/declarations/src/index.d.ts +1 -1
- package/dist/declarations/src/preview.d.ts +65 -8
- package/dist/declarations/src/render.d.ts +26 -0
- package/dist/declarations/src/schema/array.d.ts +8 -5
- package/dist/declarations/src/schema/boolean.d.ts +8 -6
- package/dist/declarations/src/schema/code.d.ts +8 -6
- package/dist/declarations/src/schema/color.d.ts +8 -6
- package/dist/declarations/src/schema/date.d.ts +8 -6
- package/dist/declarations/src/schema/datetime.d.ts +8 -6
- package/dist/declarations/src/schema/discriminatedUnion.d.ts +8 -5
- package/dist/declarations/src/schema/enum.d.ts +8 -6
- package/dist/declarations/src/schema/file.d.ts +8 -6
- package/dist/declarations/src/schema/image.d.ts +8 -6
- package/dist/declarations/src/schema/index.d.ts +29 -1
- package/dist/declarations/src/schema/keyOf.d.ts +8 -6
- package/dist/declarations/src/schema/literal.d.ts +8 -6
- package/dist/declarations/src/schema/locale.d.ts +1 -2
- package/dist/declarations/src/schema/number.d.ts +8 -6
- package/dist/declarations/src/schema/object.d.ts +8 -5
- package/dist/declarations/src/schema/record.d.ts +8 -5
- package/dist/declarations/src/schema/richtext.d.ts +8 -6
- package/dist/declarations/src/schema/route.d.ts +8 -6
- package/dist/declarations/src/schema/settings.d.ts +1 -1
- package/dist/declarations/src/schema/string.d.ts +8 -11
- package/dist/declarations/src/source/settings.d.ts +27 -0
- package/dist/{index-21fd16b1.cjs.dev.js → index-27d57011.cjs.dev.js} +589 -349
- package/dist/{index-06bb2832.esm.js → index-71a59a88.esm.js} +589 -349
- package/dist/{index-f5842720.cjs.prod.js → index-9e372bd7.cjs.prod.js} +589 -349
- package/dist/valbuild-core.cjs.dev.js +1 -1
- package/dist/valbuild-core.cjs.prod.js +1 -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
|
@@ -411,8 +411,93 @@ var Schema = /*#__PURE__*/function () {
|
|
|
411
411
|
* For example, if you have an object schema, you must assert each key / value pair manually.
|
|
412
412
|
*/
|
|
413
413
|
}, {
|
|
414
|
-
key: "
|
|
414
|
+
key: "executePreview",
|
|
415
415
|
value:
|
|
416
|
+
/**
|
|
417
|
+
* This value's preview, and every preview below it.
|
|
418
|
+
*
|
|
419
|
+
* The default is the whole of it for a LEAF: a leaf has nothing below it, so
|
|
420
|
+
* all it can contribute is {@link PreviewNode.self}. Containers override this
|
|
421
|
+
* and recurse; object and discriminated union add nothing of their own beyond
|
|
422
|
+
* the self they inherit here, and array and record add `rows`.
|
|
423
|
+
*
|
|
424
|
+
* @param scope Which paths the caller needs a preview for. Absent means the
|
|
425
|
+
* whole module, which is what every caller passed before scoping existed.
|
|
426
|
+
* See {@link PreviewScope}: a container prunes recursion where nothing is
|
|
427
|
+
* wanted, and previews a WINDOW when its own path is not wanted but some of
|
|
428
|
+
* its items are — which is the single-visible-row case.
|
|
429
|
+
* @param selfIsReifiedByParent Set by an array or record on its DIRECT items,
|
|
430
|
+
* and by nothing else. Such an item's preview is the same closure the
|
|
431
|
+
* container is already running into {@link PreviewNode.rows}, so emitting a
|
|
432
|
+
* `self` for it as well would call the user's closure twice per row — which
|
|
433
|
+
* it did, and which the scoped-preview tests caught by counting. The flag
|
|
434
|
+
* does not travel further down: a grandchild is nobody's row.
|
|
435
|
+
*/
|
|
436
|
+
function executePreview(sourcePath, src, scope, selfIsReifiedByParent) {
|
|
437
|
+
if (selfIsReifiedByParent) {
|
|
438
|
+
return {};
|
|
439
|
+
}
|
|
440
|
+
return this.executeSelfPreview(sourcePath, src, scope);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* THIS value as a preview, at its own path — `{ self }` and nothing else.
|
|
445
|
+
*
|
|
446
|
+
* Every schema can produce one, which is the point: before this existed a
|
|
447
|
+
* value's preview was reified only by its CONTAINER, so a value with no
|
|
448
|
+
* container had none. A module root is exactly that, and `.preview(...)` on
|
|
449
|
+
* a module's own schema was therefore dead code — the studio showed the file
|
|
450
|
+
* name and nothing a developer wrote could change it. So is any field of an
|
|
451
|
+
* object, which reifies no rows.
|
|
452
|
+
*
|
|
453
|
+
* Gated on {@link PreviewScope.wants} rather than `wantsUnder`: a caller
|
|
454
|
+
* asking about a CONTAINER wants its rows, and computing a self for every
|
|
455
|
+
* descendant on the way past would run each item's closure twice.
|
|
456
|
+
*/
|
|
457
|
+
}, {
|
|
458
|
+
key: "executeSelfPreview",
|
|
459
|
+
value: function executeSelfPreview(sourcePath, src, scope) {
|
|
460
|
+
if (src === null || src === undefined) {
|
|
461
|
+
return {};
|
|
462
|
+
}
|
|
463
|
+
if (!this.declaresItemPreview()) {
|
|
464
|
+
return {};
|
|
465
|
+
}
|
|
466
|
+
if (scope !== undefined && !scope.wants(sourcePath)) {
|
|
467
|
+
return {};
|
|
468
|
+
}
|
|
469
|
+
try {
|
|
470
|
+
// NB NB: the closure is user code.
|
|
471
|
+
var item = this.executePreviewItem(src);
|
|
472
|
+
if (item === null) {
|
|
473
|
+
return {};
|
|
474
|
+
}
|
|
475
|
+
var title = item.title,
|
|
476
|
+
subtitle = item.subtitle,
|
|
477
|
+
image = item.image;
|
|
478
|
+
// Assigned into an annotated local rather than returned as a literal: a
|
|
479
|
+
// computed key widens `status` to `string`.
|
|
480
|
+
var res = {};
|
|
481
|
+
res[sourcePath] = {
|
|
482
|
+
status: "success",
|
|
483
|
+
data: {
|
|
484
|
+
self: {
|
|
485
|
+
title: title,
|
|
486
|
+
subtitle: subtitle,
|
|
487
|
+
image: image
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
return res;
|
|
492
|
+
} catch (e) {
|
|
493
|
+
var _res = {};
|
|
494
|
+
_res[sourcePath] = {
|
|
495
|
+
status: "error",
|
|
496
|
+
message: e instanceof Error ? e.message : "Unknown error"
|
|
497
|
+
};
|
|
498
|
+
return _res;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
416
501
|
/**
|
|
417
502
|
* This value AS A PREVIEW — what a container's row, a reference dropdown or
|
|
418
503
|
* a search hit shows for it. Runs the schema's own `preview` closure;
|
|
@@ -423,7 +508,9 @@ var Schema = /*#__PURE__*/function () {
|
|
|
423
508
|
* `executePreview` reifies an {@link ArrayPreview} / {@link RecordPreview}
|
|
424
509
|
* from item-level declarations.
|
|
425
510
|
*/
|
|
426
|
-
|
|
511
|
+
}, {
|
|
512
|
+
key: "executePreviewItem",
|
|
513
|
+
value: function executePreviewItem(src) {
|
|
427
514
|
return null;
|
|
428
515
|
}
|
|
429
516
|
/**
|
|
@@ -504,6 +591,241 @@ var Schema = /*#__PURE__*/function () {
|
|
|
504
591
|
|
|
505
592
|
// TODO: SourceError<"Could not determine type of Schema">
|
|
506
593
|
|
|
594
|
+
function ownKeys(e, r) {
|
|
595
|
+
var t = Object.keys(e);
|
|
596
|
+
if (Object.getOwnPropertySymbols) {
|
|
597
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
598
|
+
r && (o = o.filter(function (r) {
|
|
599
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
600
|
+
})), t.push.apply(t, o);
|
|
601
|
+
}
|
|
602
|
+
return t;
|
|
603
|
+
}
|
|
604
|
+
function _objectSpread2(e) {
|
|
605
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
606
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
607
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
608
|
+
_defineProperty(e, r, t[r]);
|
|
609
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
610
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
return e;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* THE RULE, and the only sentence that needs to be remembered:
|
|
618
|
+
*
|
|
619
|
+
* **`.describe()` is INPUT HELP and is shown wherever that field — or a
|
|
620
|
+
* record's key — is being ENTERED; `.preview()` is a NAME and is shown
|
|
621
|
+
* wherever the value is REFERRED TO rather than edited; `.render()` is
|
|
622
|
+
* LAYOUT and applies only while the field is open in front of you.**
|
|
623
|
+
*
|
|
624
|
+
* The test that settles every case: **can the reader change something here?**
|
|
625
|
+
* If yes it is a place for a description — the input beside a label, the key
|
|
626
|
+
* box in "New entry", "Rename key", "Duplicate", "New page", the key half of a
|
|
627
|
+
* reference dropdown. If no, it is a place for a preview — a list row, a
|
|
628
|
+
* reference once chosen, a search hit, a sitemap row, the heading of what you
|
|
629
|
+
* navigated to.
|
|
630
|
+
*
|
|
631
|
+
* That is why a description is plain data on the serialized schema and a
|
|
632
|
+
* preview is a closure: a description is true before any value exists and says
|
|
633
|
+
* the same thing to everyone filling the field in, and a preview cannot exist
|
|
634
|
+
* without the one value it names. So a description must never be used as a
|
|
635
|
+
* subtitle — it would repeat one sentence under every row of a list — and a
|
|
636
|
+
* preview must never be used as help text, because there is nothing to preview
|
|
637
|
+
* until after the value has been entered.
|
|
638
|
+
*
|
|
639
|
+
* None of the three substitutes for another: a field with a perfect
|
|
640
|
+
* description still previews as `#3` until someone writes the preview.
|
|
641
|
+
*/
|
|
642
|
+
/**
|
|
643
|
+
* A PREVIEW is how a VALUE is shown wherever a preview of it is needed — a row
|
|
644
|
+
* in a sortable list, a key in a reference dropdown, a search hit, a
|
|
645
|
+
* reference — which is everywhere the value is NAVIGABLE to rather than open.
|
|
646
|
+
* It is never how the field itself is edited: that is a RENDER (`render.ts`),
|
|
647
|
+
* which applies only when you are looking at the field. The two do not
|
|
648
|
+
* intersect — a schema can carry both, and each is read in its own places.
|
|
649
|
+
*
|
|
650
|
+
* A preview is declared on the schema of the VALUE being previewed:
|
|
651
|
+
*
|
|
652
|
+
* ```ts
|
|
653
|
+
* const author = s.object({ name: s.string() })
|
|
654
|
+
* .preview(({ val }) => ({ title: val.name }));
|
|
655
|
+
* const authors = s.array(author);
|
|
656
|
+
* ```
|
|
657
|
+
*
|
|
658
|
+
* The container reifies its rows by running each ITEM's preview closure — see
|
|
659
|
+
* {@link ArrayPreview} / {@link RecordPreview}. (Previews used to be declared
|
|
660
|
+
* on the container instead; a `.preview` on an array/record now previews the
|
|
661
|
+
* array/record itself as a value, for when IT is the item of something.)
|
|
662
|
+
*/
|
|
663
|
+
/**
|
|
664
|
+
* What a preview shows for one value: the user's `preview` callback returns
|
|
665
|
+
* this, and the Studio draws a row from it.
|
|
666
|
+
*
|
|
667
|
+
* NB: {@link ArrayPreview} / {@link RecordPreview} name the DATA a container
|
|
668
|
+
* previews with. The Studio also has React components called `ArrayPreview` /
|
|
669
|
+
* `RecordPreview` (the fallback rendering of an array / record field, part of
|
|
670
|
+
* the `<Type>Preview` convention in `components/Preview.tsx`). They do not
|
|
671
|
+
* collide today because no file needs both - if one ever does, alias this type
|
|
672
|
+
* at the import rather than renaming that convention.
|
|
673
|
+
*/
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* What `.preview(...)` takes, on every schema: the value's own source in, a
|
|
677
|
+
* {@link PreviewItem} out. `NonNullable` because a container skips null items
|
|
678
|
+
* rather than previewing them.
|
|
679
|
+
*
|
|
680
|
+
* Declared through method syntax deliberately (the same bivariance shape
|
|
681
|
+
* React's event handler types use): `nullable()` copies a schema's closure
|
|
682
|
+
* into the `Src | null` variant of the same class, and with a plain function
|
|
683
|
+
* type the checker cannot see that `NonNullable<Src | null>` IS
|
|
684
|
+
* `NonNullable<Src>` while `Src` is still a type parameter — every schema's
|
|
685
|
+
* `nullable()` would need a cast instead.
|
|
686
|
+
*/
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* How a CONTAINER's children preview. `parent` is the discriminant, and every
|
|
690
|
+
* consumer narrows on it rather than on the union as a whole. There is no
|
|
691
|
+
* `layout` here on purpose - how a preview is laid out is the editor's
|
|
692
|
+
* business, not the schema's.
|
|
693
|
+
*/
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Everything known about ONE path, which is two independent things.
|
|
697
|
+
*
|
|
698
|
+
* They are separate fields rather than a union because a path can have both,
|
|
699
|
+
* and that is not a corner case: `s.array(section).preview(...)` where
|
|
700
|
+
* `section` also previews is a section list that shows its rows AND names
|
|
701
|
+
* itself when it is nested in something. One of them would have had to win.
|
|
702
|
+
*
|
|
703
|
+
* - {@link self} - what THIS value is called, from its own schema's
|
|
704
|
+
* `.preview(...)`. This is the only answer for a value with no container to
|
|
705
|
+
* ask: a module root (whose `.preview` was never run before this existed) and
|
|
706
|
+
* any field of an object.
|
|
707
|
+
* - {@link rows} - what its CHILDREN are called, from the ITEM schema's
|
|
708
|
+
* `.preview(...)`, reified by the container. Kept alongside `self` rather
|
|
709
|
+
* than derived from the children's `self` entries because a list needs every
|
|
710
|
+
* row in one answer, and because an EMPTY list still has to preview as an
|
|
711
|
+
* empty list - which is a fact about the schema, not about any value.
|
|
712
|
+
*/
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Fold `incoming` into `target`, path by path. MUTATES `target`.
|
|
716
|
+
*
|
|
717
|
+
* Every `executePreview` used to copy child results across with a plain
|
|
718
|
+
* assignment, which was fine while one path held one thing. It no longer does:
|
|
719
|
+
* a container writes `rows` at its own path and its `self` arrives from the
|
|
720
|
+
* same walk, so an overwrite silently drops whichever landed first. Merging is
|
|
721
|
+
* per FIELD, and an error at a path beats any data there - a preview that threw
|
|
722
|
+
* must not be reported as a preview that is merely absent.
|
|
723
|
+
*/
|
|
724
|
+
function mergePreviewInto(target, incoming) {
|
|
725
|
+
for (var keyS in incoming) {
|
|
726
|
+
var key = keyS;
|
|
727
|
+
var next = incoming[key];
|
|
728
|
+
var current = target[key];
|
|
729
|
+
if (current === undefined || next.status === "error") {
|
|
730
|
+
target[key] = next;
|
|
731
|
+
continue;
|
|
732
|
+
}
|
|
733
|
+
if (current.status === "error" || next.status === "loading") {
|
|
734
|
+
continue;
|
|
735
|
+
}
|
|
736
|
+
if (current.status === "loading") {
|
|
737
|
+
target[key] = next;
|
|
738
|
+
continue;
|
|
739
|
+
}
|
|
740
|
+
target[key] = {
|
|
741
|
+
status: "success",
|
|
742
|
+
data: _objectSpread2(_objectSpread2({}, current.data), next.data)
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Which paths a preview is being computed FOR.
|
|
749
|
+
*
|
|
750
|
+
* `executePreview` takes a whole module, so one request has always walked every
|
|
751
|
+
* node in it and run every `preview` closure - for `handboka`, with `preview` at
|
|
752
|
+
* two nested array levels, that is every chapter and every section to serve one
|
|
753
|
+
* visible row. A scope is what makes the walk proportional to what is being
|
|
754
|
+
* looked at instead of to the project.
|
|
755
|
+
*
|
|
756
|
+
* Two questions, because a container and its items need different answers:
|
|
757
|
+
*
|
|
758
|
+
* - {@link PreviewScope.wants} - is a preview AT this exact path wanted? A
|
|
759
|
+
* container answers `true` here when the whole of it is being shown, and its
|
|
760
|
+
* preview is then computed in full.
|
|
761
|
+
* - {@link PreviewScope.wantsUnder} - could anything at or below this path be
|
|
762
|
+
* wanted? Recursion is pruned where this is `false`, and a container whose own
|
|
763
|
+
* path is not wanted but which has wanted descendants previews a WINDOW: only
|
|
764
|
+
* the items that were asked for. That is the case a single visible row is, and
|
|
765
|
+
* it is why {@link ArrayPreview} carries indices.
|
|
766
|
+
*
|
|
767
|
+
* Absent scope means the whole module, which is what every existing caller
|
|
768
|
+
* passes and what every existing caller got.
|
|
769
|
+
*/
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* A scope covering exactly `paths` and their subtrees.
|
|
773
|
+
*
|
|
774
|
+
* Compares SEGMENTS rather than string prefixes. A source path's module path is
|
|
775
|
+
* a quoted, dot-joined encoding (`?p="a".1."b"`), so `startsWith` gets the
|
|
776
|
+
* ancestor test wrong wherever a key is a prefix of a sibling key or contains a
|
|
777
|
+
* dot or a quote - `"title"` against `"titles"` being the cheapest example.
|
|
778
|
+
* Segments are parsed once here, not per comparison.
|
|
779
|
+
*/
|
|
780
|
+
function previewScope(paths) {
|
|
781
|
+
var wanted = paths.map(function (path) {
|
|
782
|
+
var _splitModuleFilePathA = splitModuleFilePathAndModulePath(path),
|
|
783
|
+
_splitModuleFilePathA2 = _slicedToArray(_splitModuleFilePathA, 2),
|
|
784
|
+
moduleFilePath = _splitModuleFilePathA2[0],
|
|
785
|
+
modulePath = _splitModuleFilePathA2[1];
|
|
786
|
+
return {
|
|
787
|
+
moduleFilePath: moduleFilePath,
|
|
788
|
+
segments: modulePath === "" ? [] : splitModulePath(modulePath)
|
|
789
|
+
};
|
|
790
|
+
});
|
|
791
|
+
var parse = function parse(path) {
|
|
792
|
+
var _splitModuleFilePathA3 = splitModuleFilePathAndModulePath(path),
|
|
793
|
+
_splitModuleFilePathA4 = _slicedToArray(_splitModuleFilePathA3, 2),
|
|
794
|
+
moduleFilePath = _splitModuleFilePathA4[0],
|
|
795
|
+
modulePath = _splitModuleFilePathA4[1];
|
|
796
|
+
return {
|
|
797
|
+
moduleFilePath: moduleFilePath,
|
|
798
|
+
segments: modulePath === "" ? [] : splitModulePath(modulePath)
|
|
799
|
+
};
|
|
800
|
+
};
|
|
801
|
+
var isPrefix = function isPrefix(prefix, of) {
|
|
802
|
+
if (prefix.length > of.length) return false;
|
|
803
|
+
for (var i = 0; i < prefix.length; i++) {
|
|
804
|
+
if (prefix[i] !== of[i]) return false;
|
|
805
|
+
}
|
|
806
|
+
return true;
|
|
807
|
+
};
|
|
808
|
+
return {
|
|
809
|
+
wants: function wants(path) {
|
|
810
|
+
var at = parse(path);
|
|
811
|
+
return wanted.some(function (entry) {
|
|
812
|
+
return entry.moduleFilePath === at.moduleFilePath && entry.segments.length === at.segments.length && isPrefix(entry.segments, at.segments);
|
|
813
|
+
});
|
|
814
|
+
},
|
|
815
|
+
wantsUnder: function wantsUnder(path) {
|
|
816
|
+
var at = parse(path);
|
|
817
|
+
return wanted.some(function (entry) {
|
|
818
|
+
return entry.moduleFilePath === at.moduleFilePath && (
|
|
819
|
+
// Either direction: a wanted path below `path` means recurse into it,
|
|
820
|
+
// and a wanted path ABOVE it means the whole subtree was asked for.
|
|
821
|
+
isPrefix(at.segments, entry.segments) || isPrefix(entry.segments, at.segments));
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
// TODO: improve this so that we do not get RawString and string, only string. Are there other things?
|
|
828
|
+
|
|
507
829
|
// Identity symbols are registered in the global Symbol registry so that
|
|
508
830
|
// multiple bundled copies of @valbuild/core (e.g. the editor SPA bundle vs.
|
|
509
831
|
// the host Next.js bundle) resolve to the same Symbol instance. Without
|
|
@@ -616,28 +938,6 @@ function unsafeCreateSourcePath(path, itemKey) {
|
|
|
616
938
|
return "".concat(path).concat(Internal.ModuleFilePathSep).concat(JSON.stringify(itemKey));
|
|
617
939
|
}
|
|
618
940
|
|
|
619
|
-
function ownKeys(e, r) {
|
|
620
|
-
var t = Object.keys(e);
|
|
621
|
-
if (Object.getOwnPropertySymbols) {
|
|
622
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
623
|
-
r && (o = o.filter(function (r) {
|
|
624
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
625
|
-
})), t.push.apply(t, o);
|
|
626
|
-
}
|
|
627
|
-
return t;
|
|
628
|
-
}
|
|
629
|
-
function _objectSpread2(e) {
|
|
630
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
631
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
632
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
633
|
-
_defineProperty(e, r, t[r]);
|
|
634
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
635
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
636
|
-
});
|
|
637
|
-
}
|
|
638
|
-
return e;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
941
|
var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
642
942
|
function StringSchema(options) {
|
|
643
943
|
var _this;
|
|
@@ -668,10 +968,13 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
668
968
|
/**
|
|
669
969
|
* Describe this field.
|
|
670
970
|
*
|
|
671
|
-
* The description is shown
|
|
672
|
-
*
|
|
673
|
-
*
|
|
674
|
-
*
|
|
971
|
+
* The description is INPUT HELP: it is shown where this field's value is
|
|
972
|
+
* entered — beside its input in the Val editor, and for a record's key
|
|
973
|
+
* schema in every form that asks for a key — so it is where you say what an
|
|
974
|
+
* editor needs to know to fill it in RIGHT, which the field name cannot
|
|
975
|
+
* carry. It is not a name for the value: that is `.preview(...)`, and it is
|
|
976
|
+
* read somewhere else. The description also travels in the serialized
|
|
977
|
+
* schema, which is what the AI assistant and the MCP tools read.
|
|
675
978
|
*
|
|
676
979
|
* Pass `null` to clear a description set earlier.
|
|
677
980
|
*
|
|
@@ -1008,11 +1311,6 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1008
1311
|
* is a `render`, which travels in the serialized schema instead of through
|
|
1009
1312
|
* this pipeline.
|
|
1010
1313
|
*/
|
|
1011
|
-
}, {
|
|
1012
|
-
key: "executePreview",
|
|
1013
|
-
value: function executePreview() {
|
|
1014
|
-
return {};
|
|
1015
|
-
}
|
|
1016
1314
|
}]);
|
|
1017
1315
|
}(Schema);
|
|
1018
1316
|
var string = function string(options) {
|
|
@@ -1045,10 +1343,13 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1045
1343
|
/**
|
|
1046
1344
|
* Describe this field.
|
|
1047
1345
|
*
|
|
1048
|
-
* The description is shown
|
|
1049
|
-
*
|
|
1050
|
-
*
|
|
1051
|
-
*
|
|
1346
|
+
* The description is INPUT HELP: it is shown where this field's value is
|
|
1347
|
+
* entered — beside its input in the Val editor, and for a record's key
|
|
1348
|
+
* schema in every form that asks for a key — so it is where you say what an
|
|
1349
|
+
* editor needs to know to fill it in RIGHT, which the field name cannot
|
|
1350
|
+
* carry. It is not a name for the value: that is `.preview(...)`, and it is
|
|
1351
|
+
* read somewhere else. The description also travels in the serialized
|
|
1352
|
+
* schema, which is what the AI assistant and the MCP tools read.
|
|
1052
1353
|
*
|
|
1053
1354
|
* Pass `null` to clear a description set earlier.
|
|
1054
1355
|
*
|
|
@@ -1360,7 +1661,7 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1360
1661
|
}
|
|
1361
1662
|
}, {
|
|
1362
1663
|
key: "executePreview",
|
|
1363
|
-
value: function executePreview(sourcePath, src, scope) {
|
|
1664
|
+
value: function executePreview(sourcePath, src, scope, selfIsReifiedByParent) {
|
|
1364
1665
|
var res = {};
|
|
1365
1666
|
if (src === null) {
|
|
1366
1667
|
return res;
|
|
@@ -1377,11 +1678,14 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1377
1678
|
if (scope !== undefined && !scope.wantsUnder(subPath)) {
|
|
1378
1679
|
continue;
|
|
1379
1680
|
}
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1681
|
+
mergePreviewInto(res, this.items[_key3]["executePreview"](subPath, itemSrc, scope));
|
|
1682
|
+
}
|
|
1683
|
+
// An object reifies no rows of its own, so the only thing it adds is what
|
|
1684
|
+
// IT is called — which nothing else can supply for a field of an object.
|
|
1685
|
+
// Its own items are NOT rows, so the flag stops here rather than travelling
|
|
1686
|
+
// down with the recursion above.
|
|
1687
|
+
if (!selfIsReifiedByParent) {
|
|
1688
|
+
mergePreviewInto(res, this.executeSelfPreview(sourcePath, src, scope));
|
|
1385
1689
|
}
|
|
1386
1690
|
return res;
|
|
1387
1691
|
}
|
|
@@ -1422,10 +1726,13 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
|
|
|
1422
1726
|
/**
|
|
1423
1727
|
* Describe this field.
|
|
1424
1728
|
*
|
|
1425
|
-
* The description is shown
|
|
1426
|
-
*
|
|
1427
|
-
*
|
|
1428
|
-
*
|
|
1729
|
+
* The description is INPUT HELP: it is shown where this field's value is
|
|
1730
|
+
* entered — beside its input in the Val editor, and for a record's key
|
|
1731
|
+
* schema in every form that asks for a key — so it is where you say what an
|
|
1732
|
+
* editor needs to know to fill it in RIGHT, which the field name cannot
|
|
1733
|
+
* carry. It is not a name for the value: that is `.preview(...)`, and it is
|
|
1734
|
+
* read somewhere else. The description also travels in the serialized
|
|
1735
|
+
* schema, which is what the AI assistant and the MCP tools read.
|
|
1429
1736
|
*
|
|
1430
1737
|
* Pass `null` to clear a description set earlier.
|
|
1431
1738
|
*
|
|
@@ -1584,7 +1891,7 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
|
|
|
1584
1891
|
}
|
|
1585
1892
|
}, {
|
|
1586
1893
|
key: "executePreview",
|
|
1587
|
-
value: function executePreview(sourcePath, src, scope) {
|
|
1894
|
+
value: function executePreview(sourcePath, src, scope, selfIsReifiedByParent) {
|
|
1588
1895
|
var res = {};
|
|
1589
1896
|
if (src === null) {
|
|
1590
1897
|
return res;
|
|
@@ -1599,11 +1906,10 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
|
|
|
1599
1906
|
if (scope !== undefined && !scope.wantsUnder(subPath)) {
|
|
1600
1907
|
continue;
|
|
1601
1908
|
}
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
}
|
|
1909
|
+
mergePreviewInto(res,
|
|
1910
|
+
// `true`: this item is a ROW, and its preview is the closure reified
|
|
1911
|
+
// into `rows` below. See `executePreview` on `Schema`.
|
|
1912
|
+
this.item["executePreview"](subPath, itemSrc, scope, true));
|
|
1607
1913
|
}
|
|
1608
1914
|
// The rows preview comes from the ITEM schema's own `preview` — the
|
|
1609
1915
|
// container just runs it per row. Asked as a fact rather than by running
|
|
@@ -1650,13 +1956,29 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
|
|
|
1650
1956
|
};
|
|
1651
1957
|
}
|
|
1652
1958
|
}
|
|
1653
|
-
|
|
1959
|
+
var rows = {};
|
|
1960
|
+
rows[sourcePath] = {
|
|
1654
1961
|
status: "success",
|
|
1655
1962
|
data: {
|
|
1656
|
-
|
|
1657
|
-
|
|
1963
|
+
rows: {
|
|
1964
|
+
parent: "array",
|
|
1965
|
+
items: items
|
|
1966
|
+
}
|
|
1658
1967
|
}
|
|
1659
1968
|
};
|
|
1969
|
+
mergePreviewInto(res, rows);
|
|
1970
|
+
}
|
|
1971
|
+
// ...and what the LIST ITSELF is called, which is a different closure on a
|
|
1972
|
+
// different schema: `s.array(section.preview(...)).preview(...)` previews
|
|
1973
|
+
// its rows AND names itself for when it is nested in something. Merged
|
|
1974
|
+
// rather than assigned, or one of the two would win. See `PreviewNode`.
|
|
1975
|
+
//
|
|
1976
|
+
// Unless this list is itself a ROW of an outer array or record, which has
|
|
1977
|
+
// already run this very closure to reify it — a container both PASSES the
|
|
1978
|
+
// flag to its items and RECEIVES it as one, and honouring only the first
|
|
1979
|
+
// half ran `s.array(s.array(x).preview(...))`'s closure twice per row.
|
|
1980
|
+
if (!selfIsReifiedByParent) {
|
|
1981
|
+
mergePreviewInto(res, this.executeSelfPreview(sourcePath, src, scope));
|
|
1660
1982
|
}
|
|
1661
1983
|
return res;
|
|
1662
1984
|
}
|
|
@@ -1759,10 +2081,13 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1759
2081
|
/**
|
|
1760
2082
|
* Describe this field.
|
|
1761
2083
|
*
|
|
1762
|
-
* The description is shown
|
|
1763
|
-
*
|
|
1764
|
-
*
|
|
1765
|
-
*
|
|
2084
|
+
* The description is INPUT HELP: it is shown where this field's value is
|
|
2085
|
+
* entered — beside its input in the Val editor, and for a record's key
|
|
2086
|
+
* schema in every form that asks for a key — so it is where you say what an
|
|
2087
|
+
* editor needs to know to fill it in RIGHT, which the field name cannot
|
|
2088
|
+
* carry. It is not a name for the value: that is `.preview(...)`, and it is
|
|
2089
|
+
* read somewhere else. The description also travels in the serialized
|
|
2090
|
+
* schema, which is what the AI assistant and the MCP tools read.
|
|
1766
2091
|
*
|
|
1767
2092
|
* Pass `null` to clear a description set earlier.
|
|
1768
2093
|
*
|
|
@@ -1951,11 +2276,6 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1951
2276
|
description: this.description
|
|
1952
2277
|
};
|
|
1953
2278
|
}
|
|
1954
|
-
}, {
|
|
1955
|
-
key: "executePreview",
|
|
1956
|
-
value: function executePreview() {
|
|
1957
|
-
return {};
|
|
1958
|
-
}
|
|
1959
2279
|
}]);
|
|
1960
2280
|
}(Schema);
|
|
1961
2281
|
var literal = function literal(value) {
|
|
@@ -2011,10 +2331,13 @@ var DiscriminatedUnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2011
2331
|
/**
|
|
2012
2332
|
* Describe this field.
|
|
2013
2333
|
*
|
|
2014
|
-
* The description is shown
|
|
2015
|
-
*
|
|
2016
|
-
*
|
|
2017
|
-
*
|
|
2334
|
+
* The description is INPUT HELP: it is shown where this field's value is
|
|
2335
|
+
* entered — beside its input in the Val editor, and for a record's key
|
|
2336
|
+
* schema in every form that asks for a key — so it is where you say what an
|
|
2337
|
+
* editor needs to know to fill it in RIGHT, which the field name cannot
|
|
2338
|
+
* carry. It is not a name for the value: that is `.preview(...)`, and it is
|
|
2339
|
+
* read somewhere else. The description also travels in the serialized
|
|
2340
|
+
* schema, which is what the AI assistant and the MCP tools read.
|
|
2018
2341
|
*
|
|
2019
2342
|
* Pass `null` to clear a description set earlier.
|
|
2020
2343
|
*
|
|
@@ -2467,7 +2790,7 @@ var DiscriminatedUnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2467
2790
|
}
|
|
2468
2791
|
}, {
|
|
2469
2792
|
key: "executePreview",
|
|
2470
|
-
value: function executePreview(sourcePath, src, scope) {
|
|
2793
|
+
value: function executePreview(sourcePath, src, scope, selfIsReifiedByParent) {
|
|
2471
2794
|
var res = {};
|
|
2472
2795
|
if (src === null) {
|
|
2473
2796
|
return res;
|
|
@@ -2492,10 +2815,16 @@ var DiscriminatedUnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2492
2815
|
return false;
|
|
2493
2816
|
});
|
|
2494
2817
|
if (thisSchema) {
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2818
|
+
// The variant owns the path — see the note on `executeCustomValidateAt`.
|
|
2819
|
+
// It contributes a `self` of its own here; the union's comes second and
|
|
2820
|
+
// wins, because `executePreviewItem` already encodes the precedence (the
|
|
2821
|
+
// union's own closure if it has one, else the matched variant's) and
|
|
2822
|
+
// there must not be a second copy of that rule.
|
|
2823
|
+
// The variant SHARES this path, so the flag passes straight through: a
|
|
2824
|
+
// union that is a row is a variant that is a row.
|
|
2825
|
+
mergePreviewInto(res, thisSchema["executePreview"](sourcePath, src, scope, selfIsReifiedByParent));
|
|
2826
|
+
if (!selfIsReifiedByParent) {
|
|
2827
|
+
mergePreviewInto(res, this.executeSelfPreview(sourcePath, src, scope));
|
|
2499
2828
|
}
|
|
2500
2829
|
return res;
|
|
2501
2830
|
}
|
|
@@ -2508,8 +2837,8 @@ var DiscriminatedUnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2508
2837
|
}]);
|
|
2509
2838
|
}(Schema);
|
|
2510
2839
|
var discriminatedUnion = function discriminatedUnion(key) {
|
|
2511
|
-
for (var _len = arguments.length, objects = new Array(_len > 1 ? _len - 1 : 0),
|
|
2512
|
-
objects[
|
|
2840
|
+
for (var _len = arguments.length, objects = new Array(_len > 1 ? _len - 1 : 0), _key2 = 1; _key2 < _len; _key2++) {
|
|
2841
|
+
objects[_key2 - 1] = arguments[_key2];
|
|
2513
2842
|
}
|
|
2514
2843
|
return new DiscriminatedUnionSchema(key, objects);
|
|
2515
2844
|
};
|
|
@@ -3486,10 +3815,13 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3486
3815
|
/**
|
|
3487
3816
|
* Describe this field.
|
|
3488
3817
|
*
|
|
3489
|
-
* The description is shown
|
|
3490
|
-
*
|
|
3491
|
-
*
|
|
3492
|
-
*
|
|
3818
|
+
* The description is INPUT HELP: it is shown where this field's value is
|
|
3819
|
+
* entered — beside its input in the Val editor, and for a record's key
|
|
3820
|
+
* schema in every form that asks for a key — so it is where you say what an
|
|
3821
|
+
* editor needs to know to fill it in RIGHT, which the field name cannot
|
|
3822
|
+
* carry. It is not a name for the value: that is `.preview(...)`, and it is
|
|
3823
|
+
* read somewhere else. The description also travels in the serialized
|
|
3824
|
+
* schema, which is what the AI assistant and the MCP tools read.
|
|
3493
3825
|
*
|
|
3494
3826
|
* Pass `null` to clear a description set earlier.
|
|
3495
3827
|
*
|
|
@@ -3870,11 +4202,6 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3870
4202
|
description: this.description
|
|
3871
4203
|
};
|
|
3872
4204
|
}
|
|
3873
|
-
}, {
|
|
3874
|
-
key: "executePreview",
|
|
3875
|
-
value: function executePreview() {
|
|
3876
|
-
return {};
|
|
3877
|
-
}
|
|
3878
4205
|
}]);
|
|
3879
4206
|
}(Schema);
|
|
3880
4207
|
|
|
@@ -3930,10 +4257,13 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3930
4257
|
/**
|
|
3931
4258
|
* Describe this field.
|
|
3932
4259
|
*
|
|
3933
|
-
* The description is shown
|
|
3934
|
-
*
|
|
3935
|
-
*
|
|
3936
|
-
*
|
|
4260
|
+
* The description is INPUT HELP: it is shown where this field's value is
|
|
4261
|
+
* entered — beside its input in the Val editor, and for a record's key
|
|
4262
|
+
* schema in every form that asks for a key — so it is where you say what an
|
|
4263
|
+
* editor needs to know to fill it in RIGHT, which the field name cannot
|
|
4264
|
+
* carry. It is not a name for the value: that is `.preview(...)`, and it is
|
|
4265
|
+
* read somewhere else. The description also travels in the serialized
|
|
4266
|
+
* schema, which is what the AI assistant and the MCP tools read.
|
|
3937
4267
|
*
|
|
3938
4268
|
* Pass `null` to clear a description set earlier.
|
|
3939
4269
|
*
|
|
@@ -4162,11 +4492,6 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4162
4492
|
description: this.description
|
|
4163
4493
|
};
|
|
4164
4494
|
}
|
|
4165
|
-
}, {
|
|
4166
|
-
key: "executePreview",
|
|
4167
|
-
value: function executePreview() {
|
|
4168
|
-
return {};
|
|
4169
|
-
}
|
|
4170
4495
|
}]);
|
|
4171
4496
|
}(Schema);
|
|
4172
4497
|
var route = function route(options) {
|
|
@@ -4199,10 +4524,13 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4199
4524
|
/**
|
|
4200
4525
|
* Describe this field.
|
|
4201
4526
|
*
|
|
4202
|
-
* The description is shown
|
|
4203
|
-
*
|
|
4204
|
-
*
|
|
4205
|
-
*
|
|
4527
|
+
* The description is INPUT HELP: it is shown where this field's value is
|
|
4528
|
+
* entered — beside its input in the Val editor, and for a record's key
|
|
4529
|
+
* schema in every form that asks for a key — so it is where you say what an
|
|
4530
|
+
* editor needs to know to fill it in RIGHT, which the field name cannot
|
|
4531
|
+
* carry. It is not a name for the value: that is `.preview(...)`, and it is
|
|
4532
|
+
* read somewhere else. The description also travels in the serialized
|
|
4533
|
+
* schema, which is what the AI assistant and the MCP tools read.
|
|
4206
4534
|
*
|
|
4207
4535
|
* Pass `null` to clear a description set earlier.
|
|
4208
4536
|
*
|
|
@@ -4848,11 +5176,6 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4848
5176
|
description: this.description
|
|
4849
5177
|
};
|
|
4850
5178
|
}
|
|
4851
|
-
}, {
|
|
4852
|
-
key: "executePreview",
|
|
4853
|
-
value: function executePreview() {
|
|
4854
|
-
return {};
|
|
4855
|
-
}
|
|
4856
5179
|
}]);
|
|
4857
5180
|
}(Schema);
|
|
4858
5181
|
var richtext = function richtext(options) {
|
|
@@ -5367,10 +5690,13 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
5367
5690
|
/**
|
|
5368
5691
|
* Describe this field.
|
|
5369
5692
|
*
|
|
5370
|
-
* The description is shown
|
|
5371
|
-
*
|
|
5372
|
-
*
|
|
5373
|
-
*
|
|
5693
|
+
* The description is INPUT HELP: it is shown where this field's value is
|
|
5694
|
+
* entered — beside its input in the Val editor, and for a record's key
|
|
5695
|
+
* schema in every form that asks for a key — so it is where you say what an
|
|
5696
|
+
* editor needs to know to fill it in RIGHT, which the field name cannot
|
|
5697
|
+
* carry. It is not a name for the value: that is `.preview(...)`, and it is
|
|
5698
|
+
* read somewhere else. The description also travels in the serialized
|
|
5699
|
+
* schema, which is what the AI assistant and the MCP tools read.
|
|
5374
5700
|
*
|
|
5375
5701
|
* Pass `null` to clear a description set earlier.
|
|
5376
5702
|
*
|
|
@@ -6163,7 +6489,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
6163
6489
|
}
|
|
6164
6490
|
}, {
|
|
6165
6491
|
key: "executePreview",
|
|
6166
|
-
value: function executePreview(sourcePath, src, scope) {
|
|
6492
|
+
value: function executePreview(sourcePath, src, scope, selfIsReifiedByParent) {
|
|
6167
6493
|
var res = {};
|
|
6168
6494
|
if (src === null) {
|
|
6169
6495
|
return res;
|
|
@@ -6188,11 +6514,10 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
6188
6514
|
if (scope !== undefined && !scope.wantsUnder(subPath)) {
|
|
6189
6515
|
continue;
|
|
6190
6516
|
}
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
}
|
|
6517
|
+
mergePreviewInto(res,
|
|
6518
|
+
// `true`: this item is a ROW, and its preview is the closure reified
|
|
6519
|
+
// into `rows` below. See `executePreview` on `Schema`.
|
|
6520
|
+
this.item["executePreview"](subPath, itemSrc, scope, true));
|
|
6196
6521
|
}
|
|
6197
6522
|
// The entries preview comes from the ITEM schema's own `preview` — the
|
|
6198
6523
|
// container just runs it per entry. Asked as a fact rather than by running
|
|
@@ -6204,7 +6529,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
6204
6529
|
var items = [];
|
|
6205
6530
|
for (var _i2 = 0, _Object$entries = Object.entries(src); _i2 < _Object$entries.length; _i2++) {
|
|
6206
6531
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i2], 2),
|
|
6207
|
-
|
|
6532
|
+
_key3 = _Object$entries$_i[0],
|
|
6208
6533
|
val = _Object$entries$_i[1];
|
|
6209
6534
|
if (isJson(val)) {
|
|
6210
6535
|
continue; // as above: nothing to select from an un-loaded entry
|
|
@@ -6212,7 +6537,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
6212
6537
|
if (val === null || val === undefined) {
|
|
6213
6538
|
continue;
|
|
6214
6539
|
}
|
|
6215
|
-
if (window !== null && !window.wantsUnder(unsafeCreateSourcePath(sourcePath,
|
|
6540
|
+
if (window !== null && !window.wantsUnder(unsafeCreateSourcePath(sourcePath, _key3))) {
|
|
6216
6541
|
continue;
|
|
6217
6542
|
}
|
|
6218
6543
|
// Per KEY, not per record: the closure is user code, and one entry whose
|
|
@@ -6224,26 +6549,37 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
6224
6549
|
var title = _item.title,
|
|
6225
6550
|
subtitle = _item.subtitle,
|
|
6226
6551
|
image = _item.image;
|
|
6227
|
-
items.push([
|
|
6552
|
+
items.push([_key3, {
|
|
6228
6553
|
title: title,
|
|
6229
6554
|
subtitle: subtitle,
|
|
6230
6555
|
image: image
|
|
6231
6556
|
}]);
|
|
6232
6557
|
}
|
|
6233
6558
|
} catch (e) {
|
|
6234
|
-
res[unsafeCreateSourcePath(sourcePath,
|
|
6559
|
+
res[unsafeCreateSourcePath(sourcePath, _key3)] = {
|
|
6235
6560
|
status: "error",
|
|
6236
6561
|
message: e instanceof Error ? e.message : "Unknown error"
|
|
6237
6562
|
};
|
|
6238
6563
|
}
|
|
6239
6564
|
}
|
|
6240
|
-
|
|
6565
|
+
var rows = {};
|
|
6566
|
+
rows[sourcePath] = {
|
|
6241
6567
|
status: "success",
|
|
6242
6568
|
data: {
|
|
6243
|
-
|
|
6244
|
-
|
|
6569
|
+
rows: {
|
|
6570
|
+
parent: "record",
|
|
6571
|
+
items: items
|
|
6572
|
+
}
|
|
6245
6573
|
}
|
|
6246
6574
|
};
|
|
6575
|
+
mergePreviewInto(res, rows);
|
|
6576
|
+
}
|
|
6577
|
+
// ...and what the RECORD ITSELF is called — a different closure on a
|
|
6578
|
+
// different schema. Skipped when this record is itself a ROW, whose
|
|
6579
|
+
// closure the outer container has already run. See the same block in
|
|
6580
|
+
// `array`, and `PreviewNode`.
|
|
6581
|
+
if (!selfIsReifiedByParent) {
|
|
6582
|
+
mergePreviewInto(res, this.executeSelfPreview(sourcePath, src, scope));
|
|
6247
6583
|
}
|
|
6248
6584
|
return res;
|
|
6249
6585
|
}
|
|
@@ -6368,6 +6704,16 @@ function record(keyOrSchema, schema) {
|
|
|
6368
6704
|
* written without removing the key.
|
|
6369
6705
|
*/
|
|
6370
6706
|
|
|
6707
|
+
/**
|
|
6708
|
+
* How the Studio behaves for the people editing this project.
|
|
6709
|
+
*
|
|
6710
|
+
* Not how it looks — that is {@link ThemeSettingsSource} — and not one person's
|
|
6711
|
+
* own preferences, which stay in their browser. This is the project's word on
|
|
6712
|
+
* what its editors are offered, which is why it is content: a team that has
|
|
6713
|
+
* decided something about the way they work should not need a developer and a
|
|
6714
|
+
* deploy to say so.
|
|
6715
|
+
*/
|
|
6716
|
+
|
|
6371
6717
|
/**
|
|
6372
6718
|
* How the Studio looks in this project.
|
|
6373
6719
|
*
|
|
@@ -6735,11 +7081,6 @@ var LocaleSchema = /*#__PURE__*/function (_Schema) {
|
|
|
6735
7081
|
description: this.description
|
|
6736
7082
|
};
|
|
6737
7083
|
}
|
|
6738
|
-
}, {
|
|
6739
|
-
key: "executePreview",
|
|
6740
|
-
value: function executePreview() {
|
|
6741
|
-
return {};
|
|
6742
|
-
}
|
|
6743
7084
|
}]);
|
|
6744
7085
|
}(Schema);
|
|
6745
7086
|
|
|
@@ -6784,10 +7125,13 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
|
|
|
6784
7125
|
/**
|
|
6785
7126
|
* Describe this field.
|
|
6786
7127
|
*
|
|
6787
|
-
* The description is shown
|
|
6788
|
-
*
|
|
6789
|
-
*
|
|
6790
|
-
*
|
|
7128
|
+
* The description is INPUT HELP: it is shown where this field's value is
|
|
7129
|
+
* entered — beside its input in the Val editor, and for a record's key
|
|
7130
|
+
* schema in every form that asks for a key — so it is where you say what an
|
|
7131
|
+
* editor needs to know to fill it in RIGHT, which the field name cannot
|
|
7132
|
+
* carry. It is not a name for the value: that is `.preview(...)`, and it is
|
|
7133
|
+
* read somewhere else. The description also travels in the serialized
|
|
7134
|
+
* schema, which is what the AI assistant and the MCP tools read.
|
|
6791
7135
|
*
|
|
6792
7136
|
* Pass `null` to clear a description set earlier.
|
|
6793
7137
|
*
|
|
@@ -6961,11 +7305,6 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
|
|
|
6961
7305
|
description: this.description
|
|
6962
7306
|
};
|
|
6963
7307
|
}
|
|
6964
|
-
}, {
|
|
6965
|
-
key: "executePreview",
|
|
6966
|
-
value: function executePreview() {
|
|
6967
|
-
return {};
|
|
6968
|
-
}
|
|
6969
7308
|
}]);
|
|
6970
7309
|
}(Schema);
|
|
6971
7310
|
var _boolean = function _boolean() {
|
|
@@ -7478,10 +7817,13 @@ var ColorSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7478
7817
|
/**
|
|
7479
7818
|
* Describe this field.
|
|
7480
7819
|
*
|
|
7481
|
-
* The description is shown
|
|
7482
|
-
*
|
|
7483
|
-
*
|
|
7484
|
-
*
|
|
7820
|
+
* The description is INPUT HELP: it is shown where this field's value is
|
|
7821
|
+
* entered — beside its input in the Val editor, and for a record's key
|
|
7822
|
+
* schema in every form that asks for a key — so it is where you say what an
|
|
7823
|
+
* editor needs to know to fill it in RIGHT, which the field name cannot
|
|
7824
|
+
* carry. It is not a name for the value: that is `.preview(...)`, and it is
|
|
7825
|
+
* read somewhere else. The description also travels in the serialized
|
|
7826
|
+
* schema, which is what the AI assistant and the MCP tools read.
|
|
7485
7827
|
*
|
|
7486
7828
|
* Pass `null` to clear a description set earlier.
|
|
7487
7829
|
*
|
|
@@ -7705,11 +8047,6 @@ var ColorSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7705
8047
|
description: this.description
|
|
7706
8048
|
};
|
|
7707
8049
|
}
|
|
7708
|
-
}, {
|
|
7709
|
-
key: "executePreview",
|
|
7710
|
-
value: function executePreview() {
|
|
7711
|
-
return {};
|
|
7712
|
-
}
|
|
7713
8050
|
}]);
|
|
7714
8051
|
}(Schema);
|
|
7715
8052
|
var color = function color(options) {
|
|
@@ -7760,10 +8097,13 @@ var EnumSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7760
8097
|
/**
|
|
7761
8098
|
* Describe this field.
|
|
7762
8099
|
*
|
|
7763
|
-
* The description is shown
|
|
7764
|
-
*
|
|
7765
|
-
*
|
|
7766
|
-
*
|
|
8100
|
+
* The description is INPUT HELP: it is shown where this field's value is
|
|
8101
|
+
* entered — beside its input in the Val editor, and for a record's key
|
|
8102
|
+
* schema in every form that asks for a key — so it is where you say what an
|
|
8103
|
+
* editor needs to know to fill it in RIGHT, which the field name cannot
|
|
8104
|
+
* carry. It is not a name for the value: that is `.preview(...)`, and it is
|
|
8105
|
+
* read somewhere else. The description also travels in the serialized
|
|
8106
|
+
* schema, which is what the AI assistant and the MCP tools read.
|
|
7767
8107
|
*
|
|
7768
8108
|
* Pass `null` to clear a description set earlier.
|
|
7769
8109
|
*
|
|
@@ -7976,12 +8316,6 @@ var EnumSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7976
8316
|
description: this.description
|
|
7977
8317
|
};
|
|
7978
8318
|
}
|
|
7979
|
-
}, {
|
|
7980
|
-
key: "executePreview",
|
|
7981
|
-
value: function executePreview() {
|
|
7982
|
-
// A leaf: nothing below it to preview.
|
|
7983
|
-
return {};
|
|
7984
|
-
}
|
|
7985
8319
|
}]);
|
|
7986
8320
|
}(Schema);
|
|
7987
8321
|
|
|
@@ -8321,7 +8655,7 @@ var SettingsSchema = /*#__PURE__*/function (_Schema) {
|
|
|
8321
8655
|
}
|
|
8322
8656
|
}, {
|
|
8323
8657
|
key: "executePreview",
|
|
8324
|
-
value: function executePreview(sourcePath, src, scope) {
|
|
8658
|
+
value: function executePreview(sourcePath, src, scope, selfIsReifiedByParent) {
|
|
8325
8659
|
var res = {};
|
|
8326
8660
|
if (src === null) {
|
|
8327
8661
|
return res;
|
|
@@ -8335,11 +8669,14 @@ var SettingsSchema = /*#__PURE__*/function (_Schema) {
|
|
|
8335
8669
|
if (scope !== undefined && !scope.wantsUnder(subPath)) {
|
|
8336
8670
|
continue;
|
|
8337
8671
|
}
|
|
8338
|
-
|
|
8339
|
-
|
|
8340
|
-
|
|
8341
|
-
|
|
8342
|
-
|
|
8672
|
+
mergePreviewInto(res, this.items[_key4]["executePreview"](subPath, itemSrc, scope));
|
|
8673
|
+
}
|
|
8674
|
+
// An object reifies no rows of its own, so the only thing it adds is what
|
|
8675
|
+
// IT is called — which nothing else can supply for a field of an object.
|
|
8676
|
+
// Its own items are NOT rows, so the flag stops here rather than travelling
|
|
8677
|
+
// down with the recursion above.
|
|
8678
|
+
if (!selfIsReifiedByParent) {
|
|
8679
|
+
mergePreviewInto(res, this.executeSelfPreview(sourcePath, src, scope));
|
|
8343
8680
|
}
|
|
8344
8681
|
return res;
|
|
8345
8682
|
}
|
|
@@ -8402,6 +8739,9 @@ function settings() {
|
|
|
8402
8739
|
dir: THEME_LOGO_DIRECTORY
|
|
8403
8740
|
}).nullable().describe("The project's own mark, shown where Val's is in the Studio. A square-ish mark rather than a wordmark: the slot is 32px wide.")
|
|
8404
8741
|
}),
|
|
8742
|
+
studio: new SettingsSchema({
|
|
8743
|
+
tour: _boolean().nullable().describe("Whether editors are offered the guided tour of the Studio. Unset means yes. Off hides the offer for everyone on this project — the tour stays in Quick actions for anyone who wants it.")
|
|
8744
|
+
}),
|
|
8405
8745
|
locales: new SettingsSchema({
|
|
8406
8746
|
// Nullable because the source type is, and because the Studio writes
|
|
8407
8747
|
// `null` for every sibling the first time a section is created.
|
|
@@ -8579,10 +8919,25 @@ function resolvePath(path, valModule, schema) {
|
|
|
8579
8919
|
if (_typeof(resolvedSource) !== "object" && !Array.isArray(resolvedSource)) {
|
|
8580
8920
|
throw Error("Schema type error: expected source to be type of record, but got ".concat(_typeof(resolvedSource)));
|
|
8581
8921
|
}
|
|
8582
|
-
|
|
8922
|
+
// PRESENCE, not truthiness. An entry that exists and is falsy is an
|
|
8923
|
+
// entry: `null` for a declared key nobody has written yet, but also `""`,
|
|
8924
|
+
// `0` and `false` in any record at all. Testing the value made every one
|
|
8925
|
+
// of those report as a key the record does not have, so nothing could
|
|
8926
|
+
// resolve them — not the Studio, not the language server, not a fix.
|
|
8927
|
+
//
|
|
8928
|
+
// A record source that is itself `null` keeps resolving as `null`, one
|
|
8929
|
+
// part per level, the way the object branch below does: the path still
|
|
8930
|
+
// names a real place in the schema, and the caller wants the schema
|
|
8931
|
+
// there in order to say that nothing is written yet.
|
|
8932
|
+
//
|
|
8933
|
+
// `hasOwnProperty`, never `in`: `in` walks the prototype chain, so
|
|
8934
|
+
// `"toString"` would resolve on every record and hand back
|
|
8935
|
+
// `Object.prototype.toString` as if it were Source. Same reason
|
|
8936
|
+
// `patch/json.ts` guards every key it reads.
|
|
8937
|
+
if (resolvedSource !== null && !Object.prototype.hasOwnProperty.call(resolvedSource, part)) {
|
|
8583
8938
|
throw Error("Invalid path: record source did not have key ".concat(part, " from path: ").concat(path));
|
|
8584
8939
|
}
|
|
8585
|
-
resolvedSource = resolvedSource[part];
|
|
8940
|
+
resolvedSource = resolvedSource === null ? resolvedSource : resolvedSource[part];
|
|
8586
8941
|
resolvedSchema = resolvedSchema instanceof RecordSchema ? (_resolvedSchema2 = resolvedSchema) === null || _resolvedSchema2 === void 0 ? void 0 : _resolvedSchema2["item"] : resolvedSchema.item;
|
|
8587
8942
|
// A `.jsonValues()` entry value is a lazily-loaded JsonSource marker. We
|
|
8588
8943
|
// can resolve the entry itself (schema is now `item`), but we cannot
|
|
@@ -8784,7 +9139,15 @@ function safeResolvePath(path, valModule, schema) {
|
|
|
8784
9139
|
}
|
|
8785
9140
|
};
|
|
8786
9141
|
}
|
|
8787
|
-
|
|
9142
|
+
// A `null` record keeps resolving as `null`, as the object branch below
|
|
9143
|
+
// does — see the same note in `resolvePath`. Without it, indexing `null`
|
|
9144
|
+
// threw a TypeError out of the function whose whole point is not to
|
|
9145
|
+
// throw.
|
|
9146
|
+
//
|
|
9147
|
+
// Own properties only. Testing `resolvedSource[part] === undefined` let
|
|
9148
|
+
// an inherited name through — `"toString"` is not undefined on any
|
|
9149
|
+
// object — so the walk continued into `Object.prototype`.
|
|
9150
|
+
if (resolvedSource !== null && !Object.prototype.hasOwnProperty.call(resolvedSource, part)) {
|
|
8788
9151
|
return {
|
|
8789
9152
|
v: {
|
|
8790
9153
|
status: "source-undefined",
|
|
@@ -8794,7 +9157,7 @@ function safeResolvePath(path, valModule, schema) {
|
|
|
8794
9157
|
}
|
|
8795
9158
|
};
|
|
8796
9159
|
}
|
|
8797
|
-
resolvedSource = resolvedSource[part];
|
|
9160
|
+
resolvedSource = resolvedSource === null ? resolvedSource : resolvedSource[part];
|
|
8798
9161
|
resolvedSchema = resolvedSchema instanceof RecordSchema ? (_resolvedSchema4 = resolvedSchema) === null || _resolvedSchema4 === void 0 ? void 0 : _resolvedSchema4["item"] : resolvedSchema.item;
|
|
8799
9162
|
// jsonValues entry: cannot descend deeper until the backing `*.val.json`
|
|
8800
9163
|
// content is loaded into the source tree.
|
|
@@ -9053,10 +9416,13 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
|
|
|
9053
9416
|
/**
|
|
9054
9417
|
* Describe this field.
|
|
9055
9418
|
*
|
|
9056
|
-
* The description is shown
|
|
9057
|
-
*
|
|
9058
|
-
*
|
|
9059
|
-
*
|
|
9419
|
+
* The description is INPUT HELP: it is shown where this field's value is
|
|
9420
|
+
* entered — beside its input in the Val editor, and for a record's key
|
|
9421
|
+
* schema in every form that asks for a key — so it is where you say what an
|
|
9422
|
+
* editor needs to know to fill it in RIGHT, which the field name cannot
|
|
9423
|
+
* carry. It is not a name for the value: that is `.preview(...)`, and it is
|
|
9424
|
+
* read somewhere else. The description also travels in the serialized
|
|
9425
|
+
* schema, which is what the AI assistant and the MCP tools read.
|
|
9060
9426
|
*
|
|
9061
9427
|
* Pass `null` to clear a description set earlier.
|
|
9062
9428
|
*
|
|
@@ -9280,11 +9646,6 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
|
|
|
9280
9646
|
description: this.description
|
|
9281
9647
|
};
|
|
9282
9648
|
}
|
|
9283
|
-
}, {
|
|
9284
|
-
key: "executePreview",
|
|
9285
|
-
value: function executePreview() {
|
|
9286
|
-
return {};
|
|
9287
|
-
}
|
|
9288
9649
|
}]);
|
|
9289
9650
|
}(Schema);
|
|
9290
9651
|
var number = function number(options) {
|
|
@@ -9397,10 +9758,13 @@ var KeyOfSchema = /*#__PURE__*/function (_Schema) {
|
|
|
9397
9758
|
/**
|
|
9398
9759
|
* Describe this field.
|
|
9399
9760
|
*
|
|
9400
|
-
* The description is shown
|
|
9401
|
-
*
|
|
9402
|
-
*
|
|
9403
|
-
*
|
|
9761
|
+
* The description is INPUT HELP: it is shown where this field's value is
|
|
9762
|
+
* entered — beside its input in the Val editor, and for a record's key
|
|
9763
|
+
* schema in every form that asks for a key — so it is where you say what an
|
|
9764
|
+
* editor needs to know to fill it in RIGHT, which the field name cannot
|
|
9765
|
+
* carry. It is not a name for the value: that is `.preview(...)`, and it is
|
|
9766
|
+
* read somewhere else. The description also travels in the serialized
|
|
9767
|
+
* schema, which is what the AI assistant and the MCP tools read.
|
|
9404
9768
|
*
|
|
9405
9769
|
* Pass `null` to clear a description set earlier.
|
|
9406
9770
|
*
|
|
@@ -9682,11 +10046,6 @@ var KeyOfSchema = /*#__PURE__*/function (_Schema) {
|
|
|
9682
10046
|
description: this.description
|
|
9683
10047
|
};
|
|
9684
10048
|
}
|
|
9685
|
-
}, {
|
|
9686
|
-
key: "executePreview",
|
|
9687
|
-
value: function executePreview() {
|
|
9688
|
-
return {};
|
|
9689
|
-
}
|
|
9690
10049
|
}]);
|
|
9691
10050
|
}(Schema);
|
|
9692
10051
|
var keyOf = function keyOf(valModule) {
|
|
@@ -9743,10 +10102,13 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
9743
10102
|
/**
|
|
9744
10103
|
* Describe this field.
|
|
9745
10104
|
*
|
|
9746
|
-
* The description is shown
|
|
9747
|
-
*
|
|
9748
|
-
*
|
|
9749
|
-
*
|
|
10105
|
+
* The description is INPUT HELP: it is shown where this field's value is
|
|
10106
|
+
* entered — beside its input in the Val editor, and for a record's key
|
|
10107
|
+
* schema in every form that asks for a key — so it is where you say what an
|
|
10108
|
+
* editor needs to know to fill it in RIGHT, which the field name cannot
|
|
10109
|
+
* carry. It is not a name for the value: that is `.preview(...)`, and it is
|
|
10110
|
+
* read somewhere else. The description also travels in the serialized
|
|
10111
|
+
* schema, which is what the AI assistant and the MCP tools read.
|
|
9750
10112
|
*
|
|
9751
10113
|
* Pass `null` to clear a description set earlier.
|
|
9752
10114
|
*
|
|
@@ -10087,11 +10449,6 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10087
10449
|
description: this.description
|
|
10088
10450
|
};
|
|
10089
10451
|
}
|
|
10090
|
-
}, {
|
|
10091
|
-
key: "executePreview",
|
|
10092
|
-
value: function executePreview() {
|
|
10093
|
-
return {};
|
|
10094
|
-
}
|
|
10095
10452
|
}]);
|
|
10096
10453
|
}(Schema);
|
|
10097
10454
|
|
|
@@ -10184,10 +10541,13 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10184
10541
|
/**
|
|
10185
10542
|
* Describe this field.
|
|
10186
10543
|
*
|
|
10187
|
-
* The description is shown
|
|
10188
|
-
*
|
|
10189
|
-
*
|
|
10190
|
-
*
|
|
10544
|
+
* The description is INPUT HELP: it is shown where this field's value is
|
|
10545
|
+
* entered — beside its input in the Val editor, and for a record's key
|
|
10546
|
+
* schema in every form that asks for a key — so it is where you say what an
|
|
10547
|
+
* editor needs to know to fill it in RIGHT, which the field name cannot
|
|
10548
|
+
* carry. It is not a name for the value: that is `.preview(...)`, and it is
|
|
10549
|
+
* read somewhere else. The description also travels in the serialized
|
|
10550
|
+
* schema, which is what the AI assistant and the MCP tools read.
|
|
10191
10551
|
*
|
|
10192
10552
|
* Pass `null` to clear a description set earlier.
|
|
10193
10553
|
*
|
|
@@ -10432,11 +10792,6 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10432
10792
|
description: this.description
|
|
10433
10793
|
};
|
|
10434
10794
|
}
|
|
10435
|
-
}, {
|
|
10436
|
-
key: "executePreview",
|
|
10437
|
-
value: function executePreview() {
|
|
10438
|
-
return {};
|
|
10439
|
-
}
|
|
10440
10795
|
}]);
|
|
10441
10796
|
}(Schema);
|
|
10442
10797
|
var date = function date(options) {
|
|
@@ -10469,10 +10824,13 @@ var DateTimeSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10469
10824
|
/**
|
|
10470
10825
|
* Describe this field.
|
|
10471
10826
|
*
|
|
10472
|
-
* The description is shown
|
|
10473
|
-
*
|
|
10474
|
-
*
|
|
10475
|
-
*
|
|
10827
|
+
* The description is INPUT HELP: it is shown where this field's value is
|
|
10828
|
+
* entered — beside its input in the Val editor, and for a record's key
|
|
10829
|
+
* schema in every form that asks for a key — so it is where you say what an
|
|
10830
|
+
* editor needs to know to fill it in RIGHT, which the field name cannot
|
|
10831
|
+
* carry. It is not a name for the value: that is `.preview(...)`, and it is
|
|
10832
|
+
* read somewhere else. The description also travels in the serialized
|
|
10833
|
+
* schema, which is what the AI assistant and the MCP tools read.
|
|
10476
10834
|
*
|
|
10477
10835
|
* Pass `null` to clear a description set earlier.
|
|
10478
10836
|
*
|
|
@@ -10772,11 +11130,6 @@ var DateTimeSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10772
11130
|
description: this.description
|
|
10773
11131
|
};
|
|
10774
11132
|
}
|
|
10775
|
-
}, {
|
|
10776
|
-
key: "executePreview",
|
|
10777
|
-
value: function executePreview() {
|
|
10778
|
-
return {};
|
|
10779
|
-
}
|
|
10780
11133
|
}]);
|
|
10781
11134
|
}(Schema);
|
|
10782
11135
|
var datetime = function datetime(options) {
|
|
@@ -10823,10 +11176,13 @@ var CodeSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10823
11176
|
/**
|
|
10824
11177
|
* Describe this field.
|
|
10825
11178
|
*
|
|
10826
|
-
* The description is shown
|
|
10827
|
-
*
|
|
10828
|
-
*
|
|
10829
|
-
*
|
|
11179
|
+
* The description is INPUT HELP: it is shown where this field's value is
|
|
11180
|
+
* entered — beside its input in the Val editor, and for a record's key
|
|
11181
|
+
* schema in every form that asks for a key — so it is where you say what an
|
|
11182
|
+
* editor needs to know to fill it in RIGHT, which the field name cannot
|
|
11183
|
+
* carry. It is not a name for the value: that is `.preview(...)`, and it is
|
|
11184
|
+
* read somewhere else. The description also travels in the serialized
|
|
11185
|
+
* schema, which is what the AI assistant and the MCP tools read.
|
|
10830
11186
|
*
|
|
10831
11187
|
* Pass `null` to clear a description set earlier.
|
|
10832
11188
|
*
|
|
@@ -11017,11 +11373,6 @@ var CodeSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11017
11373
|
description: this.description
|
|
11018
11374
|
};
|
|
11019
11375
|
}
|
|
11020
|
-
}, {
|
|
11021
|
-
key: "executePreview",
|
|
11022
|
-
value: function executePreview() {
|
|
11023
|
-
return {};
|
|
11024
|
-
}
|
|
11025
11376
|
}]);
|
|
11026
11377
|
}(Schema);
|
|
11027
11378
|
var code = function code(options) {
|
|
@@ -12595,142 +12946,31 @@ function deserializeSchemaImpl(serialized) {
|
|
|
12595
12946
|
}
|
|
12596
12947
|
|
|
12597
12948
|
/**
|
|
12598
|
-
*
|
|
12599
|
-
* in a sortable list, a key in a reference dropdown, a search hit, a
|
|
12600
|
-
* reference — which is everywhere the value is NAVIGABLE to rather than open.
|
|
12601
|
-
* It is never how the field itself is edited: that is a RENDER (`render.ts`),
|
|
12602
|
-
* which applies only when you are looking at the field. The two do not
|
|
12603
|
-
* intersect — a schema can carry both, and each is read in its own places.
|
|
12604
|
-
*
|
|
12605
|
-
* A preview is declared on the schema of the VALUE being previewed:
|
|
12606
|
-
*
|
|
12607
|
-
* ```ts
|
|
12608
|
-
* const author = s.object({ name: s.string() })
|
|
12609
|
-
* .preview(({ val }) => ({ title: val.name }));
|
|
12610
|
-
* const authors = s.array(author);
|
|
12611
|
-
* ```
|
|
12612
|
-
*
|
|
12613
|
-
* The container reifies its rows by running each ITEM's preview closure — see
|
|
12614
|
-
* {@link ArrayPreview} / {@link RecordPreview}. (Previews used to be declared
|
|
12615
|
-
* on the container instead; a `.preview` on an array/record now previews the
|
|
12616
|
-
* array/record itself as a value, for when IT is the item of something.)
|
|
12617
|
-
*/
|
|
12618
|
-
/**
|
|
12619
|
-
* What a preview shows for one value: the user's `preview` callback returns
|
|
12620
|
-
* this, and the Studio draws a row from it.
|
|
12621
|
-
*
|
|
12622
|
-
* NB: {@link ArrayPreview} / {@link RecordPreview} name the DATA a container
|
|
12623
|
-
* previews with. The Studio also has React components called `ArrayPreview` /
|
|
12624
|
-
* `RecordPreview` (the fallback rendering of an array / record field, part of
|
|
12625
|
-
* the `<Type>Preview` convention in `components/Preview.tsx`). They do not
|
|
12626
|
-
* collide today because no file needs both - if one ever does, alias this type
|
|
12627
|
-
* at the import rather than renaming that convention.
|
|
12628
|
-
*/
|
|
12629
|
-
|
|
12630
|
-
/**
|
|
12631
|
-
* What `.preview(...)` takes, on every schema: the value's own source in, a
|
|
12632
|
-
* {@link PreviewItem} out. `NonNullable` because a container skips null items
|
|
12633
|
-
* rather than previewing them.
|
|
12949
|
+
* THE RULE, and the only sentence that needs to be remembered:
|
|
12634
12950
|
*
|
|
12635
|
-
*
|
|
12636
|
-
*
|
|
12637
|
-
*
|
|
12638
|
-
*
|
|
12639
|
-
* `NonNullable<Src>` while `Src` is still a type parameter — every schema's
|
|
12640
|
-
* `nullable()` would need a cast instead.
|
|
12641
|
-
*/
|
|
12642
|
-
|
|
12643
|
-
/**
|
|
12644
|
-
* Main preview type.
|
|
12951
|
+
* **`.describe()` is INPUT HELP and is shown wherever that field — or a
|
|
12952
|
+
* record's key — is being ENTERED; `.preview()` is a NAME and is shown
|
|
12953
|
+
* wherever the value is REFERRED TO rather than edited; `.render()` is
|
|
12954
|
+
* LAYOUT and applies only while the field is open in front of you.**
|
|
12645
12955
|
*
|
|
12646
|
-
*
|
|
12647
|
-
*
|
|
12648
|
-
*
|
|
12649
|
-
*
|
|
12650
|
-
|
|
12651
|
-
|
|
12652
|
-
/**
|
|
12653
|
-
* Which paths a preview is being computed FOR.
|
|
12654
|
-
*
|
|
12655
|
-
* `executePreview` takes a whole module, so one request has always walked every
|
|
12656
|
-
* node in it and run every `preview` closure - for `handboka`, with `preview` at
|
|
12657
|
-
* two nested array levels, that is every chapter and every section to serve one
|
|
12658
|
-
* visible row. A scope is what makes the walk proportional to what is being
|
|
12659
|
-
* looked at instead of to the project.
|
|
12956
|
+
* The test that settles every case: **can the reader change something here?**
|
|
12957
|
+
* If yes it is a place for a description — the input beside a label, the key
|
|
12958
|
+
* box in "New entry", "Rename key", "Duplicate", "New page", the key half of a
|
|
12959
|
+
* reference dropdown. If no, it is a place for a preview — a list row, a
|
|
12960
|
+
* reference once chosen, a search hit, a sitemap row, the heading of what you
|
|
12961
|
+
* navigated to.
|
|
12660
12962
|
*
|
|
12661
|
-
*
|
|
12662
|
-
*
|
|
12663
|
-
*
|
|
12664
|
-
*
|
|
12665
|
-
*
|
|
12666
|
-
*
|
|
12667
|
-
*
|
|
12668
|
-
* path is not wanted but which has wanted descendants previews a WINDOW: only
|
|
12669
|
-
* the items that were asked for. That is the case a single visible row is, and
|
|
12670
|
-
* it is why {@link ArrayPreview} carries indices.
|
|
12963
|
+
* That is why a description is plain data on the serialized schema and a
|
|
12964
|
+
* preview is a closure: a description is true before any value exists and says
|
|
12965
|
+
* the same thing to everyone filling the field in, and a preview cannot exist
|
|
12966
|
+
* without the one value it names. So a description must never be used as a
|
|
12967
|
+
* subtitle — it would repeat one sentence under every row of a list — and a
|
|
12968
|
+
* preview must never be used as help text, because there is nothing to preview
|
|
12969
|
+
* until after the value has been entered.
|
|
12671
12970
|
*
|
|
12672
|
-
*
|
|
12673
|
-
*
|
|
12971
|
+
* None of the three substitutes for another: a field with a perfect
|
|
12972
|
+
* description still previews as `#3` until someone writes the preview.
|
|
12674
12973
|
*/
|
|
12675
|
-
|
|
12676
|
-
/**
|
|
12677
|
-
* A scope covering exactly `paths` and their subtrees.
|
|
12678
|
-
*
|
|
12679
|
-
* Compares SEGMENTS rather than string prefixes. A source path's module path is
|
|
12680
|
-
* a quoted, dot-joined encoding (`?p="a".1."b"`), so `startsWith` gets the
|
|
12681
|
-
* ancestor test wrong wherever a key is a prefix of a sibling key or contains a
|
|
12682
|
-
* dot or a quote - `"title"` against `"titles"` being the cheapest example.
|
|
12683
|
-
* Segments are parsed once here, not per comparison.
|
|
12684
|
-
*/
|
|
12685
|
-
function previewScope(paths) {
|
|
12686
|
-
var wanted = paths.map(function (path) {
|
|
12687
|
-
var _splitModuleFilePathA = splitModuleFilePathAndModulePath(path),
|
|
12688
|
-
_splitModuleFilePathA2 = _slicedToArray(_splitModuleFilePathA, 2),
|
|
12689
|
-
moduleFilePath = _splitModuleFilePathA2[0],
|
|
12690
|
-
modulePath = _splitModuleFilePathA2[1];
|
|
12691
|
-
return {
|
|
12692
|
-
moduleFilePath: moduleFilePath,
|
|
12693
|
-
segments: modulePath === "" ? [] : splitModulePath(modulePath)
|
|
12694
|
-
};
|
|
12695
|
-
});
|
|
12696
|
-
var parse = function parse(path) {
|
|
12697
|
-
var _splitModuleFilePathA3 = splitModuleFilePathAndModulePath(path),
|
|
12698
|
-
_splitModuleFilePathA4 = _slicedToArray(_splitModuleFilePathA3, 2),
|
|
12699
|
-
moduleFilePath = _splitModuleFilePathA4[0],
|
|
12700
|
-
modulePath = _splitModuleFilePathA4[1];
|
|
12701
|
-
return {
|
|
12702
|
-
moduleFilePath: moduleFilePath,
|
|
12703
|
-
segments: modulePath === "" ? [] : splitModulePath(modulePath)
|
|
12704
|
-
};
|
|
12705
|
-
};
|
|
12706
|
-
var isPrefix = function isPrefix(prefix, of) {
|
|
12707
|
-
if (prefix.length > of.length) return false;
|
|
12708
|
-
for (var i = 0; i < prefix.length; i++) {
|
|
12709
|
-
if (prefix[i] !== of[i]) return false;
|
|
12710
|
-
}
|
|
12711
|
-
return true;
|
|
12712
|
-
};
|
|
12713
|
-
return {
|
|
12714
|
-
wants: function wants(path) {
|
|
12715
|
-
var at = parse(path);
|
|
12716
|
-
return wanted.some(function (entry) {
|
|
12717
|
-
return entry.moduleFilePath === at.moduleFilePath && entry.segments.length === at.segments.length && isPrefix(entry.segments, at.segments);
|
|
12718
|
-
});
|
|
12719
|
-
},
|
|
12720
|
-
wantsUnder: function wantsUnder(path) {
|
|
12721
|
-
var at = parse(path);
|
|
12722
|
-
return wanted.some(function (entry) {
|
|
12723
|
-
return entry.moduleFilePath === at.moduleFilePath && (
|
|
12724
|
-
// Either direction: a wanted path below `path` means recurse into it,
|
|
12725
|
-
// and a wanted path ABOVE it means the whole subtree was asked for.
|
|
12726
|
-
isPrefix(at.segments, entry.segments) || isPrefix(entry.segments, at.segments));
|
|
12727
|
-
});
|
|
12728
|
-
}
|
|
12729
|
-
};
|
|
12730
|
-
}
|
|
12731
|
-
|
|
12732
|
-
// TODO: improve this so that we do not get RawString and string, only string. Are there other things?
|
|
12733
|
-
|
|
12734
12974
|
/**
|
|
12735
12975
|
* A RENDER is how the FIELD ITSELF is laid out in the editor, and it applies
|
|
12736
12976
|
* only when you are looking at the field: `.render({ as: "inline" })` on an
|
|
@@ -13247,7 +13487,7 @@ function isPageRouter(routerId) {
|
|
|
13247
13487
|
|
|
13248
13488
|
var corePackageJson = {
|
|
13249
13489
|
name: "@valbuild/core",
|
|
13250
|
-
version: "0.
|
|
13490
|
+
version: "0.130.0",
|
|
13251
13491
|
"private": false,
|
|
13252
13492
|
description: "Val - supercharged hard-coded content",
|
|
13253
13493
|
repository: {
|