@damiro/stylo 0.13.1 → 0.13.5

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,5 +1,5 @@
1
- import { a as e, o as t, r as n } from "./highlight-B4c0sXF_.js";
2
- import { S as r, _ as i, a, b as o, c as s, d as c, f as l, g as u, h as d, i as f, l as p, m, n as h, o as g, p as _, r as ee, s as v, t as te, u as ne, v as re, x as y, y as b } from "./useCodeMirror-C3DKpax1.js";
1
+ import { a as e, o as t, r as n } from "./highlight-dLERTt-F.js";
2
+ import { S as r, _ as i, a, b as o, c as s, d as c, f as l, g as u, h as d, i as f, l as p, m, n as h, o as g, p as _, r as ee, s as v, t as te, u as ne, v as re, x as y, y as b } from "./useCodeMirror-DtxWsSw7.js";
3
3
  import { a as ie, i as x } from "./config-DTBxVhtH.js";
4
4
  import { a as S, n as ae, o as oe, r as C, t as w } from "./embed-Dsu6b-MV.js";
5
5
  import { t as se } from "./katex-BfiLlqfN.js";
@@ -124,13 +124,11 @@ function Ne(e, t, n, r, i, a) {
124
124
  to: t,
125
125
  enter: (e) => {
126
126
  if (e.name !== "ListItem") return;
127
- let t = Me(e) - 1;
128
- if (t < 1) return;
129
- let n = r.lineAt(e.from).number, i = e.node.getChild("BulletList") ?? e.node.getChild("OrderedList"), s = r.lineAt(i ? i.from - 1 : Math.min(e.to, r.length)).number;
130
- for (let e = n; e <= s; e++) o.has(e) || (o.add(e), a.push(D.line({
127
+ let t = Me(e), n = t - 1, i = r.lineAt(e.from).number, s = e.node.getChild("BulletList") ?? e.node.getChild("OrderedList"), c = r.lineAt(s ? s.from - 1 : Math.min(e.to, r.length)).number, l = e.node.prevSibling ? "cm-inplace-item-gap" : t > 1 ? "cm-inplace-item-gap-nested" : null;
128
+ for (let e = i; e <= c; e++) n >= 1 && !o.has(e) && (o.add(e), a.push(D.line({
131
129
  class: "cm-inplace-li",
132
- attributes: { style: `--sl-li-depth:${t}` }
133
- }).range(r.line(e).from)));
130
+ attributes: { style: `--sl-li-depth:${n}` }
131
+ }).range(r.line(e).from))), e === i && l && a.push(D.line({ class: l }).range(r.line(e).from));
134
132
  }
135
133
  });
136
134
  }
@@ -1480,7 +1478,7 @@ function Sn(e, t) {
1480
1478
  }
