@lvl99dotcom/paintcanvas 0.7.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 +1 -0
- 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 +111 -23
- package/dist/lib/classes/PaintCanvas/index.js +219 -58
- 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/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 +198 -76
- package/dist/lib/settings/schema.js +92 -86
- package/dist/lib/storage/index.d.ts +82 -3
- package/dist/lib/storage/index.js +82 -5
- package/dist/lib/validation/validators.generated.d.ts +19 -8
- package/dist/lib/validation/validators.generated.js +44716 -18900
- package/dist/lib/version/index.js +1 -1
- package/dist/locales/en-GB.js +23 -5
- package/dist/locales/en-US.js +23 -5
- package/dist/locales/fr.js +23 -5
- package/dist/locales/ja.js +23 -5
- package/dist/locales/ko.js +23 -5
- package/dist/locales/zh-Hans.js +23 -5
- package/dist/locales/zh-Hant.js +23 -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 +6 -2
- package/dist/ui/elements/PaintCanvas/index.js +20 -6
- package/dist/ui/elements/PcAppSettings/index.d.ts +5 -6
- package/dist/ui/elements/PcAppSettings/index.js +17 -27
- 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/PcStats/index.d.ts +8 -4
- package/dist/ui/elements/PcStats/index.js +39 -5
- package/locales/en-GB.json +23 -5
- package/locales/en-US.json +23 -5
- package/locales/fr.json +23 -5
- package/locales/ja.json +23 -5
- package/locales/ko.json +23 -5
- package/locales/zh-Hans.json +23 -5
- package/locales/zh-Hant.json +23 -5
- package/package.json +2 -1
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { formatErrors } from "../presets/index.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { formatErrors, isValidBrushPreset } from "../presets/index.js";
|
|
2
|
+
import { validateAppSettings, validateSettings } from "../validation/validators.generated.js";
|
|
3
|
+
import { AssetFileError } from "../assets/index.js";
|
|
4
|
+
import { compareVersions, majorVersion, parseSchemaUrl } from "../schemas/index.js";
|
|
5
|
+
import { sanitisePalette } from "../classes/Palette/index.js";
|
|
6
|
+
import { APP_SETTINGS_SCHEMA_VERSION, APP_SETTINGS_TYPE, MAX_SAVED_SHORTCUTS, appSettingsSchema, keyComboSchema, settingsSchema } from "./schema.js";
|
|
4
7
|
// src/lib/settings/index.ts
|
|
5
|
-
/** Messages shown when importing settings fails */
|
|
6
|
-
var SETTINGS_FILE_ERRORS = {
|
|
7
|
-
incompatible: "Settings JSON file not compatible",
|
|
8
|
-
read: "Failed to read settings JSON file"
|
|
9
|
-
};
|
|
10
|
-
/** Importing settings failed, with a message for the user */
|
|
11
|
-
var SettingsFileError = class extends Error {};
|
|
12
8
|
/**
|
|
13
9
|
* Check app settings (e.g. kept in the browser) against `settingsSchema`.
|
|
14
10
|
*
|
|
@@ -23,37 +19,62 @@ var isValidSettings = (input) => validateSettings(input) ? {
|
|
|
23
19
|
errors: formatErrors(validateSettings.errors)
|
|
24
20
|
};
|
|
25
21
|
/**
|
|
26
|
-
* The app settings of a canvas: its input settings, keyboard shortcuts,
|
|
27
|
-
* and language.
|
|
22
|
+
* The app settings of a canvas: its input settings, keyboard shortcuts, colours, the user's colour palettes, profile
|
|
23
|
+
* graphs and brush presets, theme and language, and settings wrapper apps added (see `SettingsExtension`).
|
|
28
24
|
*
|
|
29
25
|
* @example
|
|
30
|
-
* collectSettings(canvas).
|
|
26
|
+
* collectSettings(canvas).palettes; // the user's own palettes
|
|
27
|
+
* collectSettings(canvas, { without: ["profiles"] }).profiles; // undefined
|
|
31
28
|
*/
|
|
32
|
-
var collectSettings = (app) => ({
|
|
29
|
+
var collectSettings = (app, { without = [] } = {}) => ({
|
|
33
30
|
input: structuredClone(app.input.data),
|
|
34
31
|
shortcuts: structuredClone(app.shortcuts.bindings),
|
|
35
|
-
|
|
32
|
+
...without.includes("palettes") ? {} : { palettes: structuredClone([...app.palettes.items]) },
|
|
36
33
|
colours: { ...app.colours },
|
|
37
|
-
profiles: structuredClone([...app.profiles.graphs]),
|
|
38
|
-
|
|
34
|
+
...without.includes("profiles") ? {} : { profiles: structuredClone([...app.profiles.graphs]) },
|
|
35
|
+
...without.includes("brushes") ? {} : { brushes: structuredClone(app.customPresets.presets) },
|
|
36
|
+
ui: { ...app.ui.data },
|
|
37
|
+
...structuredClone(app.settingsExtensions.collect())
|
|
39
38
|
});
|
|
39
|
+
/** Name of the palette that colours saved in PaintCanvas's palette by older versions are moved to */
|
|
40
|
+
var OLDER_PALETTE_NAME = "My colours";
|
|
41
|
+
/**
|
|
42
|
+
* Keep colours that older versions saved in PaintCanvas's palette (which can no longer be changed) in a palette of the
|
|
43
|
+
* user's own, named `OLDER_PALETTE_NAME`: unless they're PaintCanvas's colours, or one of the user's palettes already has
|
|
44
|
+
* them.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* keepOlderPalette(canvas, ["#123456"]); // the user now has a "My colours" palette with #123456
|
|
48
|
+
*/
|
|
49
|
+
var keepOlderPalette = (app, colours) => {
|
|
50
|
+
const valid = sanitisePalette(colours) ?? [];
|
|
51
|
+
const same = (other) => other.length === valid.length && other.every((colour, i) => colour === valid[i]);
|
|
52
|
+
if (valid.length === 0 || same(app.palette.colours) || app.palettes.items.some((palette) => same(palette.colours))) return;
|
|
53
|
+
app.palettes.create(OLDER_PALETTE_NAME, valid, app.author);
|
|
54
|
+
};
|
|
40
55
|
/**
|
|
41
56
|
* Use app settings on a canvas, e.g. ones kept in the browser or imported. Parts left out stay as they are; invalid
|
|
42
|
-
* values within a part are left out (see each part's sanitising).
|
|
57
|
+
* values within a part are left out (see each part's sanitising). Colour palettes, profile graphs and brush presets are
|
|
58
|
+
* added to the user's own, replacing those with the same IDs. Colours older versions saved in PaintCanvas's palette are
|
|
59
|
+
* moved to one of the user's own (see `keepOlderPalette`). Other parts go to the settings extensions (see
|
|
60
|
+
* `SettingsExtensions.apply`).
|
|
43
61
|
*
|
|
44
62
|
* @example
|
|
45
|
-
* applySettings(canvas, { colours: { foreground: "#ff0000", background: "#ffffff" } });
|
|
63
|
+
* await applySettings(canvas, { colours: { foreground: "#ff0000", background: "#ffffff" } });
|
|
46
64
|
*/
|
|
47
|
-
var applySettings = (app, settings) => {
|
|
65
|
+
var applySettings = async (app, settings) => {
|
|
48
66
|
if (settings.input) app.input.update(settings.input);
|
|
49
67
|
if (settings.shortcuts) app.shortcuts.load(settings.shortcuts);
|
|
50
|
-
if (settings.palette) app
|
|
68
|
+
if (settings.palette) keepOlderPalette(app, settings.palette);
|
|
69
|
+
if (settings.palettes) app.palettes.merge(settings.palettes);
|
|
51
70
|
if (settings.colours) {
|
|
52
71
|
app.setColour(settings.colours.foreground, "foreground");
|
|
53
72
|
app.setColour(settings.colours.background, "background");
|
|
54
73
|
}
|
|
55
|
-
if (settings.profiles) app.profiles.
|
|
74
|
+
if (settings.profiles) app.profiles.merge(settings.profiles);
|
|
56
75
|
if (settings.ui) app.ui.update(settings.ui);
|
|
76
|
+
app.settingsExtensions.apply(settings);
|
|
77
|
+
if (Array.isArray(settings.brushes)) await app.customPresets.save(...settings.brushes.filter((preset) => isValidBrushPreset(preset).valid));
|
|
57
78
|
};
|
|
58
79
|
/**
|
|
59
80
|
* The file name settings are exported to on a day, starting with a prefix (see `PaintCanvasNames.filePrefix`).
|
|
@@ -66,31 +87,51 @@ var settingsFileName = (date = /* @__PURE__ */ new Date(), prefix = "paintcanvas
|
|
|
66
87
|
return `${prefix}-settings-${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}.json`;
|
|
67
88
|
};
|
|
68
89
|
/**
|
|
69
|
-
* Write app settings to
|
|
90
|
+
* Write app settings to an app settings file (JSON). Colours older versions saved in PaintCanvas's palette are left out.
|
|
70
91
|
*
|
|
71
92
|
* @example
|
|
72
|
-
* exportSettingsFile(collectSettings(canvas)); // '{ "
|
|
93
|
+
* exportSettingsFile(collectSettings(canvas)); // '{ "$schema": ".../app-settings-1.0.0.json", "@type": "PaintCanvas/AppSettings", ... }'
|
|
73
94
|
*/
|
|
74
|
-
var exportSettingsFile = (settings
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
95
|
+
var exportSettingsFile = (settings) => {
|
|
96
|
+
const parts = { ...settings };
|
|
97
|
+
delete parts.palette;
|
|
98
|
+
const file = {
|
|
99
|
+
$schema: appSettingsSchema.$id,
|
|
100
|
+
"@type": APP_SETTINGS_TYPE,
|
|
101
|
+
...parts
|
|
102
|
+
};
|
|
103
|
+
return JSON.stringify(file, null, 2);
|
|
104
|
+
};
|
|
105
|
+
/** Whether a value is a plain object */
|
|
106
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
79
107
|
/**
|
|
80
|
-
* Read the app settings in
|
|
81
|
-
* `
|
|
108
|
+
* Read the app settings in an app settings file. Settings files from before versioned schemas (`format`, `version: 1`
|
|
109
|
+
* and `settings`, of any format name) are read too. Throws an `AssetFileError`: `read` if it isn't JSON, `invalid` if it
|
|
110
|
+
* isn't a settings file or doesn't match its schema, `unsupported` if it's a version the app can't read.
|
|
82
111
|
*
|
|
83
112
|
* @example
|
|
84
|
-
* applySettings(canvas, parseSettingsFile(text));
|
|
113
|
+
* await applySettings(canvas, parseSettingsFile(text));
|
|
85
114
|
*/
|
|
86
|
-
var parseSettingsFile = (text
|
|
115
|
+
var parseSettingsFile = (text) => {
|
|
87
116
|
let data;
|
|
88
117
|
try {
|
|
89
118
|
data = JSON.parse(text);
|
|
90
119
|
} catch {
|
|
91
|
-
throw new
|
|
120
|
+
throw new AssetFileError("read");
|
|
121
|
+
}
|
|
122
|
+
if (!isRecord(data)) throw new AssetFileError("invalid");
|
|
123
|
+
if (typeof data.format === "string" && data.version === 1) {
|
|
124
|
+
const result = isValidSettings(data.settings);
|
|
125
|
+
if (!result.valid) throw new AssetFileError("invalid");
|
|
126
|
+
return result.value;
|
|
92
127
|
}
|
|
93
|
-
|
|
94
|
-
|
|
128
|
+
const named = parseSchemaUrl(data.$schema);
|
|
129
|
+
if (named?.name !== "app-settings") throw new AssetFileError("invalid");
|
|
130
|
+
if (majorVersion(named.version) !== majorVersion("1.0.0") || compareVersions(named.version, "1.0.0") > 0) throw new AssetFileError("unsupported");
|
|
131
|
+
if (!validateAppSettings(data)) throw new AssetFileError("invalid");
|
|
132
|
+
const settings = { ...data };
|
|
133
|
+
delete settings.$schema;
|
|
134
|
+
delete settings["@type"];
|
|
135
|
+
return settings;
|
|
95
136
|
};
|
|
96
|
-
export {
|
|
137
|
+
export { APP_SETTINGS_SCHEMA_VERSION, APP_SETTINGS_TYPE, MAX_SAVED_SHORTCUTS, OLDER_PALETTE_NAME, appSettingsSchema, applySettings, collectSettings, exportSettingsFile, isValidSettings, keepOlderPalette, keyComboSchema, parseSettingsFile, settingsFileName, settingsSchema };
|
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
import type { InputSettingsData } from "../classes/InputSettings";
|
|
2
2
|
import { type UiSettingsData } from "../classes/UiSettings/index.ts";
|
|
3
3
|
import type { KeyCombo } from "../utils/shortcuts";
|
|
4
|
+
import { type ColourPalette } from "../palette/schema.ts";
|
|
4
5
|
import type { ProfileGraph } from "../profiles/index.ts";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export declare const SETTINGS_FILE_VERSION = 1;
|
|
11
|
-
/** Longest settings file format name (characters) */
|
|
12
|
-
export declare const MAX_SETTINGS_FILE_FORMAT_LENGTH = 100;
|
|
6
|
+
import type { BrushConfig } from "../brushes/types/index.ts";
|
|
7
|
+
/** Version of the app settings schema */
|
|
8
|
+
export declare const APP_SETTINGS_SCHEMA_VERSION = "1.0.0";
|
|
9
|
+
/** `@type` of an app settings file */
|
|
10
|
+
export declare const APP_SETTINGS_TYPE = "PaintCanvas/AppSettings";
|
|
13
11
|
/** Most keyboard shortcuts in saved settings */
|
|
14
12
|
export declare const MAX_SAVED_SHORTCUTS = 200;
|
|
15
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The user's app settings. Each part is optional, so a file can hold only some of them. Wrapper apps add their own
|
|
15
|
+
* parts under keys of their own (see `SettingsExtension`).
|
|
16
|
+
*/
|
|
16
17
|
export interface AppSettings {
|
|
17
18
|
/** How input devices control the canvas */
|
|
18
19
|
input?: Partial<InputSettingsData>;
|
|
19
20
|
/** Each configurable keyboard shortcut action's key combination, by ID (null when it has none) */
|
|
20
21
|
shortcuts?: Record<string, KeyCombo | null>;
|
|
21
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Colours saved in PaintCanvas's palette by older versions, as `#rrggbb` (no longer saved: applying them moves them
|
|
24
|
+
* to one of the user's palettes, see `keepOlderPalette`)
|
|
25
|
+
*/
|
|
22
26
|
palette?: string[];
|
|
27
|
+
/** The user's own colour palettes */
|
|
28
|
+
palettes?: ColourPalette[];
|
|
23
29
|
/** The foreground and background colours, as `#rrggbb` */
|
|
24
30
|
colours?: {
|
|
25
31
|
foreground: string;
|
|
@@ -27,19 +33,21 @@ export interface AppSettings {
|
|
|
27
33
|
};
|
|
28
34
|
/** The user's own profile graphs */
|
|
29
35
|
profiles?: ProfileGraph[];
|
|
36
|
+
/** The user's own and imported brush presets */
|
|
37
|
+
brushes?: BrushConfig[];
|
|
30
38
|
/** The theme, language and where canvases draw */
|
|
31
39
|
ui?: Partial<UiSettingsData>;
|
|
40
|
+
/** Parts added by wrapper apps, by their keys */
|
|
41
|
+
[extension: string]: unknown;
|
|
32
42
|
}
|
|
33
|
-
/**
|
|
34
|
-
export
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
43
|
+
/** An app settings file: what users export and import */
|
|
44
|
+
export type AppSettingsFile = Omit<AppSettings, "palette"> & {
|
|
45
|
+
/** URL of the schema, which names its version */
|
|
46
|
+
$schema: string;
|
|
47
|
+
"@type": typeof APP_SETTINGS_TYPE;
|
|
48
|
+
};
|
|
40
49
|
/** Schema of a key combination */
|
|
41
50
|
export declare const keyComboSchema: {
|
|
42
|
-
readonly $id: "paintcanvas/key-combo";
|
|
43
51
|
readonly type: "object";
|
|
44
52
|
readonly additionalProperties: false;
|
|
45
53
|
readonly required: readonly ["key"];
|
|
@@ -63,12 +71,22 @@ export declare const keyComboSchema: {
|
|
|
63
71
|
};
|
|
64
72
|
};
|
|
65
73
|
};
|
|
66
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* Schema of the user's app settings as kept in the browser: parts PaintCanvas doesn't know are left for wrapper apps
|
|
76
|
+
* to check (see `SettingsExtension`), and colours older versions saved in PaintCanvas's palette (`palette`) are allowed.
|
|
77
|
+
*/
|
|
67
78
|
export declare const settingsSchema: {
|
|
68
79
|
readonly $id: "paintcanvas/settings";
|
|
69
80
|
readonly type: "object";
|
|
70
|
-
readonly additionalProperties: false;
|
|
71
81
|
readonly properties: {
|
|
82
|
+
readonly palette: {
|
|
83
|
+
readonly type: "array";
|
|
84
|
+
readonly maxItems: 1000;
|
|
85
|
+
readonly items: {
|
|
86
|
+
readonly type: "string";
|
|
87
|
+
readonly pattern: "^#[0-9a-fA-F]{6}$";
|
|
88
|
+
};
|
|
89
|
+
};
|
|
72
90
|
readonly input: {
|
|
73
91
|
readonly type: "object";
|
|
74
92
|
readonly additionalProperties: false;
|
|
@@ -105,16 +123,36 @@ export declare const settingsSchema: {
|
|
|
105
123
|
readonly anyOf: readonly [{
|
|
106
124
|
readonly type: "null";
|
|
107
125
|
}, {
|
|
108
|
-
readonly
|
|
126
|
+
readonly type: "object";
|
|
127
|
+
readonly additionalProperties: false;
|
|
128
|
+
readonly required: readonly ["key"];
|
|
129
|
+
readonly properties: {
|
|
130
|
+
readonly key: {
|
|
131
|
+
readonly type: "string";
|
|
132
|
+
readonly minLength: 1;
|
|
133
|
+
readonly maxLength: 32;
|
|
134
|
+
};
|
|
135
|
+
readonly cmd: {
|
|
136
|
+
readonly type: "boolean";
|
|
137
|
+
};
|
|
138
|
+
readonly ctrl: {
|
|
139
|
+
readonly type: "boolean";
|
|
140
|
+
};
|
|
141
|
+
readonly shift: {
|
|
142
|
+
readonly type: "boolean";
|
|
143
|
+
};
|
|
144
|
+
readonly alt: {
|
|
145
|
+
readonly type: "boolean";
|
|
146
|
+
};
|
|
147
|
+
};
|
|
109
148
|
}];
|
|
110
149
|
};
|
|
111
150
|
};
|
|
112
|
-
readonly
|
|
151
|
+
readonly palettes: {
|
|
113
152
|
readonly type: "array";
|
|
114
|
-
readonly maxItems:
|
|
153
|
+
readonly maxItems: 100;
|
|
115
154
|
readonly items: {
|
|
116
|
-
readonly
|
|
117
|
-
readonly pattern: "^#[0-9a-fA-F]{6}$";
|
|
155
|
+
readonly $ref: string;
|
|
118
156
|
};
|
|
119
157
|
};
|
|
120
158
|
readonly colours: {
|
|
@@ -136,48 +174,144 @@ export declare const settingsSchema: {
|
|
|
136
174
|
readonly type: "array";
|
|
137
175
|
readonly maxItems: 100;
|
|
138
176
|
readonly items: {
|
|
139
|
-
readonly
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
177
|
+
readonly $ref: string;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
readonly brushes: {
|
|
181
|
+
readonly type: "array";
|
|
182
|
+
readonly maxItems: 1000;
|
|
183
|
+
readonly items: {
|
|
184
|
+
readonly $ref: string;
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
readonly ui: {
|
|
188
|
+
readonly type: "object";
|
|
189
|
+
readonly additionalProperties: false;
|
|
190
|
+
readonly properties: {
|
|
191
|
+
readonly theme: {
|
|
192
|
+
readonly enum: readonly ["light", "dark", "system"];
|
|
193
|
+
};
|
|
194
|
+
readonly locale: {
|
|
195
|
+
readonly type: "string";
|
|
196
|
+
readonly minLength: 1;
|
|
197
|
+
readonly maxLength: 35;
|
|
198
|
+
readonly pattern: "^[A-Za-z0-9-]+$";
|
|
199
|
+
};
|
|
200
|
+
readonly rendering: {
|
|
201
|
+
readonly enum: readonly ["cpu", "gpu"];
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Schema of an app settings file. Parts it doesn't name are added by wrapper apps, which check them (see
|
|
209
|
+
* `SettingsExtension`), and can publish schemas of their own that extend this one.
|
|
210
|
+
*/
|
|
211
|
+
export declare const appSettingsSchema: {
|
|
212
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
213
|
+
readonly $id: string;
|
|
214
|
+
readonly "@type": "PaintCanvas/AppSettings";
|
|
215
|
+
readonly type: "object";
|
|
216
|
+
readonly required: readonly ["$schema", "@type"];
|
|
217
|
+
readonly properties: {
|
|
218
|
+
readonly input: {
|
|
219
|
+
readonly type: "object";
|
|
220
|
+
readonly additionalProperties: false;
|
|
221
|
+
readonly properties: {
|
|
222
|
+
readonly scrollPan: {
|
|
223
|
+
readonly type: "boolean";
|
|
224
|
+
};
|
|
225
|
+
readonly pinchZoom: {
|
|
226
|
+
readonly type: "boolean";
|
|
227
|
+
};
|
|
228
|
+
readonly modifierScrollZoom: {
|
|
229
|
+
readonly type: "boolean";
|
|
230
|
+
};
|
|
231
|
+
readonly focusPen: {
|
|
232
|
+
readonly type: "boolean";
|
|
233
|
+
};
|
|
234
|
+
readonly gestures: {
|
|
235
|
+
readonly type: "object";
|
|
236
|
+
readonly maxProperties: 20;
|
|
237
|
+
readonly additionalProperties: {
|
|
149
238
|
readonly type: "string";
|
|
150
|
-
readonly
|
|
151
|
-
readonly maxLength: 100;
|
|
239
|
+
readonly maxLength: 50;
|
|
152
240
|
};
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
readonly shortcuts: {
|
|
245
|
+
readonly type: "object";
|
|
246
|
+
readonly maxProperties: 200;
|
|
247
|
+
readonly propertyNames: {
|
|
248
|
+
readonly maxLength: 64;
|
|
249
|
+
};
|
|
250
|
+
readonly additionalProperties: {
|
|
251
|
+
readonly anyOf: readonly [{
|
|
252
|
+
readonly type: "null";
|
|
253
|
+
}, {
|
|
254
|
+
readonly type: "object";
|
|
255
|
+
readonly additionalProperties: false;
|
|
256
|
+
readonly required: readonly ["key"];
|
|
257
|
+
readonly properties: {
|
|
258
|
+
readonly key: {
|
|
259
|
+
readonly type: "string";
|
|
260
|
+
readonly minLength: 1;
|
|
261
|
+
readonly maxLength: 32;
|
|
262
|
+
};
|
|
263
|
+
readonly cmd: {
|
|
264
|
+
readonly type: "boolean";
|
|
265
|
+
};
|
|
266
|
+
readonly ctrl: {
|
|
267
|
+
readonly type: "boolean";
|
|
268
|
+
};
|
|
269
|
+
readonly shift: {
|
|
270
|
+
readonly type: "boolean";
|
|
271
|
+
};
|
|
272
|
+
readonly alt: {
|
|
273
|
+
readonly type: "boolean";
|
|
176
274
|
};
|
|
177
275
|
};
|
|
276
|
+
}];
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
readonly palettes: {
|
|
280
|
+
readonly type: "array";
|
|
281
|
+
readonly maxItems: 100;
|
|
282
|
+
readonly items: {
|
|
283
|
+
readonly $ref: string;
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
readonly colours: {
|
|
287
|
+
readonly type: "object";
|
|
288
|
+
readonly additionalProperties: false;
|
|
289
|
+
readonly required: readonly ["foreground", "background"];
|
|
290
|
+
readonly properties: {
|
|
291
|
+
readonly foreground: {
|
|
292
|
+
readonly type: "string";
|
|
293
|
+
readonly pattern: "^#[0-9a-fA-F]{6}$";
|
|
294
|
+
};
|
|
295
|
+
readonly background: {
|
|
296
|
+
readonly type: "string";
|
|
297
|
+
readonly pattern: "^#[0-9a-fA-F]{6}$";
|
|
178
298
|
};
|
|
179
299
|
};
|
|
180
300
|
};
|
|
301
|
+
readonly profiles: {
|
|
302
|
+
readonly type: "array";
|
|
303
|
+
readonly maxItems: 100;
|
|
304
|
+
readonly items: {
|
|
305
|
+
readonly $ref: string;
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
readonly brushes: {
|
|
309
|
+
readonly type: "array";
|
|
310
|
+
readonly maxItems: 1000;
|
|
311
|
+
readonly items: {
|
|
312
|
+
readonly $ref: string;
|
|
313
|
+
};
|
|
314
|
+
};
|
|
181
315
|
readonly ui: {
|
|
182
316
|
readonly type: "object";
|
|
183
317
|
readonly additionalProperties: false;
|
|
@@ -196,25 +330,13 @@ export declare const settingsSchema: {
|
|
|
196
330
|
};
|
|
197
331
|
};
|
|
198
332
|
};
|
|
199
|
-
|
|
200
|
-
};
|
|
201
|
-
/** Schema of a settings file */
|
|
202
|
-
export declare const settingsFileSchema: {
|
|
203
|
-
readonly $id: "paintcanvas/settings-file";
|
|
204
|
-
readonly type: "object";
|
|
205
|
-
readonly additionalProperties: false;
|
|
206
|
-
readonly required: readonly ["format", "version", "settings"];
|
|
207
|
-
readonly properties: {
|
|
208
|
-
readonly format: {
|
|
333
|
+
readonly $schema: {
|
|
209
334
|
readonly type: "string";
|
|
210
335
|
readonly minLength: 1;
|
|
211
|
-
readonly maxLength:
|
|
212
|
-
};
|
|
213
|
-
readonly version: {
|
|
214
|
-
readonly const: 1;
|
|
336
|
+
readonly maxLength: 2048;
|
|
215
337
|
};
|
|
216
|
-
readonly
|
|
217
|
-
readonly
|
|
338
|
+
readonly "@type": {
|
|
339
|
+
readonly const: "PaintCanvas/AppSettings";
|
|
218
340
|
};
|
|
219
341
|
};
|
|
220
342
|
};
|