@sendbird/actionbook-core 0.10.6 → 0.10.8

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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as BlockNode, a as BlockquoteNode, b as BoldMark, L as ListItemNode, c as BulletListNode, C as CodeMark, D as DocumentNode, H as HardBreakNode, I as InlineNode, d as HeadingNode, e as HorizontalRuleNode, f as ItalicMark, J as JinjaIfBranch, g as JinjaIfBlockNode, h as JinjaIfInlineNode, i as JumpPointNode, j as LinkMark, N as NoteBlockNode, O as OrderedListNode, P as ParagraphNode, R as ResourceTagType, k as ResourceTagNode, S as StrikethroughMark, T as TableRowNode, l as TableNode, m as TableCellNode, M as Mark, n as TextNode, U as UnderlineMark, A as AstNode, o as NodePath, p as LintRule, q as LintContext, r as LintResult, s as LlmLintRule, t as LlmCompletionEndpoint, u as LintSection } from './types-DK_GhIWZ.js';
2
- export { v as JSONContent, w as JUMP_POINT_ID_PATTERN, x as LintSeverity, y as RESOURCE_TAG_TYPES, z as fromProseMirrorJSON } from './types-DK_GhIWZ.js';
1
+ import { B as BlockNode, a as BlockquoteNode, b as BoldMark, L as ListItemNode, c as BulletListNode, C as CodeMark, D as DocumentNode, H as HardBreakNode, I as InlineNode, d as HeadingNode, e as HorizontalRuleNode, f as ItalicMark, J as JinjaIfBranch, g as JinjaIfBlockNode, h as JinjaIfInlineNode, i as JumpPointNode, j as LinkMark, N as NoteBlockNode, O as OrderedListNode, P as ParagraphNode, R as ResourceTagType, k as ResourceTagNode, S as StrikethroughMark, T as TableRowNode, l as TableNode, m as TableCellNode, M as Mark, n as TextNode, U as UnderlineMark, A as AstNode, o as NodePath, p as LintRule, q as LintContext, r as LintResult, s as LlmLintRule, t as LlmCompletionEndpoint, u as LintSection } from './types-BQ95zx4j.js';
2
+ export { v as JSONContent, w as JUMP_POINT_ID_PATTERN, x as LintSeverity, y as RESOURCE_TAG_TYPES, z as fromProseMirrorJSON } from './types-BQ95zx4j.js';
3
3
  import { Root } from 'mdast';
4
4
 
5
5
  declare const bold: () => BoldMark;
package/dist/index.js CHANGED
@@ -2434,13 +2434,21 @@ function blockToMdast(node, depth = 0) {
2434
2434
  ];
2435
2435
  }
