camox 0.19.0 → 0.21.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/core/createLayout.js +7 -7
- package/dist/features/og/defaultFonts.js +31 -0
- package/dist/features/og/geist-variable-ttf-base64.js +21 -0
- package/dist/features/og/imageResponse.node.d.ts +12 -0
- package/dist/features/og/imageResponse.node.js +47 -0
- package/dist/features/og/imageResponse.workerd.d.ts +12 -0
- package/dist/features/og/imageResponse.workerd.js +40 -0
- package/dist/features/preview/components/BlockActionsPopover.js +1 -1
- package/dist/features/preview/components/CreatePageModal.js +1 -1
- package/dist/features/preview/components/EditPageModal.js +1 -1
- package/dist/features/preview/components/PageContentSheet.js +1 -1
- package/dist/features/preview/components/PagePicker.js +1 -1
- package/dist/features/preview/components/ShikiMarkdown.js +23 -12
- package/dist/features/studio/components/EnvironmentMenu.js +361 -57
- package/dist/features/vite/definitionsSync.js +12 -2
- package/dist/features/vite/vite.js +9 -1
- package/dist/lib/queries.js +17 -1
- package/dist/studio.css +1 -1
- package/package.json +31 -4
|
@@ -11,9 +11,9 @@ function createLayout(options) {
|
|
|
11
11
|
const initialBlocks = options.blocks.initial;
|
|
12
12
|
const BeforeBlocks = () => {
|
|
13
13
|
const $ = c(5);
|
|
14
|
-
if ($[0] !== "
|
|
14
|
+
if ($[0] !== "7133c1370318efe3d17ae04e10ee61f13b2babe8b7bb9f5f91e396facf4493b3") {
|
|
15
15
|
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
16
|
-
$[0] = "
|
|
16
|
+
$[0] = "7133c1370318efe3d17ae04e10ee61f13b2babe8b7bb9f5f91e396facf4493b3";
|
|
17
17
|
}
|
|
18
18
|
const ctx = React.use(LayoutContext);
|
|
19
19
|
if (!ctx) throw new Error(`Layout "${options.id}" BeforeBlocks must be rendered inside its Provider`);
|
|
@@ -48,9 +48,9 @@ function createLayout(options) {
|
|
|
48
48
|
BeforeBlocks.displayName = `LayoutBeforeBlocks(${options.id})`;
|
|
49
49
|
const AfterBlocks = () => {
|
|
50
50
|
const $ = c(5);
|
|
51
|
-
if ($[0] !== "
|
|
51
|
+
if ($[0] !== "7133c1370318efe3d17ae04e10ee61f13b2babe8b7bb9f5f91e396facf4493b3") {
|
|
52
52
|
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
53
|
-
$[0] = "
|
|
53
|
+
$[0] = "7133c1370318efe3d17ae04e10ee61f13b2babe8b7bb9f5f91e396facf4493b3";
|
|
54
54
|
}
|
|
55
55
|
const ctx = React.use(LayoutContext);
|
|
56
56
|
if (!ctx) throw new Error(`Layout "${options.id}" AfterBlocks must be rendered inside its Provider`);
|
|
@@ -85,9 +85,9 @@ function createLayout(options) {
|
|
|
85
85
|
AfterBlocks.displayName = `LayoutAfterBlocks(${options.id})`;
|
|
86
86
|
const Provider = (t0) => {
|
|
87
87
|
const $ = c(6);
|
|
88
|
-
if ($[0] !== "
|
|
88
|
+
if ($[0] !== "7133c1370318efe3d17ae04e10ee61f13b2babe8b7bb9f5f91e396facf4493b3") {
|
|
89
89
|
for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
90
|
-
$[0] = "
|
|
90
|
+
$[0] = "7133c1370318efe3d17ae04e10ee61f13b2babe8b7bb9f5f91e396facf4493b3";
|
|
91
91
|
}
|
|
92
92
|
const { layoutBlocks, children } = t0;
|
|
93
93
|
let t1;
|
|
@@ -129,7 +129,7 @@ function createLayout(options) {
|
|
|
129
129
|
};
|
|
130
130
|
})];
|
|
131
131
|
const buildOgImage = options.buildOgImage ? async (params) => {
|
|
132
|
-
const { ImageResponse } = await import("
|
|
132
|
+
const { ImageResponse } = await import("camox/_internal/imageResponse");
|
|
133
133
|
return new ImageResponse(options.buildOgImage(params), {
|
|
134
134
|
width: 1200,
|
|
135
135
|
height: 630
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { GEIST_VARIABLE_TTF_BASE64 } from "./geist-variable-ttf-base64.js";
|
|
2
|
+
|
|
3
|
+
//#region src/features/og/defaultFonts.ts
|
|
4
|
+
/**
|
|
5
|
+
* Decoded default fonts shared by the node and workerd OG image wrappers.
|
|
6
|
+
*
|
|
7
|
+
* The wasm renderer in `@takumi-rs/wasm` ships with no embedded fonts — calling
|
|
8
|
+
* `new Renderer()` without `fonts` produces zero text runs and OG images come
|
|
9
|
+
* out as featureless rectangles. We always inject Geist Variable so text has
|
|
10
|
+
* something to render with; the user can still pass their own `fonts:` through
|
|
11
|
+
* the ImageResponse constructor and override this default.
|
|
12
|
+
*
|
|
13
|
+
* Decoded once at module load — both wrappers cache their renderer instances
|
|
14
|
+
* at module scope, so the same bytes are passed to a single Renderer per
|
|
15
|
+
* isolate.
|
|
16
|
+
*/
|
|
17
|
+
function decodeBase64(b64) {
|
|
18
|
+
const binary = atob(b64);
|
|
19
|
+
const bytes = new Uint8Array(binary.length);
|
|
20
|
+
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
21
|
+
return bytes;
|
|
22
|
+
}
|
|
23
|
+
const DEFAULT_FONTS = [{
|
|
24
|
+
name: "Geist",
|
|
25
|
+
data: decodeBase64(GEIST_VARIABLE_TTF_BASE64),
|
|
26
|
+
weight: 400,
|
|
27
|
+
style: "normal"
|
|
28
|
+
}];
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { DEFAULT_FONTS };
|