@open-feishu-card/adapter 0.3.11 → 0.3.12
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/dsl-to-raw.d.ts.map +1 -1
- package/dist/index.cjs +38 -1
- package/dist/index.js +38 -1
- package/dist/raw-to-dsl.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/dsl-to-raw.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dsl-to-raw.d.ts","sourceRoot":"","sources":["../src/dsl-to-raw.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAgC,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"dsl-to-raw.d.ts","sourceRoot":"","sources":["../src/dsl-to-raw.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAgC,QAAQ,EAAE,MAAM,YAAY,CAAC;AAmDzE,gCAAgC;AAChC,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,QAAQ,CAW/C"}
|
package/dist/index.cjs
CHANGED
|
@@ -698,6 +698,9 @@ var KEY_RENAME = {
|
|
|
698
698
|
tag_style: "tagStyle",
|
|
699
699
|
scale_type: "scaleType",
|
|
700
700
|
drop_invalid_user_id: "dropInvalidUserID",
|
|
701
|
+
// avatar
|
|
702
|
+
custom_size: "customSize",
|
|
703
|
+
custom_size2: "customSize2",
|
|
701
704
|
// video / audio
|
|
702
705
|
file_key: "fileID",
|
|
703
706
|
audio_id: "audioID",
|
|
@@ -706,7 +709,15 @@ var KEY_RENAME = {
|
|
|
706
709
|
enable_download: "enableDownload",
|
|
707
710
|
fill_color: "fillColor"
|
|
708
711
|
};
|
|
709
|
-
var TEXT_LEAF_KEYS = /* @__PURE__ */ new Set([
|
|
712
|
+
var TEXT_LEAF_KEYS = /* @__PURE__ */ new Set([
|
|
713
|
+
"title",
|
|
714
|
+
"subtitle",
|
|
715
|
+
"alt",
|
|
716
|
+
"hover_tips",
|
|
717
|
+
"placeholder",
|
|
718
|
+
"notation",
|
|
719
|
+
"disabled_tips"
|
|
720
|
+
]);
|
|
710
721
|
function dslToRaw(dsl) {
|
|
711
722
|
const root = isRecord2(dsl) ? dsl : {};
|
|
712
723
|
const card = unwrapCard(root);
|
|
@@ -767,6 +778,12 @@ function convertEl(el, colors) {
|
|
|
767
778
|
}
|
|
768
779
|
return { tag: "person_v1", property };
|
|
769
780
|
}
|
|
781
|
+
if (tag === "avatar") {
|
|
782
|
+
return { tag: "avatar", property: buildProperty(el, "avatar", colors) };
|
|
783
|
+
}
|
|
784
|
+
if (tag === "picker_date") {
|
|
785
|
+
return { tag: "date_picker", property: buildProperty(el, "date_picker", colors) };
|
|
786
|
+
}
|
|
770
787
|
if (tag === "markdown" || tag === "lark_md") {
|
|
771
788
|
const property = buildProperty(el, "markdown", colors);
|
|
772
789
|
const fontColor = typeof el.font_color === "string" ? el.font_color : void 0;
|
|
@@ -1642,6 +1659,23 @@ function unwrap(node, ctx) {
|
|
|
1642
1659
|
if (typeof property.style === "string") out.style = property.style;
|
|
1643
1660
|
if (isRecord3(property.margin) && hasSide(property.margin)) out.margin = formatBox(property.margin);
|
|
1644
1661
|
else if (typeof property.margin === "string") out.margin = property.margin;
|
|
1662
|
+
if (property.notation != null && isRecord3(property.notation)) {
|
|
1663
|
+
const n = convertHeaderText(property.notation, ctx);
|
|
1664
|
+
if (n) out.notation = n;
|
|
1665
|
+
}
|
|
1666
|
+
return out;
|
|
1667
|
+
}
|
|
1668
|
+
if (tag === "avatar") {
|
|
1669
|
+
const out = { tag: "avatar" };
|
|
1670
|
+
if (typeof property.userID === "string") out.user_id = property.userID;
|
|
1671
|
+
else if (typeof property.user_id === "string") out.user_id = property.user_id;
|
|
1672
|
+
if (typeof property.size === "string") out.size = property.size;
|
|
1673
|
+
if (typeof property.customSize === "number") out.custom_size = property.customSize;
|
|
1674
|
+
else if (typeof property.custom_size === "number") out.custom_size = property.custom_size;
|
|
1675
|
+
if (typeof property.customSize2 === "number") out.custom_size2 = property.customSize2;
|
|
1676
|
+
else if (typeof property.custom_size2 === "number") out.custom_size2 = property.custom_size2;
|
|
1677
|
+
if (isRecord3(property.margin) && hasSide(property.margin)) out.margin = formatBox(property.margin);
|
|
1678
|
+
else if (typeof property.margin === "string") out.margin = property.margin;
|
|
1645
1679
|
return out;
|
|
1646
1680
|
}
|
|
1647
1681
|
if (tag === "person_list") {
|
|
@@ -1650,6 +1684,9 @@ function unwrap(node, ctx) {
|
|
|
1650
1684
|
if (typeof property.showAvatar === "boolean") out.show_avatar = property.showAvatar;
|
|
1651
1685
|
if (typeof property.showName === "boolean") out.show_name = property.showName;
|
|
1652
1686
|
if (typeof property.lines === "number") out.lines = property.lines;
|
|
1687
|
+
if (typeof property.mode === "string") out.mode = property.mode;
|
|
1688
|
+
if (typeof property.style === "string") out.style = property.style;
|
|
1689
|
+
if (typeof property.count === "number") out.count = property.count;
|
|
1653
1690
|
if (typeof property.dropInvalidUserID === "boolean") out.drop_invalid_user_id = property.dropInvalidUserID;
|
|
1654
1691
|
else if (typeof property.drop_invalid_user_id === "boolean") out.drop_invalid_user_id = property.drop_invalid_user_id;
|
|
1655
1692
|
if (isRecord3(property.margin) && hasSide(property.margin)) out.margin = formatBox(property.margin);
|
package/dist/index.js
CHANGED
|
@@ -696,6 +696,9 @@ var KEY_RENAME = {
|
|
|
696
696
|
tag_style: "tagStyle",
|
|
697
697
|
scale_type: "scaleType",
|
|
698
698
|
drop_invalid_user_id: "dropInvalidUserID",
|
|
699
|
+
// avatar
|
|
700
|
+
custom_size: "customSize",
|
|
701
|
+
custom_size2: "customSize2",
|
|
699
702
|
// video / audio
|
|
700
703
|
file_key: "fileID",
|
|
701
704
|
audio_id: "audioID",
|
|
@@ -704,7 +707,15 @@ var KEY_RENAME = {
|
|
|
704
707
|
enable_download: "enableDownload",
|
|
705
708
|
fill_color: "fillColor"
|
|
706
709
|
};
|
|
707
|
-
var TEXT_LEAF_KEYS = /* @__PURE__ */ new Set([
|
|
710
|
+
var TEXT_LEAF_KEYS = /* @__PURE__ */ new Set([
|
|
711
|
+
"title",
|
|
712
|
+
"subtitle",
|
|
713
|
+
"alt",
|
|
714
|
+
"hover_tips",
|
|
715
|
+
"placeholder",
|
|
716
|
+
"notation",
|
|
717
|
+
"disabled_tips"
|
|
718
|
+
]);
|
|
708
719
|
function dslToRaw(dsl) {
|
|
709
720
|
const root = isRecord2(dsl) ? dsl : {};
|
|
710
721
|
const card = unwrapCard(root);
|
|
@@ -765,6 +776,12 @@ function convertEl(el, colors) {
|
|
|
765
776
|
}
|
|
766
777
|
return { tag: "person_v1", property };
|
|
767
778
|
}
|
|
779
|
+
if (tag === "avatar") {
|
|
780
|
+
return { tag: "avatar", property: buildProperty(el, "avatar", colors) };
|
|
781
|
+
}
|
|
782
|
+
if (tag === "picker_date") {
|
|
783
|
+
return { tag: "date_picker", property: buildProperty(el, "date_picker", colors) };
|
|
784
|
+
}
|
|
768
785
|
if (tag === "markdown" || tag === "lark_md") {
|
|
769
786
|
const property = buildProperty(el, "markdown", colors);
|
|
770
787
|
const fontColor = typeof el.font_color === "string" ? el.font_color : void 0;
|
|
@@ -1640,6 +1657,23 @@ function unwrap(node, ctx) {
|
|
|
1640
1657
|
if (typeof property.style === "string") out.style = property.style;
|
|
1641
1658
|
if (isRecord3(property.margin) && hasSide(property.margin)) out.margin = formatBox(property.margin);
|
|
1642
1659
|
else if (typeof property.margin === "string") out.margin = property.margin;
|
|
1660
|
+
if (property.notation != null && isRecord3(property.notation)) {
|
|
1661
|
+
const n = convertHeaderText(property.notation, ctx);
|
|
1662
|
+
if (n) out.notation = n;
|
|
1663
|
+
}
|
|
1664
|
+
return out;
|
|
1665
|
+
}
|
|
1666
|
+
if (tag === "avatar") {
|
|
1667
|
+
const out = { tag: "avatar" };
|
|
1668
|
+
if (typeof property.userID === "string") out.user_id = property.userID;
|
|
1669
|
+
else if (typeof property.user_id === "string") out.user_id = property.user_id;
|
|
1670
|
+
if (typeof property.size === "string") out.size = property.size;
|
|
1671
|
+
if (typeof property.customSize === "number") out.custom_size = property.customSize;
|
|
1672
|
+
else if (typeof property.custom_size === "number") out.custom_size = property.custom_size;
|
|
1673
|
+
if (typeof property.customSize2 === "number") out.custom_size2 = property.customSize2;
|
|
1674
|
+
else if (typeof property.custom_size2 === "number") out.custom_size2 = property.custom_size2;
|
|
1675
|
+
if (isRecord3(property.margin) && hasSide(property.margin)) out.margin = formatBox(property.margin);
|
|
1676
|
+
else if (typeof property.margin === "string") out.margin = property.margin;
|
|
1643
1677
|
return out;
|
|
1644
1678
|
}
|
|
1645
1679
|
if (tag === "person_list") {
|
|
@@ -1648,6 +1682,9 @@ function unwrap(node, ctx) {
|
|
|
1648
1682
|
if (typeof property.showAvatar === "boolean") out.show_avatar = property.showAvatar;
|
|
1649
1683
|
if (typeof property.showName === "boolean") out.show_name = property.showName;
|
|
1650
1684
|
if (typeof property.lines === "number") out.lines = property.lines;
|
|
1685
|
+
if (typeof property.mode === "string") out.mode = property.mode;
|
|
1686
|
+
if (typeof property.style === "string") out.style = property.style;
|
|
1687
|
+
if (typeof property.count === "number") out.count = property.count;
|
|
1651
1688
|
if (typeof property.dropInvalidUserID === "boolean") out.drop_invalid_user_id = property.dropInvalidUserID;
|
|
1652
1689
|
else if (typeof property.drop_invalid_user_id === "boolean") out.drop_invalid_user_id = property.drop_invalid_user_id;
|
|
1653
1690
|
if (isRecord3(property.margin) && hasSide(property.margin)) out.margin = formatBox(property.margin);
|
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;AA6mDD;;;;;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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-feishu-card/adapter",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.12",
|
|
4
4
|
"description": "公开 DSL 与飞书内部 RAW JSON 的双向适配器;raw→DSL 对齐 feishu-raw-card-to-dsl",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"tsx": "^4.19.3",
|
|
23
23
|
"typescript": "^7.0.2",
|
|
24
24
|
"vitest": "^2.1.9",
|
|
25
|
-
"@open-feishu-card/schema": "0.1.
|
|
25
|
+
"@open-feishu-card/schema": "0.1.5"
|
|
26
26
|
},
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"publishConfig": {
|