@joplo-app/kit 0.4.0 → 0.5.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/index.d.ts +13 -2
- package/dist/index.js +7 -2
- package/dist/renderer.d.ts +10 -0
- package/dist/renderer.js +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -204,6 +204,7 @@ export type EffectDef = {
|
|
|
204
204
|
type: 'stream';
|
|
205
205
|
path: string;
|
|
206
206
|
value: string;
|
|
207
|
+
pace?: 'voice';
|
|
207
208
|
} | {
|
|
208
209
|
kind: 'effect';
|
|
209
210
|
type: 'fork';
|
|
@@ -234,6 +235,7 @@ export type EffectDef = {
|
|
|
234
235
|
kind: 'effect';
|
|
235
236
|
type: 'say';
|
|
236
237
|
text: string;
|
|
238
|
+
role?: string;
|
|
237
239
|
} | {
|
|
238
240
|
kind: 'effect';
|
|
239
241
|
type: 'narrate';
|
|
@@ -255,8 +257,13 @@ export declare const toast: ((text: string) => EffectDef) & {
|
|
|
255
257
|
* 流式输出(D56):和 set 一样把文字写进状态,播放到这一步时绑定它的文字逐字出现(像模型在输出)。
|
|
256
258
|
* 跳到这一步、截图、发布站静态查看时直接显示全文。自动播放会等输出完再进下一步。
|
|
257
259
|
* .system('助手回复', stream($.ui.reply, '周六晴,推荐去白河营地……'))
|
|
260
|
+
* 接着往后写(D100):新值以原来的值开头时,原有的字直接显示,只有新加的字逐字出现(语音转写、日志追加)。
|
|
261
|
+
* opts.pace: 'voice':新加的字跟着这一步的朗读(narrate / say)出,读到哪写到哪;默认按模型输出的速度。
|
|
262
|
+
* .system('说', '“日程安排。”', stream($.ui.spoken, '附上新的日程安排。', { pace: 'voice' }), say('日程安排。', { role: 'me' }))
|
|
258
263
|
*/
|
|
259
|
-
export declare const stream: (target: Bind, text: string
|
|
264
|
+
export declare const stream: (target: Bind, text: string, opts?: {
|
|
265
|
+
pace?: "voice";
|
|
266
|
+
}) => EffectDef;
|
|
260
267
|
/** 本步的另一条故事路线;目标是同一方案的场景键,自动播放仍走主线。 */
|
|
261
268
|
export declare const fork: (label: string, scenario: string) => EffectDef;
|
|
262
269
|
/** 本步手绘标注(下一步消失);目标隐藏或不在当前层时不画。 */
|
|
@@ -300,8 +307,12 @@ export declare const narrate: (text: string) => EffectDef;
|
|
|
300
307
|
* 角色台词(D74):这一步里角色亲口说的话,用这个角色的声音读(feature.roles 与层级的 role;没有角色时用旁白的声音)。
|
|
301
308
|
* 写第一人称、像真人说话:.click('can_go', '阿杰回复:我能去', say('我能去!'))。
|
|
302
309
|
* 同一步写了 narrate() 时只读旁白。讲解、过渡、总结请用 narrate()。
|
|
310
|
+
* opts.role(D100):写明是谁在说(feature.roles 的键)。系统步骤没有“操作的人”,要角色的声音时必须写;
|
|
311
|
+
* 操作步骤写了也以它为准:.system('说', '“帮我写一封”', say('帮我写一封', { role: 'me' }))。
|
|
303
312
|
*/
|
|
304
|
-
export declare const say: (text: string
|
|
313
|
+
export declare const say: (text: string, opts?: {
|
|
314
|
+
role?: string;
|
|
315
|
+
}) => EffectDef;
|
|
305
316
|
/**
|
|
306
317
|
* 聚光:这一步只照亮这些元素,画面其余部分压暗(不遮挡、不拦截点击,下一步要点的元素也保持明亮)。
|
|
307
318
|
* 用于“这一屏信息很多,此刻只看这一块”。
|
package/dist/index.js
CHANGED
|
@@ -59,8 +59,11 @@ export const toast = Object.assign((text) => ({ kind: 'effect', type: 'toast', t
|
|
|
59
59
|
* 流式输出(D56):和 set 一样把文字写进状态,播放到这一步时绑定它的文字逐字出现(像模型在输出)。
|
|
60
60
|
* 跳到这一步、截图、发布站静态查看时直接显示全文。自动播放会等输出完再进下一步。
|
|
61
61
|
* .system('助手回复', stream($.ui.reply, '周六晴,推荐去白河营地……'))
|
|
62
|
+
* 接着往后写(D100):新值以原来的值开头时,原有的字直接显示,只有新加的字逐字出现(语音转写、日志追加)。
|
|
63
|
+
* opts.pace: 'voice':新加的字跟着这一步的朗读(narrate / say)出,读到哪写到哪;默认按模型输出的速度。
|
|
64
|
+
* .system('说', '“日程安排。”', stream($.ui.spoken, '附上新的日程安排。', { pace: 'voice' }), say('日程安排。', { role: 'me' }))
|
|
62
65
|
*/
|
|
63
|
-
export const stream = (target, text) => ({ kind: 'effect', type: 'stream', path: pathOf(target), value: text });
|
|
66
|
+
export const stream = (target, text, opts = {}) => ({ kind: 'effect', type: 'stream', path: pathOf(target), value: text, ...(opts.pace !== undefined ? { pace: opts.pace } : {}) });
|
|
64
67
|
/** 本步的另一条故事路线;目标是同一方案的场景键,自动播放仍走主线。 */
|
|
65
68
|
export const fork = (label, scenario) => ({ kind: 'effect', type: 'fork', label, scenario });
|
|
66
69
|
/** 本步手绘标注(下一步消失);目标隐藏或不在当前层时不画。 */
|
|
@@ -101,8 +104,10 @@ export const narrate = (text) => ({ kind: 'effect', type: 'narrate', text });
|
|
|
101
104
|
* 角色台词(D74):这一步里角色亲口说的话,用这个角色的声音读(feature.roles 与层级的 role;没有角色时用旁白的声音)。
|
|
102
105
|
* 写第一人称、像真人说话:.click('can_go', '阿杰回复:我能去', say('我能去!'))。
|
|
103
106
|
* 同一步写了 narrate() 时只读旁白。讲解、过渡、总结请用 narrate()。
|
|
107
|
+
* opts.role(D100):写明是谁在说(feature.roles 的键)。系统步骤没有“操作的人”,要角色的声音时必须写;
|
|
108
|
+
* 操作步骤写了也以它为准:.system('说', '“帮我写一封”', say('帮我写一封', { role: 'me' }))。
|
|
104
109
|
*/
|
|
105
|
-
export const say = (text) => ({ kind: 'effect', type: 'say', text });
|
|
110
|
+
export const say = (text, opts = {}) => ({ kind: 'effect', type: 'say', text, ...(opts.role !== undefined ? { role: opts.role } : {}) });
|
|
106
111
|
// ---------- 焦点与呈现形式(D70):这一步观众看哪里、用什么形式看 ----------
|
|
107
112
|
// 镜头(shot)负责“取景”:推近、跟随。下面这些只负责“强调”:都不推近镜头;目标不在当前镜头里时,镜头先退回整层。
|
|
108
113
|
// 都只作用于这一步(下一步消失),跳到任意一步、前后翻、回放结果一致。
|
package/dist/renderer.d.ts
CHANGED
|
@@ -64,6 +64,8 @@ export type RendererServices = {
|
|
|
64
64
|
styleOf(props: Record<string, unknown>, width: number): CSSProperties;
|
|
65
65
|
nodeLabel(node: PluginIRNode): string;
|
|
66
66
|
useCtx(): RendererContext;
|
|
67
|
+
/** Subscribe to every engine clock frame (D99). Only per-frame presenters need it; useCtx().clock changes only on run / pause / speed, with live time fields. */
|
|
68
|
+
useEngineFrame(enabled?: boolean): EngineFrame | undefined;
|
|
67
69
|
useI18n(): {
|
|
68
70
|
t: {
|
|
69
71
|
stage: Record<string, unknown>;
|
|
@@ -99,6 +101,14 @@ export type RendererServices = {
|
|
|
99
101
|
};
|
|
100
102
|
export declare function registerRendererServices(services: RendererServices): void;
|
|
101
103
|
export declare const useCtx: () => RendererContext;
|
|
104
|
+
export declare const useEngineFrame: (enabled?: boolean) => Readonly<{
|
|
105
|
+
timeMs: number;
|
|
106
|
+
elapsedMs: number;
|
|
107
|
+
rawMs: number;
|
|
108
|
+
running: boolean;
|
|
109
|
+
speed: number;
|
|
110
|
+
paused?: boolean;
|
|
111
|
+
}> | undefined;
|
|
102
112
|
export declare const useI18n: <Messages extends Record<string, unknown>>() => {
|
|
103
113
|
t: {
|
|
104
114
|
stage: Messages;
|
package/dist/renderer.js
CHANGED
|
@@ -4,6 +4,7 @@ export function registerRendererServices(services) { global[KEY] = Object.freeze
|
|
|
4
4
|
const host = () => { if (!global[KEY])
|
|
5
5
|
throw new Error('Joplo renderer services are not initialized'); return global[KEY]; };
|
|
6
6
|
export const useCtx = () => host().useCtx();
|
|
7
|
+
export const useEngineFrame = (enabled = true) => host().useEngineFrame(enabled);
|
|
7
8
|
export const useI18n = () => host().useI18n();
|
|
8
9
|
export const useR = (...args) => host().useR(...args);
|
|
9
10
|
export const useRoot = (...args) => host().useRoot(...args);
|