modern-idoc 0.11.8 → 0.12.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/index.cjs +94 -10
- package/dist/index.d.cts +129 -3
- package/dist/index.d.mts +129 -3
- package/dist/index.d.ts +129 -3
- package/dist/index.js +2 -2
- package/dist/index.mjs +90 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1476,6 +1476,48 @@ function normalizeChart(chart) {
|
|
|
1476
1476
|
});
|
|
1477
1477
|
}
|
|
1478
1478
|
|
|
1479
|
+
const nanoid = () => {
|
|
1480
|
+
return nanoid$1.nanoid(10);
|
|
1481
|
+
};
|
|
1482
|
+
const idGenerator = nanoid;
|
|
1483
|
+
|
|
1484
|
+
function normalizeCommentOffset(offset) {
|
|
1485
|
+
return {
|
|
1486
|
+
x: normalizeNumber(offset.x) ?? 0,
|
|
1487
|
+
y: normalizeNumber(offset.y) ?? 0
|
|
1488
|
+
};
|
|
1489
|
+
}
|
|
1490
|
+
function normalizeCommentAuthor(author) {
|
|
1491
|
+
return clearUndef({
|
|
1492
|
+
id: author.id,
|
|
1493
|
+
name: author.name,
|
|
1494
|
+
color: author.color,
|
|
1495
|
+
initials: author.initials
|
|
1496
|
+
});
|
|
1497
|
+
}
|
|
1498
|
+
function normalizeCommentMessage(message) {
|
|
1499
|
+
return clearUndef({
|
|
1500
|
+
id: message.id ?? idGenerator(),
|
|
1501
|
+
author: message.author ? normalizeCommentAuthor(message.author) : void 0,
|
|
1502
|
+
body: message.body ?? "",
|
|
1503
|
+
createdAt: normalizeNumber(message.createdAt)
|
|
1504
|
+
});
|
|
1505
|
+
}
|
|
1506
|
+
function normalizeCommentThread(thread) {
|
|
1507
|
+
return clearUndef({
|
|
1508
|
+
id: thread.id ?? idGenerator(),
|
|
1509
|
+
offset: thread.offset ? normalizeCommentOffset(thread.offset) : void 0,
|
|
1510
|
+
resolved: thread.resolved,
|
|
1511
|
+
messages: (thread.messages ?? []).map(normalizeCommentMessage)
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
function normalizeComments(comments) {
|
|
1515
|
+
if (!comments?.length) {
|
|
1516
|
+
return void 0;
|
|
1517
|
+
}
|
|
1518
|
+
return comments.map(normalizeCommentThread);
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1479
1521
|
function normalizeConnection(connection) {
|
|
1480
1522
|
return clearUndef({
|
|
1481
1523
|
start: connection.start,
|
|
@@ -1527,12 +1569,51 @@ function getDefaultShadowStyle() {
|
|
|
1527
1569
|
};
|
|
1528
1570
|
}
|
|
1529
1571
|
|
|
1572
|
+
function normalizeFilter(filter) {
|
|
1573
|
+
return clearUndef({
|
|
1574
|
+
blur: filter.blur,
|
|
1575
|
+
brightness: filter.brightness,
|
|
1576
|
+
contrast: filter.contrast,
|
|
1577
|
+
grayscale: filter.grayscale,
|
|
1578
|
+
hueRotate: filter.hueRotate,
|
|
1579
|
+
invert: filter.invert,
|
|
1580
|
+
opacity: filter.opacity,
|
|
1581
|
+
saturate: filter.saturate,
|
|
1582
|
+
sepia: filter.sepia,
|
|
1583
|
+
duotone: filter.duotone ? [normalizeColor(filter.duotone[0]), normalizeColor(filter.duotone[1])] : void 0,
|
|
1584
|
+
biLevel: filter.biLevel,
|
|
1585
|
+
colorChange: filter.colorChange ? { from: normalizeColor(filter.colorChange.from), to: normalizeColor(filter.colorChange.to) } : void 0
|
|
1586
|
+
});
|
|
1587
|
+
}
|
|
1588
|
+
function stringifyFilter(filter) {
|
|
1589
|
+
const parts = [];
|
|
1590
|
+
if (filter.blur !== void 0)
|
|
1591
|
+
parts.push(`blur(${filter.blur}px)`);
|
|
1592
|
+
if (filter.brightness !== void 0)
|
|
1593
|
+
parts.push(`brightness(${filter.brightness})`);
|
|
1594
|
+
if (filter.contrast !== void 0)
|
|
1595
|
+
parts.push(`contrast(${filter.contrast})`);
|
|
1596
|
+
if (filter.grayscale !== void 0)
|
|
1597
|
+
parts.push(`grayscale(${filter.grayscale})`);
|
|
1598
|
+
if (filter.hueRotate !== void 0)
|
|
1599
|
+
parts.push(`hue-rotate(${filter.hueRotate}deg)`);
|
|
1600
|
+
if (filter.invert !== void 0)
|
|
1601
|
+
parts.push(`invert(${filter.invert})`);
|
|
1602
|
+
if (filter.opacity !== void 0)
|
|
1603
|
+
parts.push(`opacity(${filter.opacity})`);
|
|
1604
|
+
if (filter.saturate !== void 0)
|
|
1605
|
+
parts.push(`saturate(${filter.saturate})`);
|
|
1606
|
+
if (filter.sepia !== void 0)
|
|
1607
|
+
parts.push(`sepia(${filter.sepia})`);
|
|
1608
|
+
return parts.join(" ");
|
|
1609
|
+
}
|
|
1530
1610
|
const effectFields = [
|
|
1531
1611
|
"fill",
|
|
1532
1612
|
"outline",
|
|
1533
1613
|
"shadow",
|
|
1534
1614
|
"transform",
|
|
1535
|
-
"transformOrigin"
|
|
1615
|
+
"transformOrigin",
|
|
1616
|
+
"filter"
|
|
1536
1617
|
];
|
|
1537
1618
|
function normalizeEffectV0(effect) {
|
|
1538
1619
|
const _effect = pick(effect, effectFields);
|
|
@@ -1574,7 +1655,8 @@ function normalizeEffect(effect) {
|
|
|
1574
1655
|
outline: isNone(_effect.outline) ? void 0 : normalizeOutline(_effect.outline),
|
|
1575
1656
|
shadow: isNone(_effect.shadow) ? void 0 : normalizeShadow(_effect.shadow),
|
|
1576
1657
|
transform: isNone(_effect.transform) ? void 0 : _effect.transform,
|
|
1577
|
-
transformOrigin: _effect.transformOrigin
|
|
1658
|
+
transformOrigin: _effect.transformOrigin,
|
|
1659
|
+
filter: _effect.filter ? normalizeFilter(_effect.filter) : void 0
|
|
1578
1660
|
});
|
|
1579
1661
|
}
|
|
1580
1662
|
|
|
@@ -1584,18 +1666,14 @@ function normalizeForeground(foreground) {
|
|
|
1584
1666
|
...normalizeFill(foreground)
|
|
1585
1667
|
};
|
|
1586
1668
|
} else {
|
|
1587
|
-
return {
|
|
1669
|
+
return clearUndef({
|
|
1588
1670
|
...normalizeFill(foreground),
|
|
1589
|
-
...pick(foreground, ["fillWithShape"])
|
|
1590
|
-
|
|
1671
|
+
...pick(foreground, ["fillWithShape"]),
|
|
1672
|
+
effects: foreground.effects?.map(normalizeEffect)
|
|
1673
|
+
});
|
|
1591
1674
|
}
|
|
1592
1675
|
}
|
|
1593
1676
|
|
|
1594
|
-
const nanoid = () => {
|
|
1595
|
-
return nanoid$1.nanoid(10);
|
|
1596
|
-
};
|
|
1597
|
-
const idGenerator = nanoid;
|
|
1598
|
-
|
|
1599
1677
|
function normalizeShape(shape) {
|
|
1600
1678
|
if (typeof shape === "string") {
|
|
1601
1679
|
if (shape.startsWith("<svg")) {
|
|
@@ -2038,6 +2116,7 @@ function normalizeElement(element) {
|
|
|
2038
2116
|
connection: isNone(element.connection) ? void 0 : normalizeConnection(element.connection),
|
|
2039
2117
|
table: isNone(element.table) ? void 0 : normalizeTable(element.table),
|
|
2040
2118
|
chart: isNone(element.chart) ? void 0 : normalizeChart(element.chart),
|
|
2119
|
+
comments: normalizeComments(element.comments),
|
|
2041
2120
|
...normalizeEffect(element),
|
|
2042
2121
|
children: element.children?.map((child) => normalizeElement(child))
|
|
2043
2122
|
});
|
|
@@ -2151,11 +2230,15 @@ exports.normalizeCRLF = normalizeCRLF;
|
|
|
2151
2230
|
exports.normalizeChart = normalizeChart;
|
|
2152
2231
|
exports.normalizeColor = normalizeColor;
|
|
2153
2232
|
exports.normalizeColorFill = normalizeColorFill;
|
|
2233
|
+
exports.normalizeCommentMessage = normalizeCommentMessage;
|
|
2234
|
+
exports.normalizeCommentThread = normalizeCommentThread;
|
|
2235
|
+
exports.normalizeComments = normalizeComments;
|
|
2154
2236
|
exports.normalizeConnection = normalizeConnection;
|
|
2155
2237
|
exports.normalizeDocument = normalizeDocument;
|
|
2156
2238
|
exports.normalizeEffect = normalizeEffect;
|
|
2157
2239
|
exports.normalizeElement = normalizeElement;
|
|
2158
2240
|
exports.normalizeFill = normalizeFill;
|
|
2241
|
+
exports.normalizeFilter = normalizeFilter;
|
|
2159
2242
|
exports.normalizeFlatDocument = normalizeFlatDocument;
|
|
2160
2243
|
exports.normalizeForeground = normalizeForeground;
|
|
2161
2244
|
exports.normalizeGradient = normalizeGradient;
|
|
@@ -2184,5 +2267,6 @@ exports.propertyOffsetSet = propertyOffsetSet;
|
|
|
2184
2267
|
exports.round = round;
|
|
2185
2268
|
exports.setNestedValue = setNestedValue;
|
|
2186
2269
|
exports.setObjectValueByPath = setObjectValueByPath;
|
|
2270
|
+
exports.stringifyFilter = stringifyFilter;
|
|
2187
2271
|
exports.stringifyGradient = stringifyGradient;
|
|
2188
2272
|
exports.textContentToString = textContentToString;
|
package/dist/index.d.cts
CHANGED
|
@@ -383,6 +383,62 @@ interface NormalizedChart extends Toggleable {
|
|
|
383
383
|
}
|
|
384
384
|
declare function normalizeChart(chart: Chart): NormalizedChart;
|
|
385
385
|
|
|
386
|
+
/** 评论位置:相对所属元素原点的偏移。 */
|
|
387
|
+
interface CommentOffset {
|
|
388
|
+
x: number;
|
|
389
|
+
y: number;
|
|
390
|
+
}
|
|
391
|
+
/** 评论作者。 */
|
|
392
|
+
interface CommentAuthor {
|
|
393
|
+
id?: string;
|
|
394
|
+
name?: string;
|
|
395
|
+
color?: string;
|
|
396
|
+
/** 姓名缩写(PPTX 作者用;缺省可由 name 推导)。 */
|
|
397
|
+
initials?: string;
|
|
398
|
+
}
|
|
399
|
+
/** 线程中的单条消息(根消息即创建评论,其后为回复)。 */
|
|
400
|
+
interface CommentMessage {
|
|
401
|
+
id?: string;
|
|
402
|
+
author?: CommentAuthor;
|
|
403
|
+
/** 正文。 */
|
|
404
|
+
body?: string;
|
|
405
|
+
/** 创建时间(毫秒时间戳)。 */
|
|
406
|
+
createdAt?: number;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* 一条评论线程,作为 {@link Element} 的能力存于 `element.comments`。
|
|
410
|
+
*
|
|
411
|
+
* - 锚点:`offset` 为**相对所属元素原点的偏移**(渲染时经元素世界矩阵还原为屏幕位置),
|
|
412
|
+
* 随该元素及其祖先的平移 / 缩放 / 旋转、复制 / 删除 / 重组自然跟随。
|
|
413
|
+
* 「画布级评论」即挂在页/帧或根元素上的线程 —— 无需区分 canvas / element 锚点。
|
|
414
|
+
* - 归属页(如 PPTX 幻灯片)由元素在文档树中的位置决定,无需显式 pageId。
|
|
415
|
+
* - 线程级数据(offset / resolved)归线程本身;对话内容在 `messages`。
|
|
416
|
+
*/
|
|
417
|
+
interface CommentThread {
|
|
418
|
+
id?: string;
|
|
419
|
+
/** 锚点偏移(相对所属元素原点)。 */
|
|
420
|
+
offset?: CommentOffset;
|
|
421
|
+
/** 是否已解决。 */
|
|
422
|
+
resolved?: boolean;
|
|
423
|
+
/** 对话消息(首条为创建,其后为回复)。 */
|
|
424
|
+
messages?: CommentMessage[];
|
|
425
|
+
}
|
|
426
|
+
interface NormalizedCommentMessage {
|
|
427
|
+
id: string;
|
|
428
|
+
author?: CommentAuthor;
|
|
429
|
+
body: string;
|
|
430
|
+
createdAt?: number;
|
|
431
|
+
}
|
|
432
|
+
interface NormalizedCommentThread {
|
|
433
|
+
id: string;
|
|
434
|
+
offset?: CommentOffset;
|
|
435
|
+
resolved?: boolean;
|
|
436
|
+
messages: NormalizedCommentMessage[];
|
|
437
|
+
}
|
|
438
|
+
declare function normalizeCommentMessage(message: CommentMessage): NormalizedCommentMessage;
|
|
439
|
+
declare function normalizeCommentThread(thread: CommentThread): NormalizedCommentThread;
|
|
440
|
+
declare function normalizeComments(comments?: CommentThread[]): NormalizedCommentThread[] | undefined;
|
|
441
|
+
|
|
386
442
|
type ConnectionMode = 'straight' | 'orthogonal' | 'curved';
|
|
387
443
|
interface ConnectionAnchor {
|
|
388
444
|
id: string;
|
|
@@ -483,6 +539,62 @@ interface NormalizedShadowStyle {
|
|
|
483
539
|
}
|
|
484
540
|
declare function getDefaultShadowStyle(): NormalizedShadowStyle;
|
|
485
541
|
|
|
542
|
+
/**
|
|
543
|
+
* 滤镜/调色。字段与语义对齐 CSS filter 函数(可经 stringifyFilter 无损转成 CSS filter 字符串),
|
|
544
|
+
* 并扩展若干 CSS 无等价、但 OOXML a:blip 支持的项(duotone / biLevel / colorChange)。
|
|
545
|
+
*/
|
|
546
|
+
interface Filter {
|
|
547
|
+
/** filter: blur(Npx) */
|
|
548
|
+
blur?: number;
|
|
549
|
+
/** filter: brightness(N),1 = 原值 */
|
|
550
|
+
brightness?: number;
|
|
551
|
+
/** filter: contrast(N),1 = 原值 */
|
|
552
|
+
contrast?: number;
|
|
553
|
+
/** filter: grayscale(0~1) */
|
|
554
|
+
grayscale?: number;
|
|
555
|
+
/** filter: hue-rotate(Ndeg) */
|
|
556
|
+
hueRotate?: number;
|
|
557
|
+
/** filter: invert(0~1) */
|
|
558
|
+
invert?: number;
|
|
559
|
+
/** filter: opacity(0~1) */
|
|
560
|
+
opacity?: number;
|
|
561
|
+
/** filter: saturate(N),1 = 原值 */
|
|
562
|
+
saturate?: number;
|
|
563
|
+
/** filter: sepia(0~1) */
|
|
564
|
+
sepia?: number;
|
|
565
|
+
/** 双色调,[暗, 亮] 两色映射(OOXML a:duotone,无 CSS 等价) */
|
|
566
|
+
duotone?: [Color, Color];
|
|
567
|
+
/** 黑白阈值 0~1(OOXML a:biLevel,无直接 CSS 等价) */
|
|
568
|
+
biLevel?: number;
|
|
569
|
+
/** 颜色替换(OOXML a:clrChange,无 CSS 等价) */
|
|
570
|
+
colorChange?: {
|
|
571
|
+
from: Color;
|
|
572
|
+
to: Color;
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
interface NormalizedFilter {
|
|
576
|
+
blur?: number;
|
|
577
|
+
brightness?: number;
|
|
578
|
+
contrast?: number;
|
|
579
|
+
grayscale?: number;
|
|
580
|
+
hueRotate?: number;
|
|
581
|
+
invert?: number;
|
|
582
|
+
opacity?: number;
|
|
583
|
+
saturate?: number;
|
|
584
|
+
sepia?: number;
|
|
585
|
+
duotone?: [NormalizedColor, NormalizedColor];
|
|
586
|
+
biLevel?: number;
|
|
587
|
+
colorChange?: {
|
|
588
|
+
from: NormalizedColor;
|
|
589
|
+
to: NormalizedColor;
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
declare function normalizeFilter(filter: Filter): NormalizedFilter;
|
|
593
|
+
/**
|
|
594
|
+
* 把 Filter 转成 CSS filter 字符串(仅含有 CSS 等价的项)。
|
|
595
|
+
* duotone / biLevel / colorChange 无 CSS filter 形式,自动跳过。
|
|
596
|
+
*/
|
|
597
|
+
declare function stringifyFilter(filter: NormalizedFilter): string;
|
|
486
598
|
interface _EffectV0 {
|
|
487
599
|
transformOrigin?: string;
|
|
488
600
|
rotate?: number;
|
|
@@ -506,6 +618,8 @@ interface Effect {
|
|
|
506
618
|
shadow?: WithNone<Shadow>;
|
|
507
619
|
transform?: WithStyleNone<string>;
|
|
508
620
|
transformOrigin?: string;
|
|
621
|
+
/** 滤镜/调色(灰度/双色调/亮度/对比度等),多用于图片元素的整图调色 */
|
|
622
|
+
filter?: Filter;
|
|
509
623
|
}
|
|
510
624
|
interface NormalizedEffect {
|
|
511
625
|
fill?: NormalizedFill;
|
|
@@ -513,15 +627,24 @@ interface NormalizedEffect {
|
|
|
513
627
|
shadow?: NormalizedShadow;
|
|
514
628
|
transform?: string;
|
|
515
629
|
transformOrigin?: string;
|
|
630
|
+
filter?: NormalizedFilter;
|
|
516
631
|
}
|
|
517
632
|
declare const effectFields: (keyof Effect)[];
|
|
518
633
|
declare function normalizeEffect(effect: _EffectV0 & Effect): NormalizedEffect;
|
|
519
634
|
|
|
520
635
|
interface NormalizedBaseForeground {
|
|
521
636
|
fillWithShape?: boolean;
|
|
637
|
+
/**
|
|
638
|
+
* 图片效果叠层(对应 bige 的"图片样式"),每层为通用 Effect,按数组顺序叠加。
|
|
639
|
+
* 多重描边 = 多个层(每层一条 outline);位移重影 = transform: translate()。
|
|
640
|
+
* 渲染端按需把 `图片 + effects` 烘焙到运行时 canvas,不入数据。
|
|
641
|
+
*/
|
|
642
|
+
effects?: NormalizedEffect[];
|
|
522
643
|
}
|
|
523
644
|
type NormalizedForeground = NormalizedBaseForeground & NormalizedFill;
|
|
524
|
-
type ForegroundObject = Partial<NormalizedBaseForeground
|
|
645
|
+
type ForegroundObject = Partial<Omit<NormalizedBaseForeground, 'effects'>> & FillObject & {
|
|
646
|
+
effects?: Effect[];
|
|
647
|
+
};
|
|
525
648
|
type Foreground = string | ForegroundObject;
|
|
526
649
|
declare function normalizeForeground(foreground: Foreground): NormalizedForeground | undefined;
|
|
527
650
|
|
|
@@ -886,6 +1009,8 @@ interface Element<T = Meta> extends Effect, Omit<Node<T>, 'children'> {
|
|
|
886
1009
|
connection?: WithNone<Connection>;
|
|
887
1010
|
table?: WithNone<Table>;
|
|
888
1011
|
chart?: WithNone<Chart>;
|
|
1012
|
+
/** 评论线程。挂在哪个元素即归属哪个元素 / 页;offset 相对该元素原点。 */
|
|
1013
|
+
comments?: CommentThread[];
|
|
889
1014
|
children?: Element[];
|
|
890
1015
|
}
|
|
891
1016
|
interface NormalizedElement<T = Meta> extends NormalizedEffect, Omit<Node<T>, 'children'> {
|
|
@@ -900,6 +1025,7 @@ interface NormalizedElement<T = Meta> extends NormalizedEffect, Omit<Node<T>, 'c
|
|
|
900
1025
|
connection?: NormalizedConnection;
|
|
901
1026
|
table?: NormalizedTable;
|
|
902
1027
|
chart?: NormalizedChart;
|
|
1028
|
+
comments?: NormalizedCommentThread[];
|
|
903
1029
|
children?: NormalizedElement[];
|
|
904
1030
|
}
|
|
905
1031
|
declare function normalizeElement<T = Meta>(element: Element<T>): NormalizedElement<T>;
|
|
@@ -1040,5 +1166,5 @@ declare class Reactivable extends Observable implements PropertyAccessor {
|
|
|
1040
1166
|
destroy(): void;
|
|
1041
1167
|
}
|
|
1042
1168
|
|
|
1043
|
-
export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, colorFillFields, defaultColor, defineProperty, effectFields, flatDocumentToDocument, getDeclarations, getDefaultBackgroundStyle, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOutlineStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, gradientFillFields, hasCRLF, idGenerator, imageFillFiedls, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeChart, normalizeColor, normalizeColorFill, normalizeConnection, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeNumber, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeStyle, normalizeTable, normalizeText, normalizeTextContent, normalizeTextDeformation, normalizeVideo, parseColor, parseGradient, pick, presetFillFiedls, property, property2, propertyOffsetFallback, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
|
|
1044
|
-
export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, Chart, ChartAxis, ChartGrouping, ChartLegend, ChartObject, ChartSeriesObject, ChartType, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, Connection, ConnectionAnchor, ConnectionMode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Effect, Element, EmNode, EventListener, EventListenerOptions, EventListenerValue, ExtentKeywordNode, Fill, FillObject, FillRule, FlatDocument, FlatElement, FlatTextContent, FlexDirection, FlexWrap, FontKerning, FontStyle, FontWeight, Foreground, ForegroundObject, FragmentObject, FullStyle, GradientFill, GradientFillObject, GradientNode, HeadEnd, Hex8Color, HexNode, HighlightColormap, HighlightImage, HighlightLine, HighlightReferImage, HighlightSize, HighlightThickness, HslColor, HslaColor, HsvColor, HsvaColor, HwbColor, HwbaColor, IdGenerator, ImageFill, ImageFillCropRect, ImageFillObject, ImageFillStretchRect, ImageFillTile, Justify, LabColor, LabaColor, LchColor, LchaColor, LineCap, LineEndSize, LineEndType, LineJoin, LinearGradient, LinearGradientNode, LinearGradientWithType, ListStyleColormap, ListStyleImage, ListStylePosition, ListStyleSize, ListStyleType, LiteralNode, Meta, Node, None, NormalizedAudio, NormalizedBackground, NormalizedBackgroundStyle, NormalizedBaseBackground, NormalizedBaseForeground, NormalizedBaseOutline, NormalizedChart, NormalizedChartSeries, NormalizedColor, NormalizedColorFill, NormalizedConnection, NormalizedDocument, NormalizedEffect, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedFlatDocument, NormalizedFlatElement, NormalizedForeground, NormalizedFragment, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOutline, NormalizedOutlineStyle, NormalizedParagraph, NormalizedPresetFill, NormalizedShadow, NormalizedShadowStyle, NormalizedShape, NormalizedStyle, NormalizedTable, NormalizedTableCell, NormalizedTableColumn, NormalizedTableRow, NormalizedText, NormalizedTextContent, NormalizedTextDeformation, NormalizedTextDrawStyle, NormalizedTextInlineStyle, NormalizedTextLineStyle, NormalizedTextStyle, NormalizedTransformStyle, NormalizedVideo, ObjectColor, ObservableEvents, Outline, OutlineObject, OutlineStyle, Overflow, ParagraphObject, PercentNode, PointerEvents, Position, PositionKeywordNode, PositionNode, PresetFill, PresetFillObject, PropertyAccessor, PropertyDeclaration, PxNode, RadialGradient, RadialGradientNode, RadialGradientWithType, ReactivableEvents, RepeatingLinearGradientNode, RepeatingRadialGradientNode, RgbColor, RgbNode, RgbaColor, RgbaNode, SVGPathData, Shadow, ShadowObject, Shape, ShapeConnectionPoint, ShapeNode, ShapePath, ShapePathStyle, StrokeLinecap, StrokeLinejoin, Style, StyleObject, StyleUnit, Table, TableCellObject, TableColumnObject, TableObject, TableRowObject, TailEnd, Text, TextAlign, TextContent, TextDecoration, TextDeformation, TextObject, TextOrientation, TextTransform, TextWrap, Toggleable, Uint32Color, VerticalAlign, Video, Visibility, WithNone, WithStyleNone, WritingMode, XyzColor, XyzaColor, _EffectV0 };
|
|
1169
|
+
export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, colorFillFields, defaultColor, defineProperty, effectFields, flatDocumentToDocument, getDeclarations, getDefaultBackgroundStyle, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOutlineStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, gradientFillFields, hasCRLF, idGenerator, imageFillFiedls, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeChart, normalizeColor, normalizeColorFill, normalizeCommentMessage, normalizeCommentThread, normalizeComments, normalizeConnection, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFilter, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeNumber, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeStyle, normalizeTable, normalizeText, normalizeTextContent, normalizeTextDeformation, normalizeVideo, parseColor, parseGradient, pick, presetFillFiedls, property, property2, propertyOffsetFallback, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyFilter, stringifyGradient, textContentToString };
|
|
1170
|
+
export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, Chart, ChartAxis, ChartGrouping, ChartLegend, ChartObject, ChartSeriesObject, ChartType, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, CommentAuthor, CommentMessage, CommentOffset, CommentThread, Connection, ConnectionAnchor, ConnectionMode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Effect, Element, EmNode, EventListener, EventListenerOptions, EventListenerValue, ExtentKeywordNode, Fill, FillObject, FillRule, Filter, FlatDocument, FlatElement, FlatTextContent, FlexDirection, FlexWrap, FontKerning, FontStyle, FontWeight, Foreground, ForegroundObject, FragmentObject, FullStyle, GradientFill, GradientFillObject, GradientNode, HeadEnd, Hex8Color, HexNode, HighlightColormap, HighlightImage, HighlightLine, HighlightReferImage, HighlightSize, HighlightThickness, HslColor, HslaColor, HsvColor, HsvaColor, HwbColor, HwbaColor, IdGenerator, ImageFill, ImageFillCropRect, ImageFillObject, ImageFillStretchRect, ImageFillTile, Justify, LabColor, LabaColor, LchColor, LchaColor, LineCap, LineEndSize, LineEndType, LineJoin, LinearGradient, LinearGradientNode, LinearGradientWithType, ListStyleColormap, ListStyleImage, ListStylePosition, ListStyleSize, ListStyleType, LiteralNode, Meta, Node, None, NormalizedAudio, NormalizedBackground, NormalizedBackgroundStyle, NormalizedBaseBackground, NormalizedBaseForeground, NormalizedBaseOutline, NormalizedChart, NormalizedChartSeries, NormalizedColor, NormalizedColorFill, NormalizedCommentMessage, NormalizedCommentThread, NormalizedConnection, NormalizedDocument, NormalizedEffect, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedFilter, NormalizedFlatDocument, NormalizedFlatElement, NormalizedForeground, NormalizedFragment, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOutline, NormalizedOutlineStyle, NormalizedParagraph, NormalizedPresetFill, NormalizedShadow, NormalizedShadowStyle, NormalizedShape, NormalizedStyle, NormalizedTable, NormalizedTableCell, NormalizedTableColumn, NormalizedTableRow, NormalizedText, NormalizedTextContent, NormalizedTextDeformation, NormalizedTextDrawStyle, NormalizedTextInlineStyle, NormalizedTextLineStyle, NormalizedTextStyle, NormalizedTransformStyle, NormalizedVideo, ObjectColor, ObservableEvents, Outline, OutlineObject, OutlineStyle, Overflow, ParagraphObject, PercentNode, PointerEvents, Position, PositionKeywordNode, PositionNode, PresetFill, PresetFillObject, PropertyAccessor, PropertyDeclaration, PxNode, RadialGradient, RadialGradientNode, RadialGradientWithType, ReactivableEvents, RepeatingLinearGradientNode, RepeatingRadialGradientNode, RgbColor, RgbNode, RgbaColor, RgbaNode, SVGPathData, Shadow, ShadowObject, Shape, ShapeConnectionPoint, ShapeNode, ShapePath, ShapePathStyle, StrokeLinecap, StrokeLinejoin, Style, StyleObject, StyleUnit, Table, TableCellObject, TableColumnObject, TableObject, TableRowObject, TailEnd, Text, TextAlign, TextContent, TextDecoration, TextDeformation, TextObject, TextOrientation, TextTransform, TextWrap, Toggleable, Uint32Color, VerticalAlign, Video, Visibility, WithNone, WithStyleNone, WritingMode, XyzColor, XyzaColor, _EffectV0 };
|
package/dist/index.d.mts
CHANGED
|
@@ -383,6 +383,62 @@ interface NormalizedChart extends Toggleable {
|
|
|
383
383
|
}
|
|
384
384
|
declare function normalizeChart(chart: Chart): NormalizedChart;
|
|
385
385
|
|
|
386
|
+
/** 评论位置:相对所属元素原点的偏移。 */
|
|
387
|
+
interface CommentOffset {
|
|
388
|
+
x: number;
|
|
389
|
+
y: number;
|
|
390
|
+
}
|
|
391
|
+
/** 评论作者。 */
|
|
392
|
+
interface CommentAuthor {
|
|
393
|
+
id?: string;
|
|
394
|
+
name?: string;
|
|
395
|
+
color?: string;
|
|
396
|
+
/** 姓名缩写(PPTX 作者用;缺省可由 name 推导)。 */
|
|
397
|
+
initials?: string;
|
|
398
|
+
}
|
|
399
|
+
/** 线程中的单条消息(根消息即创建评论,其后为回复)。 */
|
|
400
|
+
interface CommentMessage {
|
|
401
|
+
id?: string;
|
|
402
|
+
author?: CommentAuthor;
|
|
403
|
+
/** 正文。 */
|
|
404
|
+
body?: string;
|
|
405
|
+
/** 创建时间(毫秒时间戳)。 */
|
|
406
|
+
createdAt?: number;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* 一条评论线程,作为 {@link Element} 的能力存于 `element.comments`。
|
|
410
|
+
*
|
|
411
|
+
* - 锚点:`offset` 为**相对所属元素原点的偏移**(渲染时经元素世界矩阵还原为屏幕位置),
|
|
412
|
+
* 随该元素及其祖先的平移 / 缩放 / 旋转、复制 / 删除 / 重组自然跟随。
|
|
413
|
+
* 「画布级评论」即挂在页/帧或根元素上的线程 —— 无需区分 canvas / element 锚点。
|
|
414
|
+
* - 归属页(如 PPTX 幻灯片)由元素在文档树中的位置决定,无需显式 pageId。
|
|
415
|
+
* - 线程级数据(offset / resolved)归线程本身;对话内容在 `messages`。
|
|
416
|
+
*/
|
|
417
|
+
interface CommentThread {
|
|
418
|
+
id?: string;
|
|
419
|
+
/** 锚点偏移(相对所属元素原点)。 */
|
|
420
|
+
offset?: CommentOffset;
|
|
421
|
+
/** 是否已解决。 */
|
|
422
|
+
resolved?: boolean;
|
|
423
|
+
/** 对话消息(首条为创建,其后为回复)。 */
|
|
424
|
+
messages?: CommentMessage[];
|
|
425
|
+
}
|
|
426
|
+
interface NormalizedCommentMessage {
|
|
427
|
+
id: string;
|
|
428
|
+
author?: CommentAuthor;
|
|
429
|
+
body: string;
|
|
430
|
+
createdAt?: number;
|
|
431
|
+
}
|
|
432
|
+
interface NormalizedCommentThread {
|
|
433
|
+
id: string;
|
|
434
|
+
offset?: CommentOffset;
|
|
435
|
+
resolved?: boolean;
|
|
436
|
+
messages: NormalizedCommentMessage[];
|
|
437
|
+
}
|
|
438
|
+
declare function normalizeCommentMessage(message: CommentMessage): NormalizedCommentMessage;
|
|
439
|
+
declare function normalizeCommentThread(thread: CommentThread): NormalizedCommentThread;
|
|
440
|
+
declare function normalizeComments(comments?: CommentThread[]): NormalizedCommentThread[] | undefined;
|
|
441
|
+
|
|
386
442
|
type ConnectionMode = 'straight' | 'orthogonal' | 'curved';
|
|
387
443
|
interface ConnectionAnchor {
|
|
388
444
|
id: string;
|
|
@@ -483,6 +539,62 @@ interface NormalizedShadowStyle {
|
|
|
483
539
|
}
|
|
484
540
|
declare function getDefaultShadowStyle(): NormalizedShadowStyle;
|
|
485
541
|
|
|
542
|
+
/**
|
|
543
|
+
* 滤镜/调色。字段与语义对齐 CSS filter 函数(可经 stringifyFilter 无损转成 CSS filter 字符串),
|
|
544
|
+
* 并扩展若干 CSS 无等价、但 OOXML a:blip 支持的项(duotone / biLevel / colorChange)。
|
|
545
|
+
*/
|
|
546
|
+
interface Filter {
|
|
547
|
+
/** filter: blur(Npx) */
|
|
548
|
+
blur?: number;
|
|
549
|
+
/** filter: brightness(N),1 = 原值 */
|
|
550
|
+
brightness?: number;
|
|
551
|
+
/** filter: contrast(N),1 = 原值 */
|
|
552
|
+
contrast?: number;
|
|
553
|
+
/** filter: grayscale(0~1) */
|
|
554
|
+
grayscale?: number;
|
|
555
|
+
/** filter: hue-rotate(Ndeg) */
|
|
556
|
+
hueRotate?: number;
|
|
557
|
+
/** filter: invert(0~1) */
|
|
558
|
+
invert?: number;
|
|
559
|
+
/** filter: opacity(0~1) */
|
|
560
|
+
opacity?: number;
|
|
561
|
+
/** filter: saturate(N),1 = 原值 */
|
|
562
|
+
saturate?: number;
|
|
563
|
+
/** filter: sepia(0~1) */
|
|
564
|
+
sepia?: number;
|
|
565
|
+
/** 双色调,[暗, 亮] 两色映射(OOXML a:duotone,无 CSS 等价) */
|
|
566
|
+
duotone?: [Color, Color];
|
|
567
|
+
/** 黑白阈值 0~1(OOXML a:biLevel,无直接 CSS 等价) */
|
|
568
|
+
biLevel?: number;
|
|
569
|
+
/** 颜色替换(OOXML a:clrChange,无 CSS 等价) */
|
|
570
|
+
colorChange?: {
|
|
571
|
+
from: Color;
|
|
572
|
+
to: Color;
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
interface NormalizedFilter {
|
|
576
|
+
blur?: number;
|
|
577
|
+
brightness?: number;
|
|
578
|
+
contrast?: number;
|
|
579
|
+
grayscale?: number;
|
|
580
|
+
hueRotate?: number;
|
|
581
|
+
invert?: number;
|
|
582
|
+
opacity?: number;
|
|
583
|
+
saturate?: number;
|
|
584
|
+
sepia?: number;
|
|
585
|
+
duotone?: [NormalizedColor, NormalizedColor];
|
|
586
|
+
biLevel?: number;
|
|
587
|
+
colorChange?: {
|
|
588
|
+
from: NormalizedColor;
|
|
589
|
+
to: NormalizedColor;
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
declare function normalizeFilter(filter: Filter): NormalizedFilter;
|
|
593
|
+
/**
|
|
594
|
+
* 把 Filter 转成 CSS filter 字符串(仅含有 CSS 等价的项)。
|
|
595
|
+
* duotone / biLevel / colorChange 无 CSS filter 形式,自动跳过。
|
|
596
|
+
*/
|
|
597
|
+
declare function stringifyFilter(filter: NormalizedFilter): string;
|
|
486
598
|
interface _EffectV0 {
|
|
487
599
|
transformOrigin?: string;
|
|
488
600
|
rotate?: number;
|
|
@@ -506,6 +618,8 @@ interface Effect {
|
|
|
506
618
|
shadow?: WithNone<Shadow>;
|
|
507
619
|
transform?: WithStyleNone<string>;
|
|
508
620
|
transformOrigin?: string;
|
|
621
|
+
/** 滤镜/调色(灰度/双色调/亮度/对比度等),多用于图片元素的整图调色 */
|
|
622
|
+
filter?: Filter;
|
|
509
623
|
}
|
|
510
624
|
interface NormalizedEffect {
|
|
511
625
|
fill?: NormalizedFill;
|
|
@@ -513,15 +627,24 @@ interface NormalizedEffect {
|
|
|
513
627
|
shadow?: NormalizedShadow;
|
|
514
628
|
transform?: string;
|
|
515
629
|
transformOrigin?: string;
|
|
630
|
+
filter?: NormalizedFilter;
|
|
516
631
|
}
|
|
517
632
|
declare const effectFields: (keyof Effect)[];
|
|
518
633
|
declare function normalizeEffect(effect: _EffectV0 & Effect): NormalizedEffect;
|
|
519
634
|
|
|
520
635
|
interface NormalizedBaseForeground {
|
|
521
636
|
fillWithShape?: boolean;
|
|
637
|
+
/**
|
|
638
|
+
* 图片效果叠层(对应 bige 的"图片样式"),每层为通用 Effect,按数组顺序叠加。
|
|
639
|
+
* 多重描边 = 多个层(每层一条 outline);位移重影 = transform: translate()。
|
|
640
|
+
* 渲染端按需把 `图片 + effects` 烘焙到运行时 canvas,不入数据。
|
|
641
|
+
*/
|
|
642
|
+
effects?: NormalizedEffect[];
|
|
522
643
|
}
|
|
523
644
|
type NormalizedForeground = NormalizedBaseForeground & NormalizedFill;
|
|
524
|
-
type ForegroundObject = Partial<NormalizedBaseForeground
|
|
645
|
+
type ForegroundObject = Partial<Omit<NormalizedBaseForeground, 'effects'>> & FillObject & {
|
|
646
|
+
effects?: Effect[];
|
|
647
|
+
};
|
|
525
648
|
type Foreground = string | ForegroundObject;
|
|
526
649
|
declare function normalizeForeground(foreground: Foreground): NormalizedForeground | undefined;
|
|
527
650
|
|
|
@@ -886,6 +1009,8 @@ interface Element<T = Meta> extends Effect, Omit<Node<T>, 'children'> {
|
|
|
886
1009
|
connection?: WithNone<Connection>;
|
|
887
1010
|
table?: WithNone<Table>;
|
|
888
1011
|
chart?: WithNone<Chart>;
|
|
1012
|
+
/** 评论线程。挂在哪个元素即归属哪个元素 / 页;offset 相对该元素原点。 */
|
|
1013
|
+
comments?: CommentThread[];
|
|
889
1014
|
children?: Element[];
|
|
890
1015
|
}
|
|
891
1016
|
interface NormalizedElement<T = Meta> extends NormalizedEffect, Omit<Node<T>, 'children'> {
|
|
@@ -900,6 +1025,7 @@ interface NormalizedElement<T = Meta> extends NormalizedEffect, Omit<Node<T>, 'c
|
|
|
900
1025
|
connection?: NormalizedConnection;
|
|
901
1026
|
table?: NormalizedTable;
|
|
902
1027
|
chart?: NormalizedChart;
|
|
1028
|
+
comments?: NormalizedCommentThread[];
|
|
903
1029
|
children?: NormalizedElement[];
|
|
904
1030
|
}
|
|
905
1031
|
declare function normalizeElement<T = Meta>(element: Element<T>): NormalizedElement<T>;
|
|
@@ -1040,5 +1166,5 @@ declare class Reactivable extends Observable implements PropertyAccessor {
|
|
|
1040
1166
|
destroy(): void;
|
|
1041
1167
|
}
|
|
1042
1168
|
|
|
1043
|
-
export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, colorFillFields, defaultColor, defineProperty, effectFields, flatDocumentToDocument, getDeclarations, getDefaultBackgroundStyle, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOutlineStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, gradientFillFields, hasCRLF, idGenerator, imageFillFiedls, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeChart, normalizeColor, normalizeColorFill, normalizeConnection, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeNumber, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeStyle, normalizeTable, normalizeText, normalizeTextContent, normalizeTextDeformation, normalizeVideo, parseColor, parseGradient, pick, presetFillFiedls, property, property2, propertyOffsetFallback, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
|
|
1044
|
-
export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, Chart, ChartAxis, ChartGrouping, ChartLegend, ChartObject, ChartSeriesObject, ChartType, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, Connection, ConnectionAnchor, ConnectionMode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Effect, Element, EmNode, EventListener, EventListenerOptions, EventListenerValue, ExtentKeywordNode, Fill, FillObject, FillRule, FlatDocument, FlatElement, FlatTextContent, FlexDirection, FlexWrap, FontKerning, FontStyle, FontWeight, Foreground, ForegroundObject, FragmentObject, FullStyle, GradientFill, GradientFillObject, GradientNode, HeadEnd, Hex8Color, HexNode, HighlightColormap, HighlightImage, HighlightLine, HighlightReferImage, HighlightSize, HighlightThickness, HslColor, HslaColor, HsvColor, HsvaColor, HwbColor, HwbaColor, IdGenerator, ImageFill, ImageFillCropRect, ImageFillObject, ImageFillStretchRect, ImageFillTile, Justify, LabColor, LabaColor, LchColor, LchaColor, LineCap, LineEndSize, LineEndType, LineJoin, LinearGradient, LinearGradientNode, LinearGradientWithType, ListStyleColormap, ListStyleImage, ListStylePosition, ListStyleSize, ListStyleType, LiteralNode, Meta, Node, None, NormalizedAudio, NormalizedBackground, NormalizedBackgroundStyle, NormalizedBaseBackground, NormalizedBaseForeground, NormalizedBaseOutline, NormalizedChart, NormalizedChartSeries, NormalizedColor, NormalizedColorFill, NormalizedConnection, NormalizedDocument, NormalizedEffect, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedFlatDocument, NormalizedFlatElement, NormalizedForeground, NormalizedFragment, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOutline, NormalizedOutlineStyle, NormalizedParagraph, NormalizedPresetFill, NormalizedShadow, NormalizedShadowStyle, NormalizedShape, NormalizedStyle, NormalizedTable, NormalizedTableCell, NormalizedTableColumn, NormalizedTableRow, NormalizedText, NormalizedTextContent, NormalizedTextDeformation, NormalizedTextDrawStyle, NormalizedTextInlineStyle, NormalizedTextLineStyle, NormalizedTextStyle, NormalizedTransformStyle, NormalizedVideo, ObjectColor, ObservableEvents, Outline, OutlineObject, OutlineStyle, Overflow, ParagraphObject, PercentNode, PointerEvents, Position, PositionKeywordNode, PositionNode, PresetFill, PresetFillObject, PropertyAccessor, PropertyDeclaration, PxNode, RadialGradient, RadialGradientNode, RadialGradientWithType, ReactivableEvents, RepeatingLinearGradientNode, RepeatingRadialGradientNode, RgbColor, RgbNode, RgbaColor, RgbaNode, SVGPathData, Shadow, ShadowObject, Shape, ShapeConnectionPoint, ShapeNode, ShapePath, ShapePathStyle, StrokeLinecap, StrokeLinejoin, Style, StyleObject, StyleUnit, Table, TableCellObject, TableColumnObject, TableObject, TableRowObject, TailEnd, Text, TextAlign, TextContent, TextDecoration, TextDeformation, TextObject, TextOrientation, TextTransform, TextWrap, Toggleable, Uint32Color, VerticalAlign, Video, Visibility, WithNone, WithStyleNone, WritingMode, XyzColor, XyzaColor, _EffectV0 };
|
|
1169
|
+
export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, colorFillFields, defaultColor, defineProperty, effectFields, flatDocumentToDocument, getDeclarations, getDefaultBackgroundStyle, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOutlineStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, gradientFillFields, hasCRLF, idGenerator, imageFillFiedls, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeChart, normalizeColor, normalizeColorFill, normalizeCommentMessage, normalizeCommentThread, normalizeComments, normalizeConnection, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFilter, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeNumber, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeStyle, normalizeTable, normalizeText, normalizeTextContent, normalizeTextDeformation, normalizeVideo, parseColor, parseGradient, pick, presetFillFiedls, property, property2, propertyOffsetFallback, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyFilter, stringifyGradient, textContentToString };
|
|
1170
|
+
export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, Chart, ChartAxis, ChartGrouping, ChartLegend, ChartObject, ChartSeriesObject, ChartType, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, CommentAuthor, CommentMessage, CommentOffset, CommentThread, Connection, ConnectionAnchor, ConnectionMode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Effect, Element, EmNode, EventListener, EventListenerOptions, EventListenerValue, ExtentKeywordNode, Fill, FillObject, FillRule, Filter, FlatDocument, FlatElement, FlatTextContent, FlexDirection, FlexWrap, FontKerning, FontStyle, FontWeight, Foreground, ForegroundObject, FragmentObject, FullStyle, GradientFill, GradientFillObject, GradientNode, HeadEnd, Hex8Color, HexNode, HighlightColormap, HighlightImage, HighlightLine, HighlightReferImage, HighlightSize, HighlightThickness, HslColor, HslaColor, HsvColor, HsvaColor, HwbColor, HwbaColor, IdGenerator, ImageFill, ImageFillCropRect, ImageFillObject, ImageFillStretchRect, ImageFillTile, Justify, LabColor, LabaColor, LchColor, LchaColor, LineCap, LineEndSize, LineEndType, LineJoin, LinearGradient, LinearGradientNode, LinearGradientWithType, ListStyleColormap, ListStyleImage, ListStylePosition, ListStyleSize, ListStyleType, LiteralNode, Meta, Node, None, NormalizedAudio, NormalizedBackground, NormalizedBackgroundStyle, NormalizedBaseBackground, NormalizedBaseForeground, NormalizedBaseOutline, NormalizedChart, NormalizedChartSeries, NormalizedColor, NormalizedColorFill, NormalizedCommentMessage, NormalizedCommentThread, NormalizedConnection, NormalizedDocument, NormalizedEffect, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedFilter, NormalizedFlatDocument, NormalizedFlatElement, NormalizedForeground, NormalizedFragment, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOutline, NormalizedOutlineStyle, NormalizedParagraph, NormalizedPresetFill, NormalizedShadow, NormalizedShadowStyle, NormalizedShape, NormalizedStyle, NormalizedTable, NormalizedTableCell, NormalizedTableColumn, NormalizedTableRow, NormalizedText, NormalizedTextContent, NormalizedTextDeformation, NormalizedTextDrawStyle, NormalizedTextInlineStyle, NormalizedTextLineStyle, NormalizedTextStyle, NormalizedTransformStyle, NormalizedVideo, ObjectColor, ObservableEvents, Outline, OutlineObject, OutlineStyle, Overflow, ParagraphObject, PercentNode, PointerEvents, Position, PositionKeywordNode, PositionNode, PresetFill, PresetFillObject, PropertyAccessor, PropertyDeclaration, PxNode, RadialGradient, RadialGradientNode, RadialGradientWithType, ReactivableEvents, RepeatingLinearGradientNode, RepeatingRadialGradientNode, RgbColor, RgbNode, RgbaColor, RgbaNode, SVGPathData, Shadow, ShadowObject, Shape, ShapeConnectionPoint, ShapeNode, ShapePath, ShapePathStyle, StrokeLinecap, StrokeLinejoin, Style, StyleObject, StyleUnit, Table, TableCellObject, TableColumnObject, TableObject, TableRowObject, TailEnd, Text, TextAlign, TextContent, TextDecoration, TextDeformation, TextObject, TextOrientation, TextTransform, TextWrap, Toggleable, Uint32Color, VerticalAlign, Video, Visibility, WithNone, WithStyleNone, WritingMode, XyzColor, XyzaColor, _EffectV0 };
|
package/dist/index.d.ts
CHANGED
|
@@ -383,6 +383,62 @@ interface NormalizedChart extends Toggleable {
|
|
|
383
383
|
}
|
|
384
384
|
declare function normalizeChart(chart: Chart): NormalizedChart;
|
|
385
385
|
|
|
386
|
+
/** 评论位置:相对所属元素原点的偏移。 */
|
|
387
|
+
interface CommentOffset {
|
|
388
|
+
x: number;
|
|
389
|
+
y: number;
|
|
390
|
+
}
|
|
391
|
+
/** 评论作者。 */
|
|
392
|
+
interface CommentAuthor {
|
|
393
|
+
id?: string;
|
|
394
|
+
name?: string;
|
|
395
|
+
color?: string;
|
|
396
|
+
/** 姓名缩写(PPTX 作者用;缺省可由 name 推导)。 */
|
|
397
|
+
initials?: string;
|
|
398
|
+
}
|
|
399
|
+
/** 线程中的单条消息(根消息即创建评论,其后为回复)。 */
|
|
400
|
+
interface CommentMessage {
|
|
401
|
+
id?: string;
|
|
402
|
+
author?: CommentAuthor;
|
|
403
|
+
/** 正文。 */
|
|
404
|
+
body?: string;
|
|
405
|
+
/** 创建时间(毫秒时间戳)。 */
|
|
406
|
+
createdAt?: number;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* 一条评论线程,作为 {@link Element} 的能力存于 `element.comments`。
|
|
410
|
+
*
|
|
411
|
+
* - 锚点:`offset` 为**相对所属元素原点的偏移**(渲染时经元素世界矩阵还原为屏幕位置),
|
|
412
|
+
* 随该元素及其祖先的平移 / 缩放 / 旋转、复制 / 删除 / 重组自然跟随。
|
|
413
|
+
* 「画布级评论」即挂在页/帧或根元素上的线程 —— 无需区分 canvas / element 锚点。
|
|
414
|
+
* - 归属页(如 PPTX 幻灯片)由元素在文档树中的位置决定,无需显式 pageId。
|
|
415
|
+
* - 线程级数据(offset / resolved)归线程本身;对话内容在 `messages`。
|
|
416
|
+
*/
|
|
417
|
+
interface CommentThread {
|
|
418
|
+
id?: string;
|
|
419
|
+
/** 锚点偏移(相对所属元素原点)。 */
|
|
420
|
+
offset?: CommentOffset;
|
|
421
|
+
/** 是否已解决。 */
|
|
422
|
+
resolved?: boolean;
|
|
423
|
+
/** 对话消息(首条为创建,其后为回复)。 */
|
|
424
|
+
messages?: CommentMessage[];
|
|
425
|
+
}
|
|
426
|
+
interface NormalizedCommentMessage {
|
|
427
|
+
id: string;
|
|
428
|
+
author?: CommentAuthor;
|
|
429
|
+
body: string;
|
|
430
|
+
createdAt?: number;
|
|
431
|
+
}
|
|
432
|
+
interface NormalizedCommentThread {
|
|
433
|
+
id: string;
|
|
434
|
+
offset?: CommentOffset;
|
|
435
|
+
resolved?: boolean;
|
|
436
|
+
messages: NormalizedCommentMessage[];
|
|
437
|
+
}
|
|
438
|
+
declare function normalizeCommentMessage(message: CommentMessage): NormalizedCommentMessage;
|
|
439
|
+
declare function normalizeCommentThread(thread: CommentThread): NormalizedCommentThread;
|
|
440
|
+
declare function normalizeComments(comments?: CommentThread[]): NormalizedCommentThread[] | undefined;
|
|
441
|
+
|
|
386
442
|
type ConnectionMode = 'straight' | 'orthogonal' | 'curved';
|
|
387
443
|
interface ConnectionAnchor {
|
|
388
444
|
id: string;
|
|
@@ -483,6 +539,62 @@ interface NormalizedShadowStyle {
|
|
|
483
539
|
}
|
|
484
540
|
declare function getDefaultShadowStyle(): NormalizedShadowStyle;
|
|
485
541
|
|
|
542
|
+
/**
|
|
543
|
+
* 滤镜/调色。字段与语义对齐 CSS filter 函数(可经 stringifyFilter 无损转成 CSS filter 字符串),
|
|
544
|
+
* 并扩展若干 CSS 无等价、但 OOXML a:blip 支持的项(duotone / biLevel / colorChange)。
|
|
545
|
+
*/
|
|
546
|
+
interface Filter {
|
|
547
|
+
/** filter: blur(Npx) */
|
|
548
|
+
blur?: number;
|
|
549
|
+
/** filter: brightness(N),1 = 原值 */
|
|
550
|
+
brightness?: number;
|
|
551
|
+
/** filter: contrast(N),1 = 原值 */
|
|
552
|
+
contrast?: number;
|
|
553
|
+
/** filter: grayscale(0~1) */
|
|
554
|
+
grayscale?: number;
|
|
555
|
+
/** filter: hue-rotate(Ndeg) */
|
|
556
|
+
hueRotate?: number;
|
|
557
|
+
/** filter: invert(0~1) */
|
|
558
|
+
invert?: number;
|
|
559
|
+
/** filter: opacity(0~1) */
|
|
560
|
+
opacity?: number;
|
|
561
|
+
/** filter: saturate(N),1 = 原值 */
|
|
562
|
+
saturate?: number;
|
|
563
|
+
/** filter: sepia(0~1) */
|
|
564
|
+
sepia?: number;
|
|
565
|
+
/** 双色调,[暗, 亮] 两色映射(OOXML a:duotone,无 CSS 等价) */
|
|
566
|
+
duotone?: [Color, Color];
|
|
567
|
+
/** 黑白阈值 0~1(OOXML a:biLevel,无直接 CSS 等价) */
|
|
568
|
+
biLevel?: number;
|
|
569
|
+
/** 颜色替换(OOXML a:clrChange,无 CSS 等价) */
|
|
570
|
+
colorChange?: {
|
|
571
|
+
from: Color;
|
|
572
|
+
to: Color;
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
interface NormalizedFilter {
|
|
576
|
+
blur?: number;
|
|
577
|
+
brightness?: number;
|
|
578
|
+
contrast?: number;
|
|
579
|
+
grayscale?: number;
|
|
580
|
+
hueRotate?: number;
|
|
581
|
+
invert?: number;
|
|
582
|
+
opacity?: number;
|
|
583
|
+
saturate?: number;
|
|
584
|
+
sepia?: number;
|
|
585
|
+
duotone?: [NormalizedColor, NormalizedColor];
|
|
586
|
+
biLevel?: number;
|
|
587
|
+
colorChange?: {
|
|
588
|
+
from: NormalizedColor;
|
|
589
|
+
to: NormalizedColor;
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
declare function normalizeFilter(filter: Filter): NormalizedFilter;
|
|
593
|
+
/**
|
|
594
|
+
* 把 Filter 转成 CSS filter 字符串(仅含有 CSS 等价的项)。
|
|
595
|
+
* duotone / biLevel / colorChange 无 CSS filter 形式,自动跳过。
|
|
596
|
+
*/
|
|
597
|
+
declare function stringifyFilter(filter: NormalizedFilter): string;
|
|
486
598
|
interface _EffectV0 {
|
|
487
599
|
transformOrigin?: string;
|
|
488
600
|
rotate?: number;
|
|
@@ -506,6 +618,8 @@ interface Effect {
|
|
|
506
618
|
shadow?: WithNone<Shadow>;
|
|
507
619
|
transform?: WithStyleNone<string>;
|
|
508
620
|
transformOrigin?: string;
|
|
621
|
+
/** 滤镜/调色(灰度/双色调/亮度/对比度等),多用于图片元素的整图调色 */
|
|
622
|
+
filter?: Filter;
|
|
509
623
|
}
|
|
510
624
|
interface NormalizedEffect {
|
|
511
625
|
fill?: NormalizedFill;
|
|
@@ -513,15 +627,24 @@ interface NormalizedEffect {
|
|
|
513
627
|
shadow?: NormalizedShadow;
|
|
514
628
|
transform?: string;
|
|
515
629
|
transformOrigin?: string;
|
|
630
|
+
filter?: NormalizedFilter;
|
|
516
631
|
}
|
|
517
632
|
declare const effectFields: (keyof Effect)[];
|
|
518
633
|
declare function normalizeEffect(effect: _EffectV0 & Effect): NormalizedEffect;
|
|
519
634
|
|
|
520
635
|
interface NormalizedBaseForeground {
|
|
521
636
|
fillWithShape?: boolean;
|
|
637
|
+
/**
|
|
638
|
+
* 图片效果叠层(对应 bige 的"图片样式"),每层为通用 Effect,按数组顺序叠加。
|
|
639
|
+
* 多重描边 = 多个层(每层一条 outline);位移重影 = transform: translate()。
|
|
640
|
+
* 渲染端按需把 `图片 + effects` 烘焙到运行时 canvas,不入数据。
|
|
641
|
+
*/
|
|
642
|
+
effects?: NormalizedEffect[];
|
|
522
643
|
}
|
|
523
644
|
type NormalizedForeground = NormalizedBaseForeground & NormalizedFill;
|
|
524
|
-
type ForegroundObject = Partial<NormalizedBaseForeground
|
|
645
|
+
type ForegroundObject = Partial<Omit<NormalizedBaseForeground, 'effects'>> & FillObject & {
|
|
646
|
+
effects?: Effect[];
|
|
647
|
+
};
|
|
525
648
|
type Foreground = string | ForegroundObject;
|
|
526
649
|
declare function normalizeForeground(foreground: Foreground): NormalizedForeground | undefined;
|
|
527
650
|
|
|
@@ -886,6 +1009,8 @@ interface Element<T = Meta> extends Effect, Omit<Node<T>, 'children'> {
|
|
|
886
1009
|
connection?: WithNone<Connection>;
|
|
887
1010
|
table?: WithNone<Table>;
|
|
888
1011
|
chart?: WithNone<Chart>;
|
|
1012
|
+
/** 评论线程。挂在哪个元素即归属哪个元素 / 页;offset 相对该元素原点。 */
|
|
1013
|
+
comments?: CommentThread[];
|
|
889
1014
|
children?: Element[];
|
|
890
1015
|
}
|
|
891
1016
|
interface NormalizedElement<T = Meta> extends NormalizedEffect, Omit<Node<T>, 'children'> {
|
|
@@ -900,6 +1025,7 @@ interface NormalizedElement<T = Meta> extends NormalizedEffect, Omit<Node<T>, 'c
|
|
|
900
1025
|
connection?: NormalizedConnection;
|
|
901
1026
|
table?: NormalizedTable;
|
|
902
1027
|
chart?: NormalizedChart;
|
|
1028
|
+
comments?: NormalizedCommentThread[];
|
|
903
1029
|
children?: NormalizedElement[];
|
|
904
1030
|
}
|
|
905
1031
|
declare function normalizeElement<T = Meta>(element: Element<T>): NormalizedElement<T>;
|
|
@@ -1040,5 +1166,5 @@ declare class Reactivable extends Observable implements PropertyAccessor {
|
|
|
1040
1166
|
destroy(): void;
|
|
1041
1167
|
}
|
|
1042
1168
|
|
|
1043
|
-
export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, colorFillFields, defaultColor, defineProperty, effectFields, flatDocumentToDocument, getDeclarations, getDefaultBackgroundStyle, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOutlineStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, gradientFillFields, hasCRLF, idGenerator, imageFillFiedls, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeChart, normalizeColor, normalizeColorFill, normalizeConnection, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeNumber, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeStyle, normalizeTable, normalizeText, normalizeTextContent, normalizeTextDeformation, normalizeVideo, parseColor, parseGradient, pick, presetFillFiedls, property, property2, propertyOffsetFallback, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
|
|
1044
|
-
export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, Chart, ChartAxis, ChartGrouping, ChartLegend, ChartObject, ChartSeriesObject, ChartType, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, Connection, ConnectionAnchor, ConnectionMode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Effect, Element, EmNode, EventListener, EventListenerOptions, EventListenerValue, ExtentKeywordNode, Fill, FillObject, FillRule, FlatDocument, FlatElement, FlatTextContent, FlexDirection, FlexWrap, FontKerning, FontStyle, FontWeight, Foreground, ForegroundObject, FragmentObject, FullStyle, GradientFill, GradientFillObject, GradientNode, HeadEnd, Hex8Color, HexNode, HighlightColormap, HighlightImage, HighlightLine, HighlightReferImage, HighlightSize, HighlightThickness, HslColor, HslaColor, HsvColor, HsvaColor, HwbColor, HwbaColor, IdGenerator, ImageFill, ImageFillCropRect, ImageFillObject, ImageFillStretchRect, ImageFillTile, Justify, LabColor, LabaColor, LchColor, LchaColor, LineCap, LineEndSize, LineEndType, LineJoin, LinearGradient, LinearGradientNode, LinearGradientWithType, ListStyleColormap, ListStyleImage, ListStylePosition, ListStyleSize, ListStyleType, LiteralNode, Meta, Node, None, NormalizedAudio, NormalizedBackground, NormalizedBackgroundStyle, NormalizedBaseBackground, NormalizedBaseForeground, NormalizedBaseOutline, NormalizedChart, NormalizedChartSeries, NormalizedColor, NormalizedColorFill, NormalizedConnection, NormalizedDocument, NormalizedEffect, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedFlatDocument, NormalizedFlatElement, NormalizedForeground, NormalizedFragment, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOutline, NormalizedOutlineStyle, NormalizedParagraph, NormalizedPresetFill, NormalizedShadow, NormalizedShadowStyle, NormalizedShape, NormalizedStyle, NormalizedTable, NormalizedTableCell, NormalizedTableColumn, NormalizedTableRow, NormalizedText, NormalizedTextContent, NormalizedTextDeformation, NormalizedTextDrawStyle, NormalizedTextInlineStyle, NormalizedTextLineStyle, NormalizedTextStyle, NormalizedTransformStyle, NormalizedVideo, ObjectColor, ObservableEvents, Outline, OutlineObject, OutlineStyle, Overflow, ParagraphObject, PercentNode, PointerEvents, Position, PositionKeywordNode, PositionNode, PresetFill, PresetFillObject, PropertyAccessor, PropertyDeclaration, PxNode, RadialGradient, RadialGradientNode, RadialGradientWithType, ReactivableEvents, RepeatingLinearGradientNode, RepeatingRadialGradientNode, RgbColor, RgbNode, RgbaColor, RgbaNode, SVGPathData, Shadow, ShadowObject, Shape, ShapeConnectionPoint, ShapeNode, ShapePath, ShapePathStyle, StrokeLinecap, StrokeLinejoin, Style, StyleObject, StyleUnit, Table, TableCellObject, TableColumnObject, TableObject, TableRowObject, TailEnd, Text, TextAlign, TextContent, TextDecoration, TextDeformation, TextObject, TextOrientation, TextTransform, TextWrap, Toggleable, Uint32Color, VerticalAlign, Video, Visibility, WithNone, WithStyleNone, WritingMode, XyzColor, XyzaColor, _EffectV0 };
|
|
1169
|
+
export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, colorFillFields, defaultColor, defineProperty, effectFields, flatDocumentToDocument, getDeclarations, getDefaultBackgroundStyle, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOutlineStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, gradientFillFields, hasCRLF, idGenerator, imageFillFiedls, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeChart, normalizeColor, normalizeColorFill, normalizeCommentMessage, normalizeCommentThread, normalizeComments, normalizeConnection, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFilter, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeNumber, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeStyle, normalizeTable, normalizeText, normalizeTextContent, normalizeTextDeformation, normalizeVideo, parseColor, parseGradient, pick, presetFillFiedls, property, property2, propertyOffsetFallback, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyFilter, stringifyGradient, textContentToString };
|
|
1170
|
+
export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, Chart, ChartAxis, ChartGrouping, ChartLegend, ChartObject, ChartSeriesObject, ChartType, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, CommentAuthor, CommentMessage, CommentOffset, CommentThread, Connection, ConnectionAnchor, ConnectionMode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Effect, Element, EmNode, EventListener, EventListenerOptions, EventListenerValue, ExtentKeywordNode, Fill, FillObject, FillRule, Filter, FlatDocument, FlatElement, FlatTextContent, FlexDirection, FlexWrap, FontKerning, FontStyle, FontWeight, Foreground, ForegroundObject, FragmentObject, FullStyle, GradientFill, GradientFillObject, GradientNode, HeadEnd, Hex8Color, HexNode, HighlightColormap, HighlightImage, HighlightLine, HighlightReferImage, HighlightSize, HighlightThickness, HslColor, HslaColor, HsvColor, HsvaColor, HwbColor, HwbaColor, IdGenerator, ImageFill, ImageFillCropRect, ImageFillObject, ImageFillStretchRect, ImageFillTile, Justify, LabColor, LabaColor, LchColor, LchaColor, LineCap, LineEndSize, LineEndType, LineJoin, LinearGradient, LinearGradientNode, LinearGradientWithType, ListStyleColormap, ListStyleImage, ListStylePosition, ListStyleSize, ListStyleType, LiteralNode, Meta, Node, None, NormalizedAudio, NormalizedBackground, NormalizedBackgroundStyle, NormalizedBaseBackground, NormalizedBaseForeground, NormalizedBaseOutline, NormalizedChart, NormalizedChartSeries, NormalizedColor, NormalizedColorFill, NormalizedCommentMessage, NormalizedCommentThread, NormalizedConnection, NormalizedDocument, NormalizedEffect, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedFilter, NormalizedFlatDocument, NormalizedFlatElement, NormalizedForeground, NormalizedFragment, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOutline, NormalizedOutlineStyle, NormalizedParagraph, NormalizedPresetFill, NormalizedShadow, NormalizedShadowStyle, NormalizedShape, NormalizedStyle, NormalizedTable, NormalizedTableCell, NormalizedTableColumn, NormalizedTableRow, NormalizedText, NormalizedTextContent, NormalizedTextDeformation, NormalizedTextDrawStyle, NormalizedTextInlineStyle, NormalizedTextLineStyle, NormalizedTextStyle, NormalizedTransformStyle, NormalizedVideo, ObjectColor, ObservableEvents, Outline, OutlineObject, OutlineStyle, Overflow, ParagraphObject, PercentNode, PointerEvents, Position, PositionKeywordNode, PositionNode, PresetFill, PresetFillObject, PropertyAccessor, PropertyDeclaration, PxNode, RadialGradient, RadialGradientNode, RadialGradientWithType, ReactivableEvents, RepeatingLinearGradientNode, RepeatingRadialGradientNode, RgbColor, RgbNode, RgbaColor, RgbaNode, SVGPathData, Shadow, ShadowObject, Shape, ShapeConnectionPoint, ShapeNode, ShapePath, ShapePathStyle, StrokeLinecap, StrokeLinejoin, Style, StyleObject, StyleUnit, Table, TableCellObject, TableColumnObject, TableObject, TableRowObject, TailEnd, Text, TextAlign, TextContent, TextDecoration, TextDeformation, TextObject, TextOrientation, TextTransform, TextWrap, Toggleable, Uint32Color, VerticalAlign, Video, Visibility, WithNone, WithStyleNone, WritingMode, XyzColor, XyzaColor, _EffectV0 };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.modernIdoc={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return typeof e==`string`?{src:e}:e}var n={grad:.9,turn:360,rad:360/(2*Math.PI)},r=function(e){return typeof e==`string`?e.length>0:typeof e==`number`},i=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=10**t),Math.round(n*e)/n+0},a=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},o=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},s=function(e){return{r:a(e.r,0,255),g:a(e.g,0,255),b:a(e.b,0,255),a:a(e.a)}},c=function(e){return{r:i(e.r),g:i(e.g),b:i(e.b),a:i(e.a,3)}},l=/^#([0-9a-f]{3,8})$/i,u=function(e){var t=e.toString(16);return t.length<2?`0`+t:t},d=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=Math.max(t,n,r),o=a-Math.min(t,n,r),s=o?a===t?(n-r)/o:a===n?2+(r-t)/o:4+(t-n)/o:0;return{h:60*(s<0?s+6:s),s:a?o/a*100:0,v:a/255*100,a:i}},f=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var a=Math.floor(t),o=r*(1-n),s=r*(1-(t-a)*n),c=r*(1-(1-t+a)*n),l=a%6;return{r:255*[r,s,o,o,c,r][l],g:255*[c,r,r,s,o,o][l],b:255*[o,o,c,r,r,s][l],a:i}},p=function(e){return{h:o(e.h),s:a(e.s,0,100),l:a(e.l,0,100),a:a(e.a)}},ee=function(e){return{h:i(e.h),s:i(e.s),l:i(e.l),a:i(e.a,3)}},m=function(e){return f((n=(t=e).s,{h:t.h,s:(n*=((r=t.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:t.a}));var t,n,r},h=function(e){return{h:(t=d(e)).h,s:(i=(200-(n=t.s))*(r=t.v)/100)>0&&i<200?n*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,n,r,i},g=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,te=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ne=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v={string:[[function(e){var t=l.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?i(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?i(parseInt(e.substr(6,2),16)/255,2):1}:null:null},`hex`],[function(e){var t=_.exec(e)||ne.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:s({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},`rgb`],[function(e){var t=g.exec(e)||te.exec(e);if(!t)return null;var r,i;return m(p({h:(r=t[1],i=t[2],i===void 0&&(i=`deg`),Number(r)*(n[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)}))},`hsl`]],object:[[function(e){var t=e.r,n=e.g,i=e.b,a=e.a,o=a===void 0?1:a;return r(t)&&r(n)&&r(i)?s({r:Number(t),g:Number(n),b:Number(i),a:Number(o)}):null},`rgb`],[function(e){var t=e.h,n=e.s,i=e.l,a=e.a,o=a===void 0?1:a;return!r(t)||!r(n)||!r(i)?null:m(p({h:Number(t),s:Number(n),l:Number(i),a:Number(o)}))},`hsl`],[function(e){var t=e.h,n=e.s,i=e.v,s=e.a,c=s===void 0?1:s;return!r(t)||!r(n)||!r(i)?null:f(function(e){return{h:o(e.h),s:a(e.s,0,100),v:a(e.v,0,100),a:a(e.a)}}({h:Number(t),s:Number(n),v:Number(i),a:Number(c)}))},`hsv`]]},y=function(e,t){for(var n=0;n<t.length;n++){var r=t[n][0](e);if(r)return[r,t[n][1]]}return[null,void 0]},re=function(e){return typeof e==`string`?y(e.trim(),v.string):typeof e==`object`&&e?y(e,v.object):[null,void 0]},b=function(e,t){var n=h(e);return{h:n.h,s:a(n.s+100*t,0,100),l:n.l,a:n.a}},x=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},ie=function(e,t){var n=h(e);return{h:n.h,s:n.s,l:a(n.l+100*t,0,100),a:n.a}},S=function(){function e(e){this.parsed=re(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return i(x(this.rgba),2)},e.prototype.isDark=function(){return x(this.rgba)<.5},e.prototype.isLight=function(){return x(this.rgba)>=.5},e.prototype.toHex=function(){return e=c(this.rgba),t=e.r,n=e.g,r=e.b,o=(a=e.a)<1?u(i(255*a)):``,`#`+u(t)+u(n)+u(r)+o;var e,t,n,r,a,o},e.prototype.toRgb=function(){return c(this.rgba)},e.prototype.toRgbString=function(){return e=c(this.rgba),t=e.r,n=e.g,r=e.b,(i=e.a)<1?`rgba(`+t+`, `+n+`, `+r+`, `+i+`)`:`rgb(`+t+`, `+n+`, `+r+`)`;var e,t,n,r,i},e.prototype.toHsl=function(){return ee(h(this.rgba))},e.prototype.toHslString=function(){return e=ee(h(this.rgba)),t=e.h,n=e.s,r=e.l,(i=e.a)<1?`hsla(`+t+`, `+n+`%, `+r+`%, `+i+`)`:`hsl(`+t+`, `+n+`%, `+r+`%)`;var e,t,n,r,i},e.prototype.toHsv=function(){return e=d(this.rgba),{h:i(e.h),s:i(e.s),v:i(e.v),a:i(e.a,3)};var e},e.prototype.invert=function(){return C({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return e===void 0&&(e=.1),C(b(this.rgba,e))},e.prototype.desaturate=function(e){return e===void 0&&(e=.1),C(b(this.rgba,-e))},e.prototype.grayscale=function(){return C(b(this.rgba,-1))},e.prototype.lighten=function(e){return e===void 0&&(e=.1),C(ie(this.rgba,e))},e.prototype.darken=function(e){return e===void 0&&(e=.1),C(ie(this.rgba,-e))},e.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return typeof e==`number`?C({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):i(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=h(this.rgba);return typeof e==`number`?C({h:e,s:t.s,l:t.l,a:t.a}):i(t.h)},e.prototype.isEqual=function(e){return this.toHex()===C(e).toHex()},e}(),C=function(e){return e instanceof S?e:new S(e)},ae=class{eventListeners=new Map;addEventListener(e,t,n){let r={value:t,options:n},i=this.eventListeners.get(e);return i?Array.isArray(i)?i.push(r):this.eventListeners.set(e,[i,r]):this.eventListeners.set(e,r),this}removeEventListener(e,t,n){if(!t)return this.eventListeners.delete(e),this;let r=this.eventListeners.get(e);if(!r)return this;if(Array.isArray(r)){let i=[];for(let e=0,a=r.length;e<a;e++){let a=r[e];(a.value!==t||typeof n==`object`&&n?.once&&(typeof a.options==`boolean`||!a.options?.once))&&i.push(a)}i.length?this.eventListeners.set(e,i.length===1?i[0]:i):this.eventListeners.delete(e)}else r.value===t&&(typeof n==`boolean`||!n?.once||typeof r.options==`boolean`||r.options?.once)&&this.eventListeners.delete(e);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(e){return this.eventListeners.has(e)}dispatchEvent(e,...t){let n=this.eventListeners.get(e);if(n){if(Array.isArray(n))for(let r=n.length,i=0;i<r;i++){let r=n[i];typeof r.options==`object`&&r.options?.once&&this.off(e,r.value,r.options),r.value.apply(this,t)}else typeof n.options==`object`&&n.options?.once&&this.off(e,n.value,n.options),n.value.apply(this,t);return!0}else return!1}on(e,t,n){return this.addEventListener(e,t,n)}once(e,t){return this.addEventListener(e,t,{once:!0})}off(e,t,n){return this.removeEventListener(e,t,n)}emit(e,...t){this.dispatchEvent(e,...t)}};function w(e){return e==null||e===``||e===`none`}function T(e,t=0,n=10**t){return Math.round(n*e)/n+0}function E(e,t){if(typeof e==`number`)return Number.isFinite(e)?e:t;if(typeof e==`string`){let n=Number.parseFloat(e);return Number.isFinite(n)?n:t}return t}function D(e,t=!1){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return t?e.map(e=>D(e,t)):e;let n={};for(let r in e){let i=e[r];i!=null&&(t?n[r]=D(i,t):n[r]=i)}return n}function O(e,t){let n={};return t.forEach(t=>{t in e&&(n[t]=e[t])}),n}function k(e,t){if(e===t)return!0;if(e&&t&&typeof e==`object`&&typeof t==`object`){let n=Array.from(new Set([...Object.keys(e),...Object.keys(t)]));return!n.length||n.every(n=>e[n]===t[n])}return!1}function A(e,t,n){let r=t.length-1;if(r<0)return e===void 0?n:e;for(let i=0;i<r;i++){if(e==null)return n;e=e[t[i]]}return e==null||e[t[r]]===void 0?n:e[t[r]]}function j(e,t,n){let r=t.length-1;for(let n=0;n<r;n++)typeof e[t[n]]!=`object`&&(e[t[n]]={}),e=e[t[n]];e[t[r]]=n}function oe(e,t,n){return e==null||!t||typeof t!=`string`?n:e[t]===void 0?(t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``),A(e,t.split(`.`),n)):e[t]}function se(e,t,n){if(!(typeof e!=`object`||!t))return t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``),j(e,t.split(`.`),n)}var ce=class{_eventListeners={};on(e,t){let n=this._eventListeners[e];n===void 0&&(n=[],this._eventListeners[e]=n);let r=n.indexOf(t);return r>-1&&n.splice(r,1),n.push(t),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n),this}off(e,t){let n=this._eventListeners[e];if(n!==void 0){let e=n.indexOf(t);e>-1&&n.splice(e,1)}return this}emit(e,...t){let n=this._eventListeners[e];if(n!==void 0){let e=n.length;if(e>0)for(let r=0;r<e;r++)n[r].apply(this,t)}return this}removeAllListeners(){return this._eventListeners={},this}hasEventListener(e){return!!this._eventListeners[e]}destroy(){this.removeAllListeners()}},le=class{_map=new WeakMap;_toRaw(e){if(e&&typeof e==`object`){let t=e.__v_raw;t&&(e=this._toRaw(t))}return e}delete(e){return this._map.delete(this._toRaw(e))}get(e){return this._map.get(this._toRaw(e))}has(e){return this._map.has(this._toRaw(e))}set(e,t){return this._map.set(this._toRaw(e),this._toRaw(t)),this}},ue=Symbol.for(`declarations`),M=Symbol.for(`inited`);function N(e){let t;if(Object.hasOwn(e,ue))t=e[ue];else{let n=Object.getPrototypeOf(e);t={...n?N(n):{}},e[ue]=t}return t}function P(e,t,n,r){let{alias:i,internalKey:a}=r,o=e[t];i?se(e,i,n):e[a]=n,e.onUpdateProperty?.(t,n??I(e,t,r),o)}function F(e,t,n){let{alias:r,internalKey:i}=n,a;return a=r?oe(e,r):e[i],a??=I(e,t,n),a}function I(e,t,n){let{default:r,fallback:i}=n,a;if(r!==void 0&&!e[M]?.[t]){e[M]||(e[M]={}),e[M][t]=!0;let n=typeof r==`function`?r():r;n!==void 0&&(e[t]=n,a=n)}return a===void 0&&i!==void 0&&(a=typeof i==`function`?i():i),a}function de(e,t){function n(){return this.getProperty?this.getProperty(e):F(this,e,t)}function r(n){this.setProperty?this.setProperty(e,n):P(this,e,n,t)}return{get:n,set:r}}function fe(e,t,n={}){let r={...n,internalKey:Symbol.for(t)},i=N(e);i[t]=r;let{get:a,set:o}=de(t,r);Object.defineProperty(e.prototype,t,{get(){return a.call(this)},set(e){o.call(this,e)},configurable:!0,enumerable:!0})}function pe(e){return function(t,n){if(typeof n!=`string`)throw TypeError(`Failed to @property decorator, prop name cannot be a symbol`);fe(t.constructor,n,e)}}function me(e={}){return function(t,n){let r=n.name;if(typeof r!=`string`)throw TypeError(`Failed to @property decorator, prop name cannot be a symbol`);let i={...e,internalKey:Symbol.for(r)},a=de(r,i);return{init(e){let t=N(this.constructor);return t[r]=i,a.set.call(this,e),e},get(){return a.get.call(this)},set(e){a.set.call(this,e)}}}}var he=class extends ce{_propertyAccessor;_properties={};_updatedProperties={};_changedProperties=new Set;_updatingPromise=Promise.resolve();_updating=!1;constructor(e){super(),this.setProperties(e)}isDirty(e){return e?!!this._updatedProperties[e]:Object.keys(this._updatedProperties).length>0}offsetGetProperty(e){return this._properties[e]}offsetSetProperty(e,t){this._properties[e]=t}offsetGetProperties(e){let t=this._properties,n=Object.keys(t),r={};for(let i,a,o=0;o<n.length;o++)i=n[o],a=t[i],a!==void 0&&(!e||e.includes(i))&&(a&&typeof a==`object`?`toJSON`in a?r[i]=a.toJSON():Array.isArray(a)?r[i]=[...a]:r[i]={...a}:r[i]=a);return r}offsetSetProperties(e){if(e&&typeof e==`object`){let t=Object.keys(e);for(let n,r=0;r<t.length;r++)n=t[r],this.offsetSetProperty(n,e[n])}return this}getProperty(e){let t=this.getPropertyDeclaration(e);if(t){if(t.internal||t.alias)return F(this,e,t);{let n=this._propertyAccessor,r;return r=n&&n.getProperty?n.getProperty(e):this.offsetGetProperty(e),r??I(this,e,t)}}}setProperty(e,t){let n=this.getPropertyDeclaration(e);if(n)if(n.internal||n.alias)P(this,e,t,n);else{let r=this.getProperty(e);this._propertyAccessor?.setProperty?.(e,t),this.offsetSetProperty(e,t),this.onUpdateProperty?.(e,t??I(this,e,n),r)}}getProperties(e){let t={},n=this.getPropertyDeclarations(),r=Object.keys(n);for(let i=0,a=r.length;i<a;i++){let a=r[i],o=n[a];o.internal||o.alias||(!e||e.includes(a))&&(t[a]=this.getProperty(a))}return t}setProperties(e){if(e&&typeof e==`object`)for(let t in e)this.setProperty(t,e[t]);return this}resetProperties(){let e=this.getPropertyDeclarations(),t=Object.keys(e);for(let n=0,r=t.length;n<r;n++){let r=t[n],i=e[r];this.setProperty(r,typeof i.default==`function`?i.default():i.default)}return this}getPropertyDeclarations(){return N(this.constructor)}getPropertyDeclaration(e){return this.getPropertyDeclarations()[e]}setPropertyAccessor(e){let t=this.getPropertyDeclarations(),n=[];if(e&&e.getProperty&&e.setProperty){let r=Object.keys(t);for(let i=0,a=r.length;i<a;i++){let a=r[i],o=t[a];if(o.internal||o.alias)continue;let s=this.offsetGetProperty(a),c=e.getProperty(a);c!==void 0&&!Object.is(s,c)&&(this.offsetSetProperty(a,c),n.push({key:a,newValue:c,oldValue:s}))}}this._propertyAccessor=e;for(let e=0,t=n.length;e<t;e++){let{key:t,newValue:r,oldValue:i}=n[e];this.requestUpdate(t,r,i)}return this}async _nextTick(){return`requestAnimationFrame`in globalThis?new Promise(e=>globalThis.requestAnimationFrame(e)):Promise.resolve()}async _enqueueUpdate(){this._updating=!0;try{await this._updatingPromise}catch(e){Promise.reject(e)}await this._nextTick(),this._updating&&=(this.onUpdate(),!1)}onUpdate(){this._update(this._updatedProperties),this._updatedProperties={}}onUpdateProperty(e,t,n){Object.is(t,n)||this.requestUpdate(e,t,n)}requestUpdate(e,t,n){e!==void 0&&(this._updatedProperties[e]=n,this._changedProperties.add(e),this._updateProperty(e,t,n),this.emit(`updateProperty`,e,t,n)),this._updating||(this._updatingPromise=this._enqueueUpdate())}_update(e){}_updateProperty(e,t,n){}toJSON(){return this.offsetGetProperties()}clone(){return new this.constructor(this.toJSON())}destroy(){this.emit(`destroy`),super.destroy()}};function ge(e){let t;return t=typeof e==`number`?{r:e>>24&255,g:e>>16&255,b:e>>8&255,a:(e&255)/255}:e,C(t)}function _e(e){return{r:T(e.r),g:T(e.g),b:T(e.b),a:T(e.a,3)}}function L(e){let t=e.toString(16);return t.length<2?`0${t}`:t}var ve=`#000000FF`;function R(e){return ge(e).isValid()}function z(e,t=!1){let n=ge(e);if(!n.isValid()){if(typeof e==`string`)return e;let n=`Failed to normalizeColor ${e}`;if(t)throw Error(n);return console.warn(n),ve}let{r,g:i,b:a,a:o}=_e(n.rgba);return`#${L(r)}${L(i)}${L(a)}${L(T(o*255))}`}var B=B||{};B.parse=(function(){let e={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i},t=``;function n(e){let n=Error(`${t}: ${e}`);throw n.source=t,n}function r(){let e=i();return t.length>0&&n(`Invalid input not EOF`),e}function i(){return _(a)}function a(){return o(`linear-gradient`,e.linearGradient,c)||o(`repeating-linear-gradient`,e.repeatingLinearGradient,c)||o(`radial-gradient`,e.radialGradient,d)||o(`repeating-radial-gradient`,e.repeatingRadialGradient,d)}function o(t,r,i){return s(r,r=>{let a=i();return a&&(A(e.comma)||n(`Missing comma before color stops`)),{type:t,orientation:a,colorStops:_(ne)}})}function s(t,r){let i=A(t);if(i){A(e.startCall)||n(`Missing (`);let t=r(i);return A(e.endCall)||n(`Missing )`),t}}function c(){let t=l();if(t)return t;let n=k(`position-keyword`,e.positionKeywords,1);return n?{type:`directional`,value:n.value}:u()}function l(){return k(`directional`,e.sideOrCorner,1)}function u(){return k(`angular`,e.angleValue,1)||k(`angular`,e.radianValue,1)}function d(){let n,r=f(),i;return r&&(n=[],n.push(r),i=t,A(e.comma)&&(r=f(),r?n.push(r):t=i)),n}function f(){let e=p()||ee();if(e)e.at=h();else{let t=m();if(t){e=t;let n=h();n&&(e.at=n)}else{let t=h();if(t)e={type:`default-radial`,at:t};else{let t=g();t&&(e={type:`default-radial`,at:t})}}}return e}function p(){let e=k(`shape`,/^(circle)/i,0);return e&&(e.style=O()||m()),e}function ee(){let e=k(`shape`,/^(ellipse)/i,0);return e&&(e.style=g()||T()||m()),e}function m(){return k(`extent-keyword`,e.extentKeywords,1)}function h(){if(k(`position`,/^at/,0)){let e=g();return e||n(`Missing positioning value`),e}}function g(){let e=te();if(e.x||e.y)return{type:`position`,value:e}}function te(){return{x:T(),y:T()}}function _(t){let r=t(),i=[];if(r)for(i.push(r);A(e.comma);)r=t(),r?i.push(r):n(`One extra comma`);return i}function ne(){let e=v();return e||n(`Expected color definition`),e.length=T(),e}function v(){return re()||C()||S()||x()||b()||ie()||y()}function y(){return k(`literal`,e.literalColor,0)}function re(){return k(`hex`,e.hexColor,1)}function b(){return s(e.rgbColor,()=>({type:`rgb`,value:_(w)}))}function x(){return s(e.rgbaColor,()=>({type:`rgba`,value:_(w)}))}function ie(){return s(e.varColor,()=>({type:`var`,value:ae()}))}function S(){return s(e.hslColor,()=>{A(e.percentageValue)&&n(`HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage`);let t=w();A(e.comma);let r=A(e.percentageValue),i=r?r[1]:null;A(e.comma),r=A(e.percentageValue);let a=r?r[1]:null;return(!i||!a)&&n(`Expected percentage value for saturation and lightness in HSL`),{type:`hsl`,value:[t,i,a]}})}function C(){return s(e.hslaColor,()=>{let t=w();A(e.comma);let r=A(e.percentageValue),i=r?r[1]:null;A(e.comma),r=A(e.percentageValue);let a=r?r[1]:null;A(e.comma);let o=w();return(!i||!a)&&n(`Expected percentage value for saturation and lightness in HSLA`),{type:`hsla`,value:[t,i,a,o]}})}function ae(){return A(e.variableName)[1]}function w(){return A(e.number)[1]}function T(){return k(`%`,e.percentageValue,1)||E()||D()||O()}function E(){return k(`position-keyword`,e.positionKeywords,1)}function D(){return s(e.calcValue,()=>{let e=1,r=0;for(;e>0&&r<t.length;){let n=t.charAt(r);n===`(`?e++:n===`)`&&e--,r++}e>0&&n(`Missing closing parenthesis in calc() expression`);let i=t.substring(0,r-1);return j(r-1),{type:`calc`,value:i}})}function O(){return k(`px`,e.pixelValue,1)||k(`em`,e.emValue,1)}function k(e,t,n){let r=A(t);if(r)return{type:e,value:r[n]}}function A(e){let n,r;return r=/^\s+/.exec(t),r&&j(r[0].length),n=e.exec(t),n&&j(n[0].length),n}function j(e){t=t.substr(e)}return function(e){return t=e.toString().trim(),t.endsWith(`;`)&&(t=t.slice(0,-1)),r()}})();var ye=B.parse.bind(B),V=V||{};V.stringify=(function(){var e={"visit_linear-gradient":function(t){return e.visit_gradient(t)},"visit_repeating-linear-gradient":function(t){return e.visit_gradient(t)},"visit_radial-gradient":function(t){return e.visit_gradient(t)},"visit_repeating-radial-gradient":function(t){return e.visit_gradient(t)},visit_gradient:function(t){var n=e.visit(t.orientation);return n&&(n+=`, `),t.type+`(`+n+e.visit(t.colorStops)+`)`},visit_shape:function(t){var n=t.value,r=e.visit(t.at),i=e.visit(t.style);return i&&(n+=` `+i),r&&(n+=` at `+r),n},"visit_default-radial":function(t){var n=``,r=e.visit(t.at);return r&&(n+=r),n},"visit_extent-keyword":function(t){var n=t.value,r=e.visit(t.at);return r&&(n+=` at `+r),n},"visit_position-keyword":function(e){return e.value},visit_position:function(t){return e.visit(t.value.x)+` `+e.visit(t.value.y)},"visit_%":function(e){return e.value+`%`},visit_em:function(e){return e.value+`em`},visit_px:function(e){return e.value+`px`},visit_calc:function(e){return`calc(`+e.value+`)`},visit_literal:function(t){return e.visit_color(t.value,t)},visit_hex:function(t){return e.visit_color(`#`+t.value,t)},visit_rgb:function(t){return e.visit_color(`rgb(`+t.value.join(`, `)+`)`,t)},visit_rgba:function(t){return e.visit_color(`rgba(`+t.value.join(`, `)+`)`,t)},visit_hsl:function(t){return e.visit_color(`hsl(`+t.value[0]+`, `+t.value[1]+`%, `+t.value[2]+`%)`,t)},visit_hsla:function(t){return e.visit_color(`hsla(`+t.value[0]+`, `+t.value[1]+`%, `+t.value[2]+`%, `+t.value[3]+`)`,t)},visit_var:function(t){return e.visit_color(`var(`+t.value+`)`,t)},visit_color:function(t,n){var r=t,i=e.visit(n.length);return i&&(r+=` `+i),r},visit_angular:function(e){return e.value+`deg`},visit_directional:function(e){return`to `+e.value},visit_array:function(t){var n=``,r=t.length;return t.forEach(function(t,i){n+=e.visit(t),i<r-1&&(n+=`, `)}),n},visit_object:function(t){return t.width&&t.height?e.visit(t.width)+` `+e.visit(t.height):``},visit:function(t){if(!t)return``;if(t instanceof Array)return e.visit_array(t);if(typeof t==`object`&&!t.type)return e.visit_object(t);if(t.type){var n=e[`visit_`+t.type];if(n)return n(t);throw Error(`Missing visitor visit_`+t.type)}else throw Error(`Invalid node.`)}};return function(t){return e.visit(t)}})();var be=V.stringify.bind(V);function xe(e){let t=e.length-1;return e.map((e,n)=>{let r=e.value,i=T(n/t,3),a=`#00000000`;switch(e.type){case`rgb`:a=z({r:Number(r[0]??0),g:Number(r[1]??0),b:Number(r[2]??0)});break;case`rgba`:a=z({r:Number(r[0]??0),g:Number(r[1]??0),b:Number(r[2]??0),a:Number(r[3]??0)});break;case`literal`:a=z(e.value);break;case`hex`:a=z(`#${e.value}`);break}switch(e.length?.type){case`%`:i=Number(e.length.value)/100;break;case`px`:break;case`em`:break}return{offset:i,color:a}})}function Se(e){let t=0;switch(e.orientation?.type){case`angular`:t=Number(e.orientation.value);break;case`directional`:break}return{type:`linear-gradient`,angle:t,stops:xe(e.colorStops)}}function Ce(e){return e.orientation?.map(e=>{switch(e?.type){default:return null}}),{type:`radial-gradient`,stops:xe(e.colorStops)}}function H(e){return e.startsWith(`linear-gradient(`)||e.startsWith(`radial-gradient(`)}function we(e){return ye(e).map(e=>{switch(e?.type){case`linear-gradient`:return Se(e);case`repeating-linear-gradient`:return{...Se(e),repeat:!0};case`radial-gradient`:return Ce(e);case`repeating-radial-gradient`:return{...Ce(e),repeat:!0};default:return}}).filter(Boolean)}var U=[`color`];function Te(e){let t;return t=typeof e==`string`?{color:e}:{...e},t.color&&=z(t.color),O(t,U)}var W=[`linearGradient`,`radialGradient`,`rotateWithShape`];function Ee(e){let t;if(t=typeof e==`string`?{image:e}:{...e},t.image){let{type:e,...n}=we(t.image)[0]??{};switch(e){case`radial-gradient`:return{radialGradient:n};case`linear-gradient`:return{linearGradient:n}}}return O(t,W)}var G=[`image`,`cropRect`,`stretchRect`,`tile`,`dpi`,`opacity`,`rotateWithShape`];function De(e){let t;return t=typeof e==`string`?{image:e}:{...e},O(t,G)}var K=[`preset`,`foregroundColor`,`backgroundColor`];function Oe(e){let t;return t=typeof e==`string`?{preset:e}:{...e},w(t.foregroundColor)?delete t.foregroundColor:t.foregroundColor=z(t.foregroundColor),w(t.backgroundColor)?delete t.backgroundColor:t.backgroundColor=z(t.backgroundColor),O(t,K)}function ke(e){return!w(e.color)}function Ae(e){return typeof e==`string`?R(e):ke(e)}function je(e){return!w(e.image)&&H(e.image)||!!e.linearGradient||!!e.radialGradient}function Me(e){return typeof e==`string`?H(e):je(e)}function Ne(e){return!w(e.image)&&!H(e.image)}function Pe(e){return typeof e==`string`?!R(e)&&!H(e):Ne(e)}function Fe(e){return!w(e.preset)}function Ie(e){return typeof e==`string`?!1:Fe(e)}function q(e){let t={enabled:e&&typeof e==`object`?e.enabled??!0:!0};return Ae(e)&&Object.assign(t,Te(e)),Me(e)&&Object.assign(t,Ee(e)),Pe(e)&&Object.assign(t,De(e)),Ie(e)&&Object.assign(t,Oe(e)),O(D(t),Array.from(new Set([`enabled`,...U,...G,...W,...K])))}function J(e){return typeof e==`string`?{...q(e)}:{...q(e),...O(e,[`fillWithShape`])}}function Le(){return{backgroundImage:`none`,backgroundSize:`auto, auto`,backgroundColor:`none`,backgroundColormap:`none`}}function Re(e){return(e??[]).map(e=>E(e)??0)}function ze(e){return D({name:e.name,values:Re(e.values),xValues:e.xValues?Re(e.xValues):void 0,color:e.color})}function Be(e){return D({title:e.title,min:E(e.min),max:E(e.max),visible:e.visible})}function Ve(e){return D({enabled:e.enabled??!0,type:e.type??`column`,grouping:e.grouping,categories:e.categories??[],series:(e.series??[]).map(ze),title:e.title,legend:e.legend,categoryAxis:e.categoryAxis?Be(e.categoryAxis):void 0,valueAxis:e.valueAxis?Be(e.valueAxis):void 0})}function He(e){return D({start:e.start,end:e.end,mode:e.mode??`straight`})}function Y(e){return typeof e==`string`?{...q(e)}:{...q(e),...O(e,[`width`,`style`,`lineCap`,`lineJoin`,`headEnd`,`tailEnd`])}}function Ue(){return{outlineWidth:0,outlineOffset:0,outlineColor:`none`,outlineStyle:`none`}}function We(e){return typeof e==`string`?{enabled:!0,color:z(e)}:{...e,enabled:e.enabled??!0,color:w(e.color)?ve:z(e.color)}}function Ge(){return{boxShadow:`none`}}var Ke=[`fill`,`outline`,`shadow`,`transform`,`transformOrigin`];function qe(e){let t=O(e,Ke),{rotate:n,scaleX:r,scaleY:i,skewX:a,skewY:o,translateX:s,translateY:c}=e,l=[];return(s||c)&&l.push(`translate(${s||0}, ${c||0})`),n&&l.push(`rotate(${n}deg)`),(r||i)&&l.push(`scale(${r??1}, ${i??1})`),a&&l.push(`skewX(${a}deg)`),o&&l.push(`skewY(${o}deg)`),l.length>0&&(t.transform=l.join(` `)),(e.textStrokeWidth||e.textStrokeColor)&&(t.outline={color:e.textStrokeColor,width:e.textStrokeWidth}),e.color&&(t.fill={color:e.color}),(e.shadowOffsetX||e.shadowOffsetY||e.shadowBlur||e.shadowColor)&&(t.shadow={offsetX:e.shadowOffsetX,offsetY:e.shadowOffsetY,blur:e.shadowBlur,color:e.shadowColor}),t}function X(e){let t=qe(e);return D({fill:w(t.fill)?void 0:q(t.fill),outline:w(t.outline)?void 0:Y(t.outline),shadow:w(t.shadow)?void 0:We(t.shadow),transform:w(t.transform)?void 0:t.transform,transformOrigin:t.transformOrigin})}function Je(e){return typeof e==`string`?{...q(e)}:{...q(e),...O(e,[`fillWithShape`])}}var Ye=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,Xe=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Ye[n[e]&63];return t},Ze=()=>Xe(10),Qe=Ze;function $e(e){return typeof e==`string`?e.startsWith(`<svg`)?{enabled:!0,svg:e}:{enabled:!0,paths:[{data:e}]}:Array.isArray(e)?{enabled:!0,paths:e.map(e=>typeof e==`string`?{data:e}:e)}:e}function et(){return{overflow:`visible`,direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function tt(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:`none`,transformOrigin:`center`}}function nt(){return{...et(),...tt(),...Ge(),...Le(),...Ue(),borderRadius:0,borderColor:`none`,borderStyle:`solid`,visibility:`visible`,filter:`none`,opacity:1,pointerEvents:`auto`,maskImage:`none`}}function rt(){return{highlight:{},highlightImage:`none`,highlightReferImage:`none`,highlightColormap:`none`,highlightLine:`none`,highlightSize:`cover`,highlightThickness:`100%`}}function it(){return{listStyle:{},listStyleType:`none`,listStyleImage:`none`,listStyleColormap:`none`,listStyleSize:`cover`,listStylePosition:`outside`}}function at(){return{...rt(),color:`#000000`,verticalAlign:`baseline`,letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:`normal`,fontFamily:``,fontStyle:`normal`,fontKerning:`normal`,textTransform:`none`,textOrientation:`mixed`,textDecoration:`none`}}function ot(){return{...it(),writingMode:`horizontal-tb`,textWrap:`wrap`,textAlign:`start`,textIndent:0,lineHeight:1.2}}function st(){return{...ot(),...at(),textStrokeWidth:0,textStrokeColor:`none`}}var ct=[`textIndent`,`lineHeight`,`letterSpacing`,`wordSpacing`,`fontSize`,`textStrokeWidth`,`borderRadius`,`opacity`,`rotate`,`scaleX`,`scaleY`,`skewX`,`skewY`,`translateX`,`translateY`,`borderWidth`,`flex`,`flexGrow`,`flexShrink`];function Z(e){let t=D({...e,color:w(e.color)?void 0:z(e.color),backgroundColor:w(e.backgroundColor)?void 0:z(e.backgroundColor),borderColor:w(e.borderColor)?void 0:z(e.borderColor),outlineColor:w(e.outlineColor)?void 0:z(e.outlineColor),shadowColor:w(e.shadowColor)?void 0:z(e.shadowColor),textStrokeColor:w(e.textStrokeColor)?void 0:z(e.textStrokeColor)});for(let e of ct)if(e in t){let n=E(t[e]);n===void 0?delete t[e]:t[e]=n}return t}function lt(){return{...nt(),...st()}}function ut(e){return D({width:E(e.width)})}function dt(e){return D({height:E(e.height)})}function ft(e){return D({row:E(e.row)??0,col:E(e.col)??0,rowSpan:E(e.rowSpan),colSpan:E(e.colSpan),children:(e.children??[]).map(e=>$(e)),background:w(e.background)?void 0:J(e.background),style:w(e.style)?void 0:Z(e.style)})}function pt(e){return D({enabled:e.enabled??!0,columns:(e.columns??[]).map(ut),rows:(e.rows??[]).map(dt),cells:(e.cells??[]).map(ft)})}var mt=/\r\n|\n\r|\n|\r/,ht=RegExp(`${mt.source}|<br\\/>`,`g`),gt=RegExp(`^(${mt.source})$`),_t=`
|
|
2
|
-
`;function
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.modernIdoc={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return typeof e==`string`?{src:e}:e}var n={grad:.9,turn:360,rad:360/(2*Math.PI)},r=function(e){return typeof e==`string`?e.length>0:typeof e==`number`},i=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=10**t),Math.round(n*e)/n+0},a=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},o=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},s=function(e){return{r:a(e.r,0,255),g:a(e.g,0,255),b:a(e.b,0,255),a:a(e.a)}},c=function(e){return{r:i(e.r),g:i(e.g),b:i(e.b),a:i(e.a,3)}},l=/^#([0-9a-f]{3,8})$/i,u=function(e){var t=e.toString(16);return t.length<2?`0`+t:t},d=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=Math.max(t,n,r),o=a-Math.min(t,n,r),s=o?a===t?(n-r)/o:a===n?2+(r-t)/o:4+(t-n)/o:0;return{h:60*(s<0?s+6:s),s:a?o/a*100:0,v:a/255*100,a:i}},f=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var a=Math.floor(t),o=r*(1-n),s=r*(1-(t-a)*n),c=r*(1-(1-t+a)*n),l=a%6;return{r:255*[r,s,o,o,c,r][l],g:255*[c,r,r,s,o,o][l],b:255*[o,o,c,r,r,s][l],a:i}},p=function(e){return{h:o(e.h),s:a(e.s,0,100),l:a(e.l,0,100),a:a(e.a)}},ee=function(e){return{h:i(e.h),s:i(e.s),l:i(e.l),a:i(e.a,3)}},m=function(e){return f((n=(t=e).s,{h:t.h,s:(n*=((r=t.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:t.a}));var t,n,r},h=function(e){return{h:(t=d(e)).h,s:(i=(200-(n=t.s))*(r=t.v)/100)>0&&i<200?n*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,n,r,i},g=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,te=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ne=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v={string:[[function(e){var t=l.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?i(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?i(parseInt(e.substr(6,2),16)/255,2):1}:null:null},`hex`],[function(e){var t=_.exec(e)||ne.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:s({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},`rgb`],[function(e){var t=g.exec(e)||te.exec(e);if(!t)return null;var r,i;return m(p({h:(r=t[1],i=t[2],i===void 0&&(i=`deg`),Number(r)*(n[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)}))},`hsl`]],object:[[function(e){var t=e.r,n=e.g,i=e.b,a=e.a,o=a===void 0?1:a;return r(t)&&r(n)&&r(i)?s({r:Number(t),g:Number(n),b:Number(i),a:Number(o)}):null},`rgb`],[function(e){var t=e.h,n=e.s,i=e.l,a=e.a,o=a===void 0?1:a;return!r(t)||!r(n)||!r(i)?null:m(p({h:Number(t),s:Number(n),l:Number(i),a:Number(o)}))},`hsl`],[function(e){var t=e.h,n=e.s,i=e.v,s=e.a,c=s===void 0?1:s;return!r(t)||!r(n)||!r(i)?null:f(function(e){return{h:o(e.h),s:a(e.s,0,100),v:a(e.v,0,100),a:a(e.a)}}({h:Number(t),s:Number(n),v:Number(i),a:Number(c)}))},`hsv`]]},y=function(e,t){for(var n=0;n<t.length;n++){var r=t[n][0](e);if(r)return[r,t[n][1]]}return[null,void 0]},re=function(e){return typeof e==`string`?y(e.trim(),v.string):typeof e==`object`&&e?y(e,v.object):[null,void 0]},b=function(e,t){var n=h(e);return{h:n.h,s:a(n.s+100*t,0,100),l:n.l,a:n.a}},x=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},ie=function(e,t){var n=h(e);return{h:n.h,s:n.s,l:a(n.l+100*t,0,100),a:n.a}},ae=function(){function e(e){this.parsed=re(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return i(x(this.rgba),2)},e.prototype.isDark=function(){return x(this.rgba)<.5},e.prototype.isLight=function(){return x(this.rgba)>=.5},e.prototype.toHex=function(){return e=c(this.rgba),t=e.r,n=e.g,r=e.b,o=(a=e.a)<1?u(i(255*a)):``,`#`+u(t)+u(n)+u(r)+o;var e,t,n,r,a,o},e.prototype.toRgb=function(){return c(this.rgba)},e.prototype.toRgbString=function(){return e=c(this.rgba),t=e.r,n=e.g,r=e.b,(i=e.a)<1?`rgba(`+t+`, `+n+`, `+r+`, `+i+`)`:`rgb(`+t+`, `+n+`, `+r+`)`;var e,t,n,r,i},e.prototype.toHsl=function(){return ee(h(this.rgba))},e.prototype.toHslString=function(){return e=ee(h(this.rgba)),t=e.h,n=e.s,r=e.l,(i=e.a)<1?`hsla(`+t+`, `+n+`%, `+r+`%, `+i+`)`:`hsl(`+t+`, `+n+`%, `+r+`%)`;var e,t,n,r,i},e.prototype.toHsv=function(){return e=d(this.rgba),{h:i(e.h),s:i(e.s),v:i(e.v),a:i(e.a,3)};var e},e.prototype.invert=function(){return S({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return e===void 0&&(e=.1),S(b(this.rgba,e))},e.prototype.desaturate=function(e){return e===void 0&&(e=.1),S(b(this.rgba,-e))},e.prototype.grayscale=function(){return S(b(this.rgba,-1))},e.prototype.lighten=function(e){return e===void 0&&(e=.1),S(ie(this.rgba,e))},e.prototype.darken=function(e){return e===void 0&&(e=.1),S(ie(this.rgba,-e))},e.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return typeof e==`number`?S({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):i(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=h(this.rgba);return typeof e==`number`?S({h:e,s:t.s,l:t.l,a:t.a}):i(t.h)},e.prototype.isEqual=function(e){return this.toHex()===S(e).toHex()},e}(),S=function(e){return e instanceof ae?e:new ae(e)},oe=class{eventListeners=new Map;addEventListener(e,t,n){let r={value:t,options:n},i=this.eventListeners.get(e);return i?Array.isArray(i)?i.push(r):this.eventListeners.set(e,[i,r]):this.eventListeners.set(e,r),this}removeEventListener(e,t,n){if(!t)return this.eventListeners.delete(e),this;let r=this.eventListeners.get(e);if(!r)return this;if(Array.isArray(r)){let i=[];for(let e=0,a=r.length;e<a;e++){let a=r[e];(a.value!==t||typeof n==`object`&&n?.once&&(typeof a.options==`boolean`||!a.options?.once))&&i.push(a)}i.length?this.eventListeners.set(e,i.length===1?i[0]:i):this.eventListeners.delete(e)}else r.value===t&&(typeof n==`boolean`||!n?.once||typeof r.options==`boolean`||r.options?.once)&&this.eventListeners.delete(e);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(e){return this.eventListeners.has(e)}dispatchEvent(e,...t){let n=this.eventListeners.get(e);if(n){if(Array.isArray(n))for(let r=n.length,i=0;i<r;i++){let r=n[i];typeof r.options==`object`&&r.options?.once&&this.off(e,r.value,r.options),r.value.apply(this,t)}else typeof n.options==`object`&&n.options?.once&&this.off(e,n.value,n.options),n.value.apply(this,t);return!0}else return!1}on(e,t,n){return this.addEventListener(e,t,n)}once(e,t){return this.addEventListener(e,t,{once:!0})}off(e,t,n){return this.removeEventListener(e,t,n)}emit(e,...t){this.dispatchEvent(e,...t)}};function C(e){return e==null||e===``||e===`none`}function w(e,t=0,n=10**t){return Math.round(n*e)/n+0}function T(e,t){if(typeof e==`number`)return Number.isFinite(e)?e:t;if(typeof e==`string`){let n=Number.parseFloat(e);return Number.isFinite(n)?n:t}return t}function E(e,t=!1){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return t?e.map(e=>E(e,t)):e;let n={};for(let r in e){let i=e[r];i!=null&&(t?n[r]=E(i,t):n[r]=i)}return n}function D(e,t){let n={};return t.forEach(t=>{t in e&&(n[t]=e[t])}),n}function O(e,t){if(e===t)return!0;if(e&&t&&typeof e==`object`&&typeof t==`object`){let n=Array.from(new Set([...Object.keys(e),...Object.keys(t)]));return!n.length||n.every(n=>e[n]===t[n])}return!1}function k(e,t,n){let r=t.length-1;if(r<0)return e===void 0?n:e;for(let i=0;i<r;i++){if(e==null)return n;e=e[t[i]]}return e==null||e[t[r]]===void 0?n:e[t[r]]}function A(e,t,n){let r=t.length-1;for(let n=0;n<r;n++)typeof e[t[n]]!=`object`&&(e[t[n]]={}),e=e[t[n]];e[t[r]]=n}function se(e,t,n){return e==null||!t||typeof t!=`string`?n:e[t]===void 0?(t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``),k(e,t.split(`.`),n)):e[t]}function ce(e,t,n){if(!(typeof e!=`object`||!t))return t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``),A(e,t.split(`.`),n)}var le=class{_eventListeners={};on(e,t){let n=this._eventListeners[e];n===void 0&&(n=[],this._eventListeners[e]=n);let r=n.indexOf(t);return r>-1&&n.splice(r,1),n.push(t),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n),this}off(e,t){let n=this._eventListeners[e];if(n!==void 0){let e=n.indexOf(t);e>-1&&n.splice(e,1)}return this}emit(e,...t){let n=this._eventListeners[e];if(n!==void 0){let e=n.length;if(e>0)for(let r=0;r<e;r++)n[r].apply(this,t)}return this}removeAllListeners(){return this._eventListeners={},this}hasEventListener(e){return!!this._eventListeners[e]}destroy(){this.removeAllListeners()}},ue=class{_map=new WeakMap;_toRaw(e){if(e&&typeof e==`object`){let t=e.__v_raw;t&&(e=this._toRaw(t))}return e}delete(e){return this._map.delete(this._toRaw(e))}get(e){return this._map.get(this._toRaw(e))}has(e){return this._map.has(this._toRaw(e))}set(e,t){return this._map.set(this._toRaw(e),this._toRaw(t)),this}},de=Symbol.for(`declarations`),j=Symbol.for(`inited`);function M(e){let t;if(Object.hasOwn(e,de))t=e[de];else{let n=Object.getPrototypeOf(e);t={...n?M(n):{}},e[de]=t}return t}function N(e,t,n,r){let{alias:i,internalKey:a}=r,o=e[t];i?ce(e,i,n):e[a]=n,e.onUpdateProperty?.(t,n??F(e,t,r),o)}function P(e,t,n){let{alias:r,internalKey:i}=n,a;return a=r?se(e,r):e[i],a??=F(e,t,n),a}function F(e,t,n){let{default:r,fallback:i}=n,a;if(r!==void 0&&!e[j]?.[t]){e[j]||(e[j]={}),e[j][t]=!0;let n=typeof r==`function`?r():r;n!==void 0&&(e[t]=n,a=n)}return a===void 0&&i!==void 0&&(a=typeof i==`function`?i():i),a}function fe(e,t){function n(){return this.getProperty?this.getProperty(e):P(this,e,t)}function r(n){this.setProperty?this.setProperty(e,n):N(this,e,n,t)}return{get:n,set:r}}function pe(e,t,n={}){let r={...n,internalKey:Symbol.for(t)},i=M(e);i[t]=r;let{get:a,set:o}=fe(t,r);Object.defineProperty(e.prototype,t,{get(){return a.call(this)},set(e){o.call(this,e)},configurable:!0,enumerable:!0})}function me(e){return function(t,n){if(typeof n!=`string`)throw TypeError(`Failed to @property decorator, prop name cannot be a symbol`);pe(t.constructor,n,e)}}function he(e={}){return function(t,n){let r=n.name;if(typeof r!=`string`)throw TypeError(`Failed to @property decorator, prop name cannot be a symbol`);let i={...e,internalKey:Symbol.for(r)},a=fe(r,i);return{init(e){let t=M(this.constructor);return t[r]=i,a.set.call(this,e),e},get(){return a.get.call(this)},set(e){a.set.call(this,e)}}}}var ge=class extends le{_propertyAccessor;_properties={};_updatedProperties={};_changedProperties=new Set;_updatingPromise=Promise.resolve();_updating=!1;constructor(e){super(),this.setProperties(e)}isDirty(e){return e?!!this._updatedProperties[e]:Object.keys(this._updatedProperties).length>0}offsetGetProperty(e){return this._properties[e]}offsetSetProperty(e,t){this._properties[e]=t}offsetGetProperties(e){let t=this._properties,n=Object.keys(t),r={};for(let i,a,o=0;o<n.length;o++)i=n[o],a=t[i],a!==void 0&&(!e||e.includes(i))&&(a&&typeof a==`object`?`toJSON`in a?r[i]=a.toJSON():Array.isArray(a)?r[i]=[...a]:r[i]={...a}:r[i]=a);return r}offsetSetProperties(e){if(e&&typeof e==`object`){let t=Object.keys(e);for(let n,r=0;r<t.length;r++)n=t[r],this.offsetSetProperty(n,e[n])}return this}getProperty(e){let t=this.getPropertyDeclaration(e);if(t){if(t.internal||t.alias)return P(this,e,t);{let n=this._propertyAccessor,r;return r=n&&n.getProperty?n.getProperty(e):this.offsetGetProperty(e),r??F(this,e,t)}}}setProperty(e,t){let n=this.getPropertyDeclaration(e);if(n)if(n.internal||n.alias)N(this,e,t,n);else{let r=this.getProperty(e);this._propertyAccessor?.setProperty?.(e,t),this.offsetSetProperty(e,t),this.onUpdateProperty?.(e,t??F(this,e,n),r)}}getProperties(e){let t={},n=this.getPropertyDeclarations(),r=Object.keys(n);for(let i=0,a=r.length;i<a;i++){let a=r[i],o=n[a];o.internal||o.alias||(!e||e.includes(a))&&(t[a]=this.getProperty(a))}return t}setProperties(e){if(e&&typeof e==`object`)for(let t in e)this.setProperty(t,e[t]);return this}resetProperties(){let e=this.getPropertyDeclarations(),t=Object.keys(e);for(let n=0,r=t.length;n<r;n++){let r=t[n],i=e[r];this.setProperty(r,typeof i.default==`function`?i.default():i.default)}return this}getPropertyDeclarations(){return M(this.constructor)}getPropertyDeclaration(e){return this.getPropertyDeclarations()[e]}setPropertyAccessor(e){let t=this.getPropertyDeclarations(),n=[];if(e&&e.getProperty&&e.setProperty){let r=Object.keys(t);for(let i=0,a=r.length;i<a;i++){let a=r[i],o=t[a];if(o.internal||o.alias)continue;let s=this.offsetGetProperty(a),c=e.getProperty(a);c!==void 0&&!Object.is(s,c)&&(this.offsetSetProperty(a,c),n.push({key:a,newValue:c,oldValue:s}))}}this._propertyAccessor=e;for(let e=0,t=n.length;e<t;e++){let{key:t,newValue:r,oldValue:i}=n[e];this.requestUpdate(t,r,i)}return this}async _nextTick(){return`requestAnimationFrame`in globalThis?new Promise(e=>globalThis.requestAnimationFrame(e)):Promise.resolve()}async _enqueueUpdate(){this._updating=!0;try{await this._updatingPromise}catch(e){Promise.reject(e)}await this._nextTick(),this._updating&&=(this.onUpdate(),!1)}onUpdate(){this._update(this._updatedProperties),this._updatedProperties={}}onUpdateProperty(e,t,n){Object.is(t,n)||this.requestUpdate(e,t,n)}requestUpdate(e,t,n){e!==void 0&&(this._updatedProperties[e]=n,this._changedProperties.add(e),this._updateProperty(e,t,n),this.emit(`updateProperty`,e,t,n)),this._updating||(this._updatingPromise=this._enqueueUpdate())}_update(e){}_updateProperty(e,t,n){}toJSON(){return this.offsetGetProperties()}clone(){return new this.constructor(this.toJSON())}destroy(){this.emit(`destroy`),super.destroy()}};function _e(e){let t;return t=typeof e==`number`?{r:e>>24&255,g:e>>16&255,b:e>>8&255,a:(e&255)/255}:e,S(t)}function ve(e){return{r:w(e.r),g:w(e.g),b:w(e.b),a:w(e.a,3)}}function I(e){let t=e.toString(16);return t.length<2?`0${t}`:t}var ye=`#000000FF`;function L(e){return _e(e).isValid()}function R(e,t=!1){let n=_e(e);if(!n.isValid()){if(typeof e==`string`)return e;let n=`Failed to normalizeColor ${e}`;if(t)throw Error(n);return console.warn(n),ye}let{r,g:i,b:a,a:o}=ve(n.rgba);return`#${I(r)}${I(i)}${I(a)}${I(w(o*255))}`}var z=z||{};z.parse=(function(){let e={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i},t=``;function n(e){let n=Error(`${t}: ${e}`);throw n.source=t,n}function r(){let e=i();return t.length>0&&n(`Invalid input not EOF`),e}function i(){return _(a)}function a(){return o(`linear-gradient`,e.linearGradient,c)||o(`repeating-linear-gradient`,e.repeatingLinearGradient,c)||o(`radial-gradient`,e.radialGradient,d)||o(`repeating-radial-gradient`,e.repeatingRadialGradient,d)}function o(t,r,i){return s(r,r=>{let a=i();return a&&(k(e.comma)||n(`Missing comma before color stops`)),{type:t,orientation:a,colorStops:_(ne)}})}function s(t,r){let i=k(t);if(i){k(e.startCall)||n(`Missing (`);let t=r(i);return k(e.endCall)||n(`Missing )`),t}}function c(){let t=l();if(t)return t;let n=O(`position-keyword`,e.positionKeywords,1);return n?{type:`directional`,value:n.value}:u()}function l(){return O(`directional`,e.sideOrCorner,1)}function u(){return O(`angular`,e.angleValue,1)||O(`angular`,e.radianValue,1)}function d(){let n,r=f(),i;return r&&(n=[],n.push(r),i=t,k(e.comma)&&(r=f(),r?n.push(r):t=i)),n}function f(){let e=p()||ee();if(e)e.at=h();else{let t=m();if(t){e=t;let n=h();n&&(e.at=n)}else{let t=h();if(t)e={type:`default-radial`,at:t};else{let t=g();t&&(e={type:`default-radial`,at:t})}}}return e}function p(){let e=O(`shape`,/^(circle)/i,0);return e&&(e.style=D()||m()),e}function ee(){let e=O(`shape`,/^(ellipse)/i,0);return e&&(e.style=g()||w()||m()),e}function m(){return O(`extent-keyword`,e.extentKeywords,1)}function h(){if(O(`position`,/^at/,0)){let e=g();return e||n(`Missing positioning value`),e}}function g(){let e=te();if(e.x||e.y)return{type:`position`,value:e}}function te(){return{x:w(),y:w()}}function _(t){let r=t(),i=[];if(r)for(i.push(r);k(e.comma);)r=t(),r?i.push(r):n(`One extra comma`);return i}function ne(){let e=v();return e||n(`Expected color definition`),e.length=w(),e}function v(){return re()||S()||ae()||x()||b()||ie()||y()}function y(){return O(`literal`,e.literalColor,0)}function re(){return O(`hex`,e.hexColor,1)}function b(){return s(e.rgbColor,()=>({type:`rgb`,value:_(C)}))}function x(){return s(e.rgbaColor,()=>({type:`rgba`,value:_(C)}))}function ie(){return s(e.varColor,()=>({type:`var`,value:oe()}))}function ae(){return s(e.hslColor,()=>{k(e.percentageValue)&&n(`HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage`);let t=C();k(e.comma);let r=k(e.percentageValue),i=r?r[1]:null;k(e.comma),r=k(e.percentageValue);let a=r?r[1]:null;return(!i||!a)&&n(`Expected percentage value for saturation and lightness in HSL`),{type:`hsl`,value:[t,i,a]}})}function S(){return s(e.hslaColor,()=>{let t=C();k(e.comma);let r=k(e.percentageValue),i=r?r[1]:null;k(e.comma),r=k(e.percentageValue);let a=r?r[1]:null;k(e.comma);let o=C();return(!i||!a)&&n(`Expected percentage value for saturation and lightness in HSLA`),{type:`hsla`,value:[t,i,a,o]}})}function oe(){return k(e.variableName)[1]}function C(){return k(e.number)[1]}function w(){return O(`%`,e.percentageValue,1)||T()||E()||D()}function T(){return O(`position-keyword`,e.positionKeywords,1)}function E(){return s(e.calcValue,()=>{let e=1,r=0;for(;e>0&&r<t.length;){let n=t.charAt(r);n===`(`?e++:n===`)`&&e--,r++}e>0&&n(`Missing closing parenthesis in calc() expression`);let i=t.substring(0,r-1);return A(r-1),{type:`calc`,value:i}})}function D(){return O(`px`,e.pixelValue,1)||O(`em`,e.emValue,1)}function O(e,t,n){let r=k(t);if(r)return{type:e,value:r[n]}}function k(e){let n,r;return r=/^\s+/.exec(t),r&&A(r[0].length),n=e.exec(t),n&&A(n[0].length),n}function A(e){t=t.substr(e)}return function(e){return t=e.toString().trim(),t.endsWith(`;`)&&(t=t.slice(0,-1)),r()}})();var be=z.parse.bind(z),B=B||{};B.stringify=(function(){var e={"visit_linear-gradient":function(t){return e.visit_gradient(t)},"visit_repeating-linear-gradient":function(t){return e.visit_gradient(t)},"visit_radial-gradient":function(t){return e.visit_gradient(t)},"visit_repeating-radial-gradient":function(t){return e.visit_gradient(t)},visit_gradient:function(t){var n=e.visit(t.orientation);return n&&(n+=`, `),t.type+`(`+n+e.visit(t.colorStops)+`)`},visit_shape:function(t){var n=t.value,r=e.visit(t.at),i=e.visit(t.style);return i&&(n+=` `+i),r&&(n+=` at `+r),n},"visit_default-radial":function(t){var n=``,r=e.visit(t.at);return r&&(n+=r),n},"visit_extent-keyword":function(t){var n=t.value,r=e.visit(t.at);return r&&(n+=` at `+r),n},"visit_position-keyword":function(e){return e.value},visit_position:function(t){return e.visit(t.value.x)+` `+e.visit(t.value.y)},"visit_%":function(e){return e.value+`%`},visit_em:function(e){return e.value+`em`},visit_px:function(e){return e.value+`px`},visit_calc:function(e){return`calc(`+e.value+`)`},visit_literal:function(t){return e.visit_color(t.value,t)},visit_hex:function(t){return e.visit_color(`#`+t.value,t)},visit_rgb:function(t){return e.visit_color(`rgb(`+t.value.join(`, `)+`)`,t)},visit_rgba:function(t){return e.visit_color(`rgba(`+t.value.join(`, `)+`)`,t)},visit_hsl:function(t){return e.visit_color(`hsl(`+t.value[0]+`, `+t.value[1]+`%, `+t.value[2]+`%)`,t)},visit_hsla:function(t){return e.visit_color(`hsla(`+t.value[0]+`, `+t.value[1]+`%, `+t.value[2]+`%, `+t.value[3]+`)`,t)},visit_var:function(t){return e.visit_color(`var(`+t.value+`)`,t)},visit_color:function(t,n){var r=t,i=e.visit(n.length);return i&&(r+=` `+i),r},visit_angular:function(e){return e.value+`deg`},visit_directional:function(e){return`to `+e.value},visit_array:function(t){var n=``,r=t.length;return t.forEach(function(t,i){n+=e.visit(t),i<r-1&&(n+=`, `)}),n},visit_object:function(t){return t.width&&t.height?e.visit(t.width)+` `+e.visit(t.height):``},visit:function(t){if(!t)return``;if(t instanceof Array)return e.visit_array(t);if(typeof t==`object`&&!t.type)return e.visit_object(t);if(t.type){var n=e[`visit_`+t.type];if(n)return n(t);throw Error(`Missing visitor visit_`+t.type)}else throw Error(`Invalid node.`)}};return function(t){return e.visit(t)}})();var xe=B.stringify.bind(B);function Se(e){let t=e.length-1;return e.map((e,n)=>{let r=e.value,i=w(n/t,3),a=`#00000000`;switch(e.type){case`rgb`:a=R({r:Number(r[0]??0),g:Number(r[1]??0),b:Number(r[2]??0)});break;case`rgba`:a=R({r:Number(r[0]??0),g:Number(r[1]??0),b:Number(r[2]??0),a:Number(r[3]??0)});break;case`literal`:a=R(e.value);break;case`hex`:a=R(`#${e.value}`);break}switch(e.length?.type){case`%`:i=Number(e.length.value)/100;break;case`px`:break;case`em`:break}return{offset:i,color:a}})}function Ce(e){let t=0;switch(e.orientation?.type){case`angular`:t=Number(e.orientation.value);break;case`directional`:break}return{type:`linear-gradient`,angle:t,stops:Se(e.colorStops)}}function we(e){return e.orientation?.map(e=>{switch(e?.type){default:return null}}),{type:`radial-gradient`,stops:Se(e.colorStops)}}function V(e){return e.startsWith(`linear-gradient(`)||e.startsWith(`radial-gradient(`)}function Te(e){return be(e).map(e=>{switch(e?.type){case`linear-gradient`:return Ce(e);case`repeating-linear-gradient`:return{...Ce(e),repeat:!0};case`radial-gradient`:return we(e);case`repeating-radial-gradient`:return{...we(e),repeat:!0};default:return}}).filter(Boolean)}var H=[`color`];function Ee(e){let t;return t=typeof e==`string`?{color:e}:{...e},t.color&&=R(t.color),D(t,H)}var U=[`linearGradient`,`radialGradient`,`rotateWithShape`];function De(e){let t;if(t=typeof e==`string`?{image:e}:{...e},t.image){let{type:e,...n}=Te(t.image)[0]??{};switch(e){case`radial-gradient`:return{radialGradient:n};case`linear-gradient`:return{linearGradient:n}}}return D(t,U)}var W=[`image`,`cropRect`,`stretchRect`,`tile`,`dpi`,`opacity`,`rotateWithShape`];function Oe(e){let t;return t=typeof e==`string`?{image:e}:{...e},D(t,W)}var G=[`preset`,`foregroundColor`,`backgroundColor`];function ke(e){let t;return t=typeof e==`string`?{preset:e}:{...e},C(t.foregroundColor)?delete t.foregroundColor:t.foregroundColor=R(t.foregroundColor),C(t.backgroundColor)?delete t.backgroundColor:t.backgroundColor=R(t.backgroundColor),D(t,G)}function Ae(e){return!C(e.color)}function je(e){return typeof e==`string`?L(e):Ae(e)}function Me(e){return!C(e.image)&&V(e.image)||!!e.linearGradient||!!e.radialGradient}function Ne(e){return typeof e==`string`?V(e):Me(e)}function Pe(e){return!C(e.image)&&!V(e.image)}function Fe(e){return typeof e==`string`?!L(e)&&!V(e):Pe(e)}function Ie(e){return!C(e.preset)}function Le(e){return typeof e==`string`?!1:Ie(e)}function K(e){let t={enabled:e&&typeof e==`object`?e.enabled??!0:!0};return je(e)&&Object.assign(t,Ee(e)),Ne(e)&&Object.assign(t,De(e)),Fe(e)&&Object.assign(t,Oe(e)),Le(e)&&Object.assign(t,ke(e)),D(E(t),Array.from(new Set([`enabled`,...H,...W,...U,...G])))}function q(e){return typeof e==`string`?{...K(e)}:{...K(e),...D(e,[`fillWithShape`])}}function Re(){return{backgroundImage:`none`,backgroundSize:`auto, auto`,backgroundColor:`none`,backgroundColormap:`none`}}function ze(e){return(e??[]).map(e=>T(e)??0)}function Be(e){return E({name:e.name,values:ze(e.values),xValues:e.xValues?ze(e.xValues):void 0,color:e.color})}function Ve(e){return E({title:e.title,min:T(e.min),max:T(e.max),visible:e.visible})}function He(e){return E({enabled:e.enabled??!0,type:e.type??`column`,grouping:e.grouping,categories:e.categories??[],series:(e.series??[]).map(Be),title:e.title,legend:e.legend,categoryAxis:e.categoryAxis?Ve(e.categoryAxis):void 0,valueAxis:e.valueAxis?Ve(e.valueAxis):void 0})}var Ue=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,We=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Ue[n[e]&63];return t},Ge=()=>We(10),J=Ge;function Ke(e){return{x:T(e.x)??0,y:T(e.y)??0}}function qe(e){return E({id:e.id,name:e.name,color:e.color,initials:e.initials})}function Je(e){return E({id:e.id??J(),author:e.author?qe(e.author):void 0,body:e.body??``,createdAt:T(e.createdAt)})}function Ye(e){return E({id:e.id??J(),offset:e.offset?Ke(e.offset):void 0,resolved:e.resolved,messages:(e.messages??[]).map(Je)})}function Xe(e){if(e?.length)return e.map(Ye)}function Ze(e){return E({start:e.start,end:e.end,mode:e.mode??`straight`})}function Y(e){return typeof e==`string`?{...K(e)}:{...K(e),...D(e,[`width`,`style`,`lineCap`,`lineJoin`,`headEnd`,`tailEnd`])}}function Qe(){return{outlineWidth:0,outlineOffset:0,outlineColor:`none`,outlineStyle:`none`}}function $e(e){return typeof e==`string`?{enabled:!0,color:R(e)}:{...e,enabled:e.enabled??!0,color:C(e.color)?ye:R(e.color)}}function et(){return{boxShadow:`none`}}function tt(e){return E({blur:e.blur,brightness:e.brightness,contrast:e.contrast,grayscale:e.grayscale,hueRotate:e.hueRotate,invert:e.invert,opacity:e.opacity,saturate:e.saturate,sepia:e.sepia,duotone:e.duotone?[R(e.duotone[0]),R(e.duotone[1])]:void 0,biLevel:e.biLevel,colorChange:e.colorChange?{from:R(e.colorChange.from),to:R(e.colorChange.to)}:void 0})}function nt(e){let t=[];return e.blur!==void 0&&t.push(`blur(${e.blur}px)`),e.brightness!==void 0&&t.push(`brightness(${e.brightness})`),e.contrast!==void 0&&t.push(`contrast(${e.contrast})`),e.grayscale!==void 0&&t.push(`grayscale(${e.grayscale})`),e.hueRotate!==void 0&&t.push(`hue-rotate(${e.hueRotate}deg)`),e.invert!==void 0&&t.push(`invert(${e.invert})`),e.opacity!==void 0&&t.push(`opacity(${e.opacity})`),e.saturate!==void 0&&t.push(`saturate(${e.saturate})`),e.sepia!==void 0&&t.push(`sepia(${e.sepia})`),t.join(` `)}var rt=[`fill`,`outline`,`shadow`,`transform`,`transformOrigin`,`filter`];function it(e){let t=D(e,rt),{rotate:n,scaleX:r,scaleY:i,skewX:a,skewY:o,translateX:s,translateY:c}=e,l=[];return(s||c)&&l.push(`translate(${s||0}, ${c||0})`),n&&l.push(`rotate(${n}deg)`),(r||i)&&l.push(`scale(${r??1}, ${i??1})`),a&&l.push(`skewX(${a}deg)`),o&&l.push(`skewY(${o}deg)`),l.length>0&&(t.transform=l.join(` `)),(e.textStrokeWidth||e.textStrokeColor)&&(t.outline={color:e.textStrokeColor,width:e.textStrokeWidth}),e.color&&(t.fill={color:e.color}),(e.shadowOffsetX||e.shadowOffsetY||e.shadowBlur||e.shadowColor)&&(t.shadow={offsetX:e.shadowOffsetX,offsetY:e.shadowOffsetY,blur:e.shadowBlur,color:e.shadowColor}),t}function X(e){let t=it(e);return E({fill:C(t.fill)?void 0:K(t.fill),outline:C(t.outline)?void 0:Y(t.outline),shadow:C(t.shadow)?void 0:$e(t.shadow),transform:C(t.transform)?void 0:t.transform,transformOrigin:t.transformOrigin,filter:t.filter?tt(t.filter):void 0})}function at(e){return typeof e==`string`?{...K(e)}:E({...K(e),...D(e,[`fillWithShape`]),effects:e.effects?.map(X)})}function ot(e){return typeof e==`string`?e.startsWith(`<svg`)?{enabled:!0,svg:e}:{enabled:!0,paths:[{data:e}]}:Array.isArray(e)?{enabled:!0,paths:e.map(e=>typeof e==`string`?{data:e}:e)}:e}function st(){return{overflow:`visible`,direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function ct(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:`none`,transformOrigin:`center`}}function lt(){return{...st(),...ct(),...et(),...Re(),...Qe(),borderRadius:0,borderColor:`none`,borderStyle:`solid`,visibility:`visible`,filter:`none`,opacity:1,pointerEvents:`auto`,maskImage:`none`}}function ut(){return{highlight:{},highlightImage:`none`,highlightReferImage:`none`,highlightColormap:`none`,highlightLine:`none`,highlightSize:`cover`,highlightThickness:`100%`}}function dt(){return{listStyle:{},listStyleType:`none`,listStyleImage:`none`,listStyleColormap:`none`,listStyleSize:`cover`,listStylePosition:`outside`}}function ft(){return{...ut(),color:`#000000`,verticalAlign:`baseline`,letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:`normal`,fontFamily:``,fontStyle:`normal`,fontKerning:`normal`,textTransform:`none`,textOrientation:`mixed`,textDecoration:`none`}}function pt(){return{...dt(),writingMode:`horizontal-tb`,textWrap:`wrap`,textAlign:`start`,textIndent:0,lineHeight:1.2}}function mt(){return{...pt(),...ft(),textStrokeWidth:0,textStrokeColor:`none`}}var ht=[`textIndent`,`lineHeight`,`letterSpacing`,`wordSpacing`,`fontSize`,`textStrokeWidth`,`borderRadius`,`opacity`,`rotate`,`scaleX`,`scaleY`,`skewX`,`skewY`,`translateX`,`translateY`,`borderWidth`,`flex`,`flexGrow`,`flexShrink`];function Z(e){let t=E({...e,color:C(e.color)?void 0:R(e.color),backgroundColor:C(e.backgroundColor)?void 0:R(e.backgroundColor),borderColor:C(e.borderColor)?void 0:R(e.borderColor),outlineColor:C(e.outlineColor)?void 0:R(e.outlineColor),shadowColor:C(e.shadowColor)?void 0:R(e.shadowColor),textStrokeColor:C(e.textStrokeColor)?void 0:R(e.textStrokeColor)});for(let e of ht)if(e in t){let n=T(t[e]);n===void 0?delete t[e]:t[e]=n}return t}function gt(){return{...lt(),...mt()}}function _t(e){return E({width:T(e.width)})}function vt(e){return E({height:T(e.height)})}function yt(e){return E({row:T(e.row)??0,col:T(e.col)??0,rowSpan:T(e.rowSpan),colSpan:T(e.colSpan),children:(e.children??[]).map(e=>$(e)),background:C(e.background)?void 0:q(e.background),style:C(e.style)?void 0:Z(e.style)})}function bt(e){return E({enabled:e.enabled??!0,columns:(e.columns??[]).map(_t),rows:(e.rows??[]).map(vt),cells:(e.cells??[]).map(yt)})}var xt=/\r\n|\n\r|\n|\r/,St=RegExp(`${xt.source}|<br\\/>`,`g`),Ct=RegExp(`^(${xt.source})$`),wt=`
|
|
2
|
+
`;function Tt(e){return xt.test(e)}function Et(e){return Ct.test(e)}function Dt(e){return e.replace(St,wt)}function Q(e){let t=[];function n(){return t[t.length-1]}function r(e,n,r){let i=e?Z(e):{},a=n?K(n):void 0,o=r?Y(r):void 0,s=E({...i,fill:a,outline:o,fragments:[]});return t[t.length-1]?.fragments.length===0?t[t.length-1]=s:t.push(s),s}function i(e=``,t,i,a){let o=t?Z(t):{},s=i?K(i):void 0,c=a?Y(a):void 0;Array.from(e).forEach(e=>{if(Et(e)){let{fragments:e,fill:t,outline:i,...a}=n()||r();e.length||e.push(E({...o,fill:s,outline:c,content:wt})),r(a,t,i)}else{let t=n()||r(),i=t.fragments[t.fragments.length-1];if(i){let{content:t,fill:n,outline:r,...a}=i;if(O(s,n)&&O(c,r)&&O(o,a)){i.content=`${t}${e}`;return}}t.fragments.push(E({...o,fill:s,outline:c,content:e}))}})}(Array.isArray(e)?e:[e]).forEach(e=>{if(typeof e==`string`)r(),i(e);else if(kt(e)){let{content:t,fill:n,outline:a,...o}=e;r(o,n,a),i(t)}else if(Ot(e)){let{fragments:t,fill:n,outline:a,...o}=e;r(o,n,a),t.forEach(e=>{let{content:t,fill:n,outline:r,...a}=e;i(t,a,n,r)})}else Array.isArray(e)?(r(),e.forEach(e=>{if(typeof e==`string`)i(e);else if(kt(e)){let{content:t,fill:n,outline:r,...a}=e;i(t,a,n,r)}})):console.warn(`Failed to parse text content`,e)});let a=n();return a&&!a.fragments.length&&a.fragments.push({content:``}),t}function Ot(e){return e&&typeof e==`object`&&`fragments`in e&&Array.isArray(e.fragments)}function kt(e){return e&&typeof e==`object`&&`content`in e&&typeof e.content==`string`}function At(e){return E({type:e.type,intensities:e.intensities,maxFontSize:e.maxFontSize??100})}function jt(e){return typeof e==`string`||Array.isArray(e)?{enabled:!0,content:Q(e)}:E({enabled:e.enabled??!0,content:Q(e.content??``),style:e.style?Z(e.style):void 0,deformation:e.deformation?At(e.deformation):void 0,measureDom:e.measureDom,fonts:e.fonts,...X(e),effects:e.effects?e.effects.map(e=>X(e)):void 0})}function Mt(e){return Q(e).map(e=>{let t=Dt(e.fragments.flatMap(e=>e.content).join(``));return Et(t)?``:t}).join(wt)}function Nt(e){return typeof e==`string`?{src:e}:e}function $(e){return E({id:e.id??J(),style:C(e.style)?void 0:Z(e.style),text:C(e.text)?void 0:jt(e.text),background:C(e.background)?void 0:q(e.background),shape:C(e.shape)?void 0:ot(e.shape),foreground:C(e.foreground)?void 0:at(e.foreground),video:C(e.video)?void 0:Nt(e.video),audio:C(e.audio)?void 0:t(e.audio),connection:C(e.connection)?void 0:Ze(e.connection),table:C(e.table)?void 0:bt(e.table),chart:C(e.chart)?void 0:He(e.chart),comments:Xe(e.comments),...X(e),children:e.children?.map(e=>$(e))})}function Pt(e){return $(e)}function Ft(e){let t={};for(let n in e.children){let r=$(e.children[n]);delete r.children,t[n]=r}return{...e,children:t}}function It(e){let{children:t,...n}=e;function r(e){let{parentId:t,childrenIds:n,...r}=e;return{...r,children:[]}}let i={},a=[],o={...n,children:a};function s(e){if(!t[e]||i[e])return;let n=t[e],o=r(n);i[e]=o;let c=n.parentId;if(c){s(c);let n=t[c],r=i[c];if(!r)return;n?.childrenIds&&r?.children&&(r.children[n.childrenIds.indexOf(e)]=o)}else a.push(o)}for(let e in t)s(e);return o}e.EventEmitter=oe,e.Observable=le,e.RawWeakMap=ue,e.Reactivable=ge,e.clearUndef=E,e.colorFillFields=H,e.defaultColor=ye,e.defineProperty=pe,e.effectFields=rt,e.flatDocumentToDocument=It,e.getDeclarations=M,e.getDefaultBackgroundStyle=Re,e.getDefaultElementStyle=lt,e.getDefaultHighlightStyle=ut,e.getDefaultLayoutStyle=st,e.getDefaultListStyleStyle=dt,e.getDefaultOutlineStyle=Qe,e.getDefaultShadowStyle=et,e.getDefaultStyle=gt,e.getDefaultTextInlineStyle=ft,e.getDefaultTextLineStyle=pt,e.getDefaultTextStyle=mt,e.getDefaultTransformStyle=ct,e.getNestedValue=k,e.getObjectValueByPath=se,e.getPropertyDescriptor=fe,e.gradientFillFields=U,e.hasCRLF=Tt,e.idGenerator=J,e.imageFillFiedls=W,e.isCRLF=Et,e.isColor=L,e.isColorFill=je,e.isColorFillObject=Ae,e.isEqualObject=O,e.isFragmentObject=kt,e.isGradient=V,e.isGradientFill=Ne,e.isGradientFillObject=Me,e.isImageFill=Fe,e.isImageFillObject=Pe,e.isNone=C,e.isParagraphObject=Ot,e.isPresetFill=Le,e.isPresetFillObject=Ie,e.nanoid=Ge,e.normalizeAudio=t,e.normalizeBackground=q,e.normalizeCRLF=Dt,e.normalizeChart=He,e.normalizeColor=R,e.normalizeColorFill=Ee,e.normalizeCommentMessage=Je,e.normalizeCommentThread=Ye,e.normalizeComments=Xe,e.normalizeConnection=Ze,e.normalizeDocument=Pt,e.normalizeEffect=X,e.normalizeElement=$,e.normalizeFill=K,e.normalizeFilter=tt,e.normalizeFlatDocument=Ft,e.normalizeForeground=at,e.normalizeGradient=Te,e.normalizeGradientFill=De,e.normalizeImageFill=Oe,e.normalizeNumber=T,e.normalizeOutline=Y,e.normalizePresetFill=ke,e.normalizeShadow=$e,e.normalizeShape=ot,e.normalizeStyle=Z,e.normalizeTable=bt,e.normalizeText=jt,e.normalizeTextContent=Q,e.normalizeTextDeformation=At,e.normalizeVideo=Nt,e.parseColor=_e,e.parseGradient=be,e.pick=D,e.presetFillFiedls=G,e.property=me,e.property2=he,e.propertyOffsetFallback=F,e.propertyOffsetGet=P,e.propertyOffsetSet=N,e.round=w,e.setNestedValue=A,e.setObjectValueByPath=ce,e.stringifyFilter=nt,e.stringifyGradient=xe,e.textContentToString=Mt});
|
package/dist/index.mjs
CHANGED
|
@@ -1474,6 +1474,48 @@ function normalizeChart(chart) {
|
|
|
1474
1474
|
});
|
|
1475
1475
|
}
|
|
1476
1476
|
|
|
1477
|
+
const nanoid = () => {
|
|
1478
|
+
return nanoid$1(10);
|
|
1479
|
+
};
|
|
1480
|
+
const idGenerator = nanoid;
|
|
1481
|
+
|
|
1482
|
+
function normalizeCommentOffset(offset) {
|
|
1483
|
+
return {
|
|
1484
|
+
x: normalizeNumber(offset.x) ?? 0,
|
|
1485
|
+
y: normalizeNumber(offset.y) ?? 0
|
|
1486
|
+
};
|
|
1487
|
+
}
|
|
1488
|
+
function normalizeCommentAuthor(author) {
|
|
1489
|
+
return clearUndef({
|
|
1490
|
+
id: author.id,
|
|
1491
|
+
name: author.name,
|
|
1492
|
+
color: author.color,
|
|
1493
|
+
initials: author.initials
|
|
1494
|
+
});
|
|
1495
|
+
}
|
|
1496
|
+
function normalizeCommentMessage(message) {
|
|
1497
|
+
return clearUndef({
|
|
1498
|
+
id: message.id ?? idGenerator(),
|
|
1499
|
+
author: message.author ? normalizeCommentAuthor(message.author) : void 0,
|
|
1500
|
+
body: message.body ?? "",
|
|
1501
|
+
createdAt: normalizeNumber(message.createdAt)
|
|
1502
|
+
});
|
|
1503
|
+
}
|
|
1504
|
+
function normalizeCommentThread(thread) {
|
|
1505
|
+
return clearUndef({
|
|
1506
|
+
id: thread.id ?? idGenerator(),
|
|
1507
|
+
offset: thread.offset ? normalizeCommentOffset(thread.offset) : void 0,
|
|
1508
|
+
resolved: thread.resolved,
|
|
1509
|
+
messages: (thread.messages ?? []).map(normalizeCommentMessage)
|
|
1510
|
+
});
|
|
1511
|
+
}
|
|
1512
|
+
function normalizeComments(comments) {
|
|
1513
|
+
if (!comments?.length) {
|
|
1514
|
+
return void 0;
|
|
1515
|
+
}
|
|
1516
|
+
return comments.map(normalizeCommentThread);
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1477
1519
|
function normalizeConnection(connection) {
|
|
1478
1520
|
return clearUndef({
|
|
1479
1521
|
start: connection.start,
|
|
@@ -1525,12 +1567,51 @@ function getDefaultShadowStyle() {
|
|
|
1525
1567
|
};
|
|
1526
1568
|
}
|
|
1527
1569
|
|
|
1570
|
+
function normalizeFilter(filter) {
|
|
1571
|
+
return clearUndef({
|
|
1572
|
+
blur: filter.blur,
|
|
1573
|
+
brightness: filter.brightness,
|
|
1574
|
+
contrast: filter.contrast,
|
|
1575
|
+
grayscale: filter.grayscale,
|
|
1576
|
+
hueRotate: filter.hueRotate,
|
|
1577
|
+
invert: filter.invert,
|
|
1578
|
+
opacity: filter.opacity,
|
|
1579
|
+
saturate: filter.saturate,
|
|
1580
|
+
sepia: filter.sepia,
|
|
1581
|
+
duotone: filter.duotone ? [normalizeColor(filter.duotone[0]), normalizeColor(filter.duotone[1])] : void 0,
|
|
1582
|
+
biLevel: filter.biLevel,
|
|
1583
|
+
colorChange: filter.colorChange ? { from: normalizeColor(filter.colorChange.from), to: normalizeColor(filter.colorChange.to) } : void 0
|
|
1584
|
+
});
|
|
1585
|
+
}
|
|
1586
|
+
function stringifyFilter(filter) {
|
|
1587
|
+
const parts = [];
|
|
1588
|
+
if (filter.blur !== void 0)
|
|
1589
|
+
parts.push(`blur(${filter.blur}px)`);
|
|
1590
|
+
if (filter.brightness !== void 0)
|
|
1591
|
+
parts.push(`brightness(${filter.brightness})`);
|
|
1592
|
+
if (filter.contrast !== void 0)
|
|
1593
|
+
parts.push(`contrast(${filter.contrast})`);
|
|
1594
|
+
if (filter.grayscale !== void 0)
|
|
1595
|
+
parts.push(`grayscale(${filter.grayscale})`);
|
|
1596
|
+
if (filter.hueRotate !== void 0)
|
|
1597
|
+
parts.push(`hue-rotate(${filter.hueRotate}deg)`);
|
|
1598
|
+
if (filter.invert !== void 0)
|
|
1599
|
+
parts.push(`invert(${filter.invert})`);
|
|
1600
|
+
if (filter.opacity !== void 0)
|
|
1601
|
+
parts.push(`opacity(${filter.opacity})`);
|
|
1602
|
+
if (filter.saturate !== void 0)
|
|
1603
|
+
parts.push(`saturate(${filter.saturate})`);
|
|
1604
|
+
if (filter.sepia !== void 0)
|
|
1605
|
+
parts.push(`sepia(${filter.sepia})`);
|
|
1606
|
+
return parts.join(" ");
|
|
1607
|
+
}
|
|
1528
1608
|
const effectFields = [
|
|
1529
1609
|
"fill",
|
|
1530
1610
|
"outline",
|
|
1531
1611
|
"shadow",
|
|
1532
1612
|
"transform",
|
|
1533
|
-
"transformOrigin"
|
|
1613
|
+
"transformOrigin",
|
|
1614
|
+
"filter"
|
|
1534
1615
|
];
|
|
1535
1616
|
function normalizeEffectV0(effect) {
|
|
1536
1617
|
const _effect = pick(effect, effectFields);
|
|
@@ -1572,7 +1653,8 @@ function normalizeEffect(effect) {
|
|
|
1572
1653
|
outline: isNone(_effect.outline) ? void 0 : normalizeOutline(_effect.outline),
|
|
1573
1654
|
shadow: isNone(_effect.shadow) ? void 0 : normalizeShadow(_effect.shadow),
|
|
1574
1655
|
transform: isNone(_effect.transform) ? void 0 : _effect.transform,
|
|
1575
|
-
transformOrigin: _effect.transformOrigin
|
|
1656
|
+
transformOrigin: _effect.transformOrigin,
|
|
1657
|
+
filter: _effect.filter ? normalizeFilter(_effect.filter) : void 0
|
|
1576
1658
|
});
|
|
1577
1659
|
}
|
|
1578
1660
|
|
|
@@ -1582,18 +1664,14 @@ function normalizeForeground(foreground) {
|
|
|
1582
1664
|
...normalizeFill(foreground)
|
|
1583
1665
|
};
|
|
1584
1666
|
} else {
|
|
1585
|
-
return {
|
|
1667
|
+
return clearUndef({
|
|
1586
1668
|
...normalizeFill(foreground),
|
|
1587
|
-
...pick(foreground, ["fillWithShape"])
|
|
1588
|
-
|
|
1669
|
+
...pick(foreground, ["fillWithShape"]),
|
|
1670
|
+
effects: foreground.effects?.map(normalizeEffect)
|
|
1671
|
+
});
|
|
1589
1672
|
}
|
|
1590
1673
|
}
|
|
1591
1674
|
|
|
1592
|
-
const nanoid = () => {
|
|
1593
|
-
return nanoid$1(10);
|
|
1594
|
-
};
|
|
1595
|
-
const idGenerator = nanoid;
|
|
1596
|
-
|
|
1597
1675
|
function normalizeShape(shape) {
|
|
1598
1676
|
if (typeof shape === "string") {
|
|
1599
1677
|
if (shape.startsWith("<svg")) {
|
|
@@ -2036,6 +2114,7 @@ function normalizeElement(element) {
|
|
|
2036
2114
|
connection: isNone(element.connection) ? void 0 : normalizeConnection(element.connection),
|
|
2037
2115
|
table: isNone(element.table) ? void 0 : normalizeTable(element.table),
|
|
2038
2116
|
chart: isNone(element.chart) ? void 0 : normalizeChart(element.chart),
|
|
2117
|
+
comments: normalizeComments(element.comments),
|
|
2039
2118
|
...normalizeEffect(element),
|
|
2040
2119
|
children: element.children?.map((child) => normalizeElement(child))
|
|
2041
2120
|
});
|
|
@@ -2097,4 +2176,4 @@ function flatDocumentToDocument(flatDoc) {
|
|
|
2097
2176
|
return doc;
|
|
2098
2177
|
}
|
|
2099
2178
|
|
|
2100
|
-
export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, colorFillFields, defaultColor, defineProperty, effectFields, flatDocumentToDocument, getDeclarations, getDefaultBackgroundStyle, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOutlineStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, gradientFillFields, hasCRLF, idGenerator, imageFillFiedls, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeChart, normalizeColor, normalizeColorFill, normalizeConnection, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeNumber, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeStyle, normalizeTable, normalizeText, normalizeTextContent, normalizeTextDeformation, normalizeVideo, parseColor, parseGradient, pick, presetFillFiedls, property, property2, propertyOffsetFallback, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
|
|
2179
|
+
export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, colorFillFields, defaultColor, defineProperty, effectFields, flatDocumentToDocument, getDeclarations, getDefaultBackgroundStyle, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOutlineStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, gradientFillFields, hasCRLF, idGenerator, imageFillFiedls, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeChart, normalizeColor, normalizeColorFill, normalizeCommentMessage, normalizeCommentThread, normalizeComments, normalizeConnection, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFilter, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeNumber, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeStyle, normalizeTable, normalizeText, normalizeTextContent, normalizeTextDeformation, normalizeVideo, parseColor, parseGradient, pick, presetFillFiedls, property, property2, propertyOffsetFallback, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyFilter, stringifyGradient, textContentToString };
|