@valbuild/shared 0.133.0 → 0.134.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 CHANGED
@@ -1,5 +1,59 @@
1
1
  # @valbuild/shared
2
2
 
3
+ ## 0.134.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#680](https://github.com/valbuild/val/pull/680) [`eaa265e`](https://github.com/valbuild/val/commit/eaa265e78d9f6d2a1b685c38901612b8a3704eed) Thanks [@freekh](https://github.com/freekh)! - Add `s.view()`: point at another module, so editors can reach it from the page it belongs to.
8
+
9
+ Content that has to live in its own module — a `keyOf` target, shared settings, a route-keyed record — is invisible from the page an editor thinks of it as part of. A view field puts a row on that page's screen that leads to it:
10
+
11
+ ```ts
12
+ import employeesVal from "../data/employees.val";
13
+
14
+ const schema = s.object({
15
+ title: s.string(),
16
+ employees: s.view(employeesVal),
17
+ });
18
+
19
+ export default c.define("/app/menneskene/page.val.ts", schema, {
20
+ title: "Våre folk",
21
+ employees: { view: "/data/employees.val.ts" },
22
+ });
23
+ ```
24
+
25
+ The source is a pointer and nothing else. The module it names keeps its own source, patches, validation and address, and an editor who follows the row lands on that module's own screen — so it is clear they are changing something other pages use too.
26
+
27
+ A few things worth knowing:
28
+
29
+ - **The path autocompletes, and a wrong one does not compile.** A module now carries its own id in its type, so the source type of the field above is the literal `{ view: "/data/employees.val.ts" }`.
30
+ - **It is not readable in code.** `useVal(pageVal).employees` is a `ValView<…>` — an opaque pointer with no fields on it. Read the module it names directly, as before.
31
+ - **`view` is now a reserved object key**, like `_type` and `patch_id`: `s.object({ view: ... })` no longer compiles. A single `view: string` key is what a view pointer looks like, and an ordinary object with that shape would be indistinguishable from one.
32
+ - **Views may not form a cycle.** `A → B → A`, and a module viewing itself, are reported as module errors by `val validate` and in the Studio.
33
+ - **A pointer that disagrees with its schema is repaired automatically.** It can only happen in hand-written JSON, and the schema is the authority, so `val validate --fix` and saving in the Studio both write the module the schema names.
34
+ - **A view's `hidden` and `readonly` are its own, never the module's it points at.** A view whose target is hidden is still shown, and still leads there.
35
+
36
+ That last one comes with a change to what `hidden()` means on a **module's own schema**, which is the other half of making a shared module usable:
37
+
38
+ ```ts
39
+ // Not in the nav, and on exactly one page.
40
+ export default c.define("/data/employees.val.ts", s.record(...).hidden(), { ... });
41
+ ```
42
+
43
+ It now means the nav does not list the module — the Explorer for an ordinary module, Media for a gallery — and nothing more. Previously it also blanked the module's own page, so a module you had hidden was still in the nav and showed nothing when opened. A hidden module is now reached from an `s.view()` row, from search or from a validation error, and renders in full when you get there.
44
+
45
+ One gap worth naming rather than leaving to be discovered: a view pointing at a
46
+ module the project does not have is reported by the FIELD — the row says the
47
+ target is missing — but not by `val validate`. The schema check compares the
48
+ pointer against the schema, and the cycle check deliberately skips a target that
49
+ is not a module of the project, so neither catches it. A project-level check
50
+ belongs with them and is not here yet.
51
+
52
+ ### Patch Changes
53
+
54
+ - Updated dependencies [[`16c49ea`](https://github.com/valbuild/val/commit/16c49ea6dd97c7a96bbfdf211af9bab5884579e2), [`eaa265e`](https://github.com/valbuild/val/commit/eaa265e78d9f6d2a1b685c38901612b8a3704eed)]:
55
+ - @valbuild/core@0.134.0
56
+
3
57
  ## 0.133.0
4
58
 
5
59
  ### Minor Changes
@@ -956,7 +956,7 @@ export declare const Api: {
956
956
  message: z.ZodString;
957
957
  value: z.ZodOptional<z.ZodUnknown>;
958
958
  fatal: z.ZodOptional<z.ZodBoolean>;
959
- fixes: z.ZodOptional<z.ZodArray<z.ZodType<"image:add-metadata" | "image:check-metadata" | "image:upload-remote" | "image:download-remote" | "image:check-remote" | "images:check-remote" | "images:upload-remote" | "file:add-metadata" | "file:check-metadata" | "file:upload-remote" | "file:download-remote" | "file:check-remote" | "files:check-remote" | "files:upload-remote" | "keyof:check-keys" | "router:check-route" | "locale:check-locale" | "images:check-unique-folder" | "files:check-unique-folder" | "images:check-all-files" | "files:check-all-files" | "jsonValues:extract-entry" | "record:fill-keys" | "external:upload", unknown, z.core.$ZodTypeInternals<"image:add-metadata" | "image:check-metadata" | "image:upload-remote" | "image:download-remote" | "image:check-remote" | "images:check-remote" | "images:upload-remote" | "file:add-metadata" | "file:check-metadata" | "file:upload-remote" | "file:download-remote" | "file:check-remote" | "files:check-remote" | "files:upload-remote" | "keyof:check-keys" | "router:check-route" | "locale:check-locale" | "images:check-unique-folder" | "files:check-unique-folder" | "images:check-all-files" | "files:check-all-files" | "jsonValues:extract-entry" | "record:fill-keys" | "external:upload", unknown>>>>;
959
+ fixes: z.ZodOptional<z.ZodArray<z.ZodType<"image:add-metadata" | "image:check-metadata" | "image:upload-remote" | "image:download-remote" | "image:check-remote" | "images:check-remote" | "images:upload-remote" | "file:add-metadata" | "file:check-metadata" | "file:upload-remote" | "file:download-remote" | "file:check-remote" | "files:check-remote" | "files:upload-remote" | "keyof:check-keys" | "router:check-route" | "locale:check-locale" | "images:check-unique-folder" | "files:check-unique-folder" | "images:check-all-files" | "files:check-all-files" | "jsonValues:extract-entry" | "record:fill-keys" | "external:upload" | "view:check-module", unknown, z.core.$ZodTypeInternals<"image:add-metadata" | "image:check-metadata" | "image:upload-remote" | "image:download-remote" | "image:check-remote" | "images:check-remote" | "images:upload-remote" | "file:add-metadata" | "file:check-metadata" | "file:upload-remote" | "file:download-remote" | "file:check-remote" | "files:check-remote" | "files:upload-remote" | "keyof:check-keys" | "router:check-route" | "locale:check-locale" | "images:check-unique-folder" | "files:check-unique-folder" | "images:check-all-files" | "files:check-all-files" | "jsonValues:extract-entry" | "record:fill-keys" | "external:upload" | "view:check-module", unknown>>>>;
960
960
  }, z.core.$strip>>>>;
961
961
  }, z.core.$strip>>;
962
962
  }, z.core.$strip>;
