@joplo-app/core 0.5.0 → 0.6.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/agent-skill.d.ts +7 -7
- package/dist/agent-skill.js +28 -25
- package/dist/authoring-works.d.ts +8 -0
- package/dist/authoring-works.js +46 -0
- package/dist/catalog.d.ts +2 -0
- package/dist/compile.d.ts +6 -3
- package/dist/compile.js +415 -340
- package/dist/content-i18n.js +9 -9
- package/dist/embed.d.ts +5 -5
- package/dist/embed.js +7 -7
- package/dist/entries.d.ts +63 -0
- package/dist/entries.js +78 -0
- package/dist/feature-diff.d.ts +7 -7
- package/dist/feature-diff.js +18 -17
- package/dist/features.d.ts +3 -3
- package/dist/features.js +3 -3
- package/dist/focus-check.js +2 -2
- package/dist/focus.d.ts +1 -5
- package/dist/focus.js +13 -35
- package/dist/guide.js +156 -66
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/load.js +42 -11
- package/dist/local-review-files.js +17 -4
- package/dist/local-review.d.ts +8 -7
- package/dist/local-review.js +7 -6
- package/dist/outline.d.ts +21 -13
- package/dist/outline.js +27 -32
- package/dist/pace.d.ts +3 -4
- package/dist/pace.js +3 -4
- package/dist/playback.d.ts +57 -0
- package/dist/playback.js +317 -0
- package/dist/player.d.ts +9 -195
- package/dist/player.js +8 -633
- package/dist/playground.d.ts +1 -1
- package/dist/playground.js +4 -4
- package/dist/plugins/compiler.d.ts +16 -0
- package/dist/plugins/compiler.js +48 -9
- package/dist/presentation.d.ts +73 -0
- package/dist/presentation.js +163 -0
- package/dist/publication.d.ts +8 -0
- package/dist/publication.js +45 -0
- package/dist/result.d.ts +1 -1
- package/dist/review.d.ts +18 -10
- package/dist/review.js +62 -23
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.js +2 -0
- package/dist/scene-query.d.ts +77 -0
- package/dist/scene-query.js +246 -0
- package/dist/schema-issues.js +1 -1
- package/dist/schema.d.ts +108 -76
- package/dist/schema.js +48 -36
- package/dist/scope.d.ts +9 -9
- package/dist/scope.js +82 -49
- package/dist/selection.d.ts +1 -1
- package/dist/sequencing.d.ts +6 -0
- package/dist/sequencing.js +21 -0
- package/dist/step-plan.d.ts +55 -0
- package/dist/step-plan.js +90 -0
- package/dist/traits.d.ts +10 -0
- package/dist/traits.js +3 -0
- package/dist/validate.d.ts +1 -1
- package/dist/validate.js +75 -65
- package/dist/voice.js +2 -1
- package/package.json +15 -3
package/dist/schema.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ElementTraits } from '@joplo-app/kit/plugin';
|
|
2
2
|
/**
|
|
3
|
-
* Joplo IR(schemaVersion
|
|
3
|
+
* Joplo IR(schemaVersion 3):由 TSX 源文件编译得到的中间表示,不是作者直接编辑的格式。
|
|
4
4
|
* 权威源是项目文件夹里的 TSX/TS 文件(ADR-0002);渲染器、播放器、校验器、构建只消费这里的 IR。
|
|
5
5
|
*
|
|
6
6
|
* 带 `source` 的对象记录其来源 `相对路径:行:列`,用于选中元素、诊断定位,让 Agent 只读写那一处。
|
|
@@ -9,7 +9,7 @@ import { z } from 'zod';
|
|
|
9
9
|
/** 层级标签的预设图标(标签压窄时靠它认出是哪一层)。不写时:手机视口 mobile,其余 window。 */
|
|
10
10
|
export declare const LAYER_ICONS: readonly ["window", "browser", "mobile", "desktop", "terminal", "chat", "agent", "server", "data", "email", "doc", "flow"];
|
|
11
11
|
export type LayerIcon = (typeof LAYER_ICONS)[number];
|
|
12
|
-
export declare const SCHEMA_VERSION:
|
|
12
|
+
export declare const SCHEMA_VERSION: 3;
|
|
13
13
|
/** 作者可写的 ID(对象键、元素 id)。 */
|
|
14
14
|
export declare const Id: z.ZodString;
|
|
15
15
|
/** 编译器生成的限定 ID,例如 `invite.happy`、`invite.a-modal@/members`。 */
|
|
@@ -69,7 +69,7 @@ export declare const SceneNode: z.ZodType<SceneNode>;
|
|
|
69
69
|
/** 一个画面 = 某个方案上下文中的一个路径:布局 + 页面 + 堆叠进来的功能元素。 */
|
|
70
70
|
export declare const Scene: z.ZodObject<{
|
|
71
71
|
id: z.ZodString;
|
|
72
|
-
|
|
72
|
+
workId: z.ZodNullable<z.ZodString>;
|
|
73
73
|
route: z.ZodString;
|
|
74
74
|
name: z.ZodString;
|
|
75
75
|
viewport: z.ZodDefault<z.ZodEnum<{
|
|
@@ -429,7 +429,7 @@ export declare const Scenario: z.ZodObject<{
|
|
|
429
429
|
}, z.core.$strict>>>;
|
|
430
430
|
ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
431
431
|
id: z.ZodString;
|
|
432
|
-
|
|
432
|
+
workId: z.ZodString;
|
|
433
433
|
name: z.ZodString;
|
|
434
434
|
description: z.ZodDefault<z.ZodString>;
|
|
435
435
|
caseIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -636,26 +636,6 @@ export declare const Route: z.ZodObject<{
|
|
|
636
636
|
slots: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
637
637
|
source: z.ZodOptional<z.ZodString>;
|
|
638
638
|
}, z.core.$strict>;
|
|
639
|
-
export declare const Feature: z.ZodObject<{
|
|
640
|
-
id: z.ZodString;
|
|
641
|
-
name: z.ZodString;
|
|
642
|
-
goal: z.ZodString;
|
|
643
|
-
roles: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
644
|
-
id: z.ZodOptional<z.ZodString>;
|
|
645
|
-
name: z.ZodString;
|
|
646
|
-
desc: z.ZodDefault<z.ZodString>;
|
|
647
|
-
color: z.ZodString;
|
|
648
|
-
}, z.core.$strict>>>;
|
|
649
|
-
constraints: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
650
|
-
id: z.ZodString;
|
|
651
|
-
text: z.ZodString;
|
|
652
|
-
hard: z.ZodDefault<z.ZodBoolean>;
|
|
653
|
-
}, z.core.$strict>>>;
|
|
654
|
-
caseIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
655
|
-
optionIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
656
|
-
pick: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
657
|
-
source: z.ZodOptional<z.ZodString>;
|
|
658
|
-
}, z.core.$strict>;
|
|
659
639
|
export declare const Case: z.ZodObject<{
|
|
660
640
|
id: z.ZodString;
|
|
661
641
|
featureId: z.ZodString;
|
|
@@ -694,6 +674,46 @@ export declare const Coverage: z.ZodObject<{
|
|
|
694
674
|
declared: "declared";
|
|
695
675
|
}>>;
|
|
696
676
|
}, z.core.$strict>;
|
|
677
|
+
/** 功能是作品之上的评审层;评审信息按作品 id 存放。 */
|
|
678
|
+
export declare const Feature: z.ZodObject<{
|
|
679
|
+
id: z.ZodString;
|
|
680
|
+
name: z.ZodString;
|
|
681
|
+
goal: z.ZodString;
|
|
682
|
+
roles: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
683
|
+
id: z.ZodOptional<z.ZodString>;
|
|
684
|
+
name: z.ZodString;
|
|
685
|
+
desc: z.ZodDefault<z.ZodString>;
|
|
686
|
+
color: z.ZodString;
|
|
687
|
+
}, z.core.$strict>>>;
|
|
688
|
+
constraints: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
689
|
+
id: z.ZodString;
|
|
690
|
+
text: z.ZodString;
|
|
691
|
+
hard: z.ZodDefault<z.ZodBoolean>;
|
|
692
|
+
}, z.core.$strict>>>;
|
|
693
|
+
caseIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
694
|
+
workIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
695
|
+
pick: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
696
|
+
alternatives: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
697
|
+
decisionFocus: z.ZodString;
|
|
698
|
+
tradeoffs: z.ZodArray<z.ZodString>;
|
|
699
|
+
coverage: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
700
|
+
status: z.ZodEnum<{
|
|
701
|
+
undecided: "undecided";
|
|
702
|
+
missing: "missing";
|
|
703
|
+
not_applicable: "not_applicable";
|
|
704
|
+
excluded: "excluded";
|
|
705
|
+
expressed: "expressed";
|
|
706
|
+
}>;
|
|
707
|
+
scenarioIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
708
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
709
|
+
basis: z.ZodDefault<z.ZodEnum<{
|
|
710
|
+
derived: "derived";
|
|
711
|
+
declared: "declared";
|
|
712
|
+
}>>;
|
|
713
|
+
}, z.core.$strict>>;
|
|
714
|
+
}, z.core.$strict>>;
|
|
715
|
+
source: z.ZodOptional<z.ZodString>;
|
|
716
|
+
}, z.core.$strict>;
|
|
697
717
|
export declare const FreeReaction: z.ZodObject<{
|
|
698
718
|
action: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
699
719
|
type: z.ZodLiteral<"click">;
|
|
@@ -783,7 +803,8 @@ export declare const FreeReaction: z.ZodObject<{
|
|
|
783
803
|
}, z.core.$strict>], "type">>>;
|
|
784
804
|
source: z.ZodOptional<z.ZodString>;
|
|
785
805
|
}, z.core.$strict>;
|
|
786
|
-
export declare const
|
|
806
|
+
export declare const Work: z.ZodObject<{
|
|
807
|
+
sequencing: z.ZodOptional<z.ZodLiteral<"linear">>;
|
|
787
808
|
free: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
788
809
|
action: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
789
810
|
type: z.ZodLiteral<"click">;
|
|
@@ -874,28 +895,19 @@ export declare const Option: z.ZodObject<{
|
|
|
874
895
|
source: z.ZodOptional<z.ZodString>;
|
|
875
896
|
}, z.core.$strict>>>;
|
|
876
897
|
id: z.ZodString;
|
|
877
|
-
featureId: z.ZodString
|
|
898
|
+
featureId: z.ZodOptional<z.ZodString>;
|
|
878
899
|
key: z.ZodString;
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
missing: "missing";
|
|
888
|
-
not_applicable: "not_applicable";
|
|
889
|
-
excluded: "excluded";
|
|
890
|
-
expressed: "expressed";
|
|
891
|
-
}>;
|
|
892
|
-
scenarioIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
893
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
894
|
-
basis: z.ZodDefault<z.ZodEnum<{
|
|
895
|
-
derived: "derived";
|
|
896
|
-
declared: "declared";
|
|
897
|
-
}>>;
|
|
900
|
+
title: z.ZodString;
|
|
901
|
+
summary: z.ZodString;
|
|
902
|
+
audience: z.ZodOptional<z.ZodString>;
|
|
903
|
+
roles: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
904
|
+
id: z.ZodOptional<z.ZodString>;
|
|
905
|
+
name: z.ZodString;
|
|
906
|
+
desc: z.ZodDefault<z.ZodString>;
|
|
907
|
+
color: z.ZodString;
|
|
898
908
|
}, z.core.$strict>>>;
|
|
909
|
+
draft: z.ZodOptional<z.ZodLiteral<true>>;
|
|
910
|
+
routes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
899
911
|
layers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
900
912
|
title: z.ZodString;
|
|
901
913
|
sceneId: z.ZodString;
|
|
@@ -922,7 +934,7 @@ export declare const RULE_CONFIRMATIONS: readonly ["pending", "confirmed", "conf
|
|
|
922
934
|
export declare const Rule: z.ZodObject<{
|
|
923
935
|
id: z.ZodString;
|
|
924
936
|
featureId: z.ZodString;
|
|
925
|
-
|
|
937
|
+
workId: z.ZodOptional<z.ZodString>;
|
|
926
938
|
text: z.ZodString;
|
|
927
939
|
origin: z.ZodEnum<{
|
|
928
940
|
user: "user";
|
|
@@ -945,7 +957,7 @@ export declare const Rule: z.ZodObject<{
|
|
|
945
957
|
export declare const Issue: z.ZodObject<{
|
|
946
958
|
id: z.ZodString;
|
|
947
959
|
featureId: z.ZodString;
|
|
948
|
-
|
|
960
|
+
workId: z.ZodOptional<z.ZodString>;
|
|
949
961
|
text: z.ZodString;
|
|
950
962
|
severity: z.ZodDefault<z.ZodEnum<{
|
|
951
963
|
blocker: "blocker";
|
|
@@ -998,7 +1010,7 @@ export declare const AudioRegionSchema: z.ZodObject<{
|
|
|
998
1010
|
channels: z.ZodNumber;
|
|
999
1011
|
}, z.core.$strict>;
|
|
1000
1012
|
export declare const Project: z.ZodObject<{
|
|
1001
|
-
schemaVersion: z.ZodLiteral<
|
|
1013
|
+
schemaVersion: z.ZodLiteral<3>;
|
|
1002
1014
|
name: z.ZodString;
|
|
1003
1015
|
description: z.ZodDefault<z.ZodString>;
|
|
1004
1016
|
theme: z.ZodDefault<z.ZodString>;
|
|
@@ -1084,6 +1096,15 @@ export declare const Project: z.ZodObject<{
|
|
|
1084
1096
|
title: z.ZodString;
|
|
1085
1097
|
version: z.ZodOptional<z.ZodString>;
|
|
1086
1098
|
components: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1099
|
+
label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
1100
|
+
inspect: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1101
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
1102
|
+
props: z.ZodArray<z.ZodString>;
|
|
1103
|
+
join: z.ZodOptional<z.ZodString>;
|
|
1104
|
+
values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>>;
|
|
1105
|
+
flags: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>>;
|
|
1106
|
+
fallback: z.ZodOptional<z.ZodString>;
|
|
1107
|
+
}, z.core.$strict>>>;
|
|
1087
1108
|
interactive: z.ZodOptional<z.ZodBoolean>;
|
|
1088
1109
|
parent: z.ZodOptional<z.ZodString>;
|
|
1089
1110
|
needsId: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1121,11 +1142,30 @@ export declare const Project: z.ZodObject<{
|
|
|
1121
1142
|
hard: z.ZodDefault<z.ZodBoolean>;
|
|
1122
1143
|
}, z.core.$strict>>>;
|
|
1123
1144
|
caseIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1124
|
-
|
|
1145
|
+
workIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1125
1146
|
pick: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1147
|
+
alternatives: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1148
|
+
decisionFocus: z.ZodString;
|
|
1149
|
+
tradeoffs: z.ZodArray<z.ZodString>;
|
|
1150
|
+
coverage: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1151
|
+
status: z.ZodEnum<{
|
|
1152
|
+
undecided: "undecided";
|
|
1153
|
+
missing: "missing";
|
|
1154
|
+
not_applicable: "not_applicable";
|
|
1155
|
+
excluded: "excluded";
|
|
1156
|
+
expressed: "expressed";
|
|
1157
|
+
}>;
|
|
1158
|
+
scenarioIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1159
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
1160
|
+
basis: z.ZodDefault<z.ZodEnum<{
|
|
1161
|
+
derived: "derived";
|
|
1162
|
+
declared: "declared";
|
|
1163
|
+
}>>;
|
|
1164
|
+
}, z.core.$strict>>;
|
|
1165
|
+
}, z.core.$strict>>;
|
|
1126
1166
|
source: z.ZodOptional<z.ZodString>;
|
|
1127
1167
|
}, z.core.$strict>>>;
|
|
1128
|
-
|
|
1168
|
+
entryIds: z.ZodArray<z.ZodString>;
|
|
1129
1169
|
cases: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1130
1170
|
id: z.ZodString;
|
|
1131
1171
|
featureId: z.ZodString;
|
|
@@ -1148,7 +1188,8 @@ export declare const Project: z.ZodObject<{
|
|
|
1148
1188
|
}>>;
|
|
1149
1189
|
source: z.ZodOptional<z.ZodString>;
|
|
1150
1190
|
}, z.core.$strict>>>;
|
|
1151
|
-
|
|
1191
|
+
works: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1192
|
+
sequencing: z.ZodOptional<z.ZodLiteral<"linear">>;
|
|
1152
1193
|
free: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1153
1194
|
action: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1154
1195
|
type: z.ZodLiteral<"click">;
|
|
@@ -1239,28 +1280,19 @@ export declare const Project: z.ZodObject<{
|
|
|
1239
1280
|
source: z.ZodOptional<z.ZodString>;
|
|
1240
1281
|
}, z.core.$strict>>>;
|
|
1241
1282
|
id: z.ZodString;
|
|
1242
|
-
featureId: z.ZodString
|
|
1283
|
+
featureId: z.ZodOptional<z.ZodString>;
|
|
1243
1284
|
key: z.ZodString;
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
missing: "missing";
|
|
1253
|
-
not_applicable: "not_applicable";
|
|
1254
|
-
excluded: "excluded";
|
|
1255
|
-
expressed: "expressed";
|
|
1256
|
-
}>;
|
|
1257
|
-
scenarioIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1258
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
1259
|
-
basis: z.ZodDefault<z.ZodEnum<{
|
|
1260
|
-
derived: "derived";
|
|
1261
|
-
declared: "declared";
|
|
1262
|
-
}>>;
|
|
1285
|
+
title: z.ZodString;
|
|
1286
|
+
summary: z.ZodString;
|
|
1287
|
+
audience: z.ZodOptional<z.ZodString>;
|
|
1288
|
+
roles: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1289
|
+
id: z.ZodOptional<z.ZodString>;
|
|
1290
|
+
name: z.ZodString;
|
|
1291
|
+
desc: z.ZodDefault<z.ZodString>;
|
|
1292
|
+
color: z.ZodString;
|
|
1263
1293
|
}, z.core.$strict>>>;
|
|
1294
|
+
draft: z.ZodOptional<z.ZodLiteral<true>>;
|
|
1295
|
+
routes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1264
1296
|
layers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1265
1297
|
title: z.ZodString;
|
|
1266
1298
|
sceneId: z.ZodString;
|
|
@@ -1285,7 +1317,7 @@ export declare const Project: z.ZodObject<{
|
|
|
1285
1317
|
rules: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1286
1318
|
id: z.ZodString;
|
|
1287
1319
|
featureId: z.ZodString;
|
|
1288
|
-
|
|
1320
|
+
workId: z.ZodOptional<z.ZodString>;
|
|
1289
1321
|
text: z.ZodString;
|
|
1290
1322
|
origin: z.ZodEnum<{
|
|
1291
1323
|
user: "user";
|
|
@@ -1306,7 +1338,7 @@ export declare const Project: z.ZodObject<{
|
|
|
1306
1338
|
}, z.core.$strict>>>;
|
|
1307
1339
|
scenes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1308
1340
|
id: z.ZodString;
|
|
1309
|
-
|
|
1341
|
+
workId: z.ZodNullable<z.ZodString>;
|
|
1310
1342
|
route: z.ZodString;
|
|
1311
1343
|
name: z.ZodString;
|
|
1312
1344
|
viewport: z.ZodDefault<z.ZodEnum<{
|
|
@@ -1335,7 +1367,7 @@ export declare const Project: z.ZodObject<{
|
|
|
1335
1367
|
}, z.core.$strict>>>;
|
|
1336
1368
|
ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
1337
1369
|
id: z.ZodString;
|
|
1338
|
-
|
|
1370
|
+
workId: z.ZodString;
|
|
1339
1371
|
name: z.ZodString;
|
|
1340
1372
|
description: z.ZodDefault<z.ZodString>;
|
|
1341
1373
|
caseIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -1536,7 +1568,7 @@ export declare const Project: z.ZodObject<{
|
|
|
1536
1568
|
issues: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1537
1569
|
id: z.ZodString;
|
|
1538
1570
|
featureId: z.ZodString;
|
|
1539
|
-
|
|
1571
|
+
workId: z.ZodOptional<z.ZodString>;
|
|
1540
1572
|
text: z.ZodString;
|
|
1541
1573
|
severity: z.ZodDefault<z.ZodEnum<{
|
|
1542
1574
|
blocker: "blocker";
|
|
@@ -1551,7 +1583,7 @@ export type Project = z.infer<typeof Project>;
|
|
|
1551
1583
|
export type Route = z.infer<typeof Route>;
|
|
1552
1584
|
export type Feature = z.infer<typeof Feature>;
|
|
1553
1585
|
export type Case = z.infer<typeof Case>;
|
|
1554
|
-
export type
|
|
1586
|
+
export type Work = z.infer<typeof Work>;
|
|
1555
1587
|
export type Coverage = z.infer<typeof Coverage>;
|
|
1556
1588
|
export type Rule = z.infer<typeof Rule>;
|
|
1557
1589
|
export type Issue = z.infer<typeof Issue>;
|
package/dist/schema.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ElementTraitsSchema } from "./traits.js";
|
|
1
|
+
import { ElementTraitsSchema, PluginInspectFieldSchema, PluginTextSchema } from "./traits.js";
|
|
2
2
|
/**
|
|
3
|
-
* Joplo IR(schemaVersion
|
|
3
|
+
* Joplo IR(schemaVersion 3):由 TSX 源文件编译得到的中间表示,不是作者直接编辑的格式。
|
|
4
4
|
* 权威源是项目文件夹里的 TSX/TS 文件(ADR-0002);渲染器、播放器、校验器、构建只消费这里的 IR。
|
|
5
5
|
*
|
|
6
6
|
* 带 `source` 的对象记录其来源 `相对路径:行:列`,用于选中元素、诊断定位,让 Agent 只读写那一处。
|
|
@@ -16,7 +16,7 @@ const ScopeRule = z.lazy(() => z.strictObject({
|
|
|
16
16
|
}));
|
|
17
17
|
const SlotSpec = z.strictObject({ text: z.array(DataPath).optional(), scope: z.union([z.literal('global'), z.array(ScopeRule)]).optional() });
|
|
18
18
|
const DataSpec = z.strictObject({ node: SlotSpec.optional(), step: SlotSpec.optional() });
|
|
19
|
-
export const SCHEMA_VERSION =
|
|
19
|
+
export const SCHEMA_VERSION = 3;
|
|
20
20
|
/** 作者可写的 ID(对象键、元素 id)。 */
|
|
21
21
|
export const Id = z.string().regex(/^[A-Za-z][A-Za-z0-9_-]{0,63}$/, 'ID must start with a letter and contain only letters, digits, underscores, and hyphens');
|
|
22
22
|
/** 编译器生成的限定 ID,例如 `invite.happy`、`invite.a-modal@/members`。 */
|
|
@@ -58,7 +58,7 @@ export const SceneNode = z.lazy(() => z.strictObject({
|
|
|
58
58
|
export const Scene = z.strictObject({
|
|
59
59
|
id: Qid,
|
|
60
60
|
/** 方案上下文;`null` 表示发布视图(所有功能都取选定方案)。 */
|
|
61
|
-
|
|
61
|
+
workId: Qid.nullable(),
|
|
62
62
|
route: z.string().regex(/^\/[^\s]*$/),
|
|
63
63
|
name: z.string().min(1),
|
|
64
64
|
viewport: z.enum(['desktop', 'mobile']).default('desktop'),
|
|
@@ -173,7 +173,7 @@ export const Scenario = z.strictObject({
|
|
|
173
173
|
media: MediaSnapshot.optional(),
|
|
174
174
|
ext: z.record(z.string(), Json).optional(),
|
|
175
175
|
id: Qid,
|
|
176
|
-
|
|
176
|
+
workId: Qid,
|
|
177
177
|
name: z.string().min(1),
|
|
178
178
|
description: z.string().default(''),
|
|
179
179
|
caseIds: z.array(Qid).default([]),
|
|
@@ -202,19 +202,6 @@ export const Route = z.strictObject({
|
|
|
202
202
|
slots: z.array(z.string()).default([]),
|
|
203
203
|
source: Source,
|
|
204
204
|
});
|
|
205
|
-
export const Feature = z.strictObject({
|
|
206
|
-
id: Id,
|
|
207
|
-
name: z.string().min(1),
|
|
208
|
-
goal: z.string().min(1),
|
|
209
|
-
/** 角色(D56):id 来自 { 键: role('名字') } 写法,可被层级和过渡卡引用;旧的名字数组没有 id。color 已按顺序补齐。 */
|
|
210
|
-
roles: z.array(z.strictObject({ id: Id.optional(), name: z.string().min(1), desc: z.string().default(''), color: z.string().min(1) })).default([]),
|
|
211
|
-
constraints: z.array(z.strictObject({ id: Id, text: z.string().min(1), hard: z.boolean().default(false) })).default([]),
|
|
212
|
-
caseIds: z.array(Qid).default([]),
|
|
213
|
-
optionIds: z.array(Qid).default([]),
|
|
214
|
-
/** 选定的方案;build 只发布它。 */
|
|
215
|
-
pick: Qid.nullable().default(null),
|
|
216
|
-
source: Source,
|
|
217
|
-
});
|
|
218
205
|
export const Case = z.strictObject({
|
|
219
206
|
id: Qid,
|
|
220
207
|
featureId: Id,
|
|
@@ -232,20 +219,46 @@ export const Coverage = z.strictObject({
|
|
|
232
219
|
/** derived = 编译器根据场景推导;declared = 作者在源文件中声明。 */
|
|
233
220
|
basis: z.enum(['derived', 'declared']).default('declared'),
|
|
234
221
|
});
|
|
222
|
+
/** 功能是作品之上的评审层;评审信息按作品 id 存放。 */
|
|
223
|
+
export const Feature = z.strictObject({
|
|
224
|
+
id: Id,
|
|
225
|
+
name: z.string().min(1),
|
|
226
|
+
goal: z.string().min(1),
|
|
227
|
+
/** 角色(D56):id 来自 { 键: role('名字') } 写法,可被层级和过渡卡引用;旧的名字数组没有 id。color 已按顺序补齐。 */
|
|
228
|
+
roles: z.array(z.strictObject({ id: Id.optional(), name: z.string().min(1), desc: z.string().default(''), color: z.string().min(1) })).default([]),
|
|
229
|
+
constraints: z.array(z.strictObject({ id: Id, text: z.string().min(1), hard: z.boolean().default(false) })).default([]),
|
|
230
|
+
caseIds: z.array(Qid).default([]),
|
|
231
|
+
workIds: z.array(Qid).default([]),
|
|
232
|
+
/** 选定的方案;build 只发布它。 */
|
|
233
|
+
pick: Qid.nullable().default(null),
|
|
234
|
+
alternatives: z.record(Qid, z.strictObject({
|
|
235
|
+
decisionFocus: z.string(),
|
|
236
|
+
tradeoffs: z.array(z.string()),
|
|
237
|
+
coverage: z.record(Qid, Coverage),
|
|
238
|
+
})),
|
|
239
|
+
source: Source,
|
|
240
|
+
}).superRefine((f, ctx) => {
|
|
241
|
+
const keys = Object.keys(f.alternatives);
|
|
242
|
+
if (new Set(f.workIds).size !== f.workIds.length || keys.length !== f.workIds.length || keys.some(id => !f.workIds.includes(id)))
|
|
243
|
+
ctx.addIssue({ code: 'custom', path: ['alternatives'], message: 'alternatives must list every workId exactly once' });
|
|
244
|
+
});
|
|
235
245
|
export const FreeReaction = z.strictObject({ action: Action, effects: z.array(Effect).default([]), source: Source });
|
|
236
|
-
export const
|
|
246
|
+
export const Work = z.strictObject({
|
|
247
|
+
/** 共享切片解析器在全部切片使用 chapter() 时写入;Entry.sequencing 消费,公开保留;缺省 independent。 */
|
|
248
|
+
sequencing: z.literal('linear').optional(),
|
|
237
249
|
free: z.record(Id, FreeReaction).optional(),
|
|
238
250
|
id: Qid,
|
|
239
|
-
featureId: Id,
|
|
251
|
+
featureId: Id.optional(),
|
|
240
252
|
/** 文件名,例如 `a-modal`。 */
|
|
241
253
|
key: Id,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
254
|
+
title: z.string().min(1),
|
|
255
|
+
summary: z.string().min(1),
|
|
256
|
+
audience: z.string().min(1).optional(),
|
|
257
|
+
/** 独立作品声明角色;功能下面的作品保持为空,通过 rolesOf 继承功能角色。 */
|
|
258
|
+
roles: Feature.shape.roles,
|
|
259
|
+
draft: z.literal(true).optional(),
|
|
246
260
|
/** 该方案触及的路径(堆叠或新增)。 */
|
|
247
261
|
routes: z.array(z.string()).default([]),
|
|
248
|
-
coverage: z.record(Qid, Coverage).default({}),
|
|
249
262
|
/** 层级(视角):键 → 标题与这一层自己的画面(完全独立的页面)。演示信息,发布站保留。 */
|
|
250
263
|
/** icon:作者显式选的预设图标(层级标签用);不写时由 layersOf 按视口补默认。 */
|
|
251
264
|
layers: z.record(Id, z.strictObject({ title: z.string().min(1), sceneId: Qid, role: Id.optional(), icon: z.enum(LAYER_ICONS).optional() })).default({}),
|
|
@@ -256,7 +269,7 @@ export const RULE_CONFIRMATIONS = ['pending', 'confirmed', 'conflict', 'out_of_s
|
|
|
256
269
|
export const Rule = z.strictObject({
|
|
257
270
|
id: Qid,
|
|
258
271
|
featureId: Id,
|
|
259
|
-
|
|
272
|
+
workId: Qid.optional(),
|
|
260
273
|
text: z.string().min(1),
|
|
261
274
|
origin: z.enum(RULE_ORIGINS),
|
|
262
275
|
confirmation: z.enum(RULE_CONFIRMATIONS).default('pending'),
|
|
@@ -269,7 +282,7 @@ export const Rule = z.strictObject({
|
|
|
269
282
|
export const Issue = z.strictObject({
|
|
270
283
|
id: Qid,
|
|
271
284
|
featureId: Id,
|
|
272
|
-
|
|
285
|
+
workId: Qid.optional(),
|
|
273
286
|
text: z.string().min(1),
|
|
274
287
|
severity: z.enum(['blocker', 'major', 'minor']).default('major'),
|
|
275
288
|
refs: z.array(z.string()).default([]),
|
|
@@ -333,7 +346,7 @@ export const Project = z.strictObject({
|
|
|
333
346
|
id: z.string().min(1),
|
|
334
347
|
title: z.string(),
|
|
335
348
|
version: z.string().optional(),
|
|
336
|
-
components: z.record(z.string(), z.strictObject({ interactive: z.boolean().optional(), parent: z.string().optional(), needsId: z.boolean().optional(), selfEvident: z.boolean().optional(), traits: ElementTraitsSchema.optional() })),
|
|
349
|
+
components: z.record(z.string(), z.strictObject({ label: PluginTextSchema.optional(), inspect: z.array(PluginInspectFieldSchema).optional(), interactive: z.boolean().optional(), parent: z.string().optional(), needsId: z.boolean().optional(), selfEvident: z.boolean().optional(), traits: ElementTraitsSchema.optional() })),
|
|
337
350
|
})).optional(),
|
|
338
351
|
/** 作者主题(D51):主题名 → CSS 原文(themes/<name>.css);渲染时自动限定在舞台范围内。发布站同样打包。 */
|
|
339
352
|
themes: z.record(z.string(), z.string()).default({}),
|
|
@@ -341,18 +354,17 @@ export const Project = z.strictObject({
|
|
|
341
354
|
mode: z.enum(['dev', 'publish', 'review']),
|
|
342
355
|
routes: z.record(z.string(), Route).default({}),
|
|
343
356
|
features: z.record(Id, Feature).default({}),
|
|
344
|
-
/**
|
|
345
|
-
|
|
357
|
+
/** 编译器决定的条目顺序,发布时保留;每个条目恰好一次。 */
|
|
358
|
+
entryIds: z.array(Id),
|
|
346
359
|
cases: z.record(Qid, Case).default({}),
|
|
347
|
-
|
|
360
|
+
works: z.record(Qid, Work).default({}),
|
|
348
361
|
rules: z.record(Qid, Rule).default({}),
|
|
349
362
|
scenes: z.record(Qid, Scene).default({}),
|
|
350
363
|
scenarios: z.record(Qid, Scenario).default({}),
|
|
351
364
|
issues: z.record(Qid, Issue).default({}),
|
|
352
365
|
}).superRefine((p, ctx) => {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
ctx.addIssue({ code: 'custom', path: ['featureIds'], message: 'featureIds must list every feature exactly once' });
|
|
366
|
+
const entries = [...Object.keys(p.features), ...Object.values(p.works).filter(w => !w.featureId).map(w => w.id)];
|
|
367
|
+
const ids = new Set(p.entryIds);
|
|
368
|
+
if (ids.size !== p.entryIds.length || ids.size !== entries.length || entries.some(id => !ids.has(id)))
|
|
369
|
+
ctx.addIssue({ code: 'custom', path: ['entryIds'], message: 'entryIds must list every entry exactly once' });
|
|
358
370
|
});
|
package/dist/scope.d.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import type { Project, Step } from './schema.js';
|
|
2
|
-
/** 作者要分享的范围:场景 id
|
|
2
|
+
/** 作者要分享的范围:场景 id 与首页条目 id(功能取选定作品;评审版取全部作品;独立作品取自身)。 */
|
|
3
3
|
export type ScopeRequest = {
|
|
4
4
|
scenarios?: readonly string[];
|
|
5
|
-
|
|
5
|
+
entryIds?: readonly string[];
|
|
6
6
|
};
|
|
7
7
|
/** publish = 只发布选定方案;review = 评审版(全部方案)。 */
|
|
8
8
|
export type ScopeMode = 'publish' | 'review';
|
|
9
9
|
/** 因为被范围内步骤引用而带上的别的功能的内容(只给作者看:终端输出、看板浮层,不进分享)。 */
|
|
10
10
|
export type ScopeBorrowed = {
|
|
11
11
|
kind: 'element';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
entryId: string;
|
|
13
|
+
entryTitle: string;
|
|
14
|
+
workId: string;
|
|
15
15
|
elementId: string;
|
|
16
16
|
route: string;
|
|
17
17
|
refs: string[];
|
|
18
18
|
scenarios: string[];
|
|
19
19
|
} | {
|
|
20
20
|
kind: 'page';
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
entryId: string;
|
|
22
|
+
entryTitle: string;
|
|
23
|
+
workId: string;
|
|
24
24
|
route: string;
|
|
25
25
|
scenarios: string[];
|
|
26
26
|
};
|
|
@@ -28,7 +28,7 @@ export type ScopeInfo = {
|
|
|
28
28
|
/** `.joplo/cloud.json` 里这个范围的键:排序后的场景 id,用逗号连接;评审版前缀 `review:`。 */
|
|
29
29
|
key: string;
|
|
30
30
|
scenarios: string[];
|
|
31
|
-
|
|
31
|
+
entryIds: string[];
|
|
32
32
|
borrowed: ScopeBorrowed[];
|
|
33
33
|
};
|
|
34
34
|
export declare const hasScope: (r: ScopeRequest | undefined) => r is ScopeRequest;
|