@open-feishu-card/renderer 0.2.16 → 0.2.17

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/all.css CHANGED
@@ -306,6 +306,33 @@
306
306
  margin: 8px 0;
307
307
  }
308
308
 
309
+ .universal-card-collapse-divider {
310
+ width: 100%;
311
+ height: 1px;
312
+ background-color: #dee0e3;
313
+ border: none;
314
+ margin: 8px 0;
315
+ }
316
+
317
+ .universal-card-avatar {
318
+ display: inline-flex;
319
+ align-items: center;
320
+ vertical-align: middle;
321
+ }
322
+
323
+ .universal-card-avatar__img {
324
+ border-radius: 50%;
325
+ object-fit: cover;
326
+ display: block;
327
+ background: #eff0f1;
328
+ }
329
+
330
+ .universal-card-fallback-text {
331
+ color: #646a73;
332
+ font-size: 14px;
333
+ line-height: 22px;
334
+ }
335
+
309
336
  /* ---- div / note ---- */
310
337
  .universal-card-div > * + * { margin-top: 8px; }
311
338
  /* div 带前置图标:icon 在左、文本在右排成一行(复刻网页版 .universal-card-div 布局) */
package/dist/index.cjs CHANGED
@@ -1228,6 +1228,33 @@ var BASE_STYLES_CSS = `/**
1228
1228
  margin: 8px 0;
1229
1229
  }
1230
1230
 
1231
+ .universal-card-collapse-divider {
1232
+ width: 100%;
1233
+ height: 1px;
1234
+ background-color: #dee0e3;
1235
+ border: none;
1236
+ margin: 8px 0;
1237
+ }
1238
+
1239
+ .universal-card-avatar {
1240
+ display: inline-flex;
1241
+ align-items: center;
1242
+ vertical-align: middle;
1243
+ }
1244
+
1245
+ .universal-card-avatar__img {
1246
+ border-radius: 50%;
1247
+ object-fit: cover;
1248
+ display: block;
1249
+ background: #eff0f1;
1250
+ }
1251
+
1252
+ .universal-card-fallback-text {
1253
+ color: #646a73;
1254
+ font-size: 14px;
1255
+ line-height: 22px;
1256
+ }
1257
+
1231
1258
  /* ---- div / note ---- */
1232
1259
  .universal-card-div > * + * { margin-top: 8px; }
1233
1260
  /* div \u5E26\u524D\u7F6E\u56FE\u6807\uFF1Aicon \u5728\u5DE6\u3001\u6587\u672C\u5728\u53F3\u6392\u6210\u4E00\u884C\uFF08\u590D\u523B\u7F51\u9875\u7248 .universal-card-div \u5E03\u5C40\uFF09 */
@@ -5958,6 +5985,11 @@ function registerBuiltins() {
5958
5985
  registerComponent("input", (el) => renderStaticField(el));
5959
5986
  registerComponent("multi_select_static", (el) => renderStaticField(el));
5960
5987
  registerComponent("select_static", (el) => renderStaticField(el));
5988
+ registerComponent("date_picker", (el) => renderStaticField(el));
5989
+ registerComponent("picker_time", (el) => renderStaticField(el));
5990
+ registerComponent("picker_datetime", (el) => renderStaticField(el));
5991
+ registerComponent("select_person", (el) => renderStaticField(el));
5992
+ registerComponent("multi_select_person", (el) => renderStaticField(el));
5961
5993
  registerComponent("checker", (el, ctx) => {
5962
5994
  const p = el.property || {};
5963
5995
  const checked = p.checked === true;
@@ -6105,6 +6137,40 @@ function registerBuiltins() {
6105
6137
  const p = el.property || {};
6106
6138
  return renderPersonChip(p.userID, p, ctx);
6107
6139
  });
6140
+ const AVATAR_SIZE_PX = {
6141
+ tiny: 16,
6142
+ small: 24,
6143
+ medium: 32,
6144
+ large: 40,
6145
+ huge: 48
6146
+ };
6147
+ registerComponent("avatar", (el, ctx) => {
6148
+ const p = el.property || {};
6149
+ const userID = p.userID || p.user_id;
6150
+ const sizeKey = String(p.size ?? "medium");
6151
+ const custom = typeof p.customSize === "number" ? p.customSize : typeof p.custom_size === "number" ? p.custom_size : void 0;
6152
+ const px = sizeKey === "custom" && typeof custom === "number" && custom > 0 ? custom : AVATAR_SIZE_PX[sizeKey] || AVATAR_SIZE_PX.medium;
6153
+ const { name, src } = resolvePersonDisplay(userID, ctx);
6154
+ return h(
6155
+ "div",
6156
+ { className: `${CLS}-avatar`, title: name },
6157
+ renderAvatarNode(`${CLS}-avatar__img`, px, src, name)
6158
+ );
6159
+ });
6160
+ registerComponent(
6161
+ "collapse_divider",
6162
+ () => h("div", { className: `${CLS}-collapse-divider` })
6163
+ );
6164
+ registerComponent("fallback_text", (el, ctx) => {
6165
+ const p = el.property || {};
6166
+ const textEl = p.text;
6167
+ if (textEl && typeof textEl === "object" && textEl.tag) {
6168
+ return h("div", { className: `${CLS}-fallback-text` }, renderElement(textEl, ctx));
6169
+ }
6170
+ const content = extractPlainText(p.text);
6171
+ if (!content) return null;
6172
+ return h("div", { className: `${CLS}-fallback-text` }, content);
6173
+ });
6108
6174
  registerComponent("person_list", (el, ctx) => {
6109
6175
  const p = el.property || {};
6110
6176
  const list = Array.isArray(p.persons) ? p.persons : [];
package/dist/index.js CHANGED
@@ -1227,6 +1227,33 @@ var BASE_STYLES_CSS = `/**
1227
1227
  margin: 8px 0;
1228
1228
  }
1229
1229
 
1230
+ .universal-card-collapse-divider {
1231
+ width: 100%;
1232
+ height: 1px;
1233
+ background-color: #dee0e3;
1234
+ border: none;
1235
+ margin: 8px 0;
1236
+ }
1237
+
1238
+ .universal-card-avatar {
1239
+ display: inline-flex;
1240
+ align-items: center;
1241
+ vertical-align: middle;
1242
+ }
1243
+
1244
+ .universal-card-avatar__img {
1245
+ border-radius: 50%;
1246
+ object-fit: cover;
1247
+ display: block;
1248
+ background: #eff0f1;
1249
+ }
1250
+
1251
+ .universal-card-fallback-text {
1252
+ color: #646a73;
1253
+ font-size: 14px;
1254
+ line-height: 22px;
1255
+ }
1256
+
1230
1257
  /* ---- div / note ---- */
