@open-feishu-card/adapter 0.3.9 → 0.3.10

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.
@@ -10,7 +10,7 @@ export type CustomColorEntry = {
10
10
  export type ColorRegistry = Record<string, CustomColorEntry>;
11
11
  export declare function readColorRegistry(card: Record<string, unknown>): ColorRegistry;
12
12
  export declare function isCustomColorAlias(value: unknown): value is string;
13
- /** column / column_set background_style cus-N → customBackgroundStyle */
13
+ /** column / column_set / interactive_container background_style cus-N → customBackgroundStyle */
14
14
  export declare function expandBackgroundStyleAlias(style: unknown, registry: ColorRegistry): {
15
15
  light_mode: string;
16
16
  dark_mode: 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,a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,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
@@ -843,13 +843,27 @@ function buildProperty(el, tag, colors) {
843
843
  const property = {};
844
844
  for (const [k, v] of Object.entries(el)) {
845
845
  if (k === "tag" || k === "id") continue;
846
- if ((k === "background_style" || k === "backgroundStyle") && (tag === "column" || tag === "column_set")) {
846
+ if ((k === "background_style" || k === "backgroundStyle") && (tag === "column" || tag === "column_set" || tag === "interactive_container")) {
847
847
  const renamed = renameKey(k);
848
848
  property[renamed] = v;
849
849
  const expanded = expandBackgroundStyleAlias(v, colors);
850
850
  if (expanded) property.customBackgroundStyle = expanded;
851
851
  continue;
852
852
  }
853
+ if ((k === "background_color" || k === "backgroundColor") && tag === "collapsible_panel") {
854
+ const renamed = renameKey(k);
855
+ property[renamed] = v;
856
+ const expanded = expandBackgroundStyleAlias(v, colors);
857
+ if (expanded) property.customBackgroundStyle = expanded;
858
+ continue;
859
+ }
860
+ if (k === "border" && tag === "collapsible_panel" && isRecord2(v)) {
861
+ const border = { ...v };
862
+ const expanded = expandBackgroundStyleAlias(border.color, colors);
863
+ if (expanded) border.color = expanded.light_mode;
864
+ property.border = border;
865
+ continue;
866
+ }
853
867
  if ((k === "border_color" || k === "borderColor") && tag === "interactive_container") {
854
868
  const renamed = renameKey(k);
855
869
  property[renamed] = v;
package/dist/index.js CHANGED
@@ -841,13 +841,27 @@ function buildProperty(el, tag, colors) {
841
841
  const property = {};
842
842
  for (const [k, v] of Object.entries(el)) {
843
843
  if (k === "tag" || k === "id") continue;
844
- if ((k === "background_style" || k === "backgroundStyle") && (tag === "column" || tag === "column_set")) {
844
+ if ((k === "background_style" || k === "backgroundStyle") && (tag === "column" || tag === "column_set" || tag === "interactive_container")) {
845
845
  const renamed = renameKey(k);
846
846
  property[renamed] = v;
847
847
  const expanded = expandBackgroundStyleAlias(v, colors);
848
848
  if (expanded) property.customBackgroundStyle = expanded;
849
849
  continue;
850
850
  }
851
+ if ((k === "background_color" || k === "backgroundColor") && tag === "collapsible_panel") {
852
+ const renamed = renameKey(k);
853
+ property[renamed] = v;
854
+ const expanded = expandBackgroundStyleAlias(v, colors);
855
+ if (expanded) property.customBackgroundStyle = expanded;
856
+ continue;
857
+ }
858
+ if (k === "border" && tag === "collapsible_panel" && isRecord2(v)) {
859
+ const border = { ...v };
860
+ const expanded = expandBackgroundStyleAlias(border.color, colors);
861
+ if (expanded) border.color = expanded.light_mode;
862
+ property.border = border;
863
+ continue;
864
+ }
851
865
  if ((k === "border_color" || k === "borderColor") && tag === "interactive_container") {
852
866
  const renamed = renameKey(k);
853
867
  property[renamed] = v;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-feishu-card/adapter",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
4
4
  "description": "公开 DSL 与飞书内部 RAW JSON 的双向适配器;raw→DSL 对齐 feishu-raw-card-to-dsl",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",