@graview/guest 0.1.70 → 0.1.72
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/README.md +21 -0
- package/client.js +1 -1
- package/dist/client.generated.d.ts.map +1 -1
- package/dist/client.generated.js +2 -2
- package/dist/client.generated.js.map +1 -1
- package/dist/guest.d.ts.map +1 -1
- package/dist/guest.js +39 -1
- package/dist/guest.js.map +1 -1
- package/dist/headless/runtime.generated.js +1 -1
- package/dist/host/fonts.d.ts +50 -3
- package/dist/host/fonts.d.ts.map +1 -1
- package/dist/host/fonts.js +306 -33
- package/dist/host/fonts.js.map +1 -1
- package/dist/host/frame.d.ts +24 -1
- package/dist/host/frame.d.ts.map +1 -1
- package/dist/host/frame.js +89 -1
- package/dist/host/frame.js.map +1 -1
- package/dist/host/index.d.ts +1 -1
- package/dist/host/index.d.ts.map +1 -1
- package/dist/host/manifest.d.ts.map +1 -1
- package/dist/host/manifest.js +22 -0
- package/dist/host/manifest.js.map +1 -1
- package/dist/host/pictures.d.ts +29 -1
- package/dist/host/pictures.d.ts.map +1 -1
- package/dist/host/pictures.js +66 -16
- package/dist/host/pictures.js.map +1 -1
- package/dist/host/react.d.ts +18 -0
- package/dist/host/react.d.ts.map +1 -1
- package/dist/host/react.js +21 -1
- package/dist/host/react.js.map +1 -1
- package/dist/host/session.d.ts +45 -1
- package/dist/host/session.d.ts.map +1 -1
- package/dist/host/session.js +133 -1
- package/dist/host/session.js.map +1 -1
- package/dist/host/view-runtime.generated.js +1 -1
- package/dist/host/view.d.ts +12 -0
- package/dist/host/view.d.ts.map +1 -1
- package/dist/host/view.js +3 -5
- package/dist/host/view.js.map +1 -1
- package/dist/host/worker-react.d.ts +4 -0
- package/dist/host/worker-react.d.ts.map +1 -1
- package/dist/host/worker-react.js +1 -0
- package/dist/host/worker-react.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/protocol.d.ts +20 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js.map +1 -1
- package/package.json +3 -3
package/dist/host/fonts.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type ViewFont } from "@graview/core/css";
|
|
2
|
+
import type { GuestFont } from "../protocol.js";
|
|
2
3
|
export interface ViewFontsOptions {
|
|
3
4
|
/** Where a file the app holds is loaded from (MountWorkerViewOptions.asset). */
|
|
4
5
|
readonly asset?: (path: string) => string | undefined;
|
|
5
|
-
/** The `https:` origins a
|
|
6
|
+
/** The `https:` origins a lent face may come from (MountWorkerViewOptions.fonts), apart from a view's images. */
|
|
6
7
|
readonly origins?: readonly string[];
|
|
7
8
|
/** The brand's own stacks: a face lent to a view never takes one of their names. */
|
|
8
9
|
readonly typography?: {
|
|
@@ -17,6 +18,52 @@ export declare function viewFontAddress(font: ViewFont, options: ViewFontsOption
|
|
|
17
18
|
} | {
|
|
18
19
|
readonly refused: string;
|
|
19
20
|
};
|
|
20
|
-
/**
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Add each face the page may load to its fonts, and say each it may not.
|
|
23
|
+
* What it answers gives them back. `replacing`: what the same view's last
|
|
24
|
+
* lending answered, given back once each face of this one has loaded or
|
|
25
|
+
* failed, so the view is not left without a face meanwhile and a face both
|
|
26
|
+
* lend is never let go between them.
|
|
27
|
+
*/
|
|
28
|
+
export declare function loadViewFonts(document: Document, fonts: readonly ViewFont[], options: ViewFontsOptions, say: (said: string) => void, replacing?: () => void): () => void;
|
|
29
|
+
/**
|
|
30
|
+
* THE FACES AN APP LENDS A FRAME (Roadmap f-faces-lent-to-frames), read by
|
|
31
|
+
* the host and handed as `data:` fonts (`GuestFont`). A frame is another
|
|
32
|
+
* origin: the app's own files are not served to it, and a font origin the
|
|
33
|
+
* host lists for its views is none the frame's policy names — that allows
|
|
34
|
+
* `font-src data:`, and nothing more is asked of it. So the host reads each
|
|
35
|
+
* file where it would load one for a worker view (`viewFontAddress`: a file
|
|
36
|
+
* the app holds where `asset` serves it, or an `https:` address on an origin
|
|
37
|
+
* `fonts.origins` lists), held to the same bound, `VIEW_FONT_MOST_BYTES`,
|
|
38
|
+
* however it is served: a file on a listed origin is counted too, since it
|
|
39
|
+
* goes into a message rather than to the engine.
|
|
40
|
+
*
|
|
41
|
+
* ONE FILE A NAME, THE LAST LENT. Of the files the brand lends under one
|
|
42
|
+
* name (family, weight and style), the last that reads within the bound is
|
|
43
|
+
* the one the frame is handed, and where there were several the host is told
|
|
44
|
+
* which. What is refused, too large or unreadable is said, naming the face,
|
|
45
|
+
* as it is for a worker view.
|
|
46
|
+
*/
|
|
47
|
+
export declare function frameFonts(fonts: readonly ViewFont[], options: ViewFontsOptions & {
|
|
48
|
+
readonly fetch: typeof fetch;
|
|
49
|
+
readonly signal?: AbortSignal;
|
|
50
|
+
readonly settled?: (family: string) => void;
|
|
51
|
+
}, say: (said: string) => void): Promise<readonly GuestFont[]>;
|
|
52
|
+
/** One reading of a brand's faces, shared by every frame on a page lent them. */
|
|
53
|
+
export interface FrameFontsReading {
|
|
54
|
+
/** The faces as frames are handed them, and what was said of them, once all are read. */
|
|
55
|
+
readonly read: Promise<{
|
|
56
|
+
readonly fonts: readonly GuestFont[];
|
|
57
|
+
readonly said: readonly string[];
|
|
58
|
+
}>;
|
|
59
|
+
/** The families still being read. */
|
|
60
|
+
waiting(): readonly string[];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* THE FACES A BRAND LENDS, READ ONCE A PAGE (Roadmap f-faces-lent-to-frames):
|
|
64
|
+
* every frame dressed in the same brand, its files served from the same
|
|
65
|
+
* place, is handed the same reading — fetched and encoded once, and what was
|
|
66
|
+
* said of it said to each frame's host.
|
|
67
|
+
*/
|
|
68
|
+
export declare function readFrameFonts(window: Window & typeof globalThis, fonts: readonly ViewFont[], options: ViewFontsOptions): FrameFontsReading;
|
|
22
69
|
//# sourceMappingURL=fonts.d.ts.map
|
package/dist/host/fonts.d.ts.map
CHANGED
|
@@ -1 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CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,EAAE,OAAO,EAAE,gBAAgB,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,SAAS,SAAS,EAAE,CAAC,CA8CjQ;AAED,iFAAiF;AACjF,MAAM,WAAW,iBAAiB;IAChC,yFAAyF;IACzF,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;QAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IACnG,qCAAqC;IACrC,OAAO,IAAI,SAAS,MAAM,EAAE,CAAC;CAC9B;AAKD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,UAAU,EAAE,KAAK,EAAE,SAAS,QAAQ,EAAE,EAAE,OAAO,EAAE,gBAAgB,GAAG,iBAAiB,CAyB3I"}
|
package/dist/host/fonts.js
CHANGED
|
@@ -1,25 +1,123 @@
|
|
|
1
|
-
import { brandFamilies, VIEW_FONTS_MOST, viewFontProblem, viewFontSource } from "@graview/core/css";
|
|
1
|
+
import { brandFamilies, VIEW_FONT_MOST_BYTES, VIEW_FONTS_MOST, viewFontProblem, viewFontSource } from "@graview/core/css";
|
|
2
2
|
import { imageOriginsOf } from "./open-judge.js";
|
|
3
|
+
const named = (family) => `The app's face "${String(family)}" for its views`;
|
|
4
|
+
/** A face whose file answered as something else: not read as a font. */
|
|
5
|
+
const notAFont = (family, url, type) => `${named(family)} is not loaded: ${url} answered ${type || "no type"}, not a font.`;
|
|
3
6
|
/** Where the page loads a face from, or why it does not. */
|
|
4
7
|
export function viewFontAddress(font, options) {
|
|
5
|
-
const
|
|
8
|
+
const not = `${named(font.family)} is not loaded`;
|
|
6
9
|
const problem = viewFontProblem(font, brandFamilies(options.typography));
|
|
7
10
|
if (problem)
|
|
8
|
-
return { refused: `${
|
|
11
|
+
return { refused: `${not}: ${problem}.` };
|
|
9
12
|
const source = viewFontSource(font.src);
|
|
10
13
|
if ("asset" in source) {
|
|
11
14
|
const url = options.asset?.(source.asset);
|
|
12
|
-
return url ? { url } : { refused: `${
|
|
15
|
+
return url ? { url } : { refused: `${not}: this host says nowhere the app's own files are served (\`asset\`), so ${font.src} is not fetched.` };
|
|
13
16
|
}
|
|
14
|
-
return imageOriginsOf(options.origins).includes(new URL(source.https).origin) ? { url: source.https } : { refused: `${
|
|
17
|
+
return imageOriginsOf(options.origins).includes(new URL(source.https).origin) ? { url: source.https } : { refused: `${not}: ${source.origin} is no origin this host lists for the faces its views are lent (\`fonts.origins\`), so it is not fetched.` };
|
|
18
|
+
}
|
|
19
|
+
/** A face's file, read up to the limit: its bytes, `over` past it, or `failed`. Never sent on elsewhere. A file the app holds is asked for with the page's session, one on a listed origin with none. */
|
|
20
|
+
async function readHeld(fetcher, url, signal, credentials = "same-origin") {
|
|
21
|
+
const response = await fetcher(url, { signal, credentials, redirect: "error" });
|
|
22
|
+
if (!response.ok) {
|
|
23
|
+
void response.body?.cancel();
|
|
24
|
+
return "failed";
|
|
25
|
+
}
|
|
26
|
+
/* A font (or one of the older names servers still give it), bytes that say nothing more, or no type at all: anything else (a page, a sign-in) is not read as one. */
|
|
27
|
+
const type = (response.headers.get("content-type") ?? "").split(";")[0].trim().toLowerCase();
|
|
28
|
+
if (type !== "" && !type.startsWith("font/") && !type.startsWith("application/font-") && !type.startsWith("application/x-font-") && type !== "application/octet-stream") {
|
|
29
|
+
void response.body?.cancel();
|
|
30
|
+
return { type };
|
|
31
|
+
}
|
|
32
|
+
const declared = Number(response.headers.get("content-length") ?? NaN);
|
|
33
|
+
if (Number.isFinite(declared) && declared > VIEW_FONT_MOST_BYTES) {
|
|
34
|
+
void response.body?.cancel();
|
|
35
|
+
return "over";
|
|
36
|
+
}
|
|
37
|
+
/* No body to count as it comes: not read whole to find out. */
|
|
38
|
+
const reader = response.body?.getReader();
|
|
39
|
+
if (!reader)
|
|
40
|
+
return "failed";
|
|
41
|
+
const chunks = [];
|
|
42
|
+
let size = 0;
|
|
43
|
+
for (;;) {
|
|
44
|
+
const { done, value } = await reader.read();
|
|
45
|
+
if (done)
|
|
46
|
+
break;
|
|
47
|
+
size += value.byteLength;
|
|
48
|
+
if (size > VIEW_FONT_MOST_BYTES) {
|
|
49
|
+
void reader.cancel();
|
|
50
|
+
return "over";
|
|
51
|
+
}
|
|
52
|
+
chunks.push(value);
|
|
53
|
+
}
|
|
54
|
+
const bytes = new Uint8Array(size);
|
|
55
|
+
let at = 0;
|
|
56
|
+
for (const chunk of chunks) {
|
|
57
|
+
bytes.set(chunk, at);
|
|
58
|
+
at += chunk.byteLength;
|
|
59
|
+
}
|
|
60
|
+
return bytes.buffer;
|
|
15
61
|
}
|
|
16
|
-
/** The faces on a page, each with how many views hold it, so a view drawn again adds none twice and the last to go takes it. */
|
|
17
62
|
const held = new WeakMap();
|
|
18
|
-
|
|
19
|
-
|
|
63
|
+
const lendings = new WeakMap();
|
|
64
|
+
/** A face's weight as the engine matches it: no weight is "normal", which is 400, as "bold" is 700. */
|
|
65
|
+
const weightOf = (font) => {
|
|
66
|
+
const weight = String(font.weight ?? "normal").trim().replace(/\s+/g, " ").toLowerCase();
|
|
67
|
+
return weight === "normal" ? "400" : weight === "bold" ? "700" : weight;
|
|
68
|
+
};
|
|
69
|
+
/** A face's name: its family, weight and style, as the engine matches them, without regard to case. */
|
|
70
|
+
const nameOf = (font) => JSON.stringify([font.family.toLowerCase(), weightOf(font), (font.style ?? "normal").toLowerCase()]);
|
|
71
|
+
/** Put in the page's fonts the one face a name draws, take out the others, and say which, once the one that will draw has loaded. */
|
|
72
|
+
function draw(document, name) {
|
|
73
|
+
let drawing;
|
|
74
|
+
for (let at = name.files.length - 1; at >= 0 && !drawing; at -= 1)
|
|
75
|
+
if (name.files[at].face)
|
|
76
|
+
drawing = name.files[at];
|
|
77
|
+
for (const one of name.files) {
|
|
78
|
+
if (one === drawing || !one.drawn)
|
|
79
|
+
continue;
|
|
80
|
+
document.fonts?.delete(one.face);
|
|
81
|
+
one.drawn = false;
|
|
82
|
+
}
|
|
83
|
+
if (drawing && !drawing.drawn) {
|
|
84
|
+
document.fonts?.add(drawing.face);
|
|
85
|
+
drawing.drawn = true;
|
|
86
|
+
}
|
|
87
|
+
/* What a lending about to be given back holds is not counted: a brand changing one file for another is not two. */
|
|
88
|
+
const staying = name.files.filter((one) => [...one.holders.keys()].some((lending) => !lending.going));
|
|
89
|
+
if (staying.length < 2) {
|
|
90
|
+
name.told = undefined;
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (!drawing || drawing !== staying.at(-1) || name.told === drawing.url)
|
|
94
|
+
return;
|
|
95
|
+
name.told = drawing.url;
|
|
96
|
+
const told = new Set();
|
|
97
|
+
for (const one of staying) {
|
|
98
|
+
for (const [lending, family] of one.holders) {
|
|
99
|
+
if (lending.going || told.has(lending))
|
|
100
|
+
continue;
|
|
101
|
+
told.add(lending);
|
|
102
|
+
lending.say(`${named(family)} is lent from ${staying.length} files on this page, and the one drawn in every view is ${drawing.url}.`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Add each face the page may load to its fonts, and say each it may not.
|
|
108
|
+
* What it answers gives them back. `replacing`: what the same view's last
|
|
109
|
+
* lending answered, given back once each face of this one has loaded or
|
|
110
|
+
* failed, so the view is not left without a face meanwhile and a face both
|
|
111
|
+
* lend is never let go between them.
|
|
112
|
+
*/
|
|
113
|
+
export function loadViewFonts(document, fonts, options, say, replacing) {
|
|
20
114
|
const page = document.defaultView;
|
|
21
|
-
const
|
|
22
|
-
held.set(document,
|
|
115
|
+
const names = held.get(document) ?? new Map();
|
|
116
|
+
held.set(document, names);
|
|
117
|
+
const lending = { say, going: false };
|
|
118
|
+
const replaced = replacing ? lendings.get(replacing) : undefined;
|
|
119
|
+
if (replaced)
|
|
120
|
+
replaced.going = true;
|
|
23
121
|
const mine = [];
|
|
24
122
|
if (fonts.length > VIEW_FONTS_MOST)
|
|
25
123
|
say(`The app lends its views ${fonts.length} faces and at most ${VIEW_FONTS_MOST} are loaded, so ${fonts.slice(VIEW_FONTS_MOST).map((font) => `"${font.family}"`).join(", ")} ${fonts.length - VIEW_FONTS_MOST === 1 ? "is" : "are"} not.`);
|
|
@@ -29,41 +127,216 @@ export function loadViewFonts(document, fonts, options, say) {
|
|
|
29
127
|
say(at.refused);
|
|
30
128
|
continue;
|
|
31
129
|
}
|
|
130
|
+
const isHeld = "asset" in viewFontSource(font.src);
|
|
32
131
|
const Face = page?.FontFace;
|
|
33
|
-
|
|
132
|
+
const fetcher = page?.fetch?.bind(page);
|
|
133
|
+
if (!Face || !document.fonts || (isHeld && !fetcher))
|
|
34
134
|
continue;
|
|
35
|
-
const key =
|
|
36
|
-
|
|
37
|
-
|
|
135
|
+
const key = nameOf(font);
|
|
136
|
+
const name = names.get(key) ?? { files: [] };
|
|
137
|
+
names.set(key, name);
|
|
138
|
+
const had = name.files.find((one) => one.url === at.url);
|
|
38
139
|
if (had) {
|
|
39
|
-
|
|
140
|
+
/* Lent again, it is the last lent. */
|
|
141
|
+
had.holders.set(lending, font.family);
|
|
142
|
+
name.files.splice(name.files.indexOf(had), 1);
|
|
143
|
+
name.files.push(had);
|
|
144
|
+
mine.push({ name, one: had });
|
|
145
|
+
draw(document, name);
|
|
40
146
|
continue;
|
|
41
147
|
}
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
148
|
+
let settle = () => { };
|
|
149
|
+
const settled = new Promise((resolve) => (settle = resolve));
|
|
150
|
+
const one = { url: at.url, stop: new AbortController(), holders: new Map([[lending, font.family]]), settled, settle, drawn: false };
|
|
151
|
+
name.files.push(one);
|
|
152
|
+
mine.push({ name, one });
|
|
153
|
+
/* Said to every view holding it, and let go, so a view that lends it again tries again. */
|
|
154
|
+
const fail = (words) => {
|
|
155
|
+
one.settle();
|
|
156
|
+
if (one.stop.signal.aborted)
|
|
157
|
+
return;
|
|
158
|
+
const index = name.files.indexOf(one);
|
|
159
|
+
if (index >= 0)
|
|
160
|
+
name.files.splice(index, 1);
|
|
161
|
+
/* Not to a lending about to be given back: the view lending it again hears it once, there. */
|
|
162
|
+
for (const [lending, family] of one.holders)
|
|
163
|
+
if (!lending.going)
|
|
164
|
+
lending.say(words(family));
|
|
165
|
+
draw(document, name);
|
|
166
|
+
if (name.files.length === 0 && names.get(key) === name)
|
|
167
|
+
names.delete(key);
|
|
168
|
+
};
|
|
169
|
+
const couldNot = () => fail((family) => `${named(family)} could not be loaded from ${at.url}.`);
|
|
170
|
+
const descriptors = { display: "swap", ...(font.weight !== undefined ? { weight: weightOf(font) } : {}), ...(font.style ? { style: font.style.toLowerCase() } : {}) };
|
|
171
|
+
const load = (source) => {
|
|
172
|
+
/* A family that is not one identifier ("Baloo 2") is an error at once in Firefox unless quoted, and drawn by no name in the others if it is: quoted only where the engine refuses it plain. */
|
|
173
|
+
let face = new Face(font.family, source, descriptors);
|
|
174
|
+
if (face.status === "error")
|
|
175
|
+
face = new Face(JSON.stringify(font.family), source, descriptors);
|
|
176
|
+
face.load().then(() => {
|
|
177
|
+
one.settle();
|
|
178
|
+
if (one.stop.signal.aborted || !name.files.includes(one))
|
|
179
|
+
return;
|
|
180
|
+
one.face = face;
|
|
181
|
+
draw(document, name);
|
|
182
|
+
}, couldNot);
|
|
183
|
+
};
|
|
184
|
+
if (!isHeld)
|
|
185
|
+
load(`url(${JSON.stringify(at.url)})`);
|
|
186
|
+
else
|
|
187
|
+
readHeld(fetcher, at.url, one.stop.signal).then((read) => {
|
|
188
|
+
if (one.stop.signal.aborted)
|
|
189
|
+
return one.settle();
|
|
190
|
+
if (read === "failed")
|
|
191
|
+
return couldNot();
|
|
192
|
+
if (typeof read === "object" && "type" in read)
|
|
193
|
+
return fail((family) => notAFont(family, at.url, read.type));
|
|
194
|
+
if (read === "over")
|
|
195
|
+
return fail((family) => `${named(family)} is not loaded: its file, ${at.url}, is more than ${VIEW_FONT_MOST_BYTES / 1_000_000} MB, the most a file the app holds may be as a face for its views.`);
|
|
196
|
+
load(read);
|
|
197
|
+
}, couldNot);
|
|
51
198
|
}
|
|
52
199
|
let given = false;
|
|
53
|
-
|
|
200
|
+
const giveBack = () => {
|
|
54
201
|
if (given)
|
|
55
202
|
return;
|
|
56
203
|
given = true;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
204
|
+
replacing?.();
|
|
205
|
+
for (const { name, one } of mine) {
|
|
206
|
+
one.holders.delete(lending);
|
|
207
|
+
if (one.holders.size > 0)
|
|
60
208
|
continue;
|
|
61
|
-
one.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
209
|
+
one.stop.abort();
|
|
210
|
+
one.settle();
|
|
211
|
+
const index = name.files.indexOf(one);
|
|
212
|
+
if (index >= 0)
|
|
213
|
+
name.files.splice(index, 1);
|
|
214
|
+
if (one.drawn)
|
|
215
|
+
document.fonts?.delete(one.face);
|
|
216
|
+
one.drawn = false;
|
|
217
|
+
draw(document, name);
|
|
66
218
|
}
|
|
219
|
+
for (const [key, name] of names)
|
|
220
|
+
if (name.files.length === 0)
|
|
221
|
+
names.delete(key);
|
|
67
222
|
};
|
|
223
|
+
lendings.set(giveBack, lending);
|
|
224
|
+
if (replacing)
|
|
225
|
+
void Promise.all(mine.map(({ one }) => one.settled)).then(() => replacing());
|
|
226
|
+
return giveBack;
|
|
227
|
+
}
|
|
228
|
+
/** A font file's type, by its extension, as a `data:` font says it. */
|
|
229
|
+
const fontType = (url) => `font/${/\.(woff2|woff|ttf|otf)(?:[?#]|$)/i.exec(url)?.[1]?.toLowerCase() ?? "woff2"}`;
|
|
230
|
+
/** Bytes as base64, a piece at a time: a face is up to two million of them, more than one call takes as arguments. */
|
|
231
|
+
function base64Of(bytes) {
|
|
232
|
+
const all = new Uint8Array(bytes);
|
|
233
|
+
let text = "";
|
|
234
|
+
for (let at = 0; at < all.length; at += 0x8000)
|
|
235
|
+
text += String.fromCharCode(...all.subarray(at, at + 0x8000));
|
|
236
|
+
return btoa(text);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* THE FACES AN APP LENDS A FRAME (Roadmap f-faces-lent-to-frames), read by
|
|
240
|
+
* the host and handed as `data:` fonts (`GuestFont`). A frame is another
|
|
241
|
+
* origin: the app's own files are not served to it, and a font origin the
|
|
242
|
+
* host lists for its views is none the frame's policy names — that allows
|
|
243
|
+
* `font-src data:`, and nothing more is asked of it. So the host reads each
|
|
244
|
+
* file where it would load one for a worker view (`viewFontAddress`: a file
|
|
245
|
+
* the app holds where `asset` serves it, or an `https:` address on an origin
|
|
246
|
+
* `fonts.origins` lists), held to the same bound, `VIEW_FONT_MOST_BYTES`,
|
|
247
|
+
* however it is served: a file on a listed origin is counted too, since it
|
|
248
|
+
* goes into a message rather than to the engine.
|
|
249
|
+
*
|
|
250
|
+
* ONE FILE A NAME, THE LAST LENT. Of the files the brand lends under one
|
|
251
|
+
* name (family, weight and style), the last that reads within the bound is
|
|
252
|
+
* the one the frame is handed, and where there were several the host is told
|
|
253
|
+
* which. What is refused, too large or unreadable is said, naming the face,
|
|
254
|
+
* as it is for a worker view.
|
|
255
|
+
*/
|
|
256
|
+
export async function frameFonts(fonts, options, say) {
|
|
257
|
+
if (fonts.length > VIEW_FONTS_MOST)
|
|
258
|
+
say(`The app lends its views ${fonts.length} faces and at most ${VIEW_FONTS_MOST} are loaded, so ${fonts.slice(VIEW_FONTS_MOST).map((font) => `"${font.family}"`).join(", ")} ${fonts.length - VIEW_FONTS_MOST === 1 ? "is" : "are"} not.`);
|
|
259
|
+
/* Each name's files in the order they were lent, a file lent twice counted where it was lent last. */
|
|
260
|
+
const names = new Map();
|
|
261
|
+
for (const font of fonts.slice(0, VIEW_FONTS_MOST)) {
|
|
262
|
+
const at = viewFontAddress(font, options);
|
|
263
|
+
if ("refused" in at) {
|
|
264
|
+
say(at.refused);
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
const key = nameOf(font);
|
|
268
|
+
const files = (names.get(key) ?? []).filter((one) => one.url !== at.url);
|
|
269
|
+
files.push({ font, url: at.url });
|
|
270
|
+
names.set(key, files);
|
|
271
|
+
}
|
|
272
|
+
const signal = options.signal ?? new AbortController().signal;
|
|
273
|
+
const lent = await Promise.all([...names.values()].map(async (files) => {
|
|
274
|
+
try {
|
|
275
|
+
for (let at = files.length - 1; at >= 0; at -= 1) {
|
|
276
|
+
const { font, url } = files[at];
|
|
277
|
+
const isHeld = "asset" in viewFontSource(font.src);
|
|
278
|
+
const read = await readHeld(options.fetch, url, signal, isHeld ? "same-origin" : "omit").catch(() => "failed");
|
|
279
|
+
if (signal.aborted)
|
|
280
|
+
return undefined;
|
|
281
|
+
if (read === "failed") {
|
|
282
|
+
say(`${named(font.family)} could not be loaded from ${url}.`);
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
if (read === "over") {
|
|
286
|
+
say(`${named(font.family)} is not loaded: its file, ${url}, is more than ${VIEW_FONT_MOST_BYTES / 1_000_000} MB, the most a file may be as a face for the app's views.`);
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
if (!(read instanceof ArrayBuffer)) {
|
|
290
|
+
say(notAFont(font.family, url, read.type));
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
if (files.length > 1)
|
|
294
|
+
say(`${named(font.family)} is lent from ${files.length} files, and the one drawn in the frame is ${url}.`);
|
|
295
|
+
return { family: font.family, ...(font.weight !== undefined ? { weight: weightOf(font) } : {}), ...(font.style ? { style: font.style.toLowerCase() } : {}), src: `data:${fontType(url)};base64,${base64Of(read)}` };
|
|
296
|
+
}
|
|
297
|
+
return undefined;
|
|
298
|
+
}
|
|
299
|
+
finally {
|
|
300
|
+
options.settled?.(files[0].font.family);
|
|
301
|
+
}
|
|
302
|
+
}));
|
|
303
|
+
return lent.filter((one) => one !== undefined);
|
|
304
|
+
}
|
|
305
|
+
const readings = new WeakMap();
|
|
306
|
+
/** The most brands' readings a page keeps at once: an older one is read again if it is lent again. */
|
|
307
|
+
const READINGS_KEPT = 8;
|
|
308
|
+
/**
|
|
309
|
+
* THE FACES A BRAND LENDS, READ ONCE A PAGE (Roadmap f-faces-lent-to-frames):
|
|
310
|
+
* every frame dressed in the same brand, its files served from the same
|
|
311
|
+
* place, is handed the same reading — fetched and encoded once, and what was
|
|
312
|
+
* said of it said to each frame's host.
|
|
313
|
+
*/
|
|
314
|
+
export function readFrameFonts(window, fonts, options) {
|
|
315
|
+
const served = fonts.map((font) => {
|
|
316
|
+
const source = viewFontSource(font.src);
|
|
317
|
+
return source && "asset" in source ? (options.asset?.(source.asset) ?? null) : null;
|
|
318
|
+
});
|
|
319
|
+
const key = JSON.stringify([fonts, options.typography ?? null, options.origins ?? [], served]);
|
|
320
|
+
const page = readings.get(window) ?? new Map();
|
|
321
|
+
readings.set(window, page);
|
|
322
|
+
const had = page.get(key);
|
|
323
|
+
if (had)
|
|
324
|
+
return had;
|
|
325
|
+
const said = [];
|
|
326
|
+
const waiting = new Set();
|
|
327
|
+
for (const font of fonts.slice(0, VIEW_FONTS_MOST))
|
|
328
|
+
if (!("refused" in viewFontAddress(font, options)))
|
|
329
|
+
waiting.add(font.family);
|
|
330
|
+
const read = frameFonts(fonts, { ...options, fetch: window.fetch.bind(window), settled: (family) => waiting.delete(family) }, (one) => said.push(one)).then((lent) => ({ fonts: lent, said }));
|
|
331
|
+
const reading = { read, waiting: () => [...waiting] };
|
|
332
|
+
page.set(key, reading);
|
|
333
|
+
if (page.size > READINGS_KEPT)
|
|
334
|
+
page.delete(page.keys().next().value);
|
|
335
|
+
// A reading in which a face could not be had (a network fault, a host's 5xx) is not kept: the next frame asks again.
|
|
336
|
+
read.then((got) => {
|
|
337
|
+
if (got.said.length > 0 && page.get(key) === reading)
|
|
338
|
+
page.delete(key);
|
|
339
|
+
}, () => page.delete(key));
|
|
340
|
+
return reading;
|
|
68
341
|
}
|
|
69
342
|
//# sourceMappingURL=fonts.js.map
|
package/dist/host/fonts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fonts.js","sourceRoot":"","sources":["../../src/host/fonts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,cAAc,EAAiB,MAAM,mBAAmB,CAAC;AACnH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AA4BjD,4DAA4D;AAC5D,MAAM,UAAU,eAAe,CAAC,IAAc,EAAE,OAAyB;IACvE,MAAM,KAAK,GAAG,mBAAmB,MAAM,CAAE,IAA6B,CAAC,MAAM,CAAC,+BAA+B,CAAC;IAC9G,MAAM,OAAO,GAAG,eAAe,CAAC,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;IACzE,IAAI,OAAO;QAAE,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,KAAK,OAAO,GAAG,EAAE,CAAC;IACzD,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,CAAE,CAAC;IACzC,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;QACtB,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1C,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,2EAA2E,IAAI,CAAC,GAAG,kBAAkB,EAAE,CAAC;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AAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC/L,MAAM,OAAO,GAAsB,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC;IACzE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACvB,IAAI,IAAI,CAAC,IAAI,GAAG,aAAa;QAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAM,CAAC,CAAC;IACtE,qHAAqH;IACrH,IAAI,CAAC,IAAI,CACP,CAAC,GAAG,EAAE,EAAE;QACN,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,OAAO;YAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACzE,CAAC,EACD,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CACvB,CAAC;IACF,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/host/frame.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import type { GuestPictures } from "./pictures.js";
|
|
|
5
5
|
import type { Arrival } from "./links.js";
|
|
6
6
|
import type { GoTo } from "@graview/react/provider";
|
|
7
7
|
import { type GuestBrand } from "./theme.js";
|
|
8
|
+
/** The longest a frame waits for the faces it is lent before it says it has drawn: as long as a picture is given to load. */
|
|
9
|
+
export declare const FACES_WAIT_MS = 2000;
|
|
8
10
|
export { createGuestHost, createGuestLimiter, readAcross } from "./session.js";
|
|
9
11
|
export { readTheme } from "./theme.js";
|
|
10
12
|
export { GUEST_PROTOCOL, GUEST_SANDBOX, OPAQUE_ORIGIN } from "../protocol.js";
|
|
@@ -51,6 +53,22 @@ export interface MountGuestViewOptions<S extends AnySchema> {
|
|
|
51
53
|
readonly pictures?: GuestPictures;
|
|
52
54
|
/** Where a record's file (`FileValue.href`) is fetched for those pictures: a host serving the app under a base answers `base + href`. The href resolved against the page by default. */
|
|
53
55
|
readonly file?: (href: string) => string | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Where a file the app holds (`/graview/assets/<sha256>.woff2`) is read
|
|
58
|
+
* from for the faces its brand lends its views (`brand.views.fonts`,
|
|
59
|
+
* Roadmap f-faces-lent-to-frames), as a worker view's `asset` says. Each
|
|
60
|
+
* face is read by the host, at most 2 MB, and handed to the frame as a
|
|
61
|
+
* `data:` font its client puts in the frame's document: the frame's policy
|
|
62
|
+
* allows `font-src data:` and is asked for nothing more. Without it, a face
|
|
63
|
+
* the app holds is not lent, and that is said (`onProblem`).
|
|
64
|
+
*/
|
|
65
|
+
readonly asset?: (path: string) => string | undefined;
|
|
66
|
+
/** The `https:` origins a lent face may be read from by address, as a worker view's `fonts` says: none by default. */
|
|
67
|
+
readonly fonts?: {
|
|
68
|
+
readonly origins: readonly string[];
|
|
69
|
+
};
|
|
70
|
+
/** What the host could not do for the frame, in a sentence: a face it did not lend, and why; the guest's height held (`onSize`). */
|
|
71
|
+
readonly onProblem?: (said: string) => void;
|
|
54
72
|
/** The app's named places: what the guest is told of (`props.places`), and may ask to go to by slug. None by default. */
|
|
55
73
|
readonly places?: () => readonly GuestPlace[];
|
|
56
74
|
readonly onNavigate?: (id: string) => void;
|
|
@@ -62,7 +80,12 @@ export interface MountGuestViewOptions<S extends AnySchema> {
|
|
|
62
80
|
readonly onLost?: (said: string) => void;
|
|
63
81
|
/** The face's own way of going (`useGoTo`), read when the guest goes: where `onArrive` is not given, the arrival is gone to by it. */
|
|
64
82
|
readonly goTo?: () => GoTo | undefined;
|
|
65
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* The guest asked for a height. By default the frame takes it. Not told a
|
|
85
|
+
* height the growth guard held (Roadmap f-guest-growth-guard): a guest
|
|
86
|
+
* whose every height tracks the frame's own a few times running is held,
|
|
87
|
+
* the frame wears `data-guest-view-held`, and `onProblem` is told why.
|
|
88
|
+
*/
|
|
66
89
|
readonly onSize?: (height: number) => void;
|
|
67
90
|
readonly limits?: GuestLimits;
|
|
68
91
|
/** The frame's accessible name. The view's name by default. */
|
package/dist/host/frame.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame.d.ts","sourceRoot":"","sources":["../../src/host/frame.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,
|
|
1
|
+
{"version":3,"file":"frame.d.ts","sourceRoot":"","sources":["../../src/host/frame.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAA8E,KAAK,UAAU,EAAE,KAAK,UAAU,EAAoC,MAAM,gBAAgB,CAAC;AAEhL,OAAO,EAAuD,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAG5J,OAAO,KAAK,EAAoB,aAAa,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAA0D,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAMrG,6HAA6H;AAC7H,eAAO,MAAM,aAAa,OAAQ,CAAC;AAQnC,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;A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