prosekit 0.0.0-next-20230627094841

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 (70) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +13 -0
  3. package/dist/basic/style.css +133 -0
  4. package/dist/chunk-23S3SZFA.js +46 -0
  5. package/dist/chunk-2MVHS73Q.js +709 -0
  6. package/dist/chunk-4GDRVRDP.js +0 -0
  7. package/dist/chunk-5PFF57NB.js +1546 -0
  8. package/dist/chunk-6A2XHVFY.js +46 -0
  9. package/dist/chunk-7OYIOTDD.js +16472 -0
  10. package/dist/chunk-ARJTWYPA.js +1321 -0
  11. package/dist/chunk-CDGN4JUS.js +1546 -0
  12. package/dist/chunk-CG5B6PMC.js +973 -0
  13. package/dist/chunk-DDN3TFRH.js +185 -0
  14. package/dist/chunk-EQV3CWHZ.js +2213 -0
  15. package/dist/chunk-ERNIDFFW.js +1711 -0
  16. package/dist/chunk-FAVXZAF7.js +3279 -0
  17. package/dist/chunk-HSPTUO6P.js +53 -0
  18. package/dist/chunk-JMNJUDT7.js +165 -0
  19. package/dist/chunk-LXCCO2LO.js +52 -0
  20. package/dist/chunk-MIPON3OH.js +922 -0
  21. package/dist/chunk-NAWSCY5F.js +166 -0
  22. package/dist/chunk-S64NFSV2.js +236 -0
  23. package/dist/chunk-S65R2BUY.js +15 -0
  24. package/dist/chunk-T2V5UU6H.js +204 -0
  25. package/dist/chunk-TWIMWRRZ.js +57 -0
  26. package/dist/chunk-US2P3K6I.js +185 -0
  27. package/dist/chunk-UTNVEPBA.js +950 -0
  28. package/dist/chunk-UWHQRU5N.js +4883 -0
  29. package/dist/chunk-VIKPJJET.js +662 -0
  30. package/dist/chunk-WAMZOD5I.js +67 -0
  31. package/dist/chunk-YUY5I2TY.js +236 -0
  32. package/dist/core/style.css +54 -0
  33. package/dist/extension-list/style.css +78 -0
  34. package/dist/pm/view/style/prosemirror.css +52 -0
  35. package/dist/prosekit-basic.js +2 -0
  36. package/dist/prosekit-core.js +2 -0
  37. package/dist/prosekit-extension-blockquote.js +2 -0
  38. package/dist/prosekit-extension-bold.js +2 -0
  39. package/dist/prosekit-extension-code-block.js +2 -0
  40. package/dist/prosekit-extension-code.js +2 -0
  41. package/dist/prosekit-extension-heading.js +2 -0
  42. package/dist/prosekit-extension-horizontal-rule.js +2 -0
  43. package/dist/prosekit-extension-italic.js +2 -0
  44. package/dist/prosekit-extension-list.js +2 -0
  45. package/dist/prosekit-extension-suggestion.js +2 -0
  46. package/dist/prosekit-lit-elements-menu-item.js +2 -0
  47. package/dist/prosekit-lit-elements-menu.js +2 -0
  48. package/dist/prosekit-lit-elements-popover.js +2 -0
  49. package/dist/prosekit-lit.js +2 -0
  50. package/dist/prosekit-pm-commands.js +2 -0
  51. package/dist/prosekit-pm-inputrules.js +2 -0
  52. package/dist/prosekit-pm-keymap.js +2 -0
  53. package/dist/prosekit-pm-model.js +2 -0
  54. package/dist/prosekit-pm-state.js +2 -0
  55. package/dist/prosekit-pm-transform.js +2 -0
  56. package/dist/prosekit-pm-view.js +2 -0
  57. package/dist/prosekit-pm.js +2 -0
  58. package/dist/prosekit-react-components-menu-item.js +2 -0
  59. package/dist/prosekit-react-components-menu.js +2 -0
  60. package/dist/prosekit-react-components-popover-suggestion.js +2 -0
  61. package/dist/prosekit-react-components-popover.js +2 -0
  62. package/dist/prosekit-react.js +2 -0
  63. package/dist/prosekit-vue-components-menu-item.js +2 -0
  64. package/dist/prosekit-vue-components-menu.js +2 -0
  65. package/dist/prosekit-vue-components-popover-suggestion.js +2 -0
  66. package/dist/prosekit-vue-components-popover.js +2 -0
  67. package/dist/prosekit-vue.js +2 -0
  68. package/dist/prosekit.js +0 -0
  69. package/package.json +262 -0
  70. package/src/index.ts +1 -0
