bookcover-web 0.10.0 → 0.12.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/dist/embed_types.d.ts +17 -7
- package/dist/embed_types.d.ts.map +1 -1
- package/dist/embed_types.js +7 -3
- package/dist/embed_types.js.map +1 -1
- package/package.json +5 -5
package/dist/embed_types.d.ts
CHANGED
|
@@ -8,29 +8,39 @@ export interface InitMessage {
|
|
|
8
8
|
type: 'init';
|
|
9
9
|
preset?: Partial<EmbedFormState>;
|
|
10
10
|
bg_image?: File | null;
|
|
11
|
+
bg_image_builtin?: string | null;
|
|
11
12
|
custom_fonts?: CustomFont[];
|
|
12
13
|
finished_mode?: boolean;
|
|
13
14
|
hide_size_section?: boolean;
|
|
14
15
|
locale?: AppLocale;
|
|
15
16
|
}
|
|
16
|
-
/** Widget -> host. `
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
17
|
+
/** Widget -> host. `bg_image` rides on every data/finished message (cloning a File is cheap);
|
|
18
|
+
* `custom_fonts` byte arrays are expensive to clone, so on 'data' messages the field is only
|
|
19
|
+
* present when the font set changed since the last message (absent = unchanged), while
|
|
20
|
+
* 'finished' always carries the complete array.
|
|
21
|
+
*
|
|
22
|
+
* `bg_image_builtin` is ADVISORY background identity, so a host doesn't have to recover it by
|
|
23
|
+
* hashing returned bytes: when the user picks one of the widget's built-in backgrounds it
|
|
24
|
+
* carries that image's published filename, and it is null for a user upload or no image at all.
|
|
25
|
+
* The filename IS the id — hosts join it onto their own assets path to get the bytes and slice
|
|
26
|
+
* its extension off for the MIME type, so it must stay a filename (see the contract on
|
|
27
|
+
* BACKGROUNDS in the widget's services/backgrounds.ts). It exists purely so the host can store a
|
|
28
|
+
* reference instead of a private copy of a shipped image. Treat it as untrusted input — map it
|
|
29
|
+
* to a built-in only after checking it against your own allowlist, and fall back to the upload
|
|
30
|
+
* path otherwise. Nothing in bookcover ever resolves bytes from this field. */
|
|
21
31
|
export type WidgetMessage = {
|
|
22
32
|
type: 'ready';
|
|
23
33
|
} | {
|
|
24
34
|
type: 'data';
|
|
25
35
|
data: EmbedFormState;
|
|
26
|
-
schema: Record<string, unknown>;
|
|
27
36
|
bg_image: File | null;
|
|
37
|
+
bg_image_builtin: string | null;
|
|
28
38
|
custom_fonts?: CustomFont[];
|
|
29
39
|
} | {
|
|
30
40
|
type: 'finished';
|
|
31
41
|
data: EmbedFormState;
|
|
32
|
-
schema: Record<string, unknown>;
|
|
33
42
|
bg_image: File | null;
|
|
43
|
+
bg_image_builtin: string | null;
|
|
34
44
|
custom_fonts: CustomFont[];
|
|
35
45
|
} | {
|
|
36
46
|
type: 'cancelled';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed_types.d.ts","sourceRoot":"","sources":["../src/embed_types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"embed_types.d.ts","sourceRoot":"","sources":["../src/embed_types.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAA;AAClD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;AAE3C;+CAC+C;AAC/C,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK,CAAA;AAErC,+DAA+D;AAC/D,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAA;IAEZ,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAEhC,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAItB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAEhC,YAAY,CAAC,EAAE,UAAU,EAAE,CAAA;IAE3B,aAAa,CAAC,EAAE,OAAO,CAAA;IAEvB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,MAAM,CAAC,EAAE,SAAS,CAAA;CACrB;AAED;;;;;;;;;;;;;gFAagF;AAChF,MAAM,MAAM,aAAa,GACnB;IAAC,IAAI,EAAE,OAAO,CAAA;CAAC,GACf;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;IACzD,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,YAAY,CAAC,EAAE,UAAU,EAAE,CAAA;CAAC,GAC/D;IAAC,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;IAC7D,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,YAAY,EAAE,UAAU,EAAE,CAAA;CAAC,GAC9D;IAAC,IAAI,EAAE,WAAW,CAAA;CAAC,CAAA"}
|
package/dist/embed_types.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// Protocol types for embedding the cover-editor widget in an iframe. The host sends one
|
|
2
2
|
// InitMessage in reply to the widget's 'ready' message; the widget reports edits back with
|
|
3
|
-
// WidgetMessage.
|
|
4
|
-
//
|
|
5
|
-
//
|
|
3
|
+
// WidgetMessage.
|
|
4
|
+
//
|
|
5
|
+
// Binaries are never part of the stored record. The background image and custom font bytes
|
|
6
|
+
// travel as separate structured-clone fields beside the pure-JSON form values, so hosts persist
|
|
7
|
+
// `data` as-is (e.g. to Firestore) and own the storage and identity of the binaries themselves.
|
|
8
|
+
// Messages carry no derived schema: hosts call build_schema(form) from bookcover-core, so there
|
|
9
|
+
// is exactly one place that form → schema conversion happens.
|
|
6
10
|
export {};
|
|
7
11
|
//# sourceMappingURL=embed_types.js.map
|
package/dist/embed_types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed_types.js","sourceRoot":"","sources":["../src/embed_types.ts"],"names":[],"mappings":"AACA,wFAAwF;AACxF,2FAA2F;AAC3F,
|
|
1
|
+
{"version":3,"file":"embed_types.js","sourceRoot":"","sources":["../src/embed_types.ts"],"names":[],"mappings":"AACA,wFAAwF;AACxF,2FAA2F;AAC3F,iBAAiB;AACjB,EAAE;AACF,2FAA2F;AAC3F,gGAAgG;AAChG,gGAAgG;AAChG,gGAAgG;AAChG,8DAA8D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bookcover-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"license": "MIT-0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"dev": "tsc --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@myriaddreamin/typst-ts-renderer": "
|
|
24
|
-
"@myriaddreamin/typst-ts-web-compiler": "
|
|
25
|
-
"@myriaddreamin/typst.ts": "
|
|
26
|
-
"bookcover-core": "^0.
|
|
23
|
+
"@myriaddreamin/typst-ts-renderer": "0.7.0",
|
|
24
|
+
"@myriaddreamin/typst-ts-web-compiler": "0.7.0",
|
|
25
|
+
"@myriaddreamin/typst.ts": "0.7.0",
|
|
26
|
+
"bookcover-core": "^0.12.0",
|
|
27
27
|
"typst-fonts": "^0.1.0"
|
|
28
28
|
}
|
|
29
29
|
}
|