@kubohiroya/turbowarp-bubble 0.12.0 → 0.13.1

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.
@@ -751,6 +751,529 @@
751
751
  }
752
752
  }
753
753
  };
754
+ var block_editor_fixed_inputs_schema_default$1 = {
755
+ $schema: "http://json-schema.org/draft-07/schema#",
756
+ $id: "https://kubohiroya.github.io/turbowarp-bubble/schemas/block-editor-fixed-inputs.schema.json",
757
+ title: "turbowarp-bubble fixed editing contracts",
758
+ $defs: {
759
+ "defineBubbleClosePolicy": {
760
+ "type": "object",
761
+ "properties": {
762
+ "TRIGGER": {
763
+ "type": "string",
764
+ "enum": [
765
+ "condition",
766
+ "timeout",
767
+ "condition-or-timeout"
768
+ ]
769
+ },
770
+ "TIMEOUT": {
771
+ "type": "number",
772
+ "exclusiveMinimum": 0
773
+ }
774
+ },
775
+ "additionalProperties": false
776
+ },
777
+ "setPortraitLayout": {
778
+ "type": "object",
779
+ "properties": {
780
+ "PLACEMENT": {
781
+ "type": "string",
782
+ "enum": [
783
+ "none",
784
+ "left",
785
+ "right",
786
+ "top-left",
787
+ "top-right",
788
+ "bottom-left",
789
+ "bottom-right"
790
+ ]
791
+ },
792
+ "X": { "type": "number" },
793
+ "Y": { "type": "number" },
794
+ "ZOOM": {
795
+ "type": "number",
796
+ "exclusiveMinimum": 0
797
+ },
798
+ "RADIUS": {
799
+ "type": "number",
800
+ "minimum": 0
801
+ }
802
+ },
803
+ "additionalProperties": false
804
+ },
805
+ "setBubbleDistance": {
806
+ "type": "object",
807
+ "properties": { "DISTANCE": {
808
+ "type": "number",
809
+ "minimum": 0
810
+ } },
811
+ "additionalProperties": false
812
+ },
813
+ "setBubbleVisualStyle": {
814
+ "type": "object",
815
+ "properties": { "VISUAL_STYLE": {
816
+ "type": "string",
817
+ "enum": [
818
+ "NORMAL",
819
+ "THINKING",
820
+ "DREAMING",
821
+ "YELLING",
822
+ "OFF_PANEL",
823
+ "WAVY",
824
+ "WHISPERING",
825
+ "ANNOUNCEMENT",
826
+ "NARRATION",
827
+ "NO_BUBBLE"
828
+ ]
829
+ } },
830
+ "additionalProperties": false
831
+ },
832
+ "setBubbleTailLength": {
833
+ "type": "object",
834
+ "properties": { "LENGTH": {
835
+ "type": "number",
836
+ "exclusiveMinimum": 0
837
+ } },
838
+ "additionalProperties": false
839
+ },
840
+ "setBubbleOffset": {
841
+ "type": "object",
842
+ "properties": {
843
+ "X": { "type": "number" },
844
+ "Y": { "type": "number" },
845
+ "SCALE": {
846
+ "type": "number",
847
+ "exclusiveMinimum": 0
848
+ }
849
+ },
850
+ "additionalProperties": false
851
+ },
852
+ "setBlinkFrames": {
853
+ "type": "object",
854
+ "properties": { "SECONDS": {
855
+ "type": "number",
856
+ "exclusiveMinimum": 0
857
+ } },
858
+ "additionalProperties": false
859
+ },
860
+ "setLipSyncFrames": {
861
+ "type": "object",
862
+ "properties": { "SECONDS": {
863
+ "type": "number",
864
+ "exclusiveMinimum": 0
865
+ } },
866
+ "additionalProperties": false
867
+ },
868
+ "setContinueFrames": {
869
+ "type": "object",
870
+ "properties": { "SECONDS": {
871
+ "type": "number",
872
+ "exclusiveMinimum": 0
873
+ } },
874
+ "additionalProperties": false
875
+ },
876
+ "setBubbleReveal": {
877
+ "type": "object",
878
+ "properties": {
879
+ "UNIT": {
880
+ "type": "string",
881
+ "enum": [
882
+ "CHARACTER",
883
+ "WORD",
884
+ "LINE",
885
+ "BLOCK"
886
+ ]
887
+ },
888
+ "SECONDS": {
889
+ "type": "number",
890
+ "minimum": 0
891
+ },
892
+ "LAYOUT": {
893
+ "type": "string",
894
+ "enum": ["DYNAMIC", "RESERVED"]
895
+ }
896
+ },
897
+ "additionalProperties": false
898
+ },
899
+ "setBubbleWordDelimiters": {
900
+ "type": "object",
901
+ "properties": { "SHOW": {
902
+ "type": "string",
903
+ "enum": ["false", "true"]
904
+ } },
905
+ "additionalProperties": false
906
+ },
907
+ "finishBubbleReveal": {
908
+ "type": "object",
909
+ "properties": {
910
+ "UNIT": {
911
+ "type": "string",
912
+ "enum": [
913
+ "CHARACTER",
914
+ "WORD",
915
+ "LINE",
916
+ "BLOCK"
917
+ ]
918
+ },
919
+ "TIMEOUT": {
920
+ "type": "number",
921
+ "minimum": 0
922
+ }
923
+ },
924
+ "additionalProperties": false
925
+ },
926
+ "setBubbleShowAnimation": {
927
+ "type": "object",
928
+ "properties": {
929
+ "MOTION": {
930
+ "type": "string",
931
+ "enum": [
932
+ "fadeIn",
933
+ "floatIn",
934
+ "zoomIn",
935
+ "riseUp"
936
+ ]
937
+ },
938
+ "SECONDS": {
939
+ "type": "number",
940
+ "minimum": 0
941
+ }
942
+ },
943
+ "additionalProperties": false
944
+ },
945
+ "setBubbleHideAnimation": {
946
+ "type": "object",
947
+ "properties": {
948
+ "MOTION": {
949
+ "type": "string",
950
+ "enum": [
951
+ "fadeOut",
952
+ "floatOut",
953
+ "zoomOut",
954
+ "sink"
955
+ ]
956
+ },
957
+ "SECONDS": {
958
+ "type": "number",
959
+ "minimum": 0
960
+ }
961
+ },
962
+ "additionalProperties": false
963
+ },
964
+ "animateBubble": {
965
+ "type": "object",
966
+ "properties": { "MOTION": {
967
+ "type": "string",
968
+ "enum": [
969
+ "fadeIn",
970
+ "floatIn",
971
+ "zoomIn",
972
+ "riseUp",
973
+ "fadeOut",
974
+ "floatOut",
975
+ "zoomOut",
976
+ "sink",
977
+ "shake",
978
+ "explode",
979
+ "animateBubbleShape"
980
+ ]
981
+ } },
982
+ "additionalProperties": false
983
+ },
984
+ "shakeBubble": {
985
+ "type": "object",
986
+ "properties": {
987
+ "DIRECTION": { "type": "number" },
988
+ "COUNT": {
989
+ "type": "integer",
990
+ "minimum": 1
991
+ },
992
+ "EASE": {
993
+ "type": "string",
994
+ "enum": [
995
+ "linear",
996
+ "easeIn",
997
+ "easeOut",
998
+ "easeInOut"
999
+ ]
1000
+ }
1001
+ },
1002
+ "additionalProperties": false
1003
+ },
1004
+ "explodeBubble": {
1005
+ "type": "object",
1006
+ "properties": {
1007
+ "SCALE": {
1008
+ "type": "number",
1009
+ "exclusiveMinimum": 0
1010
+ },
1011
+ "COUNT": {
1012
+ "type": "integer",
1013
+ "minimum": 1
1014
+ },
1015
+ "EASE": {
1016
+ "type": "string",
1017
+ "enum": [
1018
+ "linear",
1019
+ "easeIn",
1020
+ "easeOut",
1021
+ "easeInOut"
1022
+ ]
1023
+ }
1024
+ },
1025
+ "additionalProperties": false
1026
+ },
1027
+ "animateBubbleShape": {
1028
+ "type": "object",
1029
+ "properties": {
1030
+ "VISUAL_STYLE": {
1031
+ "type": "string",
1032
+ "enum": [
1033
+ "NORMAL",
1034
+ "THINKING",
1035
+ "DREAMING",
1036
+ "YELLING",
1037
+ "OFF_PANEL",
1038
+ "WAVY",
1039
+ "WHISPERING",
1040
+ "ANNOUNCEMENT",
1041
+ "NARRATION",
1042
+ "NO_BUBBLE"
1043
+ ]
1044
+ },
1045
+ "SPEED": {
1046
+ "type": "number",
1047
+ "minimum": 0
1048
+ },
1049
+ "SECONDS": {
1050
+ "type": "number",
1051
+ "minimum": 0
1052
+ }
1053
+ },
1054
+ "additionalProperties": false
1055
+ },
1056
+ "setBubbleAnimationMode": {
1057
+ "type": "object",
1058
+ "properties": { "MODE": {
1059
+ "type": "string",
1060
+ "enum": [
1061
+ "talking",
1062
+ "awaiting-continue",
1063
+ "idle"
1064
+ ]
1065
+ } },
1066
+ "additionalProperties": false
1067
+ },
1068
+ "waitForBubbleContinue": {
1069
+ "type": "object",
1070
+ "properties": { "TIMEOUT": {
1071
+ "type": "number",
1072
+ "minimum": 0
1073
+ } },
1074
+ "additionalProperties": false
1075
+ }
1076
+ }
1077
+ };
1078
+ //#endregion
1079
+ //#region src/fixed-input-editors.ts
1080
+ var contracts$1 = block_editor_fixed_inputs_schema_default$1.$defs;
1081
+ var repository$1 = "turbowarp-bubble";
1082
+ var canonicalSource$1 = {
1083
+ repository: repository$1,
1084
+ path: "schemas/block-editor-fixed-inputs.schema.json"
1085
+ };
1086
+ var contractRevision$1 = "fixed-inputs-v1";
1087
+ var numberToken$1 = /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$/u;
1088
+ /** New input only: never run this strict lexical policy over unmodified raw fields. */
1089
+ function fixedNumber$1(value) {
1090
+ if (typeof value === "number" && Number.isFinite(value)) return value;
1091
+ if (typeof value !== "string" || !numberToken$1.test(value.trim())) throw new TypeError("Invalid fixed number.");
1092
+ const number = Number(value);
1093
+ if (!Number.isFinite(number)) throw new TypeError("Invalid fixed number.");
1094
+ return number;
1095
+ }
1096
+ function existingNumber$1(value) {
1097
+ if (typeof value !== "string" && typeof value !== "number") throw new TypeError("Invalid numeric projection.");
1098
+ if (typeof value === "string" && value.trim() === "") throw new TypeError("Unprojected existing numeric field.");
1099
+ const number = Number(value);
1100
+ if (!Number.isFinite(number)) throw new TypeError("Invalid numeric projection.");
1101
+ return number;
1102
+ }
1103
+ function normalizeChoice$1(opcode, argument, value) {
1104
+ const trimmed = value.trim();
1105
+ if ([
1106
+ "VISUAL_STYLE",
1107
+ "UNIT",
1108
+ "LAYOUT"
1109
+ ].includes(argument)) return trimmed.toUpperCase();
1110
+ if ([
1111
+ "TRIGGER",
1112
+ "SHOW",
1113
+ "MODE",
1114
+ "PLACEMENT"
1115
+ ].includes(argument)) {
1116
+ const lowered = trimmed.toLowerCase();
1117
+ return opcode === "setPortraitLayout" ? lowered.replaceAll("_", "-") : lowered;
1118
+ }
1119
+ return trimmed;
1120
+ }
1121
+ function bundle$1(opcode, argument) {
1122
+ const source = {
1123
+ ...canonicalSource$1,
1124
+ symbol: `/$defs/${opcode}/properties/${argument}`
1125
+ };
1126
+ return {
1127
+ identity: {
1128
+ ownerId: repository$1,
1129
+ contractId: `${opcode}.${argument}`,
1130
+ revision: contractRevision$1,
1131
+ variantId: "fixed"
1132
+ },
1133
+ dialect: "draft-07",
1134
+ root: {
1135
+ retrievalUri: `${block_editor_fixed_inputs_schema_default$1.$id}?binding=${opcode}.${argument}`,
1136
+ document: contracts$1[opcode].properties[argument],
1137
+ artifact: {
1138
+ role: "canonical-schema",
1139
+ source
1140
+ }
1141
+ },
1142
+ resources: [],
1143
+ provenance: {
1144
+ canonicalSources: [
1145
+ source,
1146
+ {
1147
+ repository: repository$1,
1148
+ path: "src/block-definitions.json"
1149
+ },
1150
+ {
1151
+ repository: repository$1,
1152
+ path: "src/extension.ts",
1153
+ symbol: opcode
1154
+ }
1155
+ ],
1156
+ generatedFiles: [],
1157
+ referenceSchemas: [],
1158
+ generationSources: []
1159
+ }
1160
+ };
1161
+ }
1162
+ function fixedInputEditorOptions$1() {
1163
+ return Object.entries(contracts$1).map(([opcode, contract]) => {
1164
+ const bindings = Object.entries(contract.properties).map(([argument, schema]) => ({
1165
+ argument,
1166
+ schemaBundle: bundle$1(opcode, argument),
1167
+ control: schema.enum ? {
1168
+ kind: "enum",
1169
+ choices: schema.enum.map((value) => ({
1170
+ value,
1171
+ label: value
1172
+ }))
1173
+ } : { kind: schema.type === "number" || schema.type === "integer" ? "number" : "color" },
1174
+ read(value) {
1175
+ if (schema.type === "number" || schema.type === "integer") return existingNumber$1(value);
1176
+ if (typeof value !== "string") throw new TypeError("Invalid string projection.");
1177
+ return schema.enum ? normalizeChoice$1(opcode, argument, value) : value;
1178
+ },
1179
+ encode(value) {
1180
+ if (schema.type === "number" || schema.type === "integer") {
1181
+ fixedNumber$1(value);
1182
+ return typeof value === "number" ? Object.is(value, -0) ? "-0" : String(value) : value.trim();
1183
+ }
1184
+ if (typeof value !== "string") throw new TypeError("Invalid fixed string.");
1185
+ return value;
1186
+ },
1187
+ validateCandidate(candidate) {
1188
+ let valid;
1189
+ try {
1190
+ if (schema.type === "number" || schema.type === "integer") {
1191
+ const number = existingNumber$1(candidate);
1192
+ valid = (schema.type !== "integer" || Number.isInteger(number)) && (schema.minimum === void 0 || number >= schema.minimum) && (schema.maximum === void 0 || number <= schema.maximum) && (schema.exclusiveMinimum === void 0 || number > schema.exclusiveMinimum);
1193
+ } else valid = typeof candidate === "string" && (schema.enum ? schema.enum.includes(candidate) : new RegExp(schema.pattern, "u").test(candidate));
1194
+ } catch {
1195
+ valid = false;
1196
+ }
1197
+ return valid ? [] : [{
1198
+ path: argument,
1199
+ message: "Check this value before saving."
1200
+ }];
1201
+ }
1202
+ }));
1203
+ return {
1204
+ apiVersion: 1,
1205
+ extensionId: extensionConfig$1.id,
1206
+ editorId: `${extensionConfig$1.id}.fixed.${opcode}`,
1207
+ opcodes: [`${extensionConfig$1.id}_${opcode}`],
1208
+ contractId: `${repository$1}.${opcode}.fixed`,
1209
+ contractRevision: contractRevision$1,
1210
+ bindings,
1211
+ validationContext: () => ({
1212
+ consumerId: repository$1,
1213
+ nowMs: 0,
1214
+ settings: null
1215
+ }),
1216
+ ...opcode === "defineBubbleClosePolicy" ? {
1217
+ readOnlyArguments: ["CONDITION"],
1218
+ dependencies: [{
1219
+ selector: "TRIGGER",
1220
+ dependents: ["TIMEOUT"]
1221
+ }],
1222
+ branchPolicies: [{
1223
+ selector: "TRIGGER",
1224
+ normalize: {
1225
+ trim: true,
1226
+ lowercase: true
1227
+ },
1228
+ cases: [
1229
+ {
1230
+ values: ["condition"],
1231
+ activeDependents: [],
1232
+ requireOnSelectorChange: [{
1233
+ argument: "CONDITION",
1234
+ rule: "nonempty-string"
1235
+ }]
1236
+ },
1237
+ {
1238
+ values: ["timeout"],
1239
+ activeDependents: ["TIMEOUT"]
1240
+ },
1241
+ {
1242
+ values: ["condition-or-timeout"],
1243
+ activeDependents: ["TIMEOUT"],
1244
+ requireOnSelectorChange: [{
1245
+ argument: "CONDITION",
1246
+ rule: "nonempty-string"
1247
+ }]
1248
+ }
1249
+ ]
1250
+ }]
1251
+ } : {}
1252
+ };
1253
+ });
1254
+ }
1255
+ /** Optional GUI capability; ordinary runtime/composition consumers do not load the editor. */
1256
+ function registerFixedInputEditors$1(scratch, runtime) {
1257
+ const api = scratch.gui?.blockEditors;
1258
+ if (api?.apiVersion !== 1 || typeof api.registerFixedInputEditor !== "function") return void 0;
1259
+ const events = runtime;
1260
+ const removers = [];
1261
+ let active = true;
1262
+ const dispose = () => {
1263
+ if (!active) return;
1264
+ active = false;
1265
+ events.off?.("RUNTIME_DISPOSED", dispose);
1266
+ for (const remove of removers.splice(0).reverse()) remove();
1267
+ };
1268
+ try {
1269
+ for (const options of fixedInputEditorOptions$1()) removers.push(api.registerFixedInputEditor.call(api, options));
1270
+ events.on?.("RUNTIME_DISPOSED", dispose);
1271
+ } catch (error) {
1272
+ dispose();
1273
+ throw error;
1274
+ }
1275
+ return dispose;
1276
+ }
754
1277
  //#endregion