2436
2436
  case "orderedList": {
2437
- const items = node.content.map((li) => listItemToMdast(li, depth + 1));
2437
+ const spread = node.spread ?? false;
2438
+ let counter = node.start;
2439
+ const items = node.content.map((li) => {
2440
+ const mdastLi = listItemToMdast(li, depth + 1);
2441
+ if (li.value != null) counter = li.value;
2442
+ mdastLi._ordinalValue = counter;
2443
+ counter++;
2444
+ return mdastLi;
2445
+ });
2438
2446
  return [
2439
2447
  {
2440
2448
  type: "list",
2441
2449
  ordered: true,
2442
- start: node.start,
2443
- spread: node.spread ?? false,
2450
+ start: node.content[0]?.value ?? node.start,
2451
+ spread,
2444
2452
  children: items
2445
2453
  }
2446
2454
  ];
@@ -2926,6 +2934,14 @@ var gfmNoAutolinkToMarkdown = () => ({
2926
2934
  function isEmptyParagraph(node) {
2927
2935
  return node.type === "paragraph" && (!("children" in node) || !node.children || node.children.length === 0);
2928
2936
  }
2937
+ var JINJA_TAG_RE = /^\{%\s*(if|elif|else|endif)\b/;
2938
+ function isJinjaTagParagraph(node) {
2939
+ if (node.type !== "paragraph") return false;
2940
+ const children = node.children;
2941
+ if (!children || children.length !== 1) return false;
2942
+ const child = children[0];
2943
+ return child.type === "text" && typeof child.value === "string" && JINJA_TAG_RE.test(child.value);
2944
+ }
2929
2945
  function textHandler(node, parent, state, info) {
2930
2946
  const originalUnsafe = state.unsafe;
2931
2947
  state.unsafe = originalUnsafe.filter((p) => !(p.character === "_" && !p.atBreak));
@@ -2940,10 +2956,24 @@ function linkHandler(node, parent, state, info) {
2940
2956
  const titlePart = title ? ` "${title.replace(/"/g, '\\"')}"` : "";
2941
2957
  return `[${childrenText}](${url}${titlePart})`;
2942
2958
  }
2959
+ function listItemHandler(node, parent, state, info) {
2960
+ const value = node._ordinalValue;
2961
+ if (value != null && parent && parent.ordered) {
2962
+ const list = parent;
2963
+ const savedStart = list.start;
2964
+ const idx = list.children.indexOf(node);
2965
+ list.start = value - idx;
2966
+ const result = defaultHandlers3.listItem(node, parent, state, info);
2967
+ list.start = savedStart;
2968
+ return result;
2969
+ }
2970
+ return defaultHandlers3.listItem(node, parent, state, info);
2971
+ }
2943
2972
  function serializeToMarkdown(doc2) {
2944
2973
  const mdastTree = toMdast(doc2);
2945
2974
  const raw = toMarkdown(mdastTree, {
2946
2975
  bullet: "-",
2976
+ bulletOrdered: ".",
2947
2977
  rule: "-",
2948
2978
  listItemIndent: "one",
2949
2979
  incrementListMarker: true,
@@ -2954,11 +2984,15 @@ function serializeToMarkdown(doc2) {
2954
2984
  // Empty paragraphs represent blank-line spacers.
2955
2985
  // Reduce the separator after an empty paragraph from \n\n to \n
2956
2986
  // so that 1 empty paragraph = 1 extra blank line in the output.
2957
- (left) => isEmptyParagraph(left) ? 0 : null
2987
+ (left) => isEmptyParagraph(left) ? 0 : null,
2988
+ // Consecutive paragraphs: single newline instead of blank line
2989
+ // (skip jinja tag paragraphs — they need blank lines for proper roundtrip)
2990
+ (left, right) => left.type === "paragraph" && right.type === "paragraph" && !isJinjaTagParagraph(left) && !isJinjaTagParagraph(right) ? 0 : null
2958
2991
  ],
2959
2992
  handlers: {
2960
2993
  text: textHandler,
2961
2994
  link: linkHandler,
2995
+ listItem: listItemHandler,
2962
2996
  ...resourceTagToMarkdown().handlers,
2963
2997
  ...jumpPointToMarkdown().handlers
2964
2998
  },
@@ -3174,6 +3208,10 @@ function convertPMListItem(node, depth = 0) {
3174
3208
  if (typeof checked === "boolean") {
3175
3209
  base.checked = checked;
3176
3210
  }
3211
+ const value = node.attrs?.value;
3212
+ if (value != null) {
3213
+ base.value = value;
3214
+ }
3177
3215
  return base;
3178
3216
  }
3179
3217
  function fromProseMirrorJSON(pmJSON) {
@@ -3710,6 +3748,11 @@ function tokenize(input) {
3710
3748
  i++;
3711
3749
  continue;
3712
3750
  }
3751
+ if (input[i] === ",") {
3752
+ tokens.push({ type: "COMMA", value: "," });
3753
+ i++;
3754
+ continue;
3755
+ }
3713
3756
  return { tokens: [], error: `Unexpected character: ${input[i]}` };
3714
3757
  }
3715
3758
  tokens.push({ type: "EOF", value: "" });
@@ -3840,6 +3883,17 @@ var Parser = class {
3840
3883
  return null;
3841
3884
  case "IDENT": {
3842
3885
  this.advance();
3886
+ if (this.peek().type === "LPAREN") {
3887
+ this.advance();
3888
+ while (this.peek().type !== "RPAREN" && this.peek().type !== "EOF") {
3889
+ this.orExpr();
3890
+ if (this.peek().type === "COMMA") {
3891
+ this.advance();
3892
+ }
3893
+ }
3894
+ this.expect("RPAREN");
3895
+ return null;
3896
+ }
3843
3897
  return this.resolveVariable(t.value);
3844
3898
  }
3845
3899
  case "LPAREN": {