@kubex/zinc 1.0.102 → 1.0.104
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/custom-elements.json +552 -1
- package/dist/vscode.html-custom-data.json +88 -0
- package/dist/web-types.json +202 -1
- package/dist/zn.d.ts +103 -0
- package/dist/zn.min.js +476 -345
- package/docs/pages/components/markdown-editor.md +301 -0
- package/docs/pages/components/sp.md +36 -0
- package/package.json +2 -1
- package/src/components/markdown-editor/index.ts +12 -0
- package/src/components/markdown-editor/markdown-editor.component.ts +332 -0
- package/src/components/markdown-editor/markdown-editor.scss +212 -0
- package/src/components/markdown-editor/markdown-editor.test.ts +22 -0
- package/src/components/sp/sp.component.ts +2 -0
- package/src/components/sp/sp.scss +13 -0
- package/src/zinc.ts +1 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
@use "../../wc";
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
width: 100%;
|
|
7
|
+
min-height: 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.markdown-editor {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
gap: var(--zn-spacing-small);
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 100%;
|
|
16
|
+
min-height: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.markdown-editor--expanded {
|
|
20
|
+
position: fixed;
|
|
21
|
+
inset: 10px;
|
|
22
|
+
z-index: 9999;
|
|
23
|
+
background: var(--zn-panel-background-color, var(--zn-color-neutral-0, #fff));
|
|
24
|
+
border: 1px solid var(--zn-color-neutral-300);
|
|
25
|
+
border-radius: var(--zn-border-radius-medium);
|
|
26
|
+
padding: var(--zn-spacing-medium);
|
|
27
|
+
box-shadow: var(--zn-shadow-large);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.markdown-editor__label {
|
|
31
|
+
font-size: var(--zn-input-label-font-size-medium);
|
|
32
|
+
color: var(--zn-input-label-color);
|
|
33
|
+
font-weight: var(--zn-font-weight-semibold);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.markdown-editor__toolbar {
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
gap: var(--zn-spacing-small);
|
|
40
|
+
justify-content: flex-end;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.markdown-editor__view-toggle {
|
|
44
|
+
display: inline-flex;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.markdown-editor__body {
|
|
48
|
+
display: flex;
|
|
49
|
+
flex: 1;
|
|
50
|
+
min-height: 0;
|
|
51
|
+
gap: var(--zn-spacing-medium);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.markdown-editor__editor,
|
|
55
|
+
.markdown-editor__preview-wrapper {
|
|
56
|
+
flex: 1;
|
|
57
|
+
min-width: 0;
|
|
58
|
+
min-height: 0;
|
|
59
|
+
display: flex;
|
|
60
|
+
|
|
61
|
+
&[hidden] {
|
|
62
|
+
display: none;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.markdown-editor__editor zn-textarea {
|
|
67
|
+
flex: 1;
|
|
68
|
+
width: 100%;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.markdown-editor__preview-wrapper {
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.markdown-editor__preview {
|
|
76
|
+
flex: 1;
|
|
77
|
+
background: var(--zn-color-neutral-0, white);
|
|
78
|
+
border: 1px solid var(--zn-color-neutral-200);
|
|
79
|
+
border-radius: var(--zn-border-radius-medium);
|
|
80
|
+
padding: var(--zn-spacing-x-large);
|
|
81
|
+
overflow-y: auto;
|
|
82
|
+
font-family: inherit;
|
|
83
|
+
line-height: 1.7;
|
|
84
|
+
color: var(--zn-color-text, #222);
|
|
85
|
+
|
|
86
|
+
h1 {
|
|
87
|
+
font-size: 1.8em;
|
|
88
|
+
margin: 0.8em 0 0.4em;
|
|
89
|
+
border-bottom: 1px solid var(--zn-color-neutral-200);
|
|
90
|
+
padding-bottom: 0.3em;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
h2 {
|
|
94
|
+
font-size: 1.5em;
|
|
95
|
+
margin: 0.8em 0 0.4em;
|
|
96
|
+
border-bottom: 1px solid var(--zn-color-neutral-200);
|
|
97
|
+
padding-bottom: 0.2em;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
h3 {
|
|
101
|
+
font-size: 1.25em;
|
|
102
|
+
margin: 0.7em 0 0.3em;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
h4,
|
|
106
|
+
h5,
|
|
107
|
+
h6 {
|
|
108
|
+
font-size: 1.1em;
|
|
109
|
+
margin: 0.6em 0 0.3em;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
p {
|
|
113
|
+
margin: 0.6em 0;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
ul,
|
|
117
|
+
ol {
|
|
118
|
+
margin: 0.6em 0;
|
|
119
|
+
padding-left: 2em;
|
|
120
|
+
display: block;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
ul {
|
|
124
|
+
list-style-type: disc;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
ol {
|
|
128
|
+
list-style-type: decimal;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
ul ul {
|
|
132
|
+
list-style-type: circle;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
ul ul ul {
|
|
136
|
+
list-style-type: square;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
li {
|
|
140
|
+
margin: 0.2em 0;
|
|
141
|
+
display: list-item;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
blockquote {
|
|
145
|
+
border-left: 4px solid var(--zn-color-neutral-300);
|
|
146
|
+
margin: 0.8em 0;
|
|
147
|
+
padding: 0.4em 1em;
|
|
148
|
+
color: var(--zn-color-neutral-600, #555);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
table {
|
|
152
|
+
border-collapse: collapse;
|
|
153
|
+
width: 100%;
|
|
154
|
+
margin: 0.8em 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
th,
|
|
158
|
+
td {
|
|
159
|
+
border: 1px solid var(--zn-color-neutral-300);
|
|
160
|
+
padding: 0.4em 0.8em;
|
|
161
|
+
text-align: left;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
th {
|
|
165
|
+
background: var(--zn-color-neutral-100);
|
|
166
|
+
font-weight: bold;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
code {
|
|
170
|
+
background: var(--zn-color-neutral-100);
|
|
171
|
+
padding: 0.15em 0.4em;
|
|
172
|
+
border-radius: 3px;
|
|
173
|
+
font-size: 0.9em;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
pre {
|
|
177
|
+
background: var(--zn-color-neutral-100);
|
|
178
|
+
padding: 1em;
|
|
179
|
+
border-radius: 4px;
|
|
180
|
+
overflow-x: auto;
|
|
181
|
+
|
|
182
|
+
code {
|
|
183
|
+
background: none;
|
|
184
|
+
padding: 0;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
hr {
|
|
189
|
+
border: none;
|
|
190
|
+
border-top: 1px solid var(--zn-color-neutral-300);
|
|
191
|
+
margin: 1.5em 0;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
a {
|
|
195
|
+
color: var(--zn-color-primary-600);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.markdown-editor__help-text {
|
|
200
|
+
font-size: var(--zn-input-help-text-font-size-medium);
|
|
201
|
+
color: var(--zn-input-help-text-color);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.markdown-editor--expanded .markdown-editor__body {
|
|
205
|
+
min-height: 0;
|
|
206
|
+
flex: 1;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.markdown-editor--expanded .markdown-editor__editor zn-textarea,
|
|
210
|
+
.markdown-editor--expanded .markdown-editor__preview {
|
|
211
|
+
min-height: calc(100vh - 200px);
|
|
212
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import '../../../dist/zn.min.js';
|
|
2
|
+
import {expect, fixture, html} from '@open-wc/testing';
|
|
3
|
+
|
|
4
|
+
describe('<zn-markdown-editor>', () => {
|
|
5
|
+
it('should render a component', async () => {
|
|
6
|
+
const el = await fixture(html`
|
|
7
|
+
<zn-markdown-editor></zn-markdown-editor>`);
|
|
8
|
+
expect(el).to.exist;
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should accept an initial value', async () => {
|
|
12
|
+
const el = await fixture<HTMLElement & { value: string }>(html`
|
|
13
|
+
<zn-markdown-editor value="# hello"></zn-markdown-editor>`);
|
|
14
|
+
expect(el.value).to.equal('# hello');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should read value from light-DOM text content when no value is set', async () => {
|
|
18
|
+
const el = await fixture<HTMLElement & { value: string }>(html`
|
|
19
|
+
<zn-markdown-editor>Body text</zn-markdown-editor>`);
|
|
20
|
+
expect(el.value).to.equal('Body text');
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -39,6 +39,8 @@ export default class ZnSp extends ZincElement {
|
|
|
39
39
|
@property({attribute: 'divide', type: Boolean, reflect: true}) divide: boolean = false;
|
|
40
40
|
@property({attribute: 'gap', reflect: true}) gap: keyof typeof defaultSizes;
|
|
41
41
|
@property({attribute: 'row', type: Boolean, reflect: true}) row: boolean = false;
|
|
42
|
+
@property({reflect: true}) align: 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
43
|
+
@property({reflect: true}) justify: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
|
|
42
44
|
@property({attribute: 'grow', type: Boolean, reflect: true}) grow: boolean = false;
|
|
43
45
|
@property({attribute: 'pad-x', type: Boolean, reflect: true}) padX: boolean = false;
|
|
44
46
|
@property({attribute: 'pad-y', type: Boolean, reflect: true}) padY: boolean = false;
|
|
@@ -107,3 +107,16 @@
|
|
|
107
107
|
padding-right: 0;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
+
|
|
111
|
+
:host([align="start"]) .sp { align-items: flex-start; }
|
|
112
|
+
:host([align="center"]) .sp { align-items: center; }
|
|
113
|
+
:host([align="end"]) .sp { align-items: flex-end; }
|
|
114
|
+
:host([align="stretch"]) .sp { align-items: stretch; }
|
|
115
|
+
:host([align="baseline"]) .sp { align-items: baseline; }
|
|
116
|
+
|
|
117
|
+
:host([justify="start"]) .sp { justify-content: flex-start; }
|
|
118
|
+
:host([justify="center"]) .sp { justify-content: center; }
|
|
119
|
+
:host([justify="end"]) .sp { justify-content: flex-end; }
|
|
120
|
+
:host([justify="between"]) .sp { justify-content: space-between; }
|
|
121
|
+
:host([justify="around"]) .sp { justify-content: space-around; }
|
|
122
|
+
:host([justify="evenly"]) .sp { justify-content: space-evenly; }
|
package/src/zinc.ts
CHANGED
|
@@ -93,6 +93,7 @@ export { default as AnimatedButton } from './components/animated-button';
|
|
|
93
93
|
export { default as TranslationGroup } from './components/translation-group';
|
|
94
94
|
export { default as OptGroup } from './components/opt-group';
|
|
95
95
|
export { default as PriorityList } from './components/priority-list';
|
|
96
|
+
export { default as MarkdownEditor } from './components/markdown-editor';
|
|
96
97
|
/* plop:component */
|
|
97
98
|
|
|
98
99
|
// Base Component
|