@@ -76,4 +76,23 @@ export declare const SerializedCodeSchema: z.ZodType<SerializedCodeSchemaT>;
76
76
  export declare const SerializedLocaleSchema: z.ZodType<SerializedLocaleSchemaT>;
77
77
  export declare const SerializedRouteSchema: z.ZodType<SerializedRouteSchemaT>;
78
78
  export declare const SerializedSettingsSchema: z.ZodType<SerializedSettingsSchemaT>;
79
+ /**
80
+ * A view field shows another module and stores nothing of its own.
81
+ *
82
+ * Nothing in the type system forces this member to exist: `SerializedSchema` is
83
+ * declared as `z.ZodType<SerializedSchemaT>`, so a missing member is not a type
84
+ * error — it is a runtime parse failure of the WHOLE module's schema, since the
85
+ * containing object fails with it.
86
+ */
87
+ export declare const SerializedValViewSchema: z.ZodObject<{
88
+ type: z.ZodLiteral<"view">;
89
+ render: z.ZodOptional<z.ZodOptional<z.ZodObject<{
90
+ as: z.ZodLiteral<"inline">;
91
+ }, z.core.$strip>>>;
92
+ moduleFilePath: z.ZodType<import("@valbuild/core").ModuleFilePath, unknown, z.core.$ZodTypeInternals<import("@valbuild/core").ModuleFilePath, unknown>>;
93
+ opt: z.ZodLiteral<false>;
94
+ readonly: z.ZodOptional<z.ZodBoolean>;
95
+ hidden: z.ZodOptional<z.ZodBoolean>;
96
+ description: z.ZodOptional<z.ZodString>;
97
+ }, z.core.$strip>;
79
98
  export declare const SerializedSchema: z.ZodType<SerializedSchemaT>;
@@ -923,6 +923,10 @@ var SourcePath = zod.z.string().transform(function (path) {
923
923
  return path;
924
924
  });
925
925
 
926
+ var ModuleFilePath$1 = zod.z.string().transform(function (path) {
927
+ return path;
928
+ });
929
+
926
930
  var _excluded = ["directory"];
927
931
 
928
932
  // A render is static config, so unlike a `preview` it travels WHOLE — this