1231
1258
  .universal-card-div > * + * { margin-top: 8px; }
1232
1259
  /* div \u5E26\u524D\u7F6E\u56FE\u6807\uFF1Aicon \u5728\u5DE6\u3001\u6587\u672C\u5728\u53F3\u6392\u6210\u4E00\u884C\uFF08\u590D\u523B\u7F51\u9875\u7248 .universal-card-div \u5E03\u5C40\uFF09 */
@@ -5957,6 +5984,11 @@ function registerBuiltins() {
5957
5984
  registerComponent("input", (el) => renderStaticField(el));
5958
5985
  registerComponent("multi_select_static", (el) => renderStaticField(el));
5959
5986
  registerComponent("select_static", (el) => renderStaticField(el));
5987
+ registerComponent("date_picker", (el) => renderStaticField(el));
5988
+ registerComponent("picker_time", (el) => renderStaticField(el));
5989
+ registerComponent("picker_datetime", (el) => renderStaticField(el));
5990
+ registerComponent("select_person", (el) => renderStaticField(el));
5991
+ registerComponent("multi_select_person", (el) => renderStaticField(el));
5960
5992
  registerComponent("checker", (el, ctx) => {
5961
5993
  const p = el.property || {};
5962
5994
  const checked = p.checked === true;
@@ -6104,6 +6136,40 @@ function registerBuiltins() {
6104
6136
  const p = el.property || {};
6105
6137
  return renderPersonChip(p.userID, p, ctx);
6106
6138
  });
6139
+ const AVATAR_SIZE_PX = {
6140
+ tiny: 16,
6141
+ small: 24,
6142
+ medium: 32,
6143
+ large: 40,
6144
+ huge: 48
6145
+ };
6146
+ registerComponent("avatar", (el, ctx) => {
6147
+ const p = el.property || {};
6148
+ const userID = p.userID || p.user_id;
6149
+ const sizeKey = String(p.size ?? "medium");
6150
+ const custom = typeof p.customSize === "number" ? p.customSize : typeof p.custom_size === "number" ? p.custom_size : void 0;
6151
+ const px = sizeKey === "custom" && typeof custom === "number" && custom > 0 ? custom : AVATAR_SIZE_PX[sizeKey] || AVATAR_SIZE_PX.medium;
6152
+ const { name, src } = resolvePersonDisplay(userID, ctx);
6153
+ return h(
6154
+ "div",
6155
+ { className: `${CLS}-avatar`, title: name },
6156
+ renderAvatarNode(`${CLS}-avatar__img`, px, src, name)
6157
+ );
6158
+ });
6159
+ registerComponent(
6160
+ "collapse_divider",
6161
+ () => h("div", { className: `${CLS}-collapse-divider` })
6162
+ );
6163
+ registerComponent("fallback_text", (el, ctx) => {
6164
+ const p = el.property || {};
6165
+ const textEl = p.text;
6166
+ if (textEl && typeof textEl === "object" && textEl.tag) {
6167
+ return h("div", { className: `${CLS}-fallback-text` }, renderElement(textEl, ctx));
6168
+ }
6169
+ const content = extractPlainText(p.text);
6170
+ if (!content) return null;
6171
+ return h("div", { className: `${CLS}-fallback-text` }, content);
6172
+ });
6107
6173
  registerComponent("person_list", (el, ctx) => {
6108
6174
  const p = el.property || {};
6109
6175
  const list = Array.isArray(p.persons) ? p.persons : [];
package/dist/styles.css CHANGED
@@ -306,6 +306,33 @@
306
306
  margin: 8px 0;
307
307
  }
308
308
 
309
+ .universal-card-collapse-divider {
310
+ width: 100%;
311
+ height: 1px;
312
+ background-color: #dee0e3;
313
+ border: none;
314
+ margin: 8px 0;
315
+ }
316
+
317
+ .universal-card-avatar {
318
+ display: inline-flex;
319
+ align-items: center;
320
+ vertical-align: middle;
321
+ }
322
+
323
+ .universal-card-avatar__img {
324
+ border-radius: 50%;
325
+ object-fit: cover;
326
+ display: block;
327
+ background: #eff0f1;
328
+ }
329
+
330
+ .universal-card-fallback-text {
331
+ color: #646a73;
332
+ font-size: 14px;
333
+ line-height: 22px;
334
+ }
335
+
309
336
  /* ---- div / note ---- */
310
337
  .universal-card-div > * + * { margin-top: 8px; }
311
338
  /* div 带前置图标:icon 在左、文本在右排成一行(复刻网页版 .universal-card-div 布局) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-feishu-card/renderer",
3
- "version": "0.2.16",
3
+ "version": "0.2.17",
4
4
  "description": "零框架依赖的飞书卡片渲染引擎:Web / DOM / SSR,输入 RAW 或公开 DSL,输出真实 DOM 或 HTML 字符串",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -28,7 +28,7 @@
28
28
  "./dist/*.cjs"
29
29
  ],
30
30
  "dependencies": {
31
- "@open-feishu-card/adapter": "0.3.11"
31
+ "@open-feishu-card/adapter": "0.3.12"
32
32
  },
33
33
  "devDependencies": {
34
34
  "tsup": "^8.3.5",