@wrdagency/blockout 1.0.9 → 1.0.11

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.
@@ -1,18 +1,18 @@
1
- import { jsx as C, jsxs as ge } from "react/jsx-runtime";
1
+ import { jsx as L, jsxs as ge } from "react/jsx-runtime";
2
2
  import { cn as ye } from "../../../utils/css.js";
3
- import { r as T, w as ve, c as we, d as be, a as V, h as S, b as F, p as Me, E as Ie, l as ke, e as Ee, f as Ce } from "../../../toolbar-j1SJvq8D.js";
4
- import { $ as X, d as Le, T as Y, a as ee, s as Pe, g as Oe, b as j, P as z, h as te, i as Te, j as Se, k as _e, l as Ae, m as De, M as je, n as Ne, o as ne, q as W, r as xe, I as Ue, S as Fe, t as Be, E as qe, u as ze, v as He, w as Ke } from "../../../index-EPj3dCzl.js";
5
- import { l as Re, c as $e, g as Ve, w as We } from "../../../commands-IQnqt4xL.js";
3
+ import { r as T, w as ve, c as we, d as be, a as W, h as S, b as F, p as Me, E as Ie, l as ke, e as Ee, f as Le } from "../../../toolbar-CCiZ_PIy.js";
4
+ import { $ as X, d as Pe, T as Y, a as ee, s as Ce, g as Oe, b as j, P as z, h as te, i as Te, j as Se, k as _e, l as Ae, m as De, M as je, n as Ne, o as ne, q as G, r as xe, I as Ue, S as Fe, t as Be, E as qe, u as ze, v as $e, w as He } from "../../../index-EPj3dCzl.js";
5
+ import { l as Ke, c as Re, g as We, w as Ge } from "../../../commands-IQnqt4xL.js";
6
6
  import '../../../assets/prosemirror.css';/* empty css */
7
- import { d as Ge, M as Je, a as Ze, b as Qe } from "../../../index-CwFPDtaz.js";
7
+ import { d as Ve, M as Je, a as Ze, b as Qe } from "../../../index-CwFPDtaz.js";
8
8
  import { P as Xe } from "../../../base-jB1DIMnz.js";
9
9
  import "react";
10
10
  import { useMentionsPlugin as Ye } from "./slash/mentions.js";