755
1278
  //#region src/placement.ts
756
1279
  var bubbleDirectionNames = [
@@ -9857,7 +10380,7 @@
9857
10380
  });
9858
10381
  }
9859
10382
  //#endregion
9860
- //#region node_modules/.pnpm/@kubohiroya+turbowarp-svg-text@0.10.0/node_modules/@kubohiroya/turbowarp-svg-text/dist/composition.js
10383
+ //#region node_modules/.pnpm/@kubohiroya+turbowarp-svg-text@0.10.1/node_modules/@kubohiroya/turbowarp-svg-text/dist/composition.js
9861
10384
  var block_definitions_default = {
9862
10385
  extensionName: "SVG Text",
9863
10386
  blocks: [{
@@ -9917,6 +10440,37 @@
9917
10440
  ]
9918
10441
  } }
9919
10442
  };
10443
+ var block_editor_fixed_inputs_schema_default = {
10444
+ $schema: "http://json-schema.org/draft-07/schema#",
10445
+ $id: "https://kubohiroya.github.io/turbowarp-svg-text/schemas/block-editor-fixed-inputs.schema.json",
10446
+ title: "turbowarp-svg-text fixed editing contracts",
10447
+ $defs: { "defineStyle": {
10448
+ "type": "object",
10449
+ "properties": {
10450
+ "BACKGROUND": {
10451
+ "type": "string",
10452
+ "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$",
10453
+ "description": "New native colour_picker candidate only. Common host commit485f0e550e622235624b5e9176820161aeeba252 src/turbowarp/fixed-fields.js restricts new candidates to 3/6-digit hex; the existing runtime also accepts #4/#8, transparent and CSS colours."
10454
+ },
10455
+ "TEXT_COLOR": {
10456
+ "type": "string",
10457
+ "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$",
10458
+ "description": "New native colour_picker candidate only. Common host commit485f0e550e622235624b5e9176820161aeeba252 src/turbowarp/fixed-fields.js restricts new candidates to 3/6-digit hex; the existing runtime also accepts #4/#8, transparent and CSS colours."
10459
+ },
10460
+ "SIZE": { "type": "number" },
10461
+ "ALIGN": {
10462
+ "type": "string",
10463
+ "enum": [
10464
+ "left",
10465
+ "center",
10466
+ "right"
10467
+ ]
10468
+ }
10469
+ },
10470
+ "additionalProperties": false
10471
+ } },
10472
+ description: "Fixed editing contract for changed standard native fields, not the complete runtime input domain. Colour candidates intersect the common host #RGB/#RRGGBB allowlist with owner validity; existing broader colour raw values are retained unchanged."
10473
+ };
9920
10474
  var extensionConfig = {
9921
10475
  id: "kubohiroyasvgtext",
9922
10476
  slug: "svg-text",
@@ -9926,6 +10480,164 @@
9926
10480
  license: "MPL-2.0",
9927
10481
  unsandboxed: true
9928
10482
  };
