@aiquants/markdown-explorer 0.12.0 → 0.13.0
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/CHANGELOG.md +26 -0
- package/README.md +20 -12
- package/dist/EditSurface-DheIbHJi.js +705 -0
- package/dist/EditSurface-omuATGni.cjs +2 -0
- package/dist/{ExplorerSplit-DekOjAUZ.cjs → ExplorerSplit-DMizcKaY.cjs} +1 -1
- package/dist/{ExplorerSplit-MPHjw3nW.js → ExplorerSplit-DvcNMIjl.js} +109 -109
- package/dist/{MultiLayout-DtSW4rEQ.js → MultiLayout-C2R85L4x.js} +25 -25
- package/dist/{MultiLayout-HMzVDYWq.cjs → MultiLayout-Cq4y1I1g.cjs} +1 -1
- package/dist/{NativeScrollBar-CNQr7JY1.js → NativeScrollBar-CKfD2qpM.js} +1 -1
- package/dist/{NativeScrollBar-B0AkVF3E.cjs → NativeScrollBar-qvtXkNTx.cjs} +1 -1
- package/dist/{TreeLayout-_XQR-9tV.cjs → TreeLayout-8_V4L9s6.cjs} +1 -1
- package/dist/{TreeLayout-CJO9tOPq.js → TreeLayout-FCp9WPFO.js} +3 -3
- package/dist/core/contracts.d.cts +7 -1
- package/dist/core/contracts.d.ts +7 -1
- package/dist/core/labels.d.cts +14 -1
- package/dist/core/labels.d.ts +14 -1
- package/dist/{dataRoute-CH3yOKR0.cjs → dataRoute-BONacTPi.cjs} +1 -1
- package/dist/{dataRoute-Pm_0ue_4.js → dataRoute-CObbjNxG.js} +14 -12
- package/dist/index-CdydPdP7.js +3463 -0
- package/dist/index-afZWk187.cjs +13 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +21 -21
- package/dist/{location-BUNWJ4eB.cjs → location-D6RE3wAN.cjs} +1 -1
- package/dist/{location-DWd6SQhN.js → location-IRD9h42r.js} +1 -1
- package/dist/{merge-DDJaJmMU.js → merge-Bb7YRgn4.js} +1 -1
- package/dist/{merge-Bs7o3GyP.cjs → merge-Dm_uFthw.cjs} +1 -1
- package/dist/{sanitizePolicy-djLC3fRN.js → sanitizePolicy-DlrakwA4.js} +1 -1
- package/dist/{sanitizePolicy-BfUlXI5E.cjs → sanitizePolicy-DrIMuYCb.cjs} +1 -1
- package/dist/sanitizeWorker.cjs +1 -1
- package/dist/sanitizeWorker.js +1 -1
- package/dist/server/ports.d.cts +3 -0
- package/dist/server/ports.d.ts +3 -0
- package/dist/server.cjs +1 -1
- package/dist/server.js +93 -83
- package/dist/styles/markdown-explorer.css +1 -1
- package/docs/behavior/dom-hooks.md +6 -5
- package/docs/behavior/layout.md +12 -2
- package/package.json +1 -1
- package/dist/EditSurface-BTAhzvHi.js +0 -509
- package/dist/EditSurface-Dfj6Sxxb.cjs +0 -2
- package/dist/index-DpIVKG8Y.cjs +0 -13
- package/dist/index-o6OpR4ND.js +0 -3358
|
@@ -88,7 +88,7 @@ const v = Object.freeze([
|
|
|
88
88
|
deniesPath: (s) => s.split("/").some(r),
|
|
89
89
|
deniesName: r
|
|
90
90
|
};
|
|
91
|
-
}, C = y(v), z = Object.freeze({ deniesPath: () => !1, deniesName: () => !1 }), Ee = (e) => e === void 0 ? C : e === !1 ? z : y(e), ye = (e, t) => y(e).deniesPath(t),
|
|
91
|
+
}, C = y(v), z = Object.freeze({ deniesPath: () => !1, deniesName: () => !1 }), Ee = (e) => e === void 0 ? C : e === !1 ? z : y(e), ye = (e, t) => y(e).deniesPath(t), h = Object.freeze(["unauthorized", "forbidden", "not-found", "not-configured", "invalid", "too-large", "unsupported", "failed"]), U = Object.freeze(["file", "directory"]), X = Object.freeze(["video", "audio", "pdf"]), H = Object.freeze(["info", "warning", "danger"]), V = Object.freeze(["markdown", "text", "image", "media", "file", "failure"]), m = Object.freeze({ min: 1, max: 6 }), me = 1e4, u = (e) => typeof e == "string" && /^\/(?![/\\])[\x21-\x7E]*$/u.test(e), ge = Object.freeze(["http:", "https:", "mailto:"]), b = 1024, F = /^[a-z0-9-]{1,64}$/u, M = "https://relative.invalid/", g = 64, d = (e, t) => typeof t == "string" && e.includes(t), o = (e) => typeof e == "string" ? JSON.stringify(e.length > g ? `${e.slice(0, g)}…` : e) : typeof e, K = (e) => d(h, e), G = (e) => d(U, e), W = (e) => d(X, e), Re = (e) => d(H, e), Y = (e) => d(V, e), _ = (e) => typeof e == "string" && F.test(e), Ae = (e, t) => {
|
|
92
92
|
if (typeof e != "string") return !1;
|
|
93
93
|
try {
|
|
94
94
|
return t.includes(new URL(e, M).protocol);
|
|
@@ -111,11 +111,11 @@ const v = Object.freeze([
|
|
|
111
111
|
if (e === null || typeof e != "object") return !1;
|
|
112
112
|
const { status: t, entries: n, failure: r } = e;
|
|
113
113
|
return t === "ok" ? Array.isArray(n) && n.every(O) : t === "error" && p(r) === null;
|
|
114
|
-
},
|
|
114
|
+
}, he = (e) => {
|
|
115
115
|
if (e === null || typeof e != "object") return !1;
|
|
116
116
|
const { status: t, ancestors: n, failure: r } = e;
|
|
117
117
|
return t === "ok" ? n === null || x(n) : t === "error" && p(r) === null;
|
|
118
|
-
}, x = (e) => Array.isArray(e) && e.every((t) => typeof t == "string" && R(t)) && new Set(e).size === e.length,
|
|
118
|
+
}, x = (e) => Array.isArray(e) && e.every((t) => typeof t == "string" && R(t)) && new Set(e).size === e.length, be = (e) => {
|
|
119
119
|
if (e === null || typeof e != "object") return !1;
|
|
120
120
|
const { status: t, source: n, ancestors: r, failure: s } = e;
|
|
121
121
|
return t === "ok" ? n === null && r === null || typeof n == "string" && n !== "" && x(r) : t === "error" && p(s) === null;
|
|
@@ -156,7 +156,7 @@ const v = Object.freeze([
|
|
|
156
156
|
if (e === null) return null;
|
|
157
157
|
if (typeof e != "object") return "a markdown document's edit must be null or an object";
|
|
158
158
|
const { kind: t, href: n } = e;
|
|
159
|
-
return t === "inline" ? n === void 0 ? null : "an inline edit carries no href" : t !== "external" ? `unknown edit kind ${o(t)}` : ee(n) ? null : `an external edit needs an absolute https: href; got ${o(n)}`;
|
|
159
|
+
return t === "inline" ? n === void 0 ? null : "an inline edit carries no href" : t === "draft" ? n === void 0 ? null : "a draft edit carries no href" : t !== "external" ? `unknown edit kind ${o(t)}` : ee(n) ? null : `an external edit needs an absolute https: href; got ${o(n)}`;
|
|
160
160
|
}, ee = (e) => {
|
|
161
161
|
if (typeof e != "string") return !1;
|
|
162
162
|
try {
|
|
@@ -164,10 +164,10 @@ const v = Object.freeze([
|
|
|
164
164
|
} catch {
|
|
165
165
|
return !1;
|
|
166
166
|
}
|
|
167
|
-
}, f = (e) => typeof e == "string" && e.length > 0 && e.length <=
|
|
167
|
+
}, f = (e) => typeof e == "string" && e.length > 0 && e.length <= b, te = (e) => u(e.href) ? null : `a grant needs a root-relative href; got ${o(e.href)}`, ne = (e) => {
|
|
168
168
|
if (e === null || typeof e != "object") return "a revision must be an object";
|
|
169
169
|
const { id: t, modifiedAt: n, size: r, author: s, kept: i, current: a } = e;
|
|
170
|
-
return f(t) ? n !== null && (typeof n != "string" || Number.isNaN(Date.parse(n))) ? `a revision's modifiedAt must be a date-time string or null; got ${o(n)}` : typeof r != "number" || !Number.isSafeInteger(r) || r < 0 ? `a revision's size must be a non-negative integer; got ${o(r)}` : s !== null && typeof s != "string" ? `a revision's author must be a string or null; got ${o(s)}` : typeof i != "boolean" || typeof a != "boolean" ? "a revision needs kept and current booleans" : null : `a revision id must be a non-empty string of at most ${
|
|
170
|
+
return f(t) ? n !== null && (typeof n != "string" || Number.isNaN(Date.parse(n))) ? `a revision's modifiedAt must be a date-time string or null; got ${o(n)}` : typeof r != "number" || !Number.isSafeInteger(r) || r < 0 ? `a revision's size must be a non-negative integer; got ${o(r)}` : s !== null && typeof s != "string" ? `a revision's author must be a string or null; got ${o(s)}` : typeof i != "boolean" || typeof a != "boolean" ? "a revision needs kept and current booleans" : null : `a revision id must be a non-empty string of at most ${b} characters; got ${o(t)}`;
|
|
171
171
|
}, l = (e, t) => {
|
|
172
172
|
if (e === null || typeof e != "object") return "an answer must be an object";
|
|
173
173
|
const n = e, { kind: r } = n;
|
|
@@ -178,6 +178,8 @@ const v = Object.freeze([
|
|
|
178
178
|
return te(n);
|
|
179
179
|
case "edit":
|
|
180
180
|
return typeof n.text != "string" || typeof n.history != "boolean" ? "an edit source needs text and history" : f(n.version) ? null : `an edit source needs a version; got ${o(n.version)}`;
|
|
181
|
+
case "draft":
|
|
182
|
+
return typeof n.text == "string" ? null : "a draft source needs text";
|
|
181
183
|
case "saved":
|
|
182
184
|
return f(n.version) ? null : `a saved answer needs a version; got ${o(n.version)}`;
|
|
183
185
|
case "conflict":
|
|
@@ -204,7 +206,7 @@ const v = Object.freeze([
|
|
|
204
206
|
default:
|
|
205
207
|
return `unexpected answer kind ${o(r)}`;
|
|
206
208
|
}
|
|
207
|
-
}, re = Object.freeze(["edit", "grant"]), se = Object.freeze(["saved", "conflict", "grant"]), S = Object.freeze(["preview"]), oe = Object.freeze(["revisions"]), ie = Object.freeze(["revision"]), xe = (e) => l(e, re) === null, Te = (e) => l(e, se) === null, Se = (e) => l(e, S) === null, Ne = (e) => l(e, oe) === null, ve = (e) => l(e, ie) === null, we = (e) => e !== null && typeof e == "object" && e.kind === "unavailable" ? null : l(e, S), Pe = (e, t) => ({ kind: "failure", failure: ae(e, t) }), ae = (e, t) => _(t) ? { reason: e, code: t } : { reason: e }, ce = Object.freeze(["tree", "children", "ancestors", "reveal", "document", "text", "edit", "save", "preview", "revisions", "revision", "refresh", "asset", "link-card"]), E = Object.freeze({ source: "source", path: "path", version: "v", base: "base", revision: "revision", display: "as" }), le = "asset", ue = "link-card", Le = (e, t, n) => {
|
|
209
|
+
}, re = Object.freeze(["edit", "draft", "grant"]), se = Object.freeze(["saved", "conflict", "grant"]), S = Object.freeze(["preview"]), oe = Object.freeze(["revisions"]), ie = Object.freeze(["revision"]), xe = (e) => l(e, re) === null, Te = (e) => l(e, se) === null, Se = (e) => l(e, S) === null, Ne = (e) => l(e, oe) === null, ve = (e) => l(e, ie) === null, we = (e) => e !== null && typeof e == "object" && e.kind === "unavailable" ? null : l(e, S), Pe = (e, t) => ({ kind: "failure", failure: ae(e, t) }), ae = (e, t) => _(t) ? { reason: e, code: t } : { reason: e }, ce = Object.freeze(["tree", "children", "ancestors", "reveal", "document", "text", "edit", "save", "preview", "revisions", "revision", "refresh", "asset", "link-card"]), E = Object.freeze({ source: "source", path: "path", version: "v", base: "base", revision: "revision", display: "as" }), le = "asset", ue = "link-card", Le = (e, t, n) => {
|
|
208
210
|
const r = `${e}/${le}?${E.path}=${encodeURIComponent(t)}`;
|
|
209
211
|
return n === null ? r : `${r}&${E.version}=${encodeURIComponent(n)}`;
|
|
210
212
|
}, N = "text", De = (e) => {
|
|
@@ -223,7 +225,7 @@ const v = Object.freeze([
|
|
|
223
225
|
unsupported: 500,
|
|
224
226
|
failed: 500
|
|
225
227
|
}), He = (e) => {
|
|
226
|
-
const [t, ...n] =
|
|
228
|
+
const [t, ...n] = h.filter((r) => fe[r] === e);
|
|
227
229
|
return t !== void 0 && n.length === 0 ? t : "failed";
|
|
228
230
|
};
|
|
229
231
|
export {
|
|
@@ -236,8 +238,8 @@ export {
|
|
|
236
238
|
De as G,
|
|
237
239
|
He as H,
|
|
238
240
|
Oe as I,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
+
be as J,
|
|
242
|
+
he as K,
|
|
241
243
|
q as L,
|
|
242
244
|
de as M,
|
|
243
245
|
p as N,
|
|
@@ -248,8 +250,8 @@ export {
|
|
|
248
250
|
Te as S,
|
|
249
251
|
xe as T,
|
|
250
252
|
Q as U,
|
|
251
|
-
|
|
252
|
-
|
|
253
|
+
b as V,
|
|
254
|
+
h as W,
|
|
253
255
|
je as a,
|
|
254
256
|
K as b,
|
|
255
257
|
_ as c,
|