@open-feishu-card/renderer 0.2.20 → 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
@@ -5718,12 +5718,19 @@ function registerBuiltins() {
5718
5718
  const cover = resolveVideoCoverSrc(p, ctx);
5719
5719
  const showTime = p.showTime !== false && p.show_time !== false;
5720
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 } : {};
5721
5727
  if (src) {
5722
5728
  const props = {
5723
5729
  className: `${CLS}-video`,
5724
5730
  src,
5725
5731
  controls: true,
5726
- preload: "metadata"
5732
+ preload: "metadata",
5733
+ ...styleProp
5727
5734
  };
5728
5735
  if (!enableDownload) props.controlslist = "nodownload";
5729
5736
  if (cover) props.poster = cover;
@@ -5731,7 +5738,7 @@ function registerBuiltins() {
5731
5738
  }
5732
5739
  return h(
5733
5740
  "div",
5734
- { className: `${CLS}-video` },
5741
+ { className: `${CLS}-video`, ...styleProp },
5735
5742
  h(
5736
5743
  "div",
5737
5744
  { className: `${CLS}-video__cover` },
@@ -5976,11 +5983,17 @@ function registerBuiltins() {
5976
5983
  const widthTok = p.width ?? wv?.value;
5977
5984
  const block = widthTok === "fill" && !isText;
5978
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 } : {};
5979
5992
  if (url && !p.disabled) {
5980
- 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);
5981
5994
  }
5982
5995
  const cls = `${base} ${CLS}-button--static` + (p.disabled ? ` ${CLS}-button--disabled` : "");
5983
- return h("span", { className: cls }, children);
5996
+ return h("span", { className: cls, ...styleProp }, children);
5984
5997
  });
5985
5998
  registerComponent(
5986
5999
  "form",
package/dist/index.js CHANGED
@@ -5717,12 +5717,19 @@ function registerBuiltins() {
5717
5717
  const cover = resolveVideoCoverSrc(p, ctx);
5718
5718
  const showTime = p.showTime !== false && p.show_time !== false;
5719
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 } : {};
5720
5726
  if (src) {
5721
5727
  const props = {
5722
5728
  className: `${CLS}-video`,
5723
5729
  src,
5724
5730
  controls: true,
5725
- preload: "metadata"
5731
+ preload: "metadata",
5732
+ ...styleProp
5726
5733
  };
5727
5734
  if (!enableDownload) props.controlslist = "nodownload";
5728
5735
  if (cover) props.poster = cover;
@@ -5730,7 +5737,7 @@ function registerBuiltins() {
5730
5737
  }
5731
5738
  return h(
5732
5739
  "div",
5733
- { className: `${CLS}-video` },
5740
+ { className: `${CLS}-video`, ...styleProp },
5734
5741
  h(
5735
5742
  "div",
5736
5743
  { className: `${CLS}-video__cover` },
@@ -5975,11 +5982,17 @@ function registerBuiltins() {
5975
5982
  const widthTok = p.width ?? wv?.value;
5976
5983
  const block = widthTok === "fill" && !isText;
5977
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 } : {};
5978
5991
  if (url && !p.disabled) {
5979
- 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);
5980
5993
  }
5981
5994
  const cls = `${base} ${CLS}-button--static` + (p.disabled ? ` ${CLS}-button--disabled` : "");
5982
- return h("span", { className: cls }, children);
5995
+ return h("span", { className: cls, ...styleProp }, children);
5983
5996
  });
5984
5997
  registerComponent(
5985
5998
  "form",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-feishu-card/renderer",
3
- "version": "0.2.20",
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",