@pixerate/editor 0.160.0 → 0.162.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 +36 -35
- package/dist/agent/index.js +7 -6
- package/dist/animation/index.cjs +5 -4
- package/dist/animation/index.js +4 -3
- package/dist/animation-editor/index.cjs +62 -61
- package/dist/animation-editor/index.js +6 -5
- package/dist/canvas/index.cjs +33 -32
- package/dist/canvas/index.js +6 -5
- package/dist/chart/index.cjs +88 -87
- package/dist/chart/index.js +7 -6
- package/dist/{chunk-QMI5HZWA.cjs → chunk-236TKNUR.cjs} +3 -3
- package/dist/{chunk-6UPGM3JB.js → chunk-2TKHLX6H.js} +1 -1
- package/dist/{chunk-3YDQLQH2.cjs → chunk-32MMQYCQ.cjs} +81 -81
- package/dist/{chunk-MHEXLG3M.cjs → chunk-3GJH2MGH.cjs} +37 -37
- package/dist/{chunk-AKDWAWSY.cjs → chunk-3IHNXRUV.cjs} +45 -45
- package/dist/{chunk-VKF3PWKR.cjs → chunk-3OSXHLIT.cjs} +259 -28
- package/dist/{chunk-TVO6W2Q6.cjs → chunk-4NGVHHJB.cjs} +17 -17
- package/dist/chunk-4VU4CP7R.js +769 -0
- package/dist/chunk-6DM3PUQD.cjs +767 -0
- package/dist/{chunk-DBIVICAO.js → chunk-7CKPUUN4.js} +1 -1
- package/dist/{chunk-57JLBGJ5.cjs → chunk-7YBDRJXT.cjs} +8 -8
- package/dist/{chunk-KY3FYKP3.js → chunk-BQWGN5WH.js} +1 -1
- package/dist/{chunk-LEUZ4FRC.cjs → chunk-CIPIESX4.cjs} +3 -3
- package/dist/chunk-CJE5MOIS.js +347 -0
- package/dist/{chunk-5QBRAIVK.js → chunk-CX6JLDFC.js} +3 -3
- package/dist/{chunk-R3QY7PPL.js → chunk-DTSTNRPH.js} +1 -1
- package/dist/{chunk-6LUYFHHN.cjs → chunk-EQ46F75O.cjs} +51 -51
- package/dist/{chunk-UKCJ43YL.cjs → chunk-ES3UEVUT.cjs} +130 -898
- package/dist/{chunk-UM3RPYC5.js → chunk-EVPZ5IKN.js} +1 -1
- package/dist/{chunk-XNQ5EFB4.cjs → chunk-EY22AY6R.cjs} +16 -16
- package/dist/chunk-FKUKJ3XA.cjs +347 -0
- package/dist/{chunk-YABNLNY7.js → chunk-GLMP22FT.js} +3 -3
- package/dist/{chunk-SUF6WRXR.cjs → chunk-GTELFJRE.cjs} +2 -2
- package/dist/{chunk-72BGL3I2.js → chunk-GWV4T5NZ.js} +1 -1
- package/dist/{chunk-AY65VQSU.js → chunk-H3OEM3Q2.js} +1 -1
- package/dist/{chunk-4YWAEV4W.cjs → chunk-HDGBM7EA.cjs} +26 -26
- package/dist/{chunk-H5XX4KHB.js → chunk-HLOKB7WW.js} +5 -3
- package/dist/{chunk-WNAAWLZ5.js → chunk-KGTF55R3.js} +2 -2
- package/dist/{chunk-WPPJH6X4.cjs → chunk-LL3H5XUH.cjs} +6 -4
- package/dist/{chunk-4T44CJ5K.cjs → chunk-NA4UVVJ4.cjs} +15 -15
- package/dist/{chunk-Q6PA362P.js → chunk-NO5QQDHZ.js} +2 -2
- package/dist/{chunk-AA34BA7G.js → chunk-QYZGBVNC.js} +30 -798
- package/dist/chunk-S6X2QRVU.cjs +769 -0
- package/dist/{chunk-SSCL7QQ4.js → chunk-XDCFJEU7.js} +2 -2
- package/dist/{chunk-IQ6KKXOU.js → chunk-YN4AYYBJ.js} +243 -12
- package/dist/chunk-ZGOHKS3X.js +767 -0
- package/dist/color/index.cjs +6 -2
- package/dist/color/index.d.cts +1 -0
- package/dist/color/index.d.ts +1 -0
- package/dist/color/index.js +28 -24
- package/dist/color/suggest.d.cts +12 -0
- package/dist/color/suggest.d.ts +12 -0
- package/dist/effects/index.cjs +44 -771
- package/dist/effects/index.js +34 -761
- package/dist/effects/ui.d.cts +20 -3
- package/dist/effects/ui.d.ts +20 -3
- package/dist/export/index.cjs +6 -5
- package/dist/export/index.js +5 -4
- package/dist/extensions/index.cjs +9 -8
- package/dist/extensions/index.js +8 -7
- package/dist/gradient/index.cjs +28 -26
- package/dist/gradient/index.js +7 -5
- package/dist/image-editor/index.cjs +638 -637
- package/dist/image-editor/index.js +5 -4
- package/dist/index.cjs +15 -14
- package/dist/index.js +9 -8
- package/dist/paint-editor/index.cjs +17 -16
- package/dist/paint-editor/index.js +6 -5
- package/dist/typography/accessibility.d.cts +44 -0
- package/dist/typography/accessibility.d.ts +44 -0
- package/dist/typography/catalog.d.cts +98 -0
- package/dist/typography/catalog.d.ts +98 -0
- package/dist/typography/index.cjs +1099 -0
- package/dist/typography/index.d.cts +16 -0
- package/dist/typography/index.d.ts +16 -0
- package/dist/typography/index.js +1099 -0
- package/dist/typography/metrics.d.cts +31 -0
- package/dist/typography/metrics.d.ts +31 -0
- package/dist/typography/picker.d.cts +132 -0
- package/dist/typography/picker.d.ts +132 -0
- package/dist/typography/registry.d.cts +66 -0
- package/dist/typography/registry.d.ts +66 -0
- package/dist/typography/scale.d.cts +62 -0
- package/dist/typography/scale.d.ts +62 -0
- package/dist/typography/segment.d.cts +26 -0
- package/dist/typography/segment.d.ts +26 -0
- package/dist/typography/stack.d.cts +26 -0
- package/dist/typography/stack.d.ts +26 -0
- package/dist/typography/tools.d.cts +34 -0
- package/dist/typography/tools.d.ts +34 -0
- package/dist/typography/types.d.cts +96 -0
- package/dist/typography/types.d.ts +96 -0
- package/dist/typography/weight.d.cts +13 -0
- package/dist/typography/weight.d.ts +13 -0
- package/dist/vector/index.cjs +950 -949
- package/dist/vector/index.js +5 -4
- package/dist/video-editor/audio.d.cts +9 -0
- package/dist/video-editor/audio.d.ts +9 -0
- package/dist/video-editor/check.d.cts +1 -1
- package/dist/video-editor/check.d.ts +1 -1
- package/dist/video-editor/controller.d.cts +47 -0
- package/dist/video-editor/controller.d.ts +47 -0
- package/dist/video-editor/dialogue-tools.d.cts +19 -0
- package/dist/video-editor/dialogue-tools.d.ts +19 -0
- package/dist/video-editor/effect-authoring.d.cts +54 -0
- package/dist/video-editor/effect-authoring.d.ts +54 -0
- package/dist/video-editor/evaluate.d.cts +11 -0
- package/dist/video-editor/evaluate.d.ts +11 -0
- package/dist/video-editor/export.d.cts +7 -1
- package/dist/video-editor/export.d.ts +7 -1
- package/dist/video-editor/index.cjs +1857 -531
- package/dist/video-editor/index.d.cts +7 -0
- package/dist/video-editor/index.d.ts +7 -0
- package/dist/video-editor/index.js +1516 -190
- package/dist/video-editor/lut.d.cts +12 -2
- package/dist/video-editor/lut.d.ts +12 -2
- package/dist/video-editor/mask.d.cts +48 -0
- package/dist/video-editor/mask.d.ts +48 -0
- package/dist/video-editor/mix.d.cts +107 -0
- package/dist/video-editor/mix.d.ts +107 -0
- package/dist/video-editor/music-tools.d.cts +19 -0
- package/dist/video-editor/music-tools.d.ts +19 -0
- package/dist/video-editor/parse.d.cts +3 -1
- package/dist/video-editor/parse.d.ts +3 -1
- package/dist/video-editor/plan.d.cts +75 -0
- package/dist/video-editor/plan.d.ts +75 -0
- package/dist/video-editor/render.d.cts +1 -1
- package/dist/video-editor/render.d.ts +1 -1
- package/dist/video-editor/timeline.d.cts +2 -0
- package/dist/video-editor/timeline.d.ts +2 -0
- package/dist/video-editor/tools.d.cts +90 -0
- package/dist/video-editor/tools.d.ts +90 -0
- package/dist/video-editor/transcript-controller.d.cts +106 -0
- package/dist/video-editor/transcript-controller.d.ts +106 -0
- package/dist/video-editor/transcript.d.cts +40 -0
- package/dist/video-editor/transcript.d.ts +40 -0
- package/dist/video-editor/types.d.cts +62 -2
- package/dist/video-editor/types.d.ts +62 -2
- package/dist/video-editor/ui.d.cts +21 -1
- package/dist/video-editor/ui.d.ts +21 -1
- package/package.json +11 -1
- package/skills/README.md +3 -0
- package/skills/pixerate-bgm-alignment/SKILL.md +82 -0
- package/skills/pixerate-talking-head-edit/SKILL.md +80 -0
- package/skills/pixerate-typography/SKILL.md +91 -0
- package/skills/pixerate-video-editor/SKILL.md +40 -2
|
@@ -11,10 +11,10 @@ var _chunkYN6JKAUEcjs = require('./chunk-YN6JKAUE.cjs');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkNA4UVVJ4cjs = require('./chunk-NA4UVVJ4.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkLL3H5XUHcjs = require('./chunk-LL3H5XUH.cjs');
|
|
18
18
|
|
|
19
19
|
// src/export/images.ts
|
|
20
20
|
var DOCX_IMAGE_TYPES = {
|
|
@@ -1028,12 +1028,12 @@ var DocxBuilder = (_class2 = class {
|
|
|
1028
1028
|
this.drop("node", "chart", "chart has no spec");
|
|
1029
1029
|
return;
|
|
1030
1030
|
}
|
|
1031
|
-
const spec =
|
|
1032
|
-
const written =
|
|
1031
|
+
const spec = _chunkLL3H5XUHcjs.normalizeChartSpec.call(void 0, raw).spec;
|
|
1032
|
+
const written = _chunkNA4UVVJ4cjs.chartToOoxml.call(void 0, spec);
|
|
1033
1033
|
for (const issue of written.issues) this.drop("node", "chart", issue);
|
|
1034
1034
|
const name = `chart${this.charts.length + 1}.xml`;
|
|
1035
1035
|
this.charts.push(written.xml);
|
|
1036
|
-
const relId = this.rels.add(
|
|
1036
|
+
const relId = this.rels.add(_chunkNA4UVVJ4cjs.CHART_OOXML_RELATIONSHIP, `charts/${name}`);
|
|
1037
1037
|
let width = _nullishCoalesce(pixelAttr(_optionalChain([node, 'access', _91 => _91.attrs, 'optionalAccess', _92 => _92.width])), () => ( MAX_IMAGE_WIDTH_PX));
|
|
1038
1038
|
let height = _nullishCoalesce(pixelAttr(_optionalChain([node, 'access', _93 => _93.attrs, 'optionalAccess', _94 => _94.height])), () => ( 320));
|
|
1039
1039
|
if (width > MAX_IMAGE_WIDTH_PX) {
|
|
@@ -1050,8 +1050,8 @@ var DocxBuilder = (_class2 = class {
|
|
|
1050
1050
|
drawing.empty("wp:extent", { cx, cy }).empty("wp:effectExtent", { l: 0, t: 0, r: 0, b: 0 });
|
|
1051
1051
|
drawing.empty("wp:docPr", { id, name: `Chart ${id}`, descr: title || void 0, title: title || void 0 });
|
|
1052
1052
|
drawing.empty("wp:cNvGraphicFramePr");
|
|
1053
|
-
drawing.open("a:graphic").open("a:graphicData", { uri:
|
|
1054
|
-
drawing.empty("c:chart", { "xmlns:c":
|
|
1053
|
+
drawing.open("a:graphic").open("a:graphicData", { uri: _chunkNA4UVVJ4cjs.CHART_OOXML_NS });
|
|
1054
|
+
drawing.empty("c:chart", { "xmlns:c": _chunkNA4UVVJ4cjs.CHART_OOXML_NS, "r:id": relId });
|
|
1055
1055
|
drawing.close("a:graphicData").close("a:graphic").close("wp:inline").close("w:drawing").close("w:r");
|
|
1056
1056
|
this.report.written.paragraphs++;
|
|
1057
1057
|
w.open("w:p");
|
|
@@ -1384,7 +1384,7 @@ var DocxBuilder = (_class2 = class {
|
|
|
1384
1384
|
if (people) add("word/people.xml", people, `${CT_WML}people+xml`);
|
|
1385
1385
|
parts.push({ name: "word/_rels/document.xml.rels", data: this.rels.xml() });
|
|
1386
1386
|
for (const file of this.media) parts.push({ name: `word/media/${file.name}`, data: file.bytes });
|
|
1387
|
-
this.charts.forEach((xml, i) => add(`word/charts/chart${i + 1}.xml`, xml,
|
|
1387
|
+
this.charts.forEach((xml, i) => add(`word/charts/chart${i + 1}.xml`, xml, _chunkNA4UVVJ4cjs.CHART_OOXML_CONTENT_TYPE));
|
|
1388
1388
|
add("docProps/core.xml", this.coreXml(now), "application/vnd.openxmlformats-package.core-properties+xml");
|
|
1389
1389
|
const app = new XmlWriter();
|
|
1390
1390
|
app.open("Properties", { xmlns: "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" });
|
|
@@ -6,15 +6,15 @@ var _chunkA6QWKBJPcjs = require('./chunk-A6QWKBJP.cjs');
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkS6X2QRVUcjs = require('./chunk-S6X2QRVU.cjs');
|
|
10
10
|
|
|
11
11
|
// src/animation/color.ts
|
|
12
12
|
function rgbToOklab2(r, g, b, alpha = 1) {
|
|
13
|
-
const lab =
|
|
13
|
+
const lab = _chunkS6X2QRVUcjs.rgbToOklab.call(void 0, { r, g, b, a: alpha });
|
|
14
14
|
return { l: lab.l, a: lab.a, b: lab.b, alpha: lab.alpha };
|
|
15
15
|
}
|
|
16
16
|
function oklabToRgb2(color) {
|
|
17
|
-
const c =
|
|
17
|
+
const c = _chunkS6X2QRVUcjs.oklabToRgb.call(void 0, { l: color.l, a: color.a, b: color.b, alpha: color.alpha });
|
|
18
18
|
const clamp01 = (v) => Math.min(1, Math.max(0, v));
|
|
19
19
|
return {
|
|
20
20
|
r: clamp01(c.r),
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
// src/typography/weight.ts
|
|
2
|
+
function normalizeFontWeight(weight) {
|
|
3
|
+
if (weight === void 0 || weight === "normal") return 400;
|
|
4
|
+
if (weight === "bold") return 700;
|
|
5
|
+
if (typeof weight !== "number" || !Number.isFinite(weight)) return 400;
|
|
6
|
+
return Math.min(9, Math.max(1, Math.round(weight / 100))) * 100;
|
|
7
|
+
}
|
|
8
|
+
function isFontWeight(value) {
|
|
9
|
+
return value === "normal" || value === "bold" || typeof value === "number" && value >= 100 && value <= 900 && value % 100 === 0;
|
|
10
|
+
}
|
|
11
|
+
function nearestFontWeight(wanted, available) {
|
|
12
|
+
const target = normalizeFontWeight(wanted);
|
|
13
|
+
const weights = [...new Set(available.map((w) => normalizeFontWeight(w)))].sort((a, b) => a - b);
|
|
14
|
+
if (!weights.length) return target;
|
|
15
|
+
if (weights.includes(target)) return target;
|
|
16
|
+
const lighter = weights.filter((w) => w < target).reverse();
|
|
17
|
+
const heavier = weights.filter((w) => w > target);
|
|
18
|
+
if (target === 400 && weights.includes(500)) return 500;
|
|
19
|
+
if (target === 500 && weights.includes(400)) return 400;
|
|
20
|
+
if (target <= 500) return lighter[0] ?? heavier[0];
|
|
21
|
+
return heavier[0] ?? lighter[0];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// src/typography/registry.ts
|
|
25
|
+
function fontHasWeight(font, weight) {
|
|
26
|
+
const w = normalizeFontWeight(weight);
|
|
27
|
+
const ws = font.weights.map((x) => normalizeFontWeight(x));
|
|
28
|
+
if (font.isVariable && ws.length) return w >= Math.min(...ws) && w <= Math.max(...ws);
|
|
29
|
+
return ws.includes(w);
|
|
30
|
+
}
|
|
31
|
+
function filterFonts(fonts, filter = {}) {
|
|
32
|
+
const q = filter.query?.trim().toLowerCase() ?? "";
|
|
33
|
+
const kept = fonts.filter(
|
|
34
|
+
(f) => (!filter.category || f.category === filter.category) && (!filter.source || f.source === filter.source) && (filter.weight === void 0 || fontHasWeight(f, filter.weight)) && (!filter.style || f.styles.includes(filter.style)) && (filter.isVariable === void 0 || !!f.isVariable === filter.isVariable) && (!q || f.family.toLowerCase().includes(q))
|
|
35
|
+
);
|
|
36
|
+
if (!q) return kept;
|
|
37
|
+
const starts = kept.filter((f) => f.family.toLowerCase().startsWith(q));
|
|
38
|
+
return [...starts, ...kept.filter((f) => !f.family.toLowerCase().startsWith(q))];
|
|
39
|
+
}
|
|
40
|
+
function findFont(fonts, family) {
|
|
41
|
+
const lower = family.trim().toLowerCase();
|
|
42
|
+
return fonts.find((f) => f.family.toLowerCase() === lower);
|
|
43
|
+
}
|
|
44
|
+
function combineFontProviders(providers, options = {}) {
|
|
45
|
+
const owner = async (family) => {
|
|
46
|
+
for (const p of providers) if (await p.hasFont(family)) return p;
|
|
47
|
+
for (const p of providers) if (findFont(await p.listFonts(), family)) return p;
|
|
48
|
+
return void 0;
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
id: options.id ?? "fonts",
|
|
52
|
+
async listFonts() {
|
|
53
|
+
const seen = /* @__PURE__ */ new Set();
|
|
54
|
+
const out = [];
|
|
55
|
+
for (const p of providers) {
|
|
56
|
+
for (const f of await p.listFonts()) {
|
|
57
|
+
const key = f.family.toLowerCase();
|
|
58
|
+
if (seen.has(key)) continue;
|
|
59
|
+
seen.add(key);
|
|
60
|
+
out.push(f);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return out;
|
|
64
|
+
},
|
|
65
|
+
async hasFont(family) {
|
|
66
|
+
for (const p of providers) if (await p.hasFont(family)) return true;
|
|
67
|
+
return false;
|
|
68
|
+
},
|
|
69
|
+
async loadFont(family, weight, style) {
|
|
70
|
+
for (const p of providers) {
|
|
71
|
+
if (!p.loadFont) continue;
|
|
72
|
+
if (findFont(await p.listFonts(), family)) return p.loadFont(family, weight, style);
|
|
73
|
+
}
|
|
74
|
+
return !!await owner(family);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
async function ensureFontsLoaded(provider, specs) {
|
|
79
|
+
const result = { loaded: [], failed: [] };
|
|
80
|
+
const seen = /* @__PURE__ */ new Set();
|
|
81
|
+
await Promise.all(
|
|
82
|
+
specs.map(async (s) => {
|
|
83
|
+
const key = `${s.family.toLowerCase()}|${normalizeFontWeight(s.weight)}|${s.style ?? "normal"}`;
|
|
84
|
+
if (seen.has(key)) return;
|
|
85
|
+
seen.add(key);
|
|
86
|
+
const ok = provider.loadFont ? await provider.loadFont(s.family, s.weight, s.style).catch(() => false) : await provider.hasFont(s.family);
|
|
87
|
+
(ok ? result.loaded : result.failed).push(s.family);
|
|
88
|
+
})
|
|
89
|
+
);
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// src/typography/catalog.ts
|
|
94
|
+
var ALL = ["macos", "windows", "ios", "android", "linux"];
|
|
95
|
+
var R = [400, 700];
|
|
96
|
+
var NI = ["normal", "italic"];
|
|
97
|
+
var N = ["normal"];
|
|
98
|
+
var sys = (family, category, platforms, weights = R, styles = NI, isVariable) => ({
|
|
99
|
+
family,
|
|
100
|
+
category,
|
|
101
|
+
weights,
|
|
102
|
+
styles,
|
|
103
|
+
source: "system",
|
|
104
|
+
platforms,
|
|
105
|
+
...isVariable ? { isVariable } : {}
|
|
106
|
+
});
|
|
107
|
+
var SYSTEM_FONT_CATALOG = [
|
|
108
|
+
// Sans-serif
|
|
109
|
+
sys("Arial", "sans-serif", ["macos", "windows", "ios"]),
|
|
110
|
+
sys("Helvetica", "sans-serif", ["macos", "ios"], [300, 400, 700]),
|
|
111
|
+
sys("Helvetica Neue", "sans-serif", ["macos", "ios"], [100, 200, 300, 400, 500, 700]),
|
|
112
|
+
sys("Segoe UI", "sans-serif", ["windows"], [300, 400, 600, 700, 900]),
|
|
113
|
+
sys("Roboto", "sans-serif", ["android"], [100, 300, 400, 500, 700, 900]),
|
|
114
|
+
sys("Verdana", "sans-serif", ["macos", "windows"]),
|
|
115
|
+
sys("Tahoma", "sans-serif", ["macos", "windows"], R, N),
|
|
116
|
+
sys("Trebuchet MS", "sans-serif", ["macos", "windows"]),
|
|
117
|
+
sys("Calibri", "sans-serif", ["windows"], [300, 400, 700]),
|
|
118
|
+
sys("Candara", "sans-serif", ["windows"], [300, 400, 700]),
|
|
119
|
+
sys("Optima", "sans-serif", ["macos"], [400, 700, 800]),
|
|
120
|
+
sys("Gill Sans", "sans-serif", ["macos"], [300, 400, 600]),
|
|
121
|
+
sys("Avenir", "sans-serif", ["macos", "ios"], [300, 400, 500, 800, 900]),
|
|
122
|
+
sys("Avenir Next", "sans-serif", ["macos", "ios"], [200, 400, 500, 600, 700, 800]),
|
|
123
|
+
sys("Futura", "sans-serif", ["macos", "ios"], [400, 500, 700]),
|
|
124
|
+
sys("Century Gothic", "sans-serif", ["windows"]),
|
|
125
|
+
sys("Noto Sans", "sans-serif", ["android", "linux"], [100, 200, 300, 400, 500, 600, 700, 800, 900], NI, true),
|
|
126
|
+
sys("DejaVu Sans", "sans-serif", ["linux"], [200, 400, 700]),
|
|
127
|
+
sys("Liberation Sans", "sans-serif", ["linux"]),
|
|
128
|
+
sys("Ubuntu", "sans-serif", ["linux"], [300, 400, 500, 700]),
|
|
129
|
+
sys("Cantarell", "sans-serif", ["linux"], [100, 200, 300, 400, 500, 600, 700, 800], N, true),
|
|
130
|
+
// Serif
|
|
131
|
+
sys("Georgia", "serif", ["macos", "windows", "ios"]),
|
|
132
|
+
sys("Times New Roman", "serif", ["macos", "windows", "ios"]),
|
|
133
|
+
sys("Times", "serif", ["macos", "ios"]),
|
|
134
|
+
sys("Cambria", "serif", ["windows"]),
|
|
135
|
+
sys("Constantia", "serif", ["windows"]),
|
|
136
|
+
sys("Sitka Text", "serif", ["windows"], [400, 600, 700], NI, true),
|
|
137
|
+
sys("Charter", "serif", ["macos", "ios"], [400, 700, 900]),
|
|
138
|
+
sys("Iowan Old Style", "serif", ["macos", "ios"], [400, 700, 900]),
|
|
139
|
+
sys("Palatino", "serif", ["macos"]),
|
|
140
|
+
sys("Palatino Linotype", "serif", ["windows"]),
|
|
141
|
+
sys("Baskerville", "serif", ["macos", "ios"], [400, 600, 700]),
|
|
142
|
+
sys("Hoefler Text", "serif", ["macos"], [400, 900]),
|
|
143
|
+
sys("Garamond", "serif", ["windows"]),
|
|
144
|
+
sys("Book Antiqua", "serif", ["windows"]),
|
|
145
|
+
sys("Noto Serif", "serif", ["android", "linux"], [100, 200, 300, 400, 500, 600, 700, 800, 900], NI, true),
|
|
146
|
+
sys("DejaVu Serif", "serif", ["linux"]),
|
|
147
|
+
sys("Liberation Serif", "serif", ["linux"]),
|
|
148
|
+
// Monospace
|
|
149
|
+
sys("Menlo", "monospace", ["macos"]),
|
|
150
|
+
sys("Monaco", "monospace", ["macos"], [400], N),
|
|
151
|
+
sys("SF Mono", "monospace", ["macos"], [300, 400, 500, 600, 700, 800]),
|
|
152
|
+
sys("Consolas", "monospace", ["windows"]),
|
|
153
|
+
sys("Cascadia Code", "monospace", ["windows"], [200, 300, 400, 500, 600, 700], NI, true),
|
|
154
|
+
sys("Cascadia Mono", "monospace", ["windows"], [200, 300, 400, 500, 600, 700], NI, true),
|
|
155
|
+
sys("Courier New", "monospace", ["macos", "windows", "ios"]),
|
|
156
|
+
sys("Lucida Console", "monospace", ["windows"], [400], N),
|
|
157
|
+
sys("DejaVu Sans Mono", "monospace", ["linux"]),
|
|
158
|
+
sys("Liberation Mono", "monospace", ["linux"]),
|
|
159
|
+
sys("Ubuntu Mono", "monospace", ["linux"]),
|
|
160
|
+
sys("Droid Sans Mono", "monospace", ["android"], [400], N),
|
|
161
|
+
// Display
|
|
162
|
+
sys("Impact", "display", ["macos", "windows"], [400], N),
|
|
163
|
+
sys("Copperplate", "display", ["macos"], [300, 400, 700], N),
|
|
164
|
+
sys("Rockwell", "display", ["macos", "windows"]),
|
|
165
|
+
sys("Didot", "display", ["macos", "ios"], [400, 700]),
|
|
166
|
+
sys("Bodoni 72", "display", ["macos", "ios"], [400, 700]),
|
|
167
|
+
sys("Arial Black", "display", ["macos", "windows"], [900], N),
|
|
168
|
+
// Handwriting
|
|
169
|
+
sys("Comic Sans MS", "handwriting", ["macos", "windows"]),
|
|
170
|
+
sys("Segoe Print", "handwriting", ["windows"], R, N),
|
|
171
|
+
sys("Segoe Script", "handwriting", ["windows"], R, N),
|
|
172
|
+
sys("Bradley Hand", "handwriting", ["macos", "ios"], [700], N),
|
|
173
|
+
sys("Brush Script MT", "handwriting", ["macos", "windows"], [400], ["italic"]),
|
|
174
|
+
sys("Snell Roundhand", "handwriting", ["macos", "ios"], [400, 700, 900], N),
|
|
175
|
+
sys("Noteworthy", "handwriting", ["macos", "ios"], [300, 700], N)
|
|
176
|
+
];
|
|
177
|
+
var FONT_PLATFORMS = ALL;
|
|
178
|
+
function guessFontCategory(family) {
|
|
179
|
+
const known = findFont(SYSTEM_FONT_CATALOG, family);
|
|
180
|
+
if (known) return known.category;
|
|
181
|
+
const lower = family.toLowerCase();
|
|
182
|
+
if (lower === "monospace" || lower === "ui-monospace" || /\bmono|code|courier|consol/.test(lower)) return "monospace";
|
|
183
|
+
if (lower === "cursive" || /script|hand|brush|marker/.test(lower)) return "handwriting";
|
|
184
|
+
if (lower === "fantasy" || /display|poster/.test(lower)) return "display";
|
|
185
|
+
if (/sans/.test(lower)) return "sans-serif";
|
|
186
|
+
if (lower === "serif" || lower === "ui-serif" || /serif|times|garamond|georgia|baskerville|caslon|bodoni|didot/.test(lower)) return "serif";
|
|
187
|
+
return "sans-serif";
|
|
188
|
+
}
|
|
189
|
+
function createCatalogFontProvider(fonts, options = {}) {
|
|
190
|
+
const list = [...fonts];
|
|
191
|
+
return {
|
|
192
|
+
id: options.id ?? "catalog",
|
|
193
|
+
listFonts: async () => list.map((f) => ({ ...f })),
|
|
194
|
+
hasFont: (family) => !!findFont(list, family),
|
|
195
|
+
loadFont: async (family) => !!findFont(list, family)
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
function weightFromStyleName(style = "") {
|
|
199
|
+
const s = style.toLowerCase();
|
|
200
|
+
if (/thin|hairline/.test(s)) return 100;
|
|
201
|
+
if (/extra ?light|ultra ?light/.test(s)) return 200;
|
|
202
|
+
if (/light/.test(s)) return 300;
|
|
203
|
+
if (/medium/.test(s)) return 500;
|
|
204
|
+
if (/semi ?bold|demi ?bold/.test(s)) return 600;
|
|
205
|
+
if (/extra ?bold|ultra ?bold/.test(s)) return 800;
|
|
206
|
+
if (/black|heavy/.test(s)) return 900;
|
|
207
|
+
if (/bold/.test(s)) return 700;
|
|
208
|
+
return 400;
|
|
209
|
+
}
|
|
210
|
+
function createSystemFontProvider(options = {}) {
|
|
211
|
+
const catalog = (options.catalog ?? SYSTEM_FONT_CATALOG).filter((f) => !options.platform || !f.platforms || f.platforms.includes(options.platform));
|
|
212
|
+
let local = null;
|
|
213
|
+
const localFonts = () => {
|
|
214
|
+
if (!options.queryLocalFonts) return Promise.resolve(null);
|
|
215
|
+
local ??= options.queryLocalFonts().then((entries) => {
|
|
216
|
+
const byFamily = /* @__PURE__ */ new Map();
|
|
217
|
+
for (const e of entries) {
|
|
218
|
+
const key = e.family.toLowerCase();
|
|
219
|
+
const known = findFont(SYSTEM_FONT_CATALOG, e.family);
|
|
220
|
+
const entry = byFamily.get(key) ?? { family: known?.family ?? e.family, category: known?.category ?? guessFontCategory(e.family), weights: [], styles: [], source: "system" };
|
|
221
|
+
const w = weightFromStyleName(e.style);
|
|
222
|
+
if (!entry.weights.includes(w)) entry.weights.push(w);
|
|
223
|
+
const st = /italic/i.test(e.style ?? "") ? "italic" : /oblique/i.test(e.style ?? "") ? "oblique" : "normal";
|
|
224
|
+
if (!entry.styles.includes(st)) entry.styles.push(st);
|
|
225
|
+
byFamily.set(key, entry);
|
|
226
|
+
}
|
|
227
|
+
for (const f of byFamily.values()) f.weights.sort((a, b) => normalizeFontWeight(a) - normalizeFontWeight(b));
|
|
228
|
+
return [...byFamily.values()];
|
|
229
|
+
}).catch(() => null);
|
|
230
|
+
return local;
|
|
231
|
+
};
|
|
232
|
+
return {
|
|
233
|
+
id: options.id ?? "system",
|
|
234
|
+
async listFonts() {
|
|
235
|
+
return (await localFonts() ?? catalog).map((f) => ({ ...f }));
|
|
236
|
+
},
|
|
237
|
+
async hasFont(family) {
|
|
238
|
+
return !!findFont(await localFonts() ?? catalog, family);
|
|
239
|
+
},
|
|
240
|
+
async loadFont(family) {
|
|
241
|
+
return !!findFont(await localFonts() ?? catalog, family);
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
var weightRange = (w) => Array.isArray(w) ? [w[0], w[1]] : [normalizeFontWeight(w), normalizeFontWeight(w)];
|
|
246
|
+
var cssWeight = (w) => {
|
|
247
|
+
const [lo, hi] = weightRange(w);
|
|
248
|
+
return lo === hi ? String(lo) : `${lo} ${hi}`;
|
|
249
|
+
};
|
|
250
|
+
function fontFaceCss(def) {
|
|
251
|
+
return def.sources.map(
|
|
252
|
+
(s) => [
|
|
253
|
+
"@font-face {",
|
|
254
|
+
` font-family: "${def.family.replace(/"/g, '\\"')}";`,
|
|
255
|
+
` src: url("${s.url.replace(/"/g, "%22")}")${s.format ? ` format("${s.format}")` : ""};`,
|
|
256
|
+
` font-weight: ${cssWeight(s.weight)};`,
|
|
257
|
+
` font-style: ${s.style ?? "normal"};`,
|
|
258
|
+
` font-display: ${def.display ?? "swap"};`,
|
|
259
|
+
...s.unicodeRange ? [` unicode-range: ${s.unicodeRange};`] : [],
|
|
260
|
+
"}"
|
|
261
|
+
].join("\n")
|
|
262
|
+
).join("\n");
|
|
263
|
+
}
|
|
264
|
+
function webFontSummary(def) {
|
|
265
|
+
const weights = /* @__PURE__ */ new Set();
|
|
266
|
+
let isVariable = false;
|
|
267
|
+
for (const s of def.sources) {
|
|
268
|
+
const [lo, hi] = weightRange(s.weight);
|
|
269
|
+
if (lo !== hi) isVariable = true;
|
|
270
|
+
weights.add(lo);
|
|
271
|
+
weights.add(hi);
|
|
272
|
+
}
|
|
273
|
+
const styles = [...new Set(def.sources.map((s) => s.style ?? "normal"))];
|
|
274
|
+
return { family: def.family, category: def.category, weights: [...weights].sort((a, b) => a - b), styles, source: "web", ...isVariable ? { isVariable } : {} };
|
|
275
|
+
}
|
|
276
|
+
function createWebFontProvider(options) {
|
|
277
|
+
const defs = [...options.fonts];
|
|
278
|
+
const cache = /* @__PURE__ */ new Map();
|
|
279
|
+
const done = /* @__PURE__ */ new Set();
|
|
280
|
+
const g = globalThis;
|
|
281
|
+
const createFace = options.createFontFace ?? (g.FontFace ? (family, source, descriptors) => new g.FontFace(family, source, descriptors) : void 0);
|
|
282
|
+
const set = () => options.fontFaceSet ?? g.document?.fonts;
|
|
283
|
+
const def = (family) => defs.find((d) => d.family.toLowerCase() === family.trim().toLowerCase());
|
|
284
|
+
const key = (family, weight, style) => `${family.toLowerCase()}|${normalizeFontWeight(weight)}|${style ?? "normal"}`;
|
|
285
|
+
function pickSource(d, weight, style) {
|
|
286
|
+
const wanted = normalizeFontWeight(weight);
|
|
287
|
+
const st = style ?? "normal";
|
|
288
|
+
const sameStyle = d.sources.filter((s) => (s.style ?? "normal") === st);
|
|
289
|
+
const pool = sameStyle.length ? sameStyle : d.sources;
|
|
290
|
+
const inRange = pool.find((s) => {
|
|
291
|
+
const [lo, hi] = weightRange(s.weight);
|
|
292
|
+
return wanted >= lo && wanted <= hi;
|
|
293
|
+
});
|
|
294
|
+
if (inRange) return inRange;
|
|
295
|
+
const best = nearestFontWeight(wanted, pool.map((s) => weightRange(s.weight)[0]));
|
|
296
|
+
return pool.find((s) => weightRange(s.weight)[0] === best);
|
|
297
|
+
}
|
|
298
|
+
return {
|
|
299
|
+
id: options.id ?? "web",
|
|
300
|
+
listFonts: async () => defs.map(webFontSummary),
|
|
301
|
+
hasFont: (family) => !!def(family),
|
|
302
|
+
loaded: (family, weight, style) => done.has(key(family, weight, style)),
|
|
303
|
+
loadFont(family, weight, style) {
|
|
304
|
+
const k = key(family, weight, style);
|
|
305
|
+
const cached = cache.get(k);
|
|
306
|
+
if (cached) return cached;
|
|
307
|
+
const d = def(family);
|
|
308
|
+
const source = d && pickSource(d, weight, style);
|
|
309
|
+
if (!d || !source || !createFace) return Promise.resolve(false);
|
|
310
|
+
const face = createFace(d.family, `url("${source.url.replace(/"/g, "%22")}")${source.format ? ` format("${source.format}")` : ""}`, {
|
|
311
|
+
weight: cssWeight(source.weight),
|
|
312
|
+
style: source.style ?? "normal",
|
|
313
|
+
display: d.display ?? "swap",
|
|
314
|
+
...source.unicodeRange ? { unicodeRange: source.unicodeRange } : {}
|
|
315
|
+
});
|
|
316
|
+
const promise = face.load().then(() => {
|
|
317
|
+
set()?.add(face);
|
|
318
|
+
done.add(k);
|
|
319
|
+
return true;
|
|
320
|
+
}).catch(() => {
|
|
321
|
+
cache.delete(k);
|
|
322
|
+
return false;
|
|
323
|
+
});
|
|
324
|
+
cache.set(k, promise);
|
|
325
|
+
return promise;
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export {
|
|
331
|
+
normalizeFontWeight,
|
|
332
|
+
isFontWeight,
|
|
333
|
+
nearestFontWeight,
|
|
334
|
+
fontHasWeight,
|
|
335
|
+
filterFonts,
|
|
336
|
+
findFont,
|
|
337
|
+
combineFontProviders,
|
|
338
|
+
ensureFontsLoaded,
|
|
339
|
+
SYSTEM_FONT_CATALOG,
|
|
340
|
+
FONT_PLATFORMS,
|
|
341
|
+
guessFontCategory,
|
|
342
|
+
createCatalogFontProvider,
|
|
343
|
+
createSystemFontProvider,
|
|
344
|
+
fontFaceCss,
|
|
345
|
+
webFontSummary,
|
|
346
|
+
createWebFontProvider
|
|
347
|
+
};
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
chartToMermaid,
|
|
6
6
|
describeChart,
|
|
7
7
|
layoutSparkline
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XDCFJEU7.js";
|
|
9
9
|
import {
|
|
10
10
|
layoutChart
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-DTSTNRPH.js";
|
|
12
12
|
import {
|
|
13
13
|
DEFAULT_CHART_THEME,
|
|
14
14
|
normalizeChartSpec
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-HLOKB7WW.js";
|
|
16
16
|
import {
|
|
17
17
|
plainTextToSlice
|
|
18
18
|
} from "./chunk-2INPJDNY.js";
|