@@ -0,0 +1,53 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __esm = (fn, res) => function __init() {
8
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
+ };
10
+ var __commonJS = (cb, mod) => function __require() {
11
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
+ };
13
+ var __export = (target, all) => {
14
+ for (var name in all)
15
+ __defProp(target, name, { get: all[name], enumerable: true });
16
+ };
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") {
19
+ for (let key of __getOwnPropNames(from))
20
+ if (!__hasOwnProp.call(to, key) && key !== except)
21
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22
+ }
23
+ return to;
24
+ };
25
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
26
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
27
+ // If the importer is in node compatibility mode or this is not an ESM
28
+ // file that has been converted to a CommonJS file using a Babel-
29
+ // compatible transform (i.e. "__esModule" has not been set), then set
30
+ // "default" to the CommonJS "module.exports" for node compatibility.
31
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
32
+ mod
33
+ ));
34
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
+ var __decorateClass = (decorators, target, key, kind) => {
36
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
37
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
38
+ if (decorator = decorators[i])
39
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
40
+ if (kind && result)
41
+ __defProp(target, key, result);
42
+ return result;
43
+ };
44
+
45
+ export {
46
+ __esm,
47
+ __commonJS,
48
+ __export,
49
+ __reExport,
50
+ __toESM,
51
+ __toCommonJS,
52
+ __decorateClass
53
+ };
@@ -0,0 +1,165 @@
1
+ import {
2
+ Plugin
3
+ } from "./chunk-UTNVEPBA.js";
4
+ import {
5
+ canJoin,
6
+ findWrapping
7
+ } from "./chunk-ERNIDFFW.js";
8
+
9
+ // ../../node_modules/.pnpm/prosemirror-inputrules@1.2.1/node_modules/prosemirror-inputrules/dist/index.js
10
+ var InputRule = class {
11
+ // :: (RegExp, union<string, (state: EditorState, match: [string], start: number, end: number) → ?Transaction>)
12
+ /**
13
+ Create an input rule. The rule applies when the user typed
14
+ something and the text directly in front of the cursor matches
15
+ `match`, which should end with `$`.
16
+
17
+ The `handler` can be a string, in which case the matched text, or
18
+ the first matched group in the regexp, is replaced by that
19
+ string.
20
+
21
+ Or a it can be a function, which will be called with the match
22
+ array produced by
23
+ [`RegExp.exec`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec),
24
+ as well as the start and end of the matched range, and which can
25
+ return a [transaction](https://prosemirror.net/docs/ref/#state.Transaction) that describes the
26
+ rule's effect, or null to indicate the input was not handled.
27
+ */
28
+ constructor(match, handler) {
29
+ this.match = match;
30
+ this.match = match;
31
+ this.handler = typeof handler == "string" ? stringHandler(handler) : handler;
32
+ }
33
+ };
34
+ function stringHandler(string) {
35
+ return function(state, match, start, end) {
36
+ let insert = string;
37
+ if (match[1]) {
38
+ let offset = match[0].lastIndexOf(match[1]);
39
+ insert += match[0].slice(offset + match[1].length);
40
+ start += offset;
41
+ let cutOff = start - end;
42
+ if (cutOff > 0) {
43
+ insert = match[0].slice(offset - cutOff, offset) + insert;
44
+ start = end;
45
+ }
46
+ }
47
+ return state.tr.insertText(insert, start, end);
48
+ };
49
+ }
50
+ var MAX_MATCH = 500;
51
+ function inputRules({ rules }) {
52
+ let plugin = new Plugin({
53
+ state: {
54
+ init() {
55
+ return null;
56
+ },
57
+ apply(tr, prev) {
58
+ let stored = tr.getMeta(this);
59
+ if (stored)
60
+ return stored;
61
+ return tr.selectionSet || tr.docChanged ? null : prev;
62
+ }
63
+ },
64
+ props: {
65
+ handleTextInput(view, from, to, text) {
66
+ return run(view, from, to, text, rules, plugin);
67
+ },
68
+ handleDOMEvents: {
69
+ compositionend: (view) => {
70
+ setTimeout(() => {
71
+ let { $cursor } = view.state.selection;
72
+ if ($cursor)
73
+ run(view, $cursor.pos, $cursor.pos, "", rules, plugin);
74
+ });
75
+ }
76
+ }
77
+ },
78
+ isInputRules: true
79
+ });
80
+ return plugin;
81
+ }
82
+ function run(view, from, to, text, rules, plugin) {
83
+ if (view.composing)
84
+ return false;
85
+ let state = view.state, $from = state.doc.resolve(from);
86
+ if ($from.parent.type.spec.code)
87
+ return false;
88
+ let textBefore = $from.parent.textBetween(Math.max(0, $from.parentOffset - MAX_MATCH), $from.parentOffset, null, "\uFFFC") + text;
89
+ for (let i = 0; i < rules.length; i++) {
90
+ let match = rules[i].match.exec(textBefore);
91
+ let tr = match && rules[i].handler(state, match, from - (match[0].length - text.length), to);
92
+ if (!tr)
93
+ continue;
94
+ view.dispatch(tr.setMeta(plugin, { transform: tr, from, to, text }));
95
+ return true;
96
+ }
97
+ return false;
98
+ }
99
+ var undoInputRule = (state, dispatch) => {
100
+ let plugins = state.plugins;
101
+ for (let i = 0; i < plugins.length; i++) {
102
+ let plugin = plugins[i], undoable;
103
+ if (plugin.spec.isInputRules && (undoable = plugin.getState(state))) {
104
+ if (dispatch) {
105
+ let tr = state.tr, toUndo = undoable.transform;
106
+ for (let j = toUndo.steps.length - 1; j >= 0; j--)
107
+ tr.step(toUndo.steps[j].invert(toUndo.docs[j]));
108
+ if (undoable.text) {
109
+ let marks = tr.doc.resolve(undoable.from).marks();
110
+ tr.replaceWith(undoable.from, undoable.to, state.schema.text(undoable.text, marks));
111
+ } else {
112
+ tr.delete(undoable.from, undoable.to);
113
+ }
114
+ dispatch(tr);
115
+ }
116
+ return true;
117
+ }
118
+ }
119
+ return false;
120
+ };
121
+ var emDash = new InputRule(/--$/, "\u2014");
122
+ var ellipsis = new InputRule(/\.\.\.$/, "\u2026");
123
+ var openDoubleQuote = new InputRule(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/, "\u201C");
124
+ var closeDoubleQuote = new InputRule(/"$/, "\u201D");
125
+ var openSingleQuote = new InputRule(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/, "\u2018");
126
+ var closeSingleQuote = new InputRule(/'$/, "\u2019");
127
+ var smartQuotes = [openDoubleQuote, closeDoubleQuote, openSingleQuote, closeSingleQuote];
128
+ function wrappingInputRule(regexp, nodeType, getAttrs = null, joinPredicate) {
129
+ return new InputRule(regexp, (state, match, start, end) => {
130
+ let attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;
131
+ let tr = state.tr.delete(start, end);
132
+ let $start = tr.doc.resolve(start), range = $start.blockRange(), wrapping = range && findWrapping(range, nodeType, attrs);
133
+ if (!wrapping)
134
+ return null;
135
+ tr.wrap(range, wrapping);
136
+ let before = tr.doc.resolve(start - 1).nodeBefore;
137
+ if (before && before.type == nodeType && canJoin(tr.doc, start - 1) && (!joinPredicate || joinPredicate(match, before)))
138
+ tr.join(start - 1);
139
+ return tr;
140
+ });
141
+ }
142
+ function textblockTypeInputRule(regexp, nodeType, getAttrs = null) {
143
+ return new InputRule(regexp, (state, match, start, end) => {
144
+ let $start = state.doc.resolve(start);
145
+ let attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;
146
+ if (!$start.node(-1).canReplaceWith($start.index(-1), $start.indexAfter(-1), nodeType))
147
+ return null;
148
+ return state.tr.delete(start, end).setBlockType(start, start, nodeType, attrs);
149
+ });
150
+ }
151
+
152
+ export {
153
+ InputRule,
154
+ inputRules,
155
+ undoInputRule,
156
+ emDash,
157
+ ellipsis,
158
+ openDoubleQuote,
159
+ closeDoubleQuote,
160
+ openSingleQuote,
161
+ closeSingleQuote,
162
+ smartQuotes,
163
+ wrappingInputRule,
164
+ textblockTypeInputRule
165
+ };
@@ -0,0 +1,52 @@
1
+ import {
2
+ addCommands,
3
+ addKeymap,
4
+ addMarkSpec,
5
+ defineExtension,
6
+ toggleMark
7
+ } from "./chunk-2MVHS73Q.js";
8
+
9
+ // ../extension-italic/src/index.ts
10
+ function addItalicSpec() {
11
+ return addMarkSpec({
12
+ name: "italic",
13
+ spec: {
14
+ parseDOM: [
15
+ { tag: "i" },
16
+ { tag: "em" },
17
+ { style: "font-style=italic" },
18
+ {
19
+ style: "font-style=normal",
20
+ clearMark: (m) => m.type.name === "italic"
21
+ }
22
+ ],
23
+ toDOM() {
24
+ return ["em", 0];
25
+ }
26
+ }
27
+ });
28
+ }
29
+ function addItalicCommands() {
30
+ return addCommands({
31
+ toggleItalic: () => toggleMark({ type: "italic" })
32
+ });
33
+ }
34
+ function addItalicKeymap() {
35
+ return addKeymap({
36
+ "Mod-i": toggleMark({ type: "italic" })
37
+ });
38
+ }
39
+ function addItalic() {
40
+ return defineExtension([
41
+ addItalicSpec(),
42
+ addItalicCommands(),
43
+ addItalicKeymap()
44
+ ]);
45
+ }
46
+
47
+ export {
48
+ addItalicSpec,
49
+ addItalicCommands,
50
+ addItalicKeymap,
51
+ addItalic
52
+ };