10483
+ var contracts = block_editor_fixed_inputs_schema_default.$defs;
10484
+ var repository = "turbowarp-svg-text";
10485
+ var canonicalSource = {
10486
+ repository,
10487
+ path: "schemas/block-editor-fixed-inputs.schema.json"
10488
+ };
10489
+ var contractRevision = "fixed-inputs-v1";
10490
+ var numberToken = /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$/u;
10491
+ /** New input only: never run this strict lexical policy over unmodified raw fields. */
10492
+ function fixedNumber(value) {
10493
+ if (typeof value === "number" && Number.isFinite(value)) return value;
10494
+ if (typeof value !== "string" || !numberToken.test(value.trim())) throw new TypeError("Invalid fixed number.");
10495
+ const number = Number(value);
10496
+ if (!Number.isFinite(number)) throw new TypeError("Invalid fixed number.");
10497
+ return number;
10498
+ }
10499
+ function existingNumber(value) {
10500
+ if (typeof value !== "string" && typeof value !== "number") throw new TypeError("Invalid numeric projection.");
10501
+ if (typeof value === "string" && value.trim() === "") throw new TypeError("Unprojected existing numeric field.");
10502
+ const number = Number(value);
10503
+ if (!Number.isFinite(number)) throw new TypeError("Invalid numeric projection.");
10504
+ return number;
10505
+ }
10506
+ function normalizeChoice(opcode, argument, value) {
10507
+ return value.trim().toLowerCase();
10508
+ }
10509
+ function bundle(opcode, argument) {
10510
+ const source = {
10511
+ ...canonicalSource,
10512
+ symbol: `/$defs/${opcode}/properties/${argument}`
10513
+ };
10514
+ return {
10515
+ identity: {
10516
+ ownerId: repository,
10517
+ contractId: `${opcode}.${argument}`,
10518
+ revision: contractRevision,
10519
+ variantId: "fixed"
10520
+ },
10521
+ dialect: "draft-07",
10522
+ root: {
10523
+ retrievalUri: `${block_editor_fixed_inputs_schema_default.$id}?binding=${opcode}.${argument}`,
10524
+ document: contracts[opcode].properties[argument],
10525
+ artifact: {
10526
+ role: "canonical-schema",
10527
+ source
10528
+ }
10529
+ },
10530
+ resources: [],
10531
+ provenance: {
10532
+ canonicalSources: [
10533
+ source,
10534
+ {
10535
+ repository,
10536
+ path: "src/fixed-input-editors.ts",
10537
+ symbol: "fixedInputEditorOptions"
10538
+ },
10539
+ {
10540
+ repository: "turbowarp-extension-data-editor",
10541
+ path: "src/turbowarp/fixed-fields.js",
10542
+ version: "485f0e550e622235624b5e9176820161aeeba252",
10543
+ symbol: "prepareFixedChange"
10544
+ },
10545
+ {
10546
+ repository,
10547
+ path: "src/block-definitions.json"
10548
+ },
10549
+ {
10550
+ repository,
10551
+ path: "src/extension.ts",
10552
+ symbol: opcode
10553
+ }
10554
+ ],
10555
+ generatedFiles: [],
10556
+ referenceSchemas: [],
10557
+ generationSources: []
10558
+ }
10559
+ };
10560
+ }
10561
+ function fixedInputEditorOptions() {
10562
+ return Object.entries(contracts).map(([opcode, contract]) => {
10563
+ const bindings = Object.entries(contract.properties).map(([argument, schema]) => ({
10564
+ argument,
10565
+ schemaBundle: bundle(opcode, argument),
10566
+ control: schema.enum ? {
10567
+ kind: "enum",
10568
+ choices: schema.enum.map((value) => ({
10569
+ value,
10570
+ label: value
10571
+ }))
10572
+ } : { kind: schema.type === "number" || schema.type === "integer" ? "number" : "color" },
10573
+ read(value) {
10574
+ if (schema.type === "number" || schema.type === "integer") return existingNumber(value);
10575
+ if (typeof value !== "string") throw new TypeError("Invalid string projection.");
10576
+ return schema.enum ? normalizeChoice(opcode, argument, value) : value;
10577
+ },
10578
+ encode(value) {
10579
+ if (schema.type === "number" || schema.type === "integer") {
10580
+ fixedNumber(value);
10581
+ return typeof value === "number" ? Object.is(value, -0) ? "-0" : String(value) : value.trim();
10582
+ }
10583
+ if (typeof value !== "string") throw new TypeError("Invalid fixed string.");
10584
+ if (schema.pattern && /^#[\da-f]{3}$/iu.test(value)) return `#${value[1]}${value[1]}${value[2]}${value[2]}${value[3]}${value[3]}`;
10585
+ return value;
10586
+ },
10587
+ validateCandidate(candidate) {
10588
+ let valid;
10589
+ try {
10590
+ if (schema.type === "number" || schema.type === "integer") {
10591
+ const number = existingNumber(candidate);
10592
+ valid = (schema.type !== "integer" || Number.isInteger(number)) && (schema.minimum === void 0 || number >= schema.minimum) && (schema.maximum === void 0 || number <= schema.maximum) && (schema.exclusiveMinimum === void 0 || number > schema.exclusiveMinimum);
10593
+ } else valid = typeof candidate === "string" && (schema.enum ? schema.enum.includes(candidate) : new RegExp(schema.pattern, "u").test(candidate));
10594
+ } catch {
10595
+ valid = false;
10596
+ }
10597
+ return valid ? [] : [{
10598
+ path: argument,
10599
+ message: "Check this value before saving."
10600
+ }];
10601
+ }
10602
+ }));
10603
+ return {
10604
+ apiVersion: 1,
10605
+ extensionId: extensionConfig.id,
10606
+ editorId: `${extensionConfig.id}.fixed.${opcode}`,
10607
+ opcodes: [`${extensionConfig.id}_${opcode}`],
10608
+ contractId: `${repository}.${opcode}.fixed`,
10609
+ contractRevision,
10610
+ bindings,
10611
+ validationContext: () => ({
10612
+ consumerId: repository,
10613
+ nowMs: 0,
10614
+ settings: null
10615
+ })
10616
+ };
10617
+ });
10618
+ }
10619
+ /** Optional GUI capability; ordinary runtime/composition consumers do not load the editor. */
10620
+ function registerFixedInputEditors(scratch, runtime) {
10621
+ const api = scratch.gui?.blockEditors;
10622
+ if (api?.apiVersion !== 1 || typeof api.registerFixedInputEditor !== "function") return void 0;
10623
+ const events = runtime;
10624
+ const removers = [];
10625
+ let active = true;
10626
+ const dispose = () => {
10627
+ if (!active) return;
10628
+ active = false;
10629
+ events.off?.("RUNTIME_DISPOSED", dispose);
10630
+ for (const remove of removers.splice(0).reverse()) remove();
10631
+ };
10632
+ try {
10633
+ for (const options of fixedInputEditorOptions()) removers.push(api.registerFixedInputEditor.call(api, options));
10634
+ events.on?.("RUNTIME_DISPOSED", dispose);
10635
+ } catch (error) {
10636
+ dispose();
10637
+ throw error;
10638
+ }
10639
+ return dispose;
10640
+ }
9929
10641
  var baseStageWidth = 480;
9930
10642
  var baseStageHeight = 360;
9931
10643
  var defaultFontPercent$1 = 100;
@@ -10275,6 +10987,7 @@
10275
10987
  });
