@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
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
CHART_STACKINGS,
|
|
15
15
|
CHART_TRENDLINE_TYPES,
|
|
16
16
|
CHART_TYPES
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-HLOKB7WW.js";
|
|
18
18
|
|
|
19
19
|
// src/chart/schemas.ts
|
|
20
20
|
var VALUE = { type: ["number", "string", "null"], description: 'A number, numeric text ("1,200", "12%", "$40", "(3)") or null for a gap.' };
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunk3IHNXRUVcjs = require('./chunk-3IHNXRUV.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkHDGBM7EAcjs = require('./chunk-HDGBM7EA.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkLL3H5XUHcjs = require('./chunk-LL3H5XUH.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
var _chunkG43MNQ4Ccjs = require('./chunk-G43MNQ4C.cjs');
|
|
@@ -1211,7 +1211,7 @@ var ChartNodeView = (_class = class {
|
|
|
1211
1211
|
this.dom.contentEditable = "false";
|
|
1212
1212
|
this.syncAttributes();
|
|
1213
1213
|
this.key = specKey(this.node.attrs.spec);
|
|
1214
|
-
this.controller = new (0,
|
|
1214
|
+
this.controller = new (0, _chunk3IHNXRUVcjs.ChartController)({ spec: this.node.attrs.spec });
|
|
1215
1215
|
this.unsubscribe = this.controller.subscribe((state) => {
|
|
1216
1216
|
if (!state.gesture) this.writeBack();
|
|
1217
1217
|
});
|
|
@@ -1444,7 +1444,7 @@ function readSpec(value) {
|
|
|
1444
1444
|
}
|
|
1445
1445
|
}
|
|
1446
1446
|
if (!input || typeof input !== "object" || Array.isArray(input)) return null;
|
|
1447
|
-
return
|
|
1447
|
+
return _chunkLL3H5XUHcjs.normalizeChartSpec.call(void 0, input).spec;
|
|
1448
1448
|
}
|
|
1449
1449
|
var readSize = (value) => {
|
|
1450
1450
|
const n = value === null ? NaN : Number(value);
|
|
@@ -1470,10 +1470,10 @@ function staticChartSvg(node, options) {
|
|
|
1470
1470
|
const spec = node.attrs.spec;
|
|
1471
1471
|
const width = _nullishCoalesce(node.attrs.width, () => ( options.defaultWidth));
|
|
1472
1472
|
const height = _nullishCoalesce(node.attrs.height, () => ( options.defaultHeight));
|
|
1473
|
-
const scene =
|
|
1474
|
-
return
|
|
1473
|
+
const scene = _chunkHDGBM7EAcjs.layoutChart.call(void 0, spec, { width, height, theme: options.theme, selection: null });
|
|
1474
|
+
return _chunk3IHNXRUVcjs.chartSceneToDomSpec.call(void 0, scene, {
|
|
1475
1475
|
ariaLabel: spec.title || "Chart",
|
|
1476
|
-
description:
|
|
1476
|
+
description: _chunk3IHNXRUVcjs.describeChart.call(void 0, spec),
|
|
1477
1477
|
attrs: { style: "max-width: 100%; height: auto; display: block" }
|
|
1478
1478
|
});
|
|
1479
1479
|
}
|
|
@@ -1489,7 +1489,7 @@ var Chart = _core.Node.create({
|
|
|
1489
1489
|
return {
|
|
1490
1490
|
HTMLAttributes: {},
|
|
1491
1491
|
nodeView: null,
|
|
1492
|
-
theme:
|
|
1492
|
+
theme: _chunkLL3H5XUHcjs.DEFAULT_CHART_THEME,
|
|
1493
1493
|
defaultWidth: 640,
|
|
1494
1494
|
defaultHeight: 320,
|
|
1495
1495
|
generateId: () => generateStructureId("chart")
|
|
@@ -1503,7 +1503,7 @@ var Chart = _core.Node.create({
|
|
|
1503
1503
|
renderHTML: (attributes) => attributes.id ? { "data-chart-id": attributes.id } : {}
|
|
1504
1504
|
},
|
|
1505
1505
|
spec: {
|
|
1506
|
-
default:
|
|
1506
|
+
default: _chunkLL3H5XUHcjs.normalizeChartSpec.call(void 0, {}).spec,
|
|
1507
1507
|
// null (no `data-chart`) keeps what the parse rule found, e.g. a mermaid block's spec.
|
|
1508
1508
|
parseHTML: (element) => readSpec(element.getAttribute("data-chart")),
|
|
1509
1509
|
renderHTML: (attributes) => ({
|
|
@@ -1541,7 +1541,7 @@ var Chart = _core.Node.create({
|
|
|
1541
1541
|
const code = element.querySelector("code");
|
|
1542
1542
|
const language = _nullishCoalesce(_nullishCoalesce(_optionalChain([code, 'optionalAccess', _34 => _34.getAttribute, 'call', _35 => _35("class")]), () => ( element.getAttribute("data-language"))), () => ( ""));
|
|
1543
1543
|
if (!/(?:^|\s)language-mermaid(?:\s|$)/.test(language) && language !== "mermaid") return false;
|
|
1544
|
-
const result =
|
|
1544
|
+
const result = _chunk3IHNXRUVcjs.chartFromMermaid.call(void 0, _nullishCoalesce((_nullishCoalesce(code, () => ( element))).textContent, () => ( "")));
|
|
1545
1545
|
return result.family ? { spec: result.spec } : false;
|
|
1546
1546
|
}
|
|
1547
1547
|
}
|
|
@@ -1565,7 +1565,7 @@ var Chart = _core.Node.create({
|
|
|
1565
1565
|
return {
|
|
1566
1566
|
markdown: {
|
|
1567
1567
|
serialize(state, node) {
|
|
1568
|
-
const text =
|
|
1568
|
+
const text = _chunk3IHNXRUVcjs.chartToMermaid.call(void 0, node.attrs.spec);
|
|
1569
1569
|
const fence = "`".repeat(Math.max(3, longestBacktickRun(text) + 1));
|
|
1570
1570
|
state.write(`${fence}mermaid
|
|
1571
1571
|
`);
|
|
@@ -1587,7 +1587,7 @@ var Chart = _core.Node.create({
|
|
|
1587
1587
|
type: this.name,
|
|
1588
1588
|
attrs: {
|
|
1589
1589
|
id: _nullishCoalesce(options.id, () => ( this.options.generateId())),
|
|
1590
|
-
spec:
|
|
1590
|
+
spec: _chunkLL3H5XUHcjs.normalizeChartSpec.call(void 0, _nullishCoalesce(options.spec, () => ( {}))).spec,
|
|
1591
1591
|
width: _nullishCoalesce(options.width, () => ( null)),
|
|
1592
1592
|
height: _nullishCoalesce(options.height, () => ( this.options.defaultHeight))
|
|
1593
1593
|
}
|
|
@@ -1598,7 +1598,7 @@ var Chart = _core.Node.create({
|
|
|
1598
1598
|
if (dispatch) {
|
|
1599
1599
|
tr.setNodeMarkup(chart.pos, void 0, {
|
|
1600
1600
|
...chart.node.attrs,
|
|
1601
|
-
...changes.spec !== void 0 ? { spec:
|
|
1601
|
+
...changes.spec !== void 0 ? { spec: _chunkLL3H5XUHcjs.normalizeChartSpec.call(void 0, changes.spec).spec } : {},
|
|
1602
1602
|
...changes.width !== void 0 ? { width: changes.width } : {},
|
|
1603
1603
|
...changes.height !== void 0 ? { height: changes.height } : {}
|
|
1604
1604
|
});
|
|
@@ -1705,14 +1705,14 @@ var Sparkline = _core.Node.create({
|
|
|
1705
1705
|
return [{ tag: 'span[data-type="sparkline"]', priority: 60 }];
|
|
1706
1706
|
},
|
|
1707
1707
|
renderHTML({ node, HTMLAttributes }) {
|
|
1708
|
-
const scene =
|
|
1708
|
+
const scene = _chunk3IHNXRUVcjs.layoutSparkline.call(void 0, node.attrs.values, {
|
|
1709
1709
|
kind: node.attrs.kind,
|
|
1710
1710
|
width: node.attrs.width,
|
|
1711
1711
|
height: node.attrs.height,
|
|
1712
1712
|
color: _nullishCoalesce(node.attrs.color, () => ( this.options.color)),
|
|
1713
1713
|
negativeColor: this.options.negativeColor
|
|
1714
1714
|
});
|
|
1715
|
-
const svg =
|
|
1715
|
+
const svg = _chunk3IHNXRUVcjs.chartSceneToDomSpec.call(void 0, scene, {
|
|
1716
1716
|
ariaLabel: sparklineLabel(node),
|
|
1717
1717
|
attrs: { style: "display: inline-block; vertical-align: middle" }
|
|
1718
1718
|
});
|
|
@@ -0,0 +1,347 @@
|
|
|
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; }// 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 _nullishCoalesce(lighter[0], () => ( heavier[0]));
|
|
21
|
+
return _nullishCoalesce(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 = _nullishCoalesce(_optionalChain([filter, 'access', _ => _.query, 'optionalAccess', _2 => _2.trim, 'call', _3 => _3(), 'access', _4 => _4.toLowerCase, 'call', _5 => _5()]), () => ( ""));
|
|
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: _nullishCoalesce(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)}|${_nullishCoalesce(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: _nullishCoalesce(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 = (_nullishCoalesce(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 = _nullishCoalesce(byFamily.get(key), () => ( { family: _nullishCoalesce(_optionalChain([known, 'optionalAccess', _6 => _6.family]), () => ( e.family)), category: _nullishCoalesce(_optionalChain([known, 'optionalAccess', _7 => _7.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(_nullishCoalesce(e.style, () => ( ""))) ? "italic" : /oblique/i.test(_nullishCoalesce(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: _nullishCoalesce(options.id, () => ( "system")),
|
|
234
|
+
async listFonts() {
|
|
235
|
+
return (await _asyncNullishCoalesce(await localFonts(), async () => ( catalog))).map((f) => ({ ...f }));
|
|
236
|
+
},
|
|
237
|
+
async hasFont(family) {
|
|
238
|
+
return !!findFont(await _asyncNullishCoalesce(await localFonts(), async () => ( catalog)), family);
|
|
239
|
+
},
|
|
240
|
+
async loadFont(family) {
|
|
241
|
+
return !!findFont(await _asyncNullishCoalesce(await localFonts(), async () => ( 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: ${_nullishCoalesce(s.style, () => ( "normal"))};`,
|
|
258
|
+
` font-display: ${_nullishCoalesce(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) => _nullishCoalesce(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 = _nullishCoalesce(options.createFontFace, () => ( (g.FontFace ? (family, source, descriptors) => new g.FontFace(family, source, descriptors) : void 0)));
|
|
282
|
+
const set = () => _nullishCoalesce(options.fontFaceSet, () => ( _optionalChain([g, 'access', _8 => _8.document, 'optionalAccess', _9 => _9.fonts])));
|
|
283
|
+
const def = (family) => defs.find((d) => d.family.toLowerCase() === family.trim().toLowerCase());
|
|
284
|
+
const key = (family, weight, style) => `${family.toLowerCase()}|${normalizeFontWeight(weight)}|${_nullishCoalesce(style, () => ( "normal"))}`;
|
|
285
|
+
function pickSource(d, weight, style) {
|
|
286
|
+
const wanted = normalizeFontWeight(weight);
|
|
287
|
+
const st = _nullishCoalesce(style, () => ( "normal"));
|
|
288
|
+
const sameStyle = d.sources.filter((s) => (_nullishCoalesce(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: _nullishCoalesce(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: _nullishCoalesce(source.style, () => ( "normal")),
|
|
313
|
+
display: _nullishCoalesce(d.display, () => ( "swap")),
|
|
314
|
+
...source.unicodeRange ? { unicodeRange: source.unicodeRange } : {}
|
|
315
|
+
});
|
|
316
|
+
const promise = face.load().then(() => {
|
|
317
|
+
_optionalChain([set, 'call', _10 => _10(), 'optionalAccess', _11 => _11.add, 'call', _12 => _12(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
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
exports.normalizeFontWeight = normalizeFontWeight; exports.isFontWeight = isFontWeight; exports.nearestFontWeight = nearestFontWeight; exports.fontHasWeight = fontHasWeight; exports.filterFonts = filterFonts; exports.findFont = findFont; exports.combineFontProviders = combineFontProviders; exports.ensureFontsLoaded = ensureFontsLoaded; exports.SYSTEM_FONT_CATALOG = SYSTEM_FONT_CATALOG; exports.FONT_PLATFORMS = FONT_PLATFORMS; exports.guessFontCategory = guessFontCategory; exports.createCatalogFontProvider = createCatalogFontProvider; exports.createSystemFontProvider = createSystemFontProvider; exports.fontFaceCss = fontFaceCss; exports.webFontSummary = webFontSummary; exports.createWebFontProvider = createWebFontProvider;
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
CHART_OOXML_NS,
|
|
9
9
|
chartFromOoxml
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-7CKPUUN4.js";
|
|
11
11
|
import {
|
|
12
12
|
compareDocuments
|
|
13
13
|
} from "./chunk-V5OOP74P.js";
|
|
@@ -34,10 +34,10 @@ import {
|
|
|
34
34
|
searchDocument,
|
|
35
35
|
sliceContainsTable,
|
|
36
36
|
syncInitialContent
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-CX6JLDFC.js";
|
|
38
38
|
import {
|
|
39
39
|
chartDataToTable
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-HLOKB7WW.js";
|
|
41
41
|
import {
|
|
42
42
|
PIXERATE_DOCUMENT_MIME,
|
|
43
43
|
getClipboardData,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
var _chunkDWJJI6RTcjs = require('./chunk-DWJJI6RT.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkCIPIESX4cjs = require('./chunk-CIPIESX4.cjs');
|
|
8
8
|
|
|
9
9
|
// src/animation/keyframes.ts
|
|
10
10
|
var ANIMATION_TIME_EPSILON = 1e-6;
|
|
@@ -46,7 +46,7 @@ function interpolateAnimationValue(from, to, t, type = "number") {
|
|
|
46
46
|
if (t <= 0) return from;
|
|
47
47
|
if (t >= 1) return to;
|
|
48
48
|
if (type === "color" || typeof from === "string" && typeof to === "string") {
|
|
49
|
-
const mixed =
|
|
49
|
+
const mixed = _chunkCIPIESX4cjs.mixColorsOklab.call(void 0, from, to, t);
|
|
50
50
|
if (mixed !== null) return mixed;
|
|
51
51
|
}
|
|
52
52
|
return from;
|