monowind 0.1.0 → 0.1.1
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/cdn.js +5 -5
- package/dist/cdn.js.map +1 -1
- package/dist/element.d.ts +5 -2
- package/dist/element.d.ts.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/element.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
declare const HTMLElementBase: typeof HTMLElement;
|
|
2
|
+
export declare class MonoWindElement extends HTMLElementBase {
|
|
2
3
|
#private;
|
|
3
4
|
constructor();
|
|
4
5
|
connectedCallback(): void;
|
|
5
6
|
disconnectedCallback(): void;
|
|
6
7
|
}
|
|
7
|
-
/** Register the <mono-wind> element (idempotent
|
|
8
|
+
/** Register the <mono-wind> element (idempotent; no-op without a DOM, so
|
|
9
|
+
* calling it from code that also runs server-side is safe). */
|
|
8
10
|
export declare function defineMonoWind(): void;
|
|
9
11
|
declare global {
|
|
10
12
|
interface HTMLElementTagNameMap {
|
|
11
13
|
"mono-wind": MonoWindElement;
|
|
12
14
|
}
|
|
13
15
|
}
|
|
16
|
+
export {};
|
|
14
17
|
//# sourceMappingURL=element.d.ts.map
|
package/dist/element.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AAuBA,QAAA,MAAM,eAAe,EAEhB,OAAO,WAAW,CAAC;AAExB,qBAAa,eAAgB,SAAQ,eAAe;;IASlD,cAKC;IAED,iBAAiB,IAAI,IAAI,CAqCxB;IAED,oBAAoB,IAAI,IAAI,CAS3B;CA8GF;AAED;+DAC+D;AAC/D,wBAAgB,cAAc,IAAI,IAAI,CAIrC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,eAAe,CAAC;KAC9B;CACF"}
|
package/dist/index.js
CHANGED
|
@@ -858,7 +858,7 @@ function _e(e) {
|
|
|
858
858
|
}
|
|
859
859
|
//#endregion
|
|
860
860
|
//#region src/element.ts
|
|
861
|
-
var ve = "\n<style>\n :host { display: block; position: relative; contain: layout style; }\n #viewport { position: relative; width: 100%; height: 100%; }\n #decorations { position: absolute; inset: 0; pointer-events: none; user-select: none; white-space: pre; }\n</style>\n<div id=\"viewport\">\n <div id=\"decorations\" aria-hidden=\"true\"></div>\n <slot></slot>\n</div>\n", Q = class extends
|
|
861
|
+
var ve = "\n<style>\n :host { display: block; position: relative; contain: layout style; }\n #viewport { position: relative; width: 100%; height: 100%; }\n #decorations { position: absolute; inset: 0; pointer-events: none; user-select: none; white-space: pre; }\n</style>\n<div id=\"viewport\">\n <div id=\"decorations\" aria-hidden=\"true\"></div>\n <slot></slot>\n</div>\n", ye = typeof HTMLElement > "u" ? class {} : HTMLElement, Q = class extends ye {
|
|
862
862
|
#e;
|
|
863
863
|
#t;
|
|
864
864
|
#n = null;
|
|
@@ -947,12 +947,12 @@ var ve = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
949
|
};
|
|
950
|
-
function
|
|
951
|
-
customElements.get("mono-wind") || customElements.define("mono-wind", Q);
|
|
950
|
+
function be() {
|
|
951
|
+
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind", Q);
|
|
952
952
|
}
|
|
953
953
|
//#endregion
|
|
954
954
|
//#region src/ascii.ts
|
|
955
|
-
function
|
|
955
|
+
function xe(e) {
|
|
956
956
|
let t = e.localRect.width, n = e.localRect.height;
|
|
957
957
|
if (t <= 0 || n <= 0) return "";
|
|
958
958
|
let r = Array.from({ length: n }, () => Array.from({ length: t }, () => " "));
|
|
@@ -970,7 +970,7 @@ function $(e, t, n, r) {
|
|
|
970
970
|
}, c);
|
|
971
971
|
for (let e of c) for (let t = 0; t < e.length; t++) r(e.x + t, e.y, e.glyph);
|
|
972
972
|
if (e.children.length === 0 && e.text) {
|
|
973
|
-
let t = e.resolvedPadding, n = i + s.border.left + t.left, c = o + s.border.top + t.top, l = e.localRect.width - s.border.left - s.border.right - t.left - t.right, u = s.whiteSpace === "nowrap" ? e.text.split("\n").map((e) =>
|
|
973
|
+
let t = e.resolvedPadding, n = i + s.border.left + t.left, c = o + s.border.top + t.top, l = e.localRect.width - s.border.left - s.border.right - t.left - t.right, u = s.whiteSpace === "nowrap" ? e.text.split("\n").map((e) => Se(e, l, s)) : a(e.text, l);
|
|
974
974
|
for (let e = 0; e < u.length; e++) {
|
|
975
975
|
let t = u[e];
|
|
976
976
|
for (let i = 0; i < t.length; i++) r(n + i, c + e, t[i]);
|
|
@@ -978,10 +978,10 @@ function $(e, t, n, r) {
|
|
|
978
978
|
}
|
|
979
979
|
for (let t of e.children) $(t, i, o, r);
|
|
980
980
|
}
|
|
981
|
-
function
|
|
981
|
+
function Se(e, t, n) {
|
|
982
982
|
return n.overflow !== "clip" || e.length <= t ? e : t <= 0 ? "" : n.textOverflow === "ellipsis" ? `${e.slice(0, t - 1)}…` : e.slice(0, t);
|
|
983
983
|
}
|
|
984
984
|
//#endregion
|
|
985
|
-
export { Q as MonoWindElement,
|
|
985
|
+
export { Q as MonoWindElement, be as defineMonoWind, xe as renderAscii };
|
|
986
986
|
|
|
987
987
|
//# sourceMappingURL=index.js.map
|