10276
10988
  }
10277
10989
  getInfo() {
10990
+ this.fixedEditorsDispose ?? (this.fixedEditorsDispose = registerFixedInputEditors(Scratch, this.runtime));
10278
10991
  return {
10279
10992
  id: extensionConfig.id,
10280
10993
  name: Scratch.translate(block_definitions_default.extensionName),
@@ -12002,11 +12715,11 @@
12002
12715
  }));
12003
12716
  }
12004
12717
  function requireAssetManager(value) {
12005
- if (!isRecord(value) || typeof value.isLoaded !== "function" || typeof value.getAssetMimeType !== "function" || typeof value.resolveSkin !== "function") throw new BubbleRuntimeAdapterError("BUBBLE-RUNTIME-002", "Bubble image assets require an imageResolver capability. Load @kubohiroya/turbowarp-asset-manager or provide options.imageResolver before using image features.");
12718
+ if (!isRecord(value) || typeof value.isLoaded !== "function" || typeof value.getAssetMimeType !== "function" || typeof value.resolveSkin !== "function") throw new BubbleRuntimeAdapterError("BUBBLE-RUNTIME-002", "Bubble image assets require an imageResolver capability. Load @kubohiroya/turbowarp-asset-cache or provide options.imageResolver before using image features.");
12006
12719
  return value;
12007
12720
  }
