@inkandswitch/patchwork-pkg-base 0.0.130 → 0.0.131
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/module-settings-url
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
automerge:
|
|
1
|
+
automerge:2zmD6DquvotPC1hPc9zEmWbJJvY1
|
package/package.json
CHANGED
|
@@ -2151,6 +2151,35 @@ import {
|
|
|
2151
2151
|
ViewPlugin as ViewPlugin2,
|
|
2152
2152
|
WidgetType
|
|
2153
2153
|
} from "@codemirror/view";
|
|
2154
|
+
var SVG = "http://www.w3.org/2000/svg";
|
|
2155
|
+
function tick(animate) {
|
|
2156
|
+
const svg = document.createElementNS(SVG, "svg");
|
|
2157
|
+
svg.setAttribute("viewBox", "0 0 24 24");
|
|
2158
|
+
svg.setAttribute("class", "cm-task-tick");
|
|
2159
|
+
svg.setAttribute("aria-hidden", "true");
|
|
2160
|
+
const path = document.createElementNS(SVG, "path");
|
|
2161
|
+
path.setAttribute("d", "M19 7L10 16.5l-4.5-4.5");
|
|
2162
|
+
svg.append(path);
|
|
2163
|
+
if (animate) {
|
|
2164
|
+
const mask = document.createElementNS(SVG, "rect");
|
|
2165
|
+
mask.setAttribute("class", "cm-task-tick-mask");
|
|
2166
|
+
for (const [k, v] of [["x", "0"], ["y", "0"], ["width", "24"], ["height", "24"]])
|
|
2167
|
+
mask.setAttribute(k, v);
|
|
2168
|
+
const slide = document.createElementNS(SVG, "animate");
|
|
2169
|
+
for (const [k, v] of [
|
|
2170
|
+
["attributeName", "x"],
|
|
2171
|
+
["values", "0;24;24"],
|
|
2172
|
+
["dur", "0.24s"],
|
|
2173
|
+
["begin", "0.1s"],
|
|
2174
|
+
["fill", "freeze"]
|
|
2175
|
+
])
|
|
2176
|
+
slide.setAttribute(k, v);
|
|
2177
|
+
mask.append(slide);
|
|
2178
|
+
svg.append(mask);
|
|
2179
|
+
}
|
|
2180
|
+
return svg;
|
|
2181
|
+
}
|
|
2182
|
+
var justTicked = /* @__PURE__ */ new WeakMap();
|
|
2154
2183
|
var TaskWidget = class extends WidgetType {
|
|
2155
2184
|
constructor(checked) {
|
|
2156
2185
|
super();
|
|
@@ -2160,16 +2189,28 @@ var TaskWidget = class extends WidgetType {
|
|
|
2160
2189
|
return other.checked === this.checked;
|
|
2161
2190
|
}
|
|
2162
2191
|
toDOM(view) {
|
|
2163
|
-
const box = document.createElement("
|
|
2164
|
-
box.
|
|
2165
|
-
box.
|
|
2166
|
-
box.checked
|
|
2167
|
-
box.disabled = !view.state.facet(EditorView2.editable);
|
|
2192
|
+
const box = document.createElement("span");
|
|
2193
|
+
box.className = "cm-task" + (this.checked ? " cm-task-checked" : "");
|
|
2194
|
+
box.setAttribute("role", "checkbox");
|
|
2195
|
+
box.setAttribute("aria-checked", String(this.checked));
|
|
2168
2196
|
box.setAttribute("aria-label", this.checked ? "Done" : "To do");
|
|
2197
|
+
const disabled = !view.state.facet(EditorView2.editable);
|
|
2198
|
+
if (disabled) box.setAttribute("aria-disabled", "true");
|
|
2199
|
+
if (this.checked) {
|
|
2200
|
+
const ticked = justTicked.get(view);
|
|
2201
|
+
box.append(tick(ticked !== void 0 && performance.now() - ticked < 400));
|
|
2202
|
+
}
|
|
2169
2203
|
box.addEventListener("mousedown", (event) => {
|
|
2170
2204
|
if (event.button !== 0) return;
|
|
2171
2205
|
event.preventDefault();
|
|
2172
|
-
if (
|
|
2206
|
+
if (disabled) return;
|
|
2207
|
+
box.classList.add("cm-task-pressed");
|
|
2208
|
+
const up = () => {
|
|
2209
|
+
box.classList.remove("cm-task-pressed");
|
|
2210
|
+
window.removeEventListener("mouseup", up, true);
|
|
2211
|
+
};
|
|
2212
|
+
window.addEventListener("mouseup", up, true);
|
|
2213
|
+
if (!this.checked) justTicked.set(view, performance.now());
|
|
2173
2214
|
toggle(view, view.posAtDOM(box));
|
|
2174
2215
|
});
|
|
2175
2216
|
return box;
|
|
@@ -2187,6 +2228,51 @@ function toggle(view, from) {
|
|
|
2187
2228
|
userEvent: "input.toggle-task"
|
|
2188
2229
|
});
|
|
2189
2230
|
}
|
|
2231
|
+
var motion = (ms) => `max(1ms, calc(${ms}ms * var(--studio-motion-scale, 1) * var(--studio-motion-preference, 1)))`;
|
|
2232
|
+
var ink = (fade) => `color-mix(in oklab, var(--text-editor-line, currentColor), transparent ${fade}%)`;
|
|
2233
|
+
var taskTheme = EditorView2.baseTheme({
|
|
2234
|
+
".cm-task": {
|
|
2235
|
+
"--cm-task-size": "calc(1.05rem * var(--markdown-zoom, 1))",
|
|
2236
|
+
boxSizing: "border-box",
|
|
2237
|
+
display: "inline-flex",
|
|
2238
|
+
alignItems: "center",
|
|
2239
|
+
justifyContent: "center",
|
|
2240
|
+
flex: "none",
|
|
2241
|
+
width: "var(--cm-task-size)",
|
|
2242
|
+
height: "var(--cm-task-size)",
|
|
2243
|
+
borderRadius: "calc(var(--cm-task-size) / 3.5)",
|
|
2244
|
+
border: `1.5px solid ${ink(45)}`,
|
|
2245
|
+
color: ink(45),
|
|
2246
|
+
verticalAlign: "-0.15em",
|
|
2247
|
+
cursor: "var(--studio-cursor-pointer, pointer)",
|
|
2248
|
+
userSelect: "none",
|
|
2249
|
+
transition: `border-color ${motion(140)} linear, color ${motion(140)} linear, scale ${motion(100)} ease`
|
|
2250
|
+
},
|
|
2251
|
+
".cm-task-pressed": {
|
|
2252
|
+
scale: "1.1"
|
|
2253
|
+
},
|
|
2254
|
+
// done: it steps back with its text (see .cm-task-done)
|
|
2255
|
+
".cm-task-checked": {
|
|
2256
|
+
borderColor: ink(80),
|
|
2257
|
+
color: ink(55)
|
|
2258
|
+
},
|
|
2259
|
+
".cm-task[aria-disabled]": {
|
|
2260
|
+
cursor: "default"
|
|
2261
|
+
},
|
|
2262
|
+
".cm-task-tick": {
|
|
2263
|
+
width: "100%",
|
|
2264
|
+
height: "100%",
|
|
2265
|
+
fill: "none",
|
|
2266
|
+
stroke: "currentColor",
|
|
2267
|
+
strokeWidth: "2.5",
|
|
2268
|
+
strokeLinecap: "round",
|
|
2269
|
+
strokeLinejoin: "round"
|
|
2270
|
+
},
|
|
2271
|
+
".cm-task-tick-mask": {
|
|
2272
|
+
fill: "var(--text-editor-fill, white)",
|
|
2273
|
+
stroke: "none"
|
|
2274
|
+
}
|
|
2275
|
+
});
|
|
2190
2276
|
var doneMark = Decoration2.mark({ class: "cm-task-done" });
|
|
2191
2277
|
function build(view) {
|
|
2192
2278
|
const builder = new RangeSetBuilder2();
|
|
@@ -2212,7 +2298,7 @@ function build(view) {
|
|
|
2212
2298
|
}
|
|
2213
2299
|
return builder.finish();
|
|
2214
2300
|
}
|
|
2215
|
-
var
|
|
2301
|
+
var taskPlugin = ViewPlugin2.fromClass(
|
|
2216
2302
|
class {
|
|
2217
2303
|
decorations;
|
|
2218
2304
|
constructor(view) {
|
|
@@ -2226,6 +2312,7 @@ var taskCheckboxes = ViewPlugin2.fromClass(
|
|
|
2226
2312
|
},
|
|
2227
2313
|
{ decorations: (v) => v.decorations }
|
|
2228
2314
|
);
|
|
2315
|
+
var taskCheckboxes = [taskPlugin, taskTheme];
|
|
2229
2316
|
|
|
2230
2317
|
// src/extensions/margin.ts
|
|
2231
2318
|
import { syntaxTree as syntaxTree2 } from "@codemirror/language";
|
|
@@ -2349,6 +2436,7 @@ function alpha(n) {
|
|
|
2349
2436
|
return out;
|
|
2350
2437
|
}
|
|
2351
2438
|
var codeLine = Decoration3.line({ class: "cm-md-code" });
|
|
2439
|
+
var inlineCode = Decoration3.mark({ class: "cm-md-inline-code" });
|
|
2352
2440
|
var calloutMarker = Decoration3.mark({ class: "cm-md-callout-marker" });
|
|
2353
2441
|
function caretLines(state) {
|
|
2354
2442
|
const lines = /* @__PURE__ */ new Set();
|
|
@@ -2491,8 +2579,18 @@ function build2(view) {
|
|
|
2491
2579
|
if (name === "FencedCode" || name === "CodeBlock") {
|
|
2492
2580
|
const first = doc2.lineAt(node.from).number;
|
|
2493
2581
|
const last = doc2.lineAt(node.to).number;
|
|
2494
|
-
for (let n = first; n <= last; n++)
|
|
2495
|
-
|
|
2582
|
+
for (let n = first; n <= last; n++) {
|
|
2583
|
+
const ends = (n === first ? " cm-md-code-first" : "") + (n === last ? " cm-md-code-last" : "");
|
|
2584
|
+
decos.push(
|
|
2585
|
+
(ends ? Decoration3.line({ class: "cm-md-code" + ends }) : codeLine).range(
|
|
2586
|
+
doc2.line(n).from
|
|
2587
|
+
)
|
|
2588
|
+
);
|
|
2589
|
+
}
|
|
2590
|
+
return false;
|
|
2591
|
+
}
|
|
2592
|
+
if (name === "InlineCode") {
|
|
2593
|
+
decos.push(inlineCode.range(node.from, node.to));
|
|
2496
2594
|
return false;
|
|
2497
2595
|
}
|
|
2498
2596
|
if (name === "Blockquote") {
|
|
@@ -2630,8 +2728,29 @@ var marginTheme = EditorView3.baseTheme({
|
|
|
2630
2728
|
position: "relative",
|
|
2631
2729
|
paddingLeft: "calc(6px + var(--markdown-quote-indent))"
|
|
2632
2730
|
},
|
|
2731
|
+
// code sits on a faint step up the editor's fill ramp: inline, a pill;
|
|
2732
|
+
// a block, a rounded panel with a little room inside
|
|
2633
2733
|
".cm-md-code": {
|
|
2634
|
-
fontFamily: "var(--text-editor-family-code)"
|
|
2734
|
+
fontFamily: "var(--text-editor-family-code)",
|
|
2735
|
+
background: "var(--text-editor-fill-offset-10, rgb(0 0 0 / 0.04))",
|
|
2736
|
+
paddingInline: `calc(6px + ${zoomed("0.75rem")})`
|
|
2737
|
+
},
|
|
2738
|
+
".cm-md-code-first": {
|
|
2739
|
+
paddingTop: zoomed("0.5rem"),
|
|
2740
|
+
borderTopLeftRadius: "6px",
|
|
2741
|
+
borderTopRightRadius: "6px"
|
|
2742
|
+
},
|
|
2743
|
+
".cm-md-code-last": {
|
|
2744
|
+
paddingBottom: zoomed("0.5rem"),
|
|
2745
|
+
borderBottomLeftRadius: "6px",
|
|
2746
|
+
borderBottomRightRadius: "6px"
|
|
2747
|
+
},
|
|
2748
|
+
".cm-md-inline-code": {
|
|
2749
|
+
background: "var(--text-editor-fill-offset-10, rgb(0 0 0 / 0.04))",
|
|
2750
|
+
borderRadius: "4px",
|
|
2751
|
+
padding: "0.1em 0.3em",
|
|
2752
|
+
boxDecorationBreak: "clone",
|
|
2753
|
+
WebkitBoxDecorationBreak: "clone"
|
|
2635
2754
|
},
|
|
2636
2755
|
// GitHub-style callouts. Colours from theming's --studio-callout-* (the
|
|
2637
2756
|
// accent: bar) and --text-editor-callout-*-text/-fill (title ink, box
|
|
@@ -3479,14 +3598,6 @@ var markdownStyles = (style) => ({
|
|
|
3479
3598
|
".cm-content li": {
|
|
3480
3599
|
marginBottom: 0
|
|
3481
3600
|
},
|
|
3482
|
-
".cm-task": {
|
|
3483
|
-
margin: "0 0.1em",
|
|
3484
|
-
verticalAlign: "-0.1em",
|
|
3485
|
-
cursor: "pointer"
|
|
3486
|
-
},
|
|
3487
|
-
".cm-task:disabled": {
|
|
3488
|
-
cursor: "default"
|
|
3489
|
-
},
|
|
3490
3601
|
".cm-task-done": {
|
|
3491
3602
|
opacity: 0.6
|
|
3492
3603
|
},
|
|
@@ -3527,21 +3638,37 @@ var markdownStyles = (style) => ({
|
|
|
3527
3638
|
});
|
|
3528
3639
|
var baseHeadingStyles = {
|
|
3529
3640
|
fontFamily: "var(--studio-heading-family, var(--text-editor-family-sans))",
|
|
3530
|
-
fontWeight: "var(--studio-heading-weight, 400)",
|
|
3531
3641
|
textDecoration: "none"
|
|
3532
3642
|
};
|
|
3643
|
+
var H1_WEIGHT = "var(--studio-heading-weight-1, 800)";
|
|
3644
|
+
var HEADING_WEIGHT = "var(--studio-heading-weight, 650)";
|
|
3533
3645
|
var headingSizes = {
|
|
3534
|
-
1: { fontSize: `var(--studio-heading-size-1, ${zoomed2("1.5rem")})`, lineHeight: zoomed2("2rem") },
|
|
3535
|
-
2: { fontSize: `var(--studio-heading-size-2, ${zoomed2("1.5rem")})`, lineHeight: zoomed2("2rem") },
|
|
3536
|
-
3: { fontSize: `var(--studio-heading-size-3, ${zoomed2("1.25rem")})`, lineHeight: zoomed2("1.75rem") },
|
|
3537
|
-
4: { fontSize: `var(--studio-heading-size-4, ${zoomed2("1.1rem")})
|
|
3646
|
+
1: { fontSize: `var(--studio-heading-size-1, ${zoomed2("1.5rem")})`, lineHeight: zoomed2("2rem"), fontWeight: H1_WEIGHT },
|
|
3647
|
+
2: { fontSize: `var(--studio-heading-size-2, ${zoomed2("1.5rem")})`, lineHeight: zoomed2("2rem"), fontWeight: HEADING_WEIGHT },
|
|
3648
|
+
3: { fontSize: `var(--studio-heading-size-3, ${zoomed2("1.25rem")})`, lineHeight: zoomed2("1.75rem"), fontWeight: HEADING_WEIGHT },
|
|
3649
|
+
4: { fontSize: `var(--studio-heading-size-4, ${zoomed2("1.1rem")})`, fontWeight: HEADING_WEIGHT },
|
|
3650
|
+
5: { fontWeight: HEADING_WEIGHT },
|
|
3651
|
+
6: { fontWeight: HEADING_WEIGHT }
|
|
3652
|
+
};
|
|
3653
|
+
var headingLines = {
|
|
3654
|
+
...Object.fromEntries(
|
|
3655
|
+
Object.entries(headingSizes).map(([level, size]) => [
|
|
3656
|
+
`.cm-md-h${level}`,
|
|
3657
|
+
{
|
|
3658
|
+
fontFamily: baseHeadingStyles.fontFamily,
|
|
3659
|
+
...size,
|
|
3660
|
+
// the patchwork theme's highlighter weights headings by this; match
|
|
3661
|
+
"--syntax-weight-heading": size.fontWeight
|
|
3662
|
+
}
|
|
3663
|
+
])
|
|
3664
|
+
),
|
|
3665
|
+
// headings are set off by size, not colour: the theme's heading colour
|
|
3666
|
+
// (--syntax-heading, which the patchwork theme's highlighter reads) is the
|
|
3667
|
+
// text colour here, whatever the theme picks for code.
|
|
3668
|
+
".cm-md-h1, .cm-md-h2, .cm-md-h3, .cm-md-h4, .cm-md-h5, .cm-md-h6": {
|
|
3669
|
+
"--syntax-heading": "var(--text-editor-line)"
|
|
3670
|
+
}
|
|
3538
3671
|
};
|
|
3539
|
-
var headingLines = Object.fromEntries(
|
|
3540
|
-
Object.entries(headingSizes).map(([level, size]) => [
|
|
3541
|
-
`.cm-md-h${level}`,
|
|
3542
|
-
{ fontFamily: baseHeadingStyles.fontFamily, fontWeight: baseHeadingStyles.fontWeight, ...size }
|
|
3543
|
-
])
|
|
3544
|
-
);
|
|
3545
3672
|
var baseCodeStyles = {
|
|
3546
3673
|
fontFamily: "var(--text-editor-family-code)",
|
|
3547
3674
|
fontSize: "1em"
|
|
@@ -3585,6 +3712,11 @@ var markdownSyntaxHighlighting = (style) => HighlightStyle.define([
|
|
|
3585
3712
|
marginBottom: zoomed2("1rem"),
|
|
3586
3713
|
marginTop: zoomed2("2rem")
|
|
3587
3714
|
},
|
|
3715
|
+
{
|
|
3716
|
+
tag: [tags.heading5, tags.heading6],
|
|
3717
|
+
...baseHeadingStyles,
|
|
3718
|
+
...headingSizes[5]
|
|
3719
|
+
},
|
|
3588
3720
|
{
|
|
3589
3721
|
tag: tags.processingInstruction,
|
|
3590
3722
|
color: "var(--text-editor-line-offset-40)"
|