@joplo-app/server 0.1.1 → 0.1.3

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.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * v2 接口(ADR-0002):CLI 只依赖这里导出的三个函数。由 T-board 实现,届时 index.ts 改为导出它们。
3
3
  */
4
- import type { Diagnostic } from '@joplo-app/core';
4
+ import type { AppearanceFont, AppearanceStroke, Diagnostic } from '@joplo-app/core';
5
5
  export type DevOptions = {
6
6
  projectDir: string;
7
7
  /** 缺省 4790;被占用时报错,不静默换端口。 */
@@ -42,6 +42,10 @@ export type RenderOptions = {
42
42
  stepId?: string;
43
43
  /** 主题名(D51):内置主题或项目 themes/<name>.css;缺省用项目配置的主题。 */
44
44
  theme?: string;
45
+ /** 字体(D55):hand / sans / serif / kai / mono;缺省跟随主题。 */
46
+ font?: AppearanceFont | null;
47
+ /** 线条(D55):rough / clean;缺省跟随主题。 */
48
+ stroke?: AppearanceStroke | null;
45
49
  out: string;
46
50
  overwrite?: boolean;
47
51
  /** 截图尺寸(D44):舞台宽度仍是页面自己的 viewport,按比例放进这个尺寸。缺省为舞台尺寸。 */
package/dist/export.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type http from 'node:http';
2
- import { type Project } from '@joplo-app/core';
2
+ import { type AppearanceFont, type AppearanceStroke, type Project } from '@joplo-app/core';
3
3
  import { type PlaywrightModule } from './render.js';
4
4
  export type Device = 'desktop' | 'mobile';
5
5
  /**
@@ -55,6 +55,11 @@ type Ctx = {
55
55
  }>;
56
56
  fail: (e: unknown) => void;
57
57
  };
58
+ /** 导出请求里的字体与线条(D55):合法值保留,缺省、null 与未知值都是 null(跟随主题)。任何输入都不抛错。 */
59
+ export declare function exportAppearance(body: unknown): {
60
+ font: AppearanceFont | null;
61
+ stroke: AppearanceStroke | null;
62
+ };
58
63
  /** 缺省的录制:Playwright recordVideo + 渲染路由的录制模式(window.__JOPLO_RECORD__)。 */
59
64
  export declare function defaultRecorder(load: () => Promise<PlaywrightModule>): VideoRecorder;
60
65
  export declare class ExportHub {
@@ -71,6 +76,8 @@ export declare class ExportHub {
71
76
  onEvent?: (j: VideoJob) => void;
72
77
  });
73
78
  private renderUrl;
79
+ /** 取消正在进行的视频任务(D55 导出进度里的「取消」):立即标为“已取消”并中止录制;没有任务时返回 null。 */
80
+ cancel(projectId: string): VideoJob | null;
74
81
  job(projectId: string): VideoJob | null;
75
82
  private update;
76
83
  handle(sub: string, req: http.IncomingMessage, res: http.ServerResponse, ctx: Ctx): Promise<void>;
package/dist/export.js CHANGED
@@ -1,19 +1,22 @@
1
1
  /**
2
2
  * 看板「…」菜单的导出(D39):
3
3
  *
4
- * - 图片:`POST /__joplo/p/<id>/export/image` `{ scenarioId, position, theme }` → PNG(当前步骤;尺寸跟随页面自己的 viewport,
4
+ * - 图片:`POST /__joplo/p/<id>/export/image` `{ scenarioId, position, theme, font?, stroke? }` → PNG(当前步骤;尺寸跟随页面自己的 viewport,
5
5
  * 手机页面带外框;D44 起不再选择设备;镜头用这一步的导演镜头)。Playwright 打开本看板的渲染路由(与 renderStep 同一条渲染路径),截取 `[data-jexport]`。
6
- * - 视频(只在本机):`POST …/export/video` `{ scenarioId, theme }` → 202 `{ jobId }`(尺寸跟随场景起始页面的 viewport);
6
+ * - 视频(只在本机):`POST …/export/video` `{ scenarioId, theme, font?, stroke? }` → 202 `{ jobId }`(尺寸跟随场景起始页面的 viewport);
7
7
  * Playwright `recordVideo` 录下渲染路由的自动播放(含鼠标与字幕),保存为 `<项目>/exports/<场景>-<时间>.webm`。
8
8
  * 进度:`GET …/export/video/events`(SSE,先发当前状态,之后每次变化一条,结束后关闭);`GET …/export/video` 取当前状态。
9
- * 同一项目同时只能有一个视频任务(再提交返回 409)。没有 Playwright / Chromium 时任务失败,错误里带安装命令。
9
+ * 同一项目同时只能有一个视频任务(再提交返回 409);`DELETE …/export/video` 取消正在进行的任务(D55)。没有 Playwright / Chromium 时任务失败,错误里带安装命令。
10
+ *
11
+ * 外观(D55):font / stroke 由 exportAppearance 校验(未知值 = null = 跟随主题),非 null 时作为渲染路由的 URL 参数,
12
+ * RenderApp 读出后交给舞台、字幕与手机外框(与看板里看到的一致)。
10
13
  *
11
14
  * 字段流向:job(写入点:这里的 runJob)→ jobs Map(存储)→ SSE / GET(读取点)→ 看板的导出视频弹窗(消费者)。
12
15
  */
13
16
  import crypto from 'node:crypto';
14
17
  import fs from 'node:fs';
15
18
  import path from 'node:path';
16
- import { JoploError, SUBTITLE_HEIGHT, THEME_NAME, displaySceneId } from '@joplo-app/core';
19
+ import { JoploError, SUBTITLE_HEIGHT, THEME_NAME, displaySceneId, isAppearanceFont, isAppearanceStroke } from '@joplo-app/core';
17
20
  import { launch, loadPlaywright } from "./render.js";
18
21
  /**
19
22
  * 导出画面的尺寸:电脑 = 舞台 1280×800;手机 = 外框(renderer 的 phoneFrameSize(390, 844) = 446×934)
@@ -27,6 +30,13 @@ const send = (res, status, body) => {
27
30
  res.writeHead(status, { 'content-type': 'application/json; charset=utf-8', 'cache-control': 'no-store', 'x-content-type-options': 'nosniff' });
28
31
  res.end(JSON.stringify(body));
29
32
  };
33
+ /** 导出请求里的字体与线条(D55):合法值保留,缺省、null 与未知值都是 null(跟随主题)。任何输入都不抛错。 */
34
+ export function exportAppearance(body) {
35
+ const b = (body && typeof body === 'object' ? body : {});
36
+ return { font: isAppearanceFont(b.font) ? b.font : null, stroke: isAppearanceStroke(b.stroke) ? b.stroke : null };
37
+ }
38
+ /** 渲染路由上的外观参数(null 不写)。 */
39
+ const appearanceParams = (a) => ({ ...(a.font ? { font: a.font } : {}), ...(a.stroke ? { stroke: a.stroke } : {}) });
30
40
  function parseRequest(project, body, needPosition) {
31
41
  if (!project)
32
42
  throw new JoploError('INVALID_SCHEMA', '项目还没有成功编译过,无法导出');
@@ -42,7 +52,7 @@ function parseRequest(project, body, needPosition) {
42
52
  const device = project.scenes[sceneId]?.viewport === 'mobile' ? 'mobile' : 'desktop';
43
53
  // 主题(D51):请求里的主题名,没有或不合法时用项目配置的主题
44
54
  const theme = typeof b.theme === 'string' && THEME_NAME.test(b.theme) ? b.theme : project.theme;
45
- return { sc, position, device, theme };
55
+ return { sc, position, device, look: { theme, ...exportAppearance(body) } };
46
56
  }
47
57
  const fileSafe = (s) => s.replace(/[^\w.-]+/g, '_').slice(0, 80) || 'scenario';
48
58
  const stamp = (d = new Date()) => `${d.getFullYear()}${String(d.getMonth() + 1).padStart(2, '0')}${String(d.getDate()).padStart(2, '0')}-${String(d.getHours()).padStart(2, '0')}${String(d.getMinutes()).padStart(2, '0')}${String(d.getSeconds()).padStart(2, '0')}`;
@@ -107,6 +117,16 @@ export class ExportHub {
107
117
  renderUrl(projectId, q) {
108
118
  return `${this.opts.baseUrl()}?${new URLSearchParams({ render: '1', project: projectId, ...q })}`;
109
119
  }
120
+ /** 取消正在进行的视频任务(D55 导出进度里的「取消」):立即标为“已取消”并中止录制;没有任务时返回 null。 */
121
+ cancel(projectId) {
122
+ const job = this.jobs.get(projectId);
123
+ if (!job || job.status !== 'running')
124
+ return null;
125
+ this.update(job, { status: 'error', phase: 'error', error: '已取消' });
126
+ this.aborts.get(projectId)?.abort();
127
+ this.aborts.delete(projectId);
128
+ return { ...job };
129
+ }
110
130
  job(projectId) {
111
131
  return this.jobs.get(projectId) ?? null;
112
132
  }
@@ -126,8 +146,8 @@ export class ExportHub {
126
146
  const b = await ctx.jsonBody();
127
147
  if (!b.ok)
128
148
  return;
129
- const { sc, position, device, theme } = parseRequest(ctx.project, b.body, true);
130
- const png = await this.image(ctx.projectId, sc.id, position, device, theme);
149
+ const { sc, position, device, look } = parseRequest(ctx.project, b.body, true);
150
+ const png = await this.image(ctx.projectId, sc.id, position, device, look);
131
151
  res.writeHead(200, { 'content-type': 'image/png', 'cache-control': 'no-store', 'content-disposition': `attachment; filename="${fileSafe(sc.id)}-${position}.png"` });
132
152
  res.end(png);
133
153
  return;
@@ -138,15 +158,21 @@ export class ExportHub {
138
158
  const b = await ctx.jsonBody();
139
159
  if (!b.ok)
140
160
  return;
141
- const { sc, device, theme } = parseRequest(ctx.project, b.body, false);
161
+ const { sc, device, look } = parseRequest(ctx.project, b.body, false);
142
162
  const cur = this.jobs.get(ctx.projectId);
143
163
  if (cur?.status === 'running')
144
164
  return send(res, 409, { error: { code: 'UNSUPPORTED_ACTION', message: '这个项目已有一个视频正在导出,请等它完成' }, job: cur });
145
- const job = this.startVideo(ctx.projectId, ctx.dir, sc.id, sc.steps.length, device, theme);
165
+ const job = this.startVideo(ctx.projectId, ctx.dir, sc.id, sc.steps.length, device, look);
146
166
  return send(res, 202, { jobId: job.id, job });
147
167
  }
148
168
  if (sub === 'video' && method === 'GET')
149
169
  return send(res, 200, { job: this.job(ctx.projectId) });
170
+ if (sub === 'video' && method === 'DELETE') {
171
+ if (!ctx.guardWrite(false))
172
+ return;
173
+ const job = this.cancel(ctx.projectId);
174
+ return job ? send(res, 200, { job }) : send(res, 404, { error: { code: 'NOT_FOUND', message: '这个项目没有正在导出的视频' } });
175
+ }
150
176
  if (sub === 'video/events' && method === 'GET') {
151
177
  if (!ctx.guardWrite(false))
152
178
  return;
@@ -161,12 +187,12 @@ export class ExportHub {
161
187
  res.end();
162
188
  }
163
189
  }
164
- async image(projectId, scenarioId, position, device, theme) {
190
+ async image(projectId, scenarioId, position, device, look) {
165
191
  const pw = await this.deps.loadPlaywright();
166
192
  const browser = await launch(pw);
167
193
  try {
168
194
  const page = await browser.newPage({ viewport: EXPORT_SIZE[device], deviceScaleFactor: 2, reducedMotion: 'reduce' });
169
- await page.goto(this.renderUrl(projectId, { scenario: scenarioId, position: String(position), theme, frame: '1' }), { waitUntil: 'domcontentloaded' });
195
+ await page.goto(this.renderUrl(projectId, { scenario: scenarioId, position: String(position), theme: look.theme, ...appearanceParams(look), frame: '1' }), { waitUntil: 'domcontentloaded' });
170
196
  await waitReady(page);
171
197
  return await page.locator('[data-jexport]').screenshot({ type: 'png', animations: 'disabled' });
172
198
  }
@@ -174,7 +200,7 @@ export class ExportHub {
174
200
  await browser.close().catch(() => undefined);
175
201
  }
176
202
  }
177
- startVideo(projectId, dir, scenarioId, total, device, theme) {
203
+ startVideo(projectId, dir, scenarioId, total, device, look) {
178
204
  const job = { id: crypto.randomBytes(6).toString('hex'), projectId, scenarioId, status: 'running', phase: 'starting', step: 0, total, percent: 0, file: null, error: null };
179
205
  this.jobs.set(projectId, job);
180
206
  const ac = new AbortController();
@@ -186,18 +212,22 @@ export class ExportHub {
186
212
  fs.mkdirSync(path.dirname(out), { recursive: true });
187
213
  this.update(job, { phase: 'starting', percent: 2 });
188
214
  await this.deps.recordVideo({
189
- url: this.renderUrl(projectId, { scenario: scenarioId, position: '0', theme, frame: '1', record: '1' }),
215
+ url: this.renderUrl(projectId, { scenario: scenarioId, position: '0', theme: look.theme, ...appearanceParams(look), frame: '1', record: '1' }),
190
216
  size: EXPORT_SIZE[device],
191
217
  out,
192
218
  total,
193
219
  signal: ac.signal,
194
220
  progress: (step) => {
221
+ if (job.status !== 'running')
222
+ return; // 已取消
195
223
  const s = Math.max(0, Math.min(step, total));
196
224
  const percent = Math.round(5 + (total ? s / total : 1) * 85);
197
225
  if (job.phase !== 'recording' || s !== job.step)
198
226
  this.update(job, { phase: 'recording', step: s, percent });
199
227
  },
200
228
  });
229
+ if (job.status !== 'running')
230
+ return; // 已取消:录制器之后才返回,不改回完成
201
231
  this.update(job, { phase: 'saving', percent: 95 });
202
232
  if (!fs.existsSync(out))
203
233
  throw new JoploError('EXPORT_FAILED', '录制完成,但没有生成视频文件');
@@ -205,10 +235,13 @@ export class ExportHub {
205
235
  this.opts.log(`[joplo] 已导出视频:${out}`);
206
236
  }
207
237
  catch (e) {
208
- this.update(job, { status: 'error', phase: 'error', error: e instanceof Error ? e.message : String(e) });
238
+ if (job.status === 'running')
239
+ this.update(job, { status: 'error', phase: 'error', error: e instanceof Error ? e.message : String(e) });
209
240
  }
210
241
  finally {
211
- this.aborts.delete(projectId);
242
+ // 只删自己的(取消后可能已经开始了新任务)
243
+ if (this.aborts.get(projectId) === ac)
244
+ this.aborts.delete(projectId);
212
245
  }
213
246
  })();
214
247
  this.running.add(p);
package/dist/home.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { type AppearanceFont, type AppearanceStroke } from '@joplo-app/core';
1
2
  export type ProjectRecord = {
2
3
  dir: string;
3
4
  name: string;
@@ -32,18 +33,25 @@ export declare function writeServerInfo(home: string, info: ServerInfo): void;
32
33
  export declare function clearServerInfo(home: string, pid: number): void;
33
34
  export declare function pidAlive(pid: number): boolean;
34
35
  /**
35
- * `{ version: 1, theme?: string | null, projects?: { [项目 id]: { theme: string | null } } }`
36
- * theme:所有项目的主题选择;projects[id].theme:按项目覆盖,null 表示“恢复为项目默认”(使用项目 config 里的主题)。
37
- * 写入点:看板设置页(PUT /__joplo/settings);读取点:看板演示页与设置页(GET /__joplo/settings)。原子写入。
36
+ * `{ version: 1, theme?, font?, stroke?, projects?: { [项目 id]: { theme?, font?, stroke? } } }`
37
+ * - theme:主题名(内置或作者 themes/<name>.css);font:hand | sans | serif | kai | mono;stroke:rough | clean。
38
+ * - 顶层是“所有项目”的选择;projects[id] 按项目覆盖。值为 null:theme = 恢复为项目 config 的主题,font / stroke = 跟随主题。
39
+ * - 字段不存在 = 没有设置(项目条目里没有就看顶层,顶层没有就看项目 config / 主题)。
40
+ * 写入点:看板外观浮层(PUT /__joplo/settings);存储:这里(校验后原子写入);读取点:看板(GET /__joplo/settings →
41
+ * useBoardSettings → effectiveAppearance);消费者:舞台、字幕、手机外框、导出图片与视频。
42
+ * 只有 theme 的旧文件照常读取。发布站不读它(joplo.config.ts 只有 theme)。
38
43
  */
44
+ export type AppearanceOverride = {
45
+ theme?: string | null;
46
+ font?: AppearanceFont | null;
47
+ stroke?: AppearanceStroke | null;
48
+ };
39
49
  export type BoardSettings = {
40
50
  version: 1;
41
- theme?: string | null;
42
- projects?: Record<string, {
43
- theme: string | null;
44
- }>;
51
+ } & AppearanceOverride & {
52
+ projects?: Record<string, AppearanceOverride>;
45
53
  };
46
- /** 校验并规范化设置(未知字段丢弃,主题名不合法的条目丢弃)。 */
54
+ /** 校验并规范化设置(未知字段丢弃,不合法的值丢弃,没有合法字段的项目条目丢弃)。任何输入都不抛错。 */
47
55
  export declare function normalizeSettings(v: unknown): BoardSettings;
48
56
  export declare function readSettings(home: string): BoardSettings;
49
57
  export declare function writeSettings(home: string, s: unknown): BoardSettings;
package/dist/home.js CHANGED
@@ -14,6 +14,7 @@ import crypto from 'node:crypto';
14
14
  import fs from 'node:fs';
15
15
  import os from 'node:os';
16
16
  import path from 'node:path';
17
+ import { THEME_NAME, isAppearanceFont, isAppearanceStroke } from '@joplo-app/core';
17
18
  export function joploHome(env = process.env) {
18
19
  const v = env.JOPLO_HOME;
19
20
  return v && v.trim() ? path.resolve(v) : path.join(os.homedir(), '.joplo');
@@ -131,23 +132,30 @@ export function pidAlive(pid) {
131
132
  return e.code === 'EPERM';
132
133
  }
133
134
  }
134
- const NAME = /^[A-Za-z][\w-]*$/;
135
- /** 校验并规范化设置(未知字段丢弃,主题名不合法的条目丢弃)。 */
136
- export function normalizeSettings(v) {
137
- const o = (v && typeof v === 'object' ? v : {});
138
- const out = { version: 1 };
139
- if (typeof o.theme === 'string' && NAME.test(o.theme))
135
+ /** 一组外观字段:只留合法值(null 合法),其余丢弃。 */
136
+ function normalizeAppearance(o) {
137
+ const out = {};
138
+ if (o.theme === null || (typeof o.theme === 'string' && THEME_NAME.test(o.theme)))
140
139
  out.theme = o.theme;
141
- else if (o.theme === null)
142
- out.theme = null;
143
- const projects = o.projects && typeof o.projects === 'object' ? o.projects : {};
140
+ if (o.font === null || isAppearanceFont(o.font))
141
+ out.font = o.font;
142
+ if (o.stroke === null || isAppearanceStroke(o.stroke))
143
+ out.stroke = o.stroke;
144
+ return out;
145
+ }
146
+ const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
147
+ /** 校验并规范化设置(未知字段丢弃,不合法的值丢弃,没有合法字段的项目条目丢弃)。任何输入都不抛错。 */
148
+ export function normalizeSettings(v) {
149
+ const o = isObj(v) ? v : {};
150
+ const out = { version: 1, ...normalizeAppearance(o) };
151
+ const projects = isObj(o.projects) ? o.projects : {};
144
152
  const p = {};
145
153
  for (const [id, x] of Object.entries(projects)) {
146
- if (!/^[\w-]{1,64}$/.test(id) || !x || typeof x !== 'object')
154
+ if (!/^[\w-]{1,64}$/.test(id) || !isObj(x))
147
155
  continue;
148
- const t = x.theme;
149
- if (t === null || (typeof t === 'string' && NAME.test(t)))
150
- p[id] = { theme: t };
156
+ const a = normalizeAppearance(x);
157
+ if (Object.keys(a).length)
158
+ p[id] = a;
151
159
  }
152
160
  if (Object.keys(p).length)
153
161
  out.projects = p;
package/dist/render.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { Browser } from 'playwright';
2
+ import { type AppearanceFont, type AppearanceStroke } from '@joplo-app/core';
2
3
  import type { RenderOptions, RenderResult } from './contract.js';
3
4
  export type PlaywrightModule = typeof import('playwright');
4
5
  /** 按需载入 Playwright;没有安装时抛出带安装命令的 RENDER_FAILED。 */
@@ -6,4 +7,20 @@ export declare function loadPlaywright(importer?: () => Promise<PlaywrightModule
6
7
  /** 浏览器启动失败时的一行提示。 */
7
8
  export declare function launchHint(e: unknown): string;
8
9
  export declare function launch({ chromium }: PlaywrightModule): Promise<Browser>;
10
+ /**
11
+ * 渲染路由的参数(纯函数):主题必填(调用方缺省时传项目主题);字体与线条(D55)只在指定且合法时带上,
12
+ * 缺省 = 跟随主题,与 D55 之前的截图一致。
13
+ */
14
+ export declare function renderQuery(q: {
15
+ projectId: string;
16
+ scenarioId: string;
17
+ position: number;
18
+ theme: string;
19
+ font?: AppearanceFont | null;
20
+ stroke?: AppearanceStroke | null;
21
+ viewport?: {
22
+ width: number;
23
+ height: number;
24
+ };
25
+ }): string;
9
26
  export declare function renderStep(opts: RenderOptions): Promise<RenderResult>;
package/dist/render.js CHANGED
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import fs from 'node:fs';
9
9
  import path from 'node:path';
10
- import { JoploError, SUBTITLE_HEIGHT, VIEWPORT_SIZE, displaySceneId, findNode, isNodeDisabled, nodeLabel, positionAfterStep, resolveProps, stateAt, walkNodes } from '@joplo-app/core';
10
+ import { JoploError, SUBTITLE_HEIGHT, VIEWPORT_SIZE, isAppearanceFont, isAppearanceStroke, displaySceneId, findNode, isNodeDisabled, nodeLabel, positionAfterStep, resolveProps, stateAt, walkNodes } from '@joplo-app/core';
11
11
  import { createDev } from "./dev.js";
12
12
  import { realProjectDir } from "./vite-shared.js";
13
13
  const STAGE_SIZE = VIEWPORT_SIZE;
@@ -74,6 +74,22 @@ function assertNotProjectData(projectDir, out) {
74
74
  if (/\.(tsx?|jsx?|mts)$/.test(o) && o.startsWith(dir + path.sep))
75
75
  throw new JoploError('USAGE', `不能用截图覆盖项目源文件:${out}`);
76
76
  }
77
+ /**
78
+ * 渲染路由的参数(纯函数):主题必填(调用方缺省时传项目主题);字体与线条(D55)只在指定且合法时带上,
79
+ * 缺省 = 跟随主题,与 D55 之前的截图一致。
80
+ */
81
+ export function renderQuery(q) {
82
+ return new URLSearchParams({
83
+ render: '1',
84
+ project: q.projectId,
85
+ scenario: q.scenarioId,
86
+ position: String(q.position),
87
+ theme: q.theme,
88
+ ...(isAppearanceFont(q.font) ? { font: q.font } : {}),
89
+ ...(isAppearanceStroke(q.stroke) ? { stroke: q.stroke } : {}),
90
+ ...(q.viewport ? { w: String(q.viewport.width), h: String(q.viewport.height) } : {}),
91
+ }).toString();
92
+ }
77
93
  export async function renderStep(opts) {
78
94
  const projectDir = realProjectDir(opts.projectDir);
79
95
  const out = path.resolve(opts.out);
@@ -107,7 +123,7 @@ export async function renderStep(opts) {
107
123
  browser = await launch(playwright);
108
124
  const page = await browser.newPage({ viewport, deviceScaleFactor: opts.scale ?? 1, reducedMotion: 'reduce' });
109
125
  // D44:舞台宽度固定为页面自己的 viewport;指定 viewport 时它只是截图尺寸(舞台按比例放进去)
110
- const q = new URLSearchParams({ render: '1', project: server.projectId, scenario: sc.id, position: String(position), theme, ...(opts.viewport ? { w: String(opts.viewport.width), h: String(opts.viewport.height) } : {}) });
126
+ const q = renderQuery({ projectId: server.projectId, scenarioId: sc.id, position, theme, font: opts.font, stroke: opts.stroke, ...(opts.viewport ? { viewport: opts.viewport } : {}) });
111
127
  await page.goto(`${server.url}?${q}`, { waitUntil: 'domcontentloaded' });
112
128
  await page.waitForFunction(() => window.__JOPLO_READY__ === true, null, { timeout: 60000 });
113
129
  const err = await page.evaluate(() => window.__JOPLO_ERROR__ ?? null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joplo-app/server",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Joplo 本地服务:dev 看板、build 发布站、render 截图",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -15,9 +15,9 @@
15
15
  "dist"
16
16
  ],
17
17
  "dependencies": {
18
- "@joplo-app/core": "0.1.1",
19
- "@joplo-app/kit": "0.1.1",
20
- "@joplo-app/web": "0.1.1",
18
+ "@joplo-app/core": "0.1.3",
19
+ "@joplo-app/kit": "0.1.3",
20
+ "@joplo-app/web": "0.1.3",
21
21
  "@tailwindcss/vite": "4.3.4",
22
22
  "tailwindcss": "4.3.4",
23
23
  "vite": "8.3.5",