12008
12721
  function requireAssetManagerDOMImageCapability(value) {
12009
- if (!isRecord(value) || typeof value.getDOMImageCapability !== "function") throw new BubbleRuntimeAdapterError("BUBBLE-RUNTIME-002", "Bubble SVG overlay image assets require @kubohiroya/turbowarp-asset-manager 0.12.1 or a host-provided options.svgOverlayImageCapability.");
12722
+ if (!isRecord(value) || typeof value.getDOMImageCapability !== "function") throw new BubbleRuntimeAdapterError("BUBBLE-RUNTIME-002", "Bubble SVG overlay image assets require @kubohiroya/turbowarp-asset-cache 0.1.0 or a host-provided options.svgOverlayImageCapability.");
12010
12723
  const capability = value.getDOMImageCapability();
12011
12724
  if (!isRecord(capability) || typeof capability.isRegistered !== "function" || typeof capability.getMimeType !== "function" || typeof capability.resolveDOMImageResource !== "function") throw new BubbleRuntimeAdapterError("BUBBLE-RUNTIME-002", "Asset Manager did not provide a valid DOM image capability.");
12012
12725
  return capability;
@@ -12614,10 +13327,11 @@
12614
13327
  setTimeout: (callback, milliseconds) => globalThis.setTimeout(callback, milliseconds),
12615
13328
  clearTimeout: (handle) => globalThis.clearTimeout(handle)
12616
13329
  };
