@open-feishu-card/renderer 0.2.19 → 0.2.21

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 CHANGED
@@ -212,6 +212,8 @@ var COLOR_NAME_TO_TOKEN = (() => {
212
212
  map["grey-650"] = "N650";
213
213
  map["grey-950"] = "N950";
214
214
  map["grey-1000"] = "N1000";
215
+ map.white = "N00";
216
+ map.black = "N800";
215
217
  return map;
216
218
  })();
217
219
  function paletteColor(raw) {
@@ -5716,12 +5718,19 @@ function registerBuiltins() {
5716
5718
  const cover = resolveVideoCoverSrc(p, ctx);
5717
5719
  const showTime = p.showTime !== false && p.show_time !== false;
5718
5720
  const enableDownload = p.enableDownload === true || p.enable_download === true;
5721
+ const style = {};
5722
+ if (p.margin) {
5723
+ style.width = "100%";
5724
+ applyOuterMargin(style, p.margin);
5725
+ }
5726
+ const styleProp = Object.keys(style).length ? { style } : {};
5719
5727
  if (src) {
5720
5728
  const props = {
5721
5729
  className: `${CLS}-video`,
5722
5730
  src,
5723
5731
  controls: true,
5724
- preload: "metadata"
5732
+ preload: "metadata",
5733
+ ...styleProp
5725
5734
  };
5726
5735
  if (!enableDownload) props.controlslist = "nodownload";
5727
5736
  if (cover) props.poster = cover;
@@ -5729,7 +5738,7 @@ function registerBuiltins() {
5729
5738
  }
5730
5739
  return h(
5731
5740
  "div",
5732
- { className: `${CLS}-video` },
5741
+ { className: `${CLS}-video`, ...styleProp },
5733
5742
  h(
5734
5743
  "div",
5735
5744
  { className: `${CLS}-video__cover` },
@@ -5974,11 +5983,17 @@ function registerBuiltins() {
5974
5983
  const widthTok = p.width ?? wv?.value;
5975
5984
  const block = widthTok === "fill" && !isText;
5976
5985
  const base = `${CLS}-button ${CLS}-button--${type}${block ? ` ${CLS}-button--block` : ""}`;
5986
+ const style = {};
5987
+ if (p.margin) {
5988
+ style.width = block ? "100%" : "auto";
5989
+ applyOuterMargin(style, p.margin);
5990
+ }
5991
+ const styleProp = Object.keys(style).length ? { style } : {};
5977
5992
  if (url && !p.disabled) {
5978
- return h("a", { className: base, href: url, target: "_blank", rel: "noopener" }, children);
5993
+ return h("a", { className: base, href: url, target: "_blank", rel: "noopener", ...styleProp }, children);
5979
5994
  }
5980
5995
  const cls = `${base} ${CLS}-button--static` + (p.disabled ? ` ${CLS}-button--disabled` : "");
5981
- return h("span", { className: cls }, children);
5996
+ return h("span", { className: cls, ...styleProp }, children);
5982
5997
  });
5983
5998
  registerComponent(
5984
5999
  "form",
package/dist/index.js CHANGED
@@ -211,6 +211,8 @@ var COLOR_NAME_TO_TOKEN = (() => {
211
211
  map["grey-650"] = "N650";
212
212
  map["grey-950"] = "N950";
213
213
  map["grey-1000"] = "N1000";
214
+ map.white = "N00";
215
+ map.black = "N800";
214
216
  return map;
215
217
  })();
216
218
  function paletteColor(raw) {
@@ -5715,12 +5717,19 @@ function registerBuiltins() {
5715
5717
  const cover = resolveVideoCoverSrc(p, ctx);
5716
5718
  const showTime = p.showTime !== false && p.show_time !== false;
5717
5719
  const enableDownload = p.enableDownload === true || p.enable_download === true;
5720
+ const style = {};
5721
+ if (p.margin) {
5722
+ style.width = "100%";
5723
+ applyOuterMargin(style, p.margin);
5724
+ }
5725
+ const styleProp = Object.keys(style).length ? { style } : {};
5718
5726
  if (src) {
5719
5727
  const props = {
5720
5728
  className: `${CLS}-video`,
5721
5729
  src,
5722
5730
  controls: true,
5723
- preload: "metadata"
5731
+ preload: "metadata",
5732
+ ...styleProp
5724
5733
  };
5725
5734
  if (!enableDownload) props.controlslist = "nodownload";
5726
5735
  if (cover) props.poster = cover;
@@ -5728,7 +5737,7 @@ function registerBuiltins() {
5728
5737
  }
5729
5738
  return h(
5730
5739
  "div",
5731
- { className: `${CLS}-video` },
5740
+ { className: `${CLS}-video`, ...styleProp },
5732
5741
  h(
5733
5742
  "div",
5734
5743
  { className: `${CLS}-video__cover` },
@@ -5973,11 +5982,17 @@ function registerBuiltins() {
5973
5982
  const widthTok = p.width ?? wv?.value;
5974
5983
  const block = widthTok === "fill" && !isText;
5975
5984
  const base = `${CLS}-button ${CLS}-button--${type}${block ? ` ${CLS}-button--block` : ""}`;
5985
+ const style = {};
5986
+ if (p.margin) {
5987
+ style.width = block ? "100%" : "auto";
5988
+ applyOuterMargin(style, p.margin);
5989
+ }
5990
+ const styleProp = Object.keys(style).length ? { style } : {};
5976
5991
  if (url && !p.disabled) {
5977
- return h("a", { className: base, href: url, target: "_blank", rel: "noopener" }, children);
5992
+ return h("a", { className: base, href: url, target: "_blank", rel: "noopener", ...styleProp }, children);
5978
5993
  }
5979
5994
  const cls = `${base} ${CLS}-button--static` + (p.disabled ? ` ${CLS}-button--disabled` : "");
5980
- return h("span", { className: cls }, children);
5995
+ return h("span", { className: cls, ...styleProp }, children);
5981
5996
  });
5982
5997
  registerComponent(
5983
5998
  "form",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-feishu-card/renderer",
3
- "version": "0.2.19",
3
+ "version": "0.2.21",
4
4
  "description": "零框架依赖的飞书卡片渲染引擎:Web / DOM / SSR,输入 RAW 或公开 DSL,输出真实 DOM 或 HTML 字符串",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",