@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
|
@@ -1,37 +1,100 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { type AssetAuthor } from "../assets/schema.ts";
|
|
2
|
+
/** Version of the colour palette schema */
|
|
3
|
+
export declare const COLOUR_PALETTE_SCHEMA_VERSION = "1.0.0";
|
|
4
|
+
/** `@type` of a colour palette */
|
|
5
|
+
export declare const COLOUR_PALETTE_TYPE = "PaintCanvas/ColourPalette";
|
|
6
|
+
/** Version of the colour palette collection schema */
|
|
7
|
+
export declare const COLOUR_PALETTE_COLLECTION_SCHEMA_VERSION = "1.0.0";
|
|
8
|
+
/** `@type` of a colour palette collection file */
|
|
9
|
+
export declare const COLOUR_PALETTE_COLLECTION_TYPE = "PaintCanvas/ColourPaletteCollection";
|
|
10
|
+
/** Most colours in a palette */
|
|
8
11
|
export declare const MAX_PALETTE_COLOURS = 1000;
|
|
9
|
-
/**
|
|
10
|
-
export declare const
|
|
12
|
+
/** Most palettes in one file */
|
|
13
|
+
export declare const MAX_PALETTES_PER_FILE = 100;
|
|
14
|
+
/** Longest palette name (characters) */
|
|
15
|
+
export declare const MAX_PALETTE_NAME_LENGTH = 100;
|
|
11
16
|
/** Matches a `#rrggbb` colour in any case */
|
|
12
17
|
export declare const HEX_COLOUR_PATTERN = "^#[0-9a-fA-F]{6}$";
|
|
13
|
-
/** A
|
|
14
|
-
export interface
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
/** A named list of colours */
|
|
19
|
+
export interface ColourPalette {
|
|
20
|
+
/** A UUID for the user's own palettes; a readable ID for built-in ones */
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
author?: AssetAuthor;
|
|
24
|
+
/** Colours as `#rrggbb`, in order */
|
|
19
25
|
colours: string[];
|
|
20
26
|
}
|
|
21
|
-
/** Schema of a
|
|
22
|
-
export declare const
|
|
23
|
-
readonly
|
|
27
|
+
/** Schema of a palette's colours */
|
|
28
|
+
export declare const paletteColoursSchema: {
|
|
29
|
+
readonly type: "array";
|
|
30
|
+
readonly maxItems: 1000;
|
|
31
|
+
readonly items: {
|
|
32
|
+
readonly type: "string";
|
|
33
|
+
readonly pattern: "^#[0-9a-fA-F]{6}$";
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
/** Schema of a colour palette */
|
|
37
|
+
export declare const colourPaletteSchema: {
|
|
38
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
39
|
+
readonly $id: string;
|
|
40
|
+
readonly "@type": "PaintCanvas/ColourPalette";
|
|
24
41
|
readonly type: "object";
|
|
25
42
|
readonly additionalProperties: false;
|
|
26
|
-
readonly required: readonly ["
|
|
43
|
+
readonly required: readonly ["id", "name", "colours"];
|
|
27
44
|
readonly properties: {
|
|
28
|
-
readonly
|
|
45
|
+
readonly $schema: {
|
|
46
|
+
readonly type: "string";
|
|
47
|
+
readonly minLength: 1;
|
|
48
|
+
readonly maxLength: 2048;
|
|
49
|
+
};
|
|
50
|
+
readonly "@type": {
|
|
51
|
+
readonly const: "PaintCanvas/ColourPalette";
|
|
52
|
+
};
|
|
53
|
+
readonly id: {
|
|
54
|
+
readonly type: "string";
|
|
55
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
56
|
+
};
|
|
57
|
+
readonly name: {
|
|
29
58
|
readonly type: "string";
|
|
30
59
|
readonly minLength: 1;
|
|
31
60
|
readonly maxLength: 100;
|
|
61
|
+
readonly pattern: "\\S";
|
|
32
62
|
};
|
|
33
|
-
readonly
|
|
34
|
-
readonly
|
|
63
|
+
readonly author: {
|
|
64
|
+
readonly anyOf: readonly [{
|
|
65
|
+
readonly type: "string";
|
|
66
|
+
readonly minLength: 1;
|
|
67
|
+
readonly maxLength: 100;
|
|
68
|
+
}, {
|
|
69
|
+
readonly type: "object";
|
|
70
|
+
readonly additionalProperties: false;
|
|
71
|
+
readonly required: readonly ["name"];
|
|
72
|
+
readonly properties: {
|
|
73
|
+
readonly did: {
|
|
74
|
+
readonly type: "string";
|
|
75
|
+
readonly maxLength: 2048;
|
|
76
|
+
readonly pattern: "^did:[a-z]+:[a-zA-Z0-9._:%-]+$";
|
|
77
|
+
};
|
|
78
|
+
readonly name: {
|
|
79
|
+
readonly type: "string";
|
|
80
|
+
readonly minLength: 1;
|
|
81
|
+
readonly maxLength: 100;
|
|
82
|
+
};
|
|
83
|
+
readonly handle: {
|
|
84
|
+
readonly type: "string";
|
|
85
|
+
readonly minLength: 1;
|
|
86
|
+
readonly maxLength: 100;
|
|
87
|
+
};
|
|
88
|
+
readonly email: {
|
|
89
|
+
readonly type: "string";
|
|
90
|
+
readonly maxLength: 254;
|
|
91
|
+
};
|
|
92
|
+
readonly homepage: {
|
|
93
|
+
readonly type: "string";
|
|
94
|
+
readonly maxLength: 2048;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
}];
|
|
35
98
|
};
|
|
36
99
|
readonly colours: {
|
|
37
100
|
readonly type: "array";
|
|
@@ -43,3 +106,29 @@ export declare const paletteFileSchema: {
|
|
|
43
106
|
};
|
|
44
107
|
};
|
|
45
108
|
};
|
|
109
|
+
/** Schema of a colour palette collection file */
|
|
110
|
+
export declare const colourPaletteCollectionSchema: {
|
|
111
|
+
$schema: string;
|
|
112
|
+
$id: string;
|
|
113
|
+
"@type": string;
|
|
114
|
+
type: string;
|
|
115
|
+
additionalProperties: boolean;
|
|
116
|
+
required: string[];
|
|
117
|
+
properties: {
|
|
118
|
+
$schema: {
|
|
119
|
+
readonly type: "string";
|
|
120
|
+
readonly minLength: 1;
|
|
121
|
+
readonly maxLength: 2048;
|
|
122
|
+
};
|
|
123
|
+
"@type": {
|
|
124
|
+
const: string;
|
|
125
|
+
};
|
|
126
|
+
items: {
|
|
127
|
+
type: string;
|
|
128
|
+
maxItems: number;
|
|
129
|
+
items: {
|
|
130
|
+
$ref: string;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
};
|
|
@@ -1,41 +1,66 @@
|
|
|
1
|
+
import { UUID_PATTERN, authorSchema, collectionSchema, fileSchemaUrlSchema } from "../assets/schema.js";
|
|
2
|
+
import { SCHEMA_DIALECT, schemaUrl } from "../schemas/index.js";
|
|
1
3
|
// src/lib/palette/schema.ts
|
|
2
|
-
/**
|
|
3
|
-
var
|
|
4
|
-
/**
|
|
5
|
-
var
|
|
6
|
-
/**
|
|
7
|
-
var
|
|
8
|
-
/**
|
|
4
|
+
/** Version of the colour palette schema */
|
|
5
|
+
var COLOUR_PALETTE_SCHEMA_VERSION = "1.0.0";
|
|
6
|
+
/** `@type` of a colour palette */
|
|
7
|
+
var COLOUR_PALETTE_TYPE = "PaintCanvas/ColourPalette";
|
|
8
|
+
/** Version of the colour palette collection schema */
|
|
9
|
+
var COLOUR_PALETTE_COLLECTION_SCHEMA_VERSION = "1.0.0";
|
|
10
|
+
/** `@type` of a colour palette collection file */
|
|
11
|
+
var COLOUR_PALETTE_COLLECTION_TYPE = "PaintCanvas/ColourPaletteCollection";
|
|
12
|
+
/** Most colours in a palette */
|
|
9
13
|
var MAX_PALETTE_COLOURS = 1e3;
|
|
10
|
-
/**
|
|
11
|
-
var
|
|
14
|
+
/** Most palettes in one file */
|
|
15
|
+
var MAX_PALETTES_PER_FILE = 100;
|
|
16
|
+
/** Longest palette name (characters) */
|
|
17
|
+
var MAX_PALETTE_NAME_LENGTH = 100;
|
|
12
18
|
/** Matches a `#rrggbb` colour in any case */
|
|
13
19
|
var HEX_COLOUR_PATTERN = "^#[0-9a-fA-F]{6}$";
|
|
14
|
-
/** Schema of a
|
|
15
|
-
var
|
|
16
|
-
|
|
20
|
+
/** Schema of a palette's colours */
|
|
21
|
+
var paletteColoursSchema = {
|
|
22
|
+
type: "array",
|
|
23
|
+
maxItems: MAX_PALETTE_COLOURS,
|
|
24
|
+
items: {
|
|
25
|
+
type: "string",
|
|
26
|
+
pattern: HEX_COLOUR_PATTERN
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
/** Schema of a colour palette */
|
|
30
|
+
var colourPaletteSchema = {
|
|
31
|
+
$schema: SCHEMA_DIALECT,
|
|
32
|
+
$id: schemaUrl("colour-palette", COLOUR_PALETTE_SCHEMA_VERSION),
|
|
33
|
+
"@type": COLOUR_PALETTE_TYPE,
|
|
17
34
|
type: "object",
|
|
18
35
|
additionalProperties: false,
|
|
19
36
|
required: [
|
|
20
|
-
"
|
|
21
|
-
"
|
|
37
|
+
"id",
|
|
38
|
+
"name",
|
|
22
39
|
"colours"
|
|
23
40
|
],
|
|
24
41
|
properties: {
|
|
25
|
-
|
|
42
|
+
$schema: fileSchemaUrlSchema,
|
|
43
|
+
"@type": { const: COLOUR_PALETTE_TYPE },
|
|
44
|
+
id: {
|
|
45
|
+
type: "string",
|
|
46
|
+
pattern: UUID_PATTERN
|
|
47
|
+
},
|
|
48
|
+
name: {
|
|
26
49
|
type: "string",
|
|
27
50
|
minLength: 1,
|
|
28
|
-
maxLength: 100
|
|
51
|
+
maxLength: 100,
|
|
52
|
+
pattern: "\\S"
|
|
29
53
|
},
|
|
30
|
-
|
|
31
|
-
colours:
|
|
32
|
-
type: "array",
|
|
33
|
-
maxItems: MAX_PALETTE_COLOURS,
|
|
34
|
-
items: {
|
|
35
|
-
type: "string",
|
|
36
|
-
pattern: HEX_COLOUR_PATTERN
|
|
37
|
-
}
|
|
38
|
-
}
|
|
54
|
+
author: authorSchema,
|
|
55
|
+
colours: paletteColoursSchema
|
|
39
56
|
}
|
|
40
57
|
};
|
|
41
|
-
|
|
58
|
+
/** Schema of a colour palette collection file */
|
|
59
|
+
var colourPaletteCollectionSchema = collectionSchema({
|
|
60
|
+
name: "colour-palette-collection",
|
|
61
|
+
version: COLOUR_PALETTE_COLLECTION_SCHEMA_VERSION,
|
|
62
|
+
type: COLOUR_PALETTE_COLLECTION_TYPE,
|
|
63
|
+
item: colourPaletteSchema.$id,
|
|
64
|
+
maxItems: 100
|
|
65
|
+
});
|
|
66
|
+
export { 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 };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { BrushPresetFile } from "./schema";
|
|
2
1
|
import { type ValidationError } from "../validation/validators.generated.js";
|
|
3
2
|
export * from "./schema";
|
|
4
|
-
/** Result of validating a brush preset
|
|
3
|
+
/** Result of validating a brush preset */
|
|
5
4
|
export type PresetValidationResult<T> = {
|
|
6
5
|
valid: true;
|
|
7
6
|
value: T;
|
|
@@ -23,10 +22,3 @@ export declare const formatErrors: (errors: ValidationError[] | null | undefined
|
|
|
23
22
|
* isValidBrushPreset({ id: crypto.randomUUID(), name: "My brush" }).valid; // true
|
|
24
23
|
*/
|
|
25
24
|
export declare const isValidBrushPreset: (input: unknown) => PresetValidationResult<Record<string, unknown>>;
|
|
26
|
-
/**
|
|
27
|
-
* Check a brush preset file against `brushPresetFileSchema`.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* isValidBrushPresetFile({ format: "paintcanvas-brush-presets", version: 1, presets: [] }).valid; // true
|
|
31
|
-
*/
|
|
32
|
-
export declare const isValidBrushPresetFile: (input: unknown) => PresetValidationResult<BrushPresetFile>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { validateBrushPreset
|
|
2
|
-
import {
|
|
1
|
+
import { validateBrushPreset } from "../validation/validators.generated.js";
|
|
2
|
+
import { UUID_PATTERN } from "../assets/schema.js";
|
|
3
|
+
import { BRUSH_PRESET_COLLECTION_SCHEMA_VERSION, BRUSH_PRESET_COLLECTION_TYPE, BRUSH_PRESET_SCHEMA_VERSION, BRUSH_PRESET_TYPE, MAX_PRESETS_PER_FILE, MAX_PRESET_TEXT_LENGTH, MAX_SHAPE_DATA_URL_LENGTH, PNG_DATA_URL_PATTERN, brushPresetCollectionSchema, brushPresetSchema } from "./schema.js";
|
|
3
4
|
// src/lib/presets/index.ts
|
|
4
5
|
/**
|
|
5
6
|
* Turn validation errors into readable messages.
|
|
@@ -25,11 +26,4 @@ var check = (validate, input) => validate(input) ? {
|
|
|
25
26
|
* isValidBrushPreset({ id: crypto.randomUUID(), name: "My brush" }).valid; // true
|
|
26
27
|
*/
|
|
27
28
|
var isValidBrushPreset = (input) => check(validateBrushPreset, input);
|
|
28
|
-
|
|
29
|
-
* Check a brush preset file against `brushPresetFileSchema`.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* isValidBrushPresetFile({ format: "paintcanvas-brush-presets", version: 1, presets: [] }).valid; // true
|
|
33
|
-
*/
|
|
34
|
-
var isValidBrushPresetFile = (input) => check(validateBrushPresetFile, input);
|
|
35
|
-
export { BRUSH_PRESET_FILE_FORMAT, BRUSH_PRESET_FILE_FORMATS, BRUSH_PRESET_FILE_VERSION, MAX_PRESETS_PER_FILE, MAX_PRESET_FILE_FORMAT_LENGTH, MAX_PRESET_TEXT_LENGTH, MAX_SHAPE_DATA_URL_LENGTH, PNG_DATA_URL_PATTERN, UUID_PATTERN, brushPresetFileSchema, brushPresetSchema, formatErrors, isValidBrushPreset, isValidBrushPresetFile };
|
|
29
|
+
export { BRUSH_PRESET_COLLECTION_SCHEMA_VERSION, BRUSH_PRESET_COLLECTION_TYPE, BRUSH_PRESET_SCHEMA_VERSION, BRUSH_PRESET_TYPE, MAX_PRESETS_PER_FILE, MAX_PRESET_TEXT_LENGTH, MAX_SHAPE_DATA_URL_LENGTH, PNG_DATA_URL_PATTERN, UUID_PATTERN, brushPresetCollectionSchema, brushPresetSchema, formatErrors, isValidBrushPreset };
|
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
/**
|
|
4
|
-
export declare const
|
|
5
|
-
/**
|
|
6
|
-
export declare const
|
|
7
|
-
/**
|
|
8
|
-
export declare const
|
|
9
|
-
/**
|
|
10
|
-
export declare const
|
|
1
|
+
import { UUID_PATTERN } from "../assets/schema.ts";
|
|
2
|
+
export { UUID_PATTERN };
|
|
3
|
+
/** Version of the brush preset schema */
|
|
4
|
+
export declare const BRUSH_PRESET_SCHEMA_VERSION = "1.0.0";
|
|
5
|
+
/** `@type` of a brush preset */
|
|
6
|
+
export declare const BRUSH_PRESET_TYPE = "PaintCanvas/BrushConfig";
|
|
7
|
+
/** Version of the brush preset collection schema */
|
|
8
|
+
export declare const BRUSH_PRESET_COLLECTION_SCHEMA_VERSION = "1.0.0";
|
|
9
|
+
/** `@type` of a brush preset collection file */
|
|
10
|
+
export declare const BRUSH_PRESET_COLLECTION_TYPE = "PaintCanvas/BrushConfigCollection";
|
|
11
11
|
/** Most presets in one file */
|
|
12
12
|
export declare const MAX_PRESETS_PER_FILE = 1000;
|
|
13
|
-
/** Longest preset name
|
|
13
|
+
/** Longest preset name (characters) */
|
|
14
14
|
export declare const MAX_PRESET_TEXT_LENGTH = 100;
|
|
15
15
|
/** Longest brush shape data URL (characters): a 2 MB PNG as base64 */
|
|
16
16
|
export declare const MAX_SHAPE_DATA_URL_LENGTH: number;
|
|
17
17
|
/** Matches a PNG data URL */
|
|
18
18
|
export declare const PNG_DATA_URL_PATTERN = "^data:image/png;base64,[A-Za-z0-9+/]+={0,2}$";
|
|
19
|
-
/** A brush preset file: what users export and import */
|
|
20
|
-
export interface BrushPresetFile {
|
|
21
|
-
/** Names the app or kind of file, e.g. `BRUSH_PRESET_FILE_FORMAT` */
|
|
22
|
-
format: string;
|
|
23
|
-
version: typeof BRUSH_PRESET_FILE_VERSION;
|
|
24
|
-
/** Presets, each matching `brushPresetSchema` */
|
|
25
|
-
presets: Record<string, unknown>[];
|
|
26
|
-
}
|
|
27
19
|
/** JSON schema for a brush preset a user made or imported (see `BrushConfig` in the app) */
|
|
28
20
|
export declare const brushPresetSchema: {
|
|
29
|
-
readonly $
|
|
21
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
22
|
+
readonly $id: string;
|
|
23
|
+
readonly "@type": "PaintCanvas/BrushConfig";
|
|
30
24
|
readonly type: "object";
|
|
31
25
|
readonly additionalProperties: false;
|
|
32
26
|
readonly required: readonly ["id"];
|
|
33
27
|
readonly properties: {
|
|
28
|
+
readonly $schema: {
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
readonly minLength: 1;
|
|
31
|
+
readonly maxLength: 2048;
|
|
32
|
+
};
|
|
33
|
+
readonly "@type": {
|
|
34
|
+
readonly const: "PaintCanvas/BrushConfig";
|
|
35
|
+
};
|
|
34
36
|
readonly id: {
|
|
35
37
|
readonly type: "string";
|
|
36
38
|
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
@@ -59,6 +61,11 @@ export declare const brushPresetSchema: {
|
|
|
59
61
|
readonly additionalProperties: false;
|
|
60
62
|
readonly required: readonly ["name"];
|
|
61
63
|
readonly properties: {
|
|
64
|
+
readonly did: {
|
|
65
|
+
readonly type: "string";
|
|
66
|
+
readonly maxLength: 2048;
|
|
67
|
+
readonly pattern: "^did:[a-z]+:[a-zA-Z0-9._:%-]+$";
|
|
68
|
+
};
|
|
62
69
|
readonly name: {
|
|
63
70
|
readonly type: "string";
|
|
64
71
|
readonly minLength: 1;
|
|
@@ -73,7 +80,7 @@ export declare const brushPresetSchema: {
|
|
|
73
80
|
readonly type: "string";
|
|
74
81
|
readonly maxLength: 254;
|
|
75
82
|
};
|
|
76
|
-
readonly
|
|
83
|
+
readonly homepage: {
|
|
77
84
|
readonly type: "string";
|
|
78
85
|
readonly maxLength: 2048;
|
|
79
86
|
};
|
|
@@ -165,9 +172,12 @@ export declare const brushPresetSchema: {
|
|
|
165
172
|
};
|
|
166
173
|
};
|
|
167
174
|
readonly profileId: {
|
|
168
|
-
readonly
|
|
169
|
-
|
|
170
|
-
|
|
175
|
+
readonly anyOf: readonly [{
|
|
176
|
+
readonly type: "string";
|
|
177
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
178
|
+
}, {
|
|
179
|
+
readonly enum: string[];
|
|
180
|
+
}];
|
|
171
181
|
};
|
|
172
182
|
};
|
|
173
183
|
};
|
|
@@ -248,9 +258,12 @@ export declare const brushPresetSchema: {
|
|
|
248
258
|
};
|
|
249
259
|
};
|
|
250
260
|
readonly profileId: {
|
|
251
|
-
readonly
|
|
252
|
-
|
|
253
|
-
|
|
261
|
+
readonly anyOf: readonly [{
|
|
262
|
+
readonly type: "string";
|
|
263
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
264
|
+
}, {
|
|
265
|
+
readonly enum: string[];
|
|
266
|
+
}];
|
|
254
267
|
};
|
|
255
268
|
};
|
|
256
269
|
};
|
|
@@ -331,9 +344,12 @@ export declare const brushPresetSchema: {
|
|
|
331
344
|
};
|
|
332
345
|
};
|
|
333
346
|
readonly profileId: {
|
|
334
|
-
readonly
|
|
335
|
-
|
|
336
|
-
|
|
347
|
+
readonly anyOf: readonly [{
|
|
348
|
+
readonly type: "string";
|
|
349
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
350
|
+
}, {
|
|
351
|
+
readonly enum: string[];
|
|
352
|
+
}];
|
|
337
353
|
};
|
|
338
354
|
};
|
|
339
355
|
};
|
|
@@ -414,9 +430,12 @@ export declare const brushPresetSchema: {
|
|
|
414
430
|
};
|
|
415
431
|
};
|
|
416
432
|
readonly profileId: {
|
|
417
|
-
readonly
|
|
418
|
-
|
|
419
|
-
|
|
433
|
+
readonly anyOf: readonly [{
|
|
434
|
+
readonly type: "string";
|
|
435
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
436
|
+
}, {
|
|
437
|
+
readonly enum: string[];
|
|
438
|
+
}];
|
|
420
439
|
};
|
|
421
440
|
};
|
|
422
441
|
};
|
|
@@ -497,9 +516,12 @@ export declare const brushPresetSchema: {
|
|
|
497
516
|
};
|
|
498
517
|
};
|
|
499
518
|
readonly profileId: {
|
|
500
|
-
readonly
|
|
501
|
-
|
|
502
|
-
|
|
519
|
+
readonly anyOf: readonly [{
|
|
520
|
+
readonly type: "string";
|
|
521
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
522
|
+
}, {
|
|
523
|
+
readonly enum: string[];
|
|
524
|
+
}];
|
|
503
525
|
};
|
|
504
526
|
};
|
|
505
527
|
};
|
|
@@ -580,9 +602,12 @@ export declare const brushPresetSchema: {
|
|
|
580
602
|
};
|
|
581
603
|
};
|
|
582
604
|
readonly profileId: {
|
|
583
|
-
readonly
|
|
584
|
-
|
|
585
|
-
|
|
605
|
+
readonly anyOf: readonly [{
|
|
606
|
+
readonly type: "string";
|
|
607
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
608
|
+
}, {
|
|
609
|
+
readonly enum: string[];
|
|
610
|
+
}];
|
|
586
611
|
};
|
|
587
612
|
};
|
|
588
613
|
};
|
|
@@ -660,9 +685,12 @@ export declare const brushPresetSchema: {
|
|
|
660
685
|
};
|
|
661
686
|
};
|
|
662
687
|
readonly profileId: {
|
|
663
|
-
readonly
|
|
664
|
-
|
|
665
|
-
|
|
688
|
+
readonly anyOf: readonly [{
|
|
689
|
+
readonly type: "string";
|
|
690
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
691
|
+
}, {
|
|
692
|
+
readonly enum: string[];
|
|
693
|
+
}];
|
|
666
694
|
};
|
|
667
695
|
};
|
|
668
696
|
};
|
|
@@ -740,9 +768,12 @@ export declare const brushPresetSchema: {
|
|
|
740
768
|
};
|
|
741
769
|
};
|
|
742
770
|
readonly profileId: {
|
|
743
|
-
readonly
|
|
744
|
-
|
|
745
|
-
|
|
771
|
+
readonly anyOf: readonly [{
|
|
772
|
+
readonly type: "string";
|
|
773
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
774
|
+
}, {
|
|
775
|
+
readonly enum: string[];
|
|
776
|
+
}];
|
|
746
777
|
};
|
|
747
778
|
};
|
|
748
779
|
};
|
|
@@ -820,9 +851,12 @@ export declare const brushPresetSchema: {
|
|
|
820
851
|
};
|
|
821
852
|
};
|
|
822
853
|
readonly profileId: {
|
|
823
|
-
readonly
|
|
824
|
-
|
|
825
|
-
|
|
854
|
+
readonly anyOf: readonly [{
|
|
855
|
+
readonly type: "string";
|
|
856
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
857
|
+
}, {
|
|
858
|
+
readonly enum: string[];
|
|
859
|
+
}];
|
|
826
860
|
};
|
|
827
861
|
};
|
|
828
862
|
};
|
|
@@ -903,9 +937,12 @@ export declare const brushPresetSchema: {
|
|
|
903
937
|
};
|
|
904
938
|
};
|
|
905
939
|
readonly profileId: {
|
|
906
|
-
readonly
|
|
907
|
-
|
|
908
|
-
|
|
940
|
+
readonly anyOf: readonly [{
|
|
941
|
+
readonly type: "string";
|
|
942
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
943
|
+
}, {
|
|
944
|
+
readonly enum: string[];
|
|
945
|
+
}];
|
|
909
946
|
};
|
|
910
947
|
};
|
|
911
948
|
};
|
|
@@ -983,9 +1020,12 @@ export declare const brushPresetSchema: {
|
|
|
983
1020
|
};
|
|
984
1021
|
};
|
|
985
1022
|
readonly profileId: {
|
|
986
|
-
readonly
|
|
987
|
-
|
|
988
|
-
|
|
1023
|
+
readonly anyOf: readonly [{
|
|
1024
|
+
readonly type: "string";
|
|
1025
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
1026
|
+
}, {
|
|
1027
|
+
readonly enum: string[];
|
|
1028
|
+
}];
|
|
989
1029
|
};
|
|
990
1030
|
};
|
|
991
1031
|
};
|
|
@@ -1063,9 +1103,12 @@ export declare const brushPresetSchema: {
|
|
|
1063
1103
|
};
|
|
1064
1104
|
};
|
|
1065
1105
|
readonly profileId: {
|
|
1066
|
-
readonly
|
|
1067
|
-
|
|
1068
|
-
|
|
1106
|
+
readonly anyOf: readonly [{
|
|
1107
|
+
readonly type: "string";
|
|
1108
|
+
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
|
|
1109
|
+
}, {
|
|
1110
|
+
readonly enum: string[];
|
|
1111
|
+
}];
|
|
1069
1112
|
};
|
|
1070
1113
|
};
|
|
1071
1114
|
};
|
|
@@ -1087,26 +1130,28 @@ export declare const brushPresetSchema: {
|
|
|
1087
1130
|
};
|
|
1088
1131
|
};
|
|
1089
1132
|
};
|
|
1090
|
-
/** JSON schema for a brush preset file */
|
|
1091
|
-
export declare const
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1133
|
+
/** JSON schema for a brush preset collection file */
|
|
1134
|
+
export declare const brushPresetCollectionSchema: {
|
|
1135
|
+
$schema: string;
|
|
1136
|
+
$id: string;
|
|
1137
|
+
"@type": string;
|
|
1138
|
+
type: string;
|
|
1139
|
+
additionalProperties: boolean;
|
|
1140
|
+
required: string[];
|
|
1141
|
+
properties: {
|
|
1142
|
+
$schema: {
|
|
1098
1143
|
readonly type: "string";
|
|
1099
1144
|
readonly minLength: 1;
|
|
1100
|
-
readonly maxLength:
|
|
1145
|
+
readonly maxLength: 2048;
|
|
1101
1146
|
};
|
|
1102
|
-
|
|
1103
|
-
|
|
1147
|
+
"@type": {
|
|
1148
|
+
const: string;
|
|
1104
1149
|
};
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1150
|
+
items: {
|
|
1151
|
+
type: string;
|
|
1152
|
+
maxItems: number;
|
|
1153
|
+
items: {
|
|
1154
|
+
$ref: string;
|
|
1110
1155
|
};
|
|
1111
1156
|
};
|
|
1112
1157
|
};
|