@joplo-app/kit 0.2.9 → 0.2.12

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 CHANGED
@@ -25,6 +25,17 @@ export type StateInit = {
25
25
  * autoFocus(D70):默认焦点行为(结果揭晓:本步新出现或变化的元素轻轻脉冲一次;进入新的一层时先全景再推近)。
26
26
  * 缺省开启;写 false 整体关掉,演示只按作者写的 shot / trace / spotlight 等呈现。
27
27
  */
28
+ /**
29
+ * 朗读(D74):自动播放时把每一步读出来。都可以不写:不写时看板里选哪个声音来源就用哪个,旁白用它的默认音色。
30
+ * - profile:本机声音供应商 profile 的名字或 id(看板「声音 → 管理供应商」里保存的,例如 'OpenAI');写了就优先于看板里的选择。Key 不写在这里。
31
+ * - narrator:旁白(系统步骤、过渡卡)的音色,例如 'nova';
32
+ * - roles:角色的音色,键是 feature.roles 的键,例如 { xiaoyu: 'shimmer' };没写的角色用旁白的音色。
33
+ */
34
+ export type VoiceConfig = {
35
+ profile?: string;
36
+ narrator?: string;
37
+ roles?: Record<string, string>;
38
+ };
28
39
  export type ConfigDef = {
29
40
  kind: 'config';
30
41
  name: string;
@@ -33,6 +44,7 @@ export type ConfigDef = {
33
44
  layout?: string;
34
45
  home?: string;
35
46
  autoFocus?: boolean;
47
+ voice?: VoiceConfig;
36
48
  source?: string;
37
49
  };
38
50
  export declare const config: (c: Omit<ConfigDef, "kind" | "source">) => ConfigDef;
@@ -208,6 +220,14 @@ export type EffectDef = {
208
220
  kind: 'effect';
209
221
  type: 'hold';
210
222
  seconds: number;
223
+ } | {
224
+ kind: 'effect';
225
+ type: 'say';
226
+ text: string;
227
+ } | {
228
+ kind: 'effect';
229
+ type: 'narrate';
230
+ text: string;
211
231
  };
212
232
  /** 标注气泡放在目标的哪一侧;不写时自动选画面里放得下的一侧(右、左、下、上)。 */
213
233
  export type CalloutSide = 'top' | 'right' | 'bottom' | 'left';
@@ -250,6 +270,26 @@ export declare const shot: (...targets: string[]) => EffectDef;
250
270
  * .system('额度预检', '调用模型之前先预检额度', shot('billing'), explain('额度不足时在这里就拦下,不会产生模型费用'))
251
271
  */
252
272
  export declare const explain: (text: string) => EffectDef;
273
+ /**
274
+ * 旁白(D74):讲解人用旁白的声音说的话,像在给同事介绍功能,不是把字幕念出来。和字幕分开存。
275
+ * 朗读的优先级:narrate() > say()(角色台词)> 字幕(过渡卡读标题和副标题);explain 不读。字幕兜底时也用旁白的声音。
276
+ * 自动播放会等它读完再进下一步。
277
+ *
278
+ * 写法(详见 npx joplo skill story 第 6 节):
279
+ * - 一句只做一件事:交代、指点、承接或收束;说字幕说不出的意图、原因、结果,不重复字幕;
280
+ * - 短:一两句,大多 3–8 秒;能删的字都删掉,画面已经看得到的不用再说;
281
+ * - 口语:主语在前,用逗号句号断气,不写括号、斜杠、箭头;数字按口语写(“四百六十块”“第二版”);
282
+ * - 换人、跳时间、收尾也要一句,告诉观众为什么切过去;平实具体,不用比喻和口号。
283
+ * .click('share', '小雨把行程单分享给阿杰', narrate('行程用链接发给阿杰,他不用装 App。'))
284
+ * .card('现在是阿杰', { role: 'ajie' }, narrate('换到阿杰这边,他只收到一条消息。'))
285
+ */
286
+ export declare const narrate: (text: string) => EffectDef;
287
+ /**
288
+ * 角色台词(D74):这一步里角色亲口说的话,用这个角色的声音读(feature.roles 与层级的 role;没有角色时用旁白的声音)。
289
+ * 写第一人称、像真人说话:.click('can_go', '阿杰回复:我能去', say('我能去!'))。
290
+ * 同一步写了 narrate() 时只读旁白。讲解、过渡、总结请用 narrate()。
291
+ */
292
+ export declare const say: (text: string) => EffectDef;
253
293
  /**
254
294
  * 聚光:这一步只照亮这些元素,画面其余部分压暗(不遮挡、不拦截点击,下一步要点的元素也保持明亮)。
255
295
  * 用于“这一屏信息很多,此刻只看这一块”。
package/dist/index.js CHANGED
@@ -80,6 +80,26 @@ export const shot = (...targets) => ({ kind: 'effect', type: 'shot', targets });
80
80
  * .system('额度预检', '调用模型之前先预检额度', shot('billing'), explain('额度不足时在这里就拦下,不会产生模型费用'))
81
81
  */
82
82
  export const explain = (text) => ({ kind: 'effect', type: 'explain', text });
83
+ /**
84
+ * 旁白(D74):讲解人用旁白的声音说的话,像在给同事介绍功能,不是把字幕念出来。和字幕分开存。
85
+ * 朗读的优先级:narrate() > say()(角色台词)> 字幕(过渡卡读标题和副标题);explain 不读。字幕兜底时也用旁白的声音。
86
+ * 自动播放会等它读完再进下一步。
87
+ *
88
+ * 写法(详见 npx joplo skill story 第 6 节):
89
+ * - 一句只做一件事:交代、指点、承接或收束;说字幕说不出的意图、原因、结果,不重复字幕;
90
+ * - 短:一两句,大多 3–8 秒;能删的字都删掉,画面已经看得到的不用再说;
91
+ * - 口语:主语在前,用逗号句号断气,不写括号、斜杠、箭头;数字按口语写(“四百六十块”“第二版”);
92
+ * - 换人、跳时间、收尾也要一句,告诉观众为什么切过去;平实具体,不用比喻和口号。
93
+ * .click('share', '小雨把行程单分享给阿杰', narrate('行程用链接发给阿杰,他不用装 App。'))
94
+ * .card('现在是阿杰', { role: 'ajie' }, narrate('换到阿杰这边,他只收到一条消息。'))
95
+ */
96
+ export const narrate = (text) => ({ kind: 'effect', type: 'narrate', text });
97
+ /**
98
+ * 角色台词(D74):这一步里角色亲口说的话,用这个角色的声音读(feature.roles 与层级的 role;没有角色时用旁白的声音)。
99
+ * 写第一人称、像真人说话:.click('can_go', '阿杰回复:我能去', say('我能去!'))。
100
+ * 同一步写了 narrate() 时只读旁白。讲解、过渡、总结请用 narrate()。
101
+ */
102
+ export const say = (text) => ({ kind: 'effect', type: 'say', text });
83
103
  // ---------- 焦点与呈现形式(D70):这一步观众看哪里、用什么形式看 ----------
84
104
  // 镜头(shot)负责“取景”:推近、跟随。下面这些只负责“强调”:都不推近镜头;目标不在当前镜头里时,镜头先退回整层。
85
105
  // 都只作用于这一步(下一步消失),跳到任意一步、前后翻、回放结果一致。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joplo-app/kit",
3
- "version": "0.2.9",
3
+ "version": "0.2.12",
4
4
  "description": "Joplo 创作 SDK:组件、feature/option/flow 与 JSX 运行时(收集成数据,不作为 React 执行)",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",