@prosekit/extensions 0.14.2 → 0.16.0-beta.0

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.
Files changed (151) hide show
  1. package/dist/commit/style.css +1 -3
  2. package/dist/{drop-indicator-DJq8pF92.js → drop-indicator.js} +2 -4
  3. package/dist/drop-indicator.js.map +1 -0
  4. package/dist/{file-upload-I9m1EJAM.js → file.js} +2 -6
  5. package/dist/file.js.map +1 -0
  6. package/dist/gap-cursor/style.css +5 -8
  7. package/dist/{file-upload-dr3IXUty.d.ts → index.d.ts} +1 -1
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/list/style.css +79 -110
  10. package/dist/loro/style.css +18 -21
  11. package/dist/{mark-rule-Bqdm49Eq.js → mark-rule.js} +2 -5
  12. package/dist/mark-rule.js.map +1 -0
  13. package/dist/page/style.css +43 -0
  14. package/dist/{mark-paste-rule--F1QPUcU.js → paste-rule.js} +2 -6
  15. package/dist/paste-rule.js.map +1 -0
  16. package/dist/placeholder/style.css +4 -7
  17. package/dist/prosekit-extensions-autocomplete.js +1 -5
  18. package/dist/prosekit-extensions-autocomplete.js.map +1 -1
  19. package/dist/prosekit-extensions-background-color.js +1 -4
  20. package/dist/prosekit-extensions-background-color.js.map +1 -1
  21. package/dist/prosekit-extensions-blockquote.js +1 -6
  22. package/dist/prosekit-extensions-blockquote.js.map +1 -1
  23. package/dist/prosekit-extensions-bold.js +1 -6
  24. package/dist/prosekit-extensions-bold.js.map +1 -1
  25. package/dist/prosekit-extensions-code-block.d.ts +4 -2
  26. package/dist/prosekit-extensions-code-block.d.ts.map +1 -1
  27. package/dist/prosekit-extensions-code-block.js +1 -10
  28. package/dist/prosekit-extensions-code-block.js.map +1 -1
  29. package/dist/prosekit-extensions-code.js +1 -6
  30. package/dist/prosekit-extensions-code.js.map +1 -1
  31. package/dist/prosekit-extensions-commit.js +1 -2
  32. package/dist/prosekit-extensions-commit.js.map +1 -1
  33. package/dist/prosekit-extensions-doc.js +1 -2
  34. package/dist/prosekit-extensions-doc.js.map +1 -1
  35. package/dist/prosekit-extensions-drop-cursor.js +1 -2
  36. package/dist/prosekit-extensions-drop-cursor.js.map +1 -1
  37. package/dist/prosekit-extensions-drop-indicator.js +2 -3
  38. package/dist/prosekit-extensions-enter-rule.js +1 -2
  39. package/dist/prosekit-extensions-enter-rule.js.map +1 -1
  40. package/dist/prosekit-extensions-file.d.ts +2 -2
  41. package/dist/prosekit-extensions-file.js +2 -3
  42. package/dist/prosekit-extensions-gap-cursor.js +1 -2
  43. package/dist/prosekit-extensions-gap-cursor.js.map +1 -1
  44. package/dist/prosekit-extensions-hard-break.js +1 -5
  45. package/dist/prosekit-extensions-hard-break.js.map +1 -1
  46. package/dist/prosekit-extensions-heading.js +1 -6
  47. package/dist/prosekit-extensions-heading.js.map +1 -1
  48. package/dist/prosekit-extensions-horizontal-rule.d.ts.map +1 -1
  49. package/dist/prosekit-extensions-horizontal-rule.js +3 -6
  50. package/dist/prosekit-extensions-horizontal-rule.js.map +1 -1
  51. package/dist/prosekit-extensions-image.d.ts +1 -2
  52. package/dist/prosekit-extensions-image.d.ts.map +1 -1
  53. package/dist/prosekit-extensions-image.js +2 -8
  54. package/dist/prosekit-extensions-image.js.map +1 -1
  55. package/dist/prosekit-extensions-input-rule.js +1 -2
  56. package/dist/prosekit-extensions-input-rule.js.map +1 -1
  57. package/dist/prosekit-extensions-italic.js +1 -6
  58. package/dist/prosekit-extensions-italic.js.map +1 -1
  59. package/dist/prosekit-extensions-link.js +3 -6
  60. package/dist/prosekit-extensions-link.js.map +1 -1
  61. package/dist/prosekit-extensions-list.js +2 -10
  62. package/dist/prosekit-extensions-list.js.map +1 -1
  63. package/dist/prosekit-extensions-loro.d.ts.map +1 -1
  64. package/dist/prosekit-extensions-loro.js +3 -9
  65. package/dist/prosekit-extensions-loro.js.map +1 -1
  66. package/dist/prosekit-extensions-mark-rule.js +2 -3
  67. package/dist/prosekit-extensions-math.js +1 -5
  68. package/dist/prosekit-extensions-math.js.map +1 -1
  69. package/dist/prosekit-extensions-mention.js +1 -2
  70. package/dist/prosekit-extensions-mention.js.map +1 -1
  71. package/dist/prosekit-extensions-mod-click-prevention.js +1 -2
  72. package/dist/prosekit-extensions-mod-click-prevention.js.map +1 -1
  73. package/dist/prosekit-extensions-page.d.ts +114 -0
  74. package/dist/prosekit-extensions-page.d.ts.map +1 -0
  75. package/dist/prosekit-extensions-page.js +324 -0
  76. package/dist/prosekit-extensions-page.js.map +1 -0
  77. package/dist/prosekit-extensions-paragraph.d.ts.map +1 -1
  78. package/dist/prosekit-extensions-paragraph.js +3 -7
  79. package/dist/prosekit-extensions-paragraph.js.map +1 -1
  80. package/dist/prosekit-extensions-paste-rule.js +2 -3
  81. package/dist/prosekit-extensions-placeholder.js +2 -3
  82. package/dist/prosekit-extensions-placeholder.js.map +1 -1
  83. package/dist/prosekit-extensions-readonly.js +1 -2
  84. package/dist/prosekit-extensions-readonly.js.map +1 -1
  85. package/dist/prosekit-extensions-search.js +1 -2
  86. package/dist/prosekit-extensions-search.js.map +1 -1
  87. package/dist/prosekit-extensions-strike.js +1 -2
  88. package/dist/prosekit-extensions-strike.js.map +1 -1
  89. package/dist/prosekit-extensions-table.js +2 -3
  90. package/dist/prosekit-extensions-text-align.js +1 -2
  91. package/dist/prosekit-extensions-text-align.js.map +1 -1
  92. package/dist/prosekit-extensions-text-color.js +1 -4
  93. package/dist/prosekit-extensions-text-color.js.map +1 -1
  94. package/dist/prosekit-extensions-text.js +1 -2
  95. package/dist/prosekit-extensions-text.js.map +1 -1
  96. package/dist/prosekit-extensions-underline.js +1 -2
  97. package/dist/prosekit-extensions-underline.js.map +1 -1
  98. package/dist/prosekit-extensions-virtual-selection.js +1 -2
  99. package/dist/prosekit-extensions-virtual-selection.js.map +1 -1
  100. package/dist/prosekit-extensions-yjs.d.ts.map +1 -1
  101. package/dist/prosekit-extensions-yjs.js +3 -9
  102. package/dist/prosekit-extensions-yjs.js.map +1 -1
  103. package/dist/prosekit-extensions.js +1 -1
  104. package/dist/search/style.css +4 -8
  105. package/dist/shiki-highlighter-chunk.js +1 -2
  106. package/dist/shiki-highlighter-chunk.js.map +1 -1
  107. package/dist/table/style.css +16 -16
  108. package/dist/{table-B81i9oH9.js → table.js} +3 -15
  109. package/dist/table.js.map +1 -0
  110. package/dist/virtual-selection/style.css +1 -4
  111. package/dist/yjs/style.css +14 -20
  112. package/package.json +27 -14
  113. package/src/horizontal-rule/horizontal-rule-commands.ts +2 -1
  114. package/src/loro/loro.ts +3 -2
  115. package/src/page/index.ts +5 -0
  116. package/src/page/page-break-commands.spec.ts +61 -0
  117. package/src/page/page-break-commands.ts +41 -0
  118. package/src/page/page-break-keymap.ts +17 -0
  119. package/src/page/page-break-spec.ts +33 -0
  120. package/src/page/page-break.ts +23 -0
  121. package/src/page/page-element.ts +246 -0
  122. package/src/page/page-rendering.ts +164 -0
  123. package/src/page/style.css +43 -0
  124. package/src/paragraph/paragraph.ts +3 -2
  125. package/src/yjs/yjs.ts +3 -2
  126. package/dist/commit/style.css.map +0 -1
  127. package/dist/commit/style.js +0 -1
  128. package/dist/drop-indicator-DJq8pF92.js.map +0 -1
  129. package/dist/file-upload-I9m1EJAM.js.map +0 -1
  130. package/dist/file-upload-dr3IXUty.d.ts.map +0 -1
  131. package/dist/gap-cursor/style.css.map +0 -1
  132. package/dist/gap-cursor/style.js +0 -1
  133. package/dist/list/style.css.map +0 -1
  134. package/dist/list/style.js +0 -1
  135. package/dist/loro/style.css.map +0 -1
  136. package/dist/loro/style.js +0 -1
  137. package/dist/mark-paste-rule--F1QPUcU.js.map +0 -1
  138. package/dist/mark-rule-Bqdm49Eq.js.map +0 -1
  139. package/dist/placeholder/style.css.map +0 -1
  140. package/dist/placeholder/style.js +0 -1
  141. package/dist/search/style.css.map +0 -1
  142. package/dist/search/style.js +0 -1
  143. package/dist/shiki-highlighter-chunk.d.ts +0 -19
  144. package/dist/shiki-highlighter-chunk.d.ts.map +0 -1
  145. package/dist/table/style.css.map +0 -1
  146. package/dist/table/style.js +0 -1
  147. package/dist/table-B81i9oH9.js.map +0 -1
  148. package/dist/virtual-selection/style.css.map +0 -1
  149. package/dist/virtual-selection/style.js +0 -1
  150. package/dist/yjs/style.css.map +0 -1
  151. package/dist/yjs/style.js +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-extensions-search.js","names":[],"sources":["../src/search/index.ts"],"sourcesContent":["import { defineCommands, definePlugin, type Extension, type PlainExtension } from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\nimport type { EditorView } from '@prosekit/pm/view'\nimport {\n findNext,\n findNextNoWrap,\n findPrev,\n findPrevNoWrap,\n replaceAll,\n replaceCurrent,\n replaceNext,\n replaceNextNoWrap,\n search,\n SearchQuery,\n} from 'prosemirror-search'\n\n/**\n * Options for {@link defineSearchQuery}\n *\n * @public\n */\nexport interface SearchQueryOptions {\n /**\n * The search string (or regular expression).\n */\n search: string\n\n /**\n * The replace text.\n */\n replace?: string\n\n /**\n * Indicates whether the search is case-sensitive\n *\n * @default false\n */\n caseSensitive?: boolean\n\n /**\n * By default, string search will replace `\\n`, `\\r`, and `\\t` in the query\n * with newline, return, and tab characters. When this is set to true, that\n * behavior is disabled.\n *\n * @default false\n */\n literal?: boolean\n\n /**\n * When true, the search string is interpreted as a regular expression.\n *\n * @default false\n */\n regexp?: boolean\n\n /**\n * Enable whole-word matching.\n *\n * @default false\n */\n wholeWord?: boolean\n}\n\n/**\n * Defines an extension that stores a current search query and replace string.\n *\n * @public\n */\nexport function defineSearchQuery(options: SearchQueryOptions): PlainExtension {\n const query = new SearchQuery(options)\n return definePlugin(search({ initialQuery: query }))\n}\n\n/**\n * Scrolls the active search match into view.\n */\nfunction scrollActiveIntoView(view: EditorView) {\n if (view.isDestroyed) return\n const active = view.dom.querySelector('.ProseMirror-active-search-match')\n active?.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n behavior: 'smooth',\n })\n}\n\n/**\n * Wraps a command and scrolls the active search match into view when the command\n * is applied.\n */\nfunction withScrollActiveIntoView(command: Command): Command {\n return (state, dispatch, view) => {\n const result = command(state, dispatch, view)\n if (result && dispatch && view) {\n // Add a small delay because the command itself will handle scrolling if\n // the view is focused.\n setTimeout(() => scrollActiveIntoView(view), 50)\n }\n return result\n }\n}\n\n/**\n * @internal\n */\nexport type SearchCommandsExtension = Extension<{\n Commands: {\n findNext: []\n findPrev: []\n findNextNoWrap: []\n findPrevNoWrap: []\n replaceNext: []\n replaceNextNoWrap: []\n replaceCurrent: []\n replaceAll: []\n }\n}>\n\n/**\n * Defines commands for search and replace.\n *\n * @public\n */\nexport function defineSearchCommands(): SearchCommandsExtension {\n return defineCommands({\n findNext: () => withScrollActiveIntoView(findNext),\n findPrev: () => withScrollActiveIntoView(findPrev),\n findNextNoWrap: () => withScrollActiveIntoView(findNextNoWrap),\n findPrevNoWrap: () => withScrollActiveIntoView(findPrevNoWrap),\n replaceNext: () => withScrollActiveIntoView(replaceNext),\n replaceNextNoWrap: () => withScrollActiveIntoView(replaceNextNoWrap),\n replaceCurrent: () => withScrollActiveIntoView(replaceCurrent),\n replaceAll: () => withScrollActiveIntoView(replaceAll),\n })\n}\n"],"mappings":";;;;;;;;;AAoEA,SAAgB,kBAAkB,SAA6C;AAE7E,QAAO,aAAa,OAAO,EAAE,cADf,IAAI,YAAY,QAAQ,EACY,CAAC,CAAC;;;;;AAMtD,SAAS,qBAAqB,MAAkB;AAC9C,KAAI,KAAK,YAAa;AAEtB,CADe,KAAK,IAAI,cAAc,mCAAmC,EACjE,eAAe;EACrB,OAAO;EACP,QAAQ;EACR,UAAU;EACX,CAAC;;;;;;AAOJ,SAAS,yBAAyB,SAA2B;AAC3D,SAAQ,OAAO,UAAU,SAAS;EAChC,MAAM,SAAS,QAAQ,OAAO,UAAU,KAAK;AAC7C,MAAI,UAAU,YAAY,KAGxB,kBAAiB,qBAAqB,KAAK,EAAE,GAAG;AAElD,SAAO;;;;;;;;AAyBX,SAAgB,uBAAgD;AAC9D,QAAO,eAAe;EACpB,gBAAgB,yBAAyB,SAAS;EAClD,gBAAgB,yBAAyB,SAAS;EAClD,sBAAsB,yBAAyB,eAAe;EAC9D,sBAAsB,yBAAyB,eAAe;EAC9D,mBAAmB,yBAAyB,YAAY;EACxD,yBAAyB,yBAAyB,kBAAkB;EACpE,sBAAsB,yBAAyB,eAAe;EAC9D,kBAAkB,yBAAyB,WAAW;EACvD,CAAC"}
1
+ {"version":3,"file":"prosekit-extensions-search.js","names":[],"sources":["../src/search/index.ts"],"sourcesContent":["import { defineCommands, definePlugin, type Extension, type PlainExtension } from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\nimport type { EditorView } from '@prosekit/pm/view'\nimport {\n findNext,\n findNextNoWrap,\n findPrev,\n findPrevNoWrap,\n replaceAll,\n replaceCurrent,\n replaceNext,\n replaceNextNoWrap,\n search,\n SearchQuery,\n} from 'prosemirror-search'\n\n/**\n * Options for {@link defineSearchQuery}\n *\n * @public\n */\nexport interface SearchQueryOptions {\n /**\n * The search string (or regular expression).\n */\n search: string\n\n /**\n * The replace text.\n */\n replace?: string\n\n /**\n * Indicates whether the search is case-sensitive\n *\n * @default false\n */\n caseSensitive?: boolean\n\n /**\n * By default, string search will replace `\\n`, `\\r`, and `\\t` in the query\n * with newline, return, and tab characters. When this is set to true, that\n * behavior is disabled.\n *\n * @default false\n */\n literal?: boolean\n\n /**\n * When true, the search string is interpreted as a regular expression.\n *\n * @default false\n */\n regexp?: boolean\n\n /**\n * Enable whole-word matching.\n *\n * @default false\n */\n wholeWord?: boolean\n}\n\n/**\n * Defines an extension that stores a current search query and replace string.\n *\n * @public\n */\nexport function defineSearchQuery(options: SearchQueryOptions): PlainExtension {\n const query = new SearchQuery(options)\n return definePlugin(search({ initialQuery: query }))\n}\n\n/**\n * Scrolls the active search match into view.\n */\nfunction scrollActiveIntoView(view: EditorView) {\n if (view.isDestroyed) return\n const active = view.dom.querySelector('.ProseMirror-active-search-match')\n active?.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n behavior: 'smooth',\n })\n}\n\n/**\n * Wraps a command and scrolls the active search match into view when the command\n * is applied.\n */\nfunction withScrollActiveIntoView(command: Command): Command {\n return (state, dispatch, view) => {\n const result = command(state, dispatch, view)\n if (result && dispatch && view) {\n // Add a small delay because the command itself will handle scrolling if\n // the view is focused.\n setTimeout(() => scrollActiveIntoView(view), 50)\n }\n return result\n }\n}\n\n/**\n * @internal\n */\nexport type SearchCommandsExtension = Extension<{\n Commands: {\n findNext: []\n findPrev: []\n findNextNoWrap: []\n findPrevNoWrap: []\n replaceNext: []\n replaceNextNoWrap: []\n replaceCurrent: []\n replaceAll: []\n }\n}>\n\n/**\n * Defines commands for search and replace.\n *\n * @public\n */\nexport function defineSearchCommands(): SearchCommandsExtension {\n return defineCommands({\n findNext: () => withScrollActiveIntoView(findNext),\n findPrev: () => withScrollActiveIntoView(findPrev),\n findNextNoWrap: () => withScrollActiveIntoView(findNextNoWrap),\n findPrevNoWrap: () => withScrollActiveIntoView(findPrevNoWrap),\n replaceNext: () => withScrollActiveIntoView(replaceNext),\n replaceNextNoWrap: () => withScrollActiveIntoView(replaceNextNoWrap),\n replaceCurrent: () => withScrollActiveIntoView(replaceCurrent),\n replaceAll: () => withScrollActiveIntoView(replaceAll),\n })\n}\n"],"mappings":";;;;;;;;AAoEA,SAAgB,kBAAkB,SAA6C;AAE7E,QAAO,aAAa,OAAO,EAAE,cADf,IAAI,YAAY,QAAQ,EACY,CAAC,CAAC;;;;;AAMtD,SAAS,qBAAqB,MAAkB;AAC9C,KAAI,KAAK,YAAa;AACP,MAAK,IAAI,cAAc,mCAAmC,EACjE,eAAe;EACrB,OAAO;EACP,QAAQ;EACR,UAAU;EACX,CAAC;;;;;;AAOJ,SAAS,yBAAyB,SAA2B;AAC3D,SAAQ,OAAO,UAAU,SAAS;EAChC,MAAM,SAAS,QAAQ,OAAO,UAAU,KAAK;AAC7C,MAAI,UAAU,YAAY,KAGxB,kBAAiB,qBAAqB,KAAK,EAAE,GAAG;AAElD,SAAO;;;;;;;;AAyBX,SAAgB,uBAAgD;AAC9D,QAAO,eAAe;EACpB,gBAAgB,yBAAyB,SAAS;EAClD,gBAAgB,yBAAyB,SAAS;EAClD,sBAAsB,yBAAyB,eAAe;EAC9D,sBAAsB,yBAAyB,eAAe;EAC9D,mBAAmB,yBAAyB,YAAY;EACxD,yBAAyB,yBAAyB,kBAAkB;EACpE,sBAAsB,yBAAyB,eAAe;EAC9D,kBAAkB,yBAAyB,WAAW;EACvD,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { defineMarkInputRule } from "./prosekit-extensions-input-rule.js";
2
2
  import { canUseRegexLookbehind, defineCommands, defineKeymap, defineMarkSpec, toggleMark, union } from "@prosekit/core";
3
-
4
3
  //#region src/strike/index.ts
5
4
  /**
6
5
  * @internal
@@ -50,7 +49,7 @@ function defineStrikeInputRule() {
50
49
  function defineStrike() {
51
50
  return union(defineStrikeSpec(), defineStrikeCommands(), defineStrikeKeymap(), defineStrikeInputRule());
52
51
  }
53
-
54
52
  //#endregion
55
53
  export { defineStrike, defineStrikeCommands, defineStrikeInputRule, defineStrikeKeymap, defineStrikeSpec };
54
+
56
55
  //# sourceMappingURL=prosekit-extensions-strike.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-extensions-strike.js","names":[],"sources":["../src/strike/index.ts"],"sourcesContent":["import {\n canUseRegexLookbehind,\n defineCommands,\n defineKeymap,\n defineMarkSpec,\n toggleMark,\n union,\n type Extension,\n type PlainExtension,\n type Union,\n} from '@prosekit/core'\nimport type { Attrs } from '@prosekit/pm/model'\n\nimport { defineMarkInputRule } from '../input-rule/index.ts'\n\n/**\n * @internal\n */\nexport type StrikeSpecExtension = Extension<{\n Marks: {\n strike: Attrs\n }\n}>\n\n/**\n * @internal\n */\nexport function defineStrikeSpec(): StrikeSpecExtension {\n return defineMarkSpec({\n name: 'strike',\n parseDOM: [\n { tag: 's' },\n { tag: 'strike' },\n { tag: 'del' },\n { style: 'text-decoration=line-through' },\n { style: 'text-decoration-line=line-through' },\n ],\n toDOM() {\n return ['s', 0]\n },\n })\n}\n\n/**\n * @internal\n */\nexport type StrikeCommandsExtension = Extension<{\n Commands: {\n toggleStrike: []\n }\n}>\n\n/**\n * @internal\n */\nexport function defineStrikeCommands(): StrikeCommandsExtension {\n return defineCommands({\n toggleStrike: () => toggleMark({ type: 'strike' }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineStrikeKeymap(): PlainExtension {\n return defineKeymap({\n 'Mod-S': toggleMark({ type: 'strike' }),\n 'Mod-X': toggleMark({ type: 'strike' }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineStrikeInputRule(): PlainExtension {\n return defineMarkInputRule({\n regex: canUseRegexLookbehind()\n ? /(?<=\\s|^)~~([^\\s~]|[^\\s~][^~]*[^\\s~])~~$/\n : /~~([^\\s~]|[^\\s~][^~]*[^\\s~])~~$/,\n type: 'strike',\n })\n}\n\n/**\n * @internal\n */\nexport type StrikeExtension = Union<\n [StrikeSpecExtension, StrikeCommandsExtension]\n>\n\n/**\n * @public\n */\nexport function defineStrike(): StrikeExtension {\n return union(\n defineStrikeSpec(),\n defineStrikeCommands(),\n defineStrikeKeymap(),\n defineStrikeInputRule(),\n )\n}\n"],"mappings":";;;;;;;AA2BA,SAAgB,mBAAwC;AACtD,QAAO,eAAe;EACpB,MAAM;EACN,UAAU;GACR,EAAE,KAAK,KAAK;GACZ,EAAE,KAAK,UAAU;GACjB,EAAE,KAAK,OAAO;GACd,EAAE,OAAO,gCAAgC;GACzC,EAAE,OAAO,qCAAqC;GAC/C;EACD,QAAQ;AACN,UAAO,CAAC,KAAK,EAAE;;EAElB,CAAC;;;;;AAeJ,SAAgB,uBAAgD;AAC9D,QAAO,eAAe,EACpB,oBAAoB,WAAW,EAAE,MAAM,UAAU,CAAC,EACnD,CAAC;;;;;AAMJ,SAAgB,qBAAqC;AACnD,QAAO,aAAa;EAClB,SAAS,WAAW,EAAE,MAAM,UAAU,CAAC;EACvC,SAAS,WAAW,EAAE,MAAM,UAAU,CAAC;EACxC,CAAC;;;;;AAMJ,SAAgB,wBAAwC;AACtD,QAAO,oBAAoB;EACzB,OAAO,uBAAuB,GAC1B,6CACA;EACJ,MAAM;EACP,CAAC;;;;;AAaJ,SAAgB,eAAgC;AAC9C,QAAO,MACL,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,CACxB"}
1
+ {"version":3,"file":"prosekit-extensions-strike.js","names":[],"sources":["../src/strike/index.ts"],"sourcesContent":["import {\n canUseRegexLookbehind,\n defineCommands,\n defineKeymap,\n defineMarkSpec,\n toggleMark,\n union,\n type Extension,\n type PlainExtension,\n type Union,\n} from '@prosekit/core'\nimport type { Attrs } from '@prosekit/pm/model'\n\nimport { defineMarkInputRule } from '../input-rule/index.ts'\n\n/**\n * @internal\n */\nexport type StrikeSpecExtension = Extension<{\n Marks: {\n strike: Attrs\n }\n}>\n\n/**\n * @internal\n */\nexport function defineStrikeSpec(): StrikeSpecExtension {\n return defineMarkSpec({\n name: 'strike',\n parseDOM: [\n { tag: 's' },\n { tag: 'strike' },\n { tag: 'del' },\n { style: 'text-decoration=line-through' },\n { style: 'text-decoration-line=line-through' },\n ],\n toDOM() {\n return ['s', 0]\n },\n })\n}\n\n/**\n * @internal\n */\nexport type StrikeCommandsExtension = Extension<{\n Commands: {\n toggleStrike: []\n }\n}>\n\n/**\n * @internal\n */\nexport function defineStrikeCommands(): StrikeCommandsExtension {\n return defineCommands({\n toggleStrike: () => toggleMark({ type: 'strike' }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineStrikeKeymap(): PlainExtension {\n return defineKeymap({\n 'Mod-S': toggleMark({ type: 'strike' }),\n 'Mod-X': toggleMark({ type: 'strike' }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineStrikeInputRule(): PlainExtension {\n return defineMarkInputRule({\n regex: canUseRegexLookbehind()\n ? /(?<=\\s|^)~~([^\\s~]|[^\\s~][^~]*[^\\s~])~~$/\n : /~~([^\\s~]|[^\\s~][^~]*[^\\s~])~~$/,\n type: 'strike',\n })\n}\n\n/**\n * @internal\n */\nexport type StrikeExtension = Union<\n [StrikeSpecExtension, StrikeCommandsExtension]\n>\n\n/**\n * @public\n */\nexport function defineStrike(): StrikeExtension {\n return union(\n defineStrikeSpec(),\n defineStrikeCommands(),\n defineStrikeKeymap(),\n defineStrikeInputRule(),\n )\n}\n"],"mappings":";;;;;;AA2BA,SAAgB,mBAAwC;AACtD,QAAO,eAAe;EACpB,MAAM;EACN,UAAU;GACR,EAAE,KAAK,KAAK;GACZ,EAAE,KAAK,UAAU;GACjB,EAAE,KAAK,OAAO;GACd,EAAE,OAAO,gCAAgC;GACzC,EAAE,OAAO,qCAAqC;GAC/C;EACD,QAAQ;AACN,UAAO,CAAC,KAAK,EAAE;;EAElB,CAAC;;;;;AAeJ,SAAgB,uBAAgD;AAC9D,QAAO,eAAe,EACpB,oBAAoB,WAAW,EAAE,MAAM,UAAU,CAAC,EACnD,CAAC;;;;;AAMJ,SAAgB,qBAAqC;AACnD,QAAO,aAAa;EAClB,SAAS,WAAW,EAAE,MAAM,UAAU,CAAC;EACvC,SAAS,WAAW,EAAE,MAAM,UAAU,CAAC;EACxC,CAAC;;;;;AAMJ,SAAgB,wBAAwC;AACtD,QAAO,oBAAoB;EACzB,OAAO,uBAAuB,GAC1B,6CACA;EACJ,MAAM;EACP,CAAC;;;;;AAaJ,SAAgB,eAAgC;AAC9C,QAAO,MACL,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,CACxB"}
@@ -1,3 +1,2 @@
1
- import { _ as insertTable, a as defineTableSpec, c as defineTableCommands, d as selectTableColumn, f as selectTableCell, g as moveTableColumn, h as moveTableRow, i as defineTableRowSpec, l as selectTable, m as isCellSelection, n as defineTableCellSpec, o as defineTablePlugins, p as findTable, r as defineTableHeaderCellSpec, s as defineTableDropIndicator, t as defineTable, u as selectTableRow, v as exitTable } from "./table-B81i9oH9.js";
2
-
3
- export { defineTable, defineTableCellSpec, defineTableCommands, defineTableDropIndicator, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow };
1
+ import { _ as insertTable, a as defineTableSpec, c as defineTableCommands, d as selectTableColumn, f as selectTableCell, g as moveTableColumn, h as moveTableRow, i as defineTableRowSpec, l as selectTable, m as isCellSelection, n as defineTableCellSpec, o as defineTablePlugins, p as findTable, r as defineTableHeaderCellSpec, s as defineTableDropIndicator, t as defineTable, u as selectTableRow, v as exitTable } from "./table.js";
2
+ export { defineTable, defineTableCellSpec, defineTableCommands, defineTableDropIndicator, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow };
@@ -1,5 +1,4 @@
1
1
  import { defineCommands, defineKeymap, defineNodeAttr, setNodeAttrsBetween, union } from "@prosekit/core";
2
-
3
2
  //#region src/text-align/index.ts
4
3
  function defineTextAlignAttr(type, defaultValue) {
5
4
  return defineNodeAttr({
@@ -69,7 +68,7 @@ function defineTextAlignKeymap(types) {
69
68
  function defineTextAlign(options) {
70
69
  return union(defineTextAlignAttrs(options.types, options.default || "left"), defineTextAlignKeymap(options.types), defineTextAlignCommands(options.types));
71
70
  }
72
-
73
71
  //#endregion
74
72
  export { defineTextAlign, defineTextAlignCommands, defineTextAlignKeymap, setTextAlign };
73
+
75
74
  //# sourceMappingURL=prosekit-extensions-text-align.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-extensions-text-align.js","names":[],"sources":["../src/text-align/index.ts"],"sourcesContent":["import {\n defineCommands,\n defineKeymap,\n defineNodeAttr,\n setNodeAttrsBetween,\n union,\n type Extension,\n type PlainExtension,\n type Union,\n} from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\n\n/**\n * @public\n */\nexport interface TextAlignOptions<NodeName extends string = string> {\n /**\n * The names of node to add the attribute to.\n *\n * @example\n *\n * [\"paragraph\", \"heading\"]\n */\n types: NodeName[]\n\n /**\n * The default value for the attribute.\n *\n * @default \"left\"\n */\n default?: string\n}\n\nfunction defineTextAlignAttr<NodeName extends string>(\n type: NodeName,\n defaultValue: string | null,\n) {\n return defineNodeAttr<NodeName, 'textAlign', string | null>({\n type,\n attr: 'textAlign',\n default: defaultValue,\n splittable: true,\n toDOM: (value: any) => (value ? ['style', `text-align:${value};`] : null),\n parseDOM: (node: HTMLElement) => {\n return node.style.getPropertyValue('text-align') || null\n },\n })\n}\n\n/**\n * @internal\n */\nexport type TextAlignAttrsExtension<NodeName extends string> = Extension<{\n Nodes: { [K in NodeName]: { textAlign: string | null } }\n}>\n\n/**\n * @internal\n */\nfunction defineTextAlignAttrs<NodeName extends string>(\n types: NodeName[],\n defaultValue: string | null,\n): TextAlignAttrsExtension<NodeName> {\n return union(types.map((type) => defineTextAlignAttr(type, defaultValue)))\n}\n\n/**\n * @internal\n */\nexport function setTextAlign({\n types,\n value,\n}: {\n types: string[]\n value: string | null\n}): Command {\n return setNodeAttrsBetween({ type: types, attrs: { textAlign: value } })\n}\n\n/**\n * @internal\n */\nexport type TextAlignCommandsExtension = Extension<{\n Commands: {\n setTextAlign: [value: string | null]\n }\n}>\n\n/**\n * @internal\n */\nexport function defineTextAlignCommands(\n types: string[],\n): TextAlignCommandsExtension {\n return defineCommands({\n setTextAlign: (value: string | null) => setTextAlign({ types, value }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineTextAlignKeymap(types: string[]): PlainExtension {\n return defineKeymap({\n 'Mod-L': setTextAlign({ types, value: 'left' }),\n 'Mod-E': setTextAlign({ types, value: 'center' }),\n 'Mod-R': setTextAlign({ types, value: 'right' }),\n 'Mod-J': setTextAlign({ types, value: 'justify' }),\n })\n}\n\n/**\n * @internal\n */\nexport type TextAlignExtension<NodeName extends string> = Union<\n [TextAlignAttrsExtension<NodeName>, TextAlignCommandsExtension]\n>\n\n/**\n * Adds a `textAlign` attribute to the specified nodes. This will be rendered as\n * a CSS `text-align` style.\n *\n * @public\n */\nexport function defineTextAlign<NodeName extends string = string>(\n options: TextAlignOptions<NodeName>,\n): TextAlignExtension<NodeName> {\n return union(\n defineTextAlignAttrs<NodeName>(options.types, options.default || 'left'),\n defineTextAlignKeymap(options.types),\n defineTextAlignCommands(options.types),\n )\n}\n"],"mappings":";;;AAiCA,SAAS,oBACP,MACA,cACA;AACA,QAAO,eAAqD;EAC1D;EACA,MAAM;EACN,SAAS;EACT,YAAY;EACZ,QAAQ,UAAgB,QAAQ,CAAC,SAAS,cAAc,MAAM,GAAG,GAAG;EACpE,WAAW,SAAsB;AAC/B,UAAO,KAAK,MAAM,iBAAiB,aAAa,IAAI;;EAEvD,CAAC;;;;;AAaJ,SAAS,qBACP,OACA,cACmC;AACnC,QAAO,MAAM,MAAM,KAAK,SAAS,oBAAoB,MAAM,aAAa,CAAC,CAAC;;;;;AAM5E,SAAgB,aAAa,EAC3B,OACA,SAIU;AACV,QAAO,oBAAoB;EAAE,MAAM;EAAO,OAAO,EAAE,WAAW,OAAO;EAAE,CAAC;;;;;AAe1E,SAAgB,wBACd,OAC4B;AAC5B,QAAO,eAAe,EACpB,eAAe,UAAyB,aAAa;EAAE;EAAO;EAAO,CAAC,EACvE,CAAC;;;;;AAMJ,SAAgB,sBAAsB,OAAiC;AACrE,QAAO,aAAa;EAClB,SAAS,aAAa;GAAE;GAAO,OAAO;GAAQ,CAAC;EAC/C,SAAS,aAAa;GAAE;GAAO,OAAO;GAAU,CAAC;EACjD,SAAS,aAAa;GAAE;GAAO,OAAO;GAAS,CAAC;EAChD,SAAS,aAAa;GAAE;GAAO,OAAO;GAAW,CAAC;EACnD,CAAC;;;;;;;;AAgBJ,SAAgB,gBACd,SAC8B;AAC9B,QAAO,MACL,qBAA+B,QAAQ,OAAO,QAAQ,WAAW,OAAO,EACxE,sBAAsB,QAAQ,MAAM,EACpC,wBAAwB,QAAQ,MAAM,CACvC"}
1
+ {"version":3,"file":"prosekit-extensions-text-align.js","names":[],"sources":["../src/text-align/index.ts"],"sourcesContent":["import {\n defineCommands,\n defineKeymap,\n defineNodeAttr,\n setNodeAttrsBetween,\n union,\n type Extension,\n type PlainExtension,\n type Union,\n} from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\n\n/**\n * @public\n */\nexport interface TextAlignOptions<NodeName extends string = string> {\n /**\n * The names of node to add the attribute to.\n *\n * @example\n *\n * [\"paragraph\", \"heading\"]\n */\n types: NodeName[]\n\n /**\n * The default value for the attribute.\n *\n * @default \"left\"\n */\n default?: string\n}\n\nfunction defineTextAlignAttr<NodeName extends string>(\n type: NodeName,\n defaultValue: string | null,\n) {\n return defineNodeAttr<NodeName, 'textAlign', string | null>({\n type,\n attr: 'textAlign',\n default: defaultValue,\n splittable: true,\n toDOM: (value: any) => (value ? ['style', `text-align:${value};`] : null),\n parseDOM: (node: HTMLElement) => {\n return node.style.getPropertyValue('text-align') || null\n },\n })\n}\n\n/**\n * @internal\n */\nexport type TextAlignAttrsExtension<NodeName extends string> = Extension<{\n Nodes: { [K in NodeName]: { textAlign: string | null } }\n}>\n\n/**\n * @internal\n */\nfunction defineTextAlignAttrs<NodeName extends string>(\n types: NodeName[],\n defaultValue: string | null,\n): TextAlignAttrsExtension<NodeName> {\n return union(types.map((type) => defineTextAlignAttr(type, defaultValue)))\n}\n\n/**\n * @internal\n */\nexport function setTextAlign({\n types,\n value,\n}: {\n types: string[]\n value: string | null\n}): Command {\n return setNodeAttrsBetween({ type: types, attrs: { textAlign: value } })\n}\n\n/**\n * @internal\n */\nexport type TextAlignCommandsExtension = Extension<{\n Commands: {\n setTextAlign: [value: string | null]\n }\n}>\n\n/**\n * @internal\n */\nexport function defineTextAlignCommands(\n types: string[],\n): TextAlignCommandsExtension {\n return defineCommands({\n setTextAlign: (value: string | null) => setTextAlign({ types, value }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineTextAlignKeymap(types: string[]): PlainExtension {\n return defineKeymap({\n 'Mod-L': setTextAlign({ types, value: 'left' }),\n 'Mod-E': setTextAlign({ types, value: 'center' }),\n 'Mod-R': setTextAlign({ types, value: 'right' }),\n 'Mod-J': setTextAlign({ types, value: 'justify' }),\n })\n}\n\n/**\n * @internal\n */\nexport type TextAlignExtension<NodeName extends string> = Union<\n [TextAlignAttrsExtension<NodeName>, TextAlignCommandsExtension]\n>\n\n/**\n * Adds a `textAlign` attribute to the specified nodes. This will be rendered as\n * a CSS `text-align` style.\n *\n * @public\n */\nexport function defineTextAlign<NodeName extends string = string>(\n options: TextAlignOptions<NodeName>,\n): TextAlignExtension<NodeName> {\n return union(\n defineTextAlignAttrs<NodeName>(options.types, options.default || 'left'),\n defineTextAlignKeymap(options.types),\n defineTextAlignCommands(options.types),\n )\n}\n"],"mappings":";;AAiCA,SAAS,oBACP,MACA,cACA;AACA,QAAO,eAAqD;EAC1D;EACA,MAAM;EACN,SAAS;EACT,YAAY;EACZ,QAAQ,UAAgB,QAAQ,CAAC,SAAS,cAAc,MAAM,GAAG,GAAG;EACpE,WAAW,SAAsB;AAC/B,UAAO,KAAK,MAAM,iBAAiB,aAAa,IAAI;;EAEvD,CAAC;;;;;AAaJ,SAAS,qBACP,OACA,cACmC;AACnC,QAAO,MAAM,MAAM,KAAK,SAAS,oBAAoB,MAAM,aAAa,CAAC,CAAC;;;;;AAM5E,SAAgB,aAAa,EAC3B,OACA,SAIU;AACV,QAAO,oBAAoB;EAAE,MAAM;EAAO,OAAO,EAAE,WAAW,OAAO;EAAE,CAAC;;;;;AAe1E,SAAgB,wBACd,OAC4B;AAC5B,QAAO,eAAe,EACpB,eAAe,UAAyB,aAAa;EAAE;EAAO;EAAO,CAAC,EACvE,CAAC;;;;;AAMJ,SAAgB,sBAAsB,OAAiC;AACrE,QAAO,aAAa;EAClB,SAAS,aAAa;GAAE;GAAO,OAAO;GAAQ,CAAC;EAC/C,SAAS,aAAa;GAAE;GAAO,OAAO;GAAU,CAAC;EACjD,SAAS,aAAa;GAAE;GAAO,OAAO;GAAS,CAAC;EAChD,SAAS,aAAa;GAAE;GAAO,OAAO;GAAW,CAAC;EACnD,CAAC;;;;;;;;AAgBJ,SAAgB,gBACd,SAC8B;AAC9B,QAAO,MACL,qBAA+B,QAAQ,OAAO,QAAQ,WAAW,OAAO,EACxE,sBAAsB,QAAQ,MAAM,EACpC,wBAAwB,QAAQ,MAAM,CACvC"}
@@ -1,5 +1,4 @@
1
1
  import { addMark, defineCommands, defineMarkSpec, removeMark, union } from "@prosekit/core";
2
-
3
2
  //#region src/text-color/text-color-commands.ts
4
3
  /**
5
4
  * @internal
@@ -25,7 +24,6 @@ function defineTextColorCommands() {
25
24
  removeTextColor
26
25
  });
27
26
  }
28
-
29
27
  //#endregion
30
28
  //#region src/text-color/text-color-spec.ts
31
29
  /**
@@ -59,7 +57,6 @@ function defineTextColorSpec() {
59
57
  }
60
58
  });
61
59
  }
62
-
63
60
  //#endregion
64
61
  //#region src/text-color/text-color.ts
65
62
  /**
@@ -70,7 +67,7 @@ function defineTextColorSpec() {
70
67
  function defineTextColor() {
71
68
  return union(defineTextColorSpec(), defineTextColorCommands());
72
69
  }
73
-
74
70
  //#endregion
75
71
  export { addTextColor, defineTextColor, defineTextColorCommands, defineTextColorSpec, removeTextColor };
72
+
76
73
  //# sourceMappingURL=prosekit-extensions-text-color.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-extensions-text-color.js","names":[],"sources":["../src/text-color/text-color-commands.ts","../src/text-color/text-color-spec.ts","../src/text-color/text-color.ts"],"sourcesContent":["import { addMark, defineCommands, removeMark, type Extension } from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\n\nimport type { TextColorAttrs } from './text-color-spec.ts'\n\n/**\n * @internal\n */\nexport function addTextColor(attrs: TextColorAttrs): Command {\n return addMark({ type: 'textColor', attrs })\n}\n\n/**\n * @internal\n */\nexport function removeTextColor(): Command {\n return removeMark({ type: 'textColor' })\n}\n\n/**\n * @internal\n */\nexport type TextColorCommandsExtension = Extension<{\n Commands: {\n addTextColor: [attrs: TextColorAttrs]\n removeTextColor: []\n }\n}>\n\n/**\n * @internal\n */\nexport function defineTextColorCommands(): TextColorCommandsExtension {\n return defineCommands({ addTextColor, removeTextColor })\n}\n","import { defineMarkSpec, type Extension } from '@prosekit/core'\n\n/**\n * Attributes for the `textColor` mark.\n *\n * @public\n */\nexport interface TextColorAttrs {\n color: string\n}\n\n/**\n * @internal\n */\nexport type TextColorSpecExtension = Extension<{\n Marks: {\n textColor: TextColorAttrs\n }\n}>\n\n/**\n * @internal\n */\nexport function defineTextColorSpec(): TextColorSpecExtension {\n return defineMarkSpec<'textColor', TextColorAttrs>({\n name: 'textColor',\n attrs: {\n color: {\n validate: 'string',\n },\n },\n parseDOM: [\n {\n tag: ':where([style*=\"color:\"], [data-text-color])',\n getAttrs: (node): TextColorAttrs | false => {\n // When both `data-text-color` and `style=\"color\"` are present, we\n // prioritize the `data-text-color` attribute. This avoids the\n // browser's default behavior of changing hex colors to rgba in style\n // attribute.\n const value = node.getAttribute('data-text-color')\n if (value && value !== 'inherit') {\n return { color: value }\n }\n const color = node.style.color\n if (color && color !== 'inherit') {\n return { color }\n }\n return false\n },\n consuming: false,\n },\n ],\n toDOM(mark) {\n const color = (mark.attrs as TextColorAttrs).color\n return ['span', { 'style': `color: ${color};`, 'data-text-color': color }, 0]\n },\n })\n}\n","import { union, type Union } from '@prosekit/core'\n\nimport { defineTextColorCommands, type TextColorCommandsExtension } from './text-color-commands.ts'\nimport { defineTextColorSpec, type TextColorSpecExtension } from './text-color-spec.ts'\n\n/**\n * @internal\n */\nexport type TextColorExtension = Union<[TextColorSpecExtension, TextColorCommandsExtension]>\n\n/**\n * Defines the `textColor` mark and some commands for it.\n *\n * @public\n */\nexport function defineTextColor(): TextColorExtension {\n return union(\n defineTextColorSpec(),\n defineTextColorCommands(),\n )\n}\n"],"mappings":";;;;;;AAQA,SAAgB,aAAa,OAAgC;AAC3D,QAAO,QAAQ;EAAE,MAAM;EAAa;EAAO,CAAC;;;;;AAM9C,SAAgB,kBAA2B;AACzC,QAAO,WAAW,EAAE,MAAM,aAAa,CAAC;;;;;AAgB1C,SAAgB,0BAAsD;AACpE,QAAO,eAAe;EAAE;EAAc;EAAiB,CAAC;;;;;;;;ACV1D,SAAgB,sBAA8C;AAC5D,QAAO,eAA4C;EACjD,MAAM;EACN,OAAO,EACL,OAAO,EACL,UAAU,UACX,EACF;EACD,UAAU,CACR;GACE,KAAK;GACL,WAAW,SAAiC;IAK1C,MAAM,QAAQ,KAAK,aAAa,kBAAkB;AAClD,QAAI,SAAS,UAAU,UACrB,QAAO,EAAE,OAAO,OAAO;IAEzB,MAAM,QAAQ,KAAK,MAAM;AACzB,QAAI,SAAS,UAAU,UACrB,QAAO,EAAE,OAAO;AAElB,WAAO;;GAET,WAAW;GACZ,CACF;EACD,MAAM,MAAM;GACV,MAAM,QAAS,KAAK,MAAyB;AAC7C,UAAO;IAAC;IAAQ;KAAE,SAAS,UAAU,MAAM;KAAI,mBAAmB;KAAO;IAAE;IAAE;;EAEhF,CAAC;;;;;;;;;;ACzCJ,SAAgB,kBAAsC;AACpD,QAAO,MACL,qBAAqB,EACrB,yBAAyB,CAC1B"}
1
+ {"version":3,"file":"prosekit-extensions-text-color.js","names":[],"sources":["../src/text-color/text-color-commands.ts","../src/text-color/text-color-spec.ts","../src/text-color/text-color.ts"],"sourcesContent":["import { addMark, defineCommands, removeMark, type Extension } from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\n\nimport type { TextColorAttrs } from './text-color-spec.ts'\n\n/**\n * @internal\n */\nexport function addTextColor(attrs: TextColorAttrs): Command {\n return addMark({ type: 'textColor', attrs })\n}\n\n/**\n * @internal\n */\nexport function removeTextColor(): Command {\n return removeMark({ type: 'textColor' })\n}\n\n/**\n * @internal\n */\nexport type TextColorCommandsExtension = Extension<{\n Commands: {\n addTextColor: [attrs: TextColorAttrs]\n removeTextColor: []\n }\n}>\n\n/**\n * @internal\n */\nexport function defineTextColorCommands(): TextColorCommandsExtension {\n return defineCommands({ addTextColor, removeTextColor })\n}\n","import { defineMarkSpec, type Extension } from '@prosekit/core'\n\n/**\n * Attributes for the `textColor` mark.\n *\n * @public\n */\nexport interface TextColorAttrs {\n color: string\n}\n\n/**\n * @internal\n */\nexport type TextColorSpecExtension = Extension<{\n Marks: {\n textColor: TextColorAttrs\n }\n}>\n\n/**\n * @internal\n */\nexport function defineTextColorSpec(): TextColorSpecExtension {\n return defineMarkSpec<'textColor', TextColorAttrs>({\n name: 'textColor',\n attrs: {\n color: {\n validate: 'string',\n },\n },\n parseDOM: [\n {\n tag: ':where([style*=\"color:\"], [data-text-color])',\n getAttrs: (node): TextColorAttrs | false => {\n // When both `data-text-color` and `style=\"color\"` are present, we\n // prioritize the `data-text-color` attribute. This avoids the\n // browser's default behavior of changing hex colors to rgba in style\n // attribute.\n const value = node.getAttribute('data-text-color')\n if (value && value !== 'inherit') {\n return { color: value }\n }\n const color = node.style.color\n if (color && color !== 'inherit') {\n return { color }\n }\n return false\n },\n consuming: false,\n },\n ],\n toDOM(mark) {\n const color = (mark.attrs as TextColorAttrs).color\n return ['span', { 'style': `color: ${color};`, 'data-text-color': color }, 0]\n },\n })\n}\n","import { union, type Union } from '@prosekit/core'\n\nimport { defineTextColorCommands, type TextColorCommandsExtension } from './text-color-commands.ts'\nimport { defineTextColorSpec, type TextColorSpecExtension } from './text-color-spec.ts'\n\n/**\n * @internal\n */\nexport type TextColorExtension = Union<[TextColorSpecExtension, TextColorCommandsExtension]>\n\n/**\n * Defines the `textColor` mark and some commands for it.\n *\n * @public\n */\nexport function defineTextColor(): TextColorExtension {\n return union(\n defineTextColorSpec(),\n defineTextColorCommands(),\n )\n}\n"],"mappings":";;;;;AAQA,SAAgB,aAAa,OAAgC;AAC3D,QAAO,QAAQ;EAAE,MAAM;EAAa;EAAO,CAAC;;;;;AAM9C,SAAgB,kBAA2B;AACzC,QAAO,WAAW,EAAE,MAAM,aAAa,CAAC;;;;;AAgB1C,SAAgB,0BAAsD;AACpE,QAAO,eAAe;EAAE;EAAc;EAAiB,CAAC;;;;;;;ACV1D,SAAgB,sBAA8C;AAC5D,QAAO,eAA4C;EACjD,MAAM;EACN,OAAO,EACL,OAAO,EACL,UAAU,UACX,EACF;EACD,UAAU,CACR;GACE,KAAK;GACL,WAAW,SAAiC;IAK1C,MAAM,QAAQ,KAAK,aAAa,kBAAkB;AAClD,QAAI,SAAS,UAAU,UACrB,QAAO,EAAE,OAAO,OAAO;IAEzB,MAAM,QAAQ,KAAK,MAAM;AACzB,QAAI,SAAS,UAAU,UACrB,QAAO,EAAE,OAAO;AAElB,WAAO;;GAET,WAAW;GACZ,CACF;EACD,MAAM,MAAM;GACV,MAAM,QAAS,KAAK,MAAyB;AAC7C,UAAO;IAAC;IAAQ;KAAE,SAAS,UAAU,MAAM;KAAI,mBAAmB;KAAO;IAAE;IAAE;;EAEhF,CAAC;;;;;;;;;ACzCJ,SAAgB,kBAAsC;AACpD,QAAO,MACL,qBAAqB,EACrB,yBAAyB,CAC1B"}
@@ -1,5 +1,4 @@
1
1
  import { defineNodeSpec } from "@prosekit/core";
2
-
3
2
  //#region src/text/index.ts
4
3
  /**
5
4
  * @public
@@ -10,7 +9,7 @@ function defineText() {
10
9
  group: "inline"
11
10
  });
12
11
  }
13
-
14
12
  //#endregion
15
13
  export { defineText };
14
+
16
15
  //# sourceMappingURL=prosekit-extensions-text.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-extensions-text.js","names":[],"sources":["../src/text/index.ts"],"sourcesContent":["import { defineNodeSpec, type Extension } from '@prosekit/core'\nimport type { Attrs } from '@prosekit/pm/model'\n\n/**\n * @internal\n */\nexport type TextExtension = Extension<{\n Nodes: {\n text: Attrs\n }\n}>\n\n/**\n * @public\n */\nexport function defineText(): TextExtension {\n return defineNodeSpec({\n name: 'text',\n group: 'inline',\n })\n}\n"],"mappings":";;;;;;AAeA,SAAgB,aAA4B;AAC1C,QAAO,eAAe;EACpB,MAAM;EACN,OAAO;EACR,CAAC"}
1
+ {"version":3,"file":"prosekit-extensions-text.js","names":[],"sources":["../src/text/index.ts"],"sourcesContent":["import { defineNodeSpec, type Extension } from '@prosekit/core'\nimport type { Attrs } from '@prosekit/pm/model'\n\n/**\n * @internal\n */\nexport type TextExtension = Extension<{\n Nodes: {\n text: Attrs\n }\n}>\n\n/**\n * @public\n */\nexport function defineText(): TextExtension {\n return defineNodeSpec({\n name: 'text',\n group: 'inline',\n })\n}\n"],"mappings":";;;;;AAeA,SAAgB,aAA4B;AAC1C,QAAO,eAAe;EACpB,MAAM;EACN,OAAO;EACR,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { defineCommands, defineKeymap, defineMarkSpec, toggleMark, union } from "@prosekit/core";
2
-
3
2
  //#region src/underline/index.ts
4
3
  /**
5
4
  * @internal
@@ -36,7 +35,7 @@ function defineUnderlineKeymap() {
36
35
  function defineUnderline() {
37
36
  return union(defineUnderlineSpec(), defineUnderlineCommands(), defineUnderlineKeymap());
38
37
  }
39
-
40
38
  //#endregion
41
39
  export { defineUnderline, defineUnderlineCommands, defineUnderlineKeymap, defineUnderlineSpec };
40
+
42
41
  //# sourceMappingURL=prosekit-extensions-underline.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-extensions-underline.js","names":[],"sources":["../src/underline/index.ts"],"sourcesContent":["import {\n defineCommands,\n defineKeymap,\n defineMarkSpec,\n toggleMark,\n union,\n type Extension,\n type PlainExtension,\n type Union,\n} from '@prosekit/core'\nimport type { Attrs } from '@prosekit/pm/model'\n\n/**\n * @internal\n */\nexport type UnderlineSpecExtension = Extension<{\n Marks: {\n underline: Attrs\n }\n}>\n\n/**\n * @internal\n */\nexport function defineUnderlineSpec(): UnderlineSpecExtension {\n return defineMarkSpec({\n name: 'underline',\n parseDOM: [\n { tag: 'u' },\n { tag: 'underline' },\n { style: 'text-decoration=underline' },\n { style: 'text-decoration-line=underline' },\n ],\n toDOM() {\n return ['u', 0]\n },\n })\n}\n\n/**\n * @internal\n */\nexport type UnderlineCommandsExtension = Extension<{\n Commands: {\n toggleUnderline: []\n }\n}>\n\n/**\n * @internal\n */\nexport function defineUnderlineCommands(): UnderlineCommandsExtension {\n return defineCommands({\n toggleUnderline: () => toggleMark({ type: 'underline' }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineUnderlineKeymap(): PlainExtension {\n return defineKeymap({\n 'Mod-u': toggleMark({ type: 'underline' }),\n })\n}\n\n/**\n * @internal\n */\nexport type UnderlineExtension = Union<\n [UnderlineSpecExtension, UnderlineCommandsExtension]\n>\n\n/**\n * @public\n */\nexport function defineUnderline(): UnderlineExtension {\n return union(\n defineUnderlineSpec(),\n defineUnderlineCommands(),\n defineUnderlineKeymap(),\n )\n}\n"],"mappings":";;;;;;AAwBA,SAAgB,sBAA8C;AAC5D,QAAO,eAAe;EACpB,MAAM;EACN,UAAU;GACR,EAAE,KAAK,KAAK;GACZ,EAAE,KAAK,aAAa;GACpB,EAAE,OAAO,6BAA6B;GACtC,EAAE,OAAO,kCAAkC;GAC5C;EACD,QAAQ;AACN,UAAO,CAAC,KAAK,EAAE;;EAElB,CAAC;;;;;AAeJ,SAAgB,0BAAsD;AACpE,QAAO,eAAe,EACpB,uBAAuB,WAAW,EAAE,MAAM,aAAa,CAAC,EACzD,CAAC;;;;;AAMJ,SAAgB,wBAAwC;AACtD,QAAO,aAAa,EAClB,SAAS,WAAW,EAAE,MAAM,aAAa,CAAC,EAC3C,CAAC;;;;;AAaJ,SAAgB,kBAAsC;AACpD,QAAO,MACL,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,CACxB"}
1
+ {"version":3,"file":"prosekit-extensions-underline.js","names":[],"sources":["../src/underline/index.ts"],"sourcesContent":["import {\n defineCommands,\n defineKeymap,\n defineMarkSpec,\n toggleMark,\n union,\n type Extension,\n type PlainExtension,\n type Union,\n} from '@prosekit/core'\nimport type { Attrs } from '@prosekit/pm/model'\n\n/**\n * @internal\n */\nexport type UnderlineSpecExtension = Extension<{\n Marks: {\n underline: Attrs\n }\n}>\n\n/**\n * @internal\n */\nexport function defineUnderlineSpec(): UnderlineSpecExtension {\n return defineMarkSpec({\n name: 'underline',\n parseDOM: [\n { tag: 'u' },\n { tag: 'underline' },\n { style: 'text-decoration=underline' },\n { style: 'text-decoration-line=underline' },\n ],\n toDOM() {\n return ['u', 0]\n },\n })\n}\n\n/**\n * @internal\n */\nexport type UnderlineCommandsExtension = Extension<{\n Commands: {\n toggleUnderline: []\n }\n}>\n\n/**\n * @internal\n */\nexport function defineUnderlineCommands(): UnderlineCommandsExtension {\n return defineCommands({\n toggleUnderline: () => toggleMark({ type: 'underline' }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineUnderlineKeymap(): PlainExtension {\n return defineKeymap({\n 'Mod-u': toggleMark({ type: 'underline' }),\n })\n}\n\n/**\n * @internal\n */\nexport type UnderlineExtension = Union<\n [UnderlineSpecExtension, UnderlineCommandsExtension]\n>\n\n/**\n * @public\n */\nexport function defineUnderline(): UnderlineExtension {\n return union(\n defineUnderlineSpec(),\n defineUnderlineCommands(),\n defineUnderlineKeymap(),\n )\n}\n"],"mappings":";;;;;AAwBA,SAAgB,sBAA8C;AAC5D,QAAO,eAAe;EACpB,MAAM;EACN,UAAU;GACR,EAAE,KAAK,KAAK;GACZ,EAAE,KAAK,aAAa;GACpB,EAAE,OAAO,6BAA6B;GACtC,EAAE,OAAO,kCAAkC;GAC5C;EACD,QAAQ;AACN,UAAO,CAAC,KAAK,EAAE;;EAElB,CAAC;;;;;AAeJ,SAAgB,0BAAsD;AACpE,QAAO,eAAe,EACpB,uBAAuB,WAAW,EAAE,MAAM,aAAa,CAAC,EACzD,CAAC;;;;;AAMJ,SAAgB,wBAAwC;AACtD,QAAO,aAAa,EAClB,SAAS,WAAW,EAAE,MAAM,aAAa,CAAC,EAC3C,CAAC;;;;;AAaJ,SAAgB,kBAAsC;AACpD,QAAO,MACL,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,CACxB"}
@@ -1,7 +1,6 @@
1
1
  import { PluginKey, ProseMirrorPlugin } from "@prosekit/pm/state";
2
2
  import { definePlugin } from "@prosekit/core";
3
3
  import { Decoration, DecorationSet } from "@prosekit/pm/view";
4
-
5
4
  //#region src/virtual-selection/index.ts
6
5
  /**
7
6
  * Shows a virtual selection when the editor is not focused. When the editor is
@@ -52,7 +51,7 @@ const virtualSelectionPlugin = new ProseMirrorPlugin({
52
51
  }
53
52
  }
54
53
  });
55
-
56
54
  //#endregion
57
55
  export { defineVirtualSelection };
56
+
58
57
  //# sourceMappingURL=prosekit-extensions-virtual-selection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-extensions-virtual-selection.js","names":[],"sources":["../src/virtual-selection/index.ts"],"sourcesContent":["import { definePlugin, type PlainExtension } from '@prosekit/core'\nimport { PluginKey, ProseMirrorPlugin, type EditorState, type Transaction } from '@prosekit/pm/state'\nimport { Decoration, DecorationSet } from '@prosekit/pm/view'\n\n/**\n * @internal\n */\nexport type VirtualSelectionExtension = PlainExtension\n\n/**\n * Shows a virtual selection when the editor is not focused. When the editor is\n * not focused, the selected inline content will be wrapped in a `<span>`\n * element with the class `prosekit-virtual-selection`.\n *\n * This is useful when you want to move the focus to an element outside the\n * editor, but still want to show the selection.\n *\n * @public\n */\nexport function defineVirtualSelection(): VirtualSelectionExtension {\n return definePlugin(virtualSelectionPlugin)\n}\n\n// Show the decoration when this is true.\ntype PluginState = boolean\n\nconst key = new PluginKey<PluginState>('prosekit-virtual-selection')\n\nfunction getFocusMeta(tr: Transaction): PluginState | undefined {\n return tr.getMeta(key) as PluginState | undefined\n}\n\nfunction setFocusMeta(tr: Transaction, value: PluginState) {\n return tr.setMeta(key, value)\n}\n\nfunction getFocusState(state: EditorState): PluginState | undefined {\n return key.getState(state)\n}\n\nconst virtualSelectionPlugin = new ProseMirrorPlugin<PluginState>({\n key,\n state: {\n init: () => false,\n apply: (tr, value) => {\n return getFocusMeta(tr) ?? value\n },\n },\n props: {\n handleDOMEvents: {\n focus: (view) => {\n view.dispatch(setFocusMeta(view.state.tr, false))\n },\n\n blur: (view) => {\n const { dom, root } = view\n const activeElement = root.activeElement\n\n // Don't show the decoration if the dom is blurred because the focus\n // moved outside the browser window.\n if (activeElement === dom) return\n\n view.dispatch(setFocusMeta(view.state.tr, true))\n },\n },\n decorations: (state) => {\n const { selection, doc } = state\n\n if (\n selection.empty\n || !getFocusState(state)\n // When `selection.visible` is false, it indicates that the selection is\n // rendered by the editor and it's not a native browser selection. An\n // example of this is `NodeSelection`. In this situation, since the\n // editor already shows the selection, we don't need to display a\n // virtual selection.\n || !selection.visible\n ) {\n return null\n }\n\n return DecorationSet.create(doc, [\n Decoration.inline(selection.from, selection.to, {\n class: 'prosekit-virtual-selection',\n }),\n ])\n },\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;AAmBA,SAAgB,yBAAoD;AAClE,QAAO,aAAa,uBAAuB;;AAM7C,MAAM,MAAM,IAAI,UAAuB,6BAA6B;AAEpE,SAAS,aAAa,IAA0C;AAC9D,QAAO,GAAG,QAAQ,IAAI;;AAGxB,SAAS,aAAa,IAAiB,OAAoB;AACzD,QAAO,GAAG,QAAQ,KAAK,MAAM;;AAG/B,SAAS,cAAc,OAA6C;AAClE,QAAO,IAAI,SAAS,MAAM;;AAG5B,MAAM,yBAAyB,IAAI,kBAA+B;CAChE;CACA,OAAO;EACL,YAAY;EACZ,QAAQ,IAAI,UAAU;AACpB,UAAO,aAAa,GAAG,IAAI;;EAE9B;CACD,OAAO;EACL,iBAAiB;GACf,QAAQ,SAAS;AACf,SAAK,SAAS,aAAa,KAAK,MAAM,IAAI,MAAM,CAAC;;GAGnD,OAAO,SAAS;IACd,MAAM,EAAE,KAAK,SAAS;AAKtB,QAJsB,KAAK,kBAIL,IAAK;AAE3B,SAAK,SAAS,aAAa,KAAK,MAAM,IAAI,KAAK,CAAC;;GAEnD;EACD,cAAc,UAAU;GACtB,MAAM,EAAE,WAAW,QAAQ;AAE3B,OACE,UAAU,SACP,CAAC,cAAc,MAAM,IAMrB,CAAC,UAAU,QAEd,QAAO;AAGT,UAAO,cAAc,OAAO,KAAK,CAC/B,WAAW,OAAO,UAAU,MAAM,UAAU,IAAI,EAC9C,OAAO,8BACR,CAAC,CACH,CAAC;;EAEL;CACF,CAAC"}
1
+ {"version":3,"file":"prosekit-extensions-virtual-selection.js","names":[],"sources":["../src/virtual-selection/index.ts"],"sourcesContent":["import { definePlugin, type PlainExtension } from '@prosekit/core'\nimport { PluginKey, ProseMirrorPlugin, type EditorState, type Transaction } from '@prosekit/pm/state'\nimport { Decoration, DecorationSet } from '@prosekit/pm/view'\n\n/**\n * @internal\n */\nexport type VirtualSelectionExtension = PlainExtension\n\n/**\n * Shows a virtual selection when the editor is not focused. When the editor is\n * not focused, the selected inline content will be wrapped in a `<span>`\n * element with the class `prosekit-virtual-selection`.\n *\n * This is useful when you want to move the focus to an element outside the\n * editor, but still want to show the selection.\n *\n * @public\n */\nexport function defineVirtualSelection(): VirtualSelectionExtension {\n return definePlugin(virtualSelectionPlugin)\n}\n\n// Show the decoration when this is true.\ntype PluginState = boolean\n\nconst key = new PluginKey<PluginState>('prosekit-virtual-selection')\n\nfunction getFocusMeta(tr: Transaction): PluginState | undefined {\n return tr.getMeta(key) as PluginState | undefined\n}\n\nfunction setFocusMeta(tr: Transaction, value: PluginState) {\n return tr.setMeta(key, value)\n}\n\nfunction getFocusState(state: EditorState): PluginState | undefined {\n return key.getState(state)\n}\n\nconst virtualSelectionPlugin = new ProseMirrorPlugin<PluginState>({\n key,\n state: {\n init: () => false,\n apply: (tr, value) => {\n return getFocusMeta(tr) ?? value\n },\n },\n props: {\n handleDOMEvents: {\n focus: (view) => {\n view.dispatch(setFocusMeta(view.state.tr, false))\n },\n\n blur: (view) => {\n const { dom, root } = view\n const activeElement = root.activeElement\n\n // Don't show the decoration if the dom is blurred because the focus\n // moved outside the browser window.\n if (activeElement === dom) return\n\n view.dispatch(setFocusMeta(view.state.tr, true))\n },\n },\n decorations: (state) => {\n const { selection, doc } = state\n\n if (\n selection.empty\n || !getFocusState(state)\n // When `selection.visible` is false, it indicates that the selection is\n // rendered by the editor and it's not a native browser selection. An\n // example of this is `NodeSelection`. In this situation, since the\n // editor already shows the selection, we don't need to display a\n // virtual selection.\n || !selection.visible\n ) {\n return null\n }\n\n return DecorationSet.create(doc, [\n Decoration.inline(selection.from, selection.to, {\n class: 'prosekit-virtual-selection',\n }),\n ])\n },\n },\n})\n"],"mappings":";;;;;;;;;;;;;;AAmBA,SAAgB,yBAAoD;AAClE,QAAO,aAAa,uBAAuB;;AAM7C,MAAM,MAAM,IAAI,UAAuB,6BAA6B;AAEpE,SAAS,aAAa,IAA0C;AAC9D,QAAO,GAAG,QAAQ,IAAI;;AAGxB,SAAS,aAAa,IAAiB,OAAoB;AACzD,QAAO,GAAG,QAAQ,KAAK,MAAM;;AAG/B,SAAS,cAAc,OAA6C;AAClE,QAAO,IAAI,SAAS,MAAM;;AAG5B,MAAM,yBAAyB,IAAI,kBAA+B;CAChE;CACA,OAAO;EACL,YAAY;EACZ,QAAQ,IAAI,UAAU;AACpB,UAAO,aAAa,GAAG,IAAI;;EAE9B;CACD,OAAO;EACL,iBAAiB;GACf,QAAQ,SAAS;AACf,SAAK,SAAS,aAAa,KAAK,MAAM,IAAI,MAAM,CAAC;;GAGnD,OAAO,SAAS;IACd,MAAM,EAAE,KAAK,SAAS;AAKtB,QAJsB,KAAK,kBAIL,IAAK;AAE3B,SAAK,SAAS,aAAa,KAAK,MAAM,IAAI,KAAK,CAAC;;GAEnD;EACD,cAAc,UAAU;GACtB,MAAM,EAAE,WAAW,QAAQ;AAE3B,OACE,UAAU,SACP,CAAC,cAAc,MAAM,IAMrB,CAAC,UAAU,QAEd,QAAO;AAGT,UAAO,cAAc,OAAO,KAAK,CAC/B,WAAW,OAAO,UAAU,MAAM,UAAU,IAAI,EAC9C,OAAO,8BACR,CAAC,CACH,CAAC;;EAEL;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-extensions-yjs.d.ts","names":[],"sources":["../src/yjs/yjs-commands.ts","../src/yjs/yjs-types.ts","../src/yjs/yjs-cursor-plugin.ts","../src/yjs/yjs-keymap.ts","../src/yjs/yjs-sync-plugin.ts","../src/yjs/yjs-undo-plugin.ts","../src/yjs/yjs.ts"],"mappings":";;;;;;;;KAWY,oBAAA,GAAuB,SAAA;EACjC,QAAA;IACE,IAAA;IACA,IAAA;EAAA;AAAA;AAAA,iBAIY,iBAAA,CAAA,GAAqB,oBAAA;;;;;;;AAPrC;KCJY,SAAA,GAAY,UAAA,QAAkB,aAAA;;;;;ADI1C;KEFY,sBAAA,GAAyB,WAAA,CACnC,UAAA,QAAkB,aAAA;AAAA,UAGH,gBAAA,SAAyB,sBAAA;EACxC,SAAA,EAAW,SAAA;AAAA;AAAA,iBAGG,qBAAA,CACd,OAAA,EAAS,gBAAA,GACR,cAAA;;;iBCPa,eAAA,CAAA,GAAmB,cAAA;;;;;AHDnC;KIHY,oBAAA,GAAuB,WAAA,CACjC,UAAA,QAAkB,WAAA;AAAA,UAGH,cAAA,SAAuB,oBAAA;EACtC,QAAA,EAAU,CAAA,CAAE,WAAA;AAAA;AAAA,iBAGE,mBAAA,CAAoB,OAAA,EAAS,cAAA,GAAiB,cAAA;;;;;;KC6ClD,oBAAA,GAAuB,WAAA,CACjC,UAAA,QAAkB,WAAA;AAAA,UAGH,cAAA,SAAuB,oBAAA;;;;iBAcxB,mBAAA,CAAoB,OAAA,EAAS,cAAA,GAAiB,cAAA;;;UCrE7C,UAAA;ENC2B;;;EMG1C,GAAA,EAAK,CAAA,CAAE,GAAA;ENAL;;;EMKF,SAAA,EAAW,SAAA;ENDoB;;;;EMO/B,QAAA,GAAW,CAAA,CAAE,WAAA;;;ALlBf;EKuBE,IAAA,GAAO,oBAAA;;;;EAKP,IAAA,GAAO,oBAAA;;;AJ1BT;EI+BE,MAAA,GAAS,sBAAA;AAAA;;;;KAMC,YAAA,GAAe,KAAA,EAAO,oBAAA,EAAsB,cAAA;;;;iBAKxC,SAAA,CAAU,OAAA,EAAS,UAAA,GAAa,YAAA"}
1
+ {"version":3,"file":"prosekit-extensions-yjs.d.ts","names":[],"sources":["../src/yjs/yjs-commands.ts","../src/yjs/yjs-types.ts","../src/yjs/yjs-cursor-plugin.ts","../src/yjs/yjs-keymap.ts","../src/yjs/yjs-sync-plugin.ts","../src/yjs/yjs-undo-plugin.ts","../src/yjs/yjs.ts"],"mappings":";;;;;;;;KAWY,oBAAA,GAAuB,SAAA;EACjC,QAAA;IACE,IAAA;IACA,IAAA;EAAA;AAAA;AAAA,iBAIY,iBAAA,CAAA,GAAqB,oBAAA;;;;;;;AAPrC;KCJY,SAAA,GAAY,UAAA,QAAkB,aAAA;;;;;ADI1C;KEFY,sBAAA,GAAyB,WAAA,CACnC,UAAA,QAAkB,aAAA;AAAA,UAGH,gBAAA,SAAyB,sBAAA;EACxC,SAAA,EAAW,SAAA;AAAA;AAAA,iBAGG,qBAAA,CACd,OAAA,EAAS,gBAAA,GACR,cAAA;;;iBCPa,eAAA,CAAA,GAAmB,cAAA;;;;;AHDnC;KIHY,oBAAA,GAAuB,WAAA,CACjC,UAAA,QAAkB,WAAA;AAAA,UAGH,cAAA,SAAuB,oBAAA;EACtC,QAAA,EAAU,CAAA,CAAE,WAAA;AAAA;AAAA,iBAGE,mBAAA,CAAoB,OAAA,EAAS,cAAA,GAAiB,cAAA;;;;;;KC6ClD,oBAAA,GAAuB,WAAA,CACjC,UAAA,QAAkB,WAAA;AAAA,UAGH,cAAA,SAAuB,oBAAA;;;;iBAcxB,mBAAA,CAAoB,OAAA,EAAS,cAAA,GAAiB,cAAA;;;UCpE7C,UAAA;ENA2B;;;EMI1C,GAAA,EAAK,CAAA,CAAE,GAAA;ENDL;;;EMMF,SAAA,EAAW,SAAA;ENFoB;;;;EMQ/B,QAAA,GAAW,CAAA,CAAE,WAAA;;;ALnBf;EKwBE,IAAA,GAAO,oBAAA;;;;EAKP,IAAA,GAAO,oBAAA;;;AJ3BT;EIgCE,MAAA,GAAS,sBAAA;AAAA;;;;KAMC,YAAA,GAAe,KAAA,EAAO,oBAAA,EAAsB,cAAA;;;;iBAKxC,SAAA,CAAU,OAAA,EAAS,UAAA,GAAa,YAAA"}
@@ -1,6 +1,5 @@
1
- import { Priority, defineCommands, defineKeymap, definePlugin, isApple, union, withPriority } from "@prosekit/core";
1
+ import { defineCommands, defineKeymap, definePlugin, isApple, union, withPriority } from "@prosekit/core";
2
2
  import { redoCommand, undoCommand, yCursorPlugin, ySyncPlugin, yUndoPlugin, yUndoPluginKey } from "y-prosemirror";
3
-
4
3
  //#region src/yjs/yjs-commands.ts
5
4
  const commands = {
6
5
  undo: () => undoCommand,
@@ -9,14 +8,12 @@ const commands = {
9
8
  function defineYjsCommands() {
10
9
  return defineCommands(commands);
11
10
  }
12
-
13
11
  //#endregion
14
12
  //#region src/yjs/yjs-cursor-plugin.ts
15
13
  function defineYjsCursorPlugin(options) {
16
14
  const { awareness, ...rest } = options;
17
15
  return definePlugin(yCursorPlugin(awareness, rest));
18
16
  }
19
-
20
17
  //#endregion
21
18
  //#region src/yjs/yjs-keymap.ts
22
19
  const keymap = {
@@ -27,14 +24,12 @@ if (!isApple) keymap["Mod-y"] = redoCommand;
27
24
  function defineYjsKeymap() {
28
25
  return defineKeymap(keymap);
29
26
  }
30
-
31
27
  //#endregion
32
28
  //#region src/yjs/yjs-sync-plugin.ts
33
29
  function defineYjsSyncPlugin(options) {
34
30
  const { fragment, ...rest } = options;
35
31
  return definePlugin(ySyncPlugin(fragment, rest));
36
32
  }
37
-
38
33
  //#endregion
39
34
  //#region src/yjs/yjs-undo-plugin.ts
40
35
  /**
@@ -77,7 +72,6 @@ function yUndoPlugin$1(options) {
77
72
  function defineYjsUndoPlugin(options) {
78
73
  return definePlugin(yUndoPlugin$1(options));
79
74
  }
80
-
81
75
  //#endregion
82
76
  //#region src/yjs/yjs.ts
83
77
  /**
@@ -98,9 +92,9 @@ function defineYjs(options) {
98
92
  ...sync,
99
93
  fragment
100
94
  })
101
- ]), Priority.high);
95
+ ]), 3);
102
96
  }
103
-
104
97
  //#endregion
105
98
  export { defineYjs, defineYjsCommands, defineYjsCursorPlugin, defineYjsKeymap, defineYjsSyncPlugin, defineYjsUndoPlugin };
99
+
106
100
  //# sourceMappingURL=prosekit-extensions-yjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-extensions-yjs.js","names":["yUndoPlugin","originalYUndoPlugin"],"sources":["../src/yjs/yjs-commands.ts","../src/yjs/yjs-cursor-plugin.ts","../src/yjs/yjs-keymap.ts","../src/yjs/yjs-sync-plugin.ts","../src/yjs/yjs-undo-plugin.ts","../src/yjs/yjs.ts"],"sourcesContent":["import { defineCommands, type Extension } from '@prosekit/core'\nimport { redoCommand, undoCommand } from 'y-prosemirror'\n\nconst commands = {\n undo: () => undoCommand,\n redo: () => redoCommand,\n} as const\n\n/**\n * @internal\n */\nexport type YjsCommandsExtension = Extension<{\n Commands: {\n undo: []\n redo: []\n }\n}>\n\nexport function defineYjsCommands(): YjsCommandsExtension {\n return defineCommands(commands)\n}\n","import { definePlugin, type PlainExtension } from '@prosekit/core'\nimport type { Plugin } from '@prosekit/pm/state'\nimport { yCursorPlugin } from 'y-prosemirror'\n\nimport type { Awareness } from './yjs-types.ts'\n\n/**\n * Options for `y-prosemirror`'s `yCursorPlugin`.\n */\nexport type YjsCursorPluginOptions = NonNullable<\n Parameters<typeof yCursorPlugin>[1]\n>\n\nexport interface YjsCursorOptions extends YjsCursorPluginOptions {\n awareness: Awareness\n}\n\nexport function defineYjsCursorPlugin(\n options: YjsCursorOptions,\n): PlainExtension {\n const { awareness, ...rest } = options\n return definePlugin(yCursorPlugin(awareness, rest) as Plugin)\n}\n","import { defineKeymap, isApple, type Keymap, type PlainExtension } from '@prosekit/core'\nimport { redoCommand, undoCommand } from 'y-prosemirror'\n\nconst keymap: Keymap = {\n 'Mod-z': undoCommand,\n 'Mod-Z': redoCommand,\n}\n\nif (!isApple) {\n keymap['Mod-y'] = redoCommand\n}\n\nexport function defineYjsKeymap(): PlainExtension {\n return defineKeymap(keymap)\n}\n","import { definePlugin, type PlainExtension } from '@prosekit/core'\nimport type { Plugin } from '@prosekit/pm/state'\nimport { ySyncPlugin } from 'y-prosemirror'\nimport type * as Y from 'yjs'\n\n/**\n * Options for `y-prosemirror`'s `ySyncPlugin`.\n */\nexport type YjsSyncPluginOptions = NonNullable<\n Parameters<typeof ySyncPlugin>[1]\n>\n\nexport interface YjsSyncOptions extends YjsSyncPluginOptions {\n fragment: Y.XmlFragment\n}\n\nexport function defineYjsSyncPlugin(options: YjsSyncOptions): PlainExtension {\n const { fragment, ...rest } = options\n return definePlugin(ySyncPlugin(fragment, rest) as Plugin)\n}\n","import { definePlugin, type PlainExtension } from '@prosekit/core'\nimport type { ProseMirrorPlugin } from '@prosekit/pm/state'\nimport type { EditorView } from '@prosekit/pm/view'\nimport { yUndoPlugin as originalYUndoPlugin, yUndoPluginKey, type UndoPluginState } from 'y-prosemirror'\nimport type { UndoManager as YjsUndoManager } from 'yjs'\n\ntype UndoManager = YjsUndoManager & { restore: () => void }\n\n/**\n * @see https://github.com/yjs/y-prosemirror/issues/114 and https://github.com/yjs/y-prosemirror/issues/102\n */\nfunction fixYUndoPlugin(yUndoPluginInstance: ProseMirrorPlugin) {\n const originalUndoPluginView = yUndoPluginInstance.spec.view\n yUndoPluginInstance.spec.view = (view: EditorView) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- The type definition in y-prosemirror is not correct. An explicit file extension should be added to this line: https://npmx.dev/package-code/y-prosemirror/v/1.3.7/dist%2Fsrc%2Fplugins%2Fkeys.d.ts#L13\n const pluginState: UndoPluginState | undefined = yUndoPluginKey.getState(view.state)\n if (!pluginState) {\n return {}\n }\n\n const undoManager = pluginState.undoManager as UndoManager\n\n if (undoManager.restore) {\n undoManager.restore()\n undoManager.restore = () => {}\n }\n\n const viewRet = originalUndoPluginView\n ? originalUndoPluginView(view)\n : undefined\n\n return {\n destroy: () => {\n const hasUndoManSelf = undoManager.trackedOrigins.has(undoManager)\n\n const observers = undoManager._observers\n\n undoManager.restore = () => {\n if (hasUndoManSelf) {\n undoManager.trackedOrigins.add(undoManager)\n }\n\n undoManager.doc.on(\n 'afterTransaction',\n undoManager.afterTransactionHandler,\n )\n\n undoManager._observers = observers\n }\n\n if (viewRet?.destroy) {\n viewRet.destroy()\n }\n },\n }\n }\n}\n\n/**\n * Options for the `y-prosemirror`'s `yUndoPlugin`.\n */\nexport type YjsUndoPluginOptions = NonNullable<\n Parameters<typeof originalYUndoPlugin>[0]\n>\n\nexport interface YjsUndoOptions extends YjsUndoPluginOptions {}\n\n/**\n * @internal\n */\nfunction yUndoPlugin(options?: YjsUndoOptions) {\n const yUndoPluginInstance = originalYUndoPlugin(options)\n fixYUndoPlugin(yUndoPluginInstance)\n return yUndoPluginInstance\n}\n\n/**\n * @internal\n */\nexport function defineYjsUndoPlugin(options: YjsUndoOptions): PlainExtension {\n return definePlugin(yUndoPlugin(options))\n}\n","import { Priority, union, withPriority, type PlainExtension, type Union } from '@prosekit/core'\nimport type * as Y from 'yjs'\n\nimport { defineYjsCommands, type YjsCommandsExtension } from './yjs-commands.ts'\nimport { defineYjsCursorPlugin, type YjsCursorPluginOptions } from './yjs-cursor-plugin.ts'\nimport { defineYjsKeymap } from './yjs-keymap.ts'\nimport { defineYjsSyncPlugin, type YjsSyncPluginOptions } from './yjs-sync-plugin.ts'\nimport type { Awareness } from './yjs-types.ts'\nimport { defineYjsUndoPlugin, type YjsUndoPluginOptions } from './yjs-undo-plugin.ts'\n\nexport interface YjsOptions {\n /**\n * The Yjs instance handles the state of shared data.\n */\n doc: Y.Doc\n\n /**\n * The Awareness instance.\n */\n awareness: Awareness\n\n /**\n * The Yjs XmlFragment to use. If not provided,\n * `doc.getXmlFragment('prosemirror')` will be used.\n */\n fragment?: Y.XmlFragment\n\n /**\n * Options for `y-prosemirror`'s `ySyncPlugin`.\n */\n sync?: YjsSyncPluginOptions\n\n /**\n * Options for the `y-prosemirror`'s `yUndoPlugin`.\n */\n undo?: YjsUndoPluginOptions\n\n /**\n * Options for `y-prosemirror`'s `yCursorPlugin`.\n */\n cursor?: YjsCursorPluginOptions\n}\n\n/**\n * @internal\n */\nexport type YjsExtension = Union<[YjsCommandsExtension, PlainExtension]>\n\n/**\n * @public\n */\nexport function defineYjs(options: YjsOptions): YjsExtension {\n const { doc, awareness, sync, undo, cursor } = options\n const fragment = options.fragment ?? doc.getXmlFragment('prosemirror')\n\n return withPriority(\n union([\n defineYjsKeymap(),\n defineYjsCommands(),\n defineYjsCursorPlugin({ ...cursor, awareness }),\n defineYjsUndoPlugin({ ...undo }),\n defineYjsSyncPlugin({ ...sync, fragment }),\n ]),\n Priority.high,\n )\n}\n"],"mappings":";;;;AAGA,MAAM,WAAW;CACf,YAAY;CACZ,YAAY;CACb;AAYD,SAAgB,oBAA0C;AACxD,QAAO,eAAe,SAAS;;;;;ACFjC,SAAgB,sBACd,SACgB;CAChB,MAAM,EAAE,WAAW,GAAG,SAAS;AAC/B,QAAO,aAAa,cAAc,WAAW,KAAK,CAAW;;;;;AClB/D,MAAM,SAAiB;CACrB,SAAS;CACT,SAAS;CACV;AAED,IAAI,CAAC,QACH,QAAO,WAAW;AAGpB,SAAgB,kBAAkC;AAChD,QAAO,aAAa,OAAO;;;;;ACG7B,SAAgB,oBAAoB,SAAyC;CAC3E,MAAM,EAAE,UAAU,GAAG,SAAS;AAC9B,QAAO,aAAa,YAAY,UAAU,KAAK,CAAW;;;;;;;;ACP5D,SAAS,eAAe,qBAAwC;CAC9D,MAAM,yBAAyB,oBAAoB,KAAK;AACxD,qBAAoB,KAAK,QAAQ,SAAqB;EAEpD,MAAM,cAA2C,eAAe,SAAS,KAAK,MAAM;AACpF,MAAI,CAAC,YACH,QAAO,EAAE;EAGX,MAAM,cAAc,YAAY;AAEhC,MAAI,YAAY,SAAS;AACvB,eAAY,SAAS;AACrB,eAAY,gBAAgB;;EAG9B,MAAM,UAAU,yBACZ,uBAAuB,KAAK,GAC5B;AAEJ,SAAO,EACL,eAAe;GACb,MAAM,iBAAiB,YAAY,eAAe,IAAI,YAAY;GAElE,MAAM,YAAY,YAAY;AAE9B,eAAY,gBAAgB;AAC1B,QAAI,eACF,aAAY,eAAe,IAAI,YAAY;AAG7C,gBAAY,IAAI,GACd,oBACA,YAAY,wBACb;AAED,gBAAY,aAAa;;AAG3B,OAAI,SAAS,QACX,SAAQ,SAAS;KAGtB;;;;;;AAgBL,SAASA,cAAY,SAA0B;CAC7C,MAAM,sBAAsBC,YAAoB,QAAQ;AACxD,gBAAe,oBAAoB;AACnC,QAAO;;;;;AAMT,SAAgB,oBAAoB,SAAyC;AAC3E,QAAO,aAAaD,cAAY,QAAQ,CAAC;;;;;;;;AC7B3C,SAAgB,UAAU,SAAmC;CAC3D,MAAM,EAAE,KAAK,WAAW,MAAM,MAAM,WAAW;CAC/C,MAAM,WAAW,QAAQ,YAAY,IAAI,eAAe,cAAc;AAEtE,QAAO,aACL,MAAM;EACJ,iBAAiB;EACjB,mBAAmB;EACnB,sBAAsB;GAAE,GAAG;GAAQ;GAAW,CAAC;EAC/C,oBAAoB,EAAE,GAAG,MAAM,CAAC;EAChC,oBAAoB;GAAE,GAAG;GAAM;GAAU,CAAC;EAC3C,CAAC,EACF,SAAS,KACV"}
1
+ {"version":3,"file":"prosekit-extensions-yjs.js","names":["yUndoPlugin","originalYUndoPlugin"],"sources":["../src/yjs/yjs-commands.ts","../src/yjs/yjs-cursor-plugin.ts","../src/yjs/yjs-keymap.ts","../src/yjs/yjs-sync-plugin.ts","../src/yjs/yjs-undo-plugin.ts","../src/yjs/yjs.ts"],"sourcesContent":["import { defineCommands, type Extension } from '@prosekit/core'\nimport { redoCommand, undoCommand } from 'y-prosemirror'\n\nconst commands = {\n undo: () => undoCommand,\n redo: () => redoCommand,\n} as const\n\n/**\n * @internal\n */\nexport type YjsCommandsExtension = Extension<{\n Commands: {\n undo: []\n redo: []\n }\n}>\n\nexport function defineYjsCommands(): YjsCommandsExtension {\n return defineCommands(commands)\n}\n","import { definePlugin, type PlainExtension } from '@prosekit/core'\nimport type { Plugin } from '@prosekit/pm/state'\nimport { yCursorPlugin } from 'y-prosemirror'\n\nimport type { Awareness } from './yjs-types.ts'\n\n/**\n * Options for `y-prosemirror`'s `yCursorPlugin`.\n */\nexport type YjsCursorPluginOptions = NonNullable<\n Parameters<typeof yCursorPlugin>[1]\n>\n\nexport interface YjsCursorOptions extends YjsCursorPluginOptions {\n awareness: Awareness\n}\n\nexport function defineYjsCursorPlugin(\n options: YjsCursorOptions,\n): PlainExtension {\n const { awareness, ...rest } = options\n return definePlugin(yCursorPlugin(awareness, rest) as Plugin)\n}\n","import { defineKeymap, isApple, type Keymap, type PlainExtension } from '@prosekit/core'\nimport { redoCommand, undoCommand } from 'y-prosemirror'\n\nconst keymap: Keymap = {\n 'Mod-z': undoCommand,\n 'Mod-Z': redoCommand,\n}\n\nif (!isApple) {\n keymap['Mod-y'] = redoCommand\n}\n\nexport function defineYjsKeymap(): PlainExtension {\n return defineKeymap(keymap)\n}\n","import { definePlugin, type PlainExtension } from '@prosekit/core'\nimport type { Plugin } from '@prosekit/pm/state'\nimport { ySyncPlugin } from 'y-prosemirror'\nimport type * as Y from 'yjs'\n\n/**\n * Options for `y-prosemirror`'s `ySyncPlugin`.\n */\nexport type YjsSyncPluginOptions = NonNullable<\n Parameters<typeof ySyncPlugin>[1]\n>\n\nexport interface YjsSyncOptions extends YjsSyncPluginOptions {\n fragment: Y.XmlFragment\n}\n\nexport function defineYjsSyncPlugin(options: YjsSyncOptions): PlainExtension {\n const { fragment, ...rest } = options\n return definePlugin(ySyncPlugin(fragment, rest) as Plugin)\n}\n","import { definePlugin, type PlainExtension } from '@prosekit/core'\nimport type { ProseMirrorPlugin } from '@prosekit/pm/state'\nimport type { EditorView } from '@prosekit/pm/view'\nimport { yUndoPlugin as originalYUndoPlugin, yUndoPluginKey, type UndoPluginState } from 'y-prosemirror'\nimport type { UndoManager as YjsUndoManager } from 'yjs'\n\ntype UndoManager = YjsUndoManager & { restore: () => void }\n\n/**\n * @see https://github.com/yjs/y-prosemirror/issues/114 and https://github.com/yjs/y-prosemirror/issues/102\n */\nfunction fixYUndoPlugin(yUndoPluginInstance: ProseMirrorPlugin) {\n const originalUndoPluginView = yUndoPluginInstance.spec.view\n yUndoPluginInstance.spec.view = (view: EditorView) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- The type definition in y-prosemirror is not correct. An explicit file extension should be added to this line: https://npmx.dev/package-code/y-prosemirror/v/1.3.7/dist%2Fsrc%2Fplugins%2Fkeys.d.ts#L13\n const pluginState: UndoPluginState | undefined = yUndoPluginKey.getState(view.state)\n if (!pluginState) {\n return {}\n }\n\n const undoManager = pluginState.undoManager as UndoManager\n\n if (undoManager.restore) {\n undoManager.restore()\n undoManager.restore = () => {}\n }\n\n const viewRet = originalUndoPluginView\n ? originalUndoPluginView(view)\n : undefined\n\n return {\n destroy: () => {\n const hasUndoManSelf = undoManager.trackedOrigins.has(undoManager)\n\n const observers = undoManager._observers\n\n undoManager.restore = () => {\n if (hasUndoManSelf) {\n undoManager.trackedOrigins.add(undoManager)\n }\n\n undoManager.doc.on(\n 'afterTransaction',\n undoManager.afterTransactionHandler,\n )\n\n undoManager._observers = observers\n }\n\n if (viewRet?.destroy) {\n viewRet.destroy()\n }\n },\n }\n }\n}\n\n/**\n * Options for the `y-prosemirror`'s `yUndoPlugin`.\n */\nexport type YjsUndoPluginOptions = NonNullable<\n Parameters<typeof originalYUndoPlugin>[0]\n>\n\nexport interface YjsUndoOptions extends YjsUndoPluginOptions {}\n\n/**\n * @internal\n */\nfunction yUndoPlugin(options?: YjsUndoOptions) {\n const yUndoPluginInstance = originalYUndoPlugin(options)\n fixYUndoPlugin(yUndoPluginInstance)\n return yUndoPluginInstance\n}\n\n/**\n * @internal\n */\nexport function defineYjsUndoPlugin(options: YjsUndoOptions): PlainExtension {\n return definePlugin(yUndoPlugin(options))\n}\n","import type { Priority } from '@prosekit/core'\nimport { union, withPriority, type PlainExtension, type Union } from '@prosekit/core'\nimport type * as Y from 'yjs'\n\nimport { defineYjsCommands, type YjsCommandsExtension } from './yjs-commands.ts'\nimport { defineYjsCursorPlugin, type YjsCursorPluginOptions } from './yjs-cursor-plugin.ts'\nimport { defineYjsKeymap } from './yjs-keymap.ts'\nimport { defineYjsSyncPlugin, type YjsSyncPluginOptions } from './yjs-sync-plugin.ts'\nimport type { Awareness } from './yjs-types.ts'\nimport { defineYjsUndoPlugin, type YjsUndoPluginOptions } from './yjs-undo-plugin.ts'\n\nexport interface YjsOptions {\n /**\n * The Yjs instance handles the state of shared data.\n */\n doc: Y.Doc\n\n /**\n * The Awareness instance.\n */\n awareness: Awareness\n\n /**\n * The Yjs XmlFragment to use. If not provided,\n * `doc.getXmlFragment('prosemirror')` will be used.\n */\n fragment?: Y.XmlFragment\n\n /**\n * Options for `y-prosemirror`'s `ySyncPlugin`.\n */\n sync?: YjsSyncPluginOptions\n\n /**\n * Options for the `y-prosemirror`'s `yUndoPlugin`.\n */\n undo?: YjsUndoPluginOptions\n\n /**\n * Options for `y-prosemirror`'s `yCursorPlugin`.\n */\n cursor?: YjsCursorPluginOptions\n}\n\n/**\n * @internal\n */\nexport type YjsExtension = Union<[YjsCommandsExtension, PlainExtension]>\n\n/**\n * @public\n */\nexport function defineYjs(options: YjsOptions): YjsExtension {\n const { doc, awareness, sync, undo, cursor } = options\n const fragment = options.fragment ?? doc.getXmlFragment('prosemirror')\n\n return withPriority(\n union([\n defineYjsKeymap(),\n defineYjsCommands(),\n defineYjsCursorPlugin({ ...cursor, awareness }),\n defineYjsUndoPlugin({ ...undo }),\n defineYjsSyncPlugin({ ...sync, fragment }),\n ]),\n 3 satisfies typeof Priority.high,\n )\n}\n"],"mappings":";;;AAGA,MAAM,WAAW;CACf,YAAY;CACZ,YAAY;CACb;AAYD,SAAgB,oBAA0C;AACxD,QAAO,eAAe,SAAS;;;;ACFjC,SAAgB,sBACd,SACgB;CAChB,MAAM,EAAE,WAAW,GAAG,SAAS;AAC/B,QAAO,aAAa,cAAc,WAAW,KAAK,CAAW;;;;AClB/D,MAAM,SAAiB;CACrB,SAAS;CACT,SAAS;CACV;AAED,IAAI,CAAC,QACH,QAAO,WAAW;AAGpB,SAAgB,kBAAkC;AAChD,QAAO,aAAa,OAAO;;;;ACG7B,SAAgB,oBAAoB,SAAyC;CAC3E,MAAM,EAAE,UAAU,GAAG,SAAS;AAC9B,QAAO,aAAa,YAAY,UAAU,KAAK,CAAW;;;;;;;ACP5D,SAAS,eAAe,qBAAwC;CAC9D,MAAM,yBAAyB,oBAAoB,KAAK;AACxD,qBAAoB,KAAK,QAAQ,SAAqB;EAEpD,MAAM,cAA2C,eAAe,SAAS,KAAK,MAAM;AACpF,MAAI,CAAC,YACH,QAAO,EAAE;EAGX,MAAM,cAAc,YAAY;AAEhC,MAAI,YAAY,SAAS;AACvB,eAAY,SAAS;AACrB,eAAY,gBAAgB;;EAG9B,MAAM,UAAU,yBACZ,uBAAuB,KAAK,GAC5B,KAAA;AAEJ,SAAO,EACL,eAAe;GACb,MAAM,iBAAiB,YAAY,eAAe,IAAI,YAAY;GAElE,MAAM,YAAY,YAAY;AAE9B,eAAY,gBAAgB;AAC1B,QAAI,eACF,aAAY,eAAe,IAAI,YAAY;AAG7C,gBAAY,IAAI,GACd,oBACA,YAAY,wBACb;AAED,gBAAY,aAAa;;AAG3B,OAAI,SAAS,QACX,SAAQ,SAAS;KAGtB;;;;;;AAgBL,SAASA,cAAY,SAA0B;CAC7C,MAAM,sBAAsBC,YAAoB,QAAQ;AACxD,gBAAe,oBAAoB;AACnC,QAAO;;;;;AAMT,SAAgB,oBAAoB,SAAyC;AAC3E,QAAO,aAAaD,cAAY,QAAQ,CAAC;;;;;;;AC5B3C,SAAgB,UAAU,SAAmC;CAC3D,MAAM,EAAE,KAAK,WAAW,MAAM,MAAM,WAAW;CAC/C,MAAM,WAAW,QAAQ,YAAY,IAAI,eAAe,cAAc;AAEtE,QAAO,aACL,MAAM;EACJ,iBAAiB;EACjB,mBAAmB;EACnB,sBAAsB;GAAE,GAAG;GAAQ;GAAW,CAAC;EAC/C,oBAAoB,EAAE,GAAG,MAAM,CAAC;EAChC,oBAAoB;GAAE,GAAG;GAAM;GAAU,CAAC;EAC3C,CAAC,EACF,EACD"}
@@ -1 +1 @@
1
- export { };
1
+ export {};
@@ -1,16 +1,12 @@
1
1
  .ProseMirror-search-match {
2
- border-radius: 2px;
3
2
  background-color: #ffff0054;
3
+ border-radius: 2px;
4
4
  box-shadow: 0 0 0 2px #ffff0054;
5
5
  }
6
6
 
7
- .ProseMirror.ProseMirror-focused .ProseMirror-active-search-match::selection,
8
- .ProseMirror:not(.ProseMirror-focused) .ProseMirror-active-search-match {
9
- border-radius: 2px;
7
+ .ProseMirror.ProseMirror-focused .ProseMirror-active-search-match::selection, .ProseMirror:not(.ProseMirror-focused) .ProseMirror-active-search-match {
10
8
  background-color: #ff6a0054;
11
- box-shadow: 0 0 0 2px #ff6a0054;
9
+ border-radius: 2px;
12
10
  scroll-margin: 8px;
11
+ box-shadow: 0 0 0 2px #ff6a0054;
13
12
  }
14
-
15
-
16
- /*# sourceMappingURL=style.css.map*/
@@ -1,6 +1,5 @@
1
1
  import { createHighlighter } from "shiki/bundle/full";
2
2
  import { createJavaScriptRegexEngine } from "shiki/engine/javascript";
3
-
4
3
  //#region src/code-block/shiki-highlighter-chunk.ts
5
4
  let highlighterPromise;
6
5
  let highlighter;
@@ -37,7 +36,7 @@ function createOrGetHighlighter(options) {
37
36
  if (themes.length > 0) return { promise: loadThemes(themes) };
38
37
  return { highlighter };
39
38
  }
40
-
41
39
  //#endregion
42
40
  export { createOrGetHighlighter };
41
+
43
42
  //# sourceMappingURL=shiki-highlighter-chunk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shiki-highlighter-chunk.js","names":[],"sources":["../src/code-block/shiki-highlighter-chunk.ts"],"sourcesContent":["import type { BundledHighlighterOptions, BundledLanguage, BundledTheme, Highlighter, SpecialLanguage } from 'shiki'\nimport { createHighlighter } from 'shiki/bundle/full'\nimport { createJavaScriptRegexEngine } from 'shiki/engine/javascript'\n\nlet highlighterPromise: Promise<void> | undefined\nlet highlighter: Highlighter | undefined\nconst loadedLangs = new Set<BundledLanguage | SpecialLanguage>()\nconst loadedThemes = new Set<BundledTheme>()\n\nexport interface ShikiHighlighterOptions extends BundledHighlighterOptions<BundledLanguage, BundledTheme> {}\n\nexport interface HighlighterOptions extends Omit<ShikiHighlighterOptions, 'langs' | 'themes'> {\n themes: BundledTheme[]\n langs: (BundledLanguage | SpecialLanguage)[]\n}\n\nfunction ensureHighlighter({\n ...options\n}: HighlighterOptions): Promise<void> {\n if (!highlighterPromise) {\n // If no engine is provided, use the JavaScript engine, which is\n // smaller than the WASM engine.\n if (!options.engine) {\n const engine = createJavaScriptRegexEngine({ forgiving: true })\n options.engine = engine\n }\n highlighterPromise = createHighlighter(options).then((createdHighlighter) => {\n highlighter = createdHighlighter\n })\n }\n return highlighterPromise\n}\n\nasync function loadLanguages(langs: (BundledLanguage | SpecialLanguage)[]) {\n for (const lang of langs) {\n if (!highlighter) break\n await highlighter.loadLanguage(lang)\n loadedLangs.add(lang)\n }\n}\n\nasync function loadThemes(themes: BundledTheme[]) {\n for (const theme of themes) {\n if (!highlighter) break\n await highlighter.loadTheme(theme)\n loadedThemes.add(theme)\n }\n}\n\nexport type HighlighterResult =\n | {\n highlighter: Highlighter\n promise?: undefined\n }\n | {\n highlighter?: undefined\n promise: Promise<void>\n }\n\nexport function createOrGetHighlighter(\n options: HighlighterOptions,\n): HighlighterResult {\n if (!highlighter) {\n return { promise: ensureHighlighter(options) }\n }\n\n const langs = options.langs.filter((lang) => !loadedLangs.has(lang))\n if (langs.length > 0) {\n return { promise: loadLanguages(langs) }\n }\n\n const themes = options.themes.filter((theme) => !loadedThemes.has(theme))\n if (themes.length > 0) {\n return { promise: loadThemes(themes) }\n }\n\n return { highlighter }\n}\n"],"mappings":";;;;AAIA,IAAI;AACJ,IAAI;AACJ,MAAM,8BAAc,IAAI,KAAwC;AAChE,MAAM,+BAAe,IAAI,KAAmB;AAS5C,SAAS,kBAAkB,EACzB,GAAG,WACiC;AACpC,KAAI,CAAC,oBAAoB;AAGvB,MAAI,CAAC,QAAQ,OAEX,SAAQ,SADO,4BAA4B,EAAE,WAAW,MAAM,CAAC;AAGjE,uBAAqB,kBAAkB,QAAQ,CAAC,MAAM,uBAAuB;AAC3E,iBAAc;IACd;;AAEJ,QAAO;;AAGT,eAAe,cAAc,OAA8C;AACzE,MAAK,MAAM,QAAQ,OAAO;AACxB,MAAI,CAAC,YAAa;AAClB,QAAM,YAAY,aAAa,KAAK;AACpC,cAAY,IAAI,KAAK;;;AAIzB,eAAe,WAAW,QAAwB;AAChD,MAAK,MAAM,SAAS,QAAQ;AAC1B,MAAI,CAAC,YAAa;AAClB,QAAM,YAAY,UAAU,MAAM;AAClC,eAAa,IAAI,MAAM;;;AAc3B,SAAgB,uBACd,SACmB;AACnB,KAAI,CAAC,YACH,QAAO,EAAE,SAAS,kBAAkB,QAAQ,EAAE;CAGhD,MAAM,QAAQ,QAAQ,MAAM,QAAQ,SAAS,CAAC,YAAY,IAAI,KAAK,CAAC;AACpE,KAAI,MAAM,SAAS,EACjB,QAAO,EAAE,SAAS,cAAc,MAAM,EAAE;CAG1C,MAAM,SAAS,QAAQ,OAAO,QAAQ,UAAU,CAAC,aAAa,IAAI,MAAM,CAAC;AACzE,KAAI,OAAO,SAAS,EAClB,QAAO,EAAE,SAAS,WAAW,OAAO,EAAE;AAGxC,QAAO,EAAE,aAAa"}
1
+ {"version":3,"file":"shiki-highlighter-chunk.js","names":[],"sources":["../src/code-block/shiki-highlighter-chunk.ts"],"sourcesContent":["import type { BundledHighlighterOptions, BundledLanguage, BundledTheme, Highlighter, SpecialLanguage } from 'shiki'\nimport { createHighlighter } from 'shiki/bundle/full'\nimport { createJavaScriptRegexEngine } from 'shiki/engine/javascript'\n\nlet highlighterPromise: Promise<void> | undefined\nlet highlighter: Highlighter | undefined\nconst loadedLangs = new Set<BundledLanguage | SpecialLanguage>()\nconst loadedThemes = new Set<BundledTheme>()\n\nexport interface ShikiHighlighterOptions extends BundledHighlighterOptions<BundledLanguage, BundledTheme> {}\n\nexport interface HighlighterOptions extends Omit<ShikiHighlighterOptions, 'langs' | 'themes'> {\n themes: BundledTheme[]\n langs: (BundledLanguage | SpecialLanguage)[]\n}\n\nfunction ensureHighlighter({\n ...options\n}: HighlighterOptions): Promise<void> {\n if (!highlighterPromise) {\n // If no engine is provided, use the JavaScript engine, which is\n // smaller than the WASM engine.\n if (!options.engine) {\n const engine = createJavaScriptRegexEngine({ forgiving: true })\n options.engine = engine\n }\n highlighterPromise = createHighlighter(options).then((createdHighlighter) => {\n highlighter = createdHighlighter\n })\n }\n return highlighterPromise\n}\n\nasync function loadLanguages(langs: (BundledLanguage | SpecialLanguage)[]) {\n for (const lang of langs) {\n if (!highlighter) break\n await highlighter.loadLanguage(lang)\n loadedLangs.add(lang)\n }\n}\n\nasync function loadThemes(themes: BundledTheme[]) {\n for (const theme of themes) {\n if (!highlighter) break\n await highlighter.loadTheme(theme)\n loadedThemes.add(theme)\n }\n}\n\nexport type HighlighterResult =\n | {\n highlighter: Highlighter\n promise?: undefined\n }\n | {\n highlighter?: undefined\n promise: Promise<void>\n }\n\nexport function createOrGetHighlighter(\n options: HighlighterOptions,\n): HighlighterResult {\n if (!highlighter) {\n return { promise: ensureHighlighter(options) }\n }\n\n const langs = options.langs.filter((lang) => !loadedLangs.has(lang))\n if (langs.length > 0) {\n return { promise: loadLanguages(langs) }\n }\n\n const themes = options.themes.filter((theme) => !loadedThemes.has(theme))\n if (themes.length > 0) {\n return { promise: loadThemes(themes) }\n }\n\n return { highlighter }\n}\n"],"mappings":";;;AAIA,IAAI;AACJ,IAAI;AACJ,MAAM,8BAAc,IAAI,KAAwC;AAChE,MAAM,+BAAe,IAAI,KAAmB;AAS5C,SAAS,kBAAkB,EACzB,GAAG,WACiC;AACpC,KAAI,CAAC,oBAAoB;AAGvB,MAAI,CAAC,QAAQ,OAEX,SAAQ,SADO,4BAA4B,EAAE,WAAW,MAAM,CAAC;AAGjE,uBAAqB,kBAAkB,QAAQ,CAAC,MAAM,uBAAuB;AAC3E,iBAAc;IACd;;AAEJ,QAAO;;AAGT,eAAe,cAAc,OAA8C;AACzE,MAAK,MAAM,QAAQ,OAAO;AACxB,MAAI,CAAC,YAAa;AAClB,QAAM,YAAY,aAAa,KAAK;AACpC,cAAY,IAAI,KAAK;;;AAIzB,eAAe,WAAW,QAAwB;AAChD,MAAK,MAAM,SAAS,QAAQ;AAC1B,MAAI,CAAC,YAAa;AAClB,QAAM,YAAY,UAAU,MAAM;AAClC,eAAa,IAAI,MAAM;;;AAc3B,SAAgB,uBACd,SACmB;AACnB,KAAI,CAAC,YACH,QAAO,EAAE,SAAS,kBAAkB,QAAQ,EAAE;CAGhD,MAAM,QAAQ,QAAQ,MAAM,QAAQ,SAAS,CAAC,YAAY,IAAI,KAAK,CAAC;AACpE,KAAI,MAAM,SAAS,EACjB,QAAO,EAAE,SAAS,cAAc,MAAM,EAAE;CAG1C,MAAM,SAAS,QAAQ,OAAO,QAAQ,UAAU,CAAC,aAAa,IAAI,MAAM,CAAC;AACzE,KAAI,OAAO,SAAS,EAClB,QAAO,EAAE,SAAS,WAAW,OAAO,EAAE;AAGxC,QAAO,EAAE,aAAa"}
@@ -1,45 +1,45 @@
1
1
  .ProseMirror .tableWrapper {
2
2
  overflow-x: auto;
3
3
  }
4
+
4
5
  .ProseMirror table {
5
- width: 100%;
6
- overflow: hidden;
7
6
  border-collapse: collapse;
8
7
  table-layout: fixed;
8
+ width: 100%;
9
+ overflow: hidden;
9
10
  }
10
- .ProseMirror td,
11
- .ProseMirror th {
11
+
12
+ .ProseMirror td, .ProseMirror th {
12
13
  box-sizing: border-box;
13
- position: relative;
14
- padding-right: 0.75rem;
15
- padding-left: 0.75rem;
16
- border-width: 1px;
17
14
  vertical-align: top;
15
+ border-width: 1px;
16
+ padding-left: .75rem;
17
+ padding-right: .75rem;
18
+ position: relative;
18
19
  }
19
20
 
20
21
  prosekit-table-handle-drop-indicator {
21
- background-color: HighlightText;
22
+ background-color: highlighttext;
22
23
  }
23
24
 
24
25
  .ProseMirror .column-resize-handle {
25
26
  z-index: 20;
27
+ pointer-events: none;
28
+ background-color: highlighttext;
29
+ width: 4px;
26
30
  position: absolute;
27
31
  top: 0;
28
- right: -2px;
29
32
  bottom: 0;
30
- width: 4px;
31
- background-color: HighlightText;
32
- pointer-events: none;
33
+ right: -2px;
33
34
  }
35
+
34
36
  .ProseMirror.resize-cursor {
35
37
  cursor: ew-resize;
36
38
  cursor: col-resize;
37
39
  }
40
+
38
41
  .ProseMirror .selectedCell {
39
42
  --color: 210, 100%, 56%;
40
43
  border: 1px double hsl(var(--color));
41
44
  background-color: hsla(var(--color), 20%);
42
45
  }
43
-
44
-
45
- /*# sourceMappingURL=style.css.map*/
@@ -1,8 +1,7 @@
1
- import { t as defineDropIndicator } from "./drop-indicator-DJq8pF92.js";
1
+ import { t as defineDropIndicator } from "./drop-indicator.js";
2
2
  import { TextSelection } from "@prosekit/pm/state";
3
3
  import { defaultBlockAt, defineCommands, defineNodeSpec, definePlugin, getNodeType, insertNode, union } from "@prosekit/core";
4
4
  import { CellSelection, TableMap, addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, columnResizing, deleteCellSelection, deleteColumn, deleteRow, deleteTable, findCellPos, findCellRange, findTable, mergeCells, moveTableColumn, moveTableRow, splitCell, tableEditing, tableNodes } from "prosemirror-tables";
5
-
6
5
  //#region src/table/table-commands/exit-table.ts
7
6
  /**
8
7
  * When the selection is in a table node, create a default block after the table
@@ -33,7 +32,6 @@ const exitTable = (state, dispatch) => {
33
32
  }
34
33
  return true;
35
34
  };
36
-
37
35
  //#endregion
38
36
  //#region src/table/table-commands/insert-table.ts
39
37
  function createEmptyTable(schema, row, col, header) {
@@ -70,7 +68,6 @@ function insertTable(options) {
70
68
  return insertNode({ node: createEmptyTable(state.schema, row, col, header) })(state, dispatch, view);
71
69
  };
72
70
  }
73
-
74
71
  //#endregion
75
72
  //#region src/table/table-utils.ts
76
73
  /**
@@ -81,7 +78,6 @@ function insertTable(options) {
81
78
  function isCellSelection(value) {
82
79
  return value instanceof CellSelection;
83
80
  }
84
-
85
81
  //#endregion
86
82
  //#region src/table/table-commands/select-table-cell.ts
87
83
  /**
@@ -98,7 +94,6 @@ function selectTableCell(options) {
98
94
  return true;
99
95
  };
100
96
  }
101
-
102
97
  //#endregion
103
98
  //#region src/table/table-commands/select-table-column.ts
104
99
  /**
@@ -116,7 +111,6 @@ function selectTableColumn(options) {
116
111
  return true;
117
112
  };
118
113
  }
119
-
120
114
  //#endregion
121
115
  //#region src/table/table-commands/select-table-row.ts
122
116
  /**
@@ -134,7 +128,6 @@ function selectTableRow(options) {
134
128
  return true;
135
129
  };
136
130
  }
137
-
138
131
  //#endregion
139
132
  //#region src/table/table-commands/select-table.ts
140
133
  /**
@@ -159,7 +152,6 @@ function selectTable(options) {
159
152
  return true;
160
153
  };
161
154
  }
162
-
163
155
  //#endregion
164
156
  //#region src/table/table-commands.ts
165
157
  /**
@@ -189,7 +181,6 @@ function defineTableCommands() {
189
181
  moveTableColumn
190
182
  });
191
183
  }
192
-
193
184
  //#endregion
194
185
  //#region src/table/table-drop-indicator.ts
195
186
  /**
@@ -213,7 +204,6 @@ const onDrag = ({ event }) => {
213
204
  }
214
205
  return !match;
215
206
  };
216
-
217
207
  //#endregion
218
208
  //#region src/table/table-plugins.ts
219
209
  /**
@@ -222,7 +212,6 @@ const onDrag = ({ event }) => {
222
212
  function defineTablePlugins() {
223
213
  return definePlugin([tableEditing(), columnResizing()]);
224
214
  }
225
-
226
215
  //#endregion
227
216
  //#region src/table/table-spec.ts
228
217
  const cellContent = "block+";
@@ -273,7 +262,6 @@ function defineTableHeaderCellSpec() {
273
262
  attrs: cellAttrs
274
263
  });
275
264
  }
276
-
277
265
  //#endregion
278
266
  //#region src/table/table.ts
279
267
  /**
@@ -282,7 +270,7 @@ function defineTableHeaderCellSpec() {
282
270
  function defineTable() {
283
271
  return union(defineTableSpec(), defineTableRowSpec(), defineTableCellSpec(), defineTableHeaderCellSpec(), defineTablePlugins(), defineTableCommands(), defineTableDropIndicator());
284
272
  }
285
-
286
273
  //#endregion
287
274
  export { insertTable as _, defineTableSpec as a, defineTableCommands as c, selectTableColumn as d, selectTableCell as f, moveTableColumn as g, moveTableRow as h, defineTableRowSpec as i, selectTable as l, isCellSelection as m, defineTableCellSpec as n, defineTablePlugins as o, findTable as p, defineTableHeaderCellSpec as r, defineTableDropIndicator as s, defineTable as t, selectTableRow as u, exitTable as v };
288
- //# sourceMappingURL=table-B81i9oH9.js.map
275
+
276
+ //# sourceMappingURL=table.js.map