@@ -1216,7 +1220,25 @@ var SerializedSettingsSchema = zod.z.lazy(function () {
1216
1220
  section: zod.z.string().optional()
1217
1221
  }));
1218
1222
  });
1219
- var SerializedSchema = zod.z.union([SerializedStringSchema, SerializedLiteralSchema, SerializedBooleanSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedArraySchema, SerializedDiscriminatedUnionSchema, SerializedEnumSchema, SerializedRichTextSchema, SerializedRecordSchema, SerializedKeyOfSchema, SerializedRouteSchema, SerializedLocaleSchema, SerializedFileSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedColorSchema, SerializedCodeSchema, SerializedSettingsSchema, SerializedImageSchema]);
1223
+
1224
+ /**
1225
+ * A view field shows another module and stores nothing of its own.
1226
+ *
1227
+ * Nothing in the type system forces this member to exist: `SerializedSchema` is
1228
+ * declared as `z.ZodType<SerializedSchemaT>`, so a missing member is not a type
1229
+ * error — it is a runtime parse failure of the WHOLE module's schema, since the
1230
+ * containing object fails with it.
1231
+ */
1232
+ var SerializedValViewSchema = zod.z.object({
1233
+ type: zod.z.literal("view"),
1234
+ render: FieldRender.optional(),
1235
+ moduleFilePath: ModuleFilePath$1,
1236
+ opt: zod.z.literal(false),
1237
+ readonly: zod.z["boolean"]().optional(),
1238
+ hidden: zod.z["boolean"]().optional(),
1239
+ description: zod.z.string().optional()
1240
+ });
1241
+ var SerializedSchema = zod.z.union([SerializedStringSchema, SerializedLiteralSchema, SerializedBooleanSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedArraySchema, SerializedDiscriminatedUnionSchema, SerializedEnumSchema, SerializedRichTextSchema, SerializedRecordSchema, SerializedKeyOfSchema, SerializedRouteSchema, SerializedLocaleSchema, SerializedFileSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedColorSchema, SerializedCodeSchema, SerializedSettingsSchema, SerializedImageSchema, SerializedValViewSchema]);
1220
1242
 
