@damiro/stylo 0.13.0 → 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.
- package/dist/{InPlaceView-BGVCST5f.js → InPlaceView-Cq5YJ3-P.js} +48 -30
- package/dist/InPlaceView-Cq5YJ3-P.js.map +1 -0
- package/dist/{Preview-C5Oi_jpI.js → Preview-DZtTym8y.js} +2 -2
- package/dist/{Preview-C5Oi_jpI.js.map → Preview-DZtTym8y.js.map} +1 -1
- package/dist/{highlight-DNGJlCDY.js → highlight-dLERTt-F.js} +17 -17
- package/dist/highlight-dLERTt-F.js.map +1 -0
- package/dist/inplace/list-guides.d.ts +7 -0
- package/dist/inplace/list-guides.d.ts.map +1 -1
- package/dist/inplace/selection-bar-position.d.ts.map +1 -1
- package/dist/inplace/selection-bar.d.ts.map +1 -1
- package/dist/inplace/table-widget.d.ts.map +1 -1
- package/dist/inplace/tables.d.ts.map +1 -1
- package/dist/inplace/theme-callout.d.ts.map +1 -1
- package/dist/inplace/theme-canvas.d.ts +8 -0
- package/dist/inplace/theme-canvas.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/stylo.js +3 -3
- package/dist/toolbar/table.d.ts.map +1 -1
- package/dist/{useCodeMirror-COmcRrUo.js → useCodeMirror-DtxWsSw7.js} +3 -3
- package/dist/useCodeMirror-DtxWsSw7.js.map +1 -0
- package/package.json +1 -1
- package/dist/InPlaceView-BGVCST5f.js.map +0 -1
- package/dist/highlight-DNGJlCDY.js.map +0 -1
- package/dist/useCodeMirror-COmcRrUo.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as e, o as t, r as n } from "./highlight-
|
|
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-
|
|
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
|
-
|
|
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:${
|
|
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) =>
|
|
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(),
|
|
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) } });
|
|
@@ -2021,14 +2033,14 @@ var Wn = P.define({
|
|
|
2021
2033
|
};
|
|
2022
2034
|
}, this.contentDOM.addEventListener("pointerdown", this.onPointerDown, !0), this.onContextMenu = (t) => {
|
|
2023
2035
|
let n = t.target;
|
|
2024
|
-
e.state.facet(Ce)
|
|
2036
|
+
!e.state.facet(Ce) || e.state.readOnly || n?.closest(".cm-inplace-table-edit") || (t.preventDefault(), this.longPress.cancel(), !(Date.now() - this.longPressAt < 700) && this.openMenuAt(t.clientX, t.clientY, n));
|
|
2025
2037
|
}, this.contentDOM.addEventListener("contextmenu", this.onContextMenu), this.longPress = an(this.contentDOM, { onLongPress: (e, t, n) => {
|
|
2026
2038
|
this.longPressAt = Date.now(), this.openMenuAt(e, t, n);
|
|
2027
2039
|
} });
|
|
2028
2040
|
}
|
|
2029
2041
|
openMenuAt(e, t, n) {
|
|
2030
2042
|
let r = this.view;
|
|
2031
|
-
if (!r.state.facet(Ce) || n?.closest(".cm-inplace-table-edit")) return;
|
|
2043
|
+
if (!r.state.facet(Ce) || r.state.readOnly || n?.closest(".cm-inplace-table-edit")) return;
|
|
2032
2044
|
let i = n?.closest(".cm-inplace-hr");
|
|
2033
2045
|
if (i) {
|
|
2034
2046
|
let n = r.posAtDOM(i);
|
|
@@ -2089,7 +2101,7 @@ function Yn(e) {
|
|
|
2089
2101
|
};
|
|
2090
2102
|
}
|
|
2091
2103
|
function Xn(e, t, n) {
|
|
2092
|
-
if (e.state.facet(ke) !== "bar" || e.state.field(Kn, !1)) return null;
|
|
2104
|
+
if (e.state.facet(ke) !== "bar" || e.state.readOnly || e.state.field(Kn, !1)) return null;
|
|
2093
2105
|
let r = Yn(e);
|
|
2094
2106
|
if (!r) return null;
|
|
2095
2107
|
let { box: i, inCell: a } = r;
|
|
@@ -2140,8 +2152,8 @@ var Zn = class {
|
|
|
2140
2152
|
e.dom.appendChild(this.bar), t.addEventListener("scroll", this.onScroll, !0), t.addEventListener("selectionchange", this.onSelectionChange);
|
|
2141
2153
|
}
|
|
2142
2154
|
update(e) {
|
|
2143
|
-
let t = e.startState.field(Kn, !1) !== e.state.field(Kn, !1);
|
|
2144
|
-
(e.selectionSet || e.docChanged || e.focusChanged || t) && this.schedule();
|
|
2155
|
+
let t = e.startState.field(Kn, !1) !== e.state.field(Kn, !1), n = e.startState.readOnly !== e.state.readOnly;
|
|
2156
|
+
(e.selectionSet || e.docChanged || e.focusChanged || t || n) && this.schedule();
|
|
2145
2157
|
}
|
|
2146
2158
|
schedule() {
|
|
2147
2159
|
this.view.requestMeasure({
|
|
@@ -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": {
|
|
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-
|
|
2725
|
+
//# sourceMappingURL=InPlaceView-Cq5YJ3-P.js.map
|