11
- var et = Object.defineProperty, G = Object.getOwnPropertySymbols, tt = Object.prototype.hasOwnProperty, nt = Object.prototype.propertyIsEnumerable, J = (n, e, t) => e in n ? et(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, rt = (n, e) => {
11
+ var et = Object.defineProperty, V = Object.getOwnPropertySymbols, tt = Object.prototype.hasOwnProperty, nt = Object.prototype.propertyIsEnumerable, J = (n, e, t) => e in n ? et(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, rt = (n, e) => {
12
12
  for (var t in e || (e = {}))
13
13
  tt.call(e, t) && J(n, t, e[t]);
14
- if (G)
15
- for (var t of G(e))
14
+ if (V)
15
+ for (var t of V(e))
16
16
  nt.call(e, t) && J(n, t, e[t]);
17
17
  return n;
18
18
  };
@@ -100,31 +100,31 @@ const it = be({
100
100
  readonly: r,
101
101
  setAttr: i,
102
102
  onMount: o,
103
- selected: l
103
+ selected: a
104
104
  }) {
105
- const a = (u) => {
105
+ const l = (u) => {
106
106
  u != null && u instanceof Element && o(u);
107
- }, d = (u) => {
107
+ }, c = (u) => {
108
108
  u.stopPropagation(), u.preventDefault(), e.value != null && i("checked", !e.value);
109
- }, f = V(() => s.renderLabel({
109
+ }, f = W(() => s.renderLabel({
110
110
  label: n.value,
111
111
  listType: t.value,
112
112
  checked: e.value,
113
113
  readonly: r.value
114
- })), p = V(() => e.value == null ? t.value === "bullet" ? "bullet" : "ordered" : e.value ? "checked" : "unchecked");
114
+ })), p = W(() => e.value == null ? t.value === "bullet" ? "bullet" : "ordered" : e.value ? "checked" : "unchecked");
115
115
  return () => /* @__PURE__ */ S(
116
116
  "li",
117
117
  {
118
118
  class: F(
119
119
  "list-item",
120
- l.value && "ProseMirror-selectednode"
120
+ a.value && "ProseMirror-selectednode"
121
121
  )
122
122
  },
123
123
  /* @__PURE__ */ S(
124
124
  "div",
125
125
  {
126
126
  class: "label-wrapper",
127
- onPointerdown: d,
127
+ onPointerdown: c,
128
128
  contenteditable: !1
129
129
  },
130
130
  /* @__PURE__ */ S(
@@ -139,35 +139,35 @@ const it = be({
139
139
  }
140
140
  )
141
141
  ),
142
- /* @__PURE__ */ S("div", { class: "children", ref: a })
142
+ /* @__PURE__ */ S("div", { class: "children", ref: l })
143
143
  );
144
144
  }
145
- }), ie = Le(
146
- Re.node,
145
+ }), ie = Pe(
146
+ Ke.node,
147
147
  (n) => (e, t, s) => {
148
148
  const r = document.createElement("div");
149
149
  r.className = "milkdown-list-item-block";
150
150
  const i = document.createElement("div");
151
151
  i.setAttribute("data-content-dom", "true"), i.classList.add("content-dom");
152
- const o = T(e.attrs.label), l = T(e.attrs.checked), a = T(e.attrs.listType), d = T(!t.editable), f = n.get(N.key), p = T(!1), u = (c, E) => {
152
+ const o = T(e.attrs.label), a = T(e.attrs.checked), l = T(e.attrs.listType), c = T(!t.editable), f = n.get(N.key), p = T(!1), u = (d, E) => {
153
153
  if (!t.editable) return;
154
154
  const w = s();
155
- w != null && (t.hasFocus() || t.focus(), t.dispatch(t.state.tr.setNodeAttribute(w, c, E)));
155
+ w != null && (t.hasFocus() || t.focus(), t.dispatch(t.state.tr.setNodeAttribute(w, d, E)));
156
156
  }, h = ve(() => {
157
157
  p.value ? r.classList.add("selected") : r.classList.remove("selected");
158
158
  });
159
159
  let g = 0;
160
160
  const b = we(it, {
161
161
  label: o,
162
- checked: l,
163
- listType: a,
164
- readonly: d,
162
+ checked: a,
163
+ listType: l,
164
+ readonly: c,
165
165
  config: f,
166
166
  selected: p,
167
167
  setAttr: u,
168
- onMount: (c) => {
168
+ onMount: (d) => {
169
169
  const { anchor: E, head: w } = t.state.selection;
170
- c.appendChild(i);
170
+ d.appendChild(i);
171
171
  const _ = t.state.doc.resolve(E), he = t.state.doc.resolve(w);
172
172
  g = requestAnimationFrame(() => {
173
173
  if (cancelAnimationFrame(g), !_.doc.eq(t.state.doc)) return;
@@ -177,16 +177,16 @@ const it = be({
177
177
  }
178
178
  });
179
179
  b.mount(r);
180
- const O = (c) => {
181
- a.value = c.attrs.listType, o.value = c.attrs.label, l.value = c.attrs.checked, d.value = !t.editable;
180
+ const O = (d) => {
181
+ l.value = d.attrs.listType, o.value = d.attrs.label, a.value = d.attrs.checked, c.value = !t.editable;
182
182
  };
183
183
  O(e);
184
184
  let k = e;
185
185
  return {
186
186
  dom: r,
187
187
  contentDOM: i,
188
- update: (c) => c.type !== e.type ? !1 : (c.sameMarkup(k) && c.content.eq(k.content) || (k = c, O(c)), !0),
189
- ignoreMutation: (c) => !r || !i ? !0 : c.type === "selection" ? !1 : i === c.target && c.type === "attributes" ? !0 : !i.contains(c.target),
188
+ update: (d) => d.type !== e.type ? !1 : (d.sameMarkup(k) && d.content.eq(k.content) || (k = d, O(d)), !0),
189
+ ignoreMutation: (d) => !r || !i ? !0 : d.type === "selection" ? !1 : i === d.target && d.type === "attributes" ? !0 : !i.contains(d.target),
190
190
  selectNode: () => {
191
191
  p.value = !0;
192
192
  },
@@ -223,7 +223,7 @@ function at(n, e) {
223
223
  }), n;
224
224
  }
225
225
  const oe = ee((n) => {
226
- const e = n.get(Pe);
226
+ const e = n.get(Ce);
227
227
  n.update(Oe, (r) => ({
228
228
  ...r,
229
229
  editable: r.editable ?? (() => !0)
@@ -234,11 +234,11 @@ const oe = ee((n) => {
234
234
  props: {
235
235
  handlePaste: (r, i) => {
236
236
  var O, k;
237
- const o = n.get(Te), l = (k = (O = r.props).editable) == null ? void 0 : k.call(O, r.state), { clipboardData: a } = i;
238
- if (!l || !a || r.state.selection.$from.node().type.spec.code) return !1;
239
- const f = a.getData("text/plain"), p = a.getData("vscode-editor-data");
237
+ const o = n.get(Te), a = (k = (O = r.props).editable) == null ? void 0 : k.call(O, r.state), { clipboardData: l } = i;
238
+ if (!a || !l || r.state.selection.$from.node().type.spec.code) return !1;
239
+ const f = l.getData("text/plain"), p = l.getData("vscode-editor-data");
240
240
  if (p) {
241
- const c = JSON.parse(p), E = c == null ? void 0 : c.mode;
241
+ const d = JSON.parse(p), E = d == null ? void 0 : d.mode;
242
242
  if (f && E) {
243
243
  const { tr: w } = r.state, _ = Se("code_block", e);
244
244
  return w.replaceSelectionWith(_.create({ language: E })).setSelection(
@@ -249,25 +249,25 @@ const oe = ee((n) => {
249
249
  `)), r.dispatch(w), !0;
250
250
  }
251
251
  }
252
- const u = a.getData("text/html");
252
+ const u = l.getData("text/html");
253
253
  if (u.length === 0 && f.length === 0) return !1;
254
254
  const h = _e.fromSchema(e);
255
255
  let g;
256
256
  if (u.length === 0) {
257
- const c = o(f);
258
- if (!c || typeof c == "string") return !1;
257
+ const d = o(f);
258
+ if (!d || typeof d == "string") return !1;
259
259
  g = Ae.fromSchema(e).serializeFragment(
260
- c.content
260
+ d.content
261
261
  );
262
262
  } else {
263
- const c = document.createElement("template");
264
- c.innerHTML = u, g = c.content.cloneNode(!0), c.remove();
263
+ const d = document.createElement("template");
264
+ d.innerHTML = u, g = d.content.cloneNode(!0), d.remove();
265
265
  }
266
- const P = h.parseSlice(g), b = De(P);
266
+ const C = h.parseSlice(g), b = De(C);
267
267
  if (b)
268
268
  return r.dispatch(r.state.tr.replaceSelectionWith(b, !0)), !0;
269
269
  try {
270
- return r.dispatch(r.state.tr.replaceSelection(P)), !0;
270
+ return r.dispatch(r.state.tr.replaceSelection(C)), !0;
271
271
  } catch {
272
272
  return !1;
273
273
  }
@@ -282,8 +282,8 @@ const oe = ee((n) => {
282
282
 
283
283
  `
284
284
  );
285
- const l = e.topNodeType.createAndFill(void 0, r.content);
286
- return l ? i(l) : "";
285
+ const a = e.topNodeType.createAndFill(void 0, r.content);
286
+ return a ? i(a) : "";
287
287
  }
288
288
  }
289
289
  });
@@ -332,13 +332,13 @@ var ae = /* @__PURE__ */ function(n) {
332
332
  return r == 0 && i == this.length ? this : new e(this.values.slice(r, i));
333
333
  }, e.prototype.getInner = function(r) {
334
334
  return this.values[r];
335
- }, e.prototype.forEachInner = function(r, i, o, l) {
336
- for (var a = i; a < o; a++)
337
- if (r(this.values[a], l + a) === !1)
335
+ }, e.prototype.forEachInner = function(r, i, o, a) {
336
+ for (var l = i; l < o; l++)
337
+ if (r(this.values[l], a + l) === !1)
338
338
  return !1;
339
- }, e.prototype.forEachInvertedInner = function(r, i, o, l) {
340
- for (var a = i - 1; a >= o; a--)
341
- if (r(this.values[a], l + a) === !1)
339
+ }, e.prototype.forEachInvertedInner = function(r, i, o, a) {
340
+ for (var l = i - 1; l >= o; l--)
341
+ if (r(this.values[l], a + l) === !1)
342
342
  return !1;
343
343
  }, e.prototype.leafAppend = function(r) {
344
344
  if (this.length + r.length <= D)
@@ -362,12 +362,12 @@ var lt = /* @__PURE__ */ function(n) {
362
362
  }, e.prototype.getInner = function(s) {
363
363
  return s < this.left.length ? this.left.get(s) : this.right.get(s - this.left.length);
364
364
  }, e.prototype.forEachInner = function(s, r, i, o) {
365
- var l = this.left.length;
366
- if (r < l && this.left.forEachInner(s, r, Math.min(i, l), o) === !1 || i > l && this.right.forEachInner(s, Math.max(r - l, 0), Math.min(this.length, i) - l, o + l) === !1)
365
+ var a = this.left.length;
366
+ if (r < a && this.left.forEachInner(s, r, Math.min(i, a), o) === !1 || i > a && this.right.forEachInner(s, Math.max(r - a, 0), Math.min(this.length, i) - a, o + a) === !1)
367
367
  return !1;
368
368
  }, e.prototype.forEachInvertedInner = function(s, r, i, o) {
369
- var l = this.left.length;
370
- if (r > l && this.right.forEachInvertedInner(s, r - l, Math.max(i, l) - l, o + l) === !1 || i < l && this.left.forEachInvertedInner(s, Math.min(r, l), i, o) === !1)
369
+ var a = this.left.length;
370
+ if (r > a && this.right.forEachInvertedInner(s, r - a, Math.max(i, a) - a, o + a) === !1 || i < a && this.left.forEachInvertedInner(s, Math.min(r, a), i, o) === !1)
371
371
  return !1;
372
372
  }, e.prototype.sliceInner = function(s, r) {
373
373
  if (s == 0 && r == this.length)
@@ -404,7 +404,7 @@ class y {
404
404
  }
405
405
  let r, i;
406
406
  t && (r = this.remapping(s, this.items.length), i = r.maps.length);
407
- let o = e.tr, l, a, d = [], f = [];
407
+ let o = e.tr, a, l, c = [], f = [];
408
408
  return this.items.forEach((p, u) => {
409
409
  if (!p.step) {
410
410
  r || (r = this.remapping(s, u + 1), i = r.maps.length), i--, f.push(p);
@@ -413,22 +413,22 @@ class y {
413
413
  if (r) {
414
414
  f.push(new v(p.map));
415
415
  let h = p.step.map(r.slice(i)), g;
416
- h && o.maybeStep(h).doc && (g = o.mapping.maps[o.mapping.maps.length - 1], d.push(new v(g, void 0, void 0, d.length + f.length))), i--, g && r.appendMap(g, i);
416
+ h && o.maybeStep(h).doc && (g = o.mapping.maps[o.mapping.maps.length - 1], c.push(new v(g, void 0, void 0, c.length + f.length))), i--, g && r.appendMap(g, i);
417
417
  } else
418
418
  o.maybeStep(p.step);
419
419
  if (p.selection)
420
- return l = r ? p.selection.map(r.slice(i)) : p.selection, a = new y(this.items.slice(0, s).append(f.reverse().concat(d)), this.eventCount - 1), !1;
421
- }, this.items.length, 0), { remaining: a, transform: o, selection: l };
420
+ return a = r ? p.selection.map(r.slice(i)) : p.selection, l = new y(this.items.slice(0, s).append(f.reverse().concat(c)), this.eventCount - 1), !1;
421
+ }, this.items.length, 0), { remaining: l, transform: o, selection: a };
422
422
  }
423
423
  // Create a new branch with the given transform added.
424
424
  addTransform(e, t, s, r) {
425
- let i = [], o = this.eventCount, l = this.items, a = !r && l.length ? l.get(l.length - 1) : null;
425
+ let i = [], o = this.eventCount, a = this.items, l = !r && a.length ? a.get(a.length - 1) : null;
426
426
  for (let f = 0; f < e.steps.length; f++) {
427
427
  let p = e.steps[f].invert(e.docs[f]), u = new v(e.mapping.maps[f], p, t), h;
428
- (h = a && a.merge(u)) && (u = h, f ? i.pop() : l = l.slice(0, l.length - 1)), i.push(u), t && (o++, t = void 0), r || (a = u);
428
+ (h = l && l.merge(u)) && (u = h, f ? i.pop() : a = a.slice(0, a.length - 1)), i.push(u), t && (o++, t = void 0), r || (l = u);
429
429
  }
430
- let d = o - s.depth;
431
- return d > ct && (l = ut(l, d), o -= d), new y(l.append(i), o);
430
+ let c = o - s.depth;
431
+ return c > ct && (a = ut(a, c), o -= c), new y(a.append(i), o);
432
432
  }
433
433
  remapping(e, t) {
434
434
  let s = new je();
@@ -447,27 +447,27 @@ class y {
447
447
  rebased(e, t) {
448
448
  if (!this.eventCount)
449
449
  return this;
450
- let s = [], r = Math.max(0, this.items.length - t), i = e.mapping, o = e.steps.length, l = this.eventCount;
450
+ let s = [], r = Math.max(0, this.items.length - t), i = e.mapping, o = e.steps.length, a = this.eventCount;
451
451
  this.items.forEach((u) => {
452
- u.selection && l--;
452
+ u.selection && a--;
453
453
  }, r);
454
- let a = t;
454
+ let l = t;
455
455
  this.items.forEach((u) => {
456
- let h = i.getMirror(--a);
456
+ let h = i.getMirror(--l);
457
457
  if (h == null)
458
458
  return;
459
459
  o = Math.min(o, h);
460
460
  let g = i.maps[h];
461
461
  if (u.step) {
462
- let P = e.steps[h].invert(e.docs[h]), b = u.selection && u.selection.map(i.slice(a + 1, h));
463
- b && l++, s.push(new v(g, P, b));
462
+ let C = e.steps[h].invert(e.docs[h]), b = u.selection && u.selection.map(i.slice(l + 1, h));
463
+ b && a++, s.push(new v(g, C, b));
464
464
  } else
465
465
  s.push(new v(g));
466
466
  }, r);
467
- let d = [];
467
+ let c = [];
468
468
  for (let u = t; u < o; u++)
469
- d.push(new v(i.maps[u]));
470
- let f = this.items.slice(0, r).append(d).append(s), p = new y(f, l);
469
+ c.push(new v(i.maps[u]));
470
+ let f = this.items.slice(0, r).append(c).append(s), p = new y(f, a);
471
471
  return p.emptyItemCount() > pt && (p = p.compress(this.items.length - s.length)), p;
472
472
  }
473
473
  emptyItemCount() {
@@ -484,15 +484,15 @@ class y {
484
484
  // order to associate old items with rebased steps.
485
485
  compress(e = this.items.length) {
486
486
  let t = this.remapping(0, e), s = t.maps.length, r = [], i = 0;
487
- return this.items.forEach((o, l) => {
488
- if (l >= e)
487
+ return this.items.forEach((o, a) => {
488
+ if (a >= e)
489
489
  r.push(o), o.selection && i++;
490
490
  else if (o.step) {
491
- let a = o.step.map(t.slice(s)), d = a && a.getMap();
492
- if (s--, d && t.appendMap(d, s), a) {
491
+ let l = o.step.map(t.slice(s)), c = l && l.getMap();
492
+ if (s--, c && t.appendMap(c, s), l) {
493
493
  let f = o.selection && o.selection.map(t.slice(s));
494
494
  f && i++;
495
- let p = new v(d.invert(), a, f), u, h = r.length - 1;
495
+ let p = new v(c.invert(), l, f), u, h = r.length - 1;
496
496
  (u = r.length && r[h].merge(p)) ? r[h] = u : r.push(p);
497
497
  }
498
498
  } else o.map && s--;
@@ -536,8 +536,8 @@ function dt(n, e, t, s) {
536
536
  if (o && o.getMeta(I))
537
537
  return o.getMeta(I).redo ? new M(n.done.addTransform(t, void 0, s, A(e)), n.undone, Z(t.mapping.maps), n.prevTime, n.prevComposition) : new M(n.done, n.undone.addTransform(t, void 0, s, A(e)), null, n.prevTime, n.prevComposition);
538
538
  if (t.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
539
- let l = t.getMeta("composition"), a = n.prevTime == 0 || !o && n.prevComposition != l && (n.prevTime < (t.time || 0) - s.newGroupDelay || !ft(t, n.prevRanges)), d = o ? x(n.prevRanges, t.mapping) : Z(t.mapping.maps);
540
- return new M(n.done.addTransform(t, a ? e.selection.getBookmark() : void 0, s, A(e)), y.empty, d, t.time, l ?? n.prevComposition);
539
+ let a = t.getMeta("composition"), l = n.prevTime == 0 || !o && n.prevComposition != a && (n.prevTime < (t.time || 0) - s.newGroupDelay || !ft(t, n.prevRanges)), c = o ? x(n.prevRanges, t.mapping) : Z(t.mapping.maps);
540
+ return new M(n.done.addTransform(t, l ? e.selection.getBookmark() : void 0, s, A(e)), y.empty, c, t.time, a ?? n.prevComposition);
541
541
  } else return (i = t.getMeta("rebased")) ? new M(n.done.rebased(t, i), n.undone.rebased(t, i), x(n.prevRanges, t.mapping), n.prevTime, n.prevComposition) : new M(n.done.addMaps(t.mapping.maps), n.undone.addMaps(t.mapping.maps), x(n.prevRanges, t.mapping), n.prevTime, n.prevComposition);
542
542
  }
543
543
  function ft(n, e) {
@@ -571,8 +571,8 @@ function ht(n, e, t) {
571
571
  let s = A(e), r = I.get(e).spec.config, i = (t ? n.undone : n.done).popEvent(e, s);
572
572
  if (!i)
573
573
  return null;
574
- let o = i.selection.resolve(i.transform.doc), l = (t ? n.done : n.undone).addTransform(i.transform, e.selection.getBookmark(), r, s), a = new M(t ? l : i.remaining, t ? i.remaining : l, null, 0, -1);
575
- return i.transform.setSelection(o).setMeta(I, { redo: t, historyState: a });
574
+ let o = i.selection.resolve(i.transform.doc), a = (t ? n.done : n.undone).addTransform(i.transform, e.selection.getBookmark(), r, s), l = new M(t ? a : i.remaining, t ? i.remaining : a, null, 0, -1);
575
+ return i.transform.setSelection(o).setMeta(I, { redo: t, historyState: l });
576
576
  }
577
577
  let U = !1, Q = null;
578
578
  function A(n) {
@@ -626,7 +626,7 @@ function le(n, e) {
626
626
  };
627
627
  }
628
628
  const pe = le(!1, !0), ue = le(!0, !0);
629
- function L(n, e) {
629
+ function P(n, e) {
630
630
  return Object.assign(n, {
631
631
  meta: {
632
632
  package: "@milkdown/plugin-history",
@@ -634,52 +634,52 @@ function L(n, e) {
634
634
  }
635
635
  }), n;
636
636
  }
637
- const H = ne("Undo", () => () => pe);
638
- L(H, {
637
+ const $ = ne("Undo", () => () => pe);
638
+ P($, {
639
639
  displayName: "Command<undo>"
640
640
  });
641
- const K = ne("Redo", () => () => ue);
642
- L(K, {
641
+ const H = ne("Redo", () => () => ue);
642
+ P(H, {
643
643
  displayName: "Command<redo>"
644
644
  });
645
- const R = X({}, "historyProviderConfig");
646
- L(R, {
645
+ const K = X({}, "historyProviderConfig");
646
+ P(K, {
647
647
  displayName: "Ctx<historyProviderConfig>"
648
648
  });
649
649
  const ce = ee(
650
- (n) => gt(n.get(R.key))
650
+ (n) => gt(n.get(K.key))
651
651
  );
652
- L(ce, {
652
+ P(ce, {
653
653
  displayName: "Ctx<historyProviderPlugin>"
654
654
  });
655
- const $ = Ne("historyKeymap", {
655
+ const R = Ne("historyKeymap", {
656
656
  Undo: {
657
657
  shortcuts: "Mod-z",
658
658
  command: (n) => {
659
- const e = n.get(W);
660
- return () => e.call(H.key);
659
+ const e = n.get(G);
660
+ return () => e.call($.key);
661
661
  }
662
662
  },
663
663
  Redo: {
664
664
  shortcuts: ["Mod-y", "Shift-Mod-z"],
665
665
  command: (n) => {
666
- const e = n.get(W);
667
- return () => e.call(K.key);
666
+ const e = n.get(G);
667
+ return () => e.call(H.key);
668
668
  }
669
669
  }
670
670
  });
671
- L($.ctx, {
671
+ P(R.ctx, {
672
672
  displayName: "KeymapCtx<history>"
673
673
  });
674
- L($.shortcuts, {
674
+ P(R.shortcuts, {
675
675
  displayName: "Keymap<history>"
676
676
  });
677
677
  const yt = [
678
- R,
678
+ K,
679
679
  ce,
680
+ R,
680
681
  $,
681
- H,
682
- K
682
+ H
683
683
  ].flat();
684
684
  class de {
685
685
  constructor() {
@@ -731,32 +731,32 @@ const q = xe(
731
731
  ), vt = new j("MILKDOWN_LISTENER"), fe = (n) => (n.inject(q, new de()), async () => {
732
732
  await n.wait(Ue);
733
733
  const e = n.get(q), { listeners: t } = e;
734
- t.beforeMount.forEach((a) => a(n)), await n.wait(Fe);
734
+ t.beforeMount.forEach((l) => l(n)), await n.wait(Fe);
735
735
  const s = n.get(te);
736
736
  let r = null, i = null, o = null;
737
- const l = new z({
737
+ const a = new z({
738
738
  key: vt,
739
739
  view: () => ({
740
740
  destroy: () => {
741
- t.destroy.forEach((a) => a(n));
741
+ t.destroy.forEach((l) => l(n));
742
742
  }
743
743
  }),
744
744
  props: {
745
745
  handleDOMEvents: {
746
- focus: () => (t.focus.forEach((a) => a(n)), !1),
747
- blur: () => (t.blur.forEach((a) => a(n)), !1)
746
+ focus: () => (t.focus.forEach((l) => l(n)), !1),
747
+ blur: () => (t.blur.forEach((l) => l(n)), !1)
748
748
  }
749
749
  },
750
750
  state: {
751
- init: (a, d) => {
752
- r = d.doc, i = s(d.doc);
751
+ init: (l, c) => {
752
+ r = c.doc, i = s(c.doc);
753
753
  },
754
- apply: (a) => {
755
- const d = a.selection;
756
- return (!o && d || o && !d.eq(o)) && (t.selectionUpdated.forEach((p) => {
757
- p(n, d, o);
758
- }), o = d), !(a.docChanged || a.storedMarksSet) || a.getMeta("addToHistory") === !1 ? void 0 : Ge(() => {
759
- const { doc: p } = a;
754
+ apply: (l) => {
755
+ const c = l.selection;
756
+ return (!o && c || o && !c.eq(o)) && (t.selectionUpdated.forEach((p) => {
757
+ p(n, c, o);
758
+ }), o = c), !(l.docChanged || l.storedMarksSet) || l.getMeta("addToHistory") === !1 ? void 0 : Ve(() => {
759
+ const { doc: p } = l;
760
760
  if (t.updated.length > 0 && r && !r.eq(p) && t.updated.forEach((u) => {
761
761
  u(n, p, r);
762
762
  }), t.markdownUpdated.length > 0 && r && !r.eq(p)) {
@@ -770,7 +770,7 @@ const q = xe(
770
770
  }
771
771
  }
772
772
  });
773
- n.update(Be, (a) => a.concat(l)), await n.wait(qe), t.mounted.forEach((a) => a(n));
773
+ n.update(Be, (l) => l.concat(a)), await n.wait(qe), t.mounted.forEach((l) => l(n));
774
774
  });
775
775
  fe.meta = {
776
776
  package: "@milkdown/plugin-listener",
@@ -779,29 +779,41 @@ fe.meta = {
779
779
  const wt = ({
780
780
  className: n,
781
781
  value: e,
782
- onChangeValue: t
782
+ onChangeValue: t,
783
+ children: s,
784
+ toolbar: r = "top"
783
785
  }) => {
784
- const s = Ye();
786
+ const i = Ye();
785
787
  return Ze(
786
- (r) => ze.make().config((i) => {
787
- i.set(He, r), i.set(Ke, e || ""), i.get(q).markdownUpdated((l, a) => {
788
- t(a);
789
- }), i.set(N.key, {
788
+ (o) => ze.make().config((a) => {
789
+ a.set($e, o), a.set(He, e || ""), a.get(q).markdownUpdated((c, f) => {
790
+ t == null || t(f);
791
+ }), a.set(N.key, {
790
792
  renderLabel: () => ""
791
- }), i.update(ke.key, (l) => ({
792
- ...l,
793
+ }), a.update(ke.key, (c) => ({
794
+ ...c,
793
795
  linkIcon: "",
794
796
  editButton: "",
795
797
  removeButton: "",
796
798
  confirmButton: "",
797
799
  inputPlaceholder: "Enter a URL..."
798
- })), s.config(i);
799
- }).use(fe).use($e).use(Ve).use(oe).use(yt).use(ot).use(We).config(Ee).use(Ce).use(s.plugin)
800
- ), /* @__PURE__ */ ge("div", { className: ye("component-markdown-editor", n), children: [
801
- /* @__PURE__ */ C(Ie, { className: "component-markdown-editor__toolbar" }),
802
- /* @__PURE__ */ C("div", { className: "component-markdown-editor__content", children: /* @__PURE__ */ C(Qe, {}) })
803
- ] });
804
- }, St = (n) => /* @__PURE__ */ C(Je, { children: /* @__PURE__ */ C(Xe, { children: /* @__PURE__ */ C(wt, { ...n }) }) });
800
+ })), i.config(a);
801
+ }).use(fe).use(Re).use(We).use(oe).use(yt).use(ot).use(Ge).config(Ee).use(Le).use(i.plugin)
802
+ ), /* @__PURE__ */ ge(
803
+ "div",
804
+ {
805
+ className: ye(
806
+ "component-markdown-editor",
807
+ r && `component-markdown-editor--toolbar-${r}`,
808
+ n
809
+ ),
810
+ children: [
811
+ r && /* @__PURE__ */ L(Ie, { className: "component-markdown-editor__toolbar", children: s }),
812
+ /* @__PURE__ */ L("div", { className: "component-markdown-editor__content", children: /* @__PURE__ */ L(Qe, {}) })
813
+ ]
814
+ }
815
+ );
816
+ }, St = (n) => /* @__PURE__ */ L(Je, { children: /* @__PURE__ */ L(Xe, { children: /* @__PURE__ */ L(wt, { ...n }) }) });
805
817
  export {
806
818
  St as MarkdownEditor
807
819
  };
@@ -1,7 +1,9 @@
1
+ import { PropsWithChildren } from 'react';
1
2
  import { ControlFC } from '../base-control/props';
2
- interface MarkdownControlProps {
3
+ interface MarkdownControlProps extends PropsWithChildren {
3
4
  value?: string;
4
- onChangeValue: (value: string) => void;
5
+ onChangeValue?: (value: string) => void;
6
+ toolbar?: "top" | "bottom" | false;
5
7
  }
6
8
  export declare const MarkdownControl: ControlFC<MarkdownControlProps>;
7
9
  export {};
@@ -1,5 +1,5 @@
1
- import { FC } from 'react';
2
- interface EditorToolbarProps {
1
+ import { FC, PropsWithChildren } from 'react';
2
+ interface EditorToolbarProps extends PropsWithChildren {
3
3
  className?: string;
4
4
  }
5
5
  export declare const EditorToolbar: FC<EditorToolbarProps>;
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "../../toolbar/index.js";
3
3
  import "../../../index-CwFPDtaz.js";
4
- import { E as b } from "../../../toolbar-j1SJvq8D.js";
4
+ import { E as b } from "../../../toolbar-CCiZ_PIy.js";
5
5
  import "react";
6
6
  import "../../../commands-IQnqt4xL.js";
7
7
  import "../../../index-EPj3dCzl.js";
@@ -1,5 +1,6 @@
1
1
  export { useSplitInput } from './input';
2
- export { useModifiers } from './keyboard';
2
+ export { useHotkey, useModifiers } from './keyboard';
3
3
  export { useSelection, type Selection, type SelectionMode } from './selection';
4
4
  export { useObjectState } from './state';
5
5
  export { useTemporaryChange } from './temporary';
6
+ export { useTheme } from './theme';
@@ -1,12 +1,15 @@
1
1
  import { useSplitInput as r } from "./input.js";
2
- import { useModifiers as p } from "./keyboard.js";
3
- import { useSelection as m } from "./selection.js";
4
- import { useObjectState as u } from "./state.js";
5
- import { useTemporaryChange as i } from "./temporary.js";
2
+ import { useHotkey as p, useModifiers as m } from "./keyboard.js";
3
+ import { useSelection as u } from "./selection.js";
4
+ import { useObjectState as x } from "./state.js";
5
+ import { useTemporaryChange as a } from "./temporary.js";
6
+ import { useTheme as S } from "./theme.js";
6
7
  export {
7
- p as useModifiers,
8
- u as useObjectState,
9
- m as useSelection,
8
+ p as useHotkey,
9
+ m as useModifiers,
10
+ x as useObjectState,
11
+ u as useSelection,
10
12
  r as useSplitInput,
11
- i as useTemporaryChange
13
+ a as useTemporaryChange,
14
+ S as useTheme
12
15
  };
@@ -1,4 +1,4 @@
1
- import { useRef as f, useEffect as o } from "react";
1
+ import { useEffect as o, useRef as f } from "react";
2
2
  function l() {
3
3
  const r = f({
4
4
  shift: !1,
@@ -0,0 +1,9 @@
1
+ type Theme = "light" | "dark";
2
+ export declare function useTheme(): {
3
+ theme: Theme;
4
+ isDark: boolean;
5
+ isLight: boolean;
6
+ toggle: () => void;
7
+ set: import('react').Dispatch<import('react').SetStateAction<Theme>>;
8
+ };
9
+ export {};
@@ -0,0 +1,19 @@
1
+ import { u as m } from "../index-D7vLJIGX.js";
2
+ import { useEffect as r } from "react";
3
+ function h() {
4
+ const [e, t] = m("blockout__theme", "light");
5
+ return r(() => {
6
+ document.documentElement.dataset.colourScheme = e;
7
+ }, [e]), {
8
+ theme: e,
9
+ isDark: e === "dark",
10
+ isLight: e === "light",
11
+ toggle: () => {
12
+ t((o) => o === "light" ? "dark" : "light");
13
+ },
14
+ set: t
15
+ };
16
+ }
17
+ export {
18
+ h as useTheme
19
+ };