1221
1243
  var ValCommit = zod.z.object({
1222
1244
  commitSha: zod.z.string(),
@@ -1402,7 +1424,7 @@ var ValConfig = zod.z.object({
1402
1424
  gitCommit: zod.z.string().optional(),
1403
1425
  gitBranch: zod.z.string().optional()
1404
1426
  });
1405
- var ValidationFixZ = zod.z.union([zod.z.literal("image:add-metadata"), zod.z.literal("image:check-metadata"), zod.z.literal("image:check-remote"), zod.z.literal("image:upload-remote"), zod.z.literal("image:download-remote"), zod.z.literal("images:check-remote"), zod.z.literal("images:upload-remote"), zod.z.literal("file:add-metadata"), zod.z.literal("file:check-metadata"), zod.z.literal("file:check-remote"), zod.z.literal("file:upload-remote"), zod.z.literal("file:download-remote"), zod.z.literal("files:check-remote"), zod.z.literal("files:upload-remote"), zod.z.literal("keyof:check-keys"), zod.z.literal("router:check-route"), zod.z.literal("locale:check-locale"), zod.z.literal("record:fill-keys"), zod.z.literal("images:check-unique-folder"), zod.z.literal("files:check-unique-folder"), zod.z.literal("images:check-all-files"), zod.z.literal("files:check-all-files"), zod.z.literal("jsonValues:extract-entry")]);
1427
+ var ValidationFixZ = zod.z.union([zod.z.literal("image:add-metadata"), zod.z.literal("image:check-metadata"), zod.z.literal("image:check-remote"), zod.z.literal("image:upload-remote"), zod.z.literal("image:download-remote"), zod.z.literal("images:check-remote"), zod.z.literal("images:upload-remote"), zod.z.literal("file:add-metadata"), zod.z.literal("file:check-metadata"), zod.z.literal("file:check-remote"), zod.z.literal("file:upload-remote"), zod.z.literal("file:download-remote"), zod.z.literal("files:check-remote"), zod.z.literal("files:upload-remote"), zod.z.literal("keyof:check-keys"), zod.z.literal("router:check-route"), zod.z.literal("locale:check-locale"), zod.z.literal("record:fill-keys"), zod.z.literal("images:check-unique-folder"), zod.z.literal("files:check-unique-folder"), zod.z.literal("images:check-all-files"), zod.z.literal("files:check-all-files"), zod.z.literal("jsonValues:extract-entry"), zod.z.literal("view:check-module")]);
1406
1428
  var ValidationError = zod.z.object({
1407
1429
  message: zod.z.string(),
1408
1430
  value: zod.z.unknown().optional(),
@@ -4751,6 +4773,13 @@ function emptyOf(schema, context) {
4751
4773
  }, (_schema$options$forma = (_schema$options = schema.options) === null || _schema$options === void 0 ? void 0 : _schema$options.format) !== null && _schema$options$forma !== void 0 ? _schema$options$forma : core.DEFAULT_COLOR_FORMAT);
4752
4774
  } else if (schema.type === "code") {
4753
4775
  return ""; // An empty editor: no language has a sensible starting snippet
4776
+ } else if (schema.type === "view") {
4777
+ // The pointer IS the empty value: a view has exactly one valid source, and
4778
+ // the schema knows it. A new page with a view field gets the same pointer
4779
+ // every other page's has.
4780
+ return {
4781
+ view: schema.moduleFilePath
4782
+ };
4754
4783
  }
4755
4784
  var _exhaustiveCheck = schema;
4756
4785
  throw Error("Unexpected schema type: " + JSON.stringify(_exhaustiveCheck));
@@ -5398,6 +5427,8 @@ function isSkippableFixCode(fix) {
5398
5427
  case "files:check-unique-folder":
5399
5428
  case "images:check-all-files":
5400
5429
  case "files:check-all-files":
5430
+ case "view:check-module":
5431
+ // schema is code: nothing for an editor to do
5401
5432
  return true;
5402
5433
  case "keyof:check-keys":
5403
5434
  case "router:check-route":
@@ -5879,6 +5910,12 @@ function traverseSchemaSource(source, schema, path, callback) {
5879
5910
  }
5880
5911
  return;
5881
5912
  }
5913
+ if (schema.type === "view") {
5914
+ // The source here is a pointer — a module file path, not content. Indexing
5915
+ // it would make every view a hit for its target's filename, and the target
5916
+ // is already indexed under its own path.
5917
+ return;
5918
+ }
5882
5919
 
5883
5920
  // Exhaustive check
5884
5921
  var exhaustiveCheck = schema;
@@ -6760,6 +6797,7 @@ exports.SerializedRouteSchema = SerializedRouteSchema;
6760
6797
  exports.SerializedSchema = SerializedSchema;
6761
6798
  exports.SerializedSettingsSchema = SerializedSettingsSchema;
6762
6799
  exports.SerializedStringSchema = SerializedStringSchema;
6800
+ exports.SerializedValViewSchema = SerializedValViewSchema;
6763
6801
  exports.SharedValConfig = SharedValConfig;
6764
6802
  exports.VAL_ENABLE_COOKIE_NAME = VAL_ENABLE_COOKIE_NAME;
6765
6803
  exports.VAL_GREEN_RAMP = VAL_GREEN_RAMP;
@@ -923,6 +923,10 @@ var SourcePath = zod.z.string().transform(function (path) {
923
923
  return path;
924
924
  });
925
925
 
926
+ var ModuleFilePath$1 = zod.z.string().transform(function (path) {
927
+ return path;
928
+ });
929
+
926
930
  var _excluded = ["directory"];
927
931
 
928
932
  // A render is static config, so unlike a `preview` it travels WHOLE — this
@@ -1216,7 +1220,25 @@ var SerializedSettingsSchema = zod.z.lazy(function () {
1216
1220
  section: zod.z.string().optional()
1217
1221
  }));
1218
1222
  });
1219
- var SerializedSchema = zod.z.union([SerializedStringSchema, SerializedLiteralSchema, SerializedBooleanSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedArraySchema, SerializedDiscriminatedUnionSchema, SerializedEnumSchema, SerializedRichTextSchema, SerializedRecordSchema, SerializedKeyOfSchema, SerializedRouteSchema, SerializedLocaleSchema, SerializedFileSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedColorSchema, SerializedCodeSchema, SerializedSettingsSchema, SerializedImageSchema]);
1223
+
1224
+ /**
1225
+ * A view field shows another module and stores nothing of its own.
1226
+ *
1227
+ * Nothing in the type system forces this member to exist: `SerializedSchema` is
1228
+ * declared as `z.ZodType<SerializedSchemaT>`, so a missing member is not a type
1229
+ * error — it is a runtime parse failure of the WHOLE module's schema, since the
1230
+ * containing object fails with it.
1231
+ */
1232
+ var SerializedValViewSchema = zod.z.object({
1233
+ type: zod.z.literal("view"),
1234
+ render: FieldRender.optional(),
1235
+ moduleFilePath: ModuleFilePath$1,
1236
+ opt: zod.z.literal(false),
1237
+ readonly: zod.z["boolean"]().optional(),
1238
+ hidden: zod.z["boolean"]().optional(),
1239
+ description: zod.z.string().optional()
1240
+ });
1241
+ var SerializedSchema = zod.z.union([SerializedStringSchema, SerializedLiteralSchema, SerializedBooleanSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedArraySchema, SerializedDiscriminatedUnionSchema, SerializedEnumSchema, SerializedRichTextSchema, SerializedRecordSchema, SerializedKeyOfSchema, SerializedRouteSchema, SerializedLocaleSchema, SerializedFileSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedColorSchema, SerializedCodeSchema, SerializedSettingsSchema, SerializedImageSchema, SerializedValViewSchema]);
1220
1242
 
