@anoki/fse-ui
Version:
FSE UI components library
361 lines (360 loc) • 10.5 kB
JavaScript
import { __exports as r } from "./index.es765.js";
import { __require as S } from "./index.es681.js";
var A;
function W() {
if (A) return r;
A = 1;
var l = r && r.__extends || /* @__PURE__ */ (function() {
var e = function(t, n) {
return e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(i, o) {
i.__proto__ = o;
} || function(i, o) {
for (var u in o) Object.prototype.hasOwnProperty.call(o, u) && (i[u] = o[u]);
}, e(t, n);
};
return function(t, n) {
if (typeof n != "function" && n !== null)
throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
e(t, n);
function i() {
this.constructor = t;
}
t.prototype = n === null ? Object.create(n) : (i.prototype = n.prototype, new i());
};
})(), c = r && r.__assign || function() {
return c = Object.assign || function(e) {
for (var t, n = 1, i = arguments.length; n < i; n++) {
t = arguments[n];
for (var o in t) Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
}
return e;
}, c.apply(this, arguments);
};
Object.defineProperty(r, "__esModule", { value: !0 }), r.cloneNode = r.hasChildren = r.isDocument = r.isDirective = r.isComment = r.isText = r.isCDATA = r.isTag = r.Element = r.Document = r.CDATA = r.NodeWithChildren = r.ProcessingInstruction = r.Comment = r.Text = r.DataNode = r.Node = void 0;
var a = /* @__PURE__ */ S(), m = (
/** @class */
(function() {
function e() {
this.parent = null, this.prev = null, this.next = null, this.startIndex = null, this.endIndex = null;
}
return Object.defineProperty(e.prototype, "parentNode", {
// Read-write aliases for properties
/**
* Same as {@link parent}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get: function() {
return this.parent;
},
set: function(t) {
this.parent = t;
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(e.prototype, "previousSibling", {
/**
* Same as {@link prev}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get: function() {
return this.prev;
},
set: function(t) {
this.prev = t;
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(e.prototype, "nextSibling", {
/**
* Same as {@link next}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get: function() {
return this.next;
},
set: function(t) {
this.next = t;
},
enumerable: !1,
configurable: !0
}), e.prototype.cloneNode = function(t) {
return t === void 0 && (t = !1), y(this, t);
}, e;
})()
);
r.Node = m;
var f = (
/** @class */
(function(e) {
l(t, e);
function t(n) {
var i = e.call(this) || this;
return i.data = n, i;
}
return Object.defineProperty(t.prototype, "nodeValue", {
/**
* Same as {@link data}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get: function() {
return this.data;
},
set: function(n) {
this.data = n;
},
enumerable: !1,
configurable: !0
}), t;
})(m)
);
r.DataNode = f;
var g = (
/** @class */
(function(e) {
l(t, e);
function t() {
var n = e !== null && e.apply(this, arguments) || this;
return n.type = a.ElementType.Text, n;
}
return Object.defineProperty(t.prototype, "nodeType", {
get: function() {
return 3;
},
enumerable: !1,
configurable: !0
}), t;
})(f)
);
r.Text = g;
var v = (
/** @class */
(function(e) {
l(t, e);
function t() {
var n = e !== null && e.apply(this, arguments) || this;
return n.type = a.ElementType.Comment, n;
}
return Object.defineProperty(t.prototype, "nodeType", {
get: function() {
return 8;
},
enumerable: !1,
configurable: !0
}), t;
})(f)
);
r.Comment = v;
var x = (
/** @class */
(function(e) {
l(t, e);
function t(n, i) {
var o = e.call(this, i) || this;
return o.name = n, o.type = a.ElementType.Directive, o;
}
return Object.defineProperty(t.prototype, "nodeType", {
get: function() {
return 1;
},
enumerable: !1,
configurable: !0
}), t;
})(f)
);
r.ProcessingInstruction = x;
var p = (
/** @class */
(function(e) {
l(t, e);
function t(n) {
var i = e.call(this) || this;
return i.children = n, i;
}
return Object.defineProperty(t.prototype, "firstChild", {
// Aliases
/** First child of the node. */
get: function() {
var n;
return (n = this.children[0]) !== null && n !== void 0 ? n : null;
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(t.prototype, "lastChild", {
/** Last child of the node. */
get: function() {
return this.children.length > 0 ? this.children[this.children.length - 1] : null;
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(t.prototype, "childNodes", {
/**
* Same as {@link children}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get: function() {
return this.children;
},
set: function(n) {
this.children = n;
},
enumerable: !1,
configurable: !0
}), t;
})(m)
);
r.NodeWithChildren = p;
var T = (
/** @class */
(function(e) {
l(t, e);
function t() {
var n = e !== null && e.apply(this, arguments) || this;
return n.type = a.ElementType.CDATA, n;
}
return Object.defineProperty(t.prototype, "nodeType", {
get: function() {
return 4;
},
enumerable: !1,
configurable: !0
}), t;
})(p)
);
r.CDATA = T;
var C = (
/** @class */
(function(e) {
l(t, e);
function t() {
var n = e !== null && e.apply(this, arguments) || this;
return n.type = a.ElementType.Root, n;
}
return Object.defineProperty(t.prototype, "nodeType", {
get: function() {
return 9;
},
enumerable: !1,
configurable: !0
}), t;
})(p)
);
r.Document = C;
var P = (
/** @class */
(function(e) {
l(t, e);
function t(n, i, o, u) {
o === void 0 && (o = []), u === void 0 && (u = n === "script" ? a.ElementType.Script : n === "style" ? a.ElementType.Style : a.ElementType.Tag);
var s = e.call(this, o) || this;
return s.name = n, s.attribs = i, s.type = u, s;
}
return Object.defineProperty(t.prototype, "nodeType", {
get: function() {
return 1;
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(t.prototype, "tagName", {
// DOM Level 1 aliases
/**
* Same as {@link name}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get: function() {
return this.name;
},
set: function(n) {
this.name = n;
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(t.prototype, "attributes", {
get: function() {
var n = this;
return Object.keys(this.attribs).map(function(i) {
var o, u;
return {
name: i,
value: n.attribs[i],
namespace: (o = n["x-attribsNamespace"]) === null || o === void 0 ? void 0 : o[i],
prefix: (u = n["x-attribsPrefix"]) === null || u === void 0 ? void 0 : u[i]
};
});
},
enumerable: !1,
configurable: !0
}), t;
})(p)
);
r.Element = P;
function O(e) {
return (0, a.isTag)(e);
}
r.isTag = O;
function N(e) {
return e.type === a.ElementType.CDATA;
}
r.isCDATA = N;
function D(e) {
return e.type === a.ElementType.Text;
}
r.isText = D;
function j(e) {
return e.type === a.ElementType.Comment;
}
r.isComment = j;
function E(e) {
return e.type === a.ElementType.Directive;
}
r.isDirective = E;
function _(e) {
return e.type === a.ElementType.Root;
}
r.isDocument = _;
function w(e) {
return Object.prototype.hasOwnProperty.call(e, "children");
}
r.hasChildren = w;
function y(e, t) {
t === void 0 && (t = !1);
var n;
if (D(e))
n = new g(e.data);
else if (j(e))
n = new v(e.data);
else if (O(e)) {
var i = t ? d(e.children) : [], o = new P(e.name, c({}, e.attribs), i);
i.forEach(function(I) {
return I.parent = o;
}), e.namespace != null && (o.namespace = e.namespace), e["x-attribsNamespace"] && (o["x-attribsNamespace"] = c({}, e["x-attribsNamespace"])), e["x-attribsPrefix"] && (o["x-attribsPrefix"] = c({}, e["x-attribsPrefix"])), n = o;
} else if (N(e)) {
var i = t ? d(e.children) : [], u = new T(i);
i.forEach(function(b) {
return b.parent = u;
}), n = u;
} else if (_(e)) {
var i = t ? d(e.children) : [], s = new C(i);
i.forEach(function(b) {
return b.parent = s;
}), e["x-mode"] && (s["x-mode"] = e["x-mode"]), n = s;
} else if (E(e)) {
var h = new x(e.name, e.data);
e["x-name"] != null && (h["x-name"] = e["x-name"], h["x-publicId"] = e["x-publicId"], h["x-systemId"] = e["x-systemId"]), n = h;
} else
throw new Error("Not implemented yet: ".concat(e.type));
return n.startIndex = e.startIndex, n.endIndex = e.endIndex, e.sourceCodeLocation != null && (n.sourceCodeLocation = e.sourceCodeLocation), n;
}
r.cloneNode = y;
function d(e) {
for (var t = e.map(function(i) {
return y(i, !0);
}), n = 1; n < t.length; n++)
t[n].prev = t[n - 1], t[n - 1].next = t[n];
return t;
}
return r;
}
export {
W as __require
};
//# sourceMappingURL=index.es716.js.map