@open-feishu-card/adapter 0.3.6 → 0.3.8
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/custom-colors.d.ts +2 -0
- package/dist/custom-colors.d.ts.map +1 -1
- package/dist/expand-dsl-colors.d.ts +6 -1
- package/dist/expand-dsl-colors.d.ts.map +1 -1
- package/dist/index.cjs +122 -30
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +122 -31
- package/dist/normalize-stored-colors.d.ts +6 -3
- package/dist/normalize-stored-colors.d.ts.map +1 -1
- package/dist/raw-to-dsl.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/custom-colors.d.ts
CHANGED
|
@@ -23,4 +23,6 @@ export declare function resolveTextStyleCustomColorPair(textStyle: unknown): The
|
|
|
23
23
|
export declare function themePairToColorEntry(pair: ThemeColorPair): CustomColorEntry | undefined;
|
|
24
24
|
/** Light hex/rgba from column (or container) custom background, if any. */
|
|
25
25
|
export declare function resolveCustomBackgroundLight(property: unknown): string | undefined;
|
|
26
|
+
/** Light hex/rgba from interactive_container custom border color, if any. */
|
|
27
|
+
export declare function resolveCustomBorderLight(property: unknown): string | undefined;
|
|
26
28
|
//# sourceMappingURL=custom-colors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-colors.d.ts","sourceRoot":"","sources":["../src/custom-colors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGrE,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAOrE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAOpE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGvD;AAED,uEAAuE;AACvE,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAO5E;AAED,0FAA0F;AAC1F,wBAAgB,+BAA+B,CAAC,SAAS,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CAQ9F;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,cAAc,GAAG,gBAAgB,GAAG,SAAS,CAQxF;AAED,2EAA2E;AAC3E,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAKlF"}
|
|
1
|
+
{"version":3,"file":"custom-colors.d.ts","sourceRoot":"","sources":["../src/custom-colors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGrE,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAOrE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAOpE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGvD;AAED,uEAAuE;AACvE,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAO5E;AAED,0FAA0F;AAC1F,wBAAgB,+BAA+B,CAAC,SAAS,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CAQ9F;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,cAAc,GAAG,gBAAgB,GAAG,SAAS,CAQxF;AAED,2EAA2E;AAC3E,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAKlF;AAED,6EAA6E;AAC7E,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAK9E"}
|
|
@@ -17,7 +17,12 @@ export declare function expandBackgroundStyleAlias(style: unknown, registry: Col
|
|
|
17
17
|
} | undefined;
|
|
18
18
|
/** textStyle.color cus-N → customColor(去掉 color,避免被当成命名色) */
|
|
19
19
|
export declare function expandTextStyleColor(textStyle: TextStyle | undefined, registry: ColorRegistry): TextStyle | undefined;
|
|
20
|
-
/**
|
|
20
|
+
/** border_color / background_style 等 cus-N → customBackgroundStyle 形态(供 RAW 渲染器读取) */
|
|
21
|
+
export declare function expandColorAlias(style: unknown, registry: ColorRegistry): {
|
|
22
|
+
light_mode: string;
|
|
23
|
+
dark_mode: string;
|
|
24
|
+
} | undefined;
|
|
25
|
+
/** 递归展开 markdown / list 子树里的 cus-* 文字色 */
|
|
21
26
|
export declare function expandMarkdownElements(elements: CardElement[] | undefined, registry: ColorRegistry): CardElement[] | undefined;
|
|
22
27
|
/** markdown.font_color 且 content 无 <font> 时,包一层 font 再解析 */
|
|
23
28
|
export declare function wrapMarkdownContentWithFontColor(content: string, fontColor: string | undefined): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expand-dsl-colors.d.ts","sourceRoot":"","sources":["../src/expand-dsl-colors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEzD,MAAM,MAAM,gBAAgB,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AACzE,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAE7D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa,CAiB9E;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAElE;AAED,yEAAyE;AACzE,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,aAAa,GACtB;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAKvD;AAED,6DAA6D;AAC7D,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,SAAS,GAAG,SAAS,EAChC,QAAQ,EAAE,aAAa,GACtB,SAAS,GAAG,SAAS,CAWvB;AAED,
|
|
1
|
+
{"version":3,"file":"expand-dsl-colors.d.ts","sourceRoot":"","sources":["../src/expand-dsl-colors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEzD,MAAM,MAAM,gBAAgB,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AACzE,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAE7D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa,CAiB9E;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAElE;AAED,yEAAyE;AACzE,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,aAAa,GACtB;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAKvD;AAED,6DAA6D;AAC7D,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,SAAS,GAAG,SAAS,EAChC,QAAQ,EAAE,aAAa,GACtB,SAAS,GAAG,SAAS,CAWvB;AAED,sFAAsF;AACtF,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,aAAa,GACtB;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAEvD;AAED,0CAA0C;AAC1C,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,WAAW,EAAE,GAAG,SAAS,EACnC,QAAQ,EAAE,aAAa,GACtB,WAAW,EAAE,GAAG,SAAS,CAG3B;AAuCD,4DAA4D;AAC5D,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,MAAM,CAGR"}
|
package/dist/index.cjs
CHANGED
|
@@ -644,18 +644,38 @@ function expandTextStyleColor(textStyle, registry) {
|
|
|
644
644
|
}
|
|
645
645
|
function expandMarkdownElements(elements, registry) {
|
|
646
646
|
if (!Array.isArray(elements)) return elements;
|
|
647
|
-
return elements.map((el) =>
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
647
|
+
return elements.map((el) => expandMarkdownNode(el, registry));
|
|
648
|
+
}
|
|
649
|
+
function expandMarkdownNode(el, registry) {
|
|
650
|
+
const property = el.property ? { ...el.property } : void 0;
|
|
651
|
+
if (!property) return el;
|
|
652
|
+
let changed = property !== el.property;
|
|
653
|
+
if (Array.isArray(property.elements)) {
|
|
654
|
+
const next = expandMarkdownElements(property.elements, registry);
|
|
655
|
+
if (next !== property.elements) {
|
|
656
|
+
property.elements = next;
|
|
657
|
+
changed = true;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
if (Array.isArray(property.items)) {
|
|
661
|
+
property.items = property.items.map((item) => {
|
|
662
|
+
if (!item || typeof item !== "object") return item;
|
|
663
|
+
const row = item;
|
|
664
|
+
if (!Array.isArray(row.elements)) return item;
|
|
665
|
+
const next = expandMarkdownElements(row.elements, registry);
|
|
666
|
+
if (next === row.elements) return item;
|
|
667
|
+
return { ...row, elements: next };
|
|
668
|
+
});
|
|
669
|
+
changed = true;
|
|
670
|
+
}
|
|
671
|
+
if (property.textStyle) {
|
|
672
|
+
const expanded = expandTextStyleColor(property.textStyle, registry);
|
|
673
|
+
if (expanded && expanded !== property.textStyle) {
|
|
674
|
+
property.textStyle = expanded;
|
|
675
|
+
changed = true;
|
|
656
676
|
}
|
|
657
|
-
|
|
658
|
-
}
|
|
677
|
+
}
|
|
678
|
+
return changed ? { ...el, property } : el;
|
|
659
679
|
}
|
|
660
680
|
function wrapMarkdownContentWithFontColor(content, fontColor) {
|
|
661
681
|
if (!fontColor || !content || /<font\s+color/i.test(content)) return content;
|
|
@@ -830,6 +850,18 @@ function buildProperty(el, tag, colors) {
|
|
|
830
850
|
if (expanded) property.customBackgroundStyle = expanded;
|
|
831
851
|
continue;
|
|
832
852
|
}
|
|
853
|
+
if ((k === "border_color" || k === "borderColor") && tag === "interactive_container") {
|
|
854
|
+
const renamed = renameKey(k);
|
|
855
|
+
property[renamed] = v;
|
|
856
|
+
const expanded = expandBackgroundStyleAlias(v, colors);
|
|
857
|
+
if (expanded) {
|
|
858
|
+
property.customBorderColor = {
|
|
859
|
+
lightMode: expanded.light_mode,
|
|
860
|
+
darkMode: expanded.dark_mode
|
|
861
|
+
};
|
|
862
|
+
}
|
|
863
|
+
continue;
|
|
864
|
+
}
|
|
833
865
|
if (tag === "column" && k === "width" && typeof v === "string") {
|
|
834
866
|
const px = pxValue(v);
|
|
835
867
|
if (px != null) {
|
|
@@ -953,18 +985,19 @@ function isRecord2(v) {
|
|
|
953
985
|
|
|
954
986
|
// src/normalize-stored-colors.ts
|
|
955
987
|
function createColorRegistry() {
|
|
956
|
-
return { entries: {},
|
|
988
|
+
return { entries: {}, bgKeyToAlias: /* @__PURE__ */ new Map(), textKeyToAlias: /* @__PURE__ */ new Map(), bgSeq: 0, textSeq: 0 };
|
|
957
989
|
}
|
|
958
990
|
function colorEntryKey(entry) {
|
|
959
991
|
return `${entry.light_mode}|${entry.dark_mode}`;
|
|
960
992
|
}
|
|
961
993
|
function registerColorEntry(registry, entry, prefix) {
|
|
962
994
|
const key = colorEntryKey(entry);
|
|
963
|
-
const
|
|
995
|
+
const map = prefix === "cus-bg" ? registry.bgKeyToAlias : registry.textKeyToAlias;
|
|
996
|
+
const existing = map.get(key);
|
|
964
997
|
if (existing) return existing;
|
|
965
998
|
const alias = prefix === "cus-bg" ? `cus-bg-${registry.bgSeq++}` : `cus-text-${registry.textSeq++}`;
|
|
966
999
|
registry.entries[alias] = entry;
|
|
967
|
-
|
|
1000
|
+
map.set(key, alias);
|
|
968
1001
|
return alias;
|
|
969
1002
|
}
|
|
970
1003
|
function hexColorToRgba(hex) {
|
|
@@ -984,29 +1017,36 @@ function hexColorToRgba(hex) {
|
|
|
984
1017
|
}
|
|
985
1018
|
return void 0;
|
|
986
1019
|
}
|
|
987
|
-
function
|
|
988
|
-
const raw = node.custom_background_style;
|
|
1020
|
+
function readThemeColorPair(raw) {
|
|
989
1021
|
if (!raw || typeof raw !== "object") return void 0;
|
|
990
1022
|
const o = raw;
|
|
991
|
-
const lightRaw = typeof o.light_mode === "string" ? o.light_mode : void 0;
|
|
992
|
-
const darkRaw = typeof o.dark_mode === "string" ? o.dark_mode : void 0;
|
|
1023
|
+
const lightRaw = typeof o.light_mode === "string" ? o.light_mode : typeof o.lightMode === "string" ? o.lightMode : void 0;
|
|
1024
|
+
const darkRaw = typeof o.dark_mode === "string" ? o.dark_mode : typeof o.darkMode === "string" ? o.darkMode : void 0;
|
|
993
1025
|
if (!lightRaw || !darkRaw) return void 0;
|
|
994
1026
|
const light = lightRaw.startsWith("#") ? hexColorToRgba(lightRaw) : lightRaw;
|
|
995
1027
|
const dark = darkRaw.startsWith("#") ? hexColorToRgba(darkRaw) : darkRaw;
|
|
996
1028
|
if (!light || !dark) return void 0;
|
|
997
1029
|
return { light_mode: light, dark_mode: dark };
|
|
998
1030
|
}
|
|
1031
|
+
function readCustomBackgroundStyle(node) {
|
|
1032
|
+
return readThemeColorPair(node.custom_background_style);
|
|
1033
|
+
}
|
|
1034
|
+
function readCustomBorderColor(node) {
|
|
1035
|
+
return readThemeColorPair(node.custom_border_color ?? node.customBorderColor);
|
|
1036
|
+
}
|
|
999
1037
|
function normalizeStoredCardColors(dsl, preRegistered) {
|
|
1000
1038
|
const colorEntries = { ...preRegistered?.entries ?? {} };
|
|
1001
|
-
const
|
|
1039
|
+
const bgKeyToAlias = new Map(preRegistered?.bgKeyToAlias ?? []);
|
|
1040
|
+
const textKeyToAlias = new Map(preRegistered?.textKeyToAlias ?? []);
|
|
1002
1041
|
let bgSeq = preRegistered?.bgSeq ?? 0;
|
|
1003
1042
|
let textSeq = preRegistered?.textSeq ?? 0;
|
|
1004
1043
|
const ensureAlias = (prefix, entry) => {
|
|
1005
|
-
const
|
|
1044
|
+
const map = prefix === "cus-bg" ? bgKeyToAlias : textKeyToAlias;
|
|
1045
|
+
const existing2 = map.get(colorEntryKey(entry));
|
|
1006
1046
|
if (existing2) return existing2;
|
|
1007
1047
|
const alias = prefix === "cus-bg" ? `cus-bg-${bgSeq++}` : `cus-text-${textSeq++}`;
|
|
1008
1048
|
colorEntries[alias] = entry;
|
|
1009
|
-
|
|
1049
|
+
map.set(colorEntryKey(entry), alias);
|
|
1010
1050
|
return alias;
|
|
1011
1051
|
};
|
|
1012
1052
|
const walk = (node) => {
|
|
@@ -1023,6 +1063,14 @@ function normalizeStoredCardColors(dsl, preRegistered) {
|
|
|
1023
1063
|
delete obj.custom_background_style;
|
|
1024
1064
|
}
|
|
1025
1065
|
}
|
|
1066
|
+
if (obj.tag === "interactive_container") {
|
|
1067
|
+
const border = readCustomBorderColor(obj);
|
|
1068
|
+
if (border) {
|
|
1069
|
+
obj.border_color = ensureAlias("cus-bg", border);
|
|
1070
|
+
delete obj.custom_border_color;
|
|
1071
|
+
delete obj.customBorderColor;
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1026
1074
|
if (obj.tag === "markdown" && typeof obj.content === "string") {
|
|
1027
1075
|
normalizeMarkdownInlineHexColors(obj, ensureAlias, !!preRegistered);
|
|
1028
1076
|
}
|
|
@@ -1067,11 +1115,17 @@ function normalizeStoredCardColors(dsl, preRegistered) {
|
|
|
1067
1115
|
}
|
|
1068
1116
|
if (!node || typeof node !== "object") return;
|
|
1069
1117
|
const obj = node;
|
|
1070
|
-
if (obj.tag === "markdown" && obj.
|
|
1071
|
-
|
|
1072
|
-
const content =
|
|
1073
|
-
if (
|
|
1074
|
-
|
|
1118
|
+
if (obj.tag === "markdown" && typeof obj.content === "string") {
|
|
1119
|
+
delete obj.font_color;
|
|
1120
|
+
const content = obj.content;
|
|
1121
|
+
if (!/<font\s+color=/i.test(content)) {
|
|
1122
|
+
const size = obj.text_size;
|
|
1123
|
+
if (size === "small") {
|
|
1124
|
+
obj.content = wrapMarkdownContentWithFontColor(content, "cus-muted");
|
|
1125
|
+
} else if (size === "heading" || content.includes("**")) {
|
|
1126
|
+
obj.content = wrapMarkdownContentWithFontColor(content, "cus-accent");
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1075
1129
|
}
|
|
1076
1130
|
for (const value of Object.values(obj)) applyDefaultFontColors(value);
|
|
1077
1131
|
};
|
|
@@ -1136,8 +1190,8 @@ function normalizeMarkdownInlineHexColors(obj, ensureAlias, keepFontTags = false
|
|
|
1136
1190
|
const entry = hexColor(single[1]);
|
|
1137
1191
|
if (entry) {
|
|
1138
1192
|
const alias = ensureAlias("cus-text", entry);
|
|
1139
|
-
|
|
1140
|
-
obj.content = single[2]
|
|
1193
|
+
delete obj.font_color;
|
|
1194
|
+
obj.content = `<font color='${alias}'>${single[2]}</font>`;
|
|
1141
1195
|
return;
|
|
1142
1196
|
}
|
|
1143
1197
|
}
|
|
@@ -1202,6 +1256,12 @@ function resolveCustomBackgroundLight(property) {
|
|
|
1202
1256
|
const custom = p.custom_background_style ?? p.customBackgroundStyle;
|
|
1203
1257
|
return readThemeColorLight(custom);
|
|
1204
1258
|
}
|
|
1259
|
+
function resolveCustomBorderLight(property) {
|
|
1260
|
+
if (!property || typeof property !== "object") return void 0;
|
|
1261
|
+
const p = property;
|
|
1262
|
+
const custom = p.custom_border_color ?? p.customBorderColor;
|
|
1263
|
+
return readThemeColorLight(custom);
|
|
1264
|
+
}
|
|
1205
1265
|
|
|
1206
1266
|
// src/raw-to-dsl.ts
|
|
1207
1267
|
function isRawCardEnvelope(value) {
|
|
@@ -1321,8 +1381,39 @@ function convertRoot(root, ctx) {
|
|
|
1321
1381
|
normalizeStoredCardColors(out, ctx.colors);
|
|
1322
1382
|
return out;
|
|
1323
1383
|
}
|
|
1324
|
-
function convertConfig(
|
|
1325
|
-
|
|
1384
|
+
function convertConfig(node) {
|
|
1385
|
+
const out = { update_multi: true };
|
|
1386
|
+
if (node.streamingMode === true || node.streaming_mode === true) {
|
|
1387
|
+
out.streaming_mode = true;
|
|
1388
|
+
}
|
|
1389
|
+
if (node.enableForwardInteraction === true || node.enable_forward_interaction === true) {
|
|
1390
|
+
out.enable_forward_interaction = true;
|
|
1391
|
+
}
|
|
1392
|
+
if (node.enableForward === false || node.enable_forward === false) {
|
|
1393
|
+
out.enable_forward = false;
|
|
1394
|
+
}
|
|
1395
|
+
if (typeof node.widthMode === "string") out.width_mode = node.widthMode;
|
|
1396
|
+
else if (typeof node.width_mode === "string") out.width_mode = node.width_mode;
|
|
1397
|
+
const summaryRaw = isRecord3(node.summary) ? node.summary : void 0;
|
|
1398
|
+
if (summaryRaw) {
|
|
1399
|
+
const summary = {};
|
|
1400
|
+
if (typeof summaryRaw.content === "string") summary.content = summaryRaw.content;
|
|
1401
|
+
if (isRecord3(summaryRaw.i18nContent)) summary.i18n_content = summaryRaw.i18nContent;
|
|
1402
|
+
else if (isRecord3(summaryRaw.i18n_content)) summary.i18n_content = summaryRaw.i18n_content;
|
|
1403
|
+
if (Object.keys(summary).length) out.summary = summary;
|
|
1404
|
+
}
|
|
1405
|
+
const streamingRaw = isRecord3(node.streamingConfig) ? node.streamingConfig : isRecord3(node.streaming_config) ? node.streaming_config : void 0;
|
|
1406
|
+
if (streamingRaw) {
|
|
1407
|
+
const sc = {};
|
|
1408
|
+
if (streamingRaw.printStrategy != null) sc.print_strategy = streamingRaw.printStrategy;
|
|
1409
|
+
else if (streamingRaw.print_strategy != null) sc.print_strategy = streamingRaw.print_strategy;
|
|
1410
|
+
if (streamingRaw.printFrequencyMs != null) sc.print_frequency_ms = streamingRaw.printFrequencyMs;
|
|
1411
|
+
else if (streamingRaw.print_frequency_ms != null) sc.print_frequency_ms = streamingRaw.print_frequency_ms;
|
|
1412
|
+
if (streamingRaw.printStep != null) sc.print_step = streamingRaw.printStep;
|
|
1413
|
+
else if (streamingRaw.print_step != null) sc.print_step = streamingRaw.print_step;
|
|
1414
|
+
if (Object.keys(sc).length) out.streaming_config = sc;
|
|
1415
|
+
}
|
|
1416
|
+
return out;
|
|
1326
1417
|
}
|
|
1327
1418
|
function convertHeader2(node, ctx) {
|
|
1328
1419
|
const property = isRecord3(node.property) ? node.property : node;
|
|
@@ -2238,6 +2329,7 @@ exports.readThemeColorDark = readThemeColorDark;
|
|
|
2238
2329
|
exports.readThemeColorLight = readThemeColorLight;
|
|
2239
2330
|
exports.registerColorEntry = registerColorEntry;
|
|
2240
2331
|
exports.resolveCustomBackgroundLight = resolveCustomBackgroundLight;
|
|
2332
|
+
exports.resolveCustomBorderLight = resolveCustomBorderLight;
|
|
2241
2333
|
exports.resolveTextStyleColor = resolveTextStyleColor;
|
|
2242
2334
|
exports.resolveTextStyleCustomColorPair = resolveTextStyleCustomColorPair;
|
|
2243
2335
|
exports.themePairToColorEntry = themePairToColorEntry;
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { dslToRaw } from './dsl-to-raw.js';
|
|
|
10
10
|
export { rawToDsl, rawCardToDsl, isRawCardEnvelope, degradeUnknown, } from './raw-to-dsl.js';
|
|
11
11
|
export { normalizeStoredCardColors, createColorRegistry, registerColorEntry } from './normalize-stored-colors.js';
|
|
12
12
|
export type { CustomColorEntry } from './normalize-stored-colors.js';
|
|
13
|
-
export { readThemeColorLight, readThemeColorDark, resolveCustomBackgroundLight, resolveTextStyleColor, resolveTextStyleCustomColorPair, themePairToColorEntry, isCustomHexColor, } from './custom-colors.js';
|
|
13
|
+
export { readThemeColorLight, readThemeColorDark, resolveCustomBackgroundLight, resolveCustomBorderLight, resolveTextStyleColor, resolveTextStyleCustomColorPair, themePairToColorEntry, isCustomHexColor, } from './custom-colors.js';
|
|
14
14
|
export type { ThemeColorPair } from './custom-colors.js';
|
|
15
15
|
export type { CardElement, ElementProperty, JsonCard } from './types.js';
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClH,YAAY,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,4BAA4B,EAC5B,qBAAqB,EACrB,+BAA+B,EAC/B,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClH,YAAY,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,4BAA4B,EAC5B,wBAAwB,EACxB,qBAAqB,EACrB,+BAA+B,EAC/B,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -642,18 +642,38 @@ function expandTextStyleColor(textStyle, registry) {
|
|
|
642
642
|
}
|
|
643
643
|
function expandMarkdownElements(elements, registry) {
|
|
644
644
|
if (!Array.isArray(elements)) return elements;
|
|
645
|
-
return elements.map((el) =>
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
645
|
+
return elements.map((el) => expandMarkdownNode(el, registry));
|
|
646
|
+
}
|
|
647
|
+
function expandMarkdownNode(el, registry) {
|
|
648
|
+
const property = el.property ? { ...el.property } : void 0;
|
|
649
|
+
if (!property) return el;
|
|
650
|
+
let changed = property !== el.property;
|
|
651
|
+
if (Array.isArray(property.elements)) {
|
|
652
|
+
const next = expandMarkdownElements(property.elements, registry);
|
|
653
|
+
if (next !== property.elements) {
|
|
654
|
+
property.elements = next;
|
|
655
|
+
changed = true;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
if (Array.isArray(property.items)) {
|
|
659
|
+
property.items = property.items.map((item) => {
|
|
660
|
+
if (!item || typeof item !== "object") return item;
|
|
661
|
+
const row = item;
|
|
662
|
+
if (!Array.isArray(row.elements)) return item;
|
|
663
|
+
const next = expandMarkdownElements(row.elements, registry);
|
|
664
|
+
if (next === row.elements) return item;
|
|
665
|
+
return { ...row, elements: next };
|
|
666
|
+
});
|
|
667
|
+
changed = true;
|
|
668
|
+
}
|
|
669
|
+
if (property.textStyle) {
|
|
670
|
+
const expanded = expandTextStyleColor(property.textStyle, registry);
|
|
671
|
+
if (expanded && expanded !== property.textStyle) {
|
|
672
|
+
property.textStyle = expanded;
|
|
673
|
+
changed = true;
|
|
654
674
|
}
|
|
655
|
-
|
|
656
|
-
}
|
|
675
|
+
}
|
|
676
|
+
return changed ? { ...el, property } : el;
|
|
657
677
|
}
|
|
658
678
|
function wrapMarkdownContentWithFontColor(content, fontColor) {
|
|
659
679
|
if (!fontColor || !content || /<font\s+color/i.test(content)) return content;
|
|
@@ -828,6 +848,18 @@ function buildProperty(el, tag, colors) {
|
|
|
828
848
|
if (expanded) property.customBackgroundStyle = expanded;
|
|
829
849
|
continue;
|
|
830
850
|
}
|
|
851
|
+
if ((k === "border_color" || k === "borderColor") && tag === "interactive_container") {
|
|
852
|
+
const renamed = renameKey(k);
|
|
853
|
+
property[renamed] = v;
|
|
854
|
+
const expanded = expandBackgroundStyleAlias(v, colors);
|
|
855
|
+
if (expanded) {
|
|
856
|
+
property.customBorderColor = {
|
|
857
|
+
lightMode: expanded.light_mode,
|
|
858
|
+
darkMode: expanded.dark_mode
|
|
859
|
+
};
|
|
860
|
+
}
|
|
861
|
+
continue;
|
|
862
|
+
}
|
|
831
863
|
if (tag === "column" && k === "width" && typeof v === "string") {
|
|
832
864
|
const px = pxValue(v);
|
|
833
865
|
if (px != null) {
|
|
@@ -951,18 +983,19 @@ function isRecord2(v) {
|
|
|
951
983
|
|
|
952
984
|
// src/normalize-stored-colors.ts
|
|
953
985
|
function createColorRegistry() {
|
|
954
|
-
return { entries: {},
|
|
986
|
+
return { entries: {}, bgKeyToAlias: /* @__PURE__ */ new Map(), textKeyToAlias: /* @__PURE__ */ new Map(), bgSeq: 0, textSeq: 0 };
|
|
955
987
|
}
|
|
956
988
|
function colorEntryKey(entry) {
|
|
957
989
|
return `${entry.light_mode}|${entry.dark_mode}`;
|
|
958
990
|
}
|
|
959
991
|
function registerColorEntry(registry, entry, prefix) {
|
|
960
992
|
const key = colorEntryKey(entry);
|
|
961
|
-
const
|
|
993
|
+
const map = prefix === "cus-bg" ? registry.bgKeyToAlias : registry.textKeyToAlias;
|
|
994
|
+
const existing = map.get(key);
|
|
962
995
|
if (existing) return existing;
|
|
963
996
|
const alias = prefix === "cus-bg" ? `cus-bg-${registry.bgSeq++}` : `cus-text-${registry.textSeq++}`;
|
|
964
997
|
registry.entries[alias] = entry;
|
|
965
|
-
|
|
998
|
+
map.set(key, alias);
|
|
966
999
|
return alias;
|
|
967
1000
|
}
|
|
968
1001
|
function hexColorToRgba(hex) {
|
|
@@ -982,29 +1015,36 @@ function hexColorToRgba(hex) {
|
|
|
982
1015
|
}
|
|
983
1016
|
return void 0;
|
|
984
1017
|
}
|
|
985
|
-
function
|
|
986
|
-
const raw = node.custom_background_style;
|
|
1018
|
+
function readThemeColorPair(raw) {
|
|
987
1019
|
if (!raw || typeof raw !== "object") return void 0;
|
|
988
1020
|
const o = raw;
|
|
989
|
-
const lightRaw = typeof o.light_mode === "string" ? o.light_mode : void 0;
|
|
990
|
-
const darkRaw = typeof o.dark_mode === "string" ? o.dark_mode : void 0;
|
|
1021
|
+
const lightRaw = typeof o.light_mode === "string" ? o.light_mode : typeof o.lightMode === "string" ? o.lightMode : void 0;
|
|
1022
|
+
const darkRaw = typeof o.dark_mode === "string" ? o.dark_mode : typeof o.darkMode === "string" ? o.darkMode : void 0;
|
|
991
1023
|
if (!lightRaw || !darkRaw) return void 0;
|
|
992
1024
|
const light = lightRaw.startsWith("#") ? hexColorToRgba(lightRaw) : lightRaw;
|
|
993
1025
|
const dark = darkRaw.startsWith("#") ? hexColorToRgba(darkRaw) : darkRaw;
|
|
994
1026
|
if (!light || !dark) return void 0;
|
|
995
1027
|
return { light_mode: light, dark_mode: dark };
|
|
996
1028
|
}
|
|
1029
|
+
function readCustomBackgroundStyle(node) {
|
|
1030
|
+
return readThemeColorPair(node.custom_background_style);
|
|
1031
|
+
}
|
|
1032
|
+
function readCustomBorderColor(node) {
|
|
1033
|
+
return readThemeColorPair(node.custom_border_color ?? node.customBorderColor);
|
|
1034
|
+
}
|
|
997
1035
|
function normalizeStoredCardColors(dsl, preRegistered) {
|
|
998
1036
|
const colorEntries = { ...preRegistered?.entries ?? {} };
|
|
999
|
-
const
|
|
1037
|
+
const bgKeyToAlias = new Map(preRegistered?.bgKeyToAlias ?? []);
|
|
1038
|
+
const textKeyToAlias = new Map(preRegistered?.textKeyToAlias ?? []);
|
|
1000
1039
|
let bgSeq = preRegistered?.bgSeq ?? 0;
|
|
1001
1040
|
let textSeq = preRegistered?.textSeq ?? 0;
|
|
1002
1041
|
const ensureAlias = (prefix, entry) => {
|
|
1003
|
-
const
|
|
1042
|
+
const map = prefix === "cus-bg" ? bgKeyToAlias : textKeyToAlias;
|
|
1043
|
+
const existing2 = map.get(colorEntryKey(entry));
|
|
1004
1044
|
if (existing2) return existing2;
|
|
1005
1045
|
const alias = prefix === "cus-bg" ? `cus-bg-${bgSeq++}` : `cus-text-${textSeq++}`;
|
|
1006
1046
|
colorEntries[alias] = entry;
|
|
1007
|
-
|
|
1047
|
+
map.set(colorEntryKey(entry), alias);
|
|
1008
1048
|
return alias;
|
|
1009
1049
|
};
|
|
1010
1050
|
const walk = (node) => {
|
|
@@ -1021,6 +1061,14 @@ function normalizeStoredCardColors(dsl, preRegistered) {
|
|
|
1021
1061
|
delete obj.custom_background_style;
|
|
1022
1062
|
}
|
|
1023
1063
|
}
|
|
1064
|
+
if (obj.tag === "interactive_container") {
|
|
1065
|
+
const border = readCustomBorderColor(obj);
|
|
1066
|
+
if (border) {
|
|
1067
|
+
obj.border_color = ensureAlias("cus-bg", border);
|
|
1068
|
+
delete obj.custom_border_color;
|
|
1069
|
+
delete obj.customBorderColor;
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1024
1072
|
if (obj.tag === "markdown" && typeof obj.content === "string") {
|
|
1025
1073
|
normalizeMarkdownInlineHexColors(obj, ensureAlias, !!preRegistered);
|
|
1026
1074
|
}
|
|
@@ -1065,11 +1113,17 @@ function normalizeStoredCardColors(dsl, preRegistered) {
|
|
|
1065
1113
|
}
|
|
1066
1114
|
if (!node || typeof node !== "object") return;
|
|
1067
1115
|
const obj = node;
|
|
1068
|
-
if (obj.tag === "markdown" && obj.
|
|
1069
|
-
|
|
1070
|
-
const content =
|
|
1071
|
-
if (
|
|
1072
|
-
|
|
1116
|
+
if (obj.tag === "markdown" && typeof obj.content === "string") {
|
|
1117
|
+
delete obj.font_color;
|
|
1118
|
+
const content = obj.content;
|
|
1119
|
+
if (!/<font\s+color=/i.test(content)) {
|
|
1120
|
+
const size = obj.text_size;
|
|
1121
|
+
if (size === "small") {
|
|
1122
|
+
obj.content = wrapMarkdownContentWithFontColor(content, "cus-muted");
|
|
1123
|
+
} else if (size === "heading" || content.includes("**")) {
|
|
1124
|
+
obj.content = wrapMarkdownContentWithFontColor(content, "cus-accent");
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1073
1127
|
}
|
|
1074
1128
|
for (const value of Object.values(obj)) applyDefaultFontColors(value);
|
|
1075
1129
|
};
|
|
@@ -1134,8 +1188,8 @@ function normalizeMarkdownInlineHexColors(obj, ensureAlias, keepFontTags = false
|
|
|
1134
1188
|
const entry = hexColor(single[1]);
|
|
1135
1189
|
if (entry) {
|
|
1136
1190
|
const alias = ensureAlias("cus-text", entry);
|
|
1137
|
-
|
|
1138
|
-
obj.content = single[2]
|
|
1191
|
+
delete obj.font_color;
|
|
1192
|
+
obj.content = `<font color='${alias}'>${single[2]}</font>`;
|
|
1139
1193
|
return;
|
|
1140
1194
|
}
|
|
1141
1195
|
}
|
|
@@ -1200,6 +1254,12 @@ function resolveCustomBackgroundLight(property) {
|
|
|
1200
1254
|
const custom = p.custom_background_style ?? p.customBackgroundStyle;
|
|
1201
1255
|
return readThemeColorLight(custom);
|
|
1202
1256
|
}
|
|
1257
|
+
function resolveCustomBorderLight(property) {
|
|
1258
|
+
if (!property || typeof property !== "object") return void 0;
|
|
1259
|
+
const p = property;
|
|
1260
|
+
const custom = p.custom_border_color ?? p.customBorderColor;
|
|
1261
|
+
return readThemeColorLight(custom);
|
|
1262
|
+
}
|
|
1203
1263
|
|
|
1204
1264
|
// src/raw-to-dsl.ts
|
|
1205
1265
|
function isRawCardEnvelope(value) {
|
|
@@ -1319,8 +1379,39 @@ function convertRoot(root, ctx) {
|
|
|
1319
1379
|
normalizeStoredCardColors(out, ctx.colors);
|
|
1320
1380
|
return out;
|
|
1321
1381
|
}
|
|
1322
|
-
function convertConfig(
|
|
1323
|
-
|
|
1382
|
+
function convertConfig(node) {
|
|
1383
|
+
const out = { update_multi: true };
|
|
1384
|
+
if (node.streamingMode === true || node.streaming_mode === true) {
|
|
1385
|
+
out.streaming_mode = true;
|
|
1386
|
+
}
|
|
1387
|
+
if (node.enableForwardInteraction === true || node.enable_forward_interaction === true) {
|
|
1388
|
+
out.enable_forward_interaction = true;
|
|
1389
|
+
}
|
|
1390
|
+
if (node.enableForward === false || node.enable_forward === false) {
|
|
1391
|
+
out.enable_forward = false;
|
|
1392
|
+
}
|
|
1393
|
+
if (typeof node.widthMode === "string") out.width_mode = node.widthMode;
|
|
1394
|
+
else if (typeof node.width_mode === "string") out.width_mode = node.width_mode;
|
|
1395
|
+
const summaryRaw = isRecord3(node.summary) ? node.summary : void 0;
|
|
1396
|
+
if (summaryRaw) {
|
|
1397
|
+
const summary = {};
|
|
1398
|
+
if (typeof summaryRaw.content === "string") summary.content = summaryRaw.content;
|
|
1399
|
+
if (isRecord3(summaryRaw.i18nContent)) summary.i18n_content = summaryRaw.i18nContent;
|
|
1400
|
+
else if (isRecord3(summaryRaw.i18n_content)) summary.i18n_content = summaryRaw.i18n_content;
|
|
1401
|
+
if (Object.keys(summary).length) out.summary = summary;
|
|
1402
|
+
}
|
|
1403
|
+
const streamingRaw = isRecord3(node.streamingConfig) ? node.streamingConfig : isRecord3(node.streaming_config) ? node.streaming_config : void 0;
|
|
1404
|
+
if (streamingRaw) {
|
|
1405
|
+
const sc = {};
|
|
1406
|
+
if (streamingRaw.printStrategy != null) sc.print_strategy = streamingRaw.printStrategy;
|
|
1407
|
+
else if (streamingRaw.print_strategy != null) sc.print_strategy = streamingRaw.print_strategy;
|
|
1408
|
+
if (streamingRaw.printFrequencyMs != null) sc.print_frequency_ms = streamingRaw.printFrequencyMs;
|
|
1409
|
+
else if (streamingRaw.print_frequency_ms != null) sc.print_frequency_ms = streamingRaw.print_frequency_ms;
|
|
1410
|
+
if (streamingRaw.printStep != null) sc.print_step = streamingRaw.printStep;
|
|
1411
|
+
else if (streamingRaw.print_step != null) sc.print_step = streamingRaw.print_step;
|
|
1412
|
+
if (Object.keys(sc).length) out.streaming_config = sc;
|
|
1413
|
+
}
|
|
1414
|
+
return out;
|
|
1324
1415
|
}
|
|
1325
1416
|
function convertHeader2(node, ctx) {
|
|
1326
1417
|
const property = isRecord3(node.property) ? node.property : node;
|
|
@@ -2224,4 +2315,4 @@ function degradeUnknown(el) {
|
|
|
2224
2315
|
return { tag: "unknown", raw_tag: rawTag, fallback: el };
|
|
2225
2316
|
}
|
|
2226
2317
|
|
|
2227
|
-
export { createColorRegistry, degradeUnknown, dslToRaw, isCustomHexColor, isRawCardEnvelope, normalizeStoredCardColors, rawCardToDsl, rawToDsl, readThemeColorDark, readThemeColorLight, registerColorEntry, resolveCustomBackgroundLight, resolveTextStyleColor, resolveTextStyleCustomColorPair, themePairToColorEntry };
|
|
2318
|
+
export { createColorRegistry, degradeUnknown, dslToRaw, isCustomHexColor, isRawCardEnvelope, normalizeStoredCardColors, rawCardToDsl, rawToDsl, readThemeColorDark, readThemeColorLight, registerColorEntry, resolveCustomBackgroundLight, resolveCustomBorderLight, resolveTextStyleColor, resolveTextStyleCustomColorPair, themePairToColorEntry };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 飞书存储卡片时会将 config.style.color 的 cus-N 展开为 custom_background_style(#RRGGBBAA),
|
|
3
|
-
* 并丢弃 config.style 与 markdown
|
|
3
|
+
* 并丢弃 config.style 与 markdown 内联字色。回读底稿后须 normalize,否则 modify 再发会丢色。
|
|
4
|
+
* 公开 DSL 用 content 内 <font color='cus-N'> 表达字色(飞书发送接口不接受 markdown.font_color)。
|
|
4
5
|
*/
|
|
5
6
|
export type CustomColorEntry = {
|
|
6
7
|
light_mode: string;
|
|
@@ -8,7 +9,9 @@ export type CustomColorEntry = {
|
|
|
8
9
|
};
|
|
9
10
|
export type ColorRegistry = {
|
|
10
11
|
entries: Record<string, CustomColorEntry>;
|
|
11
|
-
|
|
12
|
+
/** 背景/边框等同色复用 cus-bg-N,与文字 cus-text-N 分表,避免串 alias */
|
|
13
|
+
bgKeyToAlias: Map<string, string>;
|
|
14
|
+
textKeyToAlias: Map<string, string>;
|
|
12
15
|
bgSeq: number;
|
|
13
16
|
textSeq: number;
|
|
14
17
|
};
|
|
@@ -18,7 +21,7 @@ export declare function registerColorEntry(registry: ColorRegistry, entry: Custo
|
|
|
18
21
|
export declare function hexColorToRgba(hex: string): string | undefined;
|
|
19
22
|
/**
|
|
20
23
|
* 将飞书回读的 custom_background_style 还原为可再次发送的 background_style cus-N + config.style.color。
|
|
21
|
-
* 若 markdown
|
|
24
|
+
* 若 markdown 缺少内联字色,按 text_size / 加粗内容补 <font color='cus-accent'|'cus-muted'>(飞书回读会丢字色)。
|
|
22
25
|
* rawToDsl 可传入已登记的文字自定义色(preRegistered),与背景色一并写入 config.style.color。
|
|
23
26
|
*/
|
|
24
27
|
export declare function normalizeStoredCardColors(dsl: Record<string, unknown>, preRegistered?: ColorRegistry): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-stored-colors.d.ts","sourceRoot":"","sources":["../src/normalize-stored-colors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"normalize-stored-colors.d.ts","sourceRoot":"","sources":["../src/normalize-stored-colors.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,MAAM,MAAM,gBAAgB,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzE,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC1C,sDAAsD;IACtD,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,aAAa,CAEnD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAE7D;AAED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,QAAQ,GAAG,UAAU,GAC5B,MAAM,CAWR;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgB9D;AA0BD;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,aAAa,CAAC,EAAE,aAAa,GAC5B,IAAI,CAoHN"}
|
package/dist/raw-to-dsl.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"raw-to-dsl.d.ts","sourceRoot":"","sources":["../src/raw-to-dsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAwBH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAIzD;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAcvD;
|
|
1
|
+
{"version":3,"file":"raw-to-dsl.d.ts","sourceRoot":"","sources":["../src/raw-to-dsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAwBH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAIzD;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAcvD;AAylDD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CA8C9C;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAGnF"}
|