1221
1243
  var ValCommit = zod.z.object({
1222
1244
  commitSha: zod.z.string(),
@@ -1402,7 +1424,7 @@ var ValConfig = zod.z.object({
1402
1424
  gitCommit: zod.z.string().optional(),
1403
1425
  gitBranch: zod.z.string().optional()
1404
1426
  });
1405
- var ValidationFixZ = zod.z.union([zod.z.literal("image:add-metadata"), zod.z.literal("image:check-metadata"), zod.z.literal("image:check-remote"), zod.z.literal("image:upload-remote"), zod.z.literal("image:download-remote"), zod.z.literal("images:check-remote"), zod.z.literal("images:upload-remote"), zod.z.literal("file:add-metadata"), zod.z.literal("file:check-metadata"), zod.z.literal("file:check-remote"), zod.z.literal("file:upload-remote"), zod.z.literal("file:download-remote"), zod.z.literal("files:check-remote"), zod.z.literal("files:upload-remote"), zod.z.literal("keyof:check-keys"), zod.z.literal("router:check-route"), zod.z.literal("locale:check-locale"), zod.z.literal("record:fill-keys"), zod.z.literal("images:check-unique-folder"), zod.z.literal("files:check-unique-folder"), zod.z.literal("images:check-all-files"), zod.z.literal("files:check-all-files"), zod.z.literal("jsonValues:extract-entry")]);
1427
+ var ValidationFixZ = zod.z.union([zod.z.literal("image:add-metadata"), zod.z.literal("image:check-metadata"), zod.z.literal("image:check-remote"), zod.z.literal("image:upload-remote"), zod.z.literal("image:download-remote"), zod.z.literal("images:check-remote"), zod.z.literal("images:upload-remote"), zod.z.literal("file:add-metadata"), zod.z.literal("file:check-metadata"), zod.z.literal("file:check-remote"), zod.z.literal("file:upload-remote"), zod.z.literal("file:download-remote"), zod.z.literal("files:check-remote"), zod.z.literal("files:upload-remote"), zod.z.literal("keyof:check-keys"), zod.z.literal("router:check-route"), zod.z.literal("locale:check-locale"), zod.z.literal("record:fill-keys"), zod.z.literal("images:check-unique-folder"), zod.z.literal("files:check-unique-folder"), zod.z.literal("images:check-all-files"), zod.z.literal("files:check-all-files"), zod.z.literal("jsonValues:extract-entry"), zod.z.literal("view:check-module")]);
1406
1428
  var ValidationError = zod.z.object({
1407
1429
  message: zod.z.string(),
1408
1430
  value: zod.z.unknown().optional(),
@@ -4751,6 +4773,13 @@ function emptyOf(schema, context) {
4751
4773
  }, (_schema$options$forma = (_schema$options = schema.options) === null || _schema$options === void 0 ? void 0 : _schema$options.format) !== null && _schema$options$forma !== void 0 ? _schema$options$forma : core.DEFAULT_COLOR_FORMAT);
4752
4774
  } else if (schema.type === "code") {
4753
4775
  return ""; // An empty editor: no language has a sensible starting snippet
4776
+ } else if (schema.type === "view") {
4777
+ // The pointer IS the empty value: a view has exactly one valid source, and
4778
+ // the schema knows it. A new page with a view field gets the same pointer
4779
+ // every other page's has.
4780
+ return {
4781
+ view: schema.moduleFilePath
4782
+ };
4754
4783
  }
4755
4784
  var _exhaustiveCheck = schema;
4756
4785
  throw Error("Unexpected schema type: " + JSON.stringify(_exhaustiveCheck));
@@ -5398,6 +5427,8 @@ function isSkippableFixCode(fix) {
5398
5427
  case "files:check-unique-folder":
5399
5428
  case "images:check-all-files":
5400
5429
  case "files:check-all-files":
5430
+ case "view:check-module":
5431
+ // schema is code: nothing for an editor to do
5401
5432
  return true;
5402
5433
  case "keyof:check-keys":
5403
5434
  case "router:check-route":
@@ -5879,6 +5910,12 @@ function traverseSchemaSource(source, schema, path, callback) {
5879
5910
  }
5880
5911
  return;
5881
5912
  }
5913
+ if (schema.type === "view") {
5914
+ // The source here is a pointer — a module file path, not content. Indexing
5915
+ // it would make every view a hit for its target's filename, and the target
5916
+ // is already indexed under its own path.
5917
+ return;
5918
+ }
5882
5919
 
5883
5920
  // Exhaustive check
5884
5921
  var exhaustiveCheck = schema;
@@ -6760,6 +6797,7 @@ exports.SerializedRouteSchema = SerializedRouteSchema;
6760
6797
  exports.SerializedSchema = SerializedSchema;
6761
6798
  exports.SerializedSettingsSchema = SerializedSettingsSchema;
6762
6799
  exports.SerializedStringSchema = SerializedStringSchema;
6800
+ exports.SerializedValViewSchema = SerializedValViewSchema;
6763
6801
  exports.SharedValConfig = SharedValConfig;
6764
6802
  exports.VAL_ENABLE_COOKIE_NAME = VAL_ENABLE_COOKIE_NAME;
6765
6803
  exports.VAL_GREEN_RAMP = VAL_GREEN_RAMP;
@@ -916,6 +916,10 @@ var SourcePath = z.string().transform(function (path) {
916
916
  return path;
917
917
  });
918
918
 
919
+ var ModuleFilePath$1 = z.string().transform(function (path) {
920
+ return path;
921
+ });
922
+
919
923
  var _excluded = ["directory"];
920
924
 
921
925
  // A render is static config, so unlike a `preview` it travels WHOLE — this
@@ -1209,7 +1213,25 @@ var SerializedSettingsSchema = z.lazy(function () {
1209
1213
  section: z.string().optional()
1210
1214
  }));
1211
1215
  });
