@open-feishu-card/schema 0.1.9 → 0.1.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.
package/dist/index.cjs CHANGED
@@ -1613,9 +1613,9 @@ var ImageSchema = zod.z.object({
1613
1613
  scale_type: zod.z.enum(["crop_center", "crop_top", "fit_horizontal"]).optional().describe(
1614
1614
  "\u88C1\u526A/\u7F29\u653E\u65B9\u5F0F\uFF0C\u9ED8\u8BA4 crop_center\u3002\u5185\u5BB9\u56FE/\u622A\u56FE/\u901A\u680F\u914D\u56FE\u7528 fit_horizontal\uFF1Bcrop_center/crop_top \u4EC5\u7528\u4E8E\u7F29\u7565\u56FE/\u5C0F\u5934\u50CF\u5F0F\u914D\u56FE"
1615
1615
  ),
1616
- /** stretch / large / medium / small / tiny / "Wpx Hpx" */
1616
+ /** stretch / large / medium / small / tiny / "Wpx Hpx" / "W:H" */
1617
1617
  size: zod.z.string().optional().describe(
1618
- '\u56FE\u7247\u5C3A\u5BF8\uFF1Astretch / large / medium / small / tiny\uFF0C\u6216\u81EA\u5B9A\u4E49 "Wpx Hpx"\u3002\u4EC5\u5BF9 crop_center/crop_top \u751F\u6548\uFF1Bfit_horizontal \u65F6\u4E0D\u8981\u5199 size'
1618
+ '\u56FE\u7247\u5C3A\u5BF8\uFF1Astretch / large / medium / small / tiny\uFF0C\u6216\u81EA\u5B9A\u4E49 "Wpx Hpx" / \u5BBD\u9AD8\u6BD4 "W:H"\uFF08\u5982 "1:1"\uFF09\u3002\u4EC5\u5BF9 crop_center/crop_top \u751F\u6548\uFF1Bfit_horizontal \u65F6\u4E0D\u8981\u5199 size'
1619
1619
  ),
1620
1620
  transparent: zod.z.boolean().optional().describe("\u662F\u5426\u900F\u660E\u5E95\u8272\uFF0C\u9ED8\u8BA4 false"),
1621
1621
  preview: zod.z.boolean().optional().describe("\u70B9\u51FB\u540E\u662F\u5426\u652F\u6301\u5927\u56FE\u9884\u89C8\uFF0C\u9ED8\u8BA4 true"),
@@ -2645,12 +2645,13 @@ var ESCAPE_MAP = [
2645
2645
  ["$", "$"],
2646
2646
  ["_", "_"]
2647
2647
  ];
2648
+ var ENTITIES = new Map(ESCAPE_MAP);
2649
+ var SPECIAL = new RegExp(
2650
+ `[${ESCAPE_MAP.map(([char]) => char.replace(/[\\\]\[\-^]/g, "\\$&")).join("")}]`,
2651
+ "g"
2652
+ );
2648
2653
  function escapeMarkdown(text) {
2649
- let result = text;
2650
- for (const [char, entity] of ESCAPE_MAP) {
2651
- result = result.split(char).join(entity);
2652
- }
2653
- return result;
2654
+ return text.replace(SPECIAL, (char) => ENTITIES.get(char) ?? char);
2654
2655
  }
2655
2656
  var NBSP = " ";
2656
2657
  var ENSP = " ";
package/dist/index.js CHANGED
@@ -1611,9 +1611,9 @@ var ImageSchema = z.object({
1611
1611
  scale_type: z.enum(["crop_center", "crop_top", "fit_horizontal"]).optional().describe(
1612
1612
  "\u88C1\u526A/\u7F29\u653E\u65B9\u5F0F\uFF0C\u9ED8\u8BA4 crop_center\u3002\u5185\u5BB9\u56FE/\u622A\u56FE/\u901A\u680F\u914D\u56FE\u7528 fit_horizontal\uFF1Bcrop_center/crop_top \u4EC5\u7528\u4E8E\u7F29\u7565\u56FE/\u5C0F\u5934\u50CF\u5F0F\u914D\u56FE"
1613
1613
  ),
1614
- /** stretch / large / medium / small / tiny / "Wpx Hpx" */
1614
+ /** stretch / large / medium / small / tiny / "Wpx Hpx" / "W:H" */
1615
1615
  size: z.string().optional().describe(
1616
- '\u56FE\u7247\u5C3A\u5BF8\uFF1Astretch / large / medium / small / tiny\uFF0C\u6216\u81EA\u5B9A\u4E49 "Wpx Hpx"\u3002\u4EC5\u5BF9 crop_center/crop_top \u751F\u6548\uFF1Bfit_horizontal \u65F6\u4E0D\u8981\u5199 size'
1616
+ '\u56FE\u7247\u5C3A\u5BF8\uFF1Astretch / large / medium / small / tiny\uFF0C\u6216\u81EA\u5B9A\u4E49 "Wpx Hpx" / \u5BBD\u9AD8\u6BD4 "W:H"\uFF08\u5982 "1:1"\uFF09\u3002\u4EC5\u5BF9 crop_center/crop_top \u751F\u6548\uFF1Bfit_horizontal \u65F6\u4E0D\u8981\u5199 size'
1617
1617
  ),
1618
1618
  transparent: z.boolean().optional().describe("\u662F\u5426\u900F\u660E\u5E95\u8272\uFF0C\u9ED8\u8BA4 false"),
1619
1619
  preview: z.boolean().optional().describe("\u70B9\u51FB\u540E\u662F\u5426\u652F\u6301\u5927\u56FE\u9884\u89C8\uFF0C\u9ED8\u8BA4 true"),
@@ -2643,12 +2643,13 @@ var ESCAPE_MAP = [
2643
2643
  ["$", "$"],
2644
2644
  ["_", "_"]
2645
2645
  ];
2646
+ var ENTITIES = new Map(ESCAPE_MAP);
2647
+ var SPECIAL = new RegExp(
2648
+ `[${ESCAPE_MAP.map(([char]) => char.replace(/[\\\]\[\-^]/g, "\\$&")).join("")}]`,
2649
+ "g"
2650
+ );
2646
2651
  function escapeMarkdown(text) {
2647
- let result = text;
2648
- for (const [char, entity] of ESCAPE_MAP) {
2649
- result = result.split(char).join(entity);
2650
- }
2651
- return result;
2652
+ return text.replace(SPECIAL, (char) => ENTITIES.get(char) ?? char);
2652
2653
  }
2653
2654
  var NBSP = " ";
2654
2655
  var ENSP = " ";
@@ -1 +1 @@
1
- {"version":3,"file":"escape.d.ts","sourceRoot":"","sources":["../../src/markdown/escape.ts"],"names":[],"mappings":"AA6BA,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMnD;AAED,YAAY;AACZ,eAAO,MAAM,IAAI,WAAW,CAAC;AAC7B,WAAW;AACX,eAAO,MAAM,IAAI,WAAW,CAAC;AAC7B,WAAW;AACX,eAAO,MAAM,IAAI,WAAW,CAAC"}
1
+ {"version":3,"file":"escape.d.ts","sourceRoot":"","sources":["../../src/markdown/escape.ts"],"names":[],"mappings":"AAoCA,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,YAAY;AACZ,eAAO,MAAM,IAAI,WAAW,CAAC;AAC7B,WAAW;AACX,eAAO,MAAM,IAAI,WAAW,CAAC;AAC7B,WAAW;AACX,eAAO,MAAM,IAAI,WAAW,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-feishu-card/schema",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "飞书卡片 JSON Schema 2.0 的 Zod 规范定义与类型导出",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",