@nesso-how/plugin-example 1.0.0-beta.17 → 1.0.0-beta.22
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/index.js +44 -24
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -10112,7 +10112,26 @@ function Uu({ className: e, variant: t = "default", size: n = "default", ...r })
|
|
|
10112
10112
|
...r
|
|
10113
10113
|
});
|
|
10114
10114
|
}
|
|
10115
|
-
var Wu = zu.configure(Vu), Gu =
|
|
10115
|
+
var Wu = zu.configure(Vu), Gu = {
|
|
10116
|
+
"**": {
|
|
10117
|
+
node: "StrongEmphasis",
|
|
10118
|
+
mark: "EmphasisMark",
|
|
10119
|
+
decoration: z.mark({ class: "nesso-markdown-bold" })
|
|
10120
|
+
},
|
|
10121
|
+
"*": {
|
|
10122
|
+
node: "Emphasis",
|
|
10123
|
+
mark: "EmphasisMark",
|
|
10124
|
+
decoration: z.mark({ class: "nesso-markdown-italic" })
|
|
10125
|
+
},
|
|
10126
|
+
"`": {
|
|
10127
|
+
node: "InlineCode",
|
|
10128
|
+
mark: "CodeMark",
|
|
10129
|
+
decoration: z.mark({
|
|
10130
|
+
class: "nesso-markdown-code",
|
|
10131
|
+
attributes: { spellcheck: "false" }
|
|
10132
|
+
})
|
|
10133
|
+
}
|
|
10134
|
+
}, Ku = M.define({ combine: (e) => e.some(Boolean) }), qu = (e) => (e.facet(Ku) ? Wu : zu).parse(e.doc.toString()), Ju = class extends Jr {
|
|
10116
10135
|
label;
|
|
10117
10136
|
checked;
|
|
10118
10137
|
constructor(e, t = null) {
|
|
@@ -10137,7 +10156,7 @@ var Wu = zu.configure(Vu), Gu = M.define({ combine: (e) => e.some(Boolean) }), K
|
|
|
10137
10156
|
return !1;
|
|
10138
10157
|
}
|
|
10139
10158
|
};
|
|
10140
|
-
function
|
|
10159
|
+
function Yu(e) {
|
|
10141
10160
|
let t = e.getChild("ListMark"), n = e.getChild("Task") ? 1.4 : 0;
|
|
10142
10161
|
return e.parent?.name === "BulletList" ? {
|
|
10143
10162
|
ch: 0,
|
|
@@ -10147,50 +10166,51 @@ function Ju(e) {
|
|
|
10147
10166
|
em: .75 + n
|
|
10148
10167
|
};
|
|
10149
10168
|
}
|
|
10150
|
-
function
|
|
10169
|
+
function Xu(e, t, n) {
|
|
10151
10170
|
if (t.parent?.name !== "BulletList") {
|
|
10152
10171
|
let n = t.getChild("ListMark");
|
|
10153
10172
|
return `${e.sliceDoc(n.from, n.to)} `;
|
|
10154
10173
|
}
|
|
10155
10174
|
return n === null ? "• " : "";
|
|
10156
10175
|
}
|
|
10157
|
-
function
|
|
10176
|
+
function Zu(e) {
|
|
10158
10177
|
let t = {
|
|
10159
10178
|
ch: 0,
|
|
10160
10179
|
em: 0
|
|
10161
10180
|
};
|
|
10162
10181
|
for (let n = e; n; n = n.parent) {
|
|
10163
10182
|
if (n.name !== "ListItem") continue;
|
|
10164
|
-
let e =
|
|
10183
|
+
let e = Yu(n);
|
|
10165
10184
|
t.ch += e.ch, t.em += e.em;
|
|
10166
10185
|
}
|
|
10167
10186
|
return t;
|
|
10168
10187
|
}
|
|
10169
|
-
function
|
|
10170
|
-
let r = t.getChild("ListMark"), i = t.getChild("Task"), a = i?.getChild("TaskMarker"), o = a ? e.sliceDoc(a.from + 1, a.from + 2) !== " " : null, s = e.doc.lineAt(r.from), c = /^[\t ]*$/.test(e.sliceDoc(s.from, r.from)) ? s.from : r.from, l = a?.to ?? r.to, u = l + e.sliceDoc(l, s.to).match(/^[\t ]*/)[0].length, d =
|
|
10188
|
+
function Qu(e, t, n) {
|
|
10189
|
+
let r = t.getChild("ListMark"), i = t.getChild("Task"), a = i?.getChild("TaskMarker"), o = a ? e.sliceDoc(a.from + 1, a.from + 2) !== " " : null, s = e.doc.lineAt(r.from), c = /^[\t ]*$/.test(e.sliceDoc(s.from, r.from)) ? s.from : r.from, l = a?.to ?? r.to, u = l + e.sliceDoc(l, s.to).match(/^[\t ]*/)[0].length, d = Xu(e, t, o), f = Yu(t), p = Zu(t), m = [z.line({
|
|
10171
10190
|
class: "nesso-markdown-list-item",
|
|
10172
10191
|
attributes: { style: `--nesso-list-indent: calc(${f.ch}ch + ${f.em}em); --nesso-list-padding: calc(var(--nesso-list-inset) + ${p.ch}ch + ${p.em}em)` }
|
|
10173
|
-
}).range(s.from), (n ? z.mark({ class: "nesso-markdown-syntax nesso-markdown-list-marker" }) : z.replace({ widget: new
|
|
10192
|
+
}).range(s.from), (n ? z.mark({ class: "nesso-markdown-syntax nesso-markdown-list-marker" }) : z.replace({ widget: new Ju(d, o) })).range(c, u)];
|
|
10174
10193
|
return o && i && u < i.to && m.push(z.mark({ class: "nesso-markdown-task-done" }).range(u, i.to)), m;
|
|
10175
10194
|
}
|
|
10176
|
-
function
|
|
10195
|
+
function $u(e, t) {
|
|
10177
10196
|
let n = e.doc.toString(), r = [], i = (e, t, i) => {
|
|
10178
10197
|
if (e >= t || n.slice(e, t).includes("\n")) return;
|
|
10179
10198
|
let a = i ? z.mark({ class: "nesso-markdown-syntax" }) : z.replace({});
|
|
10180
10199
|
r.push(a.range(e, t));
|
|
10181
10200
|
};
|
|
10182
|
-
return
|
|
10201
|
+
return qu(e).iterate({ enter(a) {
|
|
10183
10202
|
if ([
|
|
10184
10203
|
"Image",
|
|
10185
|
-
"InlineCode",
|
|
10186
10204
|
"FencedCode",
|
|
10187
10205
|
"CodeBlock",
|
|
10188
10206
|
"HTMLBlock"
|
|
10189
10207
|
].includes(a.name)) return !1;
|
|
10190
10208
|
let o = t && e.selection.ranges.some((e) => e.from <= a.to && e.to >= a.from);
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
|
|
10209
|
+
a.name === "ListItem" && r.push(...Qu(e, a.node, o));
|
|
10210
|
+
let s = Object.values(Gu).find((e) => e.node === a.name);
|
|
10211
|
+
if (s) {
|
|
10212
|
+
let [e, t] = a.node.getChildren(s.mark);
|
|
10213
|
+
r.push(s.decoration.range(e.to, t.from)), i(e.from, e.to, o), i(t.from, t.to, o);
|
|
10194
10214
|
}
|
|
10195
10215
|
if (a.name === "Link") {
|
|
10196
10216
|
let e = a.node.getChild("URL");
|
|
@@ -10203,9 +10223,9 @@ function Qu(e, t) {
|
|
|
10203
10223
|
}
|
|
10204
10224
|
} }), z.set(r, !0);
|
|
10205
10225
|
}
|
|
10206
|
-
function
|
|
10207
|
-
if (e.readOnly || !e.facet(
|
|
10208
|
-
let n =
|
|
10226
|
+
function ed(e, t) {
|
|
10227
|
+
if (e.readOnly || !e.facet(Ku)) return null;
|
|
10228
|
+
let n = qu(e).resolveInner(t, 1).parent?.getChild("Task")?.getChild("TaskMarker");
|
|
10209
10229
|
if (!n) return null;
|
|
10210
10230
|
let r = n.from + 1;
|
|
10211
10231
|
return {
|
|
@@ -10218,16 +10238,16 @@ function $u(e, t) {
|
|
|
10218
10238
|
};
|
|
10219
10239
|
}
|
|
10220
10240
|
Bn.define(), va.define((e) => ({
|
|
10221
|
-
decorations:
|
|
10241
|
+
decorations: $u(e.state, e.hasFocus && !e.state.readOnly),
|
|
10222
10242
|
update(e) {
|
|
10223
|
-
(e.docChanged || e.selectionSet || e.focusChanged || e.startState.readOnly !== e.state.readOnly || e.startState.facet(
|
|
10243
|
+
(e.docChanged || e.selectionSet || e.focusChanged || e.startState.readOnly !== e.state.readOnly || e.startState.facet(Ku) !== e.state.facet(Ku)) && (this.decorations = $u(e.state, e.view.hasFocus && !e.state.readOnly));
|
|
10224
10244
|
}
|
|
10225
10245
|
}), { decorations: (e) => e.decorations }), K.domEventHandlers({
|
|
10226
10246
|
mousedown(e, t) {
|
|
10227
10247
|
let n = e.target.closest(".nesso-markdown-task");
|
|
10228
10248
|
if (!n) return !1;
|
|
10229
10249
|
e.preventDefault();
|
|
10230
|
-
let r =
|
|
10250
|
+
let r = ed(t.state, t.posAtDOM(n));
|
|
10231
10251
|
return r && t.dispatch(r), !0;
|
|
10232
10252
|
},
|
|
10233
10253
|
click(e) {
|
|
@@ -10235,7 +10255,7 @@ Bn.define(), va.define((e) => ({
|
|
|
10235
10255
|
}
|
|
10236
10256
|
});
|
|
10237
10257
|
// src/Quiz.tsx
|
|
10238
|
-
function
|
|
10258
|
+
function td({ document: e, storage: t, viewId: s }) {
|
|
10239
10259
|
let [c, l] = r(null), [u, d] = r(!1), f = `quiz:${s ?? "all"}`;
|
|
10240
10260
|
n(() => {
|
|
10241
10261
|
t.list().then((e) => {
|
|
@@ -10294,7 +10314,7 @@ function ed({ document: e, storage: t, viewId: s }) {
|
|
|
10294
10314
|
});
|
|
10295
10315
|
}
|
|
10296
10316
|
// src/index.ts
|
|
10297
|
-
var
|
|
10317
|
+
var nd = () => [{
|
|
10298
10318
|
id: "uppercase-labels",
|
|
10299
10319
|
label: { en: "Uppercase labels" },
|
|
10300
10320
|
run: async ({ document: e }) => {
|
|
@@ -10308,7 +10328,7 @@ var td = () => [{
|
|
|
10308
10328
|
}, {
|
|
10309
10329
|
id: "concept-quiz",
|
|
10310
10330
|
label: { en: "Concept Quiz" },
|
|
10311
|
-
ui:
|
|
10331
|
+
ui: td,
|
|
10312
10332
|
icon: "play"
|
|
10313
10333
|
}];
|
|
10314
|
-
export {
|
|
10334
|
+
export { nd as create };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nesso-how/plugin-example",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.22",
|
|
4
4
|
"description": "Official example showing how to build Nesso plugins with the SDK and plugin APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nesso-plugin"
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"prepack": "npm run build"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@nesso-how/ui": "1.0.0-beta.
|
|
31
|
+
"@nesso-how/ui": "1.0.0-beta.22",
|
|
32
32
|
"react": "^19.2.8",
|
|
33
33
|
"react-dom": "^19.2.8"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@nesso-how/plugin": "1.0.0-beta.
|
|
36
|
+
"@nesso-how/plugin": "1.0.0-beta.22",
|
|
37
37
|
"@types/react": "^19.2.18",
|
|
38
38
|
"@types/react-dom": "^19.2.7",
|
|
39
39
|
"typescript": "~7.0.2",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"nesso": {
|
|
57
|
-
"apiVersion":
|
|
57
|
+
"apiVersion": 5,
|
|
58
58
|
"kind": "actions",
|
|
59
59
|
"entry": "dist/index.js",
|
|
60
60
|
"writes": [
|