1212
- var SerializedSchema = z.union([SerializedStringSchema, SerializedLiteralSchema, SerializedBooleanSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedArraySchema, SerializedDiscriminatedUnionSchema, SerializedEnumSchema, SerializedRichTextSchema, SerializedRecordSchema, SerializedKeyOfSchema, SerializedRouteSchema, SerializedLocaleSchema, SerializedFileSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedColorSchema, SerializedCodeSchema, SerializedSettingsSchema, SerializedImageSchema]);
1216
+
1217
+ /**
1218
+ * A view field shows another module and stores nothing of its own.
1219
+ *
1220
+ * Nothing in the type system forces this member to exist: `SerializedSchema` is
1221
+ * declared as `z.ZodType<SerializedSchemaT>`, so a missing member is not a type
1222
+ * error — it is a runtime parse failure of the WHOLE module's schema, since the
1223
+ * containing object fails with it.
1224
+ */
1225
+ var SerializedValViewSchema = z.object({
1226
+ type: z.literal("view"),
1227
+ render: FieldRender.optional(),
1228
+ moduleFilePath: ModuleFilePath$1,
1229
+ opt: z.literal(false),
1230
+ readonly: z["boolean"]().optional(),
1231
+ hidden: z["boolean"]().optional(),
1232
+ description: z.string().optional()
1233
+ });
1234
+ var SerializedSchema = z.union([SerializedStringSchema, SerializedLiteralSchema, SerializedBooleanSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedArraySchema, SerializedDiscriminatedUnionSchema, SerializedEnumSchema, SerializedRichTextSchema, SerializedRecordSchema, SerializedKeyOfSchema, SerializedRouteSchema, SerializedLocaleSchema, SerializedFileSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedColorSchema, SerializedCodeSchema, SerializedSettingsSchema, SerializedImageSchema, SerializedValViewSchema]);
1213
1235
 
