@milkdown/plugin-slash 6.5.2 → 6.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/config.d.ts CHANGED
@@ -1,20 +1,20 @@
1
- import { Ctx } from '@milkdown/core';
2
- import { Node } from '@milkdown/prose/model';
3
- import { EditorState } from '@milkdown/prose/state';
4
- import { WrappedAction } from './item';
5
- declare type Nullable<T> = T | null | undefined;
6
- export declare type StatusConfig = {
1
+ import type { Ctx } from '@milkdown/core';
2
+ import type { Node } from '@milkdown/prose/model';
3
+ import type { EditorState } from '@milkdown/prose/state';
4
+ import type { WrappedAction } from './item';
5
+ type Nullable<T> = T | null | undefined;
6
+ export interface StatusConfig {
7
7
  placeholder?: Nullable<string>;
8
8
  actions?: Nullable<WrappedAction[]>;
9
- };
10
- export declare type StatusConfigBuilderParams = {
9
+ }
10
+ export interface StatusConfigBuilderParams {
11
11
  content: string;
12
12
  isTopLevel: boolean;
13
13
  parentNode: Node;
14
14
  state: EditorState;
15
- };
16
- export declare type StatusConfigBuilder = (params: StatusConfigBuilderParams) => Nullable<StatusConfig>;
17
- export declare type Config = (ctx: Ctx) => StatusConfigBuilder;
15
+ }
16
+ export type StatusConfigBuilder = (params: StatusConfigBuilderParams) => Nullable<StatusConfig>;
17
+ export type Config = (ctx: Ctx) => StatusConfigBuilder;
18
18
  export declare const defaultActions: (ctx: Ctx, input?: string) => WrappedAction[];
19
19
  export declare const defaultConfig: Config;
20
20
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,GAAG,EAA8B,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAGvC,aAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;AAExC,oBAAY,YAAY,GAAG;IACvB,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;CACvC,CAAC;AAEF,oBAAY,yBAAyB,GAAG;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,IAAI,CAAC;IACjB,KAAK,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,oBAAY,mBAAmB,GAAG,CAAC,MAAM,EAAE,yBAAyB,KAAK,QAAQ,CAAC,YAAY,CAAC,CAAC;AAEhG,oBAAY,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,mBAAmB,CAAC;AAEvD,eAAO,MAAM,cAAc,QAAS,GAAG,qBAAgB,aAAa,EAuFnE,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,MAqB3B,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAEzC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AAG3C,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAA;AAEvC,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IAC9B,OAAO,CAAC,EAAE,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAA;CACpC;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE,IAAI,CAAA;IAChB,KAAK,EAAE,WAAW,CAAA;CACnB;AAED,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,yBAAyB,KAAK,QAAQ,CAAC,YAAY,CAAC,CAAA;AAE/F,MAAM,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,mBAAmB,CAAA;AAEtD,eAAO,MAAM,cAAc,QAAS,GAAG,qBAAgB,aAAa,EAuFnE,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,MAyB3B,CAAA"}
package/lib/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import { AtomList } from '@milkdown/utils';
2
2
  import type { Config } from './config';
3
- import { CalcPosition } from './prose-plugin/view';
3
+ import type { CalcPosition } from './prose-plugin/view';
4
4
  export type { Config, StatusConfig, StatusConfigBuilder, StatusConfigBuilderParams } from './config';
5
5
  export { defaultActions, defaultConfig } from './config';
6
6
  export type { Action, WrappedAction } from './item';
7
7
  export { createDropdownItem } from './utility';
8
- export declare type Options = {
8
+ export interface Options {
9
9
  config: Config;
10
10
  calcPosition: CalcPosition;
11
- };
11
+ }
12
12
  export declare const slashPlugin: import("@milkdown/utils").WithExtend<string, Options, import("@milkdown/utils").TypeMapping<string, string>, import("@milkdown/utils").PluginRest<string, string>>;
13
13
  export declare const slash: AtomList<import("@milkdown/utils").Metadata<import("@milkdown/utils").GetPlugin<string, Options>> & import("@milkdown/core").MilkdownPlugin>;
