nanosplash 3.0.1 → 3.0.2

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.
Files changed (66) hide show
  1. package/.github/workflows/ci.yml +50 -44
  2. package/.github/workflows/vitepress.yml +69 -0
  3. package/.prettierignore +1 -0
  4. package/.prettierrc +10 -10
  5. package/README.md +11 -172
  6. package/bun.lockb +0 -0
  7. package/coverage/{core/Dom.ts.html → DomUtilities.ts.html} +141 -138
  8. package/coverage/{core/Service.ts.html → Service.ts.html} +250 -322
  9. package/coverage/{core/Splash.ts.html → Splash.ts.html} +145 -154
  10. package/coverage/SplashQueue.ts.html +232 -0
  11. package/coverage/clover.xml +557 -552
  12. package/coverage/coverage-final.json +5 -9043
  13. package/coverage/index.html +53 -23
  14. package/dist/cjs/ns.cjs +2 -0
  15. package/dist/es/ns.js +342 -0
  16. package/dist/iife/ns.iife.js +2 -0
  17. package/docs/.vitepress/config.ts +75 -0
  18. package/docs/.vitepress/theme/css/style.css +157 -0
  19. package/docs/.vitepress/theme/index.ts +16 -0
  20. package/docs/.vitepress/theme/vue/Card.vue +31 -0
  21. package/docs/.vitepress/theme/vue/CardGrid.vue +17 -0
  22. package/docs/.vitepress/theme/vue/Exe.vue +86 -0
  23. package/docs/.vitepress/theme/vue/PlayGround.vue +50 -0
  24. package/docs/api/doc/hide.md +69 -0
  25. package/docs/api/doc/show.md +47 -0
  26. package/docs/api/start/features.md +17 -0
  27. package/docs/api/start/install.md +53 -0
  28. package/docs/api/start/playground.md +11 -0
  29. package/docs/api/start/usage.md +25 -0
  30. package/docs/index.md +30 -0
  31. package/package.json +86 -87
  32. package/src/style/ns.sass +95 -0
  33. package/src/ts/core/{Dom.ts → DomUtilities.ts} +58 -57
  34. package/src/ts/core/Service.ts +66 -90
  35. package/src/ts/core/ServiceInterface.ts +5 -7
  36. package/src/ts/core/Splash.ts +23 -26
  37. package/src/ts/core/SplashInterface.ts +12 -20
  38. package/src/ts/core/SplashQueue.ts +49 -0
  39. package/src/ts/types/Types.ts +0 -9
  40. package/tests/{Dom.spec.ts → DomUtilities.spec.ts} +13 -23
  41. package/tests/Guid.spec.ts +3 -3
  42. package/tests/Service.spec.ts +146 -67
  43. package/tests/Splash.spec.ts +26 -26
  44. package/tests/TestUtilities.ts +48 -0
  45. package/tsconfig.json +1 -0
  46. package/vite.config.ts +1 -15
  47. package/coverage/core/index.html +0 -146
  48. package/coverage/types/Types.ts.html +0 -121
  49. package/coverage/types/index.html +0 -116
  50. package/dist/latest/cjs/ns.cjs +0 -1
  51. package/dist/latest/cjs/style.css +0 -1
  52. package/dist/latest/es/ns.js +0 -306
  53. package/dist/latest/es/style.css +0 -1
  54. package/dist/latest/iife/ns.iife.js +0 -4
  55. package/dist/versioned/3.0.1/cjs/ns.cjs +0 -1
  56. package/dist/versioned/3.0.1/cjs/style.css +0 -1
  57. package/dist/versioned/3.0.1/es/ns.js +0 -306
  58. package/dist/versioned/3.0.1/es/style.css +0 -1
  59. package/dist/versioned/3.0.1/iife/ns.iife.js +0 -2
  60. package/docs/index.6d66a821.js +0 -1
  61. package/docs/index.74dbd99e.css +0 -1
  62. package/docs/index.f34144dc.js +0 -1
  63. package/docs/index.html +0 -107
  64. package/index.html +0 -105
  65. package/src/sass/ns.sass +0 -95
  66. package/vite.demo.config.ts +0 -16