1481
1479
  function Cn(e) {
1482
1480
  if (!e.facet(I).tables) return D.none;
1483
- let t = e.facet(xe) === "cells", r = e.facet(L) != null && e.facet(I).embeds, i = F(e), a = n(e.doc), o = t ? null : B(e), s = [];
1481
+ let t = e.facet(xe) === "cells" && !e.readOnly, r = e.facet(L) != null && e.facet(I).embeds, i = F(e), a = n(e.doc), o = t ? null : B(e), s = [];
1484
1482
  return i.iterate({ enter: (n) => {
1485
1483
  if (n.name !== "Table") return;
1486
1484
  if (a && n.from < a.to) return !1;
@@ -1501,7 +1499,11 @@ function Cn(e) {
1501
1499
  }
1502
1500
  var wn = P.define({
1503
1501
  create: Cn,
1504
- update: (e, t) => t.annotation(Tn) ? e.map(t.changes) : t.state.facet(xe) === "cells" ? t.docChanged ? Cn(t.state) : e.map(t.changes) : t.docChanged || t.selection ? Cn(t.state) : e,
1502
+ update: (e, t) => {
1503
+ if (t.annotation(Tn)) return e.map(t.changes);
1504
+ let n = t.startState.readOnly !== t.state.readOnly;
1505
+ return t.state.facet(xe) === "cells" ? t.docChanged || n ? Cn(t.state) : e.map(t.changes) : t.docChanged || t.selection || n ? Cn(t.state) : e;
1506
+ },
1505
1507
  provide: (e) => [O.decorations.from(e), O.atomicRanges.of((t) => t.state.field(e))]
1506
1508
  }), Tn = fe.define(), En = class extends A {
1507
1509
  data;
@@ -1649,7 +1651,17 @@ var wn = P.define({
1649
1651
  }
1650
1652
  let o = this.cols(), s = () => {
1651
1653
  let { to: e } = this.bounds(t);
1652
- t.focus(), t.dispatch({ selection: { anchor: Math.min(e + 1, t.state.doc.length) } });
1654
+ if (t.focus(), e >= t.state.doc.length) {
1655
+ t.dispatch({
1656
+ changes: {
1657
+ from: e,
1658
+ insert: "\n"
1659
+ },
1660
+ selection: { anchor: e + 1 }
1661
+ });
1662
+ return;
1663
+ }
1664
+ t.dispatch({ selection: { anchor: e + 1 } });
1653
1665
  }, c = () => {
1654
1666
  let { from: e } = this.bounds(t);
1655
1667
  t.focus(), t.dispatch({ selection: { anchor: Math.max(e - 1, 0) } });
@@ -2191,16 +2203,16 @@ var Zn = class {
2191
2203
  }])), rr = {
2192
2204
  ".cm-inplace-callout": {
2193
2205
  borderLeft: "0.25rem solid var(--stylo-callout-accent, var(--stylo-border))",
2194
- padding: "0 1rem",
2206
+ padding: "0 var(--stylo-rhythm-callout-padding-x, 1rem)",
2195
2207
  background: "color-mix(in srgb, var(--stylo-callout-accent, var(--stylo-border)) 10%, transparent)",
2196
2208
  color: "var(--stylo-text)"
2197
2209
  },
2198
2210
  ".cm-inplace-callout-head": {
2199
- paddingTop: "0.7em",
2211
+ paddingTop: "var(--stylo-rhythm-callout-padding-y, 0.7em)",
2200
2212
  borderTopRightRadius: "var(--stylo-radius)"
2201
2213
  },
2202
2214
  ".cm-inplace-callout-foot": {
2203
- paddingBottom: "0.7em",
2215
+ paddingBottom: "var(--stylo-rhythm-callout-padding-y, 0.7em)",
2204
2216
  borderBottomRightRadius: "var(--stylo-radius)"
2205
2217
  },
2206
2218
  ".cm-inplace-callout-note": { "--stylo-callout-accent": "var(--stylo-callout-note, #3b82f6)" },
@@ -2235,28 +2247,32 @@ var Zn = class {
2235
2247
  },
2236
2248
  ".cm-inplace-heading": { fontWeight: "600" },
2237
2249
  ".cm-inplace-h1": {
2238
- fontSize: "2.25em",
2239
- lineHeight: "1.1111111",
2250
+ fontSize: "var(--stylo-rhythm-h1-size, 2.25em)",
2251
+ lineHeight: "var(--stylo-rhythm-h1-line, 1.1111111)",
2240
2252
  paddingTop: "0.35em"
2241
2253
  },
2242
2254
  ".cm-inplace-h2": {
2243
- fontSize: "1.5em",
2244
- lineHeight: "1.3333333",
2255
+ fontSize: "var(--stylo-rhythm-h2-size, 1.5em)",
2256
+ lineHeight: "var(--stylo-rhythm-h2-line, 1.3333333)",
2245
2257
  paddingTop: "0.7em"
2246
2258
  },
2247
2259
  ".cm-inplace-h3": {
2248
- fontSize: "1.25em",
2249
- lineHeight: "1.6",
2260
+ fontSize: "var(--stylo-rhythm-h3-size, 1.25em)",
2261
+ lineHeight: "var(--stylo-rhythm-h3-line, 1.6)",
2250
2262
  paddingTop: "0.6em"
2251
2263
  },
2252
2264
  ".cm-inplace-h4": {
2253
- fontSize: "1em",
2254
- lineHeight: "1.5",
2265
+ fontSize: "var(--stylo-rhythm-h4-size, 1em)",
2266
+ lineHeight: "var(--stylo-rhythm-h4-line, 1.5)",
2255
2267
  paddingTop: "0.5em"
2256
2268
  },
2257
- ".cm-inplace-h5": { fontSize: "0.9em" },
2269
+ ".cm-inplace-h5": {
2270
+ fontSize: "var(--stylo-rhythm-h5-size, 0.9em)",
2271
+ lineHeight: "var(--stylo-rhythm-h5-line, 1.5)"
2272
+ },
2258
2273
  ".cm-inplace-h6": {
2259
- fontSize: "0.9em",
2274
+ fontSize: "var(--stylo-rhythm-h6-size, 0.9em)",
2275
+ lineHeight: "var(--stylo-rhythm-h6-line, 1.5)",
2260
2276
  color: "var(--stylo-text-muted)"
2261
2277
  },
2262
2278
  ".cm-inplace-strong": { fontWeight: "700" },
@@ -2340,6 +2356,8 @@ var Zn = class {
2340
2356
  backgroundPosition: "0.35em 0",
2341
2357
  backgroundSize: "calc(var(--sl-li-depth, 0) * 1.5em) 100%"
2342
2358
  },
2359
+ ".cm-inplace-item-gap": { paddingTop: "var(--stylo-rhythm-list-item-gap, 0.5em)" },
2360
+ ".cm-inplace-item-gap-nested": { paddingTop: "var(--stylo-rhythm-list-item-gap-nested, 0.75em)" },
2343
2361
  ".cm-inplace-checkbox": {
2344
2362
  margin: "0 0.4em 0 0",
2345
2363
  verticalAlign: "middle",
@@ -2704,4 +2722,4 @@ function _r({ value: e, onChange: n, readOnly: i, placeholder: a, onWikiLinkClic
2704
2722
  //#endregion
2705
2723
  export { _r as InPlaceView };
2706
2724
 
2707
- //# sourceMappingURL=InPlaceView-DJzxnK6B.js.map
2725
+ //# sourceMappingURL=InPlaceView-Cq5YJ3-P.js.map