Working on API surface.
This commit is contained in:
50
packages/js/core/dist/document.js
vendored
50
packages/js/core/dist/document.js
vendored
@@ -1,14 +1,42 @@
|
||||
import { parseLine as a, LineData as o } from "./parser.js";
|
||||
function f(u, i = " ") {
|
||||
let e = null, n = o(), t = !1;
|
||||
async function r() {
|
||||
return e = await u(), e === null ? t = !0 : a(e, n, i), { line: e, lineData: n, ended: t, next: r, current: l };
|
||||
}
|
||||
function l() {
|
||||
return { line: e, lineData: n, ended: t, next: r, current: l };
|
||||
}
|
||||
return { next: r, current: l };
|
||||
import { parseLine as f, createLineData as s } from "./parser.js";
|
||||
function d(t, l = " ") {
|
||||
let n = s(null, l);
|
||||
const i = {
|
||||
ended: !1,
|
||||
clone() {
|
||||
return d(t.clone(), l);
|
||||
},
|
||||
async next() {
|
||||
if (n.line = await t.next(), n.line === null)
|
||||
return !0;
|
||||
f(n);
|
||||
},
|
||||
current() {
|
||||
return i;
|
||||
},
|
||||
line() {
|
||||
var e;
|
||||
return (e = n.line) == null ? void 0 : e.slice(n.offsetHead);
|
||||
},
|
||||
head() {
|
||||
var e;
|
||||
return (e = n.line) == null ? void 0 : e.slice(n.offsetHead, n.offsetTail);
|
||||
},
|
||||
tail() {
|
||||
var e;
|
||||
return (e = n.line) == null ? void 0 : e.slice(n.offsetTail);
|
||||
},
|
||||
async content(e = -1, r = []) {
|
||||
var u;
|
||||
return e === -1 && (e = n.level + 1), await i.next() || n.level < e ? r.join(`
|
||||
`) : (r.push(((u = n.line) == null ? void 0 : u.slice(e)) || ""), i.content(e, r));
|
||||
},
|
||||
async seek(e, r = -1) {
|
||||
return r === -1 && (r = n.level), await i.next() ? !1 : i.head() === e ? i : n.level < r ? !1 : i.seek(e, r);
|
||||
}
|
||||
};
|
||||
return i;
|
||||
}
|
||||
export {
|
||||
f as document
|
||||
d as useDocument
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user