@@ -1,121 +0,0 @@
1
-
2
- <!doctype html>
3
- <html lang="en">
4
-
5
- <head>
6
- <title>Code coverage report for types/Types.ts</title>
7
- <meta charset="utf-8" />
8
- <link rel="stylesheet" href="../prettify.css" />
9
- <link rel="stylesheet" href="../base.css" />
10
- <link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
11
- <meta name="viewport" content="width=device-width, initial-scale=1" />
12
- <style type='text/css'>
13
- .coverage-summary .sorter {
14
- background-image: url(../sort-arrow-sprite.png);
15
- }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <div class='wrapper'>
21
- <div class='pad1'>
22
- <h1><a href="../index.html">All files</a> / <a href="index.html">types</a> Types.ts</h1>
23
- <div class='clearfix'>
24
-
25
- <div class='fl pad1y space-right2'>
26
- <span class="strong">100% </span>
27
- <span class="quiet">Statements</span>
28
- <span class='fraction'>12/12</span>
29
- </div>
30
-
31
-
32
- <div class='fl pad1y space-right2'>
33
- <span class="strong">100% </span>
34
- <span class="quiet">Branches</span>
35
- <span class='fraction'>1/1</span>
36
- </div>
37
-
38
-
39
- <div class='fl pad1y space-right2'>
40
- <span class="strong">100% </span>
41
- <span class="quiet">Functions</span>
42
- <span class='fraction'>0/0</span>
43
- </div>
44
-
45
-
46
- <div class='fl pad1y space-right2'>
47
- <span class="strong">100% </span>
48
- <span class="quiet">Lines</span>
49
- <span class='fraction'>12/12</span>
50
- </div>
51
-
52
-
53
- </div>
54
- <p class="quiet">
55
- Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
56
- </p>
57
- <template id="filterTemplate">
58
- <div class="quiet">
59
- Filter:
60
- <input oninput="onInput()" type="search" id="fileSearch">
61
- </div>
62
- </template>
63
- </div>
64
- <div class='status-line high'></div>
65
- <pre><table class="coverage">
66
- <tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
67
- <a name='L2'></a><a href='#L2'>2</a>
68
- <a name='L3'></a><a href='#L3'>3</a>
69
- <a name='L4'></a><a href='#L4'>4</a>
70
- <a name='L5'></a><a href='#L5'>5</a>
71
- <a name='L6'></a><a href='#L6'>6</a>
72
- <a name='L7'></a><a href='#L7'>7</a>
73
- <a name='L8'></a><a href='#L8'>8</a>
74
- <a name='L9'></a><a href='#L9'>9</a>
75
- <a name='L10'></a><a href='#L10'>10</a>
76
- <a name='L11'></a><a href='#L11'>11</a>
77
- <a name='L12'></a><a href='#L12'>12</a>
78
- <a name='L13'></a><a href='#L13'>13</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
79
- <span class="cline-any cline-yes">1x</span>
80
- <span class="cline-any cline-yes">1x</span>
81
- <span class="cline-any cline-yes">1x</span>
82
- <span class="cline-any cline-yes">1x</span>
83
- <span class="cline-any cline-yes">1x</span>
84
- <span class="cline-any cline-yes">1x</span>
85
- <span class="cline-any cline-yes">1x</span>
86
- <span class="cline-any cline-yes">1x</span>
87
- <span class="cline-any cline-yes">1x</span>
88
- <span class="cline-any cline-yes">1x</span>
89
- <span class="cline-any cline-yes">1x</span>
90
- <span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import { Splash } from '../core/Splash'
91
- &nbsp;
92
- export type GUIDString = string
93
- export type CSSSelector = string
94
- export type FindCallback&lt;T&gt; = (item: T, index: number) =&gt; boolean
95
- export type NSFinder = FindCallback&lt;Splash&gt;
96
- export type Reference = CSSSelector | Element
97
- &nbsp;
98
- export enum ClassListAction {
99
- Add = 'add',
100
- Remove = 'remove',
101
- }
102
- &nbsp;</pre></td></tr></table></pre>
103
-
104
- <div class='push'></div><!-- for sticky footer -->
105
- </div><!-- /wrapper -->
106
- <div class='footer quiet pad2 space-top1 center small'>
107
- Code coverage generated by
108
- <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
109
- at 2023-09-06T08:51:33.390Z
110
- </div>
111
- <script src="../prettify.js"></script>
112
- <script>
113
- window.onload = function () {
114
- prettyPrint();
115
- };
116
- </script>
117
- <script src="../sorter.js"></script>
118
- <script src="../block-navigation.js"></script>
119
- </body>
120
- </html>
121
-
@@ -1,116 +0,0 @@
1
-
2
- <!doctype html>
3
- <html lang="en">
4
-
5
- <head>
6
- <title>Code coverage report for types</title>
7
- <meta charset="utf-8" />
8
- <link rel="stylesheet" href="../prettify.css" />
9
- <link rel="stylesheet" href="../base.css" />
10
- <link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
11
- <meta name="viewport" content="width=device-width, initial-scale=1" />
12
- <style type='text/css'>
13
- .coverage-summary .sorter {
14
- background-image: url(../sort-arrow-sprite.png);
15
- }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <div class='wrapper'>
21
- <div class='pad1'>
22
- <h1><a href="../index.html">All files</a> types</h1>
23
- <div class='clearfix'>
24
-
25
- <div class='fl pad1y space-right2'>
26
- <span class="strong">100% </span>
27
- <span class="quiet">Statements</span>
28
- <span class='fraction'>12/12</span>
29
- </div>
30
-
31
-
32
- <div class='fl pad1y space-right2'>
33
- <span class="strong">100% </span>
34
- <span class="quiet">Branches</span>
35
- <span class='fraction'>1/1</span>
36
- </div>
37
-
38
-
39
- <div class='fl pad1y space-right2'>
40
- <span class="strong">100% </span>
41
- <span class="quiet">Functions</span>
42
- <span class='fraction'>0/0</span>
43
- </div>
44
-
45
-
46
- <div class='fl pad1y space-right2'>
47
- <span class="strong">100% </span>
48
- <span class="quiet">Lines</span>
49
- <span class='fraction'>12/12</span>
50
- </div>
51
-
52
-
53
- </div>
54
- <p class="quiet">
55
- Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
56
- </p>
57
- <template id="filterTemplate">
58
- <div class="quiet">
59
- Filter:
60
- <input oninput="onInput()" type="search" id="fileSearch">
61
- </div>
62
- </template>
63
- </div>
64
- <div class='status-line high'></div>
65
- <div class="pad1">
66
- <table class="coverage-summary">
67
- <thead>
68
- <tr>
69
- <th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
70
- <th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
71
- <th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
72
- <th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
73
- <th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
74
- <th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
75
- <th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
76
- <th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
77
- <th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
78
- <th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
79
- </tr>
80
- </thead>
81
- <tbody><tr>
82
- <td class="file high" data-value="Types.ts"><a href="Types.ts.html">Types.ts</a></td>
83
- <td data-value="100" class="pic high">
84
- <div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
85
- </td>
86
- <td data-value="100" class="pct high">100%</td>
87
- <td data-value="12" class="abs high">12/12</td>
88
- <td data-value="100" class="pct high">100%</td>
89
- <td data-value="1" class="abs high">1/1</td>
90
- <td data-value="100" class="pct high">100%</td>
91
- <td data-value="0" class="abs high">0/0</td>
92
- <td data-value="100" class="pct high">100%</td>
93
- <td data-value="12" class="abs high">12/12</td>
94
- </tr>
95
-
96
- </tbody>
97
- </table>
98
- </div>
99
- <div class='push'></div><!-- for sticky footer -->
100
- </div><!-- /wrapper -->
101
- <div class='footer quiet pad2 space-top1 center small'>
102
- Code coverage generated by
103
- <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
104
- at 2023-09-06T08:51:33.390Z
105
- </div>
106
- <script src="../prettify.js"></script>
107
- <script>
108
- window.onload = function () {
109
- prettyPrint();
110
- };
111
- </script>
112
- <script src="../sorter.js"></script>
113
- <script src="../block-navigation.js"></script>
114
- </body>
115
- </html>
116
-
@@ -1 +0,0 @@
1
- "use strict"; var m = Object.defineProperty; var S = (t, e, n) => e in t ? m(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n; var r = (t, e, n) => (S(t, typeof e != "symbol" ? e + "" : e, n), n); Object.defineProperties(exports, { __esModule: { value: !0 }, [Symbol.toStringTag]: { value: "Module" } }); const v = "3.0.1"; var a = (t => (t.Add = "add", t.Remove = "remove", t))(a || {}); const d = class d { constructor() { r(this, "id"); r(this, "element"); this.element = N(), this.element.id = this.id = d.generateGUID() } static generateGUID() { return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, e => { const n = Math.random() * 16 | 0; return (e === "x" ? n : n & 3 | 8).toString(16) }) } getNSContentElement() { return this.getNSElement().firstElementChild } getNSTextElement() { return this.getNSContentElement().firstElementChild } getId() { return this.id } getNSElement() { return this.element } setText(e) { return this.getNSTextElement().innerText = e, e.length > 0 ? this.showText() : this.hideText(), this } showText() { return I(this.getNSTextElement()), this } hideText() { return y(this.getNSTextElement()), this } remove() { var e; return this.element && ((e = this.element.parentElement) == null || e.removeChild(this.element), delete this.element), this } }; r(d, "NSClass", "ns"), r(d, "NSHostClass", "nsh"); let l = d; function N() { return new DOMParser().parseFromString('<div class=ns><div class=nsc><div class=nst></div><div class=nss><svg viewBox="0 0 50 50"><circle class=path cx=25 cy=25 r=20 fill=none></circle></svg></div></div></div>', "text/html").body.firstChild } function w(t, e) { e.children.length > 0 ? e.insertBefore(t, e.children.item(0)) : e.append(t) } function h(t, e) { t == null || t.classList[e](l.NSHostClass) } function E(t) { h(t.getNSElement().parentElement, a.Remove) } function I(t) { t.style.display = "flex" } function y(t) { t.style.display = "none" } function u(t) { return t instanceof Element ? t : document.querySelector(t || "") } function C(t) { var e; return ((e = t == null ? void 0 : t.classList) == null ? void 0 : e.contains(l.NSClass)) ?? !1 } function x(t, e) { h(t.parentElement, a.Remove), h(e, a.Add), w(t, e) } function f(t) { const e = t.firstElementChild; if (e !== null && C(e)) { const c = e.id; return o.getInstance().nsStack.find(g => g.getId() === c) ?? null } return null } const s = class s { constructor() { r(this, "version"); r(this, "nsStack"); this.version = v, this.nsStack = [] } findIndex(e) { return this.nsStack.findIndex(e) } find(e) { return this.nsStack.find(e) } static getInstance() { return s.instance || (s.instance = new s), s.instance } static assignToWindow() { Object.defineProperty(window, s.WindowAccessorKey, { value: s.getInstance(), writable: !1 }) } static start() { s.assignToWindow(), window.addEventListener("load", () => { window[s.WindowAccessorKey] instanceof s || s.assignToWindow() }) } createNS(e) { const n = new l; return n.setText(e || ""), this.nsStack.push(n), n } cleanAndRemove(e) { return E(e), e.remove().getId() } stackDelete(e) { let n = this.findIndex(i => i.getId() === e.getId()); return n < 0 ? null : (this.nsStack.splice(n, 1), e.getId()) } deleteNS(e) { const n = this.find(e); return n ? (this.cleanAndRemove(n), this.stackDelete(n)) : null } show(e) { let n = f(document.body); return n || (n = this.createNS(), x(n.getNSElement(), document.body)), n.setText(e || "").getId() } showInside(e, n) { const i = u(e); if (i) { let c = f(i); return c || (c = this.createNS()), x(c.getNSElement(), i), c.setText(n || "").getId() } return null } hide() { const e = this.nsStack.pop(); return e ? this.cleanAndRemove(e) : null } hideAll() { this.nsStack.forEach(this.cleanAndRemove), this.nsStack.splice(0, this.nsStack.length) } hideId(e) { return this.deleteNS(n => n.getId() === e) } hideInside(e) { const n = u(e), i = c => c.getNSElement().parentElement === n; return n ? this.deleteNS(i) : null } }; r(s, "WindowAccessorKey", "ns"), r(s, "instance"); let o = s; const T = { Service: o }; exports.Service = o; exports.default = T;
@@ -1 +0,0 @@
1
- .ns,.nsh:before{width:100%;height:100%}.ns,.nsh:before{top:0;left:0}.nsc,.ns{display:flex;justify-content:center;align-items:center}.nsh{--color: DarkSlateGray;--size: 20px;--relSize: calc(var(--size) * .9);--font: "Helvetica", "Arial", sans-serif;--weight: 400;--bg: rgba(255, 255, 255, .8);--zIdx: 999999999;--blur: blur(10px)}.nsh{position:relative;z-index:var(--zIdx)}.nsh:before{position:absolute;background-color:var(--bg);content:"";backdrop-filter:var(--blur);-webkit-backdrop-filter:var(--blur);z-index:calc(var(--zIdx) + 1);border-radius:inherit}body.nsh{height:100vh}.ns{position:absolute;z-index:calc(var(--zIdx) + 2)}.nsc{filter:drop-shadow(0 0 .1rem rgba(211,211,211,.5))}.nst{color:var(--color);font-size:var(--size);font-family:var(--font);font-weight:var(--weight);margin-right:var(--relSize);text-shadow:0 0 .06rem rgba(47,79,79,.25)}.nss{display:block;width:var(--relSize);height:var(--relSize)}.nss>svg{animation:Rotate 2s linear infinite;position:relative;width:inherit;height:inherit;stroke-width:8}.nss .path{stroke:var(--color);stroke-linecap:round;animation:Dash 1.5s ease-in-out infinite}@keyframes Rotate{to{transform:rotate(360deg)}}@keyframes Dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}
@@ -1,306 +0,0 @@
1
- var m = Object.defineProperty;
2
- var S = (e, t, n) => t in e ? m(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var r = (e, t, n) => (S(e, typeof t != "symbol" ? t + "" : t, n), n);
4
- const v = "3.0.1";
5
- var o = /* @__PURE__ */ ((e) => (e.Add = "add", e.Remove = "remove", e))(o || {});
6
- const d = class d {
7
- /**
8
- * # Constructor
9
- * Creates a new Nanosplash instance.
10
- */
11
- constructor() {
12
- /**
13
- * # ID
14
- * Each Nanosplash instance is given a unique GUID.
15
- */
16
- r(this, "id");
17
- /**
18
- * # Element
19
- * The root element of the Nanosplash component.
20
- */
21
- r(this, "element");
22
- this.element = N(), this.element.id = this.id = d.generateGUID();
23
- }
24
- /**
25
- * # Generate GUID
26
- * @returns {GUIDString} A GUID string.
27
- * @private
28
- */
29
- static generateGUID() {
30
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => {
31
- const n = Math.random() * 16 | 0;
32
- return (t === "x" ? n : n & 3 | 8).toString(16);
33
- });
34
- }
35
- /**
36
- * @inheritdoc
37
- */
38
- getNSContentElement() {
39
- return this.getNSElement().firstElementChild;
40
- }
41
- /**
42
- * @inheritdoc
43
- */
44
- getNSTextElement() {
45
- return this.getNSContentElement().firstElementChild;
46
- }
47
- /**
48
- * @inheritdoc
49
- */
50
- getId() {
51
- return this.id;
52
- }
53
- /**
54
- * @inheritdoc
55
- */
56
- getNSElement() {
57
- return this.element;
58
- }
59
- /**
60
- * @inheritdoc
61
- */
62
- setText(t) {
63
- return this.getNSTextElement().innerText = t, t.length > 0 ? this.showText() : this.hideText(), this;
64
- }
65
- /**
66
- * @inheritdoc
67
- */
68
- showText() {
69
- return I(this.getNSTextElement()), this;
70
- }
71
- /**
72
- * @inheritdoc
73
- */
74
- hideText() {
75
- return y(this.getNSTextElement()), this;
76
- }
77
- /**
78
- * @inheritdoc
79
- */
80
- remove() {
81
- var t;
82
- return this.element && ((t = this.element.parentElement) == null || t.removeChild(this.element), delete this.element), this;
83
- }
84
- };
85
- /**
86
- * # CSS Class Name
87
- * The main CSS class name of the root element of a Nanosplash component.
88
- */
89
- r(d, "NSClass", "ns"), /**
90
- * # Host CSS Class Name
91
- * The CSS class name of the host element of a Nanosplash component.
92
- * The host element is the element that the Nanosplash is attached to.
93
- */
94
- r(d, "NSHostClass", "nsh");
95
- let l = d;
96
- function N() {
97
- return new DOMParser().parseFromString(
98
- '<div class=ns><div class=nsc><div class=nst></div><div class=nss><svg viewBox="0 0 50 50"><circle class=path cx=25 cy=25 r=20 fill=none></circle></svg></div></div></div>',
99
- "text/html"
100
- ).body.firstChild;
101
- }
102
- function w(e, t) {
103
- t.children.length > 0 ? t.insertBefore(e, t.children.item(0)) : t.append(e);
104
- }
105
- function h(e, t) {
106
- e == null || e.classList[t](l.NSHostClass);
107
- }
108
- function E(e) {
109
- h(e.getNSElement().parentElement, o.Remove);
110
- }
111
- function I(e) {
112
- e.style.display = "flex";
113
- }
114
- function y(e) {
115
- e.style.display = "none";
116
- }
117
- function u(e) {
118
- return e instanceof Element ? e : document.querySelector(e || "");
119
- }
120
- function C(e) {
121
- var t;
122
- return ((t = e == null ? void 0 : e.classList) == null ? void 0 : t.contains(l.NSClass)) ?? !1;
123
- }
124
- function x(e, t) {
125
- h(e.parentElement, o.Remove), h(t, o.Add), w(e, t);
126
- }
127
- function f(e) {
128
- const t = e.firstElementChild;
129
- if (t !== null && C(t)) {
130
- const c = t.id;
131
- return a.getInstance().nsStack.find((g) => g.getId() === c) ?? null;
132
- }
133
- return null;
134
- }
135
- const s = class s {
136
- /**
137
- * # Constructor
138
- * Private constructor to prevent multiple instances.
139
- * @private
140
- */
141
- constructor() {
142
- /**
143
- * # Version
144
- */
145
- r(this, "version");
146
- /**
147
- * @inheritdoc
148
- */
149
- r(this, "nsStack");
150
- this.version = v, this.nsStack = [];
151
- }
152
- /**
153
- * # Find Index
154
- * Find Nanosplash stack index by callback.
155
- * @param callback Callback function that returns a boolean.
156
- * @returns {number} Index of Nanosplash instance in the stack or -1.
157
- * @private
158
- */
159
- findIndex(t) {
160
- return this.nsStack.findIndex(t);
161
- }
162
- /**
163
- * # Find
164
- * Find Nanosplash in the stack by callback.
165
- * @param callback Callback function that returns a boolean.
166
- * @returns {Splash | undefined} Nanosplash instance or undefined
167
- * @private
168
- */
169
- find(t) {
170
- return this.nsStack.find(t);
171
- }
172
- /**
173
- * # Get Instance
174
- * Singleton instance accessor
175
- * @returns {Service} NanosplashService instance
176
- */
177
- static getInstance() {
178
- return s.instance || (s.instance = new s()), s.instance;
179
- }
180
- /**
181
- * # Assign To Window
182
- * Assign a NanosplashService instance to the Window object.
183
- * The NanosplashService instance can be accessed in the window object
184
- * using the key window accessor key.
185
- * @see WindowAccessorKey
186
- * @private
187
- */
188
- static assignToWindow() {
189
- Object.defineProperty(window, s.WindowAccessorKey, {
190
- value: s.getInstance(),
191
- writable: !1
192
- });
193
- }
194
- /**
195
- * # Start
196
- * Initialize and attach a Nanosplash Service instance to the Window object.
197
- */
198
- static start() {
199
- s.assignToWindow(), window.addEventListener("load", () => {
200
- window[s.WindowAccessorKey] instanceof s || s.assignToWindow();
201
- });
202
- }
203
- /**
204
- * # Create Nanosplash
205
- * Return new Nanosplash instance and push it to the stack.
206
- * @param text Text to display.
207
- * @returns {Splash} Nanosplash instance.
208
- * @private
209
- */
210
- createNS(t) {
211
- const n = new l();
212
- return n.setText(t || ""), this.nsStack.push(n), n;
213
- }
214
- /**
215
- * # Clean And Remove
216
- * Remove Nanosplash from DOM and clean its parent.
217
- * @param ns Nanosplash instance.
218
- * @returns {GUIDString} Nanosplash ID.
219
- * @private
220
- */
221
- cleanAndRemove(t) {
222
- return E(t), t.remove().getId();
223
- }
224
- /**
225
- * # Stack Delete
226
- * Remove Nanosplash instance from the stack.
227
- * @param ns Nanosplash instance.
228
- * @returns {GUIDString | null} Nanosplash ID or null if it doesn't exist.
229
- * @private
230
- */
231
- stackDelete(t) {
232
- let n = this.findIndex((i) => i.getId() === t.getId());
233
- return n < 0 ? null : (this.nsStack.splice(n, 1), t.getId());
234
- }
235
- /**
236
- * # Delete NS
237
- * Remove Nanosplash instance from both the stack and the
238
- * @param callback Callback function.
239
- * @returns {GUIDString | null} Nanosplash ID or null if it doesn't exist.
240
- * @private
241
- */
242
- deleteNS(t) {
243
- const n = this.find(t);
244
- return n ? (this.cleanAndRemove(n), this.stackDelete(n)) : null;
245
- }
246
- /**
247
- * @inheritdoc
248
- */
249
- show(t) {
250
- let n = f(document.body);
251
- return n || (n = this.createNS(), x(n.getNSElement(), document.body)), n.setText(t || "").getId();
252
- }
253
- /**
254
- * @inheritdoc
255
- */
256
- showInside(t, n) {
257
- const i = u(t);
258
- if (i) {
259
- let c = f(i);
260
- return c || (c = this.createNS()), x(c.getNSElement(), i), c.setText(n || "").getId();
261
- }
262
- return null;
263
- }
264
- /**
265
- * @inheritdoc
266
- */
267
- hide() {
268
- const t = this.nsStack.pop();
269
- return t ? this.cleanAndRemove(t) : null;
270
- }
271
- /**
272
- * @inheritdoc
273
- */
274
- hideAll() {
275
- this.nsStack.forEach(this.cleanAndRemove), this.nsStack.splice(0, this.nsStack.length);
276
- }
277
- /**
278
- * @inheritdoc
279
- */
280
- hideId(t) {
281
- return this.deleteNS((n) => n.getId() === t);
282
- }
283
- /**
284
- * @inheritdoc
285
- */
286
- hideInside(t) {
287
- const n = u(t), i = (c) => c.getNSElement().parentElement === n;
288
- return n ? this.deleteNS(i) : null;
289
- }
290
- };
291
- /**
292
- * # Window Accessor Key
293
- * Key to access NanosplashService instance in the Window object.
294
- */
295
- r(s, "WindowAccessorKey", "ns"), /**
296
- * # Instance
297
- * Singleton instance of NanosplashService.
298
- * @private
299
- */
300
- r(s, "instance");
301
- let a = s;
302
- const A = { Service: a };
303
- export {
304
- a as Service,
305
- A as default
306
- };
@@ -1 +0,0 @@
1
- .ns,.nsh:before{width:100%;height:100%}.ns,.nsh:before{top:0;left:0}.nsc,.ns{display:flex;justify-content:center;align-items:center}.nsh{--color: DarkSlateGray;--size: 20px;--relSize: calc(var(--size) * .9);--font: "Helvetica", "Arial", sans-serif;--weight: 400;--bg: rgba(255, 255, 255, .8);--zIdx: 999999999;--blur: blur(10px)}.nsh{position:relative;z-index:var(--zIdx)}.nsh:before{position:absolute;background-color:var(--bg);content:"";backdrop-filter:var(--blur);-webkit-backdrop-filter:var(--blur);z-index:calc(var(--zIdx) + 1);border-radius:inherit}body.nsh{height:100vh}.ns{position:absolute;z-index:calc(var(--zIdx) + 2)}.nsc{filter:drop-shadow(0 0 .1rem rgba(211,211,211,.5))}.nst{color:var(--color);font-size:var(--size);font-family:var(--font);font-weight:var(--weight);margin-right:var(--relSize);text-shadow:0 0 .06rem rgba(47,79,79,.25)}.nss{display:block;width:var(--relSize);height:var(--relSize)}.nss>svg{animation:Rotate 2s linear infinite;position:relative;width:inherit;height:inherit;stroke-width:8}.nss .path{stroke:var(--color);stroke-linecap:round;animation:Dash 1.5s ease-in-out infinite}@keyframes Rotate{to{transform:rotate(360deg)}}@keyframes Dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}
@@ -1,4 +0,0 @@
1
- var I = Object.defineProperty; var E = (o, i, d) => i in o ? I(o, i, { enumerable: !0, configurable: !0, writable: !0, value: d }) : o[i] = d; var a = (o, i, d) => (E(o, typeof i != "symbol" ? i + "" : i, d), d); (function () {
2
- "use strict"; var o = document.createElement("style"); o.textContent = `.ns,.nsh:before{width:100%;height:100%}.ns,.nsh:before{top:0;left:0}.nsc,.ns{display:flex;justify-content:center;align-items:center}.nsh{--color: DarkSlateGray;--size: 20px;--relSize: calc(var(--size) * .9);--font: "Helvetica", "Arial", sans-serif;--weight: 400;--bg: rgba(255, 255, 255, .8);--zIdx: 999999999;--blur: blur(10px)}.nsh{position:relative;z-index:var(--zIdx)}.nsh:before{position:absolute;background-color:var(--bg);content:"";backdrop-filter:var(--blur);-webkit-backdrop-filter:var(--blur);z-index:calc(var(--zIdx) + 1);border-radius:inherit}body.nsh{height:100vh}.ns{position:absolute;z-index:calc(var(--zIdx) + 2)}.nsc{filter:drop-shadow(0 0 .1rem rgba(211,211,211,.5))}.nst{color:var(--color);font-size:var(--size);font-family:var(--font);font-weight:var(--weight);margin-right:var(--relSize);text-shadow:0 0 .06rem rgba(47,79,79,.25)}.nss{display:block;width:var(--relSize);height:var(--relSize)}.nss>svg{animation:Rotate 2s linear infinite;position:relative;width:inherit;height:inherit;stroke-width:8}.nss .path{stroke:var(--color);stroke-linecap:round;animation:Dash 1.5s ease-in-out infinite}@keyframes Rotate{to{transform:rotate(360deg)}}@keyframes Dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}
3
- `, document.head.appendChild(o); const i = "3.0.1", d = ""; var u = (t => (t.Add = "add", t.Remove = "remove", t))(u || {}); const h = class h { constructor() { a(this, "id"); a(this, "element"); this.element = S(), this.element.id = this.id = h.generateGUID() } static generateGUID() { return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, e => { const n = Math.random() * 16 | 0; return (e === "x" ? n : n & 3 | 8).toString(16) }) } getNSContentElement() { return this.getNSElement().firstElementChild } getNSTextElement() { return this.getNSContentElement().firstElementChild } getId() { return this.id } getNSElement() { return this.element } setText(e) { return this.getNSTextElement().innerText = e, e.length > 0 ? this.showText() : this.hideText(), this } showText() { return k(this.getNSTextElement()), this } hideText() { return p(this.getNSTextElement()), this } remove() { var e; return this.element && ((e = this.element.parentElement) == null || e.removeChild(this.element), delete this.element), this } }; a(h, "NSClass", "ns"), a(h, "NSHostClass", "nsh"); let c = h; function S() { return new DOMParser().parseFromString('<div class=ns><div class=nsc><div class=nst></div><div class=nss><svg viewBox="0 0 50 50"><circle class=path cx=25 cy=25 r=20 fill=none></circle></svg></div></div></div>', "text/html").body.firstChild } function w(t, e) { e.children.length > 0 ? e.insertBefore(t, e.children.item(0)) : e.append(t) } function x(t, e) { t == null || t.classList[e](c.NSHostClass) } function y(t) { x(t.getNSElement().parentElement, u.Remove) } function k(t) { t.style.display = "flex" } function p(t) { t.style.display = "none" } function g(t) { return t instanceof Element ? t : document.querySelector(t || "") } function N(t) { var e; return ((e = t == null ? void 0 : t.classList) == null ? void 0 : e.contains(c.NSClass)) ?? !1 } function m(t, e) { x(t.parentElement, u.Remove), x(e, u.Add), w(t, e) } function v(t) { const e = t.firstElementChild; if (e !== null && N(e)) { const l = e.id; return f.getInstance().nsStack.find(b => b.getId() === l) ?? null } return null } const s = class s { constructor() { a(this, "version"); a(this, "nsStack"); this.version = i, this.nsStack = [] } findIndex(e) { return this.nsStack.findIndex(e) } find(e) { return this.nsStack.find(e) } static getInstance() { return s.instance || (s.instance = new s), s.instance } static assignToWindow() { Object.defineProperty(window, s.WindowAccessorKey, { value: s.getInstance(), writable: !1 }) } static start() { s.assignToWindow(), window.addEventListener("load", () => { window[s.WindowAccessorKey] instanceof s || s.assignToWindow() }) } createNS(e) { const n = new c; return n.setText(e || ""), this.nsStack.push(n), n } cleanAndRemove(e) { return y(e), e.remove().getId() } stackDelete(e) { let n = this.findIndex(r => r.getId() === e.getId()); return n < 0 ? null : (this.nsStack.splice(n, 1), e.getId()) } deleteNS(e) { const n = this.find(e); return n ? (this.cleanAndRemove(n), this.stackDelete(n)) : null } show(e) { let n = v(document.body); return n || (n = this.createNS(), m(n.getNSElement(), document.body)), n.setText(e || "").getId() } showInside(e, n) { const r = g(e); if (r) { let l = v(r); return l || (l = this.createNS()), m(l.getNSElement(), r), l.setText(n || "").getId() } return null } hide() { const e = this.nsStack.pop(); return e ? this.cleanAndRemove(e) : null } hideAll() { this.nsStack.forEach(this.cleanAndRemove), this.nsStack.splice(0, this.nsStack.length) } hideId(e) { return this.deleteNS(n => n.getId() === e) } hideInside(e) { const n = g(e), r = l => l.getNSElement().parentElement === n; return n ? this.deleteNS(r) : null } }; a(s, "WindowAccessorKey", "ns"), a(s, "instance"); let f = s; try { f.start() } catch (t) { console.warn(t) }
4
- })();
@@ -1 +0,0 @@
1
- "use strict";var m=Object.defineProperty;var S=(t,e,n)=>e in t?m(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var r=(t,e,n)=>(S(t,typeof e!="symbol"?e+"":e,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v="3.0.1";var a=(t=>(t.Add="add",t.Remove="remove",t))(a||{});const d=class d{constructor(){r(this,"id");r(this,"element");this.element=N(),this.element.id=this.id=d.generateGUID()}static generateGUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const n=Math.random()*16|0;return(e==="x"?n:n&3|8).toString(16)})}getNSContentElement(){return this.getNSElement().firstElementChild}getNSTextElement(){return this.getNSContentElement().firstElementChild}getId(){return this.id}getNSElement(){return this.element}setText(e){return this.getNSTextElement().innerText=e,e.length>0?this.showText():this.hideText(),this}showText(){return I(this.getNSTextElement()),this}hideText(){return y(this.getNSTextElement()),this}remove(){var e;return this.element&&((e=this.element.parentElement)==null||e.removeChild(this.element),delete this.element),this}};r(d,"NSClass","ns"),r(d,"NSHostClass","nsh");let l=d;function N(){return new DOMParser().parseFromString('<div class=ns><div class=nsc><div class=nst></div><div class=nss><svg viewBox="0 0 50 50"><circle class=path cx=25 cy=25 r=20 fill=none></circle></svg></div></div></div>',"text/html").body.firstChild}function w(t,e){e.children.length>0?e.insertBefore(t,e.children.item(0)):e.append(t)}function h(t,e){t==null||t.classList[e](l.NSHostClass)}function E(t){h(t.getNSElement().parentElement,a.Remove)}function I(t){t.style.display="flex"}function y(t){t.style.display="none"}function u(t){return t instanceof Element?t:document.querySelector(t||"")}function C(t){var e;return((e=t==null?void 0:t.classList)==null?void 0:e.contains(l.NSClass))??!1}function x(t,e){h(t.parentElement,a.Remove),h(e,a.Add),w(t,e)}function f(t){const e=t.firstElementChild;if(e!==null&&C(e)){const c=e.id;return o.getInstance().nsStack.find(g=>g.getId()===c)??null}return null}const s=class s{constructor(){r(this,"version");r(this,"nsStack");this.version=v,this.nsStack=[]}findIndex(e){return this.nsStack.findIndex(e)}find(e){return this.nsStack.find(e)}static getInstance(){return s.instance||(s.instance=new s),s.instance}static assignToWindow(){Object.defineProperty(window,s.WindowAccessorKey,{value:s.getInstance(),writable:!1})}static start(){s.assignToWindow(),window.addEventListener("load",()=>{window[s.WindowAccessorKey]instanceof s||s.assignToWindow()})}createNS(e){const n=new l;return n.setText(e||""),this.nsStack.push(n),n}cleanAndRemove(e){return E(e),e.remove().getId()}stackDelete(e){let n=this.findIndex(i=>i.getId()===e.getId());return n<0?null:(this.nsStack.splice(n,1),e.getId())}deleteNS(e){const n=this.find(e);return n?(this.cleanAndRemove(n),this.stackDelete(n)):null}show(e){let n=f(document.body);return n||(n=this.createNS(),x(n.getNSElement(),document.body)),n.setText(e||"").getId()}showInside(e,n){const i=u(e);if(i){let c=f(i);return c||(c=this.createNS()),x(c.getNSElement(),i),c.setText(n||"").getId()}return null}hide(){const e=this.nsStack.pop();return e?this.cleanAndRemove(e):null}hideAll(){this.nsStack.forEach(this.cleanAndRemove),this.nsStack.splice(0,this.nsStack.length)}hideId(e){return this.deleteNS(n=>n.getId()===e)}hideInside(e){const n=u(e),i=c=>c.getNSElement().parentElement===n;return n?this.deleteNS(i):null}};r(s,"WindowAccessorKey","ns"),r(s,"instance");let o=s;const T={Service:o};exports.Service=o;exports.default=T;
@@ -1 +0,0 @@
1
- .ns,.nsh:before{width:100%;height:100%}.ns,.nsh:before{top:0;left:0}.nsc,.ns{display:flex;justify-content:center;align-items:center}.nsh{--color: DarkSlateGray;--size: 20px;--relSize: calc(var(--size) * .9);--font: "Helvetica", "Arial", sans-serif;--weight: 400;--bg: rgba(255, 255, 255, .8);--zIdx: 999999999;--blur: blur(10px)}.nsh{position:relative;z-index:var(--zIdx)}.nsh:before{position:absolute;background-color:var(--bg);content:"";backdrop-filter:var(--blur);-webkit-backdrop-filter:var(--blur);z-index:calc(var(--zIdx) + 1);border-radius:inherit}body.nsh{height:100vh}.ns{position:absolute;z-index:calc(var(--zIdx) + 2)}.nsc{filter:drop-shadow(0 0 .1rem rgba(211,211,211,.5))}.nst{color:var(--color);font-size:var(--size);font-family:var(--font);font-weight:var(--weight);margin-right:var(--relSize);text-shadow:0 0 .06rem rgba(47,79,79,.25)}.nss{display:block;width:var(--relSize);height:var(--relSize)}.nss>svg{animation:Rotate 2s linear infinite;position:relative;width:inherit;height:inherit;stroke-width:8}.nss .path{stroke:var(--color);stroke-linecap:round;animation:Dash 1.5s ease-in-out infinite}@keyframes Rotate{to{transform:rotate(360deg)}}@keyframes Dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}