@lvl99dotcom/paintcanvas 0.3.0 → 0.4.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.
Files changed (98) hide show
  1. package/README.md +1 -1
  2. package/dist/lib/brushes/StrokeEngine/index.d.ts +2 -2
  3. package/dist/lib/brushes/StrokeEngine/index.js +26 -28
  4. package/dist/lib/classes/BrushSettings/index.d.ts +24 -0
  5. package/dist/lib/classes/BrushSettings/index.js +35 -1
  6. package/dist/lib/classes/KeyboardShortcuts/index.d.ts +17 -6
  7. package/dist/lib/classes/KeyboardShortcuts/index.js +81 -18
  8. package/dist/lib/classes/PaintCanvas/index.d.ts +77 -27
  9. package/dist/lib/classes/PaintCanvas/index.js +143 -42
  10. package/dist/lib/classes/PaintCanvas/tool.d.ts +15 -0
  11. package/dist/lib/classes/PaintCanvas/tool.js +18 -0
  12. package/dist/lib/classes/Palette/index.d.ts +58 -0
  13. package/dist/lib/classes/Palette/index.js +92 -0
  14. package/dist/lib/classes/SettingsAutosave/index.d.ts +52 -0
  15. package/dist/lib/classes/SettingsAutosave/index.js +96 -0
  16. package/dist/lib/classes/ShortcutSettings/index.d.ts +63 -0
  17. package/dist/lib/classes/ShortcutSettings/index.js +110 -0
  18. package/dist/lib/palette/index.d.ts +49 -0
  19. package/dist/lib/palette/index.js +82 -0
  20. package/dist/lib/palette/schema.d.ts +45 -0
  21. package/dist/lib/palette/schema.js +41 -0
  22. package/dist/lib/rendering/cursors/index.d.ts +2 -0
  23. package/dist/lib/rendering/cursors/index.js +3 -1
  24. package/dist/lib/rendering/sample/index.js +3 -2
  25. package/dist/lib/settings/index.d.ts +63 -0
  26. package/dist/lib/settings/index.js +91 -0
  27. package/dist/lib/settings/schema.d.ts +150 -0
  28. package/dist/lib/settings/schema.js +102 -0
  29. package/dist/lib/storage/index.d.ts +36 -5
  30. package/dist/lib/storage/index.js +87 -29
  31. package/dist/lib/utils/colour/index.d.ts +72 -0
  32. package/dist/lib/utils/colour/index.js +154 -0
  33. package/dist/lib/utils/shortcuts/index.d.ts +174 -11
  34. package/dist/lib/utils/shortcuts/index.js +391 -145
  35. package/dist/lib/validation/validators.generated.d.ts +5 -0
  36. package/dist/lib/validation/validators.generated.js +872 -1
  37. package/dist/locales/en-GB.js +87 -1
  38. package/dist/locales/en-US.js +87 -1
  39. package/dist/locales/fr.js +87 -1
  40. package/dist/locales/ja.js +87 -1
  41. package/dist/locales/ko.js +87 -1
  42. package/dist/locales/zh-Hans.js +87 -1
  43. package/dist/locales/zh-Hant.js +87 -1
  44. package/dist/package.js +1 -1
  45. package/dist/ui/elements/PaintCanvas/index.d.ts +49 -47
  46. package/dist/ui/elements/PaintCanvas/index.js +128 -169
  47. package/dist/ui/elements/PaintCanvas/style.js +1 -1
  48. package/dist/ui/elements/PcAppSettings/index.d.ts +59 -0
  49. package/dist/ui/elements/PcAppSettings/index.js +222 -0
  50. package/dist/ui/elements/PcBrushConfig/index.js +1 -0
  51. package/dist/ui/elements/PcButton/index.js +1 -0
  52. package/dist/ui/elements/PcCanvas/index.d.ts +1 -1
  53. package/dist/ui/elements/PcCanvas/index.js +7 -5
  54. package/dist/ui/elements/PcColourPair/index.d.ts +43 -0
  55. package/dist/ui/elements/PcColourPair/index.js +125 -0
  56. package/dist/ui/elements/PcContextMenu/index.d.ts +70 -33
  57. package/dist/ui/elements/PcContextMenu/index.js +128 -97
  58. package/dist/ui/elements/PcDialog/index.js +1 -0
  59. package/dist/ui/elements/PcIconToggle/index.js +1 -0
  60. package/dist/ui/elements/PcLayerItem/index.d.ts +13 -34
  61. package/dist/ui/elements/PcLayerItem/index.js +39 -91
  62. package/dist/ui/elements/PcLayerItem/style.js +1 -1
  63. package/dist/ui/elements/PcMenu/index.d.ts +93 -0
  64. package/dist/ui/elements/PcMenu/index.js +204 -0
  65. package/dist/ui/elements/PcPane/index.d.ts +118 -0
  66. package/dist/ui/elements/PcPane/index.js +357 -0
  67. package/dist/ui/elements/PcPanel/index.d.ts +26 -8
  68. package/dist/ui/elements/PcPanel/index.js +76 -8
  69. package/dist/ui/elements/{PcBrushMenu → PcPanelBrushes}/index.d.ts +20 -6
  70. package/dist/ui/elements/{PcBrushMenu → PcPanelBrushes}/index.js +20 -15
  71. package/dist/ui/elements/PcPanelBrushes/style.js +3 -0
  72. package/dist/ui/elements/PcPanelColours/index.d.ts +171 -0
  73. package/dist/ui/elements/PcPanelColours/index.js +650 -0
  74. package/dist/ui/elements/PcPanelColours/style.js +3 -0
  75. package/dist/ui/elements/{PcLayersMenu → PcPanelLayers}/index.d.ts +17 -4
  76. package/dist/ui/elements/{PcLayersMenu → PcPanelLayers}/index.js +17 -10
  77. package/dist/ui/elements/PcPanelLayers/style.js +3 -0
  78. package/dist/ui/elements/PcShortcutSettings/index.d.ts +69 -0
  79. package/dist/ui/elements/PcShortcutSettings/index.js +273 -0
  80. package/dist/ui/elements/PcThemePicker/index.js +1 -0
  81. package/dist/ui/elements/PcToast/index.js +1 -0
  82. package/dist/ui/elements/PcToolSettings/index.js +2 -1
  83. package/dist/ui/elements/PcToolbar/index.d.ts +47 -12
  84. package/dist/ui/elements/PcToolbar/index.js +77 -56
  85. package/dist/ui/elements/PcToolbar/style.js +1 -1
  86. package/dist/ui/index.d.ts +7 -1
  87. package/dist/ui/index.js +8 -2
  88. package/dist/ui/tokens/index.js +3 -1
  89. package/locales/en-GB.json +87 -1
  90. package/locales/en-US.json +87 -1
  91. package/locales/fr.json +87 -1
  92. package/locales/ja.json +87 -1
  93. package/locales/ko.json +87 -1
  94. package/locales/zh-Hans.json +87 -1
  95. package/locales/zh-Hant.json +87 -1
  96. package/package.json +1 -1
  97. package/dist/ui/elements/PcBrushMenu/style.js +0 -3
  98. package/dist/ui/elements/PcLayersMenu/style.js +0 -3