1214
1236
  var ValCommit = z.object({
1215
1237
  commitSha: z.string(),
@@ -1395,7 +1417,7 @@ var ValConfig = z.object({
1395
1417
  gitCommit: z.string().optional(),
1396
1418
  gitBranch: z.string().optional()
1397
1419
  });
1398
- var ValidationFixZ = z.union([z.literal("image:add-metadata"), z.literal("image:check-metadata"), z.literal("image:check-remote"), z.literal("image:upload-remote"), z.literal("image:download-remote"), z.literal("images:check-remote"), z.literal("images:upload-remote"), z.literal("file:add-metadata"), z.literal("file:check-metadata"), z.literal("file:check-remote"), z.literal("file:upload-remote"), z.literal("file:download-remote"), z.literal("files:check-remote"), z.literal("files:upload-remote"), z.literal("keyof:check-keys"), z.literal("router:check-route"), z.literal("locale:check-locale"), z.literal("record:fill-keys"), z.literal("images:check-unique-folder"), z.literal("files:check-unique-folder"), z.literal("images:check-all-files"), z.literal("files:check-all-files"), z.literal("jsonValues:extract-entry")]);
1420
+ var ValidationFixZ = z.union([z.literal("image:add-metadata"), z.literal("image:check-metadata"), z.literal("image:check-remote"), z.literal("image:upload-remote"), z.literal("image:download-remote"), z.literal("images:check-remote"), z.literal("images:upload-remote"), z.literal("file:add-metadata"), z.literal("file:check-metadata"), z.literal("file:check-remote"), z.literal("file:upload-remote"), z.literal("file:download-remote"), z.literal("files:check-remote"), z.literal("files:upload-remote"), z.literal("keyof:check-keys"), z.literal("router:check-route"), z.literal("locale:check-locale"), z.literal("record:fill-keys"), z.literal("images:check-unique-folder"), z.literal("files:check-unique-folder"), z.literal("images:check-all-files"), z.literal("files:check-all-files"), z.literal("jsonValues:extract-entry"), z.literal("view:check-module")]);
1399
1421
  var ValidationError = z.object({
1400
1422
  message: z.string(),
1401
1423
  value: z.unknown().optional(),
@@ -4744,6 +4766,13 @@ function emptyOf(schema, context) {
4744
4766
  }, (_schema$options$forma = (_schema$options = schema.options) === null || _schema$options === void 0 ? void 0 : _schema$options.format) !== null && _schema$options$forma !== void 0 ? _schema$options$forma : DEFAULT_COLOR_FORMAT);
4745
4767
  } else if (schema.type === "code") {
4746
4768
  return ""; // An empty editor: no language has a sensible starting snippet
4769
+ } else if (schema.type === "view") {
4770
+ // The pointer IS the empty value: a view has exactly one valid source, and
4771
+ // the schema knows it. A new page with a view field gets the same pointer
4772
+ // every other page's has.
4773
+ return {
4774
+ view: schema.moduleFilePath
4775
+ };
4747
4776
  }
4748
4777
  var _exhaustiveCheck = schema;
4749
4778
  throw Error("Unexpected schema type: " + JSON.stringify(_exhaustiveCheck));
@@ -5391,6 +5420,8 @@ function isSkippableFixCode(fix) {
5391
5420
  case "files:check-unique-folder":
5392
5421
  case "images:check-all-files":
5393
5422
  case "files:check-all-files":
5423
+ case "view:check-module":
5424
+ // schema is code: nothing for an editor to do
5394
5425
  return true;
5395
5426
  case "keyof:check-keys":
5396
5427
  case "router:check-route":
@@ -5872,6 +5903,12 @@ function traverseSchemaSource(source, schema, path, callback) {
5872
5903
  }
5873
5904
  return;
5874
5905
  }
5906
+ if (schema.type === "view") {
5907
+ // The source here is a pointer — a module file path, not content. Indexing
5908
+ // it would make every view a hit for its target's filename, and the target
5909
+ // is already indexed under its own path.
5910
+ return;
5911
+ }
5875
5912
 
5876
5913
  // Exhaustive check
5877
5914
  var exhaustiveCheck = schema;
@@ -6671,4 +6708,4 @@ function resolvePairGround(ground, ramp) {
6671
6708
  return typeof ground === "number" ? ramp[ground] : ground;
6672
6709
  }
6673
6710
 
6674
- export { AA_LARGE, AA_TEXT, Api, BRAND_CONTRAST_PAIRS, BinaryFileRef, CodeOptions, ColorOptions, DEFAULT_ERROR_MESSAGE, DateOptions, ENCODE_DEFAULTS, ENCODE_MIME_TYPE_OF, FileOptions, HistoricalCommit, HistoricalModule, HistoricalPatchSet, HistoryError, ImageEncodeOption, ImageOptions, JSONValue, JSON_ENTRIES_BATCH_MAX, ModuleComparison, NEVER_ENCODED, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchGroup, PatchId, PatchJSON, RAMP_STEPS, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, RestoreVerdict, RichTextOptions, SCHEMA_SOURCE_FIXES, SerializedArraySchema, SerializedBooleanSchema, SerializedCodeSchema, SerializedColorSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedDiscriminatedUnionSchema, SerializedEnumSchema, SerializedFileSchema, SerializedImageSchema, SerializedKeyOfSchema, SerializedLiteralSchema, SerializedLocaleSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedRecordSchema, SerializedRichTextSchema, SerializedRouteSchema, SerializedSchema, SerializedSettingsSchema, SerializedStringSchema, SharedValConfig, VAL_ENABLE_COOKIE_NAME, VAL_GREEN_RAMP, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, ValCommit, ValDeployment, accentRamp, buildDuplicatePatch, buildEmptyAtPathPatch, buildFileRefValue, buildImageGalleryPatch, buildRemoveImageGalleryEntryPatch, buildSearchIndex, checkCompatibility, chooseEncoded, concatModulePath, contrastRatio, createRegExpFromPattern, createSearchIndex, createValClient, declaredLocales, describeContainerAtPath, emptyOf, explainIncompatible, filterBlockingValidationErrors, filterRoutesByPatterns, findSimilar, fitWithin, flattenRichText, getErrorMessageFromUnknownJson, getFilenameFromRef, getInlineImgInfo, getKeyOfRecordAt, getRefParts, getRoutesOf, getRoutesWithModulePaths, getSourceAt, indexModule, isMimeTypeAccepted, isRemoteSchema, isSchemaSourceFixError, isSkippedSource, keyOfRecordPath, levenshtein, localeAt, newestCommitSha, partitionValidationErrors, performSearch, relativeLuminance, remirrorToRichTextSource, removeModule, resolveEncodeSettings, resolvePairGround, resolveSchemaSourceFixForError, resolveSchemaSourceFixes, resolveSerializedSchemaAtPath, richTextToRemirror, safeParsePatch, sourcePathOfChild, themeCustomProperties, toolNames, traverseSchemaSource, urlOf, validateRoutePatterns, withExtension };
6711
+ export { AA_LARGE, AA_TEXT, Api, BRAND_CONTRAST_PAIRS, BinaryFileRef, CodeOptions, ColorOptions, DEFAULT_ERROR_MESSAGE, DateOptions, ENCODE_DEFAULTS, ENCODE_MIME_TYPE_OF, FileOptions, HistoricalCommit, HistoricalModule, HistoricalPatchSet, HistoryError, ImageEncodeOption, ImageOptions, JSONValue, JSON_ENTRIES_BATCH_MAX, ModuleComparison, NEVER_ENCODED, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchGroup, PatchId, PatchJSON, RAMP_STEPS, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, RestoreVerdict, RichTextOptions, SCHEMA_SOURCE_FIXES, SerializedArraySchema, SerializedBooleanSchema, SerializedCodeSchema, SerializedColorSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedDiscriminatedUnionSchema, SerializedEnumSchema, SerializedFileSchema, SerializedImageSchema, SerializedKeyOfSchema, SerializedLiteralSchema, SerializedLocaleSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedRecordSchema, SerializedRichTextSchema, SerializedRouteSchema, SerializedSchema, SerializedSettingsSchema, SerializedStringSchema, SerializedValViewSchema, SharedValConfig, VAL_ENABLE_COOKIE_NAME, VAL_GREEN_RAMP, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, ValCommit, ValDeployment, accentRamp, buildDuplicatePatch, buildEmptyAtPathPatch, buildFileRefValue, buildImageGalleryPatch, buildRemoveImageGalleryEntryPatch, buildSearchIndex, checkCompatibility, chooseEncoded, concatModulePath, contrastRatio, createRegExpFromPattern, createSearchIndex, createValClient, declaredLocales, describeContainerAtPath, emptyOf, explainIncompatible, filterBlockingValidationErrors, filterRoutesByPatterns, findSimilar, fitWithin, flattenRichText, getErrorMessageFromUnknownJson, getFilenameFromRef, getInlineImgInfo, getKeyOfRecordAt, getRefParts, getRoutesOf, getRoutesWithModulePaths, getSourceAt, indexModule, isMimeTypeAccepted, isRemoteSchema, isSchemaSourceFixError, isSkippedSource, keyOfRecordPath, levenshtein, localeAt, newestCommitSha, partitionValidationErrors, performSearch, relativeLuminance, remirrorToRichTextSource, removeModule, resolveEncodeSettings, resolvePairGround, resolveSchemaSourceFixForError, resolveSchemaSourceFixes, resolveSerializedSchemaAtPath, richTextToRemirror, safeParsePatch, sourcePathOfChild, themeCustomProperties, toolNames, traverseSchemaSource, urlOf, validateRoutePatterns, withExtension };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/shared",
3
- "version": "0.133.0",
3
+ "version": "0.134.0",
4
4
  "private": false,
5
5
  "description": "Val shared types and utilities",
6
6
  "repository": {
@@ -37,7 +37,7 @@
37
37
  "flexsearch": "^0.8.212",
38
38
  "zod": "^4.4.3",
39
39
  "zod-validation-error": "^5.0.0",
40
- "@valbuild/core": "0.130.0"
40
+ "@valbuild/core": "0.134.0"
41
41
  },
42
42
  "files": [
43
43
  "CHANGELOG.md",