@nine-lab/nine-ux 0.1.139 → 0.1.141
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/css/nineMenu.css +143 -47
- package/dist/nine-ux.js +5 -19
- package/dist/nine-ux.umd.js +5 -19
- package/package.json +1 -1
package/dist/css/nineMenu.css
CHANGED
|
@@ -1,66 +1,162 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
@charset "utf-8";
|
|
2
|
+
|
|
3
|
+
/* ==========================================================================
|
|
4
|
+
[1] 메인 컴포넌트 (SideMenu - 호스트 스타일)
|
|
5
|
+
========================================================================== */
|
|
6
|
+
:host {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* ==========================================================================
|
|
12
|
+
[2] 헤더 영역 (SideMenuHead)
|
|
13
|
+
========================================================================== */
|
|
14
|
+
nine-side-menu-head {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
padding: 10px;
|
|
18
|
+
height: 40px;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
nine-side-menu-head .logo-box {
|
|
23
|
+
color: #f0f0f0;
|
|
24
|
+
white-space: nowrap;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
text-overflow: ellipsis;
|
|
27
|
+
text-align: center;
|
|
28
|
+
width: 100%;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* 접힌 상태일 때 로고 너비 축소 */
|
|
32
|
+
nine-side-menu.collapse nine-side-menu-head .logo-box {
|
|
33
|
+
width: 0;
|
|
34
|
+
transition: width 0.5s ease-out;
|
|
35
|
+
}
|
|
36
|
+
/* 펼쳐진 상태이거나 호버 시 로고 보임 */
|
|
37
|
+
nine-side-menu:not(.collapse) nine-side-menu-head .logo-box,
|
|
38
|
+
nine-side-menu.hover nine-side-menu-head .logo-box {
|
|
39
|
+
width: 100%;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
nine-side-menu-head .icon-box {
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
nine-side-menu-head .icon {
|
|
49
|
+
fill: var(--icon-color, #eee);
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
transition: opacity 0.3s ease-in-out;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
nine-side-menu-head .icon-box svg {
|
|
55
|
+
display: none;
|
|
56
|
+
opacity: 0;
|
|
57
|
+
transition: opacity 0.3s ease-in-out;
|
|
9
58
|
}
|
|
10
59
|
|
|
11
|
-
|
|
12
|
-
|
|
60
|
+
/* 케이스 A: 메뉴가 접혀있을 때 -> 1번 노출 */
|
|
61
|
+
nine-side-menu.collapse nine-side-menu-head .icon:nth-of-type(1) {
|
|
62
|
+
display: block;
|
|
63
|
+
opacity: 1;
|
|
64
|
+
}
|
|
13
65
|
|
|
14
|
-
/*
|
|
15
|
-
.
|
|
16
|
-
display:
|
|
17
|
-
|
|
66
|
+
/* 케이스 B: 메뉴가 펼쳐져 있을 때 -> 1번 숨김, 2번 노출 */
|
|
67
|
+
nine-side-menu:not(.collapse) nine-side-menu-head .icon:nth-of-type(1) {
|
|
68
|
+
display: none;
|
|
69
|
+
opacity: 0;
|
|
70
|
+
}
|
|
71
|
+
nine-side-menu:not(.collapse) nine-side-menu-head .icon:nth-of-type(2) {
|
|
72
|
+
display: block;
|
|
73
|
+
opacity: 1;
|
|
74
|
+
}
|
|
75
|
+
nine-side-menu:not(.collapse) nine-side-menu-head .icon:nth-of-type(3) {
|
|
76
|
+
display: none;
|
|
77
|
+
opacity: 0;
|
|
18
78
|
}
|
|
19
79
|
|
|
20
|
-
/*
|
|
80
|
+
/* 케이스 C: 아이콘 박스 호버 시 -> 2번 숨김, 3번 노출 */
|
|
81
|
+
nine-side-menu:not(.collapse) nine-side-menu-head .icon-box:hover .icon:nth-of-type(2) {
|
|
82
|
+
display: none;
|
|
83
|
+
opacity: 0;
|
|
84
|
+
}
|
|
85
|
+
nine-side-menu:not(.collapse) nine-side-menu-head .icon-box:hover .icon:nth-of-type(3) {
|
|
86
|
+
display: block;
|
|
87
|
+
opacity: 1;
|
|
88
|
+
}
|
|
21
89
|
|
|
22
|
-
/*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
90
|
+
/* ==========================================================================
|
|
91
|
+
[3] 푸터 영역 (SideMenuFoot)
|
|
92
|
+
========================================================================== */
|
|
93
|
+
nine-side-menu-foot {
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
padding: 10px;
|
|
97
|
+
height: 40px;
|
|
98
|
+
justify-content: center;
|
|
26
99
|
}
|
|
27
100
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
101
|
+
nine-side-menu-foot .logo-box {
|
|
102
|
+
color: #f0f0f0;
|
|
103
|
+
white-space: nowrap;
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
text-overflow: ellipsis;
|
|
106
|
+
text-align: center;
|
|
107
|
+
width: 100%;
|
|
33
108
|
}
|
|
34
109
|
|
|
35
|
-
|
|
110
|
+
nine-side-menu.collapse nine-side-menu-foot .logo-box {
|
|
111
|
+
width: 0;
|
|
112
|
+
transition: width 0.5s ease-out;
|
|
113
|
+
}
|
|
114
|
+
nine-side-menu:not(.collapse) nine-side-menu-foot .logo-box,
|
|
115
|
+
nine-side-menu.hover nine-side-menu-foot .logo-box {
|
|
116
|
+
width: 100%;
|
|
117
|
+
}
|
|
36
118
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
transition: width 0.3s ease-out;
|
|
119
|
+
nine-side-menu-foot .icon-box {
|
|
120
|
+
display: flex;
|
|
121
|
+
align-items: center;
|
|
122
|
+
overflow: hidden;
|
|
42
123
|
}
|
|
43
124
|
|
|
44
|
-
|
|
45
|
-
|
|
125
|
+
nine-side-menu-foot .icon {
|
|
126
|
+
fill: var(--icon-color, #eee);
|
|
127
|
+
cursor: pointer;
|
|
128
|
+
transition: opacity 0.3s ease-in-out;
|
|
46
129
|
}
|
|
47
130
|
|
|
48
|
-
|
|
49
|
-
:
|
|
50
|
-
:
|
|
51
|
-
:
|
|
131
|
+
nine-side-menu-foot .icon-box svg {
|
|
132
|
+
display: none;
|
|
133
|
+
opacity: 0;
|
|
134
|
+
transition: opacity 0.3s ease-in-out;
|
|
135
|
+
}
|
|
52
136
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
::slotted(nine-side-menu-item).group .menubar { font-weight: 700; color: #fff; }
|
|
58
|
-
::slotted(nine-side-menu-item):not(.group) { height: 32px; }
|
|
59
|
-
::slotted(nine-side-menu-item):not(.group) li::before { content: '•'; margin-right: 8px; margin-left: 10px; }
|
|
137
|
+
nine-side-menu.collapse nine-side-menu-foot .icon:nth-of-type(1) {
|
|
138
|
+
display: block;
|
|
139
|
+
opacity: 1;
|
|
140
|
+
}
|
|
60
141
|
|
|
61
|
-
|
|
62
|
-
|
|
142
|
+
nine-side-menu:not(.collapse) nine-side-menu-foot .icon:nth-of-type(1) {
|
|
143
|
+
display: none;
|
|
144
|
+
opacity: 0;
|
|
145
|
+
}
|
|
146
|
+
nine-side-menu:not(.collapse) nine-side-menu-foot .icon:nth-of-type(2) {
|
|
147
|
+
display: block;
|
|
148
|
+
opacity: 1;
|
|
149
|
+
}
|
|
150
|
+
nine-side-menu:not(.collapse) nine-side-menu-foot .icon:nth-of-type(3) {
|
|
151
|
+
display: none;
|
|
152
|
+
opacity: 0;
|
|
63
153
|
}
|
|
64
154
|
|
|
65
|
-
|
|
66
|
-
|
|
155
|
+
nine-side-menu:not(.collapse) nine-side-menu-foot .icon-box:hover .icon:nth-of-type(2) {
|
|
156
|
+
display: none;
|
|
157
|
+
opacity: 0;
|
|
158
|
+
}
|
|
159
|
+
nine-side-menu:not(.collapse) nine-side-menu-foot .icon-box:hover .icon:nth-of-type(3) {
|
|
160
|
+
display: block;
|
|
161
|
+
opacity: 1;
|
|
162
|
+
}
|
package/dist/nine-ux.js
CHANGED
|
@@ -14082,7 +14082,7 @@ $r = function() {
|
|
|
14082
14082
|
const t = kn.getComponentCssPath("nineEditor.css"), n = t ? `@import "${t}";` : "";
|
|
14083
14083
|
this.shadowRoot.innerHTML = `
|
|
14084
14084
|
<style>
|
|
14085
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.
|
|
14085
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.141/dist/css/nineEditor.css";
|
|
14086
14086
|
${n}
|
|
14087
14087
|
</style>
|
|
14088
14088
|
|
|
@@ -14229,7 +14229,7 @@ kt = new WeakMap(), xt = new WeakMap(), ye = new WeakSet(), Ol = async function(
|
|
|
14229
14229
|
const t = this.getAttribute("lang") || "Bash", n = this.getAttribute("code") || this.textContent.trim() || "", i = this.getAttribute("css-path");
|
|
14230
14230
|
v(this, xt).innerHTML = `
|
|
14231
14231
|
<style>
|
|
14232
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.
|
|
14232
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.141/dist/css/nine-code-block.css";
|
|
14233
14233
|
${i ? `@import "${i}";` : ""}
|
|
14234
14234
|
</style>
|
|
14235
14235
|
|
|
@@ -14285,13 +14285,11 @@ St = new WeakMap(), Mt = new WeakMap(), wt = new WeakMap(), $ = new WeakSet(), A
|
|
|
14285
14285
|
const t = kn.getComponentCssPath("nineMenu.css");
|
|
14286
14286
|
this.shadowRoot.innerHTML = `
|
|
14287
14287
|
<style>
|
|
14288
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.
|
|
14288
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.141/dist/css/nineMenu.css";
|
|
14289
14289
|
${t ? `@import "${t}";` : ""}
|
|
14290
14290
|
:host {
|
|
14291
14291
|
--min-width: ${v(this, St)}px;
|
|
14292
14292
|
--max-width: ${v(this, Mt)}px;
|
|
14293
|
-
display: flex;
|
|
14294
|
-
flex-direction: column;
|
|
14295
14293
|
}
|
|
14296
14294
|
</style>
|
|
14297
14295
|
<slot name="head"></slot>
|
|
@@ -14344,13 +14342,7 @@ St = new WeakMap(), Mt = new WeakMap(), wt = new WeakMap(), $ = new WeakSet(), A
|
|
|
14344
14342
|
class Yh extends HTMLElement {
|
|
14345
14343
|
connectedCallback() {
|
|
14346
14344
|
const e = this.getAttribute("icon-color") || "#eee", t = this.innerHTML.trim();
|
|
14347
|
-
this.innerHTML = `
|
|
14348
|
-
<style>
|
|
14349
|
-
:host {
|
|
14350
|
-
--icon-color: ${e};
|
|
14351
|
-
}
|
|
14352
|
-
</style>
|
|
14353
|
-
|
|
14345
|
+
this.style.setProperty("--icon-color", e), this.innerHTML = `
|
|
14354
14346
|
<div class="logo-box">
|
|
14355
14347
|
${t}
|
|
14356
14348
|
</div>
|
|
@@ -14380,13 +14372,7 @@ class Yh extends HTMLElement {
|
|
|
14380
14372
|
class Xh extends HTMLElement {
|
|
14381
14373
|
connectedCallback() {
|
|
14382
14374
|
const e = this.getAttribute("icon-color") || "#eee", t = this.innerHTML.trim();
|
|
14383
|
-
this.innerHTML = `
|
|
14384
|
-
<style>
|
|
14385
|
-
:host {
|
|
14386
|
-
--icon-color: ${e};
|
|
14387
|
-
}
|
|
14388
|
-
</style>
|
|
14389
|
-
|
|
14375
|
+
this.style.setProperty("--icon-color", e), this.innerHTML = `
|
|
14390
14376
|
<div class="logo-box">
|
|
14391
14377
|
${t}
|
|
14392
14378
|
</div>
|
package/dist/nine-ux.umd.js
CHANGED
|
@@ -93,7 +93,7 @@ img.ProseMirror-separator {
|
|
|
93
93
|
`},addCommands(){return{setHardBreak:()=>({commands:r,chain:e,state:t,editor:n})=>r.first([()=>r.exitCode(),()=>r.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=n.extensionManager,a=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&a&&o){const u=a.filter(f=>l.includes(f.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Yf=oe.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(r=>({tag:`h${r}`,attrs:{level:r}}))},renderHTML({node:r,HTMLAttributes:e}){return[`h${this.options.levels.includes(r.attrs.level)?r.attrs.level:this.options.levels[0]}`,K(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:r=>({commands:e})=>this.options.levels.includes(r.level)?e.setNode(this.name,r):!1,toggleHeading:r=>({commands:e})=>this.options.levels.includes(r.level)?e.toggleNode(this.name,"paragraph",r):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((r,e)=>({...r,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(r=>ti({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${r}})\\s$`),type:this.type,getAttributes:{level:r}}))}});var _n=200,U=function(){};U.prototype.append=function(e){return e.length?(e=U.from(e),!this.length&&e||e.length<_n&&this.leafAppend(e)||this.length<_n&&e.leafPrepend(this)||this.appendInner(e)):this},U.prototype.prepend=function(e){return e.length?U.from(e).append(this):this},U.prototype.appendInner=function(e){return new Xf(this,e)},U.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?U.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},U.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},U.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},U.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,n),i},U.from=function(e){return e instanceof U?e:e&&e.length?new fl(e):U.empty};var fl=function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a<o;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,l){for(var a=s-1;a>=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=_n)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=_n)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(U);U.empty=new fl([]);var Xf=function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,s,o){var l=this.left.length;if(i<l&&this.left.forEachInner(n,i,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(n,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(n,i-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(n,Math.min(i,l),s,o)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(n,i):n>=s?this.right.slice(n-s,i-s):this.left.slice(n,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(U);const Zf=500;class ke{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,s;t&&(i=this.remapping(n,this.items.length),s=i.maps.length);let o=e.tr,l,a,c=[],d=[];return this.items.forEach((u,f)=>{if(!u.step){i||(i=this.remapping(n,f+1),s=i.maps.length),s--,d.push(u);return}if(i){d.push(new Oe(u.map));let h=u.step.map(i.slice(s)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new Oe(p,void 0,void 0,c.length+d.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(u.step);if(u.selection)return l=i?u.selection.map(i.slice(s)):u.selection,a=new ke(this.items.slice(0,n).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,n,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),f=new Oe(e.mapping.maps[d],u,t),h;(h=a&&a.merge(f))&&(f=h,d?s.pop():l=l.slice(0,l.length-1)),s.push(f),t&&(o++,t=void 0),i||(a=f)}let c=o-n.depth;return c>eh&&(l=Qf(l,c),o-=c),new ke(l.append(s),o)}remapping(e,t){let n=new zt;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,o)},e,t),n}addMaps(e){return this.eventCount==0?this:new ke(this.items.append(e.map(t=>new Oe(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=t;this.items.forEach(f=>{let h=s.getMirror(--a);if(h==null)return;o=Math.min(o,h);let p=s.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),g=f.selection&&f.selection.map(s.slice(a+1,h));g&&l++,n.push(new Oe(p,m,g))}else n.push(new Oe(p))},i);let c=[];for(let f=t;f<o;f++)c.push(new Oe(s.maps[f]));let d=this.items.slice(0,i).append(c).append(n),u=new ke(d,l);return u.emptyItemCount()>Zf&&(u=u.compress(this.items.length-n.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(t.slice(n)),c=a&&a.getMap();if(n--,c&&t.appendMap(c,n),a){let d=o.selection&&o.selection.map(t.slice(n));d&&s++;let u=new Oe(c.invert(),a,d),f,h=i.length-1;(f=i.length&&i[h].merge(u))?i[h]=f:i.push(u)}}else o.map&&n--},this.items.length,0),new ke(U.from(i.reverse()),s)}}ke.empty=new ke(U.empty,0);function Qf(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class Oe{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Oe(t.getMap().invert(),t,this.selection)}}}class _e{constructor(e,t,n,i,s){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=s}}const eh=20;function th(r,e,t,n){let i=t.getMeta(ft),s;if(i)return i.historyState;t.getMeta(ih)&&(r=new _e(r.done,r.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(o&&o.getMeta(ft))return o.getMeta(ft).redo?new _e(r.done.addTransform(t,void 0,n,Gn(e)),r.undone,hl(t.mapping.maps),r.prevTime,r.prevComposition):new _e(r.done,r.undone.addTransform(t,void 0,n,Gn(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=r.prevTime==0||!o&&r.prevComposition!=l&&(r.prevTime<(t.time||0)-n.newGroupDelay||!nh(t,r.prevRanges)),c=o?ri(r.prevRanges,t.mapping):hl(t.mapping.maps);return new _e(r.done.addTransform(t,a?e.selection.getBookmark():void 0,n,Gn(e)),ke.empty,c,t.time,l??r.prevComposition)}else return(s=t.getMeta("rebased"))?new _e(r.done.rebased(t,s),r.undone.rebased(t,s),ri(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new _e(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),ri(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function nh(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let s=0;s<e.length;s+=2)n<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function hl(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,s,o)=>e.push(s,o));return e}function ri(r,e){if(!r)return null;let t=[];for(let n=0;n<r.length;n+=2){let i=e.map(r[n],1),s=e.map(r[n+1],-1);i<=s&&t.push(i,s)}return t}function rh(r,e,t){let n=Gn(e),i=ft.get(e).spec.config,s=(t?r.undone:r.done).popEvent(e,n);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(t?r.done:r.undone).addTransform(s.transform,e.selection.getBookmark(),i,n),a=new _e(t?l:s.remaining,t?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(ft,{redo:t,historyState:a})}let ii=!1,pl=null;function Gn(r){let e=r.plugins;if(pl!=e){ii=!1,pl=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){ii=!0;break}}return ii}const ft=new Me("history"),ih=new Me("closeHistory");function sh(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new le({key:ft,state:{init(){return new _e(ke.empty,ke.empty,null,0,-1)},apply(e,t,n){return th(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?gl:n=="historyRedo"?yl:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function ml(r,e){return(t,n)=>{let i=ft.getState(t);if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let s=rh(i,t,r);s&&n(e?s.scrollIntoView():s)}return!0}}const gl=ml(!1,!0),yl=ml(!0,!0),oh=Z.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:r,dispatch:e})=>gl(r,e),redo:()=>({state:r,dispatch:e})=>yl(r,e)}},addProseMirrorPlugins(){return[sh(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),lh=oe.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:r}){return["hr",K(this.options.HTMLAttributes,r)]},addCommands(){return{setHorizontalRule:()=>({chain:r,state:e})=>{if(!Sf(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$from:n,$to:i}=t,s=r();return n.parentOffset===0?s.insertContentAt({from:Math.max(n.pos-1,0),to:i.pos},{type:this.name}):Zu(t)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:o,dispatch:l})=>{var a;if(l){const{$to:c}=o.selection,d=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?o.setSelection(M.create(o.doc,c.pos+1)):c.nodeAfter.isBlock?o.setSelection(S.create(o.doc,c.pos)):o.setSelection(M.create(o.doc,c.pos));else{const u=(a=c.parent.type.contentMatch.defaultType)===null||a===void 0?void 0:a.create();u&&(o.insert(d,u),o.setSelection(M.create(o.doc,d+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[al({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),ah=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,ch=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,dh=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,uh=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,fh=Te.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:r=>r.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:r=>r.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:r}){return["em",K(this.options.HTMLAttributes,r),0]},addCommands(){return{setItalic:()=>({commands:r})=>r.setMark(this.name),toggleItalic:()=>({commands:r})=>r.toggleMark(this.name),unsetItalic:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[dt({find:ah,type:this.type}),dt({find:dh,type:this.type})]},addPasteRules(){return[ut({find:ch,type:this.type}),ut({find:uh,type:this.type})]}}),hh=oe.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:r}){return["li",K(this.options.HTMLAttributes,r),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),ph="listItem",bl="textStyle",kl=/^(\d+)\.\s$/,mh=oe.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:r=>r.hasAttribute("start")?parseInt(r.getAttribute("start")||"",10):1},type:{default:null,parseHTML:r=>r.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:r}){const{start:e,...t}=r;return e===1?["ol",K(this.options.HTMLAttributes,t),0]:["ol",K(this.options.HTMLAttributes,r),0]},addCommands(){return{toggleOrderedList:()=>({commands:r,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ph,this.editor.getAttributes(bl)).run():r.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let r=Qt({find:kl,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(r=Qt({find:kl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(bl)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[r]}}),gh=oe.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:r}){return["p",K(this.options.HTMLAttributes,r),0]},addCommands(){return{setParagraph:()=>({commands:r})=>r.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),yh=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,bh=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,kh=Te.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:r=>r.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:r}){return["s",K(this.options.HTMLAttributes,r),0]},addCommands(){return{setStrike:()=>({commands:r})=>r.setMark(this.name),toggleStrike:()=>({commands:r})=>r.toggleMark(this.name),unsetStrike:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[dt({find:yh,type:this.type})]},addPasteRules(){return[ut({find:bh,type:this.type})]}}),xh=oe.create({name:"text",group:"inline"}),Sh=Z.create({name:"starterKit",addExtensions(){const r=[];return this.options.bold!==!1&&r.push(Af.configure(this.options.bold)),this.options.blockquote!==!1&&r.push(wf.configure(this.options.blockquote)),this.options.bulletList!==!1&&r.push(vf.configure(this.options.bulletList)),this.options.code!==!1&&r.push(Rf.configure(this.options.code)),this.options.codeBlock!==!1&&r.push(Lf.configure(this.options.codeBlock)),this.options.document!==!1&&r.push(zf.configure(this.options.document)),this.options.dropcursor!==!1&&r.push(Vf.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&r.push(_f.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&r.push(Gf.configure(this.options.hardBreak)),this.options.heading!==!1&&r.push(Yf.configure(this.options.heading)),this.options.history!==!1&&r.push(oh.configure(this.options.history)),this.options.horizontalRule!==!1&&r.push(lh.configure(this.options.horizontalRule)),this.options.italic!==!1&&r.push(fh.configure(this.options.italic)),this.options.listItem!==!1&&r.push(hh.configure(this.options.listItem)),this.options.orderedList!==!1&&r.push(mh.configure(this.options.orderedList)),this.options.paragraph!==!1&&r.push(gh.configure(this.options.paragraph)),this.options.strike!==!1&&r.push(kh.configure(this.options.strike)),this.options.text!==!1&&r.push(xh.configure(this.options.text)),r}}),Mh=r=>{if(!r.children.length)return;const e=r.querySelectorAll("span");e&&e.forEach(t=>{var n,i;const s=t.getAttribute("style"),o=(i=(n=t.parentElement)===null||n===void 0?void 0:n.closest("span"))===null||i===void 0?void 0:i.getAttribute("style");t.setAttribute("style",`${o};${s}`)})},wh=Te.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:r=>r.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&Mh(r),{}):!1}]},renderHTML({HTMLAttributes:r}){return["span",K(this.options.HTMLAttributes,r),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:r})=>{const{selection:e}=r;return r.doc.nodesBetween(e.from,e.to,(t,n)=>{if(t.isTextblock)return!0;t.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(s=>!!s))||r.removeMark(n,n+t.nodeSize,this.type)}),!0}}}}),Ch=Z.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:r=>{var e;return(e=r.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:r=>r.color?{style:`color: ${r.color}`}:{}}}}]},addCommands(){return{setColor:r=>({chain:e})=>e().setMark("textStyle",{color:r}).run(),unsetColor:()=>({chain:r})=>r().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),Th=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Oh=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,Eh=Te.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:r=>r.getAttribute("data-color")||r.style.backgroundColor,renderHTML:r=>r.color?{"data-color":r.color,style:`background-color: ${r.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:r}){return["mark",K(this.options.HTMLAttributes,r),0]},addCommands(){return{setHighlight:r=>({commands:e})=>e.setMark(this.name,r),toggleHighlight:r=>({commands:e})=>e.toggleMark(this.name,r),unsetHighlight:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[dt({find:Th,type:this.type})]},addPasteRules(){return[ut({find:Oh,type:this.type})]}}),Ah=Z.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:r=>{const e=r.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:r=>r.textAlign?{style:`text-align: ${r.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:r=>({commands:e})=>this.options.alignments.includes(r)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:r})).every(t=>t):!1,unsetTextAlign:()=>({commands:r})=>this.options.types.map(e=>r.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:r=>({editor:e,commands:t})=>this.options.alignments.includes(r)?e.isActive({textAlign:r})?t.unsetTextAlign():t.setTextAlign(r):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),Nh=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,vh=oe.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:r}){return["img",K(this.options.HTMLAttributes,r)]},addCommands(){return{setImage:r=>({commands:e})=>e.insertContent({type:this.name,attrs:r})}},addInputRules(){return[al({find:Nh,type:this.type,getAttributes:r=>{const[,,e,t,n]=r;return{src:t,alt:e,title:n}}})]}});class Dh extends Rl{constructor(){super();V(this,he);V(this,ce,null);V(this,ln,null);V(this,an,null)}connectedCallback(){super.connectedCallback()&&(A(this,he,Cl).call(this),A(this,he,Tl).call(this),A(this,he,ui).call(this))}get value(){return D(this,ce).getHTML()}set value(t){let n=t||"";n&&!/<\/?[a-z][^>]*>/i.test(n)&&(n=n.split(`
|
|
94
94
|
`).map(i=>`<p>${i}</p>`).join("")),D(this,ce)?D(this,ce).commands.setContent(n,!1):re(this,an,n)}get id(){return this.getAttribute("id")}set id(t){this.setAttribute("id",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get readonly(){return this.hasAttribute("readonly")}set readonly(t){t?this.setAttribute("readonly",""):this.removeAttribute("readonly"),A(this,he,ui).call(this)}disconnectedCallback(){D(this,ce)&&(D(this,ce).destroy(),re(this,ce,null))}}ce=new WeakMap,ln=new WeakMap,an=new WeakMap,he=new WeakSet,ui=function(){if(D(this,ce)){const t=this.readonly;D(this,ce).setEditable(!t);const n=this.shadowRoot.querySelector(".menu-bar");n&&(n.style.display=t?"none":"flex")}},Cl=function(){const t=Ge.getComponentCssPath("nineEditor.css"),n=t?`@import "${t}";`:"";this.shadowRoot.innerHTML=`
|
|
95
95
|
<style>
|
|
96
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.
|
|
96
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.141/dist/css/nineEditor.css";
|
|
97
97
|
${n}
|
|
98
98
|
</style>
|
|
99
99
|
|
|
@@ -130,7 +130,7 @@ img.ProseMirror-separator {
|
|
|
130
130
|
<div id="editor-container"></div>
|
|
131
131
|
`,re(this,ln,this.shadowRoot.querySelector("#editor-container")),this.shadowRoot.querySelector("#font-size").onchange=i=>{const s=i.target.value;console.log(i.target,s),D(this,ce).chain().focus().setMark("textStyle",{fontSize:s}).run()}},Tl=function(){re(this,ce,new xf({element:D(this,ln),editable:!this.readonly,extensions:[Sh,Ch,Eh.configure({multicolor:!0}),Ah.configure({types:["heading","paragraph"]}),vh.configure({inline:!0,allowBase64:!0}),wh.extend({addAttributes(){return{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}})],content:D(this,an)||this.originContents||"",onUpdate:({editor:t})=>{this.dispatchEvent(new CustomEvent("change",{detail:t.getHTML()}))},onSelectionUpdate:({editor:t})=>{this.readonly||A(this,he,Ol).call(this,t)}})),A(this,he,El).call(this)},Ol=function(t){this.shadowRoot.querySelectorAll("[data-cmd]").forEach(o=>{t.isActive(o.dataset.cmd)?o.classList.add("is-active"):o.classList.remove("is-active")}),this.shadowRoot.querySelectorAll("[data-align]").forEach(o=>{t.isActive({textAlign:o.dataset.align})?o.classList.add("is-active"):o.classList.remove("is-active")});const n=t.getAttributes("textStyle"),i=this.shadowRoot.querySelector("#font-size");i&&(i.value=n.fontSize||"14px");const s=this.shadowRoot.querySelector("#color-picker");s&&(s.value=n.color||"#000000")},El=function(){const t=D(this,ce);this.shadowRoot.querySelectorAll("[data-cmd]").forEach(n=>{n.onclick=()=>{const i=n.dataset.cmd;i==="bold"&&t.chain().focus().toggleBold().run(),i==="italic"&&t.chain().focus().toggleItalic().run(),i==="underline"&&t.chain().focus().toggleUnderline().run(),i==="strike"&&t.chain().focus().toggleStrike().run(),i==="highlight"&&t.chain().focus().toggleHighlight().run(),i==="bulletList"&&t.chain().focus().toggleBulletList().run(),i==="orderedList"&&t.chain().focus().toggleOrderedList().run(),i==="undo"&&t.chain().focus().undo().run(),i==="redo"&&t.chain().focus().redo().run()}}),this.shadowRoot.querySelector("#color-picker").oninput=n=>{t.chain().focus().setColor(n.target.value).run()},this.shadowRoot.querySelectorAll("[data-align]").forEach(n=>{n.onclick=()=>t.chain().focus().setTextAlign(n.dataset.align).run()}),this.shadowRoot.querySelector("#img-btn").onclick=()=>{const n=window.prompt("Image URL");n&&t.chain().focus().setImage({src:n}).run()}};const Ie=typeof window<"u"&&window.nine?window.nine:N.nine,xl={alert:window.alert,confirm:window.confirm},Sl=()=>{var t;console.log(Ie,window.nine);const{nativeOverride:r}=((t=Ie==null?void 0:Ie.config)==null?void 0:t.ux)||{},e=Array.isArray(r)?r:r===!0?["alert","confirm"]:[];console.log(Ie,e),window.alert=e.includes("alert")?n=>Ge.alert(n):xl.alert,window.confirm=e.includes("confirm")?async n=>await Ge.confirm(n):xl.confirm,Ie.config.debug&&e.length>0&&console.log(`[nine-ux] Native API Overridden: ${e.join(", ")}`)};(()=>{Sl(),Ie==null||Ie.subscribeConfig(r=>{(r==="ux"||r==="config")&&Sl()})})();class Ih extends HTMLElement{constructor(){super();V(this,xe);V(this,Et,!1);V(this,At);re(this,At,this.attachShadow({mode:"open"}))}static get observedAttributes(){return["lang","code"]}connectedCallback(){!this.getAttribute("code")&&this.textContent.trim()&&this.setAttribute("code",this.textContent.trim()),A(this,xe,dn).call(this)}attributeChangedCallback(){A(this,xe,dn).call(this)}}Et=new WeakMap,At=new WeakMap,xe=new WeakSet,Al=async function(){const t=this.getAttribute("code")||"";try{await navigator.clipboard.writeText(t),re(this,Et,!0),A(this,xe,dn).call(this),setTimeout(()=>{re(this,Et,!1),A(this,xe,dn).call(this)},2e3)}catch(n){console.error("Code copy failed:",n)}},dn=function(){const t=this.getAttribute("lang")||"Bash",n=this.getAttribute("code")||this.textContent.trim()||"",i=this.getAttribute("css-path");D(this,At).innerHTML=`
|
|
132
132
|
<style>
|
|
133
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.
|
|
133
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.141/dist/css/nine-code-block.css";
|
|
134
134
|
${i?`@import "${i}";`:""}
|
|
135
135
|
</style>
|
|
136
136
|
|
|
@@ -150,13 +150,11 @@ img.ProseMirror-separator {
|
|
|
150
150
|
</div>
|
|
151
151
|
`,D(this,At).querySelector(".copy-btn").onclick=()=>A(this,xe,Al).call(this)},Nl=function(t){const n=document.createElement("div");return n.textContent=t,n.innerHTML},typeof window<"u"&&(customElements.get("nine-code-block")||customElements.define("nine-code-block",Ih));class Rh extends HTMLElement{constructor(){super();V(this,F);V(this,Nt);V(this,vt);V(this,Dt,[]);this.attachShadow({mode:"open"})}set data(t){re(this,Dt,t),A(this,F,Dl).call(this),A(this,F,pi).call(this)}connectedCallback(){A(this,F,vl).call(this),setTimeout(()=>A(this,F,pi).call(this),300)}toggleGroup(t){const n=t.classList.toggle("expand");A(this,F,mi).call(this,t,n)}expand(){A(this,F,hi).call(this,"collapse"),document.body.style.width=`calc(100% - ${D(this,vt)}px)`}collapse(){A(this,F,fi).call(this,"collapse"),document.body.style.width=`calc(100% - ${D(this,Nt)}px)`}}Nt=new WeakMap,vt=new WeakMap,Dt=new WeakMap,F=new WeakSet,vl=function(){re(this,Nt,Number(this.getAttribute("min-width")||48)),re(this,vt,Number(this.getAttribute("max-width")||256));const t=Ge.getComponentCssPath("nineMenu.css");this.shadowRoot.innerHTML=`
|
|
152
152
|
<style>
|
|
153
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.
|
|
153
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.141/dist/css/nineMenu.css";
|
|
154
154
|
${t?`@import "${t}";`:""}
|
|
155
155
|
:host {
|
|
156
156
|
--min-width: ${D(this,Nt)}px;
|
|
157
157
|
--max-width: ${D(this,vt)}px;
|
|
158
|
-
display: flex;
|
|
159
|
-
flex-direction: column;
|
|
160
158
|
}
|
|
161
159
|
</style>
|
|
162
160
|
<slot name="head"></slot>
|
|
@@ -166,13 +164,7 @@ img.ProseMirror-separator {
|
|
|
166
164
|
icon-class="${i?"icon-home":"icon-base"}"
|
|
167
165
|
href="${n.path||""}" title="${n.name}">
|
|
168
166
|
${n.name}${s}
|
|
169
|
-
</nine-side-menu-item>`}).join("")},fi=function(t){this.classList.add(t),this.querySelectorAll("nine-side-menu-head, nine-side-menu-foot, nine-side-menu-body, nine-side-menu-item").forEach(n=>{n.classList.add(t)})},hi=function(t){this.classList.remove(t),this.querySelectorAll("nine-side-menu-head, nine-side-menu-foot, nine-side-menu-body, nine-side-menu-item").forEach(n=>{n.classList.remove(t)})},pi=function(){if(this.querySelector("nine-side-menu-item.active"))return;const t=window.location.pathname,n=this.querySelector(`nine-side-menu-item[href="${t}"]`);n&&(n.classList.add("active"),A(this,F,Il).call(this,n))},Il=function(t){let n=t.previousElementSibling;for(;n&&n.tagName==="NINE-SIDE-MENU-ITEM";){if(n.getAttribute("type")==="group"){n.classList.add("expand"),A(this,F,mi).call(this,n,!0);break}n=n.previousElementSibling}},mi=function(t,n){const i=Array.from(this.querySelectorAll("nine-side-menu-item")),s=i.indexOf(t);if(s!==-1)for(let o=s+1;o<i.length&&i[o].getAttribute("type")!=="group";o++)i[o].classList.toggle("hide",!n)};class Ph extends HTMLElement{connectedCallback(){const e=this.getAttribute("icon-color")||"#eee",t=this.innerHTML.trim();this.innerHTML=`
|
|
170
|
-
<style>
|
|
171
|
-
:host {
|
|
172
|
-
--icon-color: ${e};
|
|
173
|
-
}
|
|
174
|
-
</style>
|
|
175
|
-
|
|
167
|
+
</nine-side-menu-item>`}).join("")},fi=function(t){this.classList.add(t),this.querySelectorAll("nine-side-menu-head, nine-side-menu-foot, nine-side-menu-body, nine-side-menu-item").forEach(n=>{n.classList.add(t)})},hi=function(t){this.classList.remove(t),this.querySelectorAll("nine-side-menu-head, nine-side-menu-foot, nine-side-menu-body, nine-side-menu-item").forEach(n=>{n.classList.remove(t)})},pi=function(){if(this.querySelector("nine-side-menu-item.active"))return;const t=window.location.pathname,n=this.querySelector(`nine-side-menu-item[href="${t}"]`);n&&(n.classList.add("active"),A(this,F,Il).call(this,n))},Il=function(t){let n=t.previousElementSibling;for(;n&&n.tagName==="NINE-SIDE-MENU-ITEM";){if(n.getAttribute("type")==="group"){n.classList.add("expand"),A(this,F,mi).call(this,n,!0);break}n=n.previousElementSibling}},mi=function(t,n){const i=Array.from(this.querySelectorAll("nine-side-menu-item")),s=i.indexOf(t);if(s!==-1)for(let o=s+1;o<i.length&&i[o].getAttribute("type")!=="group";o++)i[o].classList.toggle("hide",!n)};class Ph extends HTMLElement{connectedCallback(){const e=this.getAttribute("icon-color")||"#eee",t=this.innerHTML.trim();this.style.setProperty("--icon-color",e),this.innerHTML=`
|
|
176
168
|
<div class="logo-box">
|
|
177
169
|
${t}
|
|
178
170
|
</div>
|
|
@@ -188,13 +180,7 @@ img.ProseMirror-separator {
|
|
|
188
180
|
<path fill-rule="evenodd" d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5"/>
|
|
189
181
|
</svg>
|
|
190
182
|
</div>
|
|
191
|
-
`;const n=this.closest("nine-side-menu");n&&(this.querySelector(".icon:nth-of-type(1)").addEventListener("click",i=>{n.expand()}),this.querySelectorAll(".icon:nth-of-type(2),.icon:nth-of-type(3)").forEach(i=>{i.addEventListener("click",s=>{n.collapse()})}))}}class Bh extends HTMLElement{connectedCallback(){const e=this.getAttribute("icon-color")||"#eee",t=this.innerHTML.trim();this.innerHTML=`
|
|
192
|
-
<style>
|
|
193
|
-
:host {
|
|
194
|
-
--icon-color: ${e};
|
|
195
|
-
}
|
|
196
|
-
</style>
|
|
197
|
-
|
|
183
|
+
`;const n=this.closest("nine-side-menu");n&&(this.querySelector(".icon:nth-of-type(1)").addEventListener("click",i=>{n.expand()}),this.querySelectorAll(".icon:nth-of-type(2),.icon:nth-of-type(3)").forEach(i=>{i.addEventListener("click",s=>{n.collapse()})}))}}class Bh extends HTMLElement{connectedCallback(){const e=this.getAttribute("icon-color")||"#eee",t=this.innerHTML.trim();this.style.setProperty("--icon-color",e),this.innerHTML=`
|
|
198
184
|
<div class="logo-box">
|
|
199
185
|
${t}
|
|
200
186
|
</div>
|