12617
- const getAssetExtension = () => requireAssetManager(runtime.ext_kubohiroyaassetmanager);
13330
+ const getRuntimeAssetExtension = () => runtime.ext_kubohiroyaassetcache ?? runtime.ext_kubohiroyaassetmanager;
13331
+ const getAssetExtension = () => requireAssetManager(getRuntimeAssetExtension());
12618
13332
  let assetManagerDOMImages;
12619
13333
  const getAssetManagerDOMImages = () => {
12620
- assetManagerDOMImages ?? (assetManagerDOMImages = requireAssetManagerDOMImageCapability(runtime.ext_kubohiroyaassetmanager));
13334
+ assetManagerDOMImages ?? (assetManagerDOMImages = requireAssetManagerDOMImageCapability(getRuntimeAssetExtension()));
12621
13335
  return assetManagerDOMImages;
12622
13336
  };
12623
13337
  let textCapability;
@@ -12744,7 +13458,7 @@
12744
13458
  textStyle: "default"
12745
13459
  })]);
12746
13460
  var EXTENSION_DOCS_URI = "https://kubohiroya.github.io/turbowarp-bubble/";
12747
- var EXTENSION_VERSION = "0.12.0";
13461
+ var EXTENSION_VERSION = "0.13.1";
12748
13462
  var BLOCK_ICON_URI = `data:image/svg+xml,${encodeURIComponent("<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\"><path fill=\"none\" stroke=\"#fff\" stroke-width=\"5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 13h40a5 5 0 0 1 5 5v23a5 5 0 0 1-5 5H30L17 55v-9h-5a5 5 0 0 1-5-5V18a5 5 0 0 1 5-5Z\"/><g fill=\"#fff\"><circle cx=\"23\" cy=\"30\" r=\"3\"/><circle cx=\"32\" cy=\"30\" r=\"3\"/><circle cx=\"41\" cy=\"30\" r=\"3\"/></g></svg>")}`;