14
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAgB,MAAM,iBAAiB,CAAC;AAEzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGvC,OAAO,EAAE,YAAY,EAAuB,MAAM,qBAAqB,CAAC;AAExE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AACrG,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzD,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,oBAAY,OAAO,GAAG;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,YAAY,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,WAAW,oKAatB,CAAC;AAEH,eAAO,MAAM,KAAK,8IAAmC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAgB,MAAM,iBAAiB,CAAA;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAGvD,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAA;AACpG,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxD,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAE9C,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,YAAY,CAAA;CAC3B;AAED,eAAO,MAAM,WAAW,oKAatB,CAAA;AAEF,eAAO,MAAM,KAAK,8IAAmC,CAAA"}
package/lib/index.es.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { createPlugin as b, AtomList as $ } from "@milkdown/utils";
2
- import { ThemeSize as E, ThemeBorder as C, ThemeShadow as T, ThemeScrollbar as N, ThemeFont as k, ThemeColor as y, ThemeIcon as S, schemaCtx as I, themeManagerCtx as u, commandsCtx as p } from "@milkdown/core";
3
- import { missingIcon as x, missingRootElement as A } from "@milkdown/exception";
4
- import { Plugin as D, PluginKey as _ } from "@milkdown/prose/state";
5
- import { findParentNode as M, calculateNodePosition as P } from "@milkdown/prose";
6
- import { DecorationSet as H, Decoration as q } from "@milkdown/prose/view";
2
+ import { ThemeSize as C, ThemeBorder as E, ThemeShadow as T, ThemeScrollbar as N, ThemeFont as k, ThemeColor as y, ThemeIcon as S, schemaCtx as I, themeManagerCtx as u, commandsCtx as p, editorViewCtx as x } from "@milkdown/core";
3
+ import { missingIcon as A, missingRootElement as D } from "@milkdown/exception";
4
+ import { Plugin as _, PluginKey as M } from "@milkdown/prose/state";
5
+ import { findParentNode as P, calculateNodePosition as H } from "@milkdown/prose";
6
+ import { DecorationSet as q, Decoration as K } from "@milkdown/prose/view";
7
7
  import w from "smooth-scroll-into-view-if-needed";
