@pixerate/editor 0.255.0 → 0.257.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/dist/agent/index.cjs +40 -38
- package/dist/agent/index.js +9 -7
- package/dist/animation/index.cjs +4 -2
- package/dist/animation/index.js +4 -2
- package/dist/animation-editor/index.cjs +63 -61
- package/dist/animation-editor/index.js +7 -5
- package/dist/brushes/colour.d.cts +11 -0
- package/dist/brushes/colour.d.ts +11 -0
- package/dist/brushes/index.cjs +51 -30
- package/dist/brushes/index.d.cts +1 -0
- package/dist/brushes/index.d.ts +1 -0
- package/dist/brushes/index.js +25 -4
- package/dist/brushes/resolve.d.cts +2 -0
- package/dist/brushes/resolve.d.ts +2 -0
- package/dist/brushes/schema.d.cts +1 -0
- package/dist/brushes/schema.d.ts +1 -0
- package/dist/brushes/tools.d.cts +7 -0
- package/dist/brushes/tools.d.ts +7 -0
- package/dist/brushes/types.d.cts +10 -2
- package/dist/brushes/types.d.ts +10 -2
- package/dist/brushes/ui.d.cts +14 -3
- package/dist/brushes/ui.d.ts +14 -3
- package/dist/{brushstrokeRender-HCOQUSWW.js → brushstrokeRender-JI4W6F2G.js} +2 -2
- package/dist/{brushstrokeRender-ZZOXI5O5.cjs → brushstrokeRender-MQ6PSDM5.cjs} +11 -11
- package/dist/canvas/index.cjs +20 -18
- package/dist/canvas/index.js +7 -5
- package/dist/chart/index.cjs +159 -157
- package/dist/chart/index.js +9 -7
- package/dist/{chunk-7272D3K2.js → chunk-2EUW2XZX.js} +27 -276
- package/dist/{chunk-L6Y7TSQ4.js → chunk-2VJ6OVJV.js} +1 -1
- package/dist/{chunk-6ZZKRH7R.js → chunk-47V3WXDG.js} +2 -2
- package/dist/{chunk-H7ET2ISK.cjs → chunk-4IMD2TLY.cjs} +52 -52
- package/dist/{chunk-VUKUTT2W.js → chunk-4M4E3N6X.js} +1 -1
- package/dist/{chunk-TBAVCLEQ.cjs → chunk-5Q5MLXAD.cjs} +23 -23
- package/dist/{chunk-MONXNVZK.js → chunk-6I23ZCGK.js} +5 -3
- package/dist/{chunk-GOBOCZZI.js → chunk-6NQPKNUZ.js} +1 -1
- package/dist/{chunk-WYGSR3IJ.js → chunk-AORZ5M5C.js} +1 -1
- package/dist/chunk-AVTPZO4Z.cjs +142 -0
- package/dist/{chunk-WKMUBATU.js → chunk-C2WEIEUB.js} +1 -1
- package/dist/{chunk-P3K2JCJA.js → chunk-D5BXSOSU.js} +3 -3
- package/dist/chunk-E2V5DA3W.js +36 -0
- package/dist/{chunk-WZOGDKCQ.js → chunk-F7CPSRLN.js} +0 -133
- package/dist/chunk-FJBQTZS4.js +17 -0
- package/dist/{chunk-SOSBOS5T.cjs → chunk-G23BTQA5.cjs} +22 -22
- package/dist/{chunk-EUIDTZNQ.cjs → chunk-I3Y2Q3PM.cjs} +59 -308
- package/dist/{chunk-YHUMGBZD.js → chunk-ICTPLVSR.js} +22 -4
- package/dist/{chunk-LRNUZKWV.cjs → chunk-IPUTIUGQ.cjs} +1 -1
- package/dist/{chunk-6GRUVGKU.js → chunk-ITURMC2M.js} +3 -3
- package/dist/{chunk-HYWRU5VX.js → chunk-IXQZHCOF.js} +1 -1
- package/dist/chunk-J5UQHWVL.js +142 -0
- package/dist/{chunk-YBAPT7NL.js → chunk-JC2SHA4A.js} +1 -23
- package/dist/chunk-LRTR4ASZ.cjs +17 -0
- package/dist/{chunk-HUAISCUX.cjs → chunk-M2HG5DJ2.cjs} +18 -18
- package/dist/{chunk-N76AMOKE.cjs → chunk-MDLEGVEN.cjs} +42 -42
- package/dist/chunk-MEGSQUQO.cjs +36 -0
- package/dist/chunk-MLLTWAXH.cjs +276 -0
- package/dist/{chunk-RHPSE2YR.js → chunk-MQ6MGIQM.js} +2 -2
- package/dist/{chunk-PGPFWC35.cjs → chunk-MQGQTKVW.cjs} +51 -33
- package/dist/{chunk-5YWWQ36H.cjs → chunk-O3ZVZSNJ.cjs} +9 -9
- package/dist/{chunk-GCTUOTCW.cjs → chunk-P3PZ63M3.cjs} +35 -35
- package/dist/{chunk-WRZ6C4TU.cjs → chunk-P6WYDBTH.cjs} +4 -4
- package/dist/{chunk-CJ6TBL2N.cjs → chunk-RHEMMGCN.cjs} +16 -16
- package/dist/{chunk-HIMGBZAM.cjs → chunk-RSIKDWOP.cjs} +201 -38
- package/dist/{chunk-SABJMH6M.cjs → chunk-RVGP2XLF.cjs} +2 -135
- package/dist/{chunk-JVRLGV3C.js → chunk-SMTUQWGY.js} +184 -21
- package/dist/{chunk-DMTEQ6SH.js → chunk-SSFMWJDK.js} +4 -4
- package/dist/{chunk-TFF2GTGN.cjs → chunk-SXQHWXEL.cjs} +2 -24
- package/dist/{chunk-IWEVV63O.cjs → chunk-UEYLANO3.cjs} +18 -16
- package/dist/chunk-VR6OGHU5.js +276 -0
- package/dist/{chunk-AF23QK5F.js → chunk-YQ4PQTBB.js} +1 -1
- package/dist/{chunk-B7V34GIH.cjs → chunk-YSGW7VV4.cjs} +88 -88
- package/dist/{chunk-3NS5C7FB.cjs → chunk-YYBW6DF2.cjs} +76 -76
- package/dist/{chunk-UFEDHACQ.js → chunk-Z7BX4TWO.js} +2 -2
- package/dist/{chunk-RUONPPMC.cjs → chunk-ZSE25IZA.cjs} +8 -8
- package/dist/color/index.cjs +7 -3
- package/dist/color/index.js +18 -14
- package/dist/export/index.cjs +8 -6
- package/dist/export/index.js +7 -5
- package/dist/extensions/index.cjs +11 -9
- package/dist/extensions/index.js +10 -8
- package/dist/gradient/index.cjs +33 -31
- package/dist/gradient/index.js +5 -3
- package/dist/image-editor/brush-presets.d.cts +4 -1
- package/dist/image-editor/brush-presets.d.ts +4 -1
- package/dist/image-editor/controller.d.cts +10 -5
- package/dist/image-editor/controller.d.ts +10 -5
- package/dist/image-editor/index.cjs +1090 -1073
- package/dist/image-editor/index.js +37 -20
- package/dist/index.cjs +17 -15
- package/dist/index.js +11 -9
- package/dist/paint-editor/brushes.d.cts +18 -1
- package/dist/paint-editor/brushes.d.ts +18 -1
- package/dist/paint-editor/collaboration-tools.d.cts +19 -0
- package/dist/paint-editor/collaboration-tools.d.ts +19 -0
- package/dist/paint-editor/collaboration.d.cts +180 -0
- package/dist/paint-editor/collaboration.d.ts +180 -0
- package/dist/paint-editor/controller.d.cts +83 -0
- package/dist/paint-editor/controller.d.ts +83 -0
- package/dist/paint-editor/engine.d.cts +7 -0
- package/dist/paint-editor/engine.d.ts +7 -0
- package/dist/paint-editor/index.cjs +2027 -1331
- package/dist/paint-editor/index.d.cts +2 -0
- package/dist/paint-editor/index.d.ts +2 -0
- package/dist/paint-editor/index.js +1671 -975
- package/dist/paint-editor/mark-settings.d.cts +1 -1
- package/dist/paint-editor/mark-settings.d.ts +1 -1
- package/dist/paint-editor/procedural.d.cts +4 -2
- package/dist/paint-editor/procedural.d.ts +4 -2
- package/dist/paint-editor/stamp-tip.d.cts +45 -0
- package/dist/paint-editor/stamp-tip.d.ts +45 -0
- package/dist/paint-editor/stroke.d.cts +2 -0
- package/dist/paint-editor/stroke.d.ts +2 -0
- package/dist/stickers/index.cjs +4 -2
- package/dist/stickers/index.js +6 -4
- package/dist/typography/index.cjs +3 -2
- package/dist/typography/index.js +2 -1
- package/dist/vector/index.cjs +971 -969
- package/dist/vector/index.js +8 -6
- package/dist/video-editor/index.cjs +4 -2
- package/dist/video-editor/index.js +4 -2
- package/package.json +1 -1
- package/skills/pixerate-brushes/SKILL.md +21 -11
- package/skills/pixerate-brushes-design/SKILL.md +6 -2
- package/skills/pixerate-brushes-design/evals/canvas-chalk.json +8 -8
- package/skills/pixerate-canvas/SKILL.md +3 -2
- package/skills/pixerate-image-editor/SKILL.md +1 -1
- package/skills/pixerate-paint-editor/SKILL.md +35 -47
- package/skills/pixerate-paint-editor/references/painting-alongside.md +19 -0
- package/skills/pixerate-vector/SKILL.md +1 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkJSDND7DFcjs = require('./chunk-JSDND7DF.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkU67EN7GGcjs = require('./chunk-U67EN7GG.cjs');
|
|
11
|
+
|
|
12
|
+
// src/stickers/tools.ts
|
|
13
|
+
var READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
14
|
+
var WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
15
|
+
function stickerForAgent(provider, s) {
|
|
16
|
+
const { id, thumbnail: _thumbnail, ...rest } = s;
|
|
17
|
+
return { ref: _chunkJSDND7DFcjs.stickerRefOf.call(void 0, provider, id), ...rest };
|
|
18
|
+
}
|
|
19
|
+
async function knownRefs(provider, cap = 500) {
|
|
20
|
+
const refs = [];
|
|
21
|
+
let after;
|
|
22
|
+
while (refs.length < cap) {
|
|
23
|
+
const page = await provider.list({ limit: _chunkJSDND7DFcjs.MAX_STICKER_PAGE, ...after ? { after } : {} });
|
|
24
|
+
refs.push(...page.items.map((s) => _chunkJSDND7DFcjs.stickerRefOf.call(void 0, provider, s.id)));
|
|
25
|
+
if (!page.next || !page.items.length) break;
|
|
26
|
+
after = page.next;
|
|
27
|
+
}
|
|
28
|
+
return refs;
|
|
29
|
+
}
|
|
30
|
+
async function describeStickerRef(provider, ref) {
|
|
31
|
+
_chunkJSDND7DFcjs.parseStickerRef.call(void 0, ref);
|
|
32
|
+
const id = _chunkJSDND7DFcjs.stickerIdFor.call(void 0, provider, ref);
|
|
33
|
+
const found = id === null ? void 0 : await provider.describe(id);
|
|
34
|
+
if (found) return found;
|
|
35
|
+
const near = _chunkJSDND7DFcjs.closestStickerRefs.call(void 0, ref, await knownRefs(provider));
|
|
36
|
+
const owner = _chunkJSDND7DFcjs.parseStickerRef.call(void 0, ref).provider;
|
|
37
|
+
const where = id === null && !provider.namespaced ? ` The sticker library is "${provider.id}", not "${owner}".` : "";
|
|
38
|
+
throw new (0, _chunkU67EN7GGcjs.StickerError)("unknown_sticker", `No sticker "${ref}".${where} Closest: ${near.join(", ") || "none"}; find_stickers lists them.`);
|
|
39
|
+
}
|
|
40
|
+
function createStickerTools(options) {
|
|
41
|
+
const find = {
|
|
42
|
+
name: "find_stickers",
|
|
43
|
+
title: "Find stickers",
|
|
44
|
+
description: "Searches the sticker library (the editor's own stamps unless the host plugged in its own): words in the name, tags, category or description, filtered by category, tags and commercial licence, a small page at a time. Returns each sticker's ref (provider:id, for the tools that spray or place stickers), name, category, tags, natural width and height, formats, whether it is tintable (recoloured to the paint colour) and its licence, plus total and next (pass as after for the next page) and the categories. Changes nothing.",
|
|
45
|
+
inputSchema: {
|
|
46
|
+
type: "object",
|
|
47
|
+
properties: {
|
|
48
|
+
query: { type: "string", maxLength: 200, description: "Words to match (default: list everything)." },
|
|
49
|
+
category: { type: "string", description: "Only this category (the result lists them)." },
|
|
50
|
+
tags: { type: "array", maxItems: 10, items: { type: "string", description: "A tag." }, description: "Only stickers with every one of these tags." },
|
|
51
|
+
commercial: { type: "boolean", description: "true: only stickers whose licence allows commercial use." },
|
|
52
|
+
limit: { type: "integer", minimum: 1, maximum: _chunkJSDND7DFcjs.MAX_STICKER_PAGE, description: "Page size (default 24)." },
|
|
53
|
+
after: { type: "string", description: "next from the previous page." }
|
|
54
|
+
},
|
|
55
|
+
additionalProperties: false
|
|
56
|
+
},
|
|
57
|
+
annotations: { title: "Find stickers", ...READ },
|
|
58
|
+
handler: async ({ query, category, tags, commercial, limit, after }) => {
|
|
59
|
+
const p = options.provider();
|
|
60
|
+
const categories = await _asyncNullishCoalesce(await _optionalChain([p, 'access', _ => _.categories, 'optionalCall', _2 => _2()]), async () => ( null));
|
|
61
|
+
if (category !== void 0 && categories && !categories.some((c) => c.id === category)) {
|
|
62
|
+
throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `No category "${category}" in "${p.name}"; categories: ${categories.map((c) => c.id).join(", ")}.`);
|
|
63
|
+
}
|
|
64
|
+
const o = { ...category !== void 0 ? { category } : {}, ...tags ? { tags } : {}, ...commercial ? { licence: { commercial: true } } : {}, ...limit !== void 0 ? { limit } : {}, ...after !== void 0 ? { after } : {} };
|
|
65
|
+
const q = typeof query === "string" ? query.trim() : "";
|
|
66
|
+
if (q && !p.capabilities.supportsSearch) throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `"${p.name}" can't search; leave query out and filter by category instead.`);
|
|
67
|
+
const page = q ? await p.search(q, o) : await p.list(o);
|
|
68
|
+
return { provider: p.id, items: page.items.map((s) => stickerForAgent(p, s)), total: page.total, ...page.next ? { next: page.next } : {}, ...categories ? { categories } : {} };
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const describe = {
|
|
72
|
+
name: "describe_sticker",
|
|
73
|
+
title: "Describe a sticker",
|
|
74
|
+
description: "Everything about one sticker by ref (from find_stickers): name, category, tags, natural size, formats, tintable, licence (with any attribution it asks for), dominant colours, variants and its outline as SVG path data (silhouette). An unknown ref is refused with the closest refs. Changes nothing.",
|
|
75
|
+
inputSchema: { type: "object", properties: { ref: { type: "string", description: "Sticker ref provider:id from find_stickers (e.g. editor:star)." } }, required: ["ref"], additionalProperties: false },
|
|
76
|
+
annotations: { title: "Describe a sticker", ...READ },
|
|
77
|
+
handler: async ({ ref }) => {
|
|
78
|
+
const p = options.provider();
|
|
79
|
+
const d = await describeStickerRef(p, ref);
|
|
80
|
+
const { thumbnail: _thumbnail, id, ...rest } = d;
|
|
81
|
+
return { ref: _chunkJSDND7DFcjs.stickerRefOf.call(void 0, p, id), ...rest };
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
return options.insert ? [find, describe, createInsertStickerTool(options.provider, options.insert)] : [find, describe];
|
|
85
|
+
}
|
|
86
|
+
async function loadForHost(provider, ref, d, host, colour, size) {
|
|
87
|
+
const id = _chunkJSDND7DFcjs.stickerIdFor.call(void 0, provider, ref);
|
|
88
|
+
const format = d.formats.includes(host.format) ? host.format : _nullishCoalesce(d.formats[0], () => ( host.format));
|
|
89
|
+
return provider.load(id, { format, ...format === "png" ? { size: Math.max(8, Math.min(_nullishCoalesce(provider.capabilities.maxSize, () => ( 1024)), Math.round(size))) } : {}, ...colour && d.tintable ? { colour } : {} });
|
|
90
|
+
}
|
|
91
|
+
async function insertSticker(provider, host, options) {
|
|
92
|
+
const d = await describeStickerRef(provider, options.ref);
|
|
93
|
+
if (options.color !== void 0 && !d.tintable) throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `"${options.ref}" is not tintable (its art has its own colours); leave color out, or pick a tintable sticker (find_stickers lists tintable).`);
|
|
94
|
+
if (options.width !== void 0 && !(options.width > 0)) throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `width must be a positive size, got ${options.width}.`);
|
|
95
|
+
const w = _nullishCoalesce(options.width, () => ( d.width));
|
|
96
|
+
const h = w * d.height / d.width;
|
|
97
|
+
const centre = host.defaultCentre();
|
|
98
|
+
const asset = await loadForHost(provider, options.ref, d, host, options.color, Math.max(w, h));
|
|
99
|
+
const ref = _chunkJSDND7DFcjs.stickerRefOf.call(void 0, provider, d.id);
|
|
100
|
+
const made = await host.insert({ ref, description: d, asset, x: _nullishCoalesce(options.x, () => ( centre.x)), y: _nullishCoalesce(options.y, () => ( centre.y)), width: w, height: h, ...options.color ? { colour: options.color.toLowerCase() } : {} });
|
|
101
|
+
return { ...made, ref, width: w, height: h, licence: d.licence };
|
|
102
|
+
}
|
|
103
|
+
function createInsertStickerTool(provider, host) {
|
|
104
|
+
return {
|
|
105
|
+
name: "insert_sticker",
|
|
106
|
+
title: "Insert a sticker",
|
|
107
|
+
description: `Puts one sticker from the sticker library (ref from find_stickers) into the document as a new ${host.noun}, centred at x, y and width wide (its natural aspect kept; default its natural size), tinted to color when the sticker is tintable. Its art is loaded first; an unknown ref is refused with the closest ones. One undo step. Returns the new ${host.noun}'s id (for the editor's own tools, such as effects on it), the ref and its licence (credit any attribution it asks for).`,
|
|
108
|
+
inputSchema: {
|
|
109
|
+
type: "object",
|
|
110
|
+
properties: {
|
|
111
|
+
ref: { type: "string", minLength: 1, description: "Sticker ref provider:id from find_stickers (e.g. editor:star)." },
|
|
112
|
+
x: { type: "number", description: "Centre x in document units (default the middle of the view or document)." },
|
|
113
|
+
y: { type: "number", description: "Centre y in document units (default the middle of the view or document)." },
|
|
114
|
+
width: { type: "number", exclusiveMinimum: 0, maximum: 1e4, description: "Width in document units (default the natural width); the height follows the aspect." },
|
|
115
|
+
color: { type: "string", pattern: "^#[0-9a-fA-F]{6}$", description: "Tint #rrggbb for tintable stickers (default the sticker's own colour); refused for stickers that are not tintable." }
|
|
116
|
+
},
|
|
117
|
+
required: ["ref"],
|
|
118
|
+
additionalProperties: false
|
|
119
|
+
},
|
|
120
|
+
annotations: { title: "Insert a sticker", ...WRITE },
|
|
121
|
+
handler: ({ ref, x, y, width, color }) => insertSticker(provider(), host, { ref, x, y, width, color })
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function createStickerToolProvider(options) {
|
|
125
|
+
return {
|
|
126
|
+
id: _nullishCoalesce(options.id, () => ( "stickers")),
|
|
127
|
+
namespace: options.namespace,
|
|
128
|
+
title: "Stickers",
|
|
129
|
+
description: "Find and describe stickers from the sticker library, by ref (provider:id), for the editors that spray or place them.",
|
|
130
|
+
skill: "pixerate-stickers",
|
|
131
|
+
tools: createStickerTools(options)
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
exports.stickerForAgent = stickerForAgent; exports.describeStickerRef = describeStickerRef; exports.createStickerTools = createStickerTools; exports.insertSticker = insertSticker; exports.createInsertStickerTool = createInsertStickerTool; exports.createStickerToolProvider = createStickerToolProvider;
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
CHART_OOXML_NS,
|
|
9
9
|
chartFromOoxml
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-2VJ6OVJV.js";
|
|
11
11
|
import {
|
|
12
12
|
compareDocuments
|
|
13
13
|
} from "./chunk-V5OOP74P.js";
|
|
@@ -35,10 +35,10 @@ import {
|
|
|
35
35
|
searchDocument,
|
|
36
36
|
sliceContainsTable,
|
|
37
37
|
syncInitialContent
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-ITURMC2M.js";
|
|
39
39
|
import {
|
|
40
40
|
chartDataToTable
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-47V3WXDG.js";
|
|
42
42
|
import {
|
|
43
43
|
PIXERATE_DOCUMENT_MIME,
|
|
44
44
|
getClipboardData,
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatHex,
|
|
3
|
+
toSrgbGamut
|
|
4
|
+
} from "./chunk-JC2SHA4A.js";
|
|
5
|
+
import {
|
|
6
|
+
contrastLevel,
|
|
7
|
+
contrastRatio,
|
|
8
|
+
oklabToOklch,
|
|
9
|
+
oklabToRgb,
|
|
10
|
+
oklchToOklab,
|
|
11
|
+
parseColor,
|
|
12
|
+
rgbToOklab
|
|
13
|
+
} from "./chunk-MHLU6GRJ.js";
|
|
14
|
+
|
|
15
|
+
// src/color/suggest.ts
|
|
16
|
+
function suggestAccessibleForeground(foreground, background, options = {}) {
|
|
17
|
+
const large = options.large ?? false;
|
|
18
|
+
const lch = oklabToOklch(rgbToOklab(foreground));
|
|
19
|
+
const asHex = (l) => parseColor(formatHex(toSrgbGamut(oklabToRgb(oklchToOklab({ ...lch, l })))));
|
|
20
|
+
for (let d = 0.01; d <= 1; d += 0.01) {
|
|
21
|
+
const downCand = asHex(Math.max(0, lch.l - d));
|
|
22
|
+
const upCand = asHex(Math.min(1, lch.l + d));
|
|
23
|
+
const downRatio = contrastRatio(downCand, background);
|
|
24
|
+
const upRatio = contrastRatio(upCand, background);
|
|
25
|
+
const downPass = contrastLevel(downRatio, { large }) !== "fail";
|
|
26
|
+
const upPass = contrastLevel(upRatio, { large }) !== "fail";
|
|
27
|
+
if (downPass && upPass) return formatHex(downRatio >= upRatio ? downCand : upCand);
|
|
28
|
+
if (downPass) return formatHex(downCand);
|
|
29
|
+
if (upPass) return formatHex(upCand);
|
|
30
|
+
}
|
|
31
|
+
return void 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
suggestAccessibleForeground
|
|
36
|
+
};
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EDITOR_STICKERS_ID,
|
|
3
|
-
MAX_STICKER_PAGE,
|
|
4
3
|
STAMP_KINDS,
|
|
5
|
-
closestStickerRefs,
|
|
6
|
-
parseStickerRef,
|
|
7
4
|
stampCoverage,
|
|
8
|
-
stickerIdFor,
|
|
9
5
|
stickerPage,
|
|
10
6
|
stickerRefOf
|
|
11
7
|
} from "./chunk-APX63ILU.js";
|
|
@@ -16,129 +12,6 @@ import {
|
|
|
16
12
|
pngDataUrl
|
|
17
13
|
} from "./chunk-OTTT5N3K.js";
|
|
18
14
|
|
|
19
|
-
// src/stickers/tools.ts
|
|
20
|
-
var READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
21
|
-
var WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
22
|
-
function stickerForAgent(provider, s) {
|
|
23
|
-
const { id, thumbnail: _thumbnail, ...rest } = s;
|
|
24
|
-
return { ref: stickerRefOf(provider, id), ...rest };
|
|
25
|
-
}
|
|
26
|
-
async function knownRefs(provider, cap = 500) {
|
|
27
|
-
const refs = [];
|
|
28
|
-
let after;
|
|
29
|
-
while (refs.length < cap) {
|
|
30
|
-
const page = await provider.list({ limit: MAX_STICKER_PAGE, ...after ? { after } : {} });
|
|
31
|
-
refs.push(...page.items.map((s) => stickerRefOf(provider, s.id)));
|
|
32
|
-
if (!page.next || !page.items.length) break;
|
|
33
|
-
after = page.next;
|
|
34
|
-
}
|
|
35
|
-
return refs;
|
|
36
|
-
}
|
|
37
|
-
async function describeStickerRef(provider, ref) {
|
|
38
|
-
parseStickerRef(ref);
|
|
39
|
-
const id = stickerIdFor(provider, ref);
|
|
40
|
-
const found = id === null ? void 0 : await provider.describe(id);
|
|
41
|
-
if (found) return found;
|
|
42
|
-
const near = closestStickerRefs(ref, await knownRefs(provider));
|
|
43
|
-
const owner = parseStickerRef(ref).provider;
|
|
44
|
-
const where = id === null && !provider.namespaced ? ` The sticker library is "${provider.id}", not "${owner}".` : "";
|
|
45
|
-
throw new StickerError("unknown_sticker", `No sticker "${ref}".${where} Closest: ${near.join(", ") || "none"}; find_stickers lists them.`);
|
|
46
|
-
}
|
|
47
|
-
function createStickerTools(options) {
|
|
48
|
-
const find = {
|
|
49
|
-
name: "find_stickers",
|
|
50
|
-
title: "Find stickers",
|
|
51
|
-
description: "Searches the sticker library (the editor's own stamps unless the host plugged in its own): words in the name, tags, category or description, filtered by category, tags and commercial licence, a small page at a time. Returns each sticker's ref (provider:id, for the tools that spray or place stickers), name, category, tags, natural width and height, formats, whether it is tintable (recoloured to the paint colour) and its licence, plus total and next (pass as after for the next page) and the categories. Changes nothing.",
|
|
52
|
-
inputSchema: {
|
|
53
|
-
type: "object",
|
|
54
|
-
properties: {
|
|
55
|
-
query: { type: "string", maxLength: 200, description: "Words to match (default: list everything)." },
|
|
56
|
-
category: { type: "string", description: "Only this category (the result lists them)." },
|
|
57
|
-
tags: { type: "array", maxItems: 10, items: { type: "string", description: "A tag." }, description: "Only stickers with every one of these tags." },
|
|
58
|
-
commercial: { type: "boolean", description: "true: only stickers whose licence allows commercial use." },
|
|
59
|
-
limit: { type: "integer", minimum: 1, maximum: MAX_STICKER_PAGE, description: "Page size (default 24)." },
|
|
60
|
-
after: { type: "string", description: "next from the previous page." }
|
|
61
|
-
},
|
|
62
|
-
additionalProperties: false
|
|
63
|
-
},
|
|
64
|
-
annotations: { title: "Find stickers", ...READ },
|
|
65
|
-
handler: async ({ query, category, tags, commercial, limit, after }) => {
|
|
66
|
-
const p = options.provider();
|
|
67
|
-
const categories = await p.categories?.() ?? null;
|
|
68
|
-
if (category !== void 0 && categories && !categories.some((c) => c.id === category)) {
|
|
69
|
-
throw new StickerError("invalid_argument", `No category "${category}" in "${p.name}"; categories: ${categories.map((c) => c.id).join(", ")}.`);
|
|
70
|
-
}
|
|
71
|
-
const o = { ...category !== void 0 ? { category } : {}, ...tags ? { tags } : {}, ...commercial ? { licence: { commercial: true } } : {}, ...limit !== void 0 ? { limit } : {}, ...after !== void 0 ? { after } : {} };
|
|
72
|
-
const q = typeof query === "string" ? query.trim() : "";
|
|
73
|
-
if (q && !p.capabilities.supportsSearch) throw new StickerError("invalid_argument", `"${p.name}" can't search; leave query out and filter by category instead.`);
|
|
74
|
-
const page = q ? await p.search(q, o) : await p.list(o);
|
|
75
|
-
return { provider: p.id, items: page.items.map((s) => stickerForAgent(p, s)), total: page.total, ...page.next ? { next: page.next } : {}, ...categories ? { categories } : {} };
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
const describe = {
|
|
79
|
-
name: "describe_sticker",
|
|
80
|
-
title: "Describe a sticker",
|
|
81
|
-
description: "Everything about one sticker by ref (from find_stickers): name, category, tags, natural size, formats, tintable, licence (with any attribution it asks for), dominant colours, variants and its outline as SVG path data (silhouette). An unknown ref is refused with the closest refs. Changes nothing.",
|
|
82
|
-
inputSchema: { type: "object", properties: { ref: { type: "string", description: "Sticker ref provider:id from find_stickers (e.g. editor:star)." } }, required: ["ref"], additionalProperties: false },
|
|
83
|
-
annotations: { title: "Describe a sticker", ...READ },
|
|
84
|
-
handler: async ({ ref }) => {
|
|
85
|
-
const p = options.provider();
|
|
86
|
-
const d = await describeStickerRef(p, ref);
|
|
87
|
-
const { thumbnail: _thumbnail, id, ...rest } = d;
|
|
88
|
-
return { ref: stickerRefOf(p, id), ...rest };
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
return options.insert ? [find, describe, createInsertStickerTool(options.provider, options.insert)] : [find, describe];
|
|
92
|
-
}
|
|
93
|
-
async function loadForHost(provider, ref, d, host, colour, size) {
|
|
94
|
-
const id = stickerIdFor(provider, ref);
|
|
95
|
-
const format = d.formats.includes(host.format) ? host.format : d.formats[0] ?? host.format;
|
|
96
|
-
return provider.load(id, { format, ...format === "png" ? { size: Math.max(8, Math.min(provider.capabilities.maxSize ?? 1024, Math.round(size))) } : {}, ...colour && d.tintable ? { colour } : {} });
|
|
97
|
-
}
|
|
98
|
-
async function insertSticker(provider, host, options) {
|
|
99
|
-
const d = await describeStickerRef(provider, options.ref);
|
|
100
|
-
if (options.color !== void 0 && !d.tintable) throw new StickerError("invalid_argument", `"${options.ref}" is not tintable (its art has its own colours); leave color out, or pick a tintable sticker (find_stickers lists tintable).`);
|
|
101
|
-
if (options.width !== void 0 && !(options.width > 0)) throw new StickerError("invalid_argument", `width must be a positive size, got ${options.width}.`);
|
|
102
|
-
const w = options.width ?? d.width;
|
|
103
|
-
const h = w * d.height / d.width;
|
|
104
|
-
const centre = host.defaultCentre();
|
|
105
|
-
const asset = await loadForHost(provider, options.ref, d, host, options.color, Math.max(w, h));
|
|
106
|
-
const ref = stickerRefOf(provider, d.id);
|
|
107
|
-
const made = await host.insert({ ref, description: d, asset, x: options.x ?? centre.x, y: options.y ?? centre.y, width: w, height: h, ...options.color ? { colour: options.color.toLowerCase() } : {} });
|
|
108
|
-
return { ...made, ref, width: w, height: h, licence: d.licence };
|
|
109
|
-
}
|
|
110
|
-
function createInsertStickerTool(provider, host) {
|
|
111
|
-
return {
|
|
112
|
-
name: "insert_sticker",
|
|
113
|
-
title: "Insert a sticker",
|
|
114
|
-
description: `Puts one sticker from the sticker library (ref from find_stickers) into the document as a new ${host.noun}, centred at x, y and width wide (its natural aspect kept; default its natural size), tinted to color when the sticker is tintable. Its art is loaded first; an unknown ref is refused with the closest ones. One undo step. Returns the new ${host.noun}'s id (for the editor's own tools, such as effects on it), the ref and its licence (credit any attribution it asks for).`,
|
|
115
|
-
inputSchema: {
|
|
116
|
-
type: "object",
|
|
117
|
-
properties: {
|
|
118
|
-
ref: { type: "string", minLength: 1, description: "Sticker ref provider:id from find_stickers (e.g. editor:star)." },
|
|
119
|
-
x: { type: "number", description: "Centre x in document units (default the middle of the view or document)." },
|
|
120
|
-
y: { type: "number", description: "Centre y in document units (default the middle of the view or document)." },
|
|
121
|
-
width: { type: "number", exclusiveMinimum: 0, maximum: 1e4, description: "Width in document units (default the natural width); the height follows the aspect." },
|
|
122
|
-
color: { type: "string", pattern: "^#[0-9a-fA-F]{6}$", description: "Tint #rrggbb for tintable stickers (default the sticker's own colour); refused for stickers that are not tintable." }
|
|
123
|
-
},
|
|
124
|
-
required: ["ref"],
|
|
125
|
-
additionalProperties: false
|
|
126
|
-
},
|
|
127
|
-
annotations: { title: "Insert a sticker", ...WRITE },
|
|
128
|
-
handler: ({ ref, x, y, width, color }) => insertSticker(provider(), host, { ref, x, y, width, color })
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
function createStickerToolProvider(options) {
|
|
132
|
-
return {
|
|
133
|
-
id: options.id ?? "stickers",
|
|
134
|
-
namespace: options.namespace,
|
|
135
|
-
title: "Stickers",
|
|
136
|
-
description: "Find and describe stickers from the sticker library, by ref (provider:id), for the editors that spray or place them.",
|
|
137
|
-
skill: "pixerate-stickers",
|
|
138
|
-
tools: createStickerTools(options)
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
|
|
142
15
|
// src/stickers/editor.ts
|
|
143
16
|
var BOX = 100;
|
|
144
17
|
var GRID = 128;
|
|
@@ -423,12 +296,6 @@ var StickerBrowser = class {
|
|
|
423
296
|
};
|
|
424
297
|
|
|
425
298
|
export {
|
|
426
|
-
stickerForAgent,
|
|
427
|
-
describeStickerRef,
|
|
428
|
-
createStickerTools,
|
|
429
|
-
insertSticker,
|
|
430
|
-
createInsertStickerTool,
|
|
431
|
-
createStickerToolProvider,
|
|
432
299
|
stampOutline,
|
|
433
300
|
stampPixels,
|
|
434
301
|
editorStickers,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseCssColor
|
|
3
|
+
} from "./chunk-3CI7FRMK.js";
|
|
4
|
+
import {
|
|
5
|
+
isDualColor,
|
|
6
|
+
resolveColor
|
|
7
|
+
} from "./chunk-VR6OGHU5.js";
|
|
8
|
+
|
|
9
|
+
// src/brushes/colour.ts
|
|
10
|
+
function brushColourHex(value, scheme) {
|
|
11
|
+
const css = typeof value === "string" || isDualColor(value) ? resolveColor(value, scheme) : null;
|
|
12
|
+
return css ? parseCssColor(css)?.hex.toLowerCase() ?? null : null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
brushColourHex
|
|
17
|
+
};
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkP6WYDBTHcjs = require('./chunk-P6WYDBTH.cjs');
|
|
22
22
|
|
|
23
23
|
// src/chart/schemas.ts
|
|
24
24
|
var VALUE = { type: ["number", "string", "null"], description: 'A number, numeric text ("1,200", "12%", "$40", "(3)") or null for a gap.' };
|
|
@@ -30,7 +30,7 @@ var FORMAT = {
|
|
|
30
30
|
type: "object",
|
|
31
31
|
description: "How numbers are written on this axis or series.",
|
|
32
32
|
properties: {
|
|
33
|
-
style: { type: "string", enum: [...
|
|
33
|
+
style: { type: "string", enum: [..._chunkP6WYDBTHcjs.CHART_NUMBER_STYLES], description: "number (default), percent (0.25 \u2192 25%), currency or compact (1.2K)." },
|
|
34
34
|
decimals: { type: "integer", minimum: 0, maximum: 10, description: "Fixed decimals (default: what the ticks need)." },
|
|
35
35
|
currency: { type: "string", description: 'ISO currency code for style "currency", e.g. "EUR" (default USD).' },
|
|
36
36
|
prefix: { type: "string", description: "Text before every number." },
|
|
@@ -50,10 +50,10 @@ var AXIS = (what) => ({
|
|
|
50
50
|
step: { type: ["number", "null"], exclusiveMinimum: 0, description: "Fixed distance between ticks, or null for automatic." },
|
|
51
51
|
gridlines: { type: "boolean", description: "Grid lines at each tick." },
|
|
52
52
|
format: FORMAT,
|
|
53
|
-
kind: { type: ["string", "null"], enum: [...
|
|
53
|
+
kind: { type: ["string", "null"], enum: [..._chunkP6WYDBTHcjs.CHART_AXIS_KINDS, null], description: 'Category axis only: "date" reads categories as dates and labels them by calendar steps.' },
|
|
54
54
|
scale: {
|
|
55
55
|
type: ["string", "null"],
|
|
56
|
-
enum: [...
|
|
56
|
+
enum: [..._chunkP6WYDBTHcjs.CHART_AXIS_SCALES, null],
|
|
57
57
|
description: 'Value axes and the numeric x axis of scatter / bubble charts: "log" spaces ticks by powers of logBase (values of 0 or less are skipped; min and max must be above 0; not with percent stacking). "linear" or null is the default. Ignored on a category axis.'
|
|
58
58
|
},
|
|
59
59
|
logBase: { type: ["number", "null"], minimum: 2, maximum: 1e3, description: "Base of a log axis, 2 to 1000 (default 10; null resets)." },
|
|
@@ -62,7 +62,7 @@ var AXIS = (what) => ({
|
|
|
62
62
|
additionalProperties: false
|
|
63
63
|
});
|
|
64
64
|
var TRENDLINE_PROPS = {
|
|
65
|
-
type: { type: "string", enum: [...
|
|
65
|
+
type: { type: "string", enum: [..._chunkP6WYDBTHcjs.CHART_TRENDLINE_TYPES], description: "Fit: linear, exponential, logarithmic, power, polynomial or moving-average." },
|
|
66
66
|
order: { type: "integer", minimum: 2, maximum: 6, description: "Polynomial order (default 2)." },
|
|
67
67
|
period: { type: "integer", minimum: 2, description: "Moving-average period in points (default 2)." },
|
|
68
68
|
forward: { type: "number", minimum: 0, description: "Extend the line this many x units past the last point (default 0)." },
|
|
@@ -77,7 +77,7 @@ var REFERENCE_COMMON = {
|
|
|
77
77
|
label: { type: "string", description: 'Text written on it, e.g. "Target" (default none).' },
|
|
78
78
|
axis: {
|
|
79
79
|
type: "string",
|
|
80
|
-
enum: [...
|
|
80
|
+
enum: [..._chunkP6WYDBTHcjs.CHART_REFERENCE_AXES],
|
|
81
81
|
description: "Axis it is measured on: y (default) is the value axis, y2 the secondary value axis (needs a series there), x the numeric x axis of a scatter or bubble chart."
|
|
82
82
|
},
|
|
83
83
|
color: { type: "string", description: "CSS colour (default: the text colour)." }
|
|
@@ -93,7 +93,7 @@ var REFERENCE_BAND_PROPS = {
|
|
|
93
93
|
};
|
|
94
94
|
var REFERENCE_COMMON_PATCH = {
|
|
95
95
|
label: { type: ["string", "null"], description: "Text written on it; null removes it." },
|
|
96
|
-
axis: { type: ["string", "null"], enum: [...
|
|
96
|
+
axis: { type: ["string", "null"], enum: [..._chunkP6WYDBTHcjs.CHART_REFERENCE_AXES, null], description: "Axis it is measured on (y, y2 or x); null goes back to y." },
|
|
97
97
|
color: { type: ["string", "null"], description: "CSS colour; null goes back to the text colour." }
|
|
98
98
|
};
|
|
99
99
|
var REFERENCE_LINE_PATCH = { value: REFERENCE_LINE_PROPS.value, ...REFERENCE_COMMON_PATCH };
|
|
@@ -127,13 +127,13 @@ var ERROR_BARS = (what) => ({
|
|
|
127
127
|
properties: {
|
|
128
128
|
type: {
|
|
129
129
|
type: "string",
|
|
130
|
-
enum: [...
|
|
130
|
+
enum: [..._chunkP6WYDBTHcjs.CHART_ERROR_BAR_TYPES],
|
|
131
131
|
description: "fixed: the same amount at every point; percent: a percentage of each value; stddev: value standard deviations of the series, drawn around the series mean (as Excel does); stderr: the standard error of the series at every point; custom: per-point plus / minus amounts."
|
|
132
132
|
},
|
|
133
133
|
value: { type: "number", minimum: 0, description: "Amount in data units for fixed (default 1), percent of each value for percent (default 5), number of standard deviations for stddev (default 1). Not for stderr or custom." },
|
|
134
134
|
plus: { type: "array", items: VALUE, description: "custom only: amount above each point, one per category, in data units (0 or more; null for none)." },
|
|
135
135
|
minus: { type: "array", items: VALUE, description: "custom only: amount below each point, one per category (default: the plus amounts)." },
|
|
136
|
-
direction: { type: "string", enum: [...
|
|
136
|
+
direction: { type: "string", enum: [..._chunkP6WYDBTHcjs.CHART_ERROR_BAR_DIRECTIONS], description: "both (default), plus (only above) or minus (only below)." },
|
|
137
137
|
cap: { type: "boolean", description: "Draw end caps (default true)." }
|
|
138
138
|
},
|
|
139
139
|
required: ["type"],
|
|
@@ -143,22 +143,22 @@ var SERIES_PROPS = {
|
|
|
143
143
|
name: { type: "string", description: "Series name (legend and data grid header)." },
|
|
144
144
|
values: { type: "array", items: VALUE, description: "One value per category, in category order (padded with gaps)." },
|
|
145
145
|
color: { type: ["string", "null"], description: "CSS colour, or null for the palette colour." },
|
|
146
|
-
type: { type: ["string", "null"], enum: [...
|
|
146
|
+
type: { type: ["string", "null"], enum: [..._chunkP6WYDBTHcjs.CHART_SERIES_TYPES, null], description: "Draw this series as bar, line, area or scatter (a combo chart); null follows the chart type." },
|
|
147
147
|
hidden: { type: "boolean", description: "Hide the series (its data is kept)." },
|
|
148
148
|
axis: { type: ["string", "null"], enum: ["primary", "secondary", null], description: "Value axis: secondary is drawn on the right with its own scale." },
|
|
149
149
|
x: { type: ["array", "null"], items: VALUE, description: "Numeric x per category, for scatter and bubble charts." },
|
|
150
150
|
sizes: { type: ["array", "null"], items: VALUE, description: "Bubble sizes per category (area is proportional to size)." },
|
|
151
151
|
pointColors: { type: ["array", "null"], items: { type: ["string", "null"] }, description: "Colour per category (null keeps the series colour)." },
|
|
152
152
|
callouts: { type: ["array", "null"], items: { type: ["string", "null"] }, description: "A label pinned to each point that matters, one per category (null: none); null removes them all. Bar, line, area and scatter charts. set_chart_callout sets one." },
|
|
153
|
-
marker: { type: ["string", "null"], enum: [...
|
|
154
|
-
curve: { type: ["string", "null"], enum: [...
|
|
153
|
+
marker: { type: ["string", "null"], enum: [..._chunkP6WYDBTHcjs.CHART_MARKERS, null], description: "Point marker shape for line, area and scatter series." },
|
|
154
|
+
curve: { type: ["string", "null"], enum: [..._chunkP6WYDBTHcjs.CHART_CURVES, null], description: "Line shape for this series: linear, smooth or step." },
|
|
155
155
|
dataLabels: { type: ["boolean", "null"], description: "Value labels for this series (null follows the chart)." },
|
|
156
156
|
format: { ...FORMAT, type: ["object", "null"], description: "How this series' labels are written (null follows the value axis)." },
|
|
157
157
|
errorBars: ERROR_BARS("Error bars along the value axis (bar, line, area and scatter series; on stacked charts they sit on the stack top)."),
|
|
158
158
|
xErrorBars: ERROR_BARS("Error bars along the x axis (scatter and bubble charts with numeric x values; amounts in x units).")
|
|
159
159
|
};
|
|
160
160
|
var CHART_UPDATE_PROPERTIES = {
|
|
161
|
-
type: { type: "string", enum: [...
|
|
161
|
+
type: { type: "string", enum: [..._chunkP6WYDBTHcjs.CHART_TYPES], description: "Chart type. streamgraph stacks areas symmetrically around a center baseline; slope joins each category from the first series (before) to the second (after); likert reads each category as a question and the series as answers from most negative to most positive; parliament draws the first series as seats; sunburst draws the grouped data (set_chart_tree) as rings, and a treemap with grouped data nests its groups; sankey draws the flows (set_chart_links); barrace reads categories as time points and series as names, and animates their ranking; choropleth shades the regions of a map, each category naming a region by code (FRA) or name (France)." },
|
|
162
162
|
title: { type: "string", description: 'Title ("" for none).' },
|
|
163
163
|
subtitle: { type: "string", description: 'Subtitle ("" for none).' },
|
|
164
164
|
xAxis: AXIS("Category axis (or numeric x axis of scatter / bubble charts)."),
|
|
@@ -167,15 +167,15 @@ var CHART_UPDATE_PROPERTIES = {
|
|
|
167
167
|
legend: {
|
|
168
168
|
type: "object",
|
|
169
169
|
description: "Legend.",
|
|
170
|
-
properties: { show: { type: "boolean", description: "Show the legend." }, position: { type: "string", enum: [...
|
|
170
|
+
properties: { show: { type: "boolean", description: "Show the legend." }, position: { type: "string", enum: [..._chunkP6WYDBTHcjs.CHART_LEGEND_POSITIONS], description: "Where the legend goes." } },
|
|
171
171
|
additionalProperties: false
|
|
172
172
|
},
|
|
173
|
-
stacking: { type: "string", enum: [...
|
|
174
|
-
orientation: { type: "string", enum: [...
|
|
175
|
-
curve: { type: "string", enum: [...
|
|
173
|
+
stacking: { type: "string", enum: [..._chunkP6WYDBTHcjs.CHART_STACKINGS], description: "none, stacked, or percent (each category scaled to 100%)." },
|
|
174
|
+
orientation: { type: "string", enum: [..._chunkP6WYDBTHcjs.CHART_ORIENTATIONS], description: "horizontal draws bars sideways." },
|
|
175
|
+
curve: { type: "string", enum: [..._chunkP6WYDBTHcjs.CHART_CURVES], description: "Line shape: linear, smooth or step." },
|
|
176
176
|
points: { type: "boolean", description: "Dots on line and area series." },
|
|
177
177
|
dataLabels: { type: "boolean", description: "Value labels on bars, points and slices." },
|
|
178
|
-
labelPosition: { type: "string", enum: [...
|
|
178
|
+
labelPosition: { type: "string", enum: [..._chunkP6WYDBTHcjs.CHART_LABEL_POSITIONS], description: "Bar label position; auto drops labels that do not fit." },
|
|
179
179
|
palette: { type: "array", items: { type: "string" }, minItems: 1, description: "Series colours in order (CSS colours)." },
|
|
180
180
|
innerRadius: { type: "number", minimum: 0, maximum: 0.9, description: "Donut hole as a fraction of the radius." },
|
|
181
181
|
gapWidth: { type: "number", minimum: 0, maximum: 0.9, description: "Space between bar groups as a fraction of the category (default 0.28)." },
|
|
@@ -183,19 +183,19 @@ var CHART_UPDATE_PROPERTIES = {
|
|
|
183
183
|
bins: { type: ["integer", "null"], minimum: 1, maximum: 500, description: "Histogram bin count, or null for \u221An." },
|
|
184
184
|
showTotal: { type: "boolean", description: "Waterfall: append a total bar." },
|
|
185
185
|
radarTicks: { type: ["integer", "null"], minimum: 1, maximum: 50, description: "Radar: number of evenly spaced rings from the value axis min to max, or null for round-number rings (default null)." },
|
|
186
|
-
radarGraticule: { type: "string", enum: [...
|
|
186
|
+
radarGraticule: { type: "string", enum: [..._chunkP6WYDBTHcjs.CHART_RADAR_GRATICULES], description: "Radar: draw rings as polygons through the spokes or as circles (default polygon)." },
|
|
187
187
|
note: { type: "string", description: 'A source or footnote written under the chart ("" for none).' },
|
|
188
188
|
highlight: { type: "array", items: { type: "string" }, description: "Category labels and series names (or ids) to draw normally while the rest are muted; [] shows everything. highlight_chart checks the names." },
|
|
189
189
|
referenceLines: { type: "array", items: { type: "object", properties: REFERENCE_LINE_PROPS, required: ["value"], additionalProperties: false }, description: "Replaces every reference line (targets, floors, averages across the plot). add_chart_reference_line adds one." },
|
|
190
190
|
referenceBands: { type: "array", items: { type: "object", properties: REFERENCE_BAND_PROPS, required: ["from", "to"], additionalProperties: false }, description: "Replaces every reference band (target ranges across the plot). add_chart_reference_band adds one." },
|
|
191
191
|
varyColors: { type: "boolean", description: "A one-series bar, line, area or scatter chart colours each category from the palette, and its legend lists the categories (default false)." },
|
|
192
|
-
likertNeutral: { type: "string", enum: [...
|
|
193
|
-
likertSort: { type: "string", enum: [...
|
|
192
|
+
likertNeutral: { type: "string", enum: [..._chunkP6WYDBTHcjs.CHART_LIKERT_NEUTRALS], description: "Likert with an odd number of answers: split (default) puts the middle answer across the centre line; separate draws it in its own column on the right." },
|
|
193
|
+
likertSort: { type: "string", enum: [..._chunkP6WYDBTHcjs.CHART_LIKERT_SORTS], description: "Likert: order the questions by agreement (positive), by disagreement (negative) or as given (none, default)." },
|
|
194
194
|
parliamentArc: { type: "number", minimum: 90, maximum: 360, description: "Parliament: sweep of the hemicycle in degrees (default 180)." },
|
|
195
195
|
parliamentMajority: { type: ["integer", "null"], minimum: 1, description: "Parliament: seats needed for a majority, drawn as a dashed line (null: half of the seats plus one)." },
|
|
196
196
|
parliamentLabel: { type: "string", description: 'Parliament: caption under the seat total ("" writes "seats").' },
|
|
197
197
|
sunburstLabel: { type: "string", description: 'Sunburst: caption under the total in the centre ("" for none).' },
|
|
198
|
-
sankeyLinkColor: { type: "string", enum: [...
|
|
198
|
+
sankeyLinkColor: { type: "string", enum: [..._chunkP6WYDBTHcjs.CHART_SANKEY_LINK_COLORS], description: "Sankey: colour each flow by its source node (default), its target node, or grey." },
|
|
199
199
|
map: { type: "string", description: 'Choropleth: the registered map to draw (list_chart_map_regions lists them; "europe" by default).' },
|
|
200
200
|
mapSteps: { type: "integer", minimum: 2, maximum: 9, description: "Choropleth: number of equal colour classes between the smallest and largest value (default 5)." },
|
|
201
201
|
mapThresholds: { type: "array", items: { type: "number" }, maxItems: 8, description: "Choropleth: class breaks in ascending order, e.g. [100, 250, 500], used instead of mapSteps; [] goes back to equal classes." },
|