@nine-lab/nine-ux 0.1.129 → 0.1.130
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 +170 -51
- package/dist/nine-ux.js +3 -3
- package/dist/nine-ux.umd.js +3 -3
- package/package.json +1 -1
package/dist/css/nineMenu.css
CHANGED
|
@@ -1,63 +1,182 @@
|
|
|
1
|
-
/* ---
|
|
1
|
+
/* --- [1] 부모 컴포넌트: nine-side-menu --- */
|
|
2
2
|
:host(nine-side-menu) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
/* 1. 호스트 자체 스타일 */
|
|
4
|
+
opacity: 0.95;
|
|
5
|
+
position: fixed;
|
|
6
|
+
top: 0;
|
|
7
|
+
bottom: 0;
|
|
8
|
+
left: 0;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
z-index: 1002;
|
|
12
|
+
color: #fff;
|
|
13
|
+
font-weight: 200;
|
|
14
|
+
background: #181A31;
|
|
6
15
|
box-shadow: 4px 4px 10px rgba(69, 65, 78, .06);
|
|
7
|
-
overflow: hidden;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
width: var(--min-width);
|
|
8
18
|
transition: width 0.2s ease-in-out;
|
|
9
|
-
}
|
|
10
19
|
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
/* 2. 상태별 너비 제어 */
|
|
21
|
+
&.collapse {
|
|
22
|
+
width: var(--min-width);
|
|
23
|
+
&:hover { width: var(--max-width); }
|
|
24
|
+
}
|
|
25
|
+
&:not(.collapse) {
|
|
26
|
+
width: var(--max-width);
|
|
27
|
+
}
|
|
13
28
|
|
|
14
|
-
/*
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
/* 3. 내부 레이아웃 */
|
|
30
|
+
& .body-wrapper {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
align-items: flex-start;
|
|
34
|
+
margin-top: 32px;
|
|
35
|
+
width: 100%;
|
|
36
|
+
flex: 1;
|
|
37
|
+
overflow-y: auto;
|
|
38
|
+
}
|
|
20
39
|
|
|
21
|
-
/*
|
|
22
|
-
:host(nine-side-menu-head), :host(nine-side-menu-foot) {
|
|
23
|
-
display: flex; align-items: center; padding: 10px; height: 50px; box-sizing: border-box;
|
|
24
|
-
& .logo-box { color: #f0f0f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; width: 100%; transition: width 0.3s; }
|
|
25
|
-
& .icon-box { display: flex; align-items: center; cursor: pointer; & .icon { fill: var(--icon-color, #eee); transition: opacity 0.3s; display: none; opacity: 0; } }
|
|
26
|
-
}
|
|
40
|
+
/* 4. 슬롯/자식 요소 스타일 (Shadow DOM 제거 버전) */
|
|
27
41
|
|
|
28
|
-
/* Head
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
/* [Head 영역] */
|
|
43
|
+
& nine-side-menu-head {
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
padding: 10px;
|
|
48
|
+
height: 40px;
|
|
49
|
+
box-sizing: border-box;
|
|
50
|
+
|
|
51
|
+
& .logo-box {
|
|
52
|
+
color: #f0f0f0; white-space: nowrap; overflow: hidden;
|
|
53
|
+
text-overflow: ellipsis; text-align: center; width: 100%;
|
|
54
|
+
transition: width 0.5s ease-out;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
& .icon-box {
|
|
58
|
+
display: flex; align-items: center; overflow: hidden;
|
|
59
|
+
& .icon {
|
|
60
|
+
fill: var(--icon-color, #eee); cursor: pointer;
|
|
61
|
+
transition: opacity 0.3s ease-in-out; display: none; opacity: 0;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Head 상태 제어 */
|
|
66
|
+
&.collapse {
|
|
67
|
+
& .logo-box { width: 0; }
|
|
68
|
+
& .icon:first-child { display: block; opacity: 1; }
|
|
69
|
+
&:hover, &.hover { & .logo-box { width: 100%; } }
|
|
70
|
+
}
|
|
71
|
+
&:not(.collapse) {
|
|
72
|
+
& .logo-box { width: 100%; }
|
|
73
|
+
& .icon:nth-child(2) { display: block; opacity: 1; }
|
|
74
|
+
& .icon-box:hover .icon:nth-child(2) { display: none; }
|
|
75
|
+
& .icon-box:hover .icon:nth-child(3) { display: block; opacity: 1; }
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* [Body 영역] */
|
|
80
|
+
& nine-side-menu-body {
|
|
81
|
+
display: flex; width: 100%; padding: 10px; height: 40px;
|
|
82
|
+
justify-content: center; overflow: auto;
|
|
83
|
+
& ul.side-menu-body {
|
|
84
|
+
width: 100%; padding: 0; margin: 0;
|
|
85
|
+
display: flex; flex-direction: column;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* [Item 영역] */
|
|
90
|
+
& nine-side-menu-item {
|
|
91
|
+
display: flex; position: relative; padding: 0; margin: 0;
|
|
92
|
+
cursor: pointer; color: #999; font-weight: bold;
|
|
93
|
+
max-height: 64px; opacity: 1; box-sizing: border-box;
|
|
94
|
+
transition: max-height 0.5s ease-in-out, opacity 0.5s ease-in-out, height 0.5s ease-out;
|
|
95
|
+
|
|
96
|
+
&.group {
|
|
97
|
+
height: 48px;
|
|
98
|
+
& li { list-style-type: none; }
|
|
99
|
+
& .menubar { font-weight: 700; }
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&:not(.group) {
|
|
103
|
+
height: 32px;
|
|
104
|
+
& li {
|
|
105
|
+
list-style-type: unset;
|
|
106
|
+
&::before { content: '•'; margin-right: 8px; margin-left: 16px; }
|
|
107
|
+
}
|
|
108
|
+
& .menubar { font-weight: 400; }
|
|
109
|
+
& .icon, & .expand-icon { display: none; }
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&.active { color: #9FF2FF; background: rgba(255,255,255,0.05); }
|
|
113
|
+
&.hide { max-height: 0; opacity: 0; overflow: hidden; }
|
|
114
|
+
&:hover { filter: brightness(90%); }
|
|
115
|
+
|
|
116
|
+
/* Item 내부 요소 */
|
|
117
|
+
& li { display: flex; align-items: center; width: calc(100% + 36px); color: inherit; }
|
|
118
|
+
& .menubar {
|
|
119
|
+
margin-left: 8px; white-space: nowrap; overflow: hidden;
|
|
120
|
+
text-overflow: ellipsis; text-align: left;
|
|
121
|
+
transition: width 0.5s ease-out, height 0.5s ease-out, padding 0.5s ease-out;
|
|
122
|
+
}
|
|
123
|
+
& .icon {
|
|
124
|
+
width: 16px; height: 16px; margin-left: 8px;
|
|
125
|
+
background-repeat: no-repeat; background-position: center; background-size: contain;
|
|
126
|
+
transition: width 0.5s ease-out, height 0.5s ease-out, margin 0.5s ease-out;
|
|
127
|
+
}
|
|
128
|
+
& .expand-icon {
|
|
129
|
+
width: 8px; height: 8px; position: absolute; right: 16px;
|
|
130
|
+
background-repeat: no-repeat; background-position: center; background-size: auto;
|
|
131
|
+
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" fill="white" viewBox="0 0 16 16"><path d="M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"/></svg>');
|
|
132
|
+
transition: transform 0.3s ease-in-out;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* 확장/축소 아이콘 회전 */
|
|
136
|
+
&:not(.expand) .expand-icon { transform: rotate(180deg); }
|
|
137
|
+
|
|
138
|
+
/* [Collapse 모드에서의 Item 제어] */
|
|
139
|
+
:host(.collapse:not(:hover)) & {
|
|
140
|
+
&:not(.group) { opacity: 0; height: 0; overflow: hidden; }
|
|
141
|
+
& li { justify-content: center; }
|
|
142
|
+
& .icon { width: 20px; height: 20px; margin-left: 4px; }
|
|
143
|
+
& .menubar, & .expand-icon { display: none; }
|
|
144
|
+
}
|
|
145
|
+
}
|
|
39
146
|
|
|
40
|
-
/*
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
147
|
+
/* [Foot 영역] */
|
|
148
|
+
& nine-side-menu-foot {
|
|
149
|
+
display: flex; align-items: center; padding: 10px; height: 40px; box-sizing: border-box;
|
|
150
|
+
& .logo-box {
|
|
151
|
+
color: #f0f0f0; white-space: nowrap; overflow: hidden;
|
|
152
|
+
text-overflow: ellipsis; text-align: center; width: 100%;
|
|
153
|
+
display: flex; justify-content: space-between;
|
|
154
|
+
transition: width 0.5s ease-out;
|
|
155
|
+
}
|
|
156
|
+
& .icon-box {
|
|
157
|
+
display: flex; align-items: center; overflow: hidden;
|
|
158
|
+
& .icon { fill: var(--icon-color, #eee); cursor: pointer; transition: opacity 0.3s; display: none; opacity: 0; }
|
|
159
|
+
}
|
|
160
|
+
&.collapse {
|
|
161
|
+
& .logo-box { width: 0; justify-content: center; }
|
|
162
|
+
& .icon:first-child { display: block; opacity: 1; }
|
|
163
|
+
&:hover { & .logo-box { width: 100%; justify-content: space-between; } }
|
|
164
|
+
}
|
|
165
|
+
&:not(.collapse) {
|
|
166
|
+
& .logo-box { width: 100%; justify-content: space-between; }
|
|
167
|
+
& .icon:nth-child(2) { display: block; opacity: 1; }
|
|
168
|
+
& .icon-box:hover { & .icon:nth-child(2) { display: none; } & .icon:nth-child(3) { display: block; opacity: 1; } }
|
|
169
|
+
}
|
|
170
|
+
}
|
|
53
171
|
}
|
|
54
172
|
|
|
55
|
-
/*
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
&:not(.group) { height: 0; opacity: 0; }
|
|
173
|
+
/* --- [2] 전역 애니메이션 --- */
|
|
174
|
+
@keyframes bounce {
|
|
175
|
+
0%, 20%, 50%, 80%, 100% { transform: translateX(0); }
|
|
176
|
+
40% { transform: translateX(-10px); }
|
|
177
|
+
60% { transform: translateX(10px); }
|
|
61
178
|
}
|
|
62
179
|
|
|
63
|
-
|
|
180
|
+
/* 애니메이션 정의 */
|
|
181
|
+
@keyframes rotate-in { from { transform: rotate(0deg); } to { transform: rotate(180deg); } }
|
|
182
|
+
@keyframes rotate-out { from { transform: rotate(180deg); } to { transform: rotate(0deg); } }
|
package/dist/nine-ux.js
CHANGED
|
@@ -14082,7 +14082,7 @@ Fr = function() {
|
|
|
14082
14082
|
const t = kn.getComponentCssPath("nineEditor.css"), r = 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.130/dist/css/nineEditor.css";
|
|
14086
14086
|
${r}
|
|
14087
14087
|
</style>
|
|
14088
14088
|
|
|
@@ -14229,7 +14229,7 @@ kt = new WeakMap(), xt = new WeakMap(), ge = new WeakSet(), Cl = async function(
|
|
|
14229
14229
|
const t = this.getAttribute("lang") || "Bash", r = this.getAttribute("code") || this.textContent.trim() || "", i = this.getAttribute("css-path");
|
|
14230
14230
|
A(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.130/dist/css/nine-code-block.css";
|
|
14233
14233
|
${i ? `@import "${i}";` : ""}
|
|
14234
14234
|
</style>
|
|
14235
14235
|
|
|
@@ -14281,7 +14281,7 @@ St = new WeakMap(), Mt = new WeakMap(), Ct = new WeakMap(), We = new WeakSet(),
|
|
|
14281
14281
|
const t = kn.getComponentCssPath("nineMenu.css");
|
|
14282
14282
|
this.shadowRoot.innerHTML = `
|
|
14283
14283
|
<style>
|
|
14284
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.
|
|
14284
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.130/dist/css/nineMenu.css";
|
|
14285
14285
|
${t ? `@import "${t}";` : ""}
|
|
14286
14286
|
:host { --min-width: ${A(this, St)}px; --max-width: ${A(this, Mt)}px; }
|
|
14287
14287
|
</style>
|
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()}}}),_f=se.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]}`,J(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=>ni({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${r}})\\s$`),type:this.type,getAttributes:{level:r}}))}});var _n=200,K=function(){};K.prototype.append=function(e){return e.length?(e=K.from(e),!this.length&&e||e.length<_n&&this.leafAppend(e)||this.length<_n&&e.leafPrepend(this)||this.appendInner(e)):this},K.prototype.prepend=function(e){return e.length?K.from(e).append(this):this},K.prototype.appendInner=function(e){return new Gf(this,e)},K.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?K.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},K.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},K.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)},K.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},K.from=function(e){return e instanceof K?e:e&&e.length?new cl(e):K.empty};var cl=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}(K);K.empty=new cl([]);var Gf=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}(K);const Yf=500;class be{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 Te(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 Te(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 be(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 Te(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>Zf&&(l=Xf(l,c),o-=c),new be(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 be(this.items.append(e.map(t=>new Te(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 Te(p,m,g))}else n.push(new Te(p))},i);let c=[];for(let f=t;f<o;f++)c.push(new Te(s.maps[f]));let d=this.items.slice(0,i).append(c).append(n),u=new be(d,l);return u.emptyItemCount()>Yf&&(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 Te(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 be(K.from(i.reverse()),s)}}be.empty=new be(K.empty,0);function Xf(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class Te{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 Te(t.getMap().invert(),t,this.selection)}}}class Ue{constructor(e,t,n,i,s){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=s}}const Zf=20;function Qf(r,e,t,n){let i=t.getMeta(ft),s;if(i)return i.historyState;t.getMeta(nh)&&(r=new Ue(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 Ue(r.done.addTransform(t,void 0,n,Gn(e)),r.undone,dl(t.mapping.maps),r.prevTime,r.prevComposition):new Ue(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||!eh(t,r.prevRanges)),c=o?ii(r.prevRanges,t.mapping):dl(t.mapping.maps);return new Ue(r.done.addTransform(t,a?e.selection.getBookmark():void 0,n,Gn(e)),be.empty,c,t.time,l??r.prevComposition)}else return(s=t.getMeta("rebased"))?new Ue(r.done.rebased(t,s),r.undone.rebased(t,s),ii(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new Ue(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),ii(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function eh(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 dl(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 ii(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 th(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 Ue(t?l:s.remaining,t?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(ft,{redo:t,historyState:a})}let si=!1,ul=null;function Gn(r){let e=r.plugins;if(ul!=e){si=!1,ul=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){si=!0;break}}return si}const ft=new Se("history"),nh=new Se("closeHistory");function rh(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new oe({key:ft,state:{init(){return new Ue(be.empty,be.empty,null,0,-1)},apply(e,t,n){return Qf(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?hl:n=="historyRedo"?pl:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function fl(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=th(i,t,r);s&&n(e?s.scrollIntoView():s)}return!0}}const hl=fl(!1,!0),pl=fl(!0,!0),ih=X.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:r,dispatch:e})=>hl(r,e),redo:()=>({state:r,dispatch:e})=>pl(r,e)}},addProseMirrorPlugins(){return[rh(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()}}}),sh=se.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:r}){return["hr",J(this.options.HTMLAttributes,r)]},addCommands(){return{setHorizontalRule:()=>({chain:r,state:e})=>{if(!kf(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}):Yu(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[sl({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),oh=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,lh=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,ah=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,ch=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,dh=we.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",J(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:oh,type:this.type}),dt({find:ah,type:this.type})]},addPasteRules(){return[ut({find:lh,type:this.type}),ut({find:ch,type:this.type})]}}),uh=se.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:r}){return["li",J(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)}}}),fh="listItem",ml="textStyle",gl=/^(\d+)\.\s$/,hh=se.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",J(this.options.HTMLAttributes,t),0]:["ol",J(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(fh,this.editor.getAttributes(ml)).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:gl,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:gl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(ml)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[r]}}),ph=se.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:r}){return["p",J(this.options.HTMLAttributes,r),0]},addCommands(){return{setParagraph:()=>({commands:r})=>r.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),mh=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,gh=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,yh=we.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",J(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:mh,type:this.type})]},addPasteRules(){return[ut({find:gh,type:this.type})]}}),bh=se.create({name:"text",group:"inline"}),kh=X.create({name:"starterKit",addExtensions(){const r=[];return this.options.bold!==!1&&r.push(Of.configure(this.options.bold)),this.options.blockquote!==!1&&r.push(Sf.configure(this.options.blockquote)),this.options.bulletList!==!1&&r.push(Nf.configure(this.options.bulletList)),this.options.code!==!1&&r.push(Df.configure(this.options.code)),this.options.codeBlock!==!1&&r.push(Pf.configure(this.options.codeBlock)),this.options.document!==!1&&r.push(Bf.configure(this.options.document)),this.options.dropcursor!==!1&&r.push($f.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&r.push(Kf.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&r.push(Uf.configure(this.options.hardBreak)),this.options.heading!==!1&&r.push(_f.configure(this.options.heading)),this.options.history!==!1&&r.push(ih.configure(this.options.history)),this.options.horizontalRule!==!1&&r.push(sh.configure(this.options.horizontalRule)),this.options.italic!==!1&&r.push(dh.configure(this.options.italic)),this.options.listItem!==!1&&r.push(uh.configure(this.options.listItem)),this.options.orderedList!==!1&&r.push(hh.configure(this.options.orderedList)),this.options.paragraph!==!1&&r.push(ph.configure(this.options.paragraph)),this.options.strike!==!1&&r.push(yh.configure(this.options.strike)),this.options.text!==!1&&r.push(bh.configure(this.options.text)),r}}),xh=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}`)})},Sh=we.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:r=>r.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&xh(r),{}):!1}]},renderHTML({HTMLAttributes:r}){return["span",J(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}}}}),Mh=X.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()}}}),Ch=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,wh=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,Th=we.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",J(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:Ch,type:this.type})]},addPasteRules(){return[ut({find:wh,type:this.type})]}}),Oh=X.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")}}}),Eh=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Nh=se.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",J(this.options.HTMLAttributes,r)]},addCommands(){return{setImage:r=>({commands:e})=>e.insertContent({type:this.name,attrs:r})}},addInputRules(){return[sl({find:Eh,type:this.type,getAttributes:r=>{const[,,e,t,n]=r;return{src:t,alt:e,title:n}}})]}});class Ah extends Dl{constructor(){super();z(this,fe);z(this,ae,null);z(this,ln,null);z(this,an,null)}connectedCallback(){super.connectedCallback()&&(R(this,fe,Sl).call(this),R(this,fe,Ml).call(this),R(this,fe,fi).call(this))}get value(){return v(this,ae).getHTML()}set value(t){let n=t||"";n&&!/<\/?[a-z][^>]*>/i.test(n)&&(n=n.split(`
|
|
94
94
|
`).map(i=>`<p>${i}</p>`).join("")),v(this,ae)?v(this,ae).commands.setContent(n,!1):ne(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"),R(this,fe,fi).call(this)}disconnectedCallback(){v(this,ae)&&(v(this,ae).destroy(),ne(this,ae,null))}}ae=new WeakMap,ln=new WeakMap,an=new WeakMap,fe=new WeakSet,fi=function(){if(v(this,ae)){const t=this.readonly;v(this,ae).setEditable(!t);const n=this.shadowRoot.querySelector(".menu-bar");n&&(n.style.display=t?"none":"flex")}},Sl=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.130/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
|
`,ne(this,ln,this.shadowRoot.querySelector("#editor-container")),this.shadowRoot.querySelector("#font-size").onchange=i=>{const s=i.target.value;console.log(i.target,s),v(this,ae).chain().focus().setMark("textStyle",{fontSize:s}).run()}},Ml=function(){ne(this,ae,new bf({element:v(this,ln),editable:!this.readonly,extensions:[kh,Mh,Th.configure({multicolor:!0}),Oh.configure({types:["heading","paragraph"]}),Nh.configure({inline:!0,allowBase64:!0}),Sh.extend({addAttributes(){return{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}})],content:v(this,an)||this.originContents||"",onUpdate:({editor:t})=>{this.dispatchEvent(new CustomEvent("change",{detail:t.getHTML()}))},onSelectionUpdate:({editor:t})=>{this.readonly||R(this,fe,Cl).call(this,t)}})),R(this,fe,wl).call(this)},Cl=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")},wl=function(){const t=v(this,ae);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 De=typeof window<"u"&&window.nine?window.nine:N.nine,yl={alert:window.alert,confirm:window.confirm},bl=()=>{var t;console.log(De,window.nine);const{nativeOverride:r}=((t=De==null?void 0:De.config)==null?void 0:t.ux)||{},e=Array.isArray(r)?r:r===!0?["alert","confirm"]:[];console.log(De,e),window.alert=e.includes("alert")?n=>Ge.alert(n):yl.alert,window.confirm=e.includes("confirm")?async n=>await Ge.confirm(n):yl.confirm,De.config.debug&&e.length>0&&console.log(`[nine-ux] Native API Overridden: ${e.join(", ")}`)};(()=>{bl(),De==null||De.subscribeConfig(r=>{(r==="ux"||r==="config")&&bl()})})();class vh extends HTMLElement{constructor(){super();z(this,ke);z(this,Et,!1);z(this,Nt);ne(this,Nt,this.attachShadow({mode:"open"}))}static get observedAttributes(){return["lang","code"]}connectedCallback(){!this.getAttribute("code")&&this.textContent.trim()&&this.setAttribute("code",this.textContent.trim()),R(this,ke,dn).call(this)}attributeChangedCallback(){R(this,ke,dn).call(this)}}Et=new WeakMap,Nt=new WeakMap,ke=new WeakSet,Tl=async function(){const t=this.getAttribute("code")||"";try{await navigator.clipboard.writeText(t),ne(this,Et,!0),R(this,ke,dn).call(this),setTimeout(()=>{ne(this,Et,!1),R(this,ke,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");v(this,Nt).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.130/dist/css/nine-code-block.css";
|
|
134
134
|
${i?`@import "${i}";`:""}
|
|
135
135
|
</style>
|
|
136
136
|
|
|
@@ -150,7 +150,7 @@ img.ProseMirror-separator {
|
|
|
150
150
|
</div>
|
|
151
151
|
`,v(this,Nt).querySelector(".copy-btn").onclick=()=>R(this,ke,Tl).call(this)},Ol=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",vh));class Dh extends HTMLElement{constructor(){super();z(this,_e);z(this,At);z(this,vt);z(this,Dt,[]);this.attachShadow({mode:"open"})}set data(t){ne(this,Dt,t),R(this,_e,Nl).call(this)}connectedCallback(){R(this,_e,El).call(this),setTimeout(()=>R(this,_e,Al).call(this),300)}expand(){this.classList.remove("collapse"),document.body.style.width=`calc(100% - ${v(this,vt)}px)`}collapse(){this.classList.add("collapse"),document.body.style.width=`calc(100% - ${v(this,At)}px)`}}At=new WeakMap,vt=new WeakMap,Dt=new WeakMap,_e=new WeakSet,El=function(){ne(this,At,Number(this.getAttribute("min-width")||48)),ne(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.130/dist/css/nineMenu.css";
|
|
154
154
|
${t?`@import "${t}";`:""}
|
|
155
155
|
:host { --min-width: ${v(this,At)}px; --max-width: ${v(this,vt)}px; }
|
|
156
156
|
</style>
|