@valbuild/core 0.141.0 → 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 +33 -0
- package/dist/declarations/src/index.d.ts +5 -1
- package/dist/declarations/src/initSchema.d.ts +33 -2
- package/dist/declarations/src/initVal.d.ts +1 -1
- package/dist/declarations/src/mimeType/font.d.ts +36 -0
- package/dist/declarations/src/mimeType/index.d.ts +1 -0
- package/dist/declarations/src/schema/font.d.ts +16 -0
- package/dist/declarations/src/schema/fontset.d.ts +40 -0
- package/dist/{index-a6c53286.esm.js → index-02a1ba06.esm.js} +184 -6
- package/dist/{index-13cf45b1.cjs.prod.js → index-46c72f01.cjs.prod.js} +185 -5
- package/dist/{index-fae161b5.cjs.dev.js → index-aac8c69c.cjs.dev.js} +185 -5
- package/dist/valbuild-core.cjs.dev.js +3 -1
- package/dist/valbuild-core.cjs.prod.js +3 -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,38 @@
|
|
|
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
|
+
|
|
3
36
|
## 0.141.0
|
|
4
37
|
|
|
5
38
|
### Minor Changes
|
|
@@ -35,7 +35,7 @@ import { ModulePath, SourcePath, getValPath, isVal } from "./val/index.js";
|
|
|
35
35
|
import { createValPathOfItem } from "./selector/SelectorProxy.js";
|
|
36
36
|
import { Operation } from "./patch/index.js";
|
|
37
37
|
import { initSchema } from "./initSchema.js";
|
|
38
|
-
import { getMimeType, mimeTypeToFileExt, filenameToMimeType, mimeTypeMatchesAccept } from "./mimeType/index.js";
|
|
38
|
+
import { getMimeType, mimeTypeToFileExt, filenameToMimeType, mimeTypeMatchesAccept, isFontMimeType, sniffFontMimeType } from "./mimeType/index.js";
|
|
39
39
|
import { type ImageMetadata } from "./schema/image.js";
|
|
40
40
|
import { type FileMetadata } from "./schema/file.js";
|
|
41
41
|
import { isJson, getJsonImport, resolveJsonValues } from "./source/json.js";
|
|
@@ -57,6 +57,7 @@ export { type SerializedNumberSchema, NumberSchema } from "./schema/number.js";
|
|
|
57
57
|
export { type SerializedBooleanSchema, BooleanSchema } from "./schema/boolean.js";
|
|
58
58
|
export { type SerializedImageSchema, ImageSchema } from "./schema/image.js";
|
|
59
59
|
export { type SerializedFileSchema, FileSchema } from "./schema/file.js";
|
|
60
|
+
export { DEFAULT_FONT_ACCEPT, FONT_MIME_TYPES } from "./mimeType/font.js";
|
|
60
61
|
export { type SerializedVideoSchema, VideoSchema, DEFAULT_VIDEO_ACCEPT, DEFAULT_VIDEO_RENDITIONS, DEFAULT_VIDEO_SEGMENT_DURATION, } from "./schema/video.js";
|
|
61
62
|
export { type SerializedDateSchema, DateSchema } from "./schema/date.js";
|
|
62
63
|
export { type SerializedSettingsSchema, SettingsSchema, } from "./schema/settings.js";
|
|
@@ -208,6 +209,9 @@ declare const Internal: {
|
|
|
208
209
|
MIME_TYPES_TO_EXT: {
|
|
209
210
|
[k: string]: string;
|
|
210
211
|
};
|
|
212
|
+
FONT_MIME_TYPE_EXTENSIONS: Record<string, string>;
|
|
213
|
+
isFontMimeType: typeof isFontMimeType;
|
|
214
|
+
sniffFontMimeType: typeof sniffFontMimeType;
|
|
211
215
|
ModuleFilePathSep: string;
|
|
212
216
|
notFileOp: (op: Operation) => op is {
|
|
213
217
|
op: "add";
|
|
@@ -13,8 +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";
|
|
16
17
|
import { video } from "./schema/video.js";
|
|
17
18
|
import { fileset } from "./schema/fileset.js";
|
|
19
|
+
import { fontset } from "./schema/fontset.js";
|
|
18
20
|
import { date } from "./schema/date.js";
|
|
19
21
|
import { datetime } from "./schema/datetime.js";
|
|
20
22
|
import { code } from "./schema/code.js";
|
|
@@ -219,6 +221,19 @@ export type InitSchema = {
|
|
|
219
221
|
*
|
|
220
222
|
*/
|
|
221
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;
|
|
222
237
|
/**
|
|
223
238
|
* Define a video.
|
|
224
239
|
*
|
|
@@ -399,6 +414,22 @@ export type InitSchema = {
|
|
|
399
414
|
* ```
|
|
400
415
|
*/
|
|
401
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;
|
|
402
433
|
/**
|
|
403
434
|
* Define a collection of videos. A field picks from it with
|
|
404
435
|
* `s.video(videosVal)`.
|
|
@@ -451,8 +482,8 @@ export type InitSchemaOptions = {
|
|
|
451
482
|
/**
|
|
452
483
|
* Every media schema is remote: `files.remote` in `val.config.ts`.
|
|
453
484
|
*
|
|
454
|
-
* `s.image()`, `s.file()`, `s.video()`, `s.imageset()`, `s.fileset()
|
|
455
|
-
* `s.videoset()` come back with `.remote()` already applied, and so does the
|
|
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
|
|
456
487
|
* image `s.richtext({ img: true })` builds for itself. Nothing downstream
|
|
457
488
|
* needs to know: the Studio, the MCP tools, validation and publishing all
|
|
458
489
|
* read `remote` off the schema, exactly as they do for a `.remote()` written
|
|
@@ -81,7 +81,7 @@ export type ValConfig = {
|
|
|
81
81
|
* of in the repository.
|
|
82
82
|
*
|
|
83
83
|
* `s.image()`, `s.file()`, `s.video()`, `s.imageset()`, `s.fileset()`,
|
|
84
|
-
* `s.videoset()` and `s.richtext({ img: true })` all behave as though
|
|
84
|
+
* `s.fontset()`, `s.videoset()` and `s.richtext({ img: true })` all behave as though
|
|
85
85
|
* `.remote()` had been written on them. Required for a project in the Val
|
|
86
86
|
* app, which has no repository for the bytes to go into: there the Val
|
|
87
87
|
* server refuses to start without it.
|
|
@@ -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;
|
|
@@ -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>;
|
|
@@ -3602,7 +3602,7 @@ var EXT_TO_MIME_TYPES = {
|
|
|
3602
3602
|
sxw: "application/vnd.sun.xml.writer",
|
|
3603
3603
|
sxg: "application/vnd.sun.xml.writer.global",
|
|
3604
3604
|
stw: "application/vnd.sun.xml.writer.template",
|
|
3605
|
-
otf: "
|
|
3605
|
+
otf: "font/otf",
|
|
3606
3606
|
osfpvg: "application/vnd.yamaha.openscoreformat.osfpvg+xml",
|
|
3607
3607
|
dp: "application/vnd.osgi.dp",
|
|
3608
3608
|
pdb: "application/vnd.palm",
|
|
@@ -3752,7 +3752,8 @@ var EXT_TO_MIME_TYPES = {
|
|
|
3752
3752
|
mxs: "application/vnd.triscape.mxs",
|
|
3753
3753
|
t: "text/troff",
|
|
3754
3754
|
tra: "application/vnd.trueapp",
|
|
3755
|
-
ttf: "
|
|
3755
|
+
ttf: "font/ttf",
|
|
3756
|
+
ttc: "font/collection",
|
|
3756
3757
|
ttl: "text/turtle",
|
|
3757
3758
|
umj: "application/vnd.umajin",
|
|
3758
3759
|
uoml: "application/vnd.uoml+xml",
|
|
@@ -3779,7 +3780,8 @@ var EXT_TO_MIME_TYPES = {
|
|
|
3779
3780
|
wbmp: "image/vnd.wap.wbmp",
|
|
3780
3781
|
wav: "audio/x-wav",
|
|
3781
3782
|
davmount: "application/davmount+xml",
|
|
3782
|
-
woff: "
|
|
3783
|
+
woff: "font/woff",
|
|
3784
|
+
woff2: "font/woff2",
|
|
3783
3785
|
wspolicy: "application/wspolicy+xml",
|
|
3784
3786
|
webp: "image/webp",
|
|
3785
3787
|
wtb: "application/vnd.webturbo",
|
|
@@ -3881,6 +3883,93 @@ function mimeTypeMatchesAccept(mimeType, accept) {
|
|
|
3881
3883
|
});
|
|
3882
3884
|
}
|
|
3883
3885
|
|
|
3886
|
+
/**
|
|
3887
|
+
* Fonts, as far as a mime type can tell.
|
|
3888
|
+
*
|
|
3889
|
+
* The four web formats have IANA types under `font/` (RFC 8081), and those are
|
|
3890
|
+
* what Val stores. Browsers and operating systems disagree about them: a file
|
|
3891
|
+
* picker reports `.woff2` as `font/woff2`, `application/font-woff2` or nothing
|
|
3892
|
+
* at all depending on the platform, and nothing at all reads as
|
|
3893
|
+
* `application/octet-stream` once the file is a data URL. That is why an upload
|
|
3894
|
+
* asks the BYTES ({@link sniffFontMimeType}) rather than trusting the picker.
|
|
3895
|
+
*/
|
|
3896
|
+
|
|
3897
|
+
/** The formats `s.fontset()` accepts unless told otherwise, best first. */
|
|
3898
|
+
var FONT_MIME_TYPES = ["font/woff2", "font/woff", "font/ttf", "font/otf"];
|
|
3899
|
+
|
|
3900
|
+
/** `s.fontset()`'s `accept` when none is given. */
|
|
3901
|
+
var DEFAULT_FONT_ACCEPT = FONT_MIME_TYPES.join(",");
|
|
3902
|
+
|
|
3903
|
+
/**
|
|
3904
|
+
* The extension of each font type, for a file input: a picker matches an
|
|
3905
|
+
* `accept` of mime types through the operating system's own table, and where
|
|
3906
|
+
* that table does not know `font/woff2` the file is greyed out.
|
|
3907
|
+
*/
|
|
3908
|
+
var FONT_MIME_TYPE_EXTENSIONS = {
|
|
3909
|
+
"font/woff2": ".woff2",
|
|
3910
|
+
"font/woff": ".woff",
|
|
3911
|
+
"font/ttf": ".ttf",
|
|
3912
|
+
"font/otf": ".otf",
|
|
3913
|
+
"font/collection": ".ttc"
|
|
3914
|
+
};
|
|
3915
|
+
|
|
3916
|
+
/**
|
|
3917
|
+
* The names the extension table used for fonts before it used RFC 8081's.
|
|
3918
|
+
* Content written then still carries them, and it is the same file.
|
|
3919
|
+
*/
|
|
3920
|
+
var LEGACY_FONT_MIME_TYPES = {
|
|
3921
|
+
"application/x-font-ttf": "font/ttf",
|
|
3922
|
+
"application/x-font-otf": "font/otf",
|
|
3923
|
+
"application/x-font-woff": "font/woff"
|
|
3924
|
+
};
|
|
3925
|
+
|
|
3926
|
+
/** `mimeType`, with a legacy font name read as its `font/` type. */
|
|
3927
|
+
function canonicalFontMimeType(mimeType) {
|
|
3928
|
+
var _LEGACY_FONT_MIME_TYP;
|
|
3929
|
+
return (_LEGACY_FONT_MIME_TYP = LEGACY_FONT_MIME_TYPES[mimeType]) !== null && _LEGACY_FONT_MIME_TYP !== void 0 ? _LEGACY_FONT_MIME_TYP : mimeType;
|
|
3930
|
+
}
|
|
3931
|
+
|
|
3932
|
+
/**
|
|
3933
|
+
* Whether a file of `mimeType` is a font a browser can draw: the `font/` types,
|
|
3934
|
+
* and the pre-RFC 8081 names still found in older data.
|
|
3935
|
+
*/
|
|
3936
|
+
function isFontMimeType(mimeType) {
|
|
3937
|
+
if (!mimeType) {
|
|
3938
|
+
return false;
|
|
3939
|
+
}
|
|
3940
|
+
return mimeType.startsWith("font/") || mimeType.startsWith("application/x-font-") || mimeType === "application/font-woff" || mimeType === "application/font-woff2" || mimeType === "application/font-sfnt" || mimeType === "application/vnd.ms-opentype";
|
|
3941
|
+
}
|
|
3942
|
+
|
|
3943
|
+
/**
|
|
3944
|
+
* The font type of `bytes`, read from the signature every font format starts
|
|
3945
|
+
* with, or `null` when they are not a font.
|
|
3946
|
+
*
|
|
3947
|
+
* Only the first four bytes are needed: the WOFF signatures (`wOFF`, `wOF2`),
|
|
3948
|
+
* the SFNT versions of TrueType (`0x00010000`, or `true` from old Apple fonts)
|
|
3949
|
+
* and of CFF-flavoured OpenType (`OTTO`), and a collection's tag (`ttcf`).
|
|
3950
|
+
*/
|
|
3951
|
+
function sniffFontMimeType(bytes) {
|
|
3952
|
+
if (bytes.length < 4) {
|
|
3953
|
+
return null;
|
|
3954
|
+
}
|
|
3955
|
+
var tag = String.fromCharCode(bytes[0], bytes[1], bytes[2], bytes[3]);
|
|
3956
|
+
switch (tag) {
|
|
3957
|
+
case "wOF2":
|
|
3958
|
+
return "font/woff2";
|
|
3959
|
+
case "wOFF":
|
|
3960
|
+
return "font/woff";
|
|
3961
|
+
case "OTTO":
|
|
3962
|
+
return "font/otf";
|
|
3963
|
+
case "true":
|
|
3964
|
+
case "\0\x01\0\0":
|
|
3965
|
+
return "font/ttf";
|
|
3966
|
+
case "ttcf":
|
|
3967
|
+
return "font/collection";
|
|
3968
|
+
default:
|
|
3969
|
+
return null;
|
|
3970
|
+
}
|
|
3971
|
+
}
|
|
3972
|
+
|
|
3884
3973
|
/**
|
|
3885
3974
|
* How an uploaded image is re-encoded in the browser, before it is uploaded.
|
|
3886
3975
|
*
|
|
@@ -10902,7 +10991,9 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10902
10991
|
// fix was offered -- and the `file:add-metadata` branch below could never be
|
|
10903
10992
|
// reached for any file whose extension is recognized, which is all of them
|
|
10904
10993
|
// that get this far.
|
|
10905
|
-
|
|
10994
|
+
// A legacy font name (`application/x-font-ttf`) is what the extension
|
|
10995
|
+
// table itself used to say, so it is not a mismatch.
|
|
10996
|
+
if (mimeType && fileMimeType !== canonicalFontMimeType(mimeType)) {
|
|
10906
10997
|
return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
|
|
10907
10998
|
message: "Mime type and file extension not matching. Mime type is '".concat(mimeType, "' but file extension is '").concat(fileMimeType, "'"),
|
|
10908
10999
|
value: src
|
|
@@ -11096,6 +11187,38 @@ function fileOf(remote, options) {
|
|
|
11096
11187
|
return new FileSchema(options, false, remote);
|
|
11097
11188
|
}
|
|
11098
11189
|
|
|
11190
|
+
/**
|
|
11191
|
+
* A font picked from an `s.fontset()`.
|
|
11192
|
+
*
|
|
11193
|
+
* The same field `s.file(fontsVal)` is — it stores `{ path }` and serializes
|
|
11194
|
+
* identically — with one thing more: it refuses a set that is not a font set,
|
|
11195
|
+
* at definition, so a field called a font cannot end up offering PDFs. What the
|
|
11196
|
+
* Studio does with it (a specimen in its parent, the set to pick from when
|
|
11197
|
+
* opened) it does for any file field backed by a font set.
|
|
11198
|
+
*/
|
|
11199
|
+
function font(fontsetModule) {
|
|
11200
|
+
assertFontset(fontsetModule);
|
|
11201
|
+
return file(fontsetModule);
|
|
11202
|
+
}
|
|
11203
|
+
|
|
11204
|
+
/** `s.font()` with `.remote()` applied: see `files.remote` in `initSchema`. */
|
|
11205
|
+
function remoteFont(fontsetModule) {
|
|
11206
|
+
assertFontset(fontsetModule);
|
|
11207
|
+
return remoteFile(fontsetModule);
|
|
11208
|
+
}
|
|
11209
|
+
function assertFontset(fontsetModule) {
|
|
11210
|
+
var _getSchema;
|
|
11211
|
+
var modulePath = getValPath(fontsetModule);
|
|
11212
|
+
var serialized = (_getSchema = getSchema(fontsetModule)) === null || _getSchema === void 0 ? void 0 : _getSchema["executeSerialize"]();
|
|
11213
|
+
var accept = (serialized === null || serialized === void 0 ? void 0 : serialized.type) === "record" && serialized.mediaType === "files" ? serialized.accept : undefined;
|
|
11214
|
+
var isFontset = !!accept && accept.split(",").every(function (type) {
|
|
11215
|
+
return isFontMimeType(type.trim());
|
|
11216
|
+
});
|
|
11217
|
+
if (!isFontset) {
|
|
11218
|
+
throw new Error("s.font(".concat(modulePath !== null && modulePath !== void 0 ? modulePath : "?", "): the module must be an s.fontset(). Use s.file() to pick from a set of other files."));
|
|
11219
|
+
}
|
|
11220
|
+
}
|
|
11221
|
+
|
|
11099
11222
|
/**
|
|
11100
11223
|
* Turn an upload into an HLS stream, in the browser, before it is uploaded.
|
|
11101
11224
|
*
|
|
@@ -11719,6 +11842,50 @@ var fileset = function fileset(options) {
|
|
|
11719
11842
|
});
|
|
11720
11843
|
};
|
|
11721
11844
|
|
|
11845
|
+
/**
|
|
11846
|
+
* Options for s.fontset()
|
|
11847
|
+
*/
|
|
11848
|
+
|
|
11849
|
+
/**
|
|
11850
|
+
* Define a collection of fonts.
|
|
11851
|
+
*
|
|
11852
|
+
* A fontset IS a fileset — the same source, the same `s.file(fontsVal)` field
|
|
11853
|
+
* to pick from it, the same checks and fixes — with `accept` defaulting to the
|
|
11854
|
+
* web font formats. What a font gets that any other file does not is decided
|
|
11855
|
+
* by its mime type rather than by the set: the Studio previews any file it
|
|
11856
|
+
* knows is a font, wherever it is shown.
|
|
11857
|
+
*
|
|
11858
|
+
* Remote is off by default: call `.remote()` on the result to allow remote files.
|
|
11859
|
+
*
|
|
11860
|
+
* @example
|
|
11861
|
+
* ```typescript
|
|
11862
|
+
* const schema = s.fontset({ dir: "/public/val/fonts" });
|
|
11863
|
+
* export default c.define("/content/fonts.val.ts", schema, {
|
|
11864
|
+
* "/public/val/fonts/inter_a1b2c.woff2": {
|
|
11865
|
+
* mimeType: "font/woff2",
|
|
11866
|
+
* },
|
|
11867
|
+
* });
|
|
11868
|
+
* ```
|
|
11869
|
+
*/
|
|
11870
|
+
var fontset = function fontset(options) {
|
|
11871
|
+
var _options$accept;
|
|
11872
|
+
var accept = (_options$accept = options.accept) !== null && _options$accept !== void 0 ? _options$accept : DEFAULT_FONT_ACCEPT;
|
|
11873
|
+
var notFonts = accept.split(",").map(function (type) {
|
|
11874
|
+
return type.trim();
|
|
11875
|
+
}).filter(function (type) {
|
|
11876
|
+
return !isFontMimeType(type);
|
|
11877
|
+
});
|
|
11878
|
+
if (notFonts.length > 0) {
|
|
11879
|
+
// A fontset that took a PDF would be a fileset under a name that says
|
|
11880
|
+
// otherwise, and the Studio would draw a specimen of nothing.
|
|
11881
|
+
throw new Error("s.fontset(): 'accept' may only name font types (font/woff2, font/woff, font/ttf, font/otf or font/*). Got: ".concat(notFonts.join(", "), ". Use s.fileset() for other files."));
|
|
11882
|
+
}
|
|
11883
|
+
return fileset({
|
|
11884
|
+
dir: options.dir,
|
|
11885
|
+
accept: accept
|
|
11886
|
+
});
|
|
11887
|
+
};
|
|
11888
|
+
|
|
11722
11889
|
var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
11723
11890
|
function DateSchema(options) {
|
|
11724
11891
|
var _this;
|
|
@@ -12764,6 +12931,7 @@ function initSchema(options) {
|
|
|
12764
12931
|
var media = (options === null || options === void 0 ? void 0 : options.remote) === true ? {
|
|
12765
12932
|
image: remoteImage,
|
|
12766
12933
|
file: remoteFile,
|
|
12934
|
+
font: remoteFont,
|
|
12767
12935
|
video: remoteVideo,
|
|
12768
12936
|
richtext: remoteRichtext,
|
|
12769
12937
|
imageset: function (options) {
|
|
@@ -12772,16 +12940,21 @@ function initSchema(options) {
|
|
|
12772
12940
|
fileset: function (options) {
|
|
12773
12941
|
return fileset(options).remote();
|
|
12774
12942
|
},
|
|
12943
|
+
fontset: function (options) {
|
|
12944
|
+
return fontset(options).remote();
|
|
12945
|
+
},
|
|
12775
12946
|
videoset: function (options) {
|
|
12776
12947
|
return videoset(options).remote();
|
|
12777
12948
|
}
|
|
12778
12949
|
} : {
|
|
12779
12950
|
image: image,
|
|
12780
12951
|
file: file,
|
|
12952
|
+
font: font,
|
|
12781
12953
|
video: video,
|
|
12782
12954
|
richtext: richtext,
|
|
12783
12955
|
imageset: imageset,
|
|
12784
12956
|
fileset: fileset,
|
|
12957
|
+
fontset: fontset,
|
|
12785
12958
|
videoset: videoset
|
|
12786
12959
|
};
|
|
12787
12960
|
// locales: F.Narrow<Locales>
|
|
@@ -12802,8 +12975,10 @@ function initSchema(options) {
|
|
|
12802
12975
|
view: view,
|
|
12803
12976
|
record: record,
|
|
12804
12977
|
file: media.file,
|
|
12978
|
+
font: media.font,
|
|
12805
12979
|
video: media.video,
|
|
12806
12980
|
fileset: media.fileset,
|
|
12981
|
+
fontset: media.fontset,
|
|
12807
12982
|
date: date,
|
|
12808
12983
|
datetime: datetime,
|
|
12809
12984
|
color: color,
|
|
@@ -15482,7 +15657,7 @@ function isPageRouter(routerId) {
|
|
|
15482
15657
|
|
|
15483
15658
|
var corePackageJson = {
|
|
15484
15659
|
name: "@valbuild/core",
|
|
15485
|
-
version: "0.
|
|
15660
|
+
version: "0.143.0",
|
|
15486
15661
|
"private": false,
|
|
15487
15662
|
description: "Val - supercharged hard-coded content",
|
|
15488
15663
|
repository: {
|
|
@@ -15652,6 +15827,9 @@ var Internal = {
|
|
|
15652
15827
|
mimeTypeMatchesAccept: mimeTypeMatchesAccept,
|
|
15653
15828
|
EXT_TO_MIME_TYPES: EXT_TO_MIME_TYPES,
|
|
15654
15829
|
MIME_TYPES_TO_EXT: MIME_TYPES_TO_EXT,
|
|
15830
|
+
FONT_MIME_TYPE_EXTENSIONS: FONT_MIME_TYPE_EXTENSIONS,
|
|
15831
|
+
isFontMimeType: isFontMimeType,
|
|
15832
|
+
sniffFontMimeType: sniffFontMimeType,
|
|
15655
15833
|
ModuleFilePathSep: ModuleFilePathSep,
|
|
15656
15834
|
notFileOp: function notFileOp(op) {
|
|
15657
15835
|
return op.op !== "file";
|
|
@@ -15703,4 +15881,4 @@ function tryJsonParse(str) {
|
|
|
15703
15881
|
}
|
|
15704
15882
|
}
|
|
15705
15883
|
|
|
15706
|
-
export {
|
|
15884
|
+
export { declaredKeySetOf as $, ArraySchema as A, BooleanSchema as B, DateSchema as C, DEFAULT_CONTENT_HOST as D, SettingsSchema as E, FATAL_ERROR_TYPES as F, GenericSelector as G, ASSISTANT_SETTINGS_MAX_LENGTH as H, Internal as I, THEME_RADIUS_STEPS as J, THEME_RADIUS_LENGTHS as K, assistantAvailability as L, ModuleFilePathSep as M, NumberSchema as N, ObjectSchema as O, PatchError as P, SETTINGS_MODULE_CONVENTION as Q, RecordSchema as R, Schema as S, THEME_LOGO_DIRECTORY as T, isRootModuleFilePath as U, VAL_EXTENSION as V, resolveSettingsModule as W, localeTagError as X, localeOfValue as Y, LocaleSchema as Z, _typeof as _, _slicedToArray as a, missingDeclaredKeys as a0, discriminatedUnionBranchOf as a1, ColorSchema as a2, CodeSchema as a3, CODE_LANGUAGES as a4, COLOR_FORMATS as a5, DEFAULT_COLOR_FORMAT as a6, DateTimeSchema as a7, KeyOfSchema as a8, ValViewSchema as a9, isValViewSource as aa, RouteSchema as ab, RichTextSchema as ac, DiscriminatedUnionSchema as ad, EnumSchema as ae, LiteralSchema as af, deserializeSchema as ag, previewScope as ah, isInlineRender as ai, parseNextJsRoutePattern as aj, parseTanStackRoutePattern as ak, tanStackSegmentsOfRoutePath as al, validateUrlAgainstPattern as am, getSourcePathFromRoute as an, isPageRouter as ao, describeSchemeRejection as ap, isCheckableScheme as aq, rejectScheme as ar, schemeOf as as, UNSAFE_URL_SCHEMES as at, _createClass as b, _classCallCheck as c, _toConsumableArray as d, DEFAULT_APP_HOST as e, DEFAULT_STATIC_HOST as f, extractValModules as g, computeValModuleShas as h, initVal as i, computeSourcesSha as j, computeSchemaSha as k, hasRemoteFileSchema as l, modules as m, hasMediaSchema as n, DEFAULT_VAL_REMOTE_HOST as o, derefPatch as p, StringSchema as q, ImageSchema as r, splitModuleFilePathAndModulePath as s, FileSchema as t, DEFAULT_FONT_ACCEPT as u, FONT_MIME_TYPES as v, VideoSchema as w, DEFAULT_VIDEO_ACCEPT as x, DEFAULT_VIDEO_RENDITIONS as y, DEFAULT_VIDEO_SEGMENT_DURATION as z };
|
|
@@ -3604,7 +3604,7 @@ var EXT_TO_MIME_TYPES = {
|
|
|
3604
3604
|
sxw: "application/vnd.sun.xml.writer",
|
|
3605
3605
|
sxg: "application/vnd.sun.xml.writer.global",
|
|
3606
3606
|
stw: "application/vnd.sun.xml.writer.template",
|
|
3607
|
-
otf: "
|
|
3607
|
+
otf: "font/otf",
|
|
3608
3608
|
osfpvg: "application/vnd.yamaha.openscoreformat.osfpvg+xml",
|
|
3609
3609
|
dp: "application/vnd.osgi.dp",
|
|
3610
3610
|
pdb: "application/vnd.palm",
|
|
@@ -3754,7 +3754,8 @@ var EXT_TO_MIME_TYPES = {
|
|
|
3754
3754
|
mxs: "application/vnd.triscape.mxs",
|
|
3755
3755
|
t: "text/troff",
|
|
3756
3756
|
tra: "application/vnd.trueapp",
|
|
3757
|
-
ttf: "
|
|
3757
|
+
ttf: "font/ttf",
|
|
3758
|
+
ttc: "font/collection",
|
|
3758
3759
|
ttl: "text/turtle",
|
|
3759
3760
|
umj: "application/vnd.umajin",
|
|
3760
3761
|
uoml: "application/vnd.uoml+xml",
|
|
@@ -3781,7 +3782,8 @@ var EXT_TO_MIME_TYPES = {
|
|
|
3781
3782
|
wbmp: "image/vnd.wap.wbmp",
|
|
3782
3783
|
wav: "audio/x-wav",
|
|
3783
3784
|
davmount: "application/davmount+xml",
|
|
3784
|
-
woff: "
|
|
3785
|
+
woff: "font/woff",
|
|
3786
|
+
woff2: "font/woff2",
|
|
3785
3787
|
wspolicy: "application/wspolicy+xml",
|
|
3786
3788
|
webp: "image/webp",
|
|
3787
3789
|
wtb: "application/vnd.webturbo",
|
|
@@ -3883,6 +3885,93 @@ function mimeTypeMatchesAccept(mimeType, accept) {
|
|
|
3883
3885
|
});
|
|
3884
3886
|
}
|
|
3885
3887
|
|
|
3888
|
+
/**
|
|
3889
|
+
* Fonts, as far as a mime type can tell.
|
|
3890
|
+
*
|
|
3891
|
+
* The four web formats have IANA types under `font/` (RFC 8081), and those are
|
|
3892
|
+
* what Val stores. Browsers and operating systems disagree about them: a file
|
|
3893
|
+
* picker reports `.woff2` as `font/woff2`, `application/font-woff2` or nothing
|
|
3894
|
+
* at all depending on the platform, and nothing at all reads as
|
|
3895
|
+
* `application/octet-stream` once the file is a data URL. That is why an upload
|
|
3896
|
+
* asks the BYTES ({@link sniffFontMimeType}) rather than trusting the picker.
|
|
3897
|
+
*/
|
|
3898
|
+
|
|
3899
|
+
/** The formats `s.fontset()` accepts unless told otherwise, best first. */
|
|
3900
|
+
var FONT_MIME_TYPES = ["font/woff2", "font/woff", "font/ttf", "font/otf"];
|
|
3901
|
+
|
|
3902
|
+
/** `s.fontset()`'s `accept` when none is given. */
|
|
3903
|
+
var DEFAULT_FONT_ACCEPT = FONT_MIME_TYPES.join(",");
|
|
3904
|
+
|
|
3905
|
+
/**
|
|
3906
|
+
* The extension of each font type, for a file input: a picker matches an
|
|
3907
|
+
* `accept` of mime types through the operating system's own table, and where
|
|
3908
|
+
* that table does not know `font/woff2` the file is greyed out.
|
|
3909
|
+
*/
|
|
3910
|
+
var FONT_MIME_TYPE_EXTENSIONS = {
|
|
3911
|
+
"font/woff2": ".woff2",
|
|
3912
|
+
"font/woff": ".woff",
|
|
3913
|
+
"font/ttf": ".ttf",
|
|
3914
|
+
"font/otf": ".otf",
|
|
3915
|
+
"font/collection": ".ttc"
|
|
3916
|
+
};
|
|
3917
|
+
|
|
3918
|
+
/**
|
|
3919
|
+
* The names the extension table used for fonts before it used RFC 8081's.
|
|
3920
|
+
* Content written then still carries them, and it is the same file.
|
|
3921
|
+
*/
|
|
3922
|
+
var LEGACY_FONT_MIME_TYPES = {
|
|
3923
|
+
"application/x-font-ttf": "font/ttf",
|
|
3924
|
+
"application/x-font-otf": "font/otf",
|
|
3925
|
+
"application/x-font-woff": "font/woff"
|
|
3926
|
+
};
|
|
3927
|
+
|
|
3928
|
+
/** `mimeType`, with a legacy font name read as its `font/` type. */
|
|
3929
|
+
function canonicalFontMimeType(mimeType) {
|
|
3930
|
+
var _LEGACY_FONT_MIME_TYP;
|
|
3931
|
+
return (_LEGACY_FONT_MIME_TYP = LEGACY_FONT_MIME_TYPES[mimeType]) !== null && _LEGACY_FONT_MIME_TYP !== void 0 ? _LEGACY_FONT_MIME_TYP : mimeType;
|
|
3932
|
+
}
|
|
3933
|
+
|
|
3934
|
+
/**
|
|
3935
|
+
* Whether a file of `mimeType` is a font a browser can draw: the `font/` types,
|
|
3936
|
+
* and the pre-RFC 8081 names still found in older data.
|
|
3937
|
+
*/
|
|
3938
|
+
function isFontMimeType(mimeType) {
|
|
3939
|
+
if (!mimeType) {
|
|
3940
|
+
return false;
|
|
3941
|
+
}
|
|
3942
|
+
return mimeType.startsWith("font/") || mimeType.startsWith("application/x-font-") || mimeType === "application/font-woff" || mimeType === "application/font-woff2" || mimeType === "application/font-sfnt" || mimeType === "application/vnd.ms-opentype";
|
|
3943
|
+
}
|
|
3944
|
+
|
|
3945
|
+
/**
|
|
3946
|
+
* The font type of `bytes`, read from the signature every font format starts
|
|
3947
|
+
* with, or `null` when they are not a font.
|
|
3948
|
+
*
|
|
3949
|
+
* Only the first four bytes are needed: the WOFF signatures (`wOFF`, `wOF2`),
|
|
3950
|
+
* the SFNT versions of TrueType (`0x00010000`, or `true` from old Apple fonts)
|
|
3951
|
+
* and of CFF-flavoured OpenType (`OTTO`), and a collection's tag (`ttcf`).
|
|
3952
|
+
*/
|
|
3953
|
+
function sniffFontMimeType(bytes) {
|
|
3954
|
+
if (bytes.length < 4) {
|
|
3955
|
+
return null;
|
|
3956
|
+
}
|
|
3957
|
+
var tag = String.fromCharCode(bytes[0], bytes[1], bytes[2], bytes[3]);
|
|
3958
|
+
switch (tag) {
|
|
3959
|
+
case "wOF2":
|
|
3960
|
+
return "font/woff2";
|
|
3961
|
+
case "wOFF":
|
|
3962
|
+
return "font/woff";
|
|
3963
|
+
case "OTTO":
|
|
3964
|
+
return "font/otf";
|
|
3965
|
+
case "true":
|
|
3966
|
+
case "\0\x01\0\0":
|
|
3967
|
+
return "font/ttf";
|
|
3968
|
+
case "ttcf":
|
|
3969
|
+
return "font/collection";
|
|
3970
|
+
default:
|
|
3971
|
+
return null;
|
|
3972
|
+
}
|
|
3973
|
+
}
|
|
3974
|
+
|
|
3886
3975
|
/**
|
|
3887
3976
|
* How an uploaded image is re-encoded in the browser, before it is uploaded.
|
|
3888
3977
|
*
|
|
@@ -10904,7 +10993,9 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10904
10993
|
// fix was offered -- and the `file:add-metadata` branch below could never be
|
|
10905
10994
|
// reached for any file whose extension is recognized, which is all of them
|
|
10906
10995
|
// that get this far.
|
|
10907
|
-
|
|
10996
|
+
// A legacy font name (`application/x-font-ttf`) is what the extension
|
|
10997
|
+
// table itself used to say, so it is not a mismatch.
|
|
10998
|
+
if (mimeType && fileMimeType !== canonicalFontMimeType(mimeType)) {
|
|
10908
10999
|
return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
|
|
10909
11000
|
message: "Mime type and file extension not matching. Mime type is '".concat(mimeType, "' but file extension is '").concat(fileMimeType, "'"),
|
|
10910
11001
|
value: src
|
|
@@ -11098,6 +11189,38 @@ function fileOf(remote, options) {
|
|
|
11098
11189
|
return new FileSchema(options, false, remote);
|
|
11099
11190
|
}
|
|
11100
11191
|
|
|
11192
|
+
/**
|
|
11193
|
+
* A font picked from an `s.fontset()`.
|
|
11194
|
+
*
|
|
11195
|
+
* The same field `s.file(fontsVal)` is — it stores `{ path }` and serializes
|
|
11196
|
+
* identically — with one thing more: it refuses a set that is not a font set,
|
|
11197
|
+
* at definition, so a field called a font cannot end up offering PDFs. What the
|
|
11198
|
+
* Studio does with it (a specimen in its parent, the set to pick from when
|
|
11199
|
+
* opened) it does for any file field backed by a font set.
|
|
11200
|
+
*/
|
|
11201
|
+
function font(fontsetModule) {
|
|
11202
|
+
assertFontset(fontsetModule);
|
|
11203
|
+
return file(fontsetModule);
|
|
11204
|
+
}
|
|
11205
|
+
|
|
11206
|
+
/** `s.font()` with `.remote()` applied: see `files.remote` in `initSchema`. */
|
|
11207
|
+
function remoteFont(fontsetModule) {
|
|
11208
|
+
assertFontset(fontsetModule);
|
|
11209
|
+
return remoteFile(fontsetModule);
|
|
11210
|
+
}
|
|
11211
|
+
function assertFontset(fontsetModule) {
|
|
11212
|
+
var _getSchema;
|
|
11213
|
+
var modulePath = getValPath(fontsetModule);
|
|
11214
|
+
var serialized = (_getSchema = getSchema(fontsetModule)) === null || _getSchema === void 0 ? void 0 : _getSchema["executeSerialize"]();
|
|
11215
|
+
var accept = (serialized === null || serialized === void 0 ? void 0 : serialized.type) === "record" && serialized.mediaType === "files" ? serialized.accept : undefined;
|
|
11216
|
+
var isFontset = !!accept && accept.split(",").every(function (type) {
|
|
11217
|
+
return isFontMimeType(type.trim());
|
|
11218
|
+
});
|
|
11219
|
+
if (!isFontset) {
|
|
11220
|
+
throw new Error("s.font(".concat(modulePath !== null && modulePath !== void 0 ? modulePath : "?", "): the module must be an s.fontset(). Use s.file() to pick from a set of other files."));
|
|
11221
|
+
}
|
|
11222
|
+
}
|
|
11223
|
+
|
|
11101
11224
|
/**
|
|
11102
11225
|
* Turn an upload into an HLS stream, in the browser, before it is uploaded.
|
|
11103
11226
|
*
|
|
@@ -11721,6 +11844,50 @@ var fileset = function fileset(options) {
|
|
|
11721
11844
|
});
|
|
11722
11845
|
};
|
|
11723
11846
|
|
|
11847
|
+
/**
|
|
11848
|
+
* Options for s.fontset()
|
|
11849
|
+
*/
|
|
11850
|
+
|
|
11851
|
+
/**
|
|
11852
|
+
* Define a collection of fonts.
|
|
11853
|
+
*
|
|
11854
|
+
* A fontset IS a fileset — the same source, the same `s.file(fontsVal)` field
|
|
11855
|
+
* to pick from it, the same checks and fixes — with `accept` defaulting to the
|
|
11856
|
+
* web font formats. What a font gets that any other file does not is decided
|
|
11857
|
+
* by its mime type rather than by the set: the Studio previews any file it
|
|
11858
|
+
* knows is a font, wherever it is shown.
|
|
11859
|
+
*
|
|
11860
|
+
* Remote is off by default: call `.remote()` on the result to allow remote files.
|
|
11861
|
+
*
|
|
11862
|
+
* @example
|
|
11863
|
+
* ```typescript
|
|
11864
|
+
* const schema = s.fontset({ dir: "/public/val/fonts" });
|
|
11865
|
+
* export default c.define("/content/fonts.val.ts", schema, {
|
|
11866
|
+
* "/public/val/fonts/inter_a1b2c.woff2": {
|
|
11867
|
+
* mimeType: "font/woff2",
|
|
11868
|
+
* },
|
|
11869
|
+
* });
|
|
11870
|
+
* ```
|
|
11871
|
+
*/
|
|
11872
|
+
var fontset = function fontset(options) {
|
|
11873
|
+
var _options$accept;
|
|
11874
|
+
var accept = (_options$accept = options.accept) !== null && _options$accept !== void 0 ? _options$accept : DEFAULT_FONT_ACCEPT;
|
|
11875
|
+
var notFonts = accept.split(",").map(function (type) {
|
|
11876
|
+
return type.trim();
|
|
11877
|
+
}).filter(function (type) {
|
|
11878
|
+
return !isFontMimeType(type);
|
|
11879
|
+
});
|
|
11880
|
+
if (notFonts.length > 0) {
|
|
11881
|
+
// A fontset that took a PDF would be a fileset under a name that says
|
|
11882
|
+
// otherwise, and the Studio would draw a specimen of nothing.
|
|
11883
|
+
throw new Error("s.fontset(): 'accept' may only name font types (font/woff2, font/woff, font/ttf, font/otf or font/*). Got: ".concat(notFonts.join(", "), ". Use s.fileset() for other files."));
|
|
11884
|
+
}
|
|
11885
|
+
return fileset({
|
|
11886
|
+
dir: options.dir,
|
|
11887
|
+
accept: accept
|
|
11888
|
+
});
|
|
11889
|
+
};
|
|
11890
|
+
|
|
11724
11891
|
var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
11725
11892
|
function DateSchema(options) {
|
|
11726
11893
|
var _this;
|
|
@@ -12766,6 +12933,7 @@ function initSchema(options) {
|
|
|
12766
12933
|
var media = (options === null || options === void 0 ? void 0 : options.remote) === true ? {
|
|
12767
12934
|
image: remoteImage,
|
|
12768
12935
|
file: remoteFile,
|
|
12936
|
+
font: remoteFont,
|
|
12769
12937
|
video: remoteVideo,
|
|
12770
12938
|
richtext: remoteRichtext,
|
|
12771
12939
|
imageset: function (options) {
|
|
@@ -12774,16 +12942,21 @@ function initSchema(options) {
|
|
|
12774
12942
|
fileset: function (options) {
|
|
12775
12943
|
return fileset(options).remote();
|
|
12776
12944
|
},
|
|
12945
|
+
fontset: function (options) {
|
|
12946
|
+
return fontset(options).remote();
|
|
12947
|
+
},
|
|
12777
12948
|
videoset: function (options) {
|
|
12778
12949
|
return videoset(options).remote();
|
|
12779
12950
|
}
|
|
12780
12951
|
} : {
|
|
12781
12952
|
image: image,
|
|
12782
12953
|
file: file,
|
|
12954
|
+
font: font,
|
|
12783
12955
|
video: video,
|
|
12784
12956
|
richtext: richtext,
|
|
12785
12957
|
imageset: imageset,
|
|
12786
12958
|
fileset: fileset,
|
|
12959
|
+
fontset: fontset,
|
|
12787
12960
|
videoset: videoset
|
|
12788
12961
|
};
|
|
12789
12962
|
// locales: F.Narrow<Locales>
|
|
@@ -12804,8 +12977,10 @@ function initSchema(options) {
|
|
|
12804
12977
|
view: view,
|
|
12805
12978
|
record: record,
|
|
12806
12979
|
file: media.file,
|
|
12980
|
+
font: media.font,
|
|
12807
12981
|
video: media.video,
|
|
12808
12982
|
fileset: media.fileset,
|
|
12983
|
+
fontset: media.fontset,
|
|
12809
12984
|
date: date,
|
|
12810
12985
|
datetime: datetime,
|
|
12811
12986
|
color: color,
|
|
@@ -15484,7 +15659,7 @@ function isPageRouter(routerId) {
|
|
|
15484
15659
|
|
|
15485
15660
|
var corePackageJson = {
|
|
15486
15661
|
name: "@valbuild/core",
|
|
15487
|
-
version: "0.
|
|
15662
|
+
version: "0.143.0",
|
|
15488
15663
|
"private": false,
|
|
15489
15664
|
description: "Val - supercharged hard-coded content",
|
|
15490
15665
|
repository: {
|
|
@@ -15654,6 +15829,9 @@ var Internal = {
|
|
|
15654
15829
|
mimeTypeMatchesAccept: mimeTypeMatchesAccept,
|
|
15655
15830
|
EXT_TO_MIME_TYPES: EXT_TO_MIME_TYPES,
|
|
15656
15831
|
MIME_TYPES_TO_EXT: MIME_TYPES_TO_EXT,
|
|
15832
|
+
FONT_MIME_TYPE_EXTENSIONS: FONT_MIME_TYPE_EXTENSIONS,
|
|
15833
|
+
isFontMimeType: isFontMimeType,
|
|
15834
|
+
sniffFontMimeType: sniffFontMimeType,
|
|
15657
15835
|
ModuleFilePathSep: ModuleFilePathSep,
|
|
15658
15836
|
notFileOp: function notFileOp(op) {
|
|
15659
15837
|
return op.op !== "file";
|
|
@@ -15715,6 +15893,7 @@ exports.ColorSchema = ColorSchema;
|
|
|
15715
15893
|
exports.DEFAULT_APP_HOST = DEFAULT_APP_HOST;
|
|
15716
15894
|
exports.DEFAULT_COLOR_FORMAT = DEFAULT_COLOR_FORMAT;
|
|
15717
15895
|
exports.DEFAULT_CONTENT_HOST = DEFAULT_CONTENT_HOST;
|
|
15896
|
+
exports.DEFAULT_FONT_ACCEPT = DEFAULT_FONT_ACCEPT;
|
|
15718
15897
|
exports.DEFAULT_STATIC_HOST = DEFAULT_STATIC_HOST;
|
|
15719
15898
|
exports.DEFAULT_VAL_REMOTE_HOST = DEFAULT_VAL_REMOTE_HOST;
|
|
15720
15899
|
exports.DEFAULT_VIDEO_ACCEPT = DEFAULT_VIDEO_ACCEPT;
|
|
@@ -15725,6 +15904,7 @@ exports.DateTimeSchema = DateTimeSchema;
|
|
|
15725
15904
|
exports.DiscriminatedUnionSchema = DiscriminatedUnionSchema;
|
|
15726
15905
|
exports.EnumSchema = EnumSchema;
|
|
15727
15906
|
exports.FATAL_ERROR_TYPES = FATAL_ERROR_TYPES;
|
|
15907
|
+
exports.FONT_MIME_TYPES = FONT_MIME_TYPES;
|
|
15728
15908
|
exports.FileSchema = FileSchema;
|
|
15729
15909
|
exports.GenericSelector = GenericSelector;
|
|
15730
15910
|
exports.ImageSchema = ImageSchema;
|
|
@@ -3604,7 +3604,7 @@ var EXT_TO_MIME_TYPES = {
|
|
|
3604
3604
|
sxw: "application/vnd.sun.xml.writer",
|
|
3605
3605
|
sxg: "application/vnd.sun.xml.writer.global",
|
|
3606
3606
|
stw: "application/vnd.sun.xml.writer.template",
|
|
3607
|
-
otf: "
|
|
3607
|
+
otf: "font/otf",
|
|
3608
3608
|
osfpvg: "application/vnd.yamaha.openscoreformat.osfpvg+xml",
|
|
3609
3609
|
dp: "application/vnd.osgi.dp",
|
|
3610
3610
|
pdb: "application/vnd.palm",
|
|
@@ -3754,7 +3754,8 @@ var EXT_TO_MIME_TYPES = {
|
|
|
3754
3754
|
mxs: "application/vnd.triscape.mxs",
|
|
3755
3755
|
t: "text/troff",
|
|
3756
3756
|
tra: "application/vnd.trueapp",
|
|
3757
|
-
ttf: "
|
|
3757
|
+
ttf: "font/ttf",
|
|
3758
|
+
ttc: "font/collection",
|
|
3758
3759
|
ttl: "text/turtle",
|
|
3759
3760
|
umj: "application/vnd.umajin",
|
|
3760
3761
|
uoml: "application/vnd.uoml+xml",
|
|
@@ -3781,7 +3782,8 @@ var EXT_TO_MIME_TYPES = {
|
|
|
3781
3782
|
wbmp: "image/vnd.wap.wbmp",
|
|
3782
3783
|
wav: "audio/x-wav",
|
|
3783
3784
|
davmount: "application/davmount+xml",
|
|
3784
|
-
woff: "
|
|
3785
|
+
woff: "font/woff",
|
|
3786
|
+
woff2: "font/woff2",
|
|
3785
3787
|
wspolicy: "application/wspolicy+xml",
|
|
3786
3788
|
webp: "image/webp",
|
|
3787
3789
|
wtb: "application/vnd.webturbo",
|
|
@@ -3883,6 +3885,93 @@ function mimeTypeMatchesAccept(mimeType, accept) {
|
|
|
3883
3885
|
});
|
|
3884
3886
|
}
|
|
3885
3887
|
|
|
3888
|
+
/**
|
|
3889
|
+
* Fonts, as far as a mime type can tell.
|
|
3890
|
+
*
|
|
3891
|
+
* The four web formats have IANA types under `font/` (RFC 8081), and those are
|
|
3892
|
+
* what Val stores. Browsers and operating systems disagree about them: a file
|
|
3893
|
+
* picker reports `.woff2` as `font/woff2`, `application/font-woff2` or nothing
|
|
3894
|
+
* at all depending on the platform, and nothing at all reads as
|
|
3895
|
+
* `application/octet-stream` once the file is a data URL. That is why an upload
|
|
3896
|
+
* asks the BYTES ({@link sniffFontMimeType}) rather than trusting the picker.
|
|
3897
|
+
*/
|
|
3898
|
+
|
|
3899
|
+
/** The formats `s.fontset()` accepts unless told otherwise, best first. */
|
|
3900
|
+
var FONT_MIME_TYPES = ["font/woff2", "font/woff", "font/ttf", "font/otf"];
|
|
3901
|
+
|
|
3902
|
+
/** `s.fontset()`'s `accept` when none is given. */
|
|
3903
|
+
var DEFAULT_FONT_ACCEPT = FONT_MIME_TYPES.join(",");
|
|
3904
|
+
|
|
3905
|
+
/**
|
|
3906
|
+
* The extension of each font type, for a file input: a picker matches an
|
|
3907
|
+
* `accept` of mime types through the operating system's own table, and where
|
|
3908
|
+
* that table does not know `font/woff2` the file is greyed out.
|
|
3909
|
+
*/
|
|
3910
|
+
var FONT_MIME_TYPE_EXTENSIONS = {
|
|
3911
|
+
"font/woff2": ".woff2",
|
|
3912
|
+
"font/woff": ".woff",
|
|
3913
|
+
"font/ttf": ".ttf",
|
|
3914
|
+
"font/otf": ".otf",
|
|
3915
|
+
"font/collection": ".ttc"
|
|
3916
|
+
};
|
|
3917
|
+
|
|
3918
|
+
/**
|
|
3919
|
+
* The names the extension table used for fonts before it used RFC 8081's.
|
|
3920
|
+
* Content written then still carries them, and it is the same file.
|
|
3921
|
+
*/
|
|
3922
|
+
var LEGACY_FONT_MIME_TYPES = {
|
|
3923
|
+
"application/x-font-ttf": "font/ttf",
|
|
3924
|
+
"application/x-font-otf": "font/otf",
|
|
3925
|
+
"application/x-font-woff": "font/woff"
|
|
3926
|
+
};
|
|
3927
|
+
|
|
3928
|
+
/** `mimeType`, with a legacy font name read as its `font/` type. */
|
|
3929
|
+
function canonicalFontMimeType(mimeType) {
|
|
3930
|
+
var _LEGACY_FONT_MIME_TYP;
|
|
3931
|
+
return (_LEGACY_FONT_MIME_TYP = LEGACY_FONT_MIME_TYPES[mimeType]) !== null && _LEGACY_FONT_MIME_TYP !== void 0 ? _LEGACY_FONT_MIME_TYP : mimeType;
|
|
3932
|
+
}
|
|
3933
|
+
|
|
3934
|
+
/**
|
|
3935
|
+
* Whether a file of `mimeType` is a font a browser can draw: the `font/` types,
|
|
3936
|
+
* and the pre-RFC 8081 names still found in older data.
|
|
3937
|
+
*/
|
|
3938
|
+
function isFontMimeType(mimeType) {
|
|
3939
|
+
if (!mimeType) {
|
|
3940
|
+
return false;
|
|
3941
|
+
}
|
|
3942
|
+
return mimeType.startsWith("font/") || mimeType.startsWith("application/x-font-") || mimeType === "application/font-woff" || mimeType === "application/font-woff2" || mimeType === "application/font-sfnt" || mimeType === "application/vnd.ms-opentype";
|
|
3943
|
+
}
|
|
3944
|
+
|
|
3945
|
+
/**
|
|
3946
|
+
* The font type of `bytes`, read from the signature every font format starts
|
|
3947
|
+
* with, or `null` when they are not a font.
|
|
3948
|
+
*
|
|
3949
|
+
* Only the first four bytes are needed: the WOFF signatures (`wOFF`, `wOF2`),
|
|
3950
|
+
* the SFNT versions of TrueType (`0x00010000`, or `true` from old Apple fonts)
|
|
3951
|
+
* and of CFF-flavoured OpenType (`OTTO`), and a collection's tag (`ttcf`).
|
|
3952
|
+
*/
|
|
3953
|
+
function sniffFontMimeType(bytes) {
|
|
3954
|
+
if (bytes.length < 4) {
|
|
3955
|
+
return null;
|
|
3956
|
+
}
|
|
3957
|
+
var tag = String.fromCharCode(bytes[0], bytes[1], bytes[2], bytes[3]);
|
|
3958
|
+
switch (tag) {
|
|
3959
|
+
case "wOF2":
|
|
3960
|
+
return "font/woff2";
|
|
3961
|
+
case "wOFF":
|
|
3962
|
+
return "font/woff";
|
|
3963
|
+
case "OTTO":
|
|
3964
|
+
return "font/otf";
|
|
3965
|
+
case "true":
|
|
3966
|
+
case "\0\x01\0\0":
|
|
3967
|
+
return "font/ttf";
|
|
3968
|
+
case "ttcf":
|
|
3969
|
+
return "font/collection";
|
|
3970
|
+
default:
|
|
3971
|
+
return null;
|
|
3972
|
+
}
|
|
3973
|
+
}
|
|
3974
|
+
|
|
3886
3975
|
/**
|
|
3887
3976
|
* How an uploaded image is re-encoded in the browser, before it is uploaded.
|
|
3888
3977
|
*
|
|
@@ -10904,7 +10993,9 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10904
10993
|
// fix was offered -- and the `file:add-metadata` branch below could never be
|
|
10905
10994
|
// reached for any file whose extension is recognized, which is all of them
|
|
10906
10995
|
// that get this far.
|
|
10907
|
-
|
|
10996
|
+
// A legacy font name (`application/x-font-ttf`) is what the extension
|
|
10997
|
+
// table itself used to say, so it is not a mismatch.
|
|
10998
|
+
if (mimeType && fileMimeType !== canonicalFontMimeType(mimeType)) {
|
|
10908
10999
|
return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
|
|
10909
11000
|
message: "Mime type and file extension not matching. Mime type is '".concat(mimeType, "' but file extension is '").concat(fileMimeType, "'"),
|
|
10910
11001
|
value: src
|
|
@@ -11098,6 +11189,38 @@ function fileOf(remote, options) {
|
|
|
11098
11189
|
return new FileSchema(options, false, remote);
|
|
11099
11190
|
}
|
|
11100
11191
|
|
|
11192
|
+
/**
|
|
11193
|
+
* A font picked from an `s.fontset()`.
|
|
11194
|
+
*
|
|
11195
|
+
* The same field `s.file(fontsVal)` is — it stores `{ path }` and serializes
|
|
11196
|
+
* identically — with one thing more: it refuses a set that is not a font set,
|
|
11197
|
+
* at definition, so a field called a font cannot end up offering PDFs. What the
|
|
11198
|
+
* Studio does with it (a specimen in its parent, the set to pick from when
|
|
11199
|
+
* opened) it does for any file field backed by a font set.
|
|
11200
|
+
*/
|
|
11201
|
+
function font(fontsetModule) {
|
|
11202
|
+
assertFontset(fontsetModule);
|
|
11203
|
+
return file(fontsetModule);
|
|
11204
|
+
}
|
|
11205
|
+
|
|
11206
|
+
/** `s.font()` with `.remote()` applied: see `files.remote` in `initSchema`. */
|
|
11207
|
+
function remoteFont(fontsetModule) {
|
|
11208
|
+
assertFontset(fontsetModule);
|
|
11209
|
+
return remoteFile(fontsetModule);
|
|
11210
|
+
}
|
|
11211
|
+
function assertFontset(fontsetModule) {
|
|
11212
|
+
var _getSchema;
|
|
11213
|
+
var modulePath = getValPath(fontsetModule);
|
|
11214
|
+
var serialized = (_getSchema = getSchema(fontsetModule)) === null || _getSchema === void 0 ? void 0 : _getSchema["executeSerialize"]();
|
|
11215
|
+
var accept = (serialized === null || serialized === void 0 ? void 0 : serialized.type) === "record" && serialized.mediaType === "files" ? serialized.accept : undefined;
|
|
11216
|
+
var isFontset = !!accept && accept.split(",").every(function (type) {
|
|
11217
|
+
return isFontMimeType(type.trim());
|
|
11218
|
+
});
|
|
11219
|
+
if (!isFontset) {
|
|
11220
|
+
throw new Error("s.font(".concat(modulePath !== null && modulePath !== void 0 ? modulePath : "?", "): the module must be an s.fontset(). Use s.file() to pick from a set of other files."));
|
|
11221
|
+
}
|
|
11222
|
+
}
|
|
11223
|
+
|
|
11101
11224
|
/**
|
|
11102
11225
|
* Turn an upload into an HLS stream, in the browser, before it is uploaded.
|
|
11103
11226
|
*
|
|
@@ -11721,6 +11844,50 @@ var fileset = function fileset(options) {
|
|
|
11721
11844
|
});
|
|
11722
11845
|
};
|
|
11723
11846
|
|
|
11847
|
+
/**
|
|
11848
|
+
* Options for s.fontset()
|
|
11849
|
+
*/
|
|
11850
|
+
|
|
11851
|
+
/**
|
|
11852
|
+
* Define a collection of fonts.
|
|
11853
|
+
*
|
|
11854
|
+
* A fontset IS a fileset — the same source, the same `s.file(fontsVal)` field
|
|
11855
|
+
* to pick from it, the same checks and fixes — with `accept` defaulting to the
|
|
11856
|
+
* web font formats. What a font gets that any other file does not is decided
|
|
11857
|
+
* by its mime type rather than by the set: the Studio previews any file it
|
|
11858
|
+
* knows is a font, wherever it is shown.
|
|
11859
|
+
*
|
|
11860
|
+
* Remote is off by default: call `.remote()` on the result to allow remote files.
|
|
11861
|
+
*
|
|
11862
|
+
* @example
|
|
11863
|
+
* ```typescript
|
|
11864
|
+
* const schema = s.fontset({ dir: "/public/val/fonts" });
|
|
11865
|
+
* export default c.define("/content/fonts.val.ts", schema, {
|
|
11866
|
+
* "/public/val/fonts/inter_a1b2c.woff2": {
|
|
11867
|
+
* mimeType: "font/woff2",
|
|
11868
|
+
* },
|
|
11869
|
+
* });
|
|
11870
|
+
* ```
|
|
11871
|
+
*/
|
|
11872
|
+
var fontset = function fontset(options) {
|
|
11873
|
+
var _options$accept;
|
|
11874
|
+
var accept = (_options$accept = options.accept) !== null && _options$accept !== void 0 ? _options$accept : DEFAULT_FONT_ACCEPT;
|
|
11875
|
+
var notFonts = accept.split(",").map(function (type) {
|
|
11876
|
+
return type.trim();
|
|
11877
|
+
}).filter(function (type) {
|
|
11878
|
+
return !isFontMimeType(type);
|
|
11879
|
+
});
|
|
11880
|
+
if (notFonts.length > 0) {
|
|
11881
|
+
// A fontset that took a PDF would be a fileset under a name that says
|
|
11882
|
+
// otherwise, and the Studio would draw a specimen of nothing.
|
|
11883
|
+
throw new Error("s.fontset(): 'accept' may only name font types (font/woff2, font/woff, font/ttf, font/otf or font/*). Got: ".concat(notFonts.join(", "), ". Use s.fileset() for other files."));
|
|
11884
|
+
}
|
|
11885
|
+
return fileset({
|
|
11886
|
+
dir: options.dir,
|
|
11887
|
+
accept: accept
|
|
11888
|
+
});
|
|
11889
|
+
};
|
|
11890
|
+
|
|
11724
11891
|
var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
11725
11892
|
function DateSchema(options) {
|
|
11726
11893
|
var _this;
|
|
@@ -12766,6 +12933,7 @@ function initSchema(options) {
|
|
|
12766
12933
|
var media = (options === null || options === void 0 ? void 0 : options.remote) === true ? {
|
|
12767
12934
|
image: remoteImage,
|
|
12768
12935
|
file: remoteFile,
|
|
12936
|
+
font: remoteFont,
|
|
12769
12937
|
video: remoteVideo,
|
|
12770
12938
|
richtext: remoteRichtext,
|
|
12771
12939
|
imageset: function (options) {
|
|
@@ -12774,16 +12942,21 @@ function initSchema(options) {
|
|
|
12774
12942
|
fileset: function (options) {
|
|
12775
12943
|
return fileset(options).remote();
|
|
12776
12944
|
},
|
|
12945
|
+
fontset: function (options) {
|
|
12946
|
+
return fontset(options).remote();
|
|
12947
|
+
},
|
|
12777
12948
|
videoset: function (options) {
|
|
12778
12949
|
return videoset(options).remote();
|
|
12779
12950
|
}
|
|
12780
12951
|
} : {
|
|
12781
12952
|
image: image,
|
|
12782
12953
|
file: file,
|
|
12954
|
+
font: font,
|
|
12783
12955
|
video: video,
|
|
12784
12956
|
richtext: richtext,
|
|
12785
12957
|
imageset: imageset,
|
|
12786
12958
|
fileset: fileset,
|
|
12959
|
+
fontset: fontset,
|
|
12787
12960
|
videoset: videoset
|
|
12788
12961
|
};
|
|
12789
12962
|
// locales: F.Narrow<Locales>
|
|
@@ -12804,8 +12977,10 @@ function initSchema(options) {
|
|
|
12804
12977
|
view: view,
|
|
12805
12978
|
record: record,
|
|
12806
12979
|
file: media.file,
|
|
12980
|
+
font: media.font,
|
|
12807
12981
|
video: media.video,
|
|
12808
12982
|
fileset: media.fileset,
|
|
12983
|
+
fontset: media.fontset,
|
|
12809
12984
|
date: date,
|
|
12810
12985
|
datetime: datetime,
|
|
12811
12986
|
color: color,
|
|
@@ -15484,7 +15659,7 @@ function isPageRouter(routerId) {
|
|
|
15484
15659
|
|
|
15485
15660
|
var corePackageJson = {
|
|
15486
15661
|
name: "@valbuild/core",
|
|
15487
|
-
version: "0.
|
|
15662
|
+
version: "0.143.0",
|
|
15488
15663
|
"private": false,
|
|
15489
15664
|
description: "Val - supercharged hard-coded content",
|
|
15490
15665
|
repository: {
|
|
@@ -15654,6 +15829,9 @@ var Internal = {
|
|
|
15654
15829
|
mimeTypeMatchesAccept: mimeTypeMatchesAccept,
|
|
15655
15830
|
EXT_TO_MIME_TYPES: EXT_TO_MIME_TYPES,
|
|
15656
15831
|
MIME_TYPES_TO_EXT: MIME_TYPES_TO_EXT,
|
|
15832
|
+
FONT_MIME_TYPE_EXTENSIONS: FONT_MIME_TYPE_EXTENSIONS,
|
|
15833
|
+
isFontMimeType: isFontMimeType,
|
|
15834
|
+
sniffFontMimeType: sniffFontMimeType,
|
|
15657
15835
|
ModuleFilePathSep: ModuleFilePathSep,
|
|
15658
15836
|
notFileOp: function notFileOp(op) {
|
|
15659
15837
|
return op.op !== "file";
|
|
@@ -15715,6 +15893,7 @@ exports.ColorSchema = ColorSchema;
|
|
|
15715
15893
|
exports.DEFAULT_APP_HOST = DEFAULT_APP_HOST;
|
|
15716
15894
|
exports.DEFAULT_COLOR_FORMAT = DEFAULT_COLOR_FORMAT;
|
|
15717
15895
|
exports.DEFAULT_CONTENT_HOST = DEFAULT_CONTENT_HOST;
|
|
15896
|
+
exports.DEFAULT_FONT_ACCEPT = DEFAULT_FONT_ACCEPT;
|
|
15718
15897
|
exports.DEFAULT_STATIC_HOST = DEFAULT_STATIC_HOST;
|
|
15719
15898
|
exports.DEFAULT_VAL_REMOTE_HOST = DEFAULT_VAL_REMOTE_HOST;
|
|
15720
15899
|
exports.DEFAULT_VIDEO_ACCEPT = DEFAULT_VIDEO_ACCEPT;
|
|
@@ -15725,6 +15904,7 @@ exports.DateTimeSchema = DateTimeSchema;
|
|
|
15725
15904
|
exports.DiscriminatedUnionSchema = DiscriminatedUnionSchema;
|
|
15726
15905
|
exports.EnumSchema = EnumSchema;
|
|
15727
15906
|
exports.FATAL_ERROR_TYPES = FATAL_ERROR_TYPES;
|
|
15907
|
+
exports.FONT_MIME_TYPES = FONT_MIME_TYPES;
|
|
15728
15908
|
exports.FileSchema = FileSchema;
|
|
15729
15909
|
exports.GenericSelector = GenericSelector;
|
|
15730
15910
|
exports.ImageSchema = ImageSchema;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var dist_valbuildCore = require('./index-
|
|
5
|
+
var dist_valbuildCore = require('./index-aac8c69c.cjs.dev.js');
|
|
6
6
|
require('./result-bb1f436e.cjs.dev.js');
|
|
7
7
|
|
|
8
8
|
|
|
@@ -17,6 +17,7 @@ exports.ColorSchema = dist_valbuildCore.ColorSchema;
|
|
|
17
17
|
exports.DEFAULT_APP_HOST = dist_valbuildCore.DEFAULT_APP_HOST;
|
|
18
18
|
exports.DEFAULT_COLOR_FORMAT = dist_valbuildCore.DEFAULT_COLOR_FORMAT;
|
|
19
19
|
exports.DEFAULT_CONTENT_HOST = dist_valbuildCore.DEFAULT_CONTENT_HOST;
|
|
20
|
+
exports.DEFAULT_FONT_ACCEPT = dist_valbuildCore.DEFAULT_FONT_ACCEPT;
|
|
20
21
|
exports.DEFAULT_STATIC_HOST = dist_valbuildCore.DEFAULT_STATIC_HOST;
|
|
21
22
|
exports.DEFAULT_VAL_REMOTE_HOST = dist_valbuildCore.DEFAULT_VAL_REMOTE_HOST;
|
|
22
23
|
exports.DEFAULT_VIDEO_ACCEPT = dist_valbuildCore.DEFAULT_VIDEO_ACCEPT;
|
|
@@ -27,6 +28,7 @@ exports.DateTimeSchema = dist_valbuildCore.DateTimeSchema;
|
|
|
27
28
|
exports.DiscriminatedUnionSchema = dist_valbuildCore.DiscriminatedUnionSchema;
|
|
28
29
|
exports.EnumSchema = dist_valbuildCore.EnumSchema;
|
|
29
30
|
exports.FATAL_ERROR_TYPES = dist_valbuildCore.FATAL_ERROR_TYPES;
|
|
31
|
+
exports.FONT_MIME_TYPES = dist_valbuildCore.FONT_MIME_TYPES;
|
|
30
32
|
exports.FileSchema = dist_valbuildCore.FileSchema;
|
|
31
33
|
exports.GenericSelector = dist_valbuildCore.GenericSelector;
|
|
32
34
|
exports.ImageSchema = dist_valbuildCore.ImageSchema;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var dist_valbuildCore = require('./index-
|
|
5
|
+
var dist_valbuildCore = require('./index-46c72f01.cjs.prod.js');
|
|
6
6
|
require('./result-787e35f6.cjs.prod.js');
|
|
7
7
|
|
|
8
8
|
|
|
@@ -17,6 +17,7 @@ exports.ColorSchema = dist_valbuildCore.ColorSchema;
|
|
|
17
17
|
exports.DEFAULT_APP_HOST = dist_valbuildCore.DEFAULT_APP_HOST;
|
|
18
18
|
exports.DEFAULT_COLOR_FORMAT = dist_valbuildCore.DEFAULT_COLOR_FORMAT;
|
|
19
19
|
exports.DEFAULT_CONTENT_HOST = dist_valbuildCore.DEFAULT_CONTENT_HOST;
|
|
20
|
+
exports.DEFAULT_FONT_ACCEPT = dist_valbuildCore.DEFAULT_FONT_ACCEPT;
|
|
20
21
|
exports.DEFAULT_STATIC_HOST = dist_valbuildCore.DEFAULT_STATIC_HOST;
|
|
21
22
|
exports.DEFAULT_VAL_REMOTE_HOST = dist_valbuildCore.DEFAULT_VAL_REMOTE_HOST;
|
|
22
23
|
exports.DEFAULT_VIDEO_ACCEPT = dist_valbuildCore.DEFAULT_VIDEO_ACCEPT;
|
|
@@ -27,6 +28,7 @@ exports.DateTimeSchema = dist_valbuildCore.DateTimeSchema;
|
|
|
27
28
|
exports.DiscriminatedUnionSchema = dist_valbuildCore.DiscriminatedUnionSchema;
|
|
28
29
|
exports.EnumSchema = dist_valbuildCore.EnumSchema;
|
|
29
30
|
exports.FATAL_ERROR_TYPES = dist_valbuildCore.FATAL_ERROR_TYPES;
|
|
31
|
+
exports.FONT_MIME_TYPES = dist_valbuildCore.FONT_MIME_TYPES;
|
|
30
32
|
exports.FileSchema = dist_valbuildCore.FileSchema;
|
|
31
33
|
exports.GenericSelector = dist_valbuildCore.GenericSelector;
|
|
32
34
|
exports.ImageSchema = dist_valbuildCore.ImageSchema;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { H as ASSISTANT_SETTINGS_MAX_LENGTH, A as ArraySchema, B as BooleanSchema, a4 as CODE_LANGUAGES, a5 as COLOR_FORMATS, a3 as CodeSchema, a2 as ColorSchema, e as DEFAULT_APP_HOST, a6 as DEFAULT_COLOR_FORMAT, D as DEFAULT_CONTENT_HOST, u as DEFAULT_FONT_ACCEPT, f as DEFAULT_STATIC_HOST, o as DEFAULT_VAL_REMOTE_HOST, x as DEFAULT_VIDEO_ACCEPT, y as DEFAULT_VIDEO_RENDITIONS, z as DEFAULT_VIDEO_SEGMENT_DURATION, C as DateSchema, a7 as DateTimeSchema, ad as DiscriminatedUnionSchema, ae as EnumSchema, F as FATAL_ERROR_TYPES, v as FONT_MIME_TYPES, t as FileSchema, G as GenericSelector, r as ImageSchema, I as Internal, a8 as KeyOfSchema, af as LiteralSchema, Z as LocaleSchema, M as ModuleFilePathSep, N as NumberSchema, O as ObjectSchema, R as RecordSchema, ac as RichTextSchema, ab as RouteSchema, Q as SETTINGS_MODULE_CONVENTION, S as Schema, E as SettingsSchema, q as StringSchema, T as THEME_LOGO_DIRECTORY, K as THEME_RADIUS_LENGTHS, J as THEME_RADIUS_STEPS, at as UNSAFE_URL_SCHEMES, V as VAL_EXTENSION, a9 as ValViewSchema, w as VideoSchema, L as assistantAvailability, k as computeSchemaSha, j as computeSourcesSha, h as computeValModuleShas, $ as declaredKeySetOf, p as derefPatch, ap as describeSchemeRejection, ag as deserializeSchema, a1 as discriminatedUnionBranchOf, g as extractValModules, an as getSourcePathFromRoute, n as hasMediaSchema, l as hasRemoteFileSchema, i as initVal, aq as isCheckableScheme, ai as isInlineRender, ao as isPageRouter, U as isRootModuleFilePath, aa as isValViewSource, Y as localeOfValue, X as localeTagError, a0 as missingDeclaredKeys, m as modules, aj as parseNextJsRoutePattern, ak as parseTanStackRoutePattern, ah as previewScope, ar as rejectScheme, W as resolveSettingsModule, as as schemeOf, al as tanStackSegmentsOfRoutePath, am as validateUrlAgainstPattern } from './index-02a1ba06.esm.js';
|
|
2
2
|
import './result-daff1cae.esm.js';
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var dist_valbuildCore = require('../../dist/index-
|
|
5
|
+
var dist_valbuildCore = require('../../dist/index-aac8c69c.cjs.dev.js');
|
|
6
6
|
var result = require('../../dist/result-bb1f436e.cjs.dev.js');
|
|
7
7
|
var util = require('../../dist/util-b213092b.cjs.dev.js');
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var dist_valbuildCore = require('../../dist/index-
|
|
5
|
+
var dist_valbuildCore = require('../../dist/index-46c72f01.cjs.prod.js');
|
|
6
6
|
var result = require('../../dist/result-787e35f6.cjs.prod.js');
|
|
7
7
|
var util = require('../../dist/util-030d8a1f.cjs.prod.js');
|
|
8
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as _typeof, a as _slicedToArray, P as PatchError, s as splitModuleFilePathAndModulePath, b as _createClass, c as _classCallCheck, d as _toConsumableArray } from '../../dist/index-
|
|
2
|
-
export { P as PatchError } from '../../dist/index-
|
|
1
|
+
import { _ as _typeof, a as _slicedToArray, P as PatchError, s as splitModuleFilePathAndModulePath, b as _createClass, c as _classCallCheck, d as _toConsumableArray } from '../../dist/index-02a1ba06.esm.js';
|
|
2
|
+
export { P as PatchError } from '../../dist/index-02a1ba06.esm.js';
|
|
3
3
|
import { f as isNonEmpty, e as err, o as ok, m as map, g as flatMap, i as isErr, h as flatMapReduce, j as filterOrElse, k as mapErr, l as map$1, n as all, p as flatten, q as allT } from '../../dist/result-daff1cae.esm.js';
|
|
4
4
|
import { p as pipe } from '../../dist/util-18613e99.esm.js';
|
|
5
5
|
|