@lvl99dotcom/paintcanvas 0.6.0 → 0.8.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/README.md +3 -2
- package/dist/lib/assets/index.d.ts +92 -0
- package/dist/lib/assets/index.js +106 -0
- package/dist/lib/assets/schema.d.ts +151 -0
- package/dist/lib/assets/schema.js +76 -0
- package/dist/lib/brushes/presetFile/index.d.ts +6 -27
- package/dist/lib/brushes/presetFile/index.js +34 -47
- package/dist/lib/brushes/types/index.d.ts +2 -11
- package/dist/lib/classes/AssetSync/index.d.ts +45 -0
- package/dist/lib/classes/AssetSync/index.js +80 -0
- package/dist/lib/classes/ColourPalettes/index.d.ts +83 -0
- package/dist/lib/classes/ColourPalettes/index.js +165 -0
- package/dist/lib/classes/CustomPresets/index.d.ts +14 -15
- package/dist/lib/classes/CustomPresets/index.js +25 -10
- package/dist/lib/classes/LayerAutosave/index.d.ts +9 -2
- package/dist/lib/classes/LayerAutosave/index.js +16 -6
- package/dist/lib/classes/PaintCanvas/index.d.ts +124 -28
- package/dist/lib/classes/PaintCanvas/index.js +228 -63
- package/dist/lib/classes/Palette/index.d.ts +3 -2
- package/dist/lib/classes/Palette/index.js +3 -2
- package/dist/lib/classes/ProfileGraphs/index.d.ts +13 -2
- package/dist/lib/classes/ProfileGraphs/index.js +22 -2
- package/dist/lib/classes/RemoteDocumentAutosave/index.d.ts +73 -0
- package/dist/lib/classes/RemoteDocumentAutosave/index.js +119 -0
- package/dist/lib/classes/SettingsAutosave/index.d.ts +7 -3
- package/dist/lib/classes/SettingsAutosave/index.js +28 -7
- package/dist/lib/classes/SettingsExtensions/index.d.ts +67 -0
- package/dist/lib/classes/SettingsExtensions/index.js +88 -0
- package/dist/lib/classes/UiSettings/index.d.ts +24 -2
- package/dist/lib/classes/UiSettings/index.js +32 -7
- package/dist/lib/document/index.d.ts +61 -4
- package/dist/lib/document/index.js +173 -4
- package/dist/lib/document/schema.d.ts +154 -39
- package/dist/lib/document/schema.js +91 -25
- package/dist/lib/messages/schema.d.ts +176 -74
- package/dist/lib/messages/schema.js +2 -1
- package/dist/lib/palette/index.d.ts +8 -42
- package/dist/lib/palette/index.js +26 -59
- package/dist/lib/palette/schema.d.ts +111 -22
- package/dist/lib/palette/schema.js +51 -26
- package/dist/lib/presets/index.d.ts +1 -9
- package/dist/lib/presets/index.js +4 -10
- package/dist/lib/presets/schema.d.ts +118 -73
- package/dist/lib/presets/schema.js +28 -60
- package/dist/lib/profiles/profileFile/index.d.ts +10 -0
- package/dist/lib/profiles/profileFile/index.js +19 -0
- package/dist/lib/profiles/schema.d.ts +96 -3
- package/dist/lib/profiles/schema.js +31 -7
- package/dist/lib/schemas/index.d.ts +42 -0
- package/dist/lib/schemas/index.js +60 -0
- package/dist/lib/settings/index.d.ts +37 -22
- package/dist/lib/settings/index.js +78 -37
- package/dist/lib/settings/schema.d.ts +202 -77
- package/dist/lib/settings/schema.js +93 -86
- package/dist/lib/storage/index.d.ts +108 -3
- package/dist/lib/storage/index.js +119 -5
- package/dist/lib/validation/validators.generated.d.ts +19 -8
- package/dist/lib/validation/validators.generated.js +44723 -18889
- package/dist/lib/version/index.d.ts +25 -0
- package/dist/lib/version/index.js +35 -0
- package/dist/locales/en-GB.js +28 -5
- package/dist/locales/en-US.js +28 -5
- package/dist/locales/fr.js +28 -5
- package/dist/locales/ja.js +28 -5
- package/dist/locales/ko.js +28 -5
- package/dist/locales/zh-Hans.js +28 -5
- package/dist/locales/zh-Hant.js +28 -5
- package/dist/package.js +1 -1
- package/dist/testing/app.d.ts +6 -2
- package/dist/testing/app.js +7 -2
- package/dist/testing/documentStore.d.ts +26 -0
- package/dist/testing/documentStore.js +31 -0
- package/dist/ui/elements/PaintCanvas/index.d.ts +19 -5
- package/dist/ui/elements/PaintCanvas/index.js +41 -10
- package/dist/ui/elements/PcAppSettings/index.d.ts +14 -7
- package/dist/ui/elements/PcAppSettings/index.js +58 -33
- package/dist/ui/elements/PcBrushConfig/index.d.ts +1 -0
- package/dist/ui/elements/PcBrushConfig/index.js +8 -9
- package/dist/ui/elements/PcBrushTest/index.d.ts +1 -0
- package/dist/ui/elements/PcBrushTest/index.js +8 -7
- package/dist/ui/elements/PcBrushTest/style.js +1 -1
- package/dist/ui/elements/PcButtonMenu/index.d.ts +88 -0
- package/dist/ui/elements/PcButtonMenu/index.js +125 -0
- package/dist/ui/elements/PcCanvas/index.d.ts +9 -0
- package/dist/ui/elements/PcCanvas/index.js +33 -17
- package/dist/ui/elements/PcClipboardTools/index.d.ts +7 -4
- package/dist/ui/elements/PcClipboardTools/index.js +20 -26
- package/dist/ui/elements/PcInputSettings/index.d.ts +2 -1
- package/dist/ui/elements/PcInputSettings/index.js +9 -15
- package/dist/ui/elements/PcLayerItem/index.d.ts +21 -6
- package/dist/ui/elements/PcLayerItem/index.js +53 -26
- package/dist/ui/elements/PcLayerItem/style.js +1 -1
- package/dist/ui/elements/PcPanelBrushes/index.d.ts +1 -1
- package/dist/ui/elements/PcPanelBrushes/index.js +22 -28
- package/dist/ui/elements/PcPanelBrushes/style.js +1 -1
- package/dist/ui/elements/PcPanelColours/index.d.ts +56 -19
- package/dist/ui/elements/PcPanelColours/index.js +251 -104
- package/dist/ui/elements/PcPanelColours/style.js +1 -1
- package/dist/ui/elements/PcSliderRange/index.js +3 -2
- package/dist/ui/elements/PcStats/index.d.ts +8 -4
- package/dist/ui/elements/PcStats/index.js +39 -5
- package/dist/ui/elements/PcToggleCheckbox/index.d.ts +13 -2
- package/dist/ui/elements/PcToggleCheckbox/index.js +27 -8
- package/dist/ui/elements/PcToolSettings/index.d.ts +1 -0
- package/dist/ui/elements/PcToolSettings/index.js +8 -8
- package/dist/ui/elements/PcVersion/index.d.ts +12 -0
- package/dist/ui/elements/PcVersion/index.js +43 -0
- package/dist/ui/index.d.ts +3 -1
- package/dist/ui/index.js +4 -2
- package/dist/ui/layout/index.d.ts +2 -2
- package/dist/ui/layout/index.js +2 -2
- package/locales/en-GB.json +28 -5
- package/locales/en-US.json +28 -5
- package/locales/fr.json +28 -5
- package/locales/ja.json +28 -5
- package/locales/ko.json +28 -5
- package/locales/zh-Hans.json +28 -5
- package/locales/zh-Hant.json +28 -5
- package/package.json +3 -2
|
@@ -80,6 +80,14 @@ export declare const strokePresetSchema: {
|
|
|
80
80
|
readonly minLength: 1;
|
|
81
81
|
readonly maxLength: 100;
|
|
82
82
|
};
|
|
83
|
+
readonly $schema: {
|
|
84
|
+
readonly type: "string";
|
|
85
|
+
readonly minLength: 1;
|
|
86
|
+
readonly maxLength: 2048;
|
|
87
|
+
};
|
|
88
|
+
readonly "@type": {
|
|
89
|
+
readonly const: "PaintCanvas/BrushConfig";
|
|
90
|
+
};
|
|
83
91
|
readonly name: {
|
|
84
92
|
readonly type: "string";
|
|
85
93
|
readonly minLength: 1;
|
|
@@ -104,6 +112,11 @@ export declare const strokePresetSchema: {
|
|
|
104
112
|
readonly additionalProperties: false;
|
|
105
113
|
readonly required: readonly ["name"];
|
|
106
114
|
readonly properties: {
|
|
115
|
+
readonly did: {
|
|
116
|
+
readonly type: "string";
|
|
117
|
+
readonly maxLength: 2048;
|
|
118
|
+
readonly pattern: "^did:[a-z]+:[a-zA-Z0-9._:%-]+$";
|
|
119
|
+
};
|
|
107
120
|
readonly name: {
|
|
108
121
|
readonly type: "string";
|
|
109
122
|
readonly minLength: 1;
|
|
@@ -118,7 +131,7 @@ export declare const strokePresetSchema: {
|
|
|
118
131
|
readonly type: "string";
|
|
119
132
|
readonly maxLength: 254;
|
|
120
133
|
};
|
|
121
|
-
readonly
|
|
134
|
+
readonly homepage: {
|
|
122
135
|
readonly type: "string";
|
|
123
136
|
readonly maxLength: 2048;
|
|
124
137
|
};
|
|
@@ -210,9 +223,12 @@ export declare const strokePresetSchema: {
|
|
|
210
223
|
};
|
|
211
224
|
};
|
|
212
225
|
readonly profileId: {
|
|
213
|
-
readonly
|
|
214
|
-
|
|
215
|
-
|
|
226
|
+
readonly anyOf: readonly [{
|
|
227
|
+
readonly type: "string";
|
|
228
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
229
|
+
}, {
|
|
230
|
+
readonly enum: string[];
|
|
231
|
+
}];
|
|
216
232
|
};
|
|
217
233
|
};
|
|
218
234
|
};
|
|
@@ -293,9 +309,12 @@ export declare const strokePresetSchema: {
|
|
|
293
309
|
};
|
|
294
310
|
};
|
|
295
311
|
readonly profileId: {
|
|
296
|
-
readonly
|
|
297
|
-
|
|
298
|
-
|
|
312
|
+
readonly anyOf: readonly [{
|
|
313
|
+
readonly type: "string";
|
|
314
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
315
|
+
}, {
|
|
316
|
+
readonly enum: string[];
|
|
317
|
+
}];
|
|
299
318
|
};
|
|
300
319
|
};
|
|
301
320
|
};
|
|
@@ -376,9 +395,12 @@ export declare const strokePresetSchema: {
|
|
|
376
395
|
};
|
|
377
396
|
};
|
|
378
397
|
readonly profileId: {
|
|
379
|
-
readonly
|
|
380
|
-
|
|
381
|
-
|
|
398
|
+
readonly anyOf: readonly [{
|
|
399
|
+
readonly type: "string";
|
|
400
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
401
|
+
}, {
|
|
402
|
+
readonly enum: string[];
|
|
403
|
+
}];
|
|
382
404
|
};
|
|
383
405
|
};
|
|
384
406
|
};
|
|
@@ -459,9 +481,12 @@ export declare const strokePresetSchema: {
|
|
|
459
481
|
};
|
|
460
482
|
};
|
|
461
483
|
readonly profileId: {
|
|
462
|
-
readonly
|
|
463
|
-
|
|
464
|
-
|
|
484
|
+
readonly anyOf: readonly [{
|
|
485
|
+
readonly type: "string";
|
|
486
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
487
|
+
}, {
|
|
488
|
+
readonly enum: string[];
|
|
489
|
+
}];
|
|
465
490
|
};
|
|
466
491
|
};
|
|
467
492
|
};
|
|
@@ -542,9 +567,12 @@ export declare const strokePresetSchema: {
|
|
|
542
567
|
};
|
|
543
568
|
};
|
|
544
569
|
readonly profileId: {
|
|
545
|
-
readonly
|
|
546
|
-
|
|
547
|
-
|
|
570
|
+
readonly anyOf: readonly [{
|
|
571
|
+
readonly type: "string";
|
|
572
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
573
|
+
}, {
|
|
574
|
+
readonly enum: string[];
|
|
575
|
+
}];
|
|
548
576
|
};
|
|
549
577
|
};
|
|
550
578
|
};
|
|
@@ -625,9 +653,12 @@ export declare const strokePresetSchema: {
|
|
|
625
653
|
};
|
|
626
654
|
};
|
|
627
655
|
readonly profileId: {
|
|
628
|
-
readonly
|
|
629
|
-
|
|
630
|
-
|
|
656
|
+
readonly anyOf: readonly [{
|
|
657
|
+
readonly type: "string";
|
|
658
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
659
|
+
}, {
|
|
660
|
+
readonly enum: string[];
|
|
661
|
+
}];
|
|
631
662
|
};
|
|
632
663
|
};
|
|
633
664
|
};
|
|
@@ -705,9 +736,12 @@ export declare const strokePresetSchema: {
|
|
|
705
736
|
};
|
|
706
737
|
};
|
|
707
738
|
readonly profileId: {
|
|
708
|
-
readonly
|
|
709
|
-
|
|
710
|
-
|
|
739
|
+
readonly anyOf: readonly [{
|
|
740
|
+
readonly type: "string";
|
|
741
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
742
|
+
}, {
|
|
743
|
+
readonly enum: string[];
|
|
744
|
+
}];
|
|
711
745
|
};
|
|
712
746
|
};
|
|
713
747
|
};
|
|
@@ -785,9 +819,12 @@ export declare const strokePresetSchema: {
|
|
|
785
819
|
};
|
|
786
820
|
};
|
|
787
821
|
readonly profileId: {
|
|
788
|
-
readonly
|
|
789
|
-
|
|
790
|
-
|
|
822
|
+
readonly anyOf: readonly [{
|
|
823
|
+
readonly type: "string";
|
|
824
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
825
|
+
}, {
|
|
826
|
+
readonly enum: string[];
|
|
827
|
+
}];
|
|
791
828
|
};
|
|
792
829
|
};
|
|
793
830
|
};
|
|
@@ -865,9 +902,12 @@ export declare const strokePresetSchema: {
|
|
|
865
902
|
};
|
|
866
903
|
};
|
|
867
904
|
readonly profileId: {
|
|
868
|
-
readonly
|
|
869
|
-
|
|
870
|
-
|
|
905
|
+
readonly anyOf: readonly [{
|
|
906
|
+
readonly type: "string";
|
|
907
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
908
|
+
}, {
|
|
909
|
+
readonly enum: string[];
|
|
910
|
+
}];
|
|
871
911
|
};
|
|
872
912
|
};
|
|
873
913
|
};
|
|
@@ -948,9 +988,12 @@ export declare const strokePresetSchema: {
|
|
|
948
988
|
};
|
|
949
989
|
};
|
|
950
990
|
readonly profileId: {
|
|
951
|
-
readonly
|
|
952
|
-
|
|
953
|
-
|
|
991
|
+
readonly anyOf: readonly [{
|
|
992
|
+
readonly type: "string";
|
|
993
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
994
|
+
}, {
|
|
995
|
+
readonly enum: string[];
|
|
996
|
+
}];
|
|
954
997
|
};
|
|
955
998
|
};
|
|
956
999
|
};
|
|
@@ -1028,9 +1071,12 @@ export declare const strokePresetSchema: {
|
|
|
1028
1071
|
};
|
|
1029
1072
|
};
|
|
1030
1073
|
readonly profileId: {
|
|
1031
|
-
readonly
|
|
1032
|
-
|
|
1033
|
-
|
|
1074
|
+
readonly anyOf: readonly [{
|
|
1075
|
+
readonly type: "string";
|
|
1076
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
1077
|
+
}, {
|
|
1078
|
+
readonly enum: string[];
|
|
1079
|
+
}];
|
|
1034
1080
|
};
|
|
1035
1081
|
};
|
|
1036
1082
|
};
|
|
@@ -1108,9 +1154,12 @@ export declare const strokePresetSchema: {
|
|
|
1108
1154
|
};
|
|
1109
1155
|
};
|
|
1110
1156
|
readonly profileId: {
|
|
1111
|
-
readonly
|
|
1112
|
-
|
|
1113
|
-
|
|
1157
|
+
readonly anyOf: readonly [{
|
|
1158
|
+
readonly type: "string";
|
|
1159
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
1160
|
+
}, {
|
|
1161
|
+
readonly enum: string[];
|
|
1162
|
+
}];
|
|
1114
1163
|
};
|
|
1115
1164
|
};
|
|
1116
1165
|
};
|
|
@@ -1131,6 +1180,8 @@ export declare const strokePresetSchema: {
|
|
|
1131
1180
|
readonly type: "boolean";
|
|
1132
1181
|
};
|
|
1133
1182
|
};
|
|
1183
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
1184
|
+
readonly "@type": "PaintCanvas/BrushConfig";
|
|
1134
1185
|
readonly type: "object";
|
|
1135
1186
|
readonly additionalProperties: false;
|
|
1136
1187
|
readonly required: readonly ["id"];
|
|
@@ -1293,6 +1344,14 @@ export declare const messageSchemas: readonly [{
|
|
|
1293
1344
|
readonly minLength: 1;
|
|
1294
1345
|
readonly maxLength: 100;
|
|
1295
1346
|
};
|
|
1347
|
+
readonly $schema: {
|
|
1348
|
+
readonly type: "string";
|
|
1349
|
+
readonly minLength: 1;
|
|
1350
|
+
readonly maxLength: 2048;
|
|
1351
|
+
};
|
|
1352
|
+
readonly "@type": {
|
|
1353
|
+
readonly const: "PaintCanvas/BrushConfig";
|
|
1354
|
+
};
|
|
1296
1355
|
readonly name: {
|
|
1297
1356
|
readonly type: "string";
|
|
1298
1357
|
readonly minLength: 1;
|
|
@@ -1317,6 +1376,11 @@ export declare const messageSchemas: readonly [{
|
|
|
1317
1376
|
readonly additionalProperties: false;
|
|
1318
1377
|
readonly required: readonly ["name"];
|
|
1319
1378
|
readonly properties: {
|
|
1379
|
+
readonly did: {
|
|
1380
|
+
readonly type: "string";
|
|
1381
|
+
readonly maxLength: 2048;
|
|
1382
|
+
readonly pattern: "^did:[a-z]+:[a-zA-Z0-9._:%-]+$";
|
|
1383
|
+
};
|
|
1320
1384
|
readonly name: {
|
|
1321
1385
|
readonly type: "string";
|
|
1322
1386
|
readonly minLength: 1;
|
|
@@ -1331,7 +1395,7 @@ export declare const messageSchemas: readonly [{
|
|
|
1331
1395
|
readonly type: "string";
|
|
1332
1396
|
readonly maxLength: 254;
|
|
1333
1397
|
};
|
|
1334
|
-
readonly
|
|
1398
|
+
readonly homepage: {
|
|
1335
1399
|
readonly type: "string";
|
|
1336
1400
|
readonly maxLength: 2048;
|
|
1337
1401
|
};
|
|
@@ -1423,9 +1487,12 @@ export declare const messageSchemas: readonly [{
|
|
|
1423
1487
|
};
|
|
1424
1488
|
};
|
|
1425
1489
|
readonly profileId: {
|
|
1426
|
-
readonly
|
|
1427
|
-
|
|
1428
|
-
|
|
1490
|
+
readonly anyOf: readonly [{
|
|
1491
|
+
readonly type: "string";
|
|
1492
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
1493
|
+
}, {
|
|
1494
|
+
readonly enum: string[];
|
|
1495
|
+
}];
|
|
1429
1496
|
};
|
|
1430
1497
|
};
|
|
1431
1498
|
};
|
|
@@ -1506,9 +1573,12 @@ export declare const messageSchemas: readonly [{
|
|
|
1506
1573
|
};
|
|
1507
1574
|
};
|
|
1508
1575
|
readonly profileId: {
|
|
1509
|
-
readonly
|
|
1510
|
-
|
|
1511
|
-
|
|
1576
|
+
readonly anyOf: readonly [{
|
|
1577
|
+
readonly type: "string";
|
|
1578
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
1579
|
+
}, {
|
|
1580
|
+
readonly enum: string[];
|
|
1581
|
+
}];
|
|
1512
1582
|
};
|
|
1513
1583
|
};
|
|
1514
1584
|
};
|
|
@@ -1589,9 +1659,12 @@ export declare const messageSchemas: readonly [{
|
|
|
1589
1659
|
};
|
|
1590
1660
|
};
|
|
1591
1661
|
readonly profileId: {
|
|
1592
|
-
readonly
|
|
1593
|
-
|
|
1594
|
-
|
|
1662
|
+
readonly anyOf: readonly [{
|
|
1663
|
+
readonly type: "string";
|
|
1664
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
1665
|
+
}, {
|
|
1666
|
+
readonly enum: string[];
|
|
1667
|
+
}];
|
|
1595
1668
|
};
|
|
1596
1669
|
};
|
|
1597
1670
|
};
|
|
@@ -1672,9 +1745,12 @@ export declare const messageSchemas: readonly [{
|
|
|
1672
1745
|
};
|
|
1673
1746
|
};
|
|
1674
1747
|
readonly profileId: {
|
|
1675
|
-
readonly
|
|
1676
|
-
|
|
1677
|
-
|
|
1748
|
+
readonly anyOf: readonly [{
|
|
1749
|
+
readonly type: "string";
|
|
1750
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
1751
|
+
}, {
|
|
1752
|
+
readonly enum: string[];
|
|
1753
|
+
}];
|
|
1678
1754
|
};
|
|
1679
1755
|
};
|
|
1680
1756
|
};
|
|
@@ -1755,9 +1831,12 @@ export declare const messageSchemas: readonly [{
|
|
|
1755
1831
|
};
|
|
1756
1832
|
};
|
|
1757
1833
|
readonly profileId: {
|
|
1758
|
-
readonly
|
|
1759
|
-
|
|
1760
|
-
|
|
1834
|
+
readonly anyOf: readonly [{
|
|
1835
|
+
readonly type: "string";
|
|
1836
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
1837
|
+
}, {
|
|
1838
|
+
readonly enum: string[];
|
|
1839
|
+
}];
|
|
1761
1840
|
};
|
|
1762
1841
|
};
|
|
1763
1842
|
};
|
|
@@ -1838,9 +1917,12 @@ export declare const messageSchemas: readonly [{
|
|
|
1838
1917
|
};
|
|
1839
1918
|
};
|
|
1840
1919
|
readonly profileId: {
|
|
1841
|
-
readonly
|
|
1842
|
-
|
|
1843
|
-
|
|
1920
|
+
readonly anyOf: readonly [{
|
|
1921
|
+
readonly type: "string";
|
|
1922
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
1923
|
+
}, {
|
|
1924
|
+
readonly enum: string[];
|
|
1925
|
+
}];
|
|
1844
1926
|
};
|
|
1845
1927
|
};
|
|
1846
1928
|
};
|
|
@@ -1918,9 +2000,12 @@ export declare const messageSchemas: readonly [{
|
|
|
1918
2000
|
};
|
|
1919
2001
|
};
|
|
1920
2002
|
readonly profileId: {
|
|
1921
|
-
readonly
|
|
1922
|
-
|
|
1923
|
-
|
|
2003
|
+
readonly anyOf: readonly [{
|
|
2004
|
+
readonly type: "string";
|
|
2005
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
2006
|
+
}, {
|
|
2007
|
+
readonly enum: string[];
|
|
2008
|
+
}];
|
|
1924
2009
|
};
|
|
1925
2010
|
};
|
|
1926
2011
|
};
|
|
@@ -1998,9 +2083,12 @@ export declare const messageSchemas: readonly [{
|
|
|
1998
2083
|
};
|
|
1999
2084
|
};
|
|
2000
2085
|
readonly profileId: {
|
|
2001
|
-
readonly
|
|
2002
|
-
|
|
2003
|
-
|
|
2086
|
+
readonly anyOf: readonly [{
|
|
2087
|
+
readonly type: "string";
|
|
2088
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
2089
|
+
}, {
|
|
2090
|
+
readonly enum: string[];
|
|
2091
|
+
}];
|
|
2004
2092
|
};
|
|
2005
2093
|
};
|
|
2006
2094
|
};
|
|
@@ -2078,9 +2166,12 @@ export declare const messageSchemas: readonly [{
|
|
|
2078
2166
|
};
|
|
2079
2167
|
};
|
|
2080
2168
|
readonly profileId: {
|
|
2081
|
-
readonly
|
|
2082
|
-
|
|
2083
|
-
|
|
2169
|
+
readonly anyOf: readonly [{
|
|
2170
|
+
readonly type: "string";
|
|
2171
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
2172
|
+
}, {
|
|
2173
|
+
readonly enum: string[];
|
|
2174
|
+
}];
|
|
2084
2175
|
};
|
|
2085
2176
|
};
|
|
2086
2177
|
};
|
|
@@ -2161,9 +2252,12 @@ export declare const messageSchemas: readonly [{
|
|
|
2161
2252
|
};
|
|
2162
2253
|
};
|
|
2163
2254
|
readonly profileId: {
|
|
2164
|
-
readonly
|
|
2165
|
-
|
|
2166
|
-
|
|
2255
|
+
readonly anyOf: readonly [{
|
|
2256
|
+
readonly type: "string";
|
|
2257
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
2258
|
+
}, {
|
|
2259
|
+
readonly enum: string[];
|
|
2260
|
+
}];
|
|
2167
2261
|
};
|
|
2168
2262
|
};
|
|
2169
2263
|
};
|
|
@@ -2241,9 +2335,12 @@ export declare const messageSchemas: readonly [{
|
|
|
2241
2335
|
};
|
|
2242
2336
|
};
|
|
2243
2337
|
readonly profileId: {
|
|
2244
|
-
readonly
|
|
2245
|
-
|
|
2246
|
-
|
|
2338
|
+
readonly anyOf: readonly [{
|
|
2339
|
+
readonly type: "string";
|
|
2340
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
2341
|
+
}, {
|
|
2342
|
+
readonly enum: string[];
|
|
2343
|
+
}];
|
|
2247
2344
|
};
|
|
2248
2345
|
};
|
|
2249
2346
|
};
|
|
@@ -2321,9 +2418,12 @@ export declare const messageSchemas: readonly [{
|
|
|
2321
2418
|
};
|
|
2322
2419
|
};
|
|
2323
2420
|
readonly profileId: {
|
|
2324
|
-
readonly
|
|
2325
|
-
|
|
2326
|
-
|
|
2421
|
+
readonly anyOf: readonly [{
|
|
2422
|
+
readonly type: "string";
|
|
2423
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
2424
|
+
}, {
|
|
2425
|
+
readonly enum: string[];
|
|
2426
|
+
}];
|
|
2327
2427
|
};
|
|
2328
2428
|
};
|
|
2329
2429
|
};
|
|
@@ -2344,6 +2444,8 @@ export declare const messageSchemas: readonly [{
|
|
|
2344
2444
|
readonly type: "boolean";
|
|
2345
2445
|
};
|
|
2346
2446
|
};
|
|
2447
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
2448
|
+
readonly "@type": "PaintCanvas/BrushConfig";
|
|
2347
2449
|
readonly type: "object";
|
|
2348
2450
|
readonly additionalProperties: false;
|
|
2349
2451
|
readonly required: readonly ["id"];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { UUID_PATTERN } from "../assets/schema.js";
|
|
1
2
|
import { ImageEncoding } from "../image/index.js";
|
|
2
|
-
import {
|
|
3
|
+
import { brushPresetSchema } from "../presets/schema.js";
|
|
3
4
|
// src/lib/messages/schema.ts
|
|
4
5
|
/** Version of the drawing message protocol, sent in every message */
|
|
5
6
|
var PROTOCOL_VERSION = 1;
|
|
@@ -1,49 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import AssetFile from "../assets";
|
|
2
|
+
import { type ColourPalette } from "./schema";
|
|
2
3
|
export * from "./schema";
|
|
3
4
|
/** The colours a palette starts with */
|
|
4
5
|
export declare const DEFAULT_PALETTE: readonly string[];
|
|
5
|
-
/**
|
|
6
|
-
export declare const
|
|
7
|
-
readonly incompatible: "Colour palette JSON file not compatible";
|
|
8
|
-
readonly read: "Failed to read colour palette JSON file";
|
|
9
|
-
};
|
|
10
|
-
/** Importing a palette failed, with a message for the user */
|
|
11
|
-
export declare class PaletteFileError extends Error {
|
|
12
|
-
}
|
|
13
|
-
/** Result of checking a palette file */
|
|
14
|
-
export type PaletteValidationResult = {
|
|
15
|
-
valid: true;
|
|
16
|
-
value: PaletteFile;
|
|
17
|
-
} | {
|
|
18
|
-
valid: false;
|
|
19
|
-
errors: string[];
|
|
20
|
-
};
|
|
6
|
+
/** Name given to the palette in a colour palette file from before versioned schemas */
|
|
7
|
+
export declare const LEGACY_PALETTE_NAME = "Imported palette";
|
|
21
8
|
/**
|
|
22
|
-
*
|
|
9
|
+
* Reads and writes colour palette collection files. Files from before versioned schemas (`format` and `version: 1`,
|
|
10
|
+
* holding one list of colours) are read as one palette named `LEGACY_PALETTE_NAME`.
|
|
23
11
|
*
|
|
24
12
|
* @example
|
|
25
|
-
*
|
|
13
|
+
* const palettes = colourPaletteFile.parse(await file.text());
|
|
26
14
|
*/
|
|
27
|
-
export declare const
|
|
28
|
-
/**
|
|
29
|
-
* The file name a palette is exported to on a day, starting with a prefix (see `PaintCanvasNames.filePrefix`).
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* paletteFileName(new Date(2026, 10, 4)); // "paintcanvas-palette-2026-11-04.json"
|
|
33
|
-
*/
|
|
34
|
-
export declare const paletteFileName: (date?: Date, prefix?: string) => string;
|
|
35
|
-
/**
|
|
36
|
-
* Write colours to a colour palette file (JSON) of a format (see `PaintCanvasNames.paletteFileFormat`).
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* exportPaletteFile(["#ff0000"]); // '{ "format": "paintcanvas-palette", "version": 1, "colours": ["#ff0000"] }'
|
|
40
|
-
*/
|
|
41
|
-
export declare const exportPaletteFile: (colours: readonly string[], format?: string) => string;
|
|
42
|
-
/**
|
|
43
|
-
* Read the colours (as lowercase `#rrggbb`) in a colour palette file of one of the given formats (PaintCanvas's by
|
|
44
|
-
* default). Throws a `PaletteFileError` if it isn't valid JSON or a compatible file.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* parsePaletteFile('{ "format": "paintcanvas-palette", "version": 1, "colours": ["#FF0000"] }'); // ["#ff0000"]
|
|
48
|
-
*/
|
|
49
|
-
export declare const parsePaletteFile: (text: string, formats?: readonly string[]) => string[];
|
|
15
|
+
export declare const colourPaletteFile: AssetFile<ColourPalette>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { HEX_COLOUR_PATTERN,
|
|
1
|
+
import AssetFile from "../assets/index.js";
|
|
2
|
+
import { validateColourPaletteCollection } from "../validation/validators.generated.js";
|
|
3
|
+
import { COLOUR_PALETTE_COLLECTION_SCHEMA_VERSION, COLOUR_PALETTE_COLLECTION_TYPE, COLOUR_PALETTE_SCHEMA_VERSION, COLOUR_PALETTE_TYPE, HEX_COLOUR_PATTERN, MAX_PALETTES_PER_FILE, MAX_PALETTE_COLOURS, MAX_PALETTE_NAME_LENGTH, colourPaletteCollectionSchema, colourPaletteSchema, paletteColoursSchema } from "./schema.js";
|
|
4
4
|
// src/lib/palette/index.ts
|
|
5
5
|
/** The colours a palette starts with */
|
|
6
6
|
var DEFAULT_PALETTE = [
|
|
@@ -20,63 +20,30 @@ var DEFAULT_PALETTE = [
|
|
|
20
20
|
"#cccccc",
|
|
21
21
|
"#ffffff"
|
|
22
22
|
];
|
|
23
|
-
/**
|
|
24
|
-
var
|
|
25
|
-
incompatible: "Colour palette JSON file not compatible",
|
|
26
|
-
read: "Failed to read colour palette JSON file"
|
|
27
|
-
};
|
|
28
|
-
/** Importing a palette failed, with a message for the user */
|
|
29
|
-
var PaletteFileError = class extends Error {};
|
|
23
|
+
/** Name given to the palette in a colour palette file from before versioned schemas */
|
|
24
|
+
var LEGACY_PALETTE_NAME = "Imported palette";
|
|
30
25
|
/**
|
|
31
|
-
*
|
|
26
|
+
* Reads and writes colour palette collection files. Files from before versioned schemas (`format` and `version: 1`,
|
|
27
|
+
* holding one list of colours) are read as one palette named `LEGACY_PALETTE_NAME`.
|
|
32
28
|
*
|
|
33
29
|
* @example
|
|
34
|
-
*
|
|
30
|
+
* const palettes = colourPaletteFile.parse(await file.text());
|
|
35
31
|
*/
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
* Write colours to a colour palette file (JSON) of a format (see `PaintCanvasNames.paletteFileFormat`).
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* exportPaletteFile(["#ff0000"]); // '{ "format": "paintcanvas-palette", "version": 1, "colours": ["#ff0000"] }'
|
|
58
|
-
*/
|
|
59
|
-
var exportPaletteFile = (colours, format = PALETTE_FILE_FORMAT) => JSON.stringify({
|
|
60
|
-
format,
|
|
61
|
-
version: 1,
|
|
62
|
-
colours
|
|
63
|
-
}, null, 2);
|
|
64
|
-
/**
|
|
65
|
-
* Read the colours (as lowercase `#rrggbb`) in a colour palette file of one of the given formats (PaintCanvas's by
|
|
66
|
-
* default). Throws a `PaletteFileError` if it isn't valid JSON or a compatible file.
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* parsePaletteFile('{ "format": "paintcanvas-palette", "version": 1, "colours": ["#FF0000"] }'); // ["#ff0000"]
|
|
70
|
-
*/
|
|
71
|
-
var parsePaletteFile = (text, formats = PALETTE_FILE_FORMATS) => {
|
|
72
|
-
let data;
|
|
73
|
-
try {
|
|
74
|
-
data = JSON.parse(text);
|
|
75
|
-
} catch {
|
|
76
|
-
throw new PaletteFileError(PALETTE_FILE_ERRORS.incompatible);
|
|
77
|
-
}
|
|
78
|
-
const result = isValidPaletteFile(data);
|
|
79
|
-
if (!result.valid || !formats.includes(result.value.format)) throw new PaletteFileError(PALETTE_FILE_ERRORS.incompatible);
|
|
80
|
-
return result.value.colours.map((colour) => colour.toLowerCase());
|
|
81
|
-
};
|
|
82
|
-
export { DEFAULT_PALETTE, HEX_COLOUR_PATTERN, MAX_PALETTE_COLOURS, MAX_PALETTE_FILE_FORMAT_LENGTH, PALETTE_FILE_ERRORS, PALETTE_FILE_FORMAT, PALETTE_FILE_FORMATS, PALETTE_FILE_VERSION, PaletteFileError, exportPaletteFile, isValidPaletteFile, paletteFileName, paletteFileSchema, parsePaletteFile };
|
|
32
|
+
var colourPaletteFile = new AssetFile({
|
|
33
|
+
schema: "colour-palette-collection",
|
|
34
|
+
version: COLOUR_PALETTE_COLLECTION_SCHEMA_VERSION,
|
|
35
|
+
type: COLOUR_PALETTE_COLLECTION_TYPE,
|
|
36
|
+
validate: validateColourPaletteCollection,
|
|
37
|
+
fileName: "colour-palettes",
|
|
38
|
+
legacyVersion: (data) => typeof data.format === "string" && data.version === 1 ? "legacy-1" : void 0,
|
|
39
|
+
migrations: [{
|
|
40
|
+
from: "legacy-1",
|
|
41
|
+
to: "1.0.0",
|
|
42
|
+
migrate: (data) => ({ items: [{
|
|
43
|
+
id: crypto.randomUUID(),
|
|
44
|
+
name: LEGACY_PALETTE_NAME,
|
|
45
|
+
colours: data.colours
|
|
46
|
+
}] })
|
|
47
|
+
}]
|
|
48
|
+
});
|
|
49
|
+
export { COLOUR_PALETTE_COLLECTION_SCHEMA_VERSION, COLOUR_PALETTE_COLLECTION_TYPE, COLOUR_PALETTE_SCHEMA_VERSION, COLOUR_PALETTE_TYPE, DEFAULT_PALETTE, HEX_COLOUR_PATTERN, LEGACY_PALETTE_NAME, MAX_PALETTES_PER_FILE, MAX_PALETTE_COLOURS, MAX_PALETTE_NAME_LENGTH, colourPaletteCollectionSchema, colourPaletteFile, colourPaletteSchema, paletteColoursSchema };
|