@@ -19823,4 +19823,875 @@ function validate15(data, { instancePath = "", parentData, parentDataProperty, r
19823
19823
  validate15.errors = vErrors;
19824
19824
  return true;
19825
19825
  }
19826
- export { validateBrushPreset, validateBrushPresetFile, validateDocument, validateHistoryMessage, validatePatchMessage, validateStrokeMessage };
19826
+ var validatePaletteFile = validate16;
19827
+ function validate16(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
19828
+ let vErrors = null;
19829
+ if (data && typeof data == "object" && !Array.isArray(data)) {
19830
+ let missing0;
19831
+ if (data.format === void 0 && (missing0 = "format") || data.version === void 0 && (missing0 = "version") || data.colours === void 0 && (missing0 = "colours")) {
19832
+ validate16.errors = [{
19833
+ instancePath,
19834
+ schemaPath: "#/required",
19835
+ keyword: "required",
19836
+ params: { missingProperty: missing0 },
19837
+ message: "must have required property '" + missing0 + "'"
19838
+ }];
19839
+ return false;
19840
+ } else {
19841
+ for (const key0 in data) if (!(key0 === "format" || key0 === "version" || key0 === "colours")) {
19842
+ validate16.errors = [{
19843
+ instancePath,
19844
+ schemaPath: "#/additionalProperties",
19845
+ keyword: "additionalProperties",
19846
+ params: { additionalProperty: key0 },
19847
+ message: "must NOT have additional properties"
19848
+ }];
19849
+ return false;
19850
+ }
19851
+ if (data.format !== void 0) {
19852
+ let data0 = data.format;
19853
+ if (typeof data0 === "string") {
19854
+ if (data0.length > 100) {
19855
+ validate16.errors = [{
19856
+ instancePath: instancePath + "/format",
19857
+ schemaPath: "#/properties/format/maxLength",
19858
+ keyword: "maxLength",
19859
+ params: { limit: 100 },
19860
+ message: "must NOT have more than 100 characters"
19861
+ }];
19862
+ return false;
19863
+ } else if (data0.length < 1) {
19864
+ validate16.errors = [{
19865
+ instancePath: instancePath + "/format",
19866
+ schemaPath: "#/properties/format/minLength",
19867
+ keyword: "minLength",
19868
+ params: { limit: 1 },
19869
+ message: "must NOT have fewer than 1 characters"
19870
+ }];
19871
+ return false;
19872
+ }
19873
+ } else {
19874
+ validate16.errors = [{
19875
+ instancePath: instancePath + "/format",
19876
+ schemaPath: "#/properties/format/type",
19877
+ keyword: "type",
19878
+ params: { type: "string" },
19879
+ message: "must be string"
19880
+ }];
19881
+ return false;
19882
+ }
19883
+ var valid0 = true;
19884
+ } else var valid0 = true;
19885
+ if (valid0) {
19886
+ if (data.version !== void 0) {
19887
+ if (1 !== data.version) {
19888
+ validate16.errors = [{
19889
+ instancePath: instancePath + "/version",
19890
+ schemaPath: "#/properties/version/const",
19891
+ keyword: "const",
19892
+ params: { allowedValue: 1 },
19893
+ message: "must be equal to constant"
19894
+ }];
19895
+ return false;
19896
+ }
19897
+ var valid0 = true;
19898
+ } else var valid0 = true;
19899
+ if (valid0) {
19900
+ if (data.colours !== void 0) {
19901
+ let data2 = data.colours;
19902
+ if (Array.isArray(data2)) {
19903
+ if (data2.length > 1e3) {
19904
+ validate16.errors = [{
19905
+ instancePath: instancePath + "/colours",
19906
+ schemaPath: "#/properties/colours/maxItems",
19907
+ keyword: "maxItems",
19908
+ params: { limit: 1e3 },
19909
+ message: "must NOT have more than 1000 items"
19910
+ }];
19911
+ return false;
19912
+ } else {
19913
+ const len0 = data2.length;
19914
+ for (let i0 = 0; i0 < len0; i0++) {
19915
+ let data3 = data2[i0];
19916
+ if (typeof data3 === "string") {
19917
+ if (!pattern7.test(data3)) {
19918
+ validate16.errors = [{
19919
+ instancePath: instancePath + "/colours/" + i0,
19920
+ schemaPath: "#/properties/colours/items/pattern",
19921
+ keyword: "pattern",
19922
+ params: { pattern: "^#[0-9a-fA-F]{6}$" },
19923
+ message: "must match pattern \"^#[0-9a-fA-F]{6}$\""
19924
+ }];
19925
+ return false;
19926
+ }
19927
+ } else {
19928
+ validate16.errors = [{
19929
+ instancePath: instancePath + "/colours/" + i0,
19930
+ schemaPath: "#/properties/colours/items/type",
19931
+ keyword: "type",
19932
+ params: { type: "string" },
19933
+ message: "must be string"
19934
+ }];
19935
+ return false;
19936
+ }
19937
+ }
19938
+ }
19939
+ } else {
19940
+ validate16.errors = [{
19941
+ instancePath: instancePath + "/colours",
19942
+ schemaPath: "#/properties/colours/type",
19943
+ keyword: "type",
19944
+ params: { type: "array" },
19945
+ message: "must be array"
19946
+ }];
19947
+ return false;
19948
+ }
19949
+ var valid0 = true;
19950
+ } else var valid0 = true;
19951
+ }
19952
+ }
19953
+ }
19954
+ } else {
19955
+ validate16.errors = [{
19956
+ instancePath,
19957
+ schemaPath: "#/type",
19958
+ keyword: "type",
19959
+ params: { type: "object" },
19960
+ message: "must be object"
19961
+ }];
19962
+ return false;
19963
+ }
19964
+ validate16.errors = vErrors;
19965
+ return true;
19966
+ }
19967
+ var validateSettings = validate17;
19968
+ function validate17(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
19969
+ let vErrors = null;
19970
+ let errors = 0;
19971
+ if (errors === 0) {
19972
+ if (data && typeof data == "object" && !Array.isArray(data)) {
19973
+ const _errs1 = errors;
19974
+ for (const key0 in data) if (!(key0 === "input" || key0 === "shortcuts" || key0 === "palette" || key0 === "colours")) {
19975
+ validate17.errors = [{
19976
+ instancePath,
19977
+ schemaPath: "#/additionalProperties",
19978
+ keyword: "additionalProperties",
19979
+ params: { additionalProperty: key0 },
19980
+ message: "must NOT have additional properties"
19981
+ }];
19982
+ return false;
19983
+ }
19984
+ if (_errs1 === errors) {
19985
+ if (data.input !== void 0) {
19986
+ let data0 = data.input;
19987
+ const _errs2 = errors;
19988
+ if (errors === _errs2) {
19989
+ if (data0 && typeof data0 == "object" && !Array.isArray(data0)) {
19990
+ const _errs4 = errors;
19991
+ for (const key1 in data0) if (!(key1 === "scrollPan" || key1 === "pinchZoom" || key1 === "modifierScrollZoom" || key1 === "focusPen" || key1 === "gestures")) {
19992
+ validate17.errors = [{
19993
+ instancePath: instancePath + "/input",
19994
+ schemaPath: "#/properties/input/additionalProperties",
19995
+ keyword: "additionalProperties",
19996
+ params: { additionalProperty: key1 },
19997
+ message: "must NOT have additional properties"
19998
+ }];
19999
+ return false;
20000
+ }
20001
+ if (_errs4 === errors) {
20002
+ if (data0.scrollPan !== void 0) {
20003
+ const _errs5 = errors;
20004
+ if (typeof data0.scrollPan !== "boolean") {
20005
+ validate17.errors = [{
20006
+ instancePath: instancePath + "/input/scrollPan",
20007
+ schemaPath: "#/properties/input/properties/scrollPan/type",
20008
+ keyword: "type",
20009
+ params: { type: "boolean" },
20010
+ message: "must be boolean"
20011
+ }];
20012
+ return false;
20013
+ }
20014
+ var valid1 = _errs5 === errors;
20015
+ } else var valid1 = true;
20016
+ if (valid1) {
20017
+ if (data0.pinchZoom !== void 0) {
20018
+ const _errs7 = errors;
20019
+ if (typeof data0.pinchZoom !== "boolean") {
20020
+ validate17.errors = [{
20021
+ instancePath: instancePath + "/input/pinchZoom",
20022
+ schemaPath: "#/properties/input/properties/pinchZoom/type",
20023
+ keyword: "type",
20024
+ params: { type: "boolean" },
20025
+ message: "must be boolean"
20026
+ }];
20027
+ return false;
20028
+ }
20029
+ var valid1 = _errs7 === errors;
20030
+ } else var valid1 = true;
20031
+ if (valid1) {
20032
+ if (data0.modifierScrollZoom !== void 0) {
20033
+ const _errs9 = errors;
20034
+ if (typeof data0.modifierScrollZoom !== "boolean") {
20035
+ validate17.errors = [{
20036
+ instancePath: instancePath + "/input/modifierScrollZoom",
20037
+ schemaPath: "#/properties/input/properties/modifierScrollZoom/type",
20038
+ keyword: "type",
20039
+ params: { type: "boolean" },
20040
+ message: "must be boolean"
20041
+ }];
20042
+ return false;
20043
+ }
20044
+ var valid1 = _errs9 === errors;
20045
+ } else var valid1 = true;
20046
+ if (valid1) {
20047
+ if (data0.focusPen !== void 0) {
20048
+ const _errs11 = errors;
20049
+ if (typeof data0.focusPen !== "boolean") {
20050
+ validate17.errors = [{
20051
+ instancePath: instancePath + "/input/focusPen",
20052
+ schemaPath: "#/properties/input/properties/focusPen/type",
20053
+ keyword: "type",
20054
+ params: { type: "boolean" },
20055
+ message: "must be boolean"
20056
+ }];
20057
+ return false;
20058
+ }
20059
+ var valid1 = _errs11 === errors;
20060
+ } else var valid1 = true;
20061
+ if (valid1) {
20062
+ if (data0.gestures !== void 0) {
20063
+ let data5 = data0.gestures;
20064
+ const _errs13 = errors;
20065
+ if (errors === _errs13) {
20066
+ if (data5 && typeof data5 == "object" && !Array.isArray(data5)) {
20067
+ if (Object.keys(data5).length > 20) {
20068
+ validate17.errors = [{
20069
+ instancePath: instancePath + "/input/gestures",
20070
+ schemaPath: "#/properties/input/properties/gestures/maxProperties",
20071
+ keyword: "maxProperties",
20072
+ params: { limit: 20 },
20073
+ message: "must NOT have more than 20 properties"
20074
+ }];
20075
+ return false;
20076
+ } else for (const key2 in data5) {
20077
+ let data6 = data5[key2];
20078
+ const _errs16 = errors;
20079
+ if (errors === _errs16) {
20080
+ if (typeof data6 === "string") {
20081
+ if (data6.length > 50) {
20082
+ validate17.errors = [{
20083
+ instancePath: instancePath + "/input/gestures/" + key2.replace(/~/g, "~0").replace(/\//g, "~1"),
20084
+ schemaPath: "#/properties/input/properties/gestures/additionalProperties/maxLength",
20085
+ keyword: "maxLength",
20086
+ params: { limit: 50 },
20087
+ message: "must NOT have more than 50 characters"
20088
+ }];
20089
+ return false;
20090
+ }
20091
+ } else {
20092
+ validate17.errors = [{
20093
+ instancePath: instancePath + "/input/gestures/" + key2.replace(/~/g, "~0").replace(/\//g, "~1"),
20094
+ schemaPath: "#/properties/input/properties/gestures/additionalProperties/type",
20095
+ keyword: "type",
20096
+ params: { type: "string" },
20097
+ message: "must be string"
20098
+ }];
20099
+ return false;
20100
+ }
20101
+ }
20102
+ if (!(_errs16 === errors)) break;
20103
+ }
20104
+ } else {
20105
+ validate17.errors = [{
20106
+ instancePath: instancePath + "/input/gestures",
20107
+ schemaPath: "#/properties/input/properties/gestures/type",
20108
+ keyword: "type",
20109
+ params: { type: "object" },
20110
+ message: "must be object"
20111
+ }];
20112
+ return false;
20113
+ }
20114
+ }
20115
+ var valid1 = _errs13 === errors;
20116
+ } else var valid1 = true;
20117
+ }
20118
+ }
20119
+ }
20120
+ }
20121
+ }
20122
+ } else {
20123
+ validate17.errors = [{
20124
+ instancePath: instancePath + "/input",
20125
+ schemaPath: "#/properties/input/type",
20126
+ keyword: "type",
20127
+ params: { type: "object" },
20128
+ message: "must be object"
20129
+ }];
20130
+ return false;
20131
+ }
20132
+ }
20133
+ var valid0 = _errs2 === errors;
20134
+ } else var valid0 = true;
20135
+ if (valid0) {
20136
+ if (data.shortcuts !== void 0) {
20137
+ let data7 = data.shortcuts;
20138
+ const _errs18 = errors;
20139
+ if (errors === _errs18) {
20140
+ if (data7 && typeof data7 == "object" && !Array.isArray(data7)) {
20141
+ if (Object.keys(data7).length > 200) {
20142
+ validate17.errors = [{
20143
+ instancePath: instancePath + "/shortcuts",
20144
+ schemaPath: "#/properties/shortcuts/maxProperties",
20145
+ keyword: "maxProperties",
20146
+ params: { limit: 200 },
20147
+ message: "must NOT have more than 200 properties"
20148
+ }];
20149
+ return false;
20150
+ } else {
20151
+ for (const key3 in data7) {
20152
+ const _errs20 = errors;
20153
+ if (typeof key3 === "string") {
20154
+ if (key3.length > 64) {
20155
+ const err0 = {
20156
+ instancePath: instancePath + "/shortcuts",
20157
+ schemaPath: "#/properties/shortcuts/propertyNames/maxLength",
20158
+ keyword: "maxLength",
20159
+ params: { limit: 64 },
20160
+ message: "must NOT have more than 64 characters",
20161
+ propertyName: key3
20162
+ };
20163
+ if (vErrors === null) vErrors = [err0];
20164
+ else vErrors.push(err0);
20165
+ errors++;
20166
+ }
20167
+ }
20168
+ var valid3 = _errs20 === errors;
20169
+ if (!valid3) {
20170
+ const err1 = {
20171
+ instancePath: instancePath + "/shortcuts",
20172
+ schemaPath: "#/properties/shortcuts/propertyNames",
20173
+ keyword: "propertyNames",
20174
+ params: { propertyName: key3 },
20175
+ message: "property name must be valid"
20176
+ };
20177
+ if (vErrors === null) vErrors = [err1];
20178
+ else vErrors.push(err1);
20179
+ errors++;
20180
+ validate17.errors = vErrors;
20181
+ return false;
20182
+ }
20183
+ }
20184
+ if (valid3) for (const key4 in data7) {
20185
+ let data8 = data7[key4];
20186
+ const _errs22 = errors;
20187
+ const _errs23 = errors;
20188
+ let valid5 = false;
20189
+ const _errs24 = errors;
20190
+ if (data8 !== null) {
20191
+ const err2 = {
20192
+ instancePath: instancePath + "/shortcuts/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"),
20193
+ schemaPath: "#/properties/shortcuts/additionalProperties/anyOf/0/type",
20194
+ keyword: "type",
20195
+ params: { type: "null" },
20196
+ message: "must be null"
20197
+ };
20198
+ if (vErrors === null) vErrors = [err2];
20199
+ else vErrors.push(err2);
20200
+ errors++;
20201
+ }
20202
+ var _valid0 = _errs24 === errors;
20203
+ valid5 = valid5 || _valid0;
20204
+ if (!valid5) {
20205
+ const _errs26 = errors;
20206
+ if (errors === errors) {
20207
+ if (data8 && typeof data8 == "object" && !Array.isArray(data8)) {
20208
+ let missing0;
20209
+ if (data8.key === void 0 && (missing0 = "key")) {
20210
+ const err3 = {
20211
+ instancePath: instancePath + "/shortcuts/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"),
20212
+ schemaPath: "key-combo/required",
20213
+ keyword: "required",
20214
+ params: { missingProperty: missing0 },
20215
+ message: "must have required property '" + missing0 + "'"
20216
+ };
20217
+ if (vErrors === null) vErrors = [err3];
20218
+ else vErrors.push(err3);
20219
+ errors++;
20220
+ } else {
20221
+ const _errs29 = errors;
20222
+ for (const key5 in data8) if (!(key5 === "key" || key5 === "cmd" || key5 === "ctrl" || key5 === "shift" || key5 === "alt")) {
20223
+ const err4 = {
20224
+ instancePath: instancePath + "/shortcuts/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"),
20225
+ schemaPath: "key-combo/additionalProperties",
20226
+ keyword: "additionalProperties",
20227
+ params: { additionalProperty: key5 },
20228
+ message: "must NOT have additional properties"
20229
+ };
20230
+ if (vErrors === null) vErrors = [err4];
20231
+ else vErrors.push(err4);
20232
+ errors++;
20233
+ break;
20234
+ }
20235
+ if (_errs29 === errors) {
20236
+ if (data8.key !== void 0) {
20237
+ let data9 = data8.key;
20238
+ const _errs30 = errors;
20239
+ if (errors === _errs30) {
20240
+ if (typeof data9 === "string") {
20241
+ if (data9.length > 32) {
20242
+ const err5 = {
20243
+ instancePath: instancePath + "/shortcuts/" + key4.replace(/~/g, "~0").replace(/\//g, "~1") + "/key",
20244
+ schemaPath: "key-combo/properties/key/maxLength",
20245
+ keyword: "maxLength",
20246
+ params: { limit: 32 },
20247
+ message: "must NOT have more than 32 characters"
20248
+ };
20249
+ if (vErrors === null) vErrors = [err5];
20250
+ else vErrors.push(err5);
20251
+ errors++;
20252
+ } else if (data9.length < 1) {
20253
+ const err6 = {
20254
+ instancePath: instancePath + "/shortcuts/" + key4.replace(/~/g, "~0").replace(/\//g, "~1") + "/key",
20255
+ schemaPath: "key-combo/properties/key/minLength",
20256
+ keyword: "minLength",
20257
+ params: { limit: 1 },
20258
+ message: "must NOT have fewer than 1 characters"
20259
+ };
20260
+ if (vErrors === null) vErrors = [err6];
20261
+ else vErrors.push(err6);
20262
+ errors++;
20263
+ }
20264
+ } else {
20265
+ const err7 = {
20266
+ instancePath: instancePath + "/shortcuts/" + key4.replace(/~/g, "~0").replace(/\//g, "~1") + "/key",
20267
+ schemaPath: "key-combo/properties/key/type",
20268
+ keyword: "type",
20269
+ params: { type: "string" },
20270
+ message: "must be string"
20271
+ };
20272
+ if (vErrors === null) vErrors = [err7];
20273
+ else vErrors.push(err7);
20274
+ errors++;
20275
+ }
20276
+ }
20277
+ var valid7 = _errs30 === errors;
20278
+ } else var valid7 = true;
20279
+ if (valid7) {
20280
+ if (data8.cmd !== void 0) {
20281
+ const _errs32 = errors;
20282
+ if (typeof data8.cmd !== "boolean") {
20283
+ const err8 = {
20284
+ instancePath: instancePath + "/shortcuts/" + key4.replace(/~/g, "~0").replace(/\//g, "~1") + "/cmd",
20285
+ schemaPath: "key-combo/properties/cmd/type",
20286
+ keyword: "type",
20287
+ params: { type: "boolean" },
20288
+ message: "must be boolean"
20289
+ };
20290
+ if (vErrors === null) vErrors = [err8];
20291
+ else vErrors.push(err8);
20292
+ errors++;
20293
+ }
20294
+ var valid7 = _errs32 === errors;
20295
+ } else var valid7 = true;
20296
+ if (valid7) {
20297
+ if (data8.ctrl !== void 0) {
20298
+ const _errs34 = errors;
20299
+ if (typeof data8.ctrl !== "boolean") {
20300
+ const err9 = {
20301
+ instancePath: instancePath + "/shortcuts/" + key4.replace(/~/g, "~0").replace(/\//g, "~1") + "/ctrl",
20302
+ schemaPath: "key-combo/properties/ctrl/type",
20303
+ keyword: "type",
20304
+ params: { type: "boolean" },
20305
+ message: "must be boolean"
20306
+ };
20307
+ if (vErrors === null) vErrors = [err9];
20308
+ else vErrors.push(err9);
20309
+ errors++;
20310
+ }
20311
+ var valid7 = _errs34 === errors;
20312
+ } else var valid7 = true;
20313
+ if (valid7) {
20314
+ if (data8.shift !== void 0) {
20315
+ const _errs36 = errors;
20316
+ if (typeof data8.shift !== "boolean") {
20317
+ const err10 = {
20318
+ instancePath: instancePath + "/shortcuts/" + key4.replace(/~/g, "~0").replace(/\//g, "~1") + "/shift",
20319
+ schemaPath: "key-combo/properties/shift/type",
20320
+ keyword: "type",
20321
+ params: { type: "boolean" },
20322
+ message: "must be boolean"
20323
+ };
20324
+ if (vErrors === null) vErrors = [err10];
20325
+ else vErrors.push(err10);
20326
+ errors++;
20327
+ }
20328
+ var valid7 = _errs36 === errors;
20329
+ } else var valid7 = true;
20330
+ if (valid7) {
20331
+ if (data8.alt !== void 0) {
20332
+ const _errs38 = errors;
20333
+ if (typeof data8.alt !== "boolean") {
20334
+ const err11 = {
20335
+ instancePath: instancePath + "/shortcuts/" + key4.replace(/~/g, "~0").replace(/\//g, "~1") + "/alt",
20336
+ schemaPath: "key-combo/properties/alt/type",
20337
+ keyword: "type",
20338
+ params: { type: "boolean" },
20339
+ message: "must be boolean"
20340
+ };
20341
+ if (vErrors === null) vErrors = [err11];
20342
+ else vErrors.push(err11);
20343
+ errors++;
20344
+ }
20345
+ var valid7 = _errs38 === errors;
20346
+ } else var valid7 = true;
20347
+ }
20348
+ }
20349
+ }
20350
+ }
20351
+ }
20352
+ }
20353
+ } else {
20354
+ const err12 = {
20355
+ instancePath: instancePath + "/shortcuts/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"),
20356
+ schemaPath: "key-combo/type",
20357
+ keyword: "type",
20358
+ params: { type: "object" },
20359
+ message: "must be object"
20360
+ };
20361
+ if (vErrors === null) vErrors = [err12];
20362
+ else vErrors.push(err12);
20363
+ errors++;
20364
+ }
20365
+ }
20366
+ var _valid0 = _errs26 === errors;
20367
+ valid5 = valid5 || _valid0;
20368
+ }
20369
+ if (!valid5) {
20370
+ const err13 = {
20371
+ instancePath: instancePath + "/shortcuts/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"),
20372
+ schemaPath: "#/properties/shortcuts/additionalProperties/anyOf",
20373
+ keyword: "anyOf",
20374
+ params: {},
20375
+ message: "must match a schema in anyOf"
20376
+ };
20377
+ if (vErrors === null) vErrors = [err13];
20378
+ else vErrors.push(err13);
20379
+ errors++;
20380
+ validate17.errors = vErrors;
20381
+ return false;
20382
+ } else {
20383
+ errors = _errs23;
20384
+ if (vErrors !== null) {
20385
+ if (_errs23) vErrors.length = _errs23;
20386
+ else vErrors = null;
20387
+ }
20388
+ }
20389
+ if (!(_errs22 === errors)) break;
20390
+ }
20391
+ }
20392
+ } else {
20393
+ validate17.errors = [{
20394
+ instancePath: instancePath + "/shortcuts",
20395
+ schemaPath: "#/properties/shortcuts/type",
20396
+ keyword: "type",
20397
+ params: { type: "object" },
20398
+ message: "must be object"
20399
+ }];
20400
+ return false;
20401
+ }
20402
+ }
20403
+ var valid0 = _errs18 === errors;
20404
+ } else var valid0 = true;
20405
+ if (valid0) {
20406
+ if (data.palette !== void 0) {
20407
+ let data14 = data.palette;
20408
+ const _errs40 = errors;
20409
+ if (errors === _errs40) {
20410
+ if (Array.isArray(data14)) {
20411
+ if (data14.length > 1e3) {
20412
+ validate17.errors = [{
20413
+ instancePath: instancePath + "/palette",
20414
+ schemaPath: "#/properties/palette/maxItems",
20415
+ keyword: "maxItems",
20416
+ params: { limit: 1e3 },
20417
+ message: "must NOT have more than 1000 items"
20418
+ }];
20419
+ return false;
20420
+ } else {
20421
+ const len0 = data14.length;
20422
+ for (let i0 = 0; i0 < len0; i0++) {
20423
+ let data15 = data14[i0];
20424
+ const _errs42 = errors;
20425
+ if (errors === _errs42) {
20426
+ if (typeof data15 === "string") {
20427
+ if (!pattern7.test(data15)) {
20428
+ validate17.errors = [{
20429
+ instancePath: instancePath + "/palette/" + i0,
20430
+ schemaPath: "#/properties/palette/items/pattern",
20431
+ keyword: "pattern",
20432
+ params: { pattern: "^#[0-9a-fA-F]{6}$" },
20433
+ message: "must match pattern \"^#[0-9a-fA-F]{6}$\""
20434
+ }];
20435
+ return false;
20436
+ }
20437
+ } else {
20438
+ validate17.errors = [{
20439
+ instancePath: instancePath + "/palette/" + i0,
20440
+ schemaPath: "#/properties/palette/items/type",
20441
+ keyword: "type",
20442
+ params: { type: "string" },
20443
+ message: "must be string"
20444
+ }];
20445
+ return false;
20446
+ }
20447
+ }
20448
+ if (!(_errs42 === errors)) break;
20449
+ }
20450
+ }
20451
+ } else {
20452
+ validate17.errors = [{
20453
+ instancePath: instancePath + "/palette",
20454
+ schemaPath: "#/properties/palette/type",
20455
+ keyword: "type",
20456
+ params: { type: "array" },
20457
+ message: "must be array"
20458
+ }];
20459
+ return false;
20460
+ }
20461
+ }
20462
+ var valid0 = _errs40 === errors;
20463
+ } else var valid0 = true;
20464
+ if (valid0) {
20465
+ if (data.colours !== void 0) {
20466
+ let data16 = data.colours;
20467
+ const _errs44 = errors;
20468
+ if (errors === _errs44) {
20469
+ if (data16 && typeof data16 == "object" && !Array.isArray(data16)) {
20470
+ let missing1;
20471
+ if (data16.foreground === void 0 && (missing1 = "foreground") || data16.background === void 0 && (missing1 = "background")) {
20472
+ validate17.errors = [{
20473
+ instancePath: instancePath + "/colours",
20474
+ schemaPath: "#/properties/colours/required",
20475
+ keyword: "required",
20476
+ params: { missingProperty: missing1 },
20477
+ message: "must have required property '" + missing1 + "'"
20478
+ }];
20479
+ return false;
20480
+ } else {
20481
+ const _errs46 = errors;
20482
+ for (const key6 in data16) if (!(key6 === "foreground" || key6 === "background")) {
20483
+ validate17.errors = [{
20484
+ instancePath: instancePath + "/colours",
20485
+ schemaPath: "#/properties/colours/additionalProperties",
20486
+ keyword: "additionalProperties",
20487
+ params: { additionalProperty: key6 },
20488
+ message: "must NOT have additional properties"
20489
+ }];
20490
+ return false;
20491
+ }
20492
+ if (_errs46 === errors) {
20493
+ if (data16.foreground !== void 0) {
20494
+ let data17 = data16.foreground;
20495
+ const _errs47 = errors;
20496
+ if (errors === _errs47) {
20497
+ if (typeof data17 === "string") {
20498
+ if (!pattern7.test(data17)) {
20499
+ validate17.errors = [{
20500
+ instancePath: instancePath + "/colours/foreground",
20501
+ schemaPath: "#/properties/colours/properties/foreground/pattern",
20502
+ keyword: "pattern",
20503
+ params: { pattern: "^#[0-9a-fA-F]{6}$" },
20504
+ message: "must match pattern \"^#[0-9a-fA-F]{6}$\""
20505
+ }];
20506
+ return false;
20507
+ }
20508
+ } else {
20509
+ validate17.errors = [{
20510
+ instancePath: instancePath + "/colours/foreground",
20511
+ schemaPath: "#/properties/colours/properties/foreground/type",
20512
+ keyword: "type",
20513
+ params: { type: "string" },
20514
+ message: "must be string"
20515
+ }];
20516
+ return false;
20517
+ }
20518
+ }
20519
+ var valid9 = _errs47 === errors;
20520
+ } else var valid9 = true;
20521
+ if (valid9) {
20522
+ if (data16.background !== void 0) {
20523
+ let data18 = data16.background;
20524
+ const _errs49 = errors;
20525
+ if (errors === _errs49) {
20526
+ if (typeof data18 === "string") {
20527
+ if (!pattern7.test(data18)) {
20528
+ validate17.errors = [{
20529
+ instancePath: instancePath + "/colours/background",
20530
+ schemaPath: "#/properties/colours/properties/background/pattern",
20531
+ keyword: "pattern",
20532
+ params: { pattern: "^#[0-9a-fA-F]{6}$" },
20533
+ message: "must match pattern \"^#[0-9a-fA-F]{6}$\""
20534
+ }];
20535
+ return false;
20536
+ }
20537
+ } else {
20538
+ validate17.errors = [{
20539
+ instancePath: instancePath + "/colours/background",
20540
+ schemaPath: "#/properties/colours/properties/background/type",
20541
+ keyword: "type",
20542
+ params: { type: "string" },
20543
+ message: "must be string"
20544
+ }];
20545
+ return false;
20546
+ }
20547
+ }
20548
+ var valid9 = _errs49 === errors;
20549
+ } else var valid9 = true;
20550
+ }
20551
+ }
20552
+ }
20553
+ } else {
20554
+ validate17.errors = [{
20555
+ instancePath: instancePath + "/colours",
20556
+ schemaPath: "#/properties/colours/type",
20557
+ keyword: "type",
20558
+ params: { type: "object" },
20559
+ message: "must be object"
20560
+ }];
20561
+ return false;
20562
+ }
20563
+ }
20564
+ var valid0 = _errs44 === errors;
20565
+ } else var valid0 = true;
20566
+ }
20567
+ }
20568
+ }
20569
+ }
20570
+ } else {
20571
+ validate17.errors = [{
20572
+ instancePath,
20573
+ schemaPath: "#/type",
20574
+ keyword: "type",
20575
+ params: { type: "object" },
20576
+ message: "must be object"
20577
+ }];
20578
+ return false;
20579
+ }
20580
+ }
20581
+ validate17.errors = vErrors;
20582
+ return errors === 0;
20583
+ }
20584
+ var validateSettingsFile = validate18;
20585
+ function validate18(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
20586
+ let vErrors = null;
20587
+ let errors = 0;
20588
+ if (errors === 0) {
20589
+ if (data && typeof data == "object" && !Array.isArray(data)) {
20590
+ let missing0;
20591
+ if (data.format === void 0 && (missing0 = "format") || data.version === void 0 && (missing0 = "version") || data.settings === void 0 && (missing0 = "settings")) {
20592
+ validate18.errors = [{
20593
+ instancePath,
20594
+ schemaPath: "#/required",
20595
+ keyword: "required",
20596
+ params: { missingProperty: missing0 },
20597
+ message: "must have required property '" + missing0 + "'"
20598
+ }];
20599
+ return false;
20600
+ } else {
20601
+ const _errs1 = errors;
20602
+ for (const key0 in data) if (!(key0 === "format" || key0 === "version" || key0 === "settings")) {
20603
+ validate18.errors = [{
20604
+ instancePath,
20605
+ schemaPath: "#/additionalProperties",
20606
+ keyword: "additionalProperties",
20607
+ params: { additionalProperty: key0 },
20608
+ message: "must NOT have additional properties"
20609
+ }];
20610
+ return false;
20611
+ }
20612
+ if (_errs1 === errors) {
20613
+ if (data.format !== void 0) {
20614
+ let data0 = data.format;
20615
+ const _errs2 = errors;
20616
+ if (errors === _errs2) {
20617
+ if (typeof data0 === "string") {
20618
+ if (data0.length > 100) {
20619
+ validate18.errors = [{
20620
+ instancePath: instancePath + "/format",
20621
+ schemaPath: "#/properties/format/maxLength",
20622
+ keyword: "maxLength",
20623
+ params: { limit: 100 },
20624
+ message: "must NOT have more than 100 characters"
20625
+ }];
20626
+ return false;
20627
+ } else if (data0.length < 1) {
20628
+ validate18.errors = [{
20629
+ instancePath: instancePath + "/format",
20630
+ schemaPath: "#/properties/format/minLength",
20631
+ keyword: "minLength",
20632
+ params: { limit: 1 },
20633
+ message: "must NOT have fewer than 1 characters"
20634
+ }];
20635
+ return false;
20636
+ }
20637
+ } else {
20638
+ validate18.errors = [{
20639
+ instancePath: instancePath + "/format",
20640
+ schemaPath: "#/properties/format/type",
20641
+ keyword: "type",
20642
+ params: { type: "string" },
20643
+ message: "must be string"
20644
+ }];
20645
+ return false;
20646
+ }
20647
+ }
20648
+ var valid0 = _errs2 === errors;
20649
+ } else var valid0 = true;
20650
+ if (valid0) {
20651
+ if (data.version !== void 0) {
20652
+ const _errs4 = errors;
20653
+ if (1 !== data.version) {
20654
+ validate18.errors = [{
20655
+ instancePath: instancePath + "/version",
20656
+ schemaPath: "#/properties/version/const",
20657
+ keyword: "const",
20658
+ params: { allowedValue: 1 },
20659
+ message: "must be equal to constant"
20660
+ }];
20661
+ return false;
20662
+ }
20663
+ var valid0 = _errs4 === errors;
20664
+ } else var valid0 = true;
20665
+ if (valid0) {
20666
+ if (data.settings !== void 0) {
20667
+ const _errs5 = errors;
20668
+ if (!validate17(data.settings, {
20669
+ instancePath: instancePath + "/settings",
20670
+ parentData: data,
20671
+ parentDataProperty: "settings",
20672
+ rootData
20673
+ })) {
20674
+ vErrors = vErrors === null ? validate17.errors : vErrors.concat(validate17.errors);
20675
+ errors = vErrors.length;
20676
+ }
20677
+ var valid0 = _errs5 === errors;
20678
+ } else var valid0 = true;
20679
+ }
20680
+ }
20681
+ }
20682
+ }
20683
+ } else {
20684
+ validate18.errors = [{
20685
+ instancePath,
20686
+ schemaPath: "#/type",
20687
+ keyword: "type",
20688
+ params: { type: "object" },
20689
+ message: "must be object"
20690
+ }];
20691
+ return false;
20692
+ }
20693
+ }
20694
+ validate18.errors = vErrors;
20695
+ return errors === 0;
20696
+ }
20697
+ export { validateBrushPreset, validateBrushPresetFile, validateDocument, validateHistoryMessage, validatePaletteFile, validatePatchMessage, validateSettings, validateSettingsFile, validateStrokeMessage };