12749
13463
  function extensionError(message) {
12750
13464
  const error = /* @__PURE__ */ new Error(`[Bubble] ${message}`);
@@ -12762,6 +13476,7 @@
12762
13476
  _defineProperty(this, "waitScheduler", void 0);
12763
13477
  _defineProperty(this, "composition", null);
12764
13478
  _defineProperty(this, "disposed", false);
13479
+ _defineProperty(this, "fixedEditorsDispose", void 0);
12765
13480
  if (!runtime) throw extensionError("TurboWarp runtime is unavailable.");
12766
13481
  this.runtime = runtime;
12767
13482
  this.options = options;
@@ -12783,6 +13498,7 @@
12783
13498
  });
12784
13499
  }
12785
13500
  getInfo() {
13501
+ if (!this.disposed) this.fixedEditorsDispose ?? (this.fixedEditorsDispose = registerFixedInputEditors$1(Scratch, this.runtime));
12786
13502
  return {
12787
13503
  id: extensionConfig$1.id,
12788
13504
  name: Scratch.translate(block_definitions_default$1.extensionName),
@@ -13184,6 +13900,7 @@
13184
13900
  async dispose() {
13185
13901
  if (this.disposed) return;
13186
13902
  this.disposed = true;
13903
+ this.fixedEditorsDispose?.();
13187
13904
  this.cancelAllWaits("Bubble extension was disposed.");
13188
13905
  if (this.composition) await this.composition.dispose();
13189
13906
  this.handles.clear();