8
- const K = (e, { css: t }) => {
9
- const o = (n, s = 1) => e.get(y, [n, s]);
8
+ const O = (e, { css: t }) => {
9
+ const n = (o, s = 1) => e.get(y, [o, s]);
10
10
  return t`
11
11
  .slash-dropdown-item {
12
12
  display: flex;
@@ -24,7 +24,7 @@ const K = (e, { css: t }) => {
24
24
 
25
25
  &,
26
26
  .icon {
27
- color: ${o("neutral", 0.87)};
27
+ color: ${n("neutral", 0.87)};
28
28
  transition: all 0.2s ease-in-out;
29
29
  }
30
30
 
@@ -33,26 +33,26 @@ const K = (e, { css: t }) => {
33
33
  }
34
34
 
35
35
  &.active {
36
- background: ${o("secondary", 0.12)};
36
+ background: ${n("secondary", 0.12)};
37
37
  &,
38
38
  .icon {
39
- color: ${o("primary")};
39
+ color: ${n("primary")};
40
40
  }
41
41
  }
42
42
  }
43
43
  `;
44
- }, O = (e, t) => {
45
- const o = (n, s = 1) => e.get(y, [n, s]);
44
+ }, U = (e, t) => {
45
+ const n = (o, s = 1) => e.get(y, [o, s]);
46
46
  return t.css`
47
47
  width: 320px;
48
48
  min-height: 48px;
49
49
  max-height: 320px;
50
50
  overflow-y: auto;
51
- border-radius: ${e.get(E, "radius")};
51
+ border-radius: ${e.get(C, "radius")};
52
52
  position: absolute;
53
- background: ${o("surface")};
53
+ background: ${n("surface")};
54
54
 
55
- ${e.get(C, void 0)}
55
+ ${e.get(E, void 0)}
56
56
  ${e.get(T, void 0)}
57
57
  ${e.get(N, void 0)}
58
58
 
@@ -60,28 +60,28 @@ const K = (e, { css: t }) => {
60
60
  display: none;
61
61
  }
62
62
 
63
- ${K(e, t)}
63
+ ${O(e, t)}
64
64
  `;
65
- }, U = (e, t) => {
66
- const o = document.createElement("div");
67
- return o.setAttribute("role", "listbox"), o.setAttribute("tabindex", "-1"), e.themeManager.onFlush(() => {
68
- const n = e.getStyle((s) => O(e.themeManager, s));
69
- n && o.classList.add(n);
70
- }), o.classList.add(e.getClassName({}, t), "hide"), o;
71
- }, f = (e, t, o, n) => {
65
+ }, W = (e, t) => {
66
+ const n = document.createElement("div");
67
+ return n.setAttribute("role", "listbox"), n.setAttribute("tabindex", "-1"), e.themeManager.onFlush(() => {
68
+ const o = e.getStyle((s) => U(e.themeManager, s));
69
+ o && n.classList.add(o);
70
+ }), n.classList.add(e.getClassName({}, t), "hide"), n;
71
+ }, f = (e, t, n, o) => {
72
72
  var l;
73
- const s = (l = n == null ? void 0 : n.textClassName) != null ? l : "text", r = document.createElement("div");
73
+ const s = (l = o == null ? void 0 : o.textClassName) != null ? l : "text", r = document.createElement("div");
74
74
  r.setAttribute("role", "option"), r.classList.add("slash-dropdown-item");
75
- const i = e.get(S, o);
75
+ const i = e.get(S, n);
76
76
  if (!i)
77
- throw x(o);
77
+ throw A(n);
78
78
  const a = document.createElement("span");
79
79
  return a.textContent = t, a.className = s, r.appendChild(i.dom), r.appendChild(a), r;
80
- }, W = (e, t) => {
81
- const { selection: o } = e, { $from: n } = o, s = e.tr.deleteRange(n.start(), n.pos);
80
+ }, B = (e, t) => {
81
+ const { selection: n } = e, { $from: o } = n, s = e.tr.deleteRange(o.start(), o.pos);
82
82
  return t == null || t(s), !1;
83
- }, B = (e) => (t, o, n) => (n && (W(t, o), e()), !0), L = (e, t = "/") => {
84
- const { nodes: o } = e.get(I), n = [
83
+ }, F = (e) => (t, n, o) => (o && (B(t, n), e()), !0), L = (e, t = "/") => {
84
+ const { nodes: n } = e.get(I), o = [
85
85
  {
86
86
  id: "h1",
87
87
  dom: f(e.get(u), "Large Heading", "h1"),
@@ -160,92 +160,97 @@ const K = (e, { css: t }) => {
160
160
  typeName: "hr"
161
161
  }
162
162
  ], s = t.slice(1).toLocaleLowerCase();
163
- return n.filter((r) => !!o[r.typeName] && r.keyword.some((i) => i.includes(s))).map(({ keyword: r, typeName: i, ...a }) => a);
164
- }, F = (e) => ({ content: t, isTopLevel: o }) => o ? t ? t.startsWith("/") ? t === "/" ? {
165
- placeholder: "Type to filter...",
166
- actions: L(e)
167
- } : {
168
- actions: L(e, t)
169
- } : null : { placeholder: "Type / to use the slash commands..." } : null, j = (e, { css: t }) => {
170
- const o = (s, r = 1) => e.get(y, [s, r]), n = e.get(k, "typography");
163
+ return o.filter((r) => !!n[r.typeName] && r.keyword.some((i) => i.includes(s))).map(({ keyword: r, typeName: i, ...a }) => a);
164
+ }, j = (e) => ({ content: t, isTopLevel: n }) => {
165
+ if (!n)
166
+ return null;
167
+ const o = e.get(x);
168
+ return o != null && o.editable ? t ? t.startsWith("/") ? t === "/" ? {
169
+ placeholder: "Type to filter...",
170
+ actions: L(e)
171
+ } : {
172
+ actions: L(e, t)
173
+ } : null : { placeholder: "Type / to use the slash commands..." } : null;
174
+ }, z = (e, { css: t }) => {
175
+ const n = (s, r = 1) => e.get(y, [s, r]), o = e.get(k, "typography");
171
176
  return t`
172
177
  position: relative;
173
178
  &::before {
174
179
  position: absolute;
175
180
  cursor: text;
176
- font-family: ${n};
181
+ font-family: ${o};
177
182
  font-size: 14px;
178
- color: ${o("neutral", 0.6)};
183
+ color: ${n("neutral", 0.6)};
179
184
  content: attr(data-text);
180
185
  height: 100%;
181
186
  display: flex;
182
187
  align-items: center;
183
188
  }
184
189
  `;
185
- }, z = (e, { css: t }) => t`
190
+ }, V = (e, { css: t }) => t`
186
191
  &::before {
187
192
  left: 8px;
188
193
  }
189
194
  `, R = (e, t) => ({
190
- handleKeyDown: (o, n) => !(e.isEmpty() || !(n instanceof KeyboardEvent) || !["ArrowUp", "ArrowDown", "Enter"].includes(n.key)),
191
- decorations: (o) => {
192
- const n = M(({ type: d }) => d.name === "paragraph")(o.selection), s = o.plugins.find(
195
+ handleKeyDown: (n, o) => !(e.isEmpty() || !(o instanceof KeyboardEvent) || !["ArrowUp", "ArrowDown", "Enter"].includes(o.key)),
196
+ decorations: (n) => {
197
+ const o = P(({ type: d }) => d.name === "paragraph")(n.selection), s = n.plugins.find(
193
198
  (d) => d.key === "MILKDOWN_UPLOAD$"
194
- ), r = s == null ? void 0 : s.getState(o);
195
- if (r != null && r.find(o.selection.from, o.selection.to).length > 0 || !n || n.node.childCount > 1 || o.selection.$from.parentOffset !== n.node.textContent.length || n.node.firstChild && n.node.firstChild.type.name !== "text")
199
+ ), r = s == null ? void 0 : s.getState(n);
200
+ if (r != null && r.find(n.selection.from, n.selection.to).length > 0 || !o || o.node.childCount > 1 || n.selection.$from.parentOffset !== o.node.textContent.length || o.node.firstChild && o.node.firstChild.type.name !== "text")
196
201
  return e.clear(), null;
197
202
  const { placeholder: i, actions: a } = e.update({
198
- parentNode: o.selection.$from.node(o.selection.$from.depth - 1),
199
- isTopLevel: o.selection.$from.depth === 1,
200
- content: n.node.textContent,
201
- state: o
203
+ parentNode: n.selection.$from.node(n.selection.$from.depth - 1),
204
+ isTopLevel: n.selection.$from.depth === 1,
205
+ content: o.node.textContent,
206
+ state: n
202
207
  });
203
208
  if (!i)
204
209
  return null;
205
210
  const l = (d, h) => {
206
- const g = n.pos;
207
- return H.create(o.doc, [
208
- q.node(g, g + n.node.nodeSize, {
211
+ const g = o.pos;
212
+ return q.create(n.doc, [
213
+ K.node(g, g + o.node.nodeSize, {
209
214
  class: h.filter((v) => v).join(" "),
210
215
  "data-text": d
211
216
  })
212
217
  ]);
213
- }, m = t.getStyle((d) => j(t.themeManager, d)), c = t.getStyle((d) => z(t.themeManager, d));
218
+ }, m = t.getStyle((d) => z(t.themeManager, d)), c = t.getStyle((d) => V(t.themeManager, d));
214
219
  return a.length ? l(i, [m, c, "empty-node", "is-slash"]) : l(i, [m, "empty-node"]);
215
220
  }
216
- }), V = (e) => ({
221
+ }), Q = (e) => ({
217
222
  id: e.id,
218
223
  $: e.dom,
219
- command: B(e.command)
220
- }), Q = () => ({
224
+ command: F(e.command)
225
+ }), G = () => ({
221
226
  placeholder: null,
222
227
  actions: []
223
- }), G = (e) => {
224
- const t = Q();
228
+ }), J = (e) => {
229
+ const t = G();
225
230
  return {
226
231
  get: () => t,
227
232
  clear: () => {
228
233
  t.placeholder = null, t.actions = [];
229
234
  },
230
- update: (o) => {
235
+ update: (n) => {
231
236
  var s, r;
232
- const n = e(o);
233
- return t.placeholder = (s = n == null ? void 0 : n.placeholder) != null ? s : null, t.actions = ((r = n == null ? void 0 : n.actions) != null ? r : []).map(V), t;
237
+ const o = e(n);
238
+ return t.placeholder = (s = o == null ? void 0 : o.placeholder) != null ? s : null, t.actions = ((r = o == null ? void 0 : o.actions) != null ? r : []).map(Q), t;
234
239
  },
235
240
  isEmpty: () => t.actions.length === 0
236
241
  };
237
- }, J = (e, t, o) => {
238
- const { actions: n } = e.get();
239
- if (!n.length)
242
+ }, X = (e, t, n) => {
243
+ const { actions: o } = e.get();
244
+ if (!o.length)
240
245
  return t.classList.add("hide"), !1;
241
246
  for (t.childNodes.forEach((r) => {
242
- r.removeEventListener("mouseenter", o.mouseEnter), r.removeEventListener("mouseleave", o.mouseLeave);
247
+ r.removeEventListener("mouseenter", n.mouseEnter), r.removeEventListener("mouseleave", n.mouseLeave);
243
248
  }); t.firstChild; )
244
249
  t.firstChild.remove();
245
- n.forEach(({ $: r }) => {
246
- r.classList.remove("active"), r.addEventListener("mouseenter", o.mouseEnter), r.addEventListener("mouseleave", o.mouseLeave), t.appendChild(r);
250
+ o.forEach(({ $: r }) => {
251
+ r.classList.remove("active"), r.addEventListener("mouseenter", n.mouseEnter), r.addEventListener("mouseleave", n.mouseLeave), t.appendChild(r);
247
252
  }), t.style.maxHeight = "", t.classList.remove("hide");
248
- const s = n[0];
253
+ const s = o[0];
249
254
  return s && (s.$.classList.add("active"), requestAnimationFrame(() => {
250
255
  w(s.$, {
251
256
  scrollMode: "if-needed",
@@ -253,7 +258,7 @@ const K = (e, { css: t }) => {
253
258
  inline: "nearest"
254
259
  });
255
260
  })), !0;
256
- }, X = () => {
261
+ }, Y = () => {
257
262
  let e = !1;
258
263
  return {
259
264
  isLock: () => e,
@@ -264,36 +269,36 @@ const K = (e, { css: t }) => {
264
269
  e = !1;
265
270
  }
266
271
  };
267
- }, Y = (e) => () => {
272
+ }, Z = (e) => () => {
268
273
  e.unlock();
269
- }, Z = (e, t) => (o) => {
274
+ }, ee = (e, t) => (n) => {
270
275
  if (t.isLock())
271
276
  return;
272
- const { actions: n } = e.get(), s = n.findIndex((a) => a.$.classList.contains("active")), r = n[s];
277
+ const { actions: o } = e.get(), s = o.findIndex((a) => a.$.classList.contains("active")), r = o[s];
273
278
  r && s >= 0 && r.$.classList.remove("active");
274
- const { target: i } = o;
279
+ const { target: i } = n;
275
280
  i instanceof HTMLElement && i.classList.add("active");
276
- }, ee = () => (e) => {
281
+ }, te = () => (e) => {
277
282
  const { target: t } = e;
278
283
  t instanceof HTMLElement && t.classList.remove("active");
279
- }, te = (e, t, o) => (n) => {
280
- const { target: s } = n;
284
+ }, oe = (e, t, n) => (o) => {
285
+ const { target: s } = o;
281
286
  if (!(s instanceof HTMLElement) || !t)
282
287
  return;
283
288
  const r = () => {
284
- n.stopPropagation(), n.preventDefault();
289
+ o.stopPropagation(), o.preventDefault();
285
290
  }, { actions: i } = e.get(), a = Object.values(i).find(({ $: l }) => l.contains(s));
286
291
  if (!a) {
287
292
  if (e.isEmpty())
288
293
  return;
289
- e.clear(), o.classList.add("hide"), r();
294
+ e.clear(), n.classList.add("hide"), r();
290
295
  return;
291
296
  }
292
297
  r(), a.command(t.state, t.dispatch, t);
293
- }, oe = (e, t, o, n) => (s) => {
298
+ }, ne = (e, t, n, o) => (s) => {
294
299
  if (!(s instanceof KeyboardEvent))
295
300
  return;
296
- n.isLock() || n.lock();
301
+ o.isLock() || o.lock();
297
302
  const { key: r } = s;
298
303
  if (e.isEmpty() || !["ArrowDown", "ArrowUp", "Enter", "Escape"].includes(r))
299
304
  return;
@@ -321,34 +326,34 @@ const K = (e, { css: t }) => {
321
326
  if (r === "Escape") {
322
327
  if (e.isEmpty())
323
328
  return;
324
- e.clear(), o.classList.add("hide");
329
+ e.clear(), n.classList.add("hide");
325
330
  return;
326
331
  }
327
332
  const m = i[a];
328
333
  !m || (m.command(t.state, t.dispatch, t), m.$.classList.remove("active"));
329
- }, ne = (e, t) => {
330
- P(e, t, (o, n, s) => {
334
+ }, re = (e, t) => {
335
+ H(e, t, (n, o, s) => {
331
336
  const r = t.parentElement;
332
337
  if (!r)
333
- throw A();
334
- let i = o.left - s.left;
338
+ throw D();
339
+ let i = n.left - s.left;
335
340
  i < 0 && (i = 0);
336
341
  let a, l;
337
- const m = o.top - s.top, c = s.height + s.top - o.bottom;
338
- c >= n.height + 28 ? a = "bottom" : m >= n.height + 28 ? a = "top" : c >= m ? (a = "bottom", l = c - 28) : (a = "top", l = m - 28), (m < 0 || c < 0) && (l = s.height - o.height - 28, l > n.height && (l = void 0));
339
- const d = a === "top" ? o.top - s.top - (l != null ? l : n.height) - 14 + r.scrollTop : o.bottom - s.top + 14 + r.scrollTop;
342
+ const m = n.top - s.top, c = s.height + s.top - n.bottom;
343
+ c >= o.height + 28 ? a = "bottom" : m >= o.height + 28 ? a = "top" : c >= m ? (a = "bottom", l = c - 28) : (a = "top", l = m - 28), (m < 0 || c < 0) && (l = s.height - n.height - 28, l > o.height && (l = void 0));
344
+ const d = a === "top" ? n.top - s.top - (l != null ? l : o.height) - 14 + r.scrollTop : n.bottom - s.top + 14 + r.scrollTop;
340
345
  return t.style.maxHeight = l !== void 0 && l > 0 ? `${l}px` : "", [d, i];
341
346
  });
342
- }, re = (e, t, o, n, s) => {
347
+ }, se = (e, t, n, o, s) => {
343
348
  const r = t.dom.parentNode;
344
349
  if (!r)
345
350
  return {};
346
- const i = U(o, n), a = X();
351
+ const i = W(n, o), a = Y();
347
352
  r.appendChild(i);
348
- const l = Y(a), m = te(e, t, i), c = oe(e, t, i, a), d = Z(e, a), h = ee();
353
+ const l = Z(a), m = oe(e, t, i), c = ne(e, t, i, a), d = ee(e, a), h = te();
349
354
  return r.addEventListener("mousemove", l), r.addEventListener("mousedown", m), r.addEventListener("keydown", c), {
350
355
  update: (g) => {
351
- !J(e, i, {
356
+ !X(e, i, {
352
357
  mouseEnter: d,
353
358
  mouseLeave: h
354
359
  }) || s(g, i);
@@ -357,28 +362,28 @@ const K = (e, { css: t }) => {
357
362
  r.removeEventListener("mousemove", l), r.removeEventListener("mousedown", m), r.removeEventListener("keydown", c), i.remove();
358
363
  }
359
364
  };
360
- }, se = "MILKDOWN_SLASH", ie = (e, t, o, n) => {
361
- const s = G(t);
362
- return new D({
363
- key: new _(se),
365
+ }, ie = "MILKDOWN_SLASH", ae = (e, t, n, o) => {
366
+ const s = J(t);
367
+ return new _({
368
+ key: new M(ie),
364
369
  props: R(s, e),
365
- view: (r) => re(s, r, e, o, n)
370
+ view: (r) => se(s, r, e, n, o)
366
371
  });
367
- }, ae = b((e, t) => {
372
+ }, le = b((e, t) => {
368
373
  var s, r;
369
- const o = (s = t == null ? void 0 : t.config) != null ? s : F, n = (r = t == null ? void 0 : t.calcPosition) != null ? r : ne;
374
+ const n = (s = t == null ? void 0 : t.config) != null ? s : j, o = (r = t == null ? void 0 : t.calcPosition) != null ? r : re;
370
375
  return {
371
376
  prosePlugins: (i, a) => {
372
- const l = o(a);
373
- return [ie(e, l, "slash-dropdown", n)];
377
+ const l = n(a);
378
+ return [ae(e, l, "slash-dropdown", o)];
374
379
  }
375
380
  };
376
- }), he = $.create([ae()]);
381
+ }), ge = $.create([le()]);
377
382
  export {
378
383
  f as createDropdownItem,
379
384
  L as defaultActions,
380
- F as defaultConfig,
381
- he as slash,
382
- ae as slashPlugin
385
+ j as defaultConfig,
386
+ ge as slash,
387
+ le as slashPlugin
383
388
  };
384
389
  //# sourceMappingURL=index.es.js.map