@valbuild/core 0.139.1 → 0.143.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 +96 -0
- package/dist/declarations/src/getSha256.d.ts +55 -0
- package/dist/declarations/src/index.d.ts +25 -4
- package/dist/declarations/src/initSchema.d.ts +106 -55
- package/dist/declarations/src/initVal.d.ts +25 -2
- package/dist/declarations/src/mimeType/font.d.ts +36 -0
- package/dist/declarations/src/mimeType/index.d.ts +1 -0
- package/dist/declarations/src/remote/validationBasis.d.ts +3 -2
- package/dist/declarations/src/schema/file.d.ts +7 -0
- package/dist/declarations/src/schema/font.d.ts +16 -0
- package/dist/declarations/src/schema/fontset.d.ts +40 -0
- package/dist/declarations/src/schema/image.d.ts +9 -2
- package/dist/declarations/src/schema/index.d.ts +2 -1
- package/dist/declarations/src/schema/record.d.ts +16 -2
- package/dist/declarations/src/schema/richtext.d.ts +20 -1
- package/dist/declarations/src/schema/validation/ValidationFix.d.ts +1 -1
- package/dist/declarations/src/schema/video.d.ts +249 -0
- package/dist/declarations/src/schema/videoset.d.ts +141 -0
- package/dist/declarations/src/source/galleries.d.ts +20 -0
- package/dist/declarations/src/source/media.d.ts +172 -12
- package/dist/declarations/src/val/index.d.ts +4 -2
- package/dist/{index-eb9f6480.esm.js → index-02a1ba06.esm.js} +1708 -150
- package/dist/{index-7d334094.cjs.prod.js → index-46c72f01.cjs.prod.js} +1713 -149
- package/dist/{index-90000f7a.cjs.dev.js → index-aac8c69c.cjs.dev.js} +1713 -149
- package/dist/valbuild-core.cjs.dev.js +7 -1
- package/dist/valbuild-core.cjs.prod.js +7 -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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,101 @@
|
|
|
1
1
|
# @valbuild/core
|
|
2
2
|
|
|
3
|
+
## 0.143.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#813](https://github.com/valbuild/val/pull/813) [`f7c25bd`](https://github.com/valbuild/val/commit/f7c25bd4b44c288db8e5ab914e6d8a72c0216ba5) Thanks [@freekh](https://github.com/freekh)! - New: `s.font(fontsVal)`, a field that picks a font from an `s.fontset()`.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
s.object({
|
|
11
|
+
headingFont: s.font(fontsVal),
|
|
12
|
+
title: s.string(),
|
|
13
|
+
});
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
It stores `{ path }` like `s.file(fontsVal)` does, and refuses a module that is not a font set. In the Studio, a font field is shown among its object's other fields as a small row — the letter "A" set in the chosen font, and the font's file name. Click it to open the field, which shows every font in the set to pick from, an upload button, and a full specimen of the chosen font. This applies to `s.file()` fields that point at a font set too.
|
|
17
|
+
|
|
18
|
+
- [#813](https://github.com/valbuild/val/pull/813) [`729c4ed`](https://github.com/valbuild/val/commit/729c4edfa28f5a2942c435ccf225e65858b080cc) Thanks [@freekh](https://github.com/freekh)! - New: `s.fontset()`, a collection of fonts.
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
const fontsVal = c.define(
|
|
22
|
+
"/content/fonts.val.ts",
|
|
23
|
+
s.fontset({ dir: "/public/val/fonts" }),
|
|
24
|
+
{},
|
|
25
|
+
);
|
|
26
|
+
// a field that picks one of them
|
|
27
|
+
s.object({ headingFont: s.file(fontsVal) });
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
It is an `s.fileset()` whose `accept` defaults to the web font formats (`font/woff2`, `font/woff`, `font/ttf`, `font/otf`); pass `accept: "font/woff2"` to allow only WOFF2. Fonts are not converted on upload.
|
|
31
|
+
|
|
32
|
+
The Studio now previews fonts set in themselves — in the gallery, in the picker of a field that points at a font set, and in the field — wherever a file is a font, including fonts in an ordinary `s.fileset()`.
|
|
33
|
+
|
|
34
|
+
Font uploads are typed from their bytes, so a font is stored as `font/woff2`, `font/ttf` and so on even when the browser reports no type for it. Files ending in `.ttf`, `.otf` and `.woff` now map to the `font/` types rather than the older `application/x-font-*` names, which are still accepted where they are already stored.
|
|
35
|
+
|
|
36
|
+
## 0.141.0
|
|
37
|
+
|
|
38
|
+
### Minor Changes
|
|
39
|
+
|
|
40
|
+
- [#802](https://github.com/valbuild/val/pull/802) [`199e214`](https://github.com/valbuild/val/commit/199e21471d98806fb34c579cb876560078c928b9) Thanks [@freekh](https://github.com/freekh)! - New: `files: { remote: true }` in `val.config.ts` stores every image, file and video on Val's remote content host.
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
const { s, c, val, config } = initVal({
|
|
44
|
+
project: "myorg/myproject",
|
|
45
|
+
files: { remote: true },
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
With it, `s.image()`, `s.file()`, `s.video()`, `s.imageset()`, `s.fileset()`, `s.videoset()` and `s.richtext({ img: true })` behave as though `.remote()` had been written on them. Images already in the project are reported as `image:upload-remote` until they are uploaded; `npx val validate --fix` does that.
|
|
50
|
+
|
|
51
|
+
**Required in the Val app.** A project running there (`VAL_ENV=app`) refuses to start without it, with an error that says what to add, and `val publish` refuses before it builds.
|
|
52
|
+
|
|
53
|
+
**Breaking:** `files.directory` has been removed from `val.config.ts`. Local files that have no `dir` of their own are stored in `/public/val`, which was the default.
|
|
54
|
+
|
|
55
|
+
- [#779](https://github.com/valbuild/val/pull/779) [`ba3f330`](https://github.com/valbuild/val/commit/ba3f3300a3dd8649e154097cdfca3b64db209d89) Thanks [@freekh](https://github.com/freekh)! - New: `s.video()`, for mp4/WebM files and HLS streams.
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
const schema = s.object({
|
|
59
|
+
intro: s.video({ stream: { type: "hls" } }),
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- **Upload and play in the Studio.** A video field shows a player, the file's size and length, and progress while it uploads.
|
|
64
|
+
- **HLS streaming without a video service.** With `stream: { type: "hls" }`, the Studio converts an upload to an HLS stream in the editor's browser before it uploads it. It makes one H.264 rendition per height (1080p, 720p and 480p by default, and never larger than the upload) and stores them as a folder of files next to your other uploads. Nothing is installed in your app for this: the converter ships inside the Studio and is only downloaded when someone uploads to a streaming field. A browser that can't convert (no WebCodecs, or a non-https address) uploads the original file and says so.
|
|
65
|
+
- **Poster:** pause on a frame and choose "Use current frame". The frame is saved as an image, and `posterTime` records where it was taken.
|
|
66
|
+
- **Start and end:** play part of a video without cutting the file.
|
|
67
|
+
- **Focal point:** marks what must stay in frame when the page crops the video.
|
|
68
|
+
- **Description:** text for people who can't see the video.
|
|
69
|
+
- **Captions:** one WebVTT file per language. `.srt` files are converted on upload.
|
|
70
|
+
- **`<ValVideo>`** in `@valbuild/next` and `@valbuild/tanstack` renders all of the above and is click-to-edit. For HLS in browsers that can't play it natively, pass `hls={() => import("hls.js")}`. It is only loaded when it's needed.
|
|
71
|
+
- **Rename** a video in the Studio. An HLS stream is renamed as a whole: every playlist and segment moves to the new folder.
|
|
72
|
+
- `npx val validate --fix` fills in `mimeType`, `width`, `height` and `duration` for a hand-written `.mp4`, `.mov`, `.webm`, `.mkv` or HLS video, on disk or on Val Remote. A remote video is not downloaded: only its headers are read, usually in one to three small requests.
|
|
73
|
+
- `.remote()` works for videos. `npx val validate --fix` moves a video to Val Remote, or back into the project, together with its poster, captions and every file of an HLS stream.
|
|
74
|
+
|
|
75
|
+
A video value always has a `mimeType`: it is how a page knows whether it has an `.mp4` or an `.m3u8`.
|
|
76
|
+
|
|
77
|
+
New: `s.videoset()`, a collection of videos, like `s.imageset()` for images.
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
const videosVal = c.define(
|
|
81
|
+
"/content/videos.val.ts",
|
|
82
|
+
s.videoset({ dir: "/public/val/videos", stream: { type: "hls" } }),
|
|
83
|
+
{},
|
|
84
|
+
);
|
|
85
|
+
const schema = s.object({ intro: s.video(videosVal) });
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
- **Upload once, set it up once, use anywhere.** A set's entry holds what is true of the file (its type, size and length) and, as defaults, a description, poster, start and end, focal point and captions. A field that picks from the set (`s.video(videosVal)`) gets all of those, and can override any of them on its own. For example, the same clip can open one page at 0:02 and every other page where the set says.
|
|
89
|
+
- **Media in the Studio.** A set is listed under Media and opens as a gallery of videos, with each video's poster as its thumbnail. Hovering a video previews it, and the selected video plays in a real player (HLS streams too) beside the poster, times, focal point and captions you edit for it. You can upload into the set (with `stream`, uploads become HLS streams, and each upload gets a poster), rename a video, and delete a video that nothing uses. Renaming a video updates every field that uses it. An HLS stream is one entry, and renaming or deleting it moves or removes all of its files.
|
|
90
|
+
- **Picking.** A set-backed field picks from the set, or uploads into it. Each value the set provides is marked "From gallery · Override", and once overridden, "Overridden · Use gallery's".
|
|
91
|
+
- `useVal` and `fetchVal` fill in what the set holds (`mimeType`, `width`, `height`, `duration`, and every default the field does not override), so `<ValVideo>` works the same either way.
|
|
92
|
+
- `.remote()` works for sets. `npx val validate --fix` fills in missing metadata for an entry, adds untracked videos found in the set's directory, and moves a set's videos to Val Remote.
|
|
93
|
+
|
|
94
|
+
Image and file galleries use the same new gallery layout: a grid or list of entries, with the selected one open in a panel beside it.
|
|
95
|
+
|
|
96
|
+
- An `s.imageset()` entry can hold a default focal point, as well as its description. An `s.image(galleryVal)` field shows both, and can override either.
|
|
97
|
+
- Fixed: outside draft mode, `useVal` and `fetchVal` now fill a gallery-backed image or file from its gallery (dimensions, mime type, description). Before, a published page got only the `path`.
|
|
98
|
+
|
|
3
99
|
## 0.139.1
|
|
4
100
|
|
|
5
101
|
### Patch Changes
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* From: https://github.com/kawanet/sha256-uint8array/commit/a035f83824c319d01ca1e7559fdcf1632c0cd6c4
|
|
3
|
+
*
|
|
4
|
+
* LICENSE:
|
|
5
|
+
*
|
|
6
|
+
* MIT License
|
|
7
|
+
* Copyright (c) 2020-2023 Yusuke Kawasaki
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
* in the Software without restriction, including without limitation the rights
|
|
12
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
* furnished to do so, subject to the following conditions:
|
|
15
|
+
*
|
|
16
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
* copies or substantial portions of the Software.
|
|
18
|
+
*
|
|
19
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
* SOFTWARE.
|
|
26
|
+
*
|
|
27
|
+
* sha256-uint8array.ts
|
|
28
|
+
*/
|
|
29
|
+
export declare function createHash(algorithm?: string): Hash;
|
|
30
|
+
export declare class Hash {
|
|
31
|
+
private A;
|
|
32
|
+
private B;
|
|
33
|
+
private C;
|
|
34
|
+
private D;
|
|
35
|
+
private E;
|
|
36
|
+
private F;
|
|
37
|
+
private G;
|
|
38
|
+
private H;
|
|
39
|
+
private _byte;
|
|
40
|
+
private _word;
|
|
41
|
+
private _size;
|
|
42
|
+
private _sp;
|
|
43
|
+
constructor();
|
|
44
|
+
update(data: string, encoding?: string): this;
|
|
45
|
+
update(data: Uint8Array): this;
|
|
46
|
+
update(data: ArrayBufferView): this;
|
|
47
|
+
private _uint8;
|
|
48
|
+
private _utf8;
|
|
49
|
+
private _int32;
|
|
50
|
+
digest(): Uint8Array;
|
|
51
|
+
digest(encoding: string): string;
|
|
52
|
+
private _hex;
|
|
53
|
+
private _bin;
|
|
54
|
+
}
|
|
55
|
+
export declare const getSHA256Hash: (bits: Uint8Array) => string;
|
|
@@ -6,6 +6,9 @@ export { Schema, type SerializedSchema, type SelectorOfSchema } from "./schema/i
|
|
|
6
6
|
export { hasRemoteFileSchema, hasMediaSchema, } from "./schema/hasRemoteFileSchema.js";
|
|
7
7
|
export type { ImageMetadata, ImageEncodeOption, ImageEncodeOptions, } from "./schema/image.js";
|
|
8
8
|
export type { FileMetadata } from "./schema/file.js";
|
|
9
|
+
export type { GalleryVideoOptions, VideoMetadata, VideoOptions, VideoStreamOption, VideoStreamOptions, } from "./schema/video.js";
|
|
10
|
+
import { videosetEntryVideoSchema } from "./schema/videoset.js";
|
|
11
|
+
export type { VideosetEntryMetadata, VideosetOptions, SerializedVideosetSchema, } from "./schema/videoset.js";
|
|
9
12
|
export type { ValModule, SerializedModule, InferValModuleType } from "./module.js";
|
|
10
13
|
export type { SourceObject, SourcePrimitive, Source } from "./source/index.js";
|
|
11
14
|
export type { FileSource } from "./source/media.js";
|
|
@@ -15,7 +18,7 @@ export type { RemoteRef } from "./source/remote.js";
|
|
|
15
18
|
export { DEFAULT_VAL_REMOTE_HOST } from "./schema/remote.js";
|
|
16
19
|
export type { RawString } from "./schema/string.js";
|
|
17
20
|
export type { ImageSource } from "./source/media.js";
|
|
18
|
-
export type { MediaHotspot, MediaSource, GalleryImageSource, GalleryFileSource, } from "./source/media.js";
|
|
21
|
+
export type { MediaHotspot, MediaSource, GalleryImageSource, GalleryFileSource, GalleryVideoSource, VideoDefaults, IsVideoSource, VideoSource, VideoPosterSource, VideoCaptionSource, ResolvedVideo, } from "./source/media.js";
|
|
19
22
|
export type { AllRichTextOptions, Bold, Styles, HeadingNode, ImageNode, Italic, LineThrough, ListItemNode, LinkNode, OrderedListNode, ParagraphNode, BrNode, RichTextNode, RichTextOptions, SerializedRichTextOptions, RichTextSource, BlockNode, SpanNode, UnorderedListNode, } from "./source/richtext.js";
|
|
20
23
|
export { type Val, type SerializedVal, type ModuleFilePath, type PatchId, type ModulePath, type SourcePath, type JsonOfSource, type ParentPatchId, } from "./val/index.js";
|
|
21
24
|
export type { Json, JsonPrimitive, JsonArray, JsonObject } from "./Json.js";
|
|
@@ -32,7 +35,7 @@ import { ModulePath, SourcePath, getValPath, isVal } from "./val/index.js";
|
|
|
32
35
|
import { createValPathOfItem } from "./selector/SelectorProxy.js";
|
|
33
36
|
import { Operation } from "./patch/index.js";
|
|
34
37
|
import { initSchema } from "./initSchema.js";
|
|
35
|
-
import { getMimeType, mimeTypeToFileExt, filenameToMimeType, mimeTypeMatchesAccept } from "./mimeType/index.js";
|
|
38
|
+
import { getMimeType, mimeTypeToFileExt, filenameToMimeType, mimeTypeMatchesAccept, isFontMimeType, sniffFontMimeType } from "./mimeType/index.js";
|
|
36
39
|
import { type ImageMetadata } from "./schema/image.js";
|
|
37
40
|
import { type FileMetadata } from "./schema/file.js";
|
|
38
41
|
import { isJson, getJsonImport, resolveJsonValues } from "./source/json.js";
|
|
@@ -43,16 +46,19 @@ import { createRenamedFilename } from "./source/filename.js";
|
|
|
43
46
|
import { getValidationBasis, getValidationHash } from "./remote/validationBasis.js";
|
|
44
47
|
import { getFileHash, hashToRemoteFileHash } from "./remote/fileHash.js";
|
|
45
48
|
import { splitRemoteRef } from "./remote/splitRemoteRef.js";
|
|
46
|
-
import {
|
|
49
|
+
import { galleriesOf } from "./source/galleries.js";
|
|
50
|
+
import { fillFromGallery, galleryEntryOf, isHlsVideo, isRemoteMediaPath, mediaUrl, resolveMedia, resolveVideo } from "./source/media.js";
|
|
47
51
|
import { colorToHex, convertColor, detectColorFormat, formatColor, parseColor } from "./schema/colorFormat.js";
|
|
48
52
|
export { type SerializedArraySchema, ArraySchema } from "./schema/array.js";
|
|
49
53
|
export { type SerializedObjectSchema, ObjectSchema } from "./schema/object.js";
|
|
50
|
-
export { type SerializedRecordSchema, RecordSchema } from "./schema/record.js";
|
|
54
|
+
export { type SerializedRecordSchema, type MediaCollectionType, RecordSchema, } from "./schema/record.js";
|
|
51
55
|
export { type SerializedStringSchema, StringSchema } from "./schema/string.js";
|
|
52
56
|
export { type SerializedNumberSchema, NumberSchema } from "./schema/number.js";
|
|
53
57
|
export { type SerializedBooleanSchema, BooleanSchema } from "./schema/boolean.js";
|
|
54
58
|
export { type SerializedImageSchema, ImageSchema } from "./schema/image.js";
|
|
55
59
|
export { type SerializedFileSchema, FileSchema } from "./schema/file.js";
|
|
60
|
+
export { DEFAULT_FONT_ACCEPT, FONT_MIME_TYPES } from "./mimeType/font.js";
|
|
61
|
+
export { type SerializedVideoSchema, VideoSchema, DEFAULT_VIDEO_ACCEPT, DEFAULT_VIDEO_RENDITIONS, DEFAULT_VIDEO_SEGMENT_DURATION, } from "./schema/video.js";
|
|
56
62
|
export { type SerializedDateSchema, DateSchema } from "./schema/date.js";
|
|
57
63
|
export { type SerializedSettingsSchema, SettingsSchema, } from "./schema/settings.js";
|
|
58
64
|
export { type SettingsSource, type AssistantSettingsSource, type LocalesSettingsSource, type AssistantAvailability, type ThemeSettingsSource, type StudioSettingsSource, type StudioCommitMessageMode, type ThemeRadius, ASSISTANT_SETTINGS_MAX_LENGTH, THEME_LOGO_DIRECTORY, THEME_RADIUS_STEPS, THEME_RADIUS_LENGTHS, assistantAvailability, } from "./source/settings.js";
|
|
@@ -128,6 +134,7 @@ declare const Internal: {
|
|
|
128
134
|
VERSION: {
|
|
129
135
|
core: string;
|
|
130
136
|
};
|
|
137
|
+
videosetEntryVideoSchema: typeof videosetEntryVideoSchema;
|
|
131
138
|
createViewHandle: typeof createViewHandle;
|
|
132
139
|
isViewHandle: typeof isViewHandle;
|
|
133
140
|
resolveViewedModule: typeof resolveViewedModule;
|
|
@@ -135,9 +142,15 @@ declare const Internal: {
|
|
|
135
142
|
viewModulesOf: typeof viewModulesOf;
|
|
136
143
|
mediaUrl: typeof mediaUrl;
|
|
137
144
|
resolveMedia: typeof resolveMedia;
|
|
145
|
+
resolveVideo: typeof resolveVideo;
|
|
138
146
|
isRemoteMediaPath: typeof isRemoteMediaPath;
|
|
139
147
|
media: {
|
|
140
148
|
fillFromGallery: typeof fillFromGallery;
|
|
149
|
+
galleriesOf: typeof galleriesOf;
|
|
150
|
+
galleryEntryOf: typeof galleryEntryOf;
|
|
151
|
+
GALLERY_DEFAULT_GROUPS: readonly (readonly string[])[];
|
|
152
|
+
isHlsVideo: typeof isHlsVideo;
|
|
153
|
+
HLS_MIME_TYPE: string;
|
|
141
154
|
};
|
|
142
155
|
getSchema: typeof getSchema;
|
|
143
156
|
getValPath: typeof getValPath;
|
|
@@ -182,6 +195,11 @@ declare const Internal: {
|
|
|
182
195
|
isExternalFileRef: typeof isExternalFileRef;
|
|
183
196
|
createValPathOfItem: typeof createValPathOfItem;
|
|
184
197
|
getSHA256Hash: (bits: Uint8Array) => string;
|
|
198
|
+
/**
|
|
199
|
+
* The same hash as `getSHA256Hash`, fed a chunk at a time: what a caller
|
|
200
|
+
* hashing hundreds of megabytes uses to give the thread back between chunks.
|
|
201
|
+
*/
|
|
202
|
+
createSHA256Hash: () => import("./getSha256.js").Hash;
|
|
185
203
|
initSchema: typeof initSchema;
|
|
186
204
|
getMimeType: typeof getMimeType;
|
|
187
205
|
mimeTypeToFileExt: typeof mimeTypeToFileExt;
|
|
@@ -191,6 +209,9 @@ declare const Internal: {
|
|
|
191
209
|
MIME_TYPES_TO_EXT: {
|
|
192
210
|
[k: string]: string;
|
|
193
211
|
};
|
|
212
|
+
FONT_MIME_TYPE_EXTENSIONS: Record<string, string>;
|
|
213
|
+
isFontMimeType: typeof isFontMimeType;
|
|
214
|
+
sniffFontMimeType: typeof sniffFontMimeType;
|
|
194
215
|
ModuleFilePathSep: string;
|
|
195
216
|
notFileOp: (op: Operation) => op is {
|
|
196
217
|
op: "add";
|
|
@@ -13,7 +13,10 @@ import { keyOf } from "./schema/keyOf.js";
|
|
|
13
13
|
import { view } from "./schema/view.js";
|
|
14
14
|
import { record } from "./schema/record.js";
|
|
15
15
|
import { file } from "./schema/file.js";
|
|
16
|
+
import { font } from "./schema/font.js";
|
|
17
|
+
import { video } from "./schema/video.js";
|
|
16
18
|
import { fileset } from "./schema/fileset.js";
|
|
19
|
+
import { fontset } from "./schema/fontset.js";
|
|
17
20
|
import { date } from "./schema/date.js";
|
|
18
21
|
import { datetime } from "./schema/datetime.js";
|
|
19
22
|
import { code } from "./schema/code.js";
|
|
@@ -22,6 +25,7 @@ import { locale } from "./schema/locale.js";
|
|
|
22
25
|
import { route } from "./schema/route.js";
|
|
23
26
|
import { router } from "./schema/router.js";
|
|
24
27
|
import { imageset } from "./schema/imageset.js";
|
|
28
|
+
import { videoset } from "./schema/videoset.js";
|
|
25
29
|
import { settings } from "./schema/settings.js";
|
|
26
30
|
export type InitSchema = {
|
|
27
31
|
/**
|
|
@@ -217,6 +221,54 @@ export type InitSchema = {
|
|
|
217
221
|
*
|
|
218
222
|
*/
|
|
219
223
|
readonly file: typeof file;
|
|
224
|
+
/**
|
|
225
|
+
* A font picked from an `s.fontset()`: `s.file(fontsVal)` for fonts, which
|
|
226
|
+
* refuses a module that is not a font set. The Studio shows it in its parent
|
|
227
|
+
* as the font's "A" and file name, and opens it on the set to pick from.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```typescript
|
|
231
|
+
* import fontsVal from "./fonts.val"; // an s.fontset() module
|
|
232
|
+
* const schema = s.object({ headingFont: s.font(fontsVal) });
|
|
233
|
+
* // source: { headingFont: { path: "/public/val/fonts/inter_a1b2c.woff2" } }
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
236
|
+
readonly font: typeof font;
|
|
237
|
+
/**
|
|
238
|
+
* Define a video.
|
|
239
|
+
*
|
|
240
|
+
* A video is an object with a `path` and a `mimeType`: an `.mp4` / `.webm`
|
|
241
|
+
* file, or — with `stream: { type: "hls" }` — an HLS stream the Studio
|
|
242
|
+
* transcodes an upload into, in the browser. `width`, `height` and
|
|
243
|
+
* `duration` are read from the file (`npx val validate --fix` adds them);
|
|
244
|
+
* `posterTime`, `startTime`, `endTime`, `hotspot`, `alt` and `captions` are
|
|
245
|
+
* authored in the Studio.
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* const schema = s.video({ stream: { type: "hls" } });
|
|
249
|
+
* export default c.define("/example.val.ts", schema, {
|
|
250
|
+
* path: "/public/val/intro_3b9d7/master.m3u8",
|
|
251
|
+
* mimeType: "application/vnd.apple.mpegurl",
|
|
252
|
+
* width: 1920,
|
|
253
|
+
* height: 1080,
|
|
254
|
+
* duration: 42.5,
|
|
255
|
+
* startTime: 2,
|
|
256
|
+
* alt: "The team walking into the office",
|
|
257
|
+
* captions: [
|
|
258
|
+
* { path: "/public/val/intro_en_8f2a1.vtt", srclang: "en", label: "English" },
|
|
259
|
+
* ],
|
|
260
|
+
* });
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* // Picked from a set: mimeType, width, height and duration live there.
|
|
264
|
+
* import videosVal from "./videos.val"; // an s.videoset() module
|
|
265
|
+
* const schema = s.video(videosVal);
|
|
266
|
+
* export default c.define("/example.val.ts", schema, {
|
|
267
|
+
* path: "/public/val/videos/intro_51df2.mp4",
|
|
268
|
+
* startTime: 2,
|
|
269
|
+
* });
|
|
270
|
+
*/
|
|
271
|
+
readonly video: typeof video;
|
|
220
272
|
/**
|
|
221
273
|
* Define a date.
|
|
222
274
|
*
|
|
@@ -362,6 +414,44 @@ export type InitSchema = {
|
|
|
362
414
|
* ```
|
|
363
415
|
*/
|
|
364
416
|
readonly fileset: typeof fileset;
|
|
417
|
+
/**
|
|
418
|
+
* Define a collection of fonts: an `s.fileset()` that accepts the web font
|
|
419
|
+
* formats, and whose files the Studio previews as type. A field picks from
|
|
420
|
+
* it with `s.file(fontsVal)`.
|
|
421
|
+
*
|
|
422
|
+
* @example
|
|
423
|
+
* ```typescript
|
|
424
|
+
* const schema = s.fontset({ dir: "/public/val/fonts" });
|
|
425
|
+
* export default c.define("/content/fonts.val.ts", schema, {
|
|
426
|
+
* "/public/val/fonts/inter_a1b2c.woff2": {
|
|
427
|
+
* mimeType: "font/woff2",
|
|
428
|
+
* },
|
|
429
|
+
* });
|
|
430
|
+
* ```
|
|
431
|
+
*/
|
|
432
|
+
readonly fontset: typeof fontset;
|
|
433
|
+
/**
|
|
434
|
+
* Define a collection of videos. A field picks from it with
|
|
435
|
+
* `s.video(videosVal)`.
|
|
436
|
+
*
|
|
437
|
+
* @example
|
|
438
|
+
* ```typescript
|
|
439
|
+
* const schema = s.videoset({
|
|
440
|
+
* dir: "/public/val/videos",
|
|
441
|
+
* stream: { type: "hls" },
|
|
442
|
+
* });
|
|
443
|
+
* export default c.define("/content/videos.val.ts", schema, {
|
|
444
|
+
* "/public/val/videos/intro_51df2.mp4": {
|
|
445
|
+
* mimeType: "video/mp4",
|
|
446
|
+
* width: 1280,
|
|
447
|
+
* height: 720,
|
|
448
|
+
* duration: 12.5,
|
|
449
|
+
* alt: "The team, introducing itself",
|
|
450
|
+
* },
|
|
451
|
+
* });
|
|
452
|
+
* ```
|
|
453
|
+
*/
|
|
454
|
+
readonly videoset: typeof videoset;
|
|
365
455
|
/**
|
|
366
456
|
* Define the project's settings.
|
|
367
457
|
*
|
|
@@ -388,59 +478,20 @@ export type InitSchema = {
|
|
|
388
478
|
*/
|
|
389
479
|
readonly settings: typeof settings;
|
|
390
480
|
};
|
|
391
|
-
export
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
patch_id?: never;
|
|
407
|
-
}>(schema: Props) => import("./index.js").ObjectSchema<Props, { [key in keyof Props]: import("./schema/index.js").SelectorOfSchema<Props[key]>; }>;
|
|
408
|
-
number: (options?: {
|
|
409
|
-
max?: number;
|
|
410
|
-
min?: number;
|
|
411
|
-
}) => import("./index.js").NumberSchema<number>;
|
|
412
|
-
discriminatedUnion: <Key extends string, T extends import("./schema/discriminatedUnion.js").DiscriminatedUnionItems<Key>>(key: Key, ...objects: T) => import("./index.js").DiscriminatedUnionSchema<Key, T, import("./index.js").DiscriminatedUnionSourceOf<Key, T>>;
|
|
413
|
-
enum: <T extends string>(values_0: T, ...values: T[]) => import("./index.js").EnumSchema<T>;
|
|
414
|
-
union: typeof union;
|
|
415
|
-
richtext: <O extends import("./index.js").RichTextOptions>(options?: O) => import("./index.js").RichTextSchema<O, import("./index.js").RichTextSource<O>>;
|
|
416
|
-
image: typeof image;
|
|
417
|
-
literal: <T extends string>(value: T) => import("./index.js").LiteralSchema<T>;
|
|
418
|
-
keyOf: <Src extends import("./selector/index.js").GenericSelector<import("./source/index.js").SourceObject> & import("./module.js").ValModuleBrand>(valModule: Src) => import("./index.js").KeyOfSchema<Src, Src extends import("./selector/index.js").GenericSelector<infer S extends import("./source/index.js").Source, undefined> ? S extends readonly import("./source/index.js").Source[] ? number : S extends import("./source/index.js").SourceObject ? string extends keyof S ? import("./index.js").RawString : keyof S : S extends Record<string, import("./source/index.js").Source> ? import("./index.js").RawString : never : never>;
|
|
419
|
-
view: <M extends import("./selector/index.js").GenericSelector<import("./source/index.js").Source> & import("./module.js").ValModuleBrand>(valModule: M) => import("./index.js").ValViewSchema<import("./module.js").ModuleIdOf<M>, M extends import("./selector/index.js").GenericSelector<infer S extends import("./source/index.js").Source, undefined> ? S : never>;
|
|
420
|
-
record: typeof record;
|
|
421
|
-
file: typeof file;
|
|
422
|
-
fileset: (options: import("./schema/fileset.js").FilesetOptions) => import("./index.js").RecordSchema<import("./index.js").ObjectSchema<{
|
|
423
|
-
mimeType: import("./index.js").StringSchema<string>;
|
|
424
|
-
}, {
|
|
425
|
-
mimeType: string;
|
|
426
|
-
}>, import("./schema/index.js").Schema<string>, Record<string, import("./schema/fileset.js").FilesetEntryMetadata>>;
|
|
427
|
-
date: (options?: Record<string, never>) => import("./index.js").DateSchema<import("./index.js").RawString>;
|
|
428
|
-
datetime: (options?: Record<string, never>) => import("./index.js").DateTimeSchema<import("./index.js").RawString>;
|
|
429
|
-
color: (options?: import("./index.js").ColorOptions) => import("./index.js").ColorSchema<import("./index.js").RawString>;
|
|
430
|
-
code: (options?: import("./index.js").CodeOptions) => import("./index.js").CodeSchema<import("./index.js").RawString>;
|
|
431
|
-
locale: () => import("./index.js").LocaleSchema<string>;
|
|
432
|
-
route: <T extends string>(options?: Record<string, never>) => import("./index.js").RouteSchema<T>;
|
|
433
|
-
router: typeof router;
|
|
434
|
-
imageset: <Accept extends `image/${string}`, Alt extends import("./schema/imageset.js").AltSchema = import("./index.js").StringSchema<string | null>>(options: import("./schema/imageset.js").ImagesetOptions<Accept, Alt>) => import("./index.js").RecordSchema<import("./index.js").ObjectSchema<{
|
|
435
|
-
width: import("./index.js").NumberSchema<number>;
|
|
436
|
-
height: import("./index.js").NumberSchema<number>;
|
|
437
|
-
mimeType: import("./index.js").StringSchema<string>;
|
|
438
|
-
alt: Alt;
|
|
439
|
-
}, {
|
|
440
|
-
width: number;
|
|
441
|
-
height: number;
|
|
442
|
-
mimeType: string;
|
|
443
|
-
alt: import("./schema/index.js").SelectorOfSchema<Alt>;
|
|
444
|
-
}>, import("./schema/index.js").Schema<string>, Record<string, import("./schema/imageset.js").ImagesetEntryMetadata<import("./schema/imageset.js").AltSourceOf<Alt>>>>;
|
|
445
|
-
settings: typeof settings;
|
|
481
|
+
export type InitSchemaOptions = {
|
|
482
|
+
/**
|
|
483
|
+
* Every media schema is remote: `files.remote` in `val.config.ts`.
|
|
484
|
+
*
|
|
485
|
+
* `s.image()`, `s.file()`, `s.video()`, `s.imageset()`, `s.fileset()`,
|
|
486
|
+
* `s.fontset()` and `s.videoset()` come back with `.remote()` already applied, and so does the
|
|
487
|
+
* image `s.richtext({ img: true })` builds for itself. Nothing downstream
|
|
488
|
+
* needs to know: the Studio, the MCP tools, validation and publishing all
|
|
489
|
+
* read `remote` off the schema, exactly as they do for a `.remote()` written
|
|
490
|
+
* by hand.
|
|
491
|
+
*
|
|
492
|
+
* It is the factories that change, not the schemas, so a schema built here
|
|
493
|
+
* is indistinguishable from one written with `.remote()`.
|
|
494
|
+
*/
|
|
495
|
+
remote?: boolean;
|
|
446
496
|
};
|
|
497
|
+
export declare function initSchema(options?: InitSchemaOptions): InitSchema;
|
|
@@ -76,7 +76,30 @@ export type ValConfig = {
|
|
|
76
76
|
project?: string;
|
|
77
77
|
root?: string;
|
|
78
78
|
files?: {
|
|
79
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Store every image, file and video on Val's remote content host instead
|
|
81
|
+
* of in the repository.
|
|
82
|
+
*
|
|
83
|
+
* `s.image()`, `s.file()`, `s.video()`, `s.imageset()`, `s.fileset()`,
|
|
84
|
+
* `s.fontset()`, `s.videoset()` and `s.richtext({ img: true })` all behave as though
|
|
85
|
+
* `.remote()` had been written on them. Required for a project in the Val
|
|
86
|
+
* app, which has no repository for the bytes to go into: there the Val
|
|
87
|
+
* server refuses to start without it.
|
|
88
|
+
*
|
|
89
|
+
* It is set here, in the project, rather than by the environment, so that
|
|
90
|
+
* every tool reads the project the same way. `val validate`, the VS Code
|
|
91
|
+
* extension and `pnpm dev` evaluate this file too, and a switch only the
|
|
92
|
+
* app could see would have them calling every remote image a mistake --
|
|
93
|
+
* and `val validate --fix` downloading it back into the repository.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* import { initVal } from "@valbuild/core";
|
|
97
|
+
* const { s, c, val, config } = initVal({
|
|
98
|
+
* project: "myorg/myproject",
|
|
99
|
+
* files: { remote: true },
|
|
100
|
+
* });
|
|
101
|
+
*/
|
|
102
|
+
remote?: boolean;
|
|
80
103
|
};
|
|
81
104
|
gitCommit?: string;
|
|
82
105
|
gitBranch?: string;
|
|
@@ -146,7 +169,7 @@ export type InitVal = {
|
|
|
146
169
|
* import { initVal } from "@valbuild/core";
|
|
147
170
|
* const { s, c, val, config } = initVal({
|
|
148
171
|
* project: "myorg/myproject",
|
|
149
|
-
* files: {
|
|
172
|
+
* files: { remote: true },
|
|
150
173
|
* });
|
|
151
174
|
* export { s, c, val, config };
|
|
152
175
|
*/
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fonts, as far as a mime type can tell.
|
|
3
|
+
*
|
|
4
|
+
* The four web formats have IANA types under `font/` (RFC 8081), and those are
|
|
5
|
+
* what Val stores. Browsers and operating systems disagree about them: a file
|
|
6
|
+
* picker reports `.woff2` as `font/woff2`, `application/font-woff2` or nothing
|
|
7
|
+
* at all depending on the platform, and nothing at all reads as
|
|
8
|
+
* `application/octet-stream` once the file is a data URL. That is why an upload
|
|
9
|
+
* asks the BYTES ({@link sniffFontMimeType}) rather than trusting the picker.
|
|
10
|
+
*/
|
|
11
|
+
/** The formats `s.fontset()` accepts unless told otherwise, best first. */
|
|
12
|
+
export declare const FONT_MIME_TYPES: readonly ["font/woff2", "font/woff", "font/ttf", "font/otf"];
|
|
13
|
+
/** `s.fontset()`'s `accept` when none is given. */
|
|
14
|
+
export declare const DEFAULT_FONT_ACCEPT: string;
|
|
15
|
+
/**
|
|
16
|
+
* The extension of each font type, for a file input: a picker matches an
|
|
17
|
+
* `accept` of mime types through the operating system's own table, and where
|
|
18
|
+
* that table does not know `font/woff2` the file is greyed out.
|
|
19
|
+
*/
|
|
20
|
+
export declare const FONT_MIME_TYPE_EXTENSIONS: Record<string, string>;
|
|
21
|
+
/** `mimeType`, with a legacy font name read as its `font/` type. */
|
|
22
|
+
export declare function canonicalFontMimeType(mimeType: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Whether a file of `mimeType` is a font a browser can draw: the `font/` types,
|
|
25
|
+
* and the pre-RFC 8081 names still found in older data.
|
|
26
|
+
*/
|
|
27
|
+
export declare function isFontMimeType(mimeType: string | null | undefined): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* The font type of `bytes`, read from the signature every font format starts
|
|
30
|
+
* with, or `null` when they are not a font.
|
|
31
|
+
*
|
|
32
|
+
* Only the first four bytes are needed: the WOFF signatures (`wOFF`, `wOF2`),
|
|
33
|
+
* the SFNT versions of TrueType (`0x00010000`, or `true` from old Apple fonts)
|
|
34
|
+
* and of CFF-flavoured OpenType (`OTTO`), and a collection's tag (`ttcf`).
|
|
35
|
+
*/
|
|
36
|
+
export declare function sniffFontMimeType(bytes: Uint8Array): string | null;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SerializedFileSchema } from "../schema/file.js";
|
|
2
2
|
import { SerializedImageSchema } from "../schema/image.js";
|
|
3
|
+
import { SerializedVideoSchema } from "../schema/video.js";
|
|
3
4
|
/**
|
|
4
5
|
* The validation basis is used in remote refs to determine if the remote content needs to be re-validated.
|
|
5
6
|
*
|
|
@@ -9,5 +10,5 @@ import { SerializedImageSchema } from "../schema/image.js";
|
|
|
9
10
|
* This way we can rename a file, without having to re-validate it.
|
|
10
11
|
* The version is outside of the validation hash, so that it is possible to manually fix the version without having to re-validate.
|
|
11
12
|
*/
|
|
12
|
-
export declare function getValidationBasis(coreVersion: string, schema: SerializedImageSchema | SerializedFileSchema, fileExt: string, metadata: Record<string, unknown> | undefined, fileHash: string): string;
|
|
13
|
-
export declare function getValidationHash(coreVersion: string, schema: SerializedImageSchema | SerializedFileSchema, fileExt: string, metadata: Record<string, unknown> | undefined, fileHash: string, textEncoder: TextEncoder): string;
|
|
13
|
+
export declare function getValidationBasis(coreVersion: string, schema: SerializedImageSchema | SerializedFileSchema | SerializedVideoSchema, fileExt: string, metadata: Record<string, unknown> | undefined, fileHash: string): string;
|
|
14
|
+
export declare function getValidationHash(coreVersion: string, schema: SerializedImageSchema | SerializedFileSchema | SerializedVideoSchema, fileExt: string, metadata: Record<string, unknown> | undefined, fileHash: string, textEncoder: TextEncoder): string;
|
|
@@ -138,3 +138,10 @@ export declare class FileSchema<Src extends FileSource | null> extends Schema<Sr
|
|
|
138
138
|
export declare function file(galleryModule: ValModule<Record<string, FilesetEntryMetadata>>): FileSchema<GalleryFileSource>;
|
|
139
139
|
/** A file of its own, carrying its own mime type. */
|
|
140
140
|
export declare function file(options?: FileOptions): FileSchema<FileSource>;
|
|
141
|
+
/**
|
|
142
|
+
* `s.file()` for a project whose media is all remote (`files.remote` in
|
|
143
|
+
* `val.config.ts`): the same schema, with `.remote()` already applied. See
|
|
144
|
+
* `initSchema`.
|
|
145
|
+
*/
|
|
146
|
+
export declare function remoteFile(galleryModule: ValModule<Record<string, FilesetEntryMetadata>>): FileSchema<GalleryFileSource>;
|
|
147
|
+
export declare function remoteFile(options?: FileOptions): FileSchema<FileSource>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ValModule } from "../index.js";
|
|
2
|
+
import { FileSchema } from "./file.js";
|
|
3
|
+
import { FilesetEntryMetadata } from "./fileset.js";
|
|
4
|
+
import { GalleryFileSource } from "../source/media.js";
|
|
5
|
+
/**
|
|
6
|
+
* A font picked from an `s.fontset()`.
|
|
7
|
+
*
|
|
8
|
+
* The same field `s.file(fontsVal)` is — it stores `{ path }` and serializes
|
|
9
|
+
* identically — with one thing more: it refuses a set that is not a font set,
|
|
10
|
+
* at definition, so a field called a font cannot end up offering PDFs. What the
|
|
11
|
+
* Studio does with it (a specimen in its parent, the set to pick from when
|
|
12
|
+
* opened) it does for any file field backed by a font set.
|
|
13
|
+
*/
|
|
14
|
+
export declare function font(fontsetModule: ValModule<Record<string, FilesetEntryMetadata>>): FileSchema<GalleryFileSource>;
|
|
15
|
+
/** `s.font()` with `.remote()` applied: see `files.remote` in `initSchema`. */
|
|
16
|
+
export declare function remoteFont(fontsetModule: ValModule<Record<string, FilesetEntryMetadata>>): FileSchema<GalleryFileSource>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { fileset, FilesetOptions } from "./fileset.js";
|
|
2
|
+
/**
|
|
3
|
+
* Options for s.fontset()
|
|
4
|
+
*/
|
|
5
|
+
export type FontsetOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* The directory where fonts should be stored.
|
|
8
|
+
* Must start with "/public" (e.g., "/public/val/fonts")
|
|
9
|
+
*/
|
|
10
|
+
dir: FilesetOptions["dir"];
|
|
11
|
+
/**
|
|
12
|
+
* The accepted font types. Defaults to every web font format:
|
|
13
|
+
* `"font/woff2,font/woff,font/ttf,font/otf"`. Narrow it to `"font/woff2"` to
|
|
14
|
+
* keep the site's fonts to the one format every current browser reads and
|
|
15
|
+
* that is smallest on the wire.
|
|
16
|
+
*/
|
|
17
|
+
accept?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Define a collection of fonts.
|
|
21
|
+
*
|
|
22
|
+
* A fontset IS a fileset — the same source, the same `s.file(fontsVal)` field
|
|
23
|
+
* to pick from it, the same checks and fixes — with `accept` defaulting to the
|
|
24
|
+
* web font formats. What a font gets that any other file does not is decided
|
|
25
|
+
* by its mime type rather than by the set: the Studio previews any file it
|
|
26
|
+
* knows is a font, wherever it is shown.
|
|
27
|
+
*
|
|
28
|
+
* Remote is off by default: call `.remote()` on the result to allow remote files.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const schema = s.fontset({ dir: "/public/val/fonts" });
|
|
33
|
+
* export default c.define("/content/fonts.val.ts", schema, {
|
|
34
|
+
* "/public/val/fonts/inter_a1b2c.woff2": {
|
|
35
|
+
* mimeType: "font/woff2",
|
|
36
|
+
* },
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare const fontset: (options: FontsetOptions) => ReturnType<typeof fileset>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CustomValidateFunction, Schema, SchemaAssertResult
|
|
1
|
+
import { CustomValidateFunction, Schema, SchemaAssertResult } from "./index.js";
|
|
2
2
|
import { GalleryImageSource, ImageSource } from "../source/media.js";
|
|
3
3
|
import { ModulePath, SourcePath } from "../val/index.js";
|
|
4
4
|
import { ValidationError, ValidationErrors } from "./validation/ValidationError.js";
|
|
@@ -198,7 +198,7 @@ export declare class ImageSchema<Src extends ImageSource | null> extends Schema<
|
|
|
198
198
|
preview(select: ItemPreviewInput<Src>): ImageSchema<Src>;
|
|
199
199
|
protected executePreviewItem(src: NonNullable<Src>): PreviewItem | null;
|
|
200
200
|
protected declaresItemPreview(): boolean;
|
|
201
|
-
protected executeSerialize():
|
|
201
|
+
protected executeSerialize(): SerializedImageSchema;
|
|
202
202
|
}
|
|
203
203
|
/**
|
|
204
204
|
* An image picked from a gallery. Its dimensions and mime type live in the
|
|
@@ -207,3 +207,10 @@ export declare class ImageSchema<Src extends ImageSource | null> extends Schema<
|
|
|
207
207
|
export declare function image(galleryModule: ValModule<Record<string, ImagesetEntryMetadata<AltSource>>>, galleryOptions?: GalleryImageOptions): ImageSchema<GalleryImageSource>;
|
|
208
208
|
/** An image of its own, carrying its own dimensions and mime type. */
|
|
209
209
|
export declare function image(options?: ImageOptions): ImageSchema<ImageSource>;
|
|
210
|
+
/**
|
|
211
|
+
* `s.image()` for a project whose media is all remote (`files.remote` in
|
|
212
|
+
* `val.config.ts`): the same schema, with `.remote()` already applied. See
|
|
213
|
+
* `initSchema`.
|
|
214
|
+
*/
|
|
215
|
+
export declare function remoteImage(galleryModule: ValModule<Record<string, ImagesetEntryMetadata<AltSource>>>, galleryOptions?: GalleryImageOptions): ImageSchema<GalleryImageSource>;
|
|
216
|
+
export declare function remoteImage(options?: ImageOptions): ImageSchema<ImageSource>;
|