@kubex/zinc 1.1.70 → 1.1.71
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 +1 -1
- package/dist/web-types.json +1 -1
- package/dist/zn.min.css +1 -1
- package/dist/zn.min.js +34 -32
- package/docs/pages/components/theme-editor.md +8 -0
- package/package.json +1 -1
- package/scss/_global-spacing.scss +7 -0
- package/src/components/button/button.scss +1 -1
- package/src/components/theme-editor/theme-editor.component.ts +32 -30
- package/src/components/theme-editor/theme-editor.scss +47 -1
|
@@ -29,6 +29,14 @@ The preview always fills its column, leaving no dead space beneath it.
|
|
|
29
29
|
it's still forwarded to the [preview frame](/components/preview-frame/), which
|
|
30
30
|
uses it the same way.
|
|
31
31
|
|
|
32
|
+
The preview column alone sets the editor's height — the controls never stretch
|
|
33
|
+
it, however many sections are expanded, they just scroll in place. So the
|
|
34
|
+
editor is as tall as its parent when that parent has a definite height, and
|
|
35
|
+
`min-height` tall otherwise; either way the controls and the preview scroll
|
|
36
|
+
independently while the header, toolbar and footer rows stay put. Stacked
|
|
37
|
+
(under 768px) there's no second column to take the height from, so both flow
|
|
38
|
+
with the page and there's only ever one scrollbar.
|
|
39
|
+
|
|
32
40
|
Controls organize themselves into tabs with collapsible groups inside each:
|
|
33
41
|
give each one a `group` and a `category` and the editor builds the structure
|
|
34
42
|
around them, no slot names required.
|
package/package.json
CHANGED
|
@@ -69,6 +69,13 @@
|
|
|
69
69
|
margin-top: var(--zn-base-gap);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
.form-actions {
|
|
73
|
+
display: flex;
|
|
74
|
+
justify-content: flex-end;
|
|
75
|
+
align-items: center;
|
|
76
|
+
gap: var(--zn-spacing-small);
|
|
77
|
+
}
|
|
78
|
+
|
|
72
79
|
zn-form-group ~ zn-form-group {
|
|
73
80
|
margin-top: var(--zn-base-gap);
|
|
74
81
|
padding-top: var(--zn-base-gap);
|
|
@@ -819,38 +819,40 @@ export default class ZnThemeEditor extends ZincElement {
|
|
|
819
819
|
<div part="base" class="editor ${this.controlsCollapsed ? 'editor--controls-collapsed' : ''}"
|
|
820
820
|
style="min-height: ${this.minHeight}px">
|
|
821
821
|
<div part="controls" class="editor__controls">
|
|
822
|
-
<div
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
<div
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
${this._hasAssignedControls(section.name) ? html`
|
|
843
|
-
<slot name="${section.name}" class="editor__section-slot" @slotchange="${this._onSlotChange}"></slot>` : nothing}
|
|
844
|
-
${this._renderGroups(section)}`)
|
|
845
|
-
: this.sectionLayout === 'tabs'
|
|
822
|
+
<div class="editor__controls-inner">
|
|
823
|
+
<div part="controls-header" class="editor__controls-header">
|
|
824
|
+
${this.controlsCaption ? html`<span class="editor__caption">${this.controlsCaption}</span>` : nothing}
|
|
825
|
+
<button type="button"
|
|
826
|
+
class="editor__mode"
|
|
827
|
+
data-mode-toggle
|
|
828
|
+
aria-label="${this.mode === 'dark' ? 'Switch to light mode' : 'Switch to dark mode'}"
|
|
829
|
+
@click="${this._toggleMode}">
|
|
830
|
+
<zn-icon src="${this.mode === 'dark' ? 'sun' : 'moon'}" library="lucide" size="16"></zn-icon>
|
|
831
|
+
</button>
|
|
832
|
+
</div>
|
|
833
|
+
<div class="editor__controls-body">
|
|
834
|
+
<div
|
|
835
|
+
class="editor__fields ${this.hasSlotController.test('[default]') ? '' : 'editor__fields--sections-only'}"
|
|
836
|
+
@zn-change="${this._onControlChange}"
|
|
837
|
+
@zn-input="${this._onControlChange}"
|
|
838
|
+
@change="${this._onControlChange}"
|
|
839
|
+
@input="${this._onControlChange}">
|
|
840
|
+
<slot @slotchange="${this._onSlotChange}"></slot>
|
|
841
|
+
${this._hasNestedGroups()
|
|
846
842
|
? this._renderTabs(section => html`
|
|
847
|
-
|
|
848
|
-
|
|
843
|
+
${this._hasAssignedControls(section.name) ? html`
|
|
844
|
+
<slot name="${section.name}" class="editor__section-slot" @slotchange="${this._onSlotChange}"></slot>` : nothing}
|
|
845
|
+
${this._renderGroups(section)}`)
|
|
846
|
+
: this.sectionLayout === 'tabs'
|
|
847
|
+
? this._renderTabs(section => html`
|
|
848
|
+
<slot name="${section.name}" class="editor__section-slot" @slotchange="${this._onSlotChange}"></slot>`)
|
|
849
|
+
: this._renderSections()}
|
|
850
|
+
</div>
|
|
851
|
+
${this.hasSlotController.test('footer') ? html`
|
|
852
|
+
<div part="footer" class="editor__footer">
|
|
853
|
+
<slot name="footer"></slot>
|
|
854
|
+
</div>` : nothing}
|
|
849
855
|
</div>
|
|
850
|
-
${this.hasSlotController.test('footer') ? html`
|
|
851
|
-
<div part="footer" class="editor__footer">
|
|
852
|
-
<slot name="footer"></slot>
|
|
853
|
-
</div>` : nothing}
|
|
854
856
|
</div>
|
|
855
857
|
</div>
|
|
856
858
|
|
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
display: block;
|
|
5
5
|
// Matches page-builder's --palette-col.
|
|
6
6
|
--zn-theme-editor-controls-width: 343px;
|
|
7
|
+
// Resolves to auto when the parent height is indefinite, so the editor still
|
|
8
|
+
// grows to its content there; given a definite parent it stays inside it and
|
|
9
|
+
// the two columns scroll on their own instead.
|
|
10
|
+
height: 100%;
|
|
7
11
|
}
|
|
8
12
|
|
|
9
13
|
.editor {
|
|
@@ -11,6 +15,7 @@
|
|
|
11
15
|
|
|
12
16
|
display: flex;
|
|
13
17
|
align-items: stretch;
|
|
18
|
+
height: 100%;
|
|
14
19
|
|
|
15
20
|
&--controls-collapsed {
|
|
16
21
|
--controls-col: 0px;
|
|
@@ -38,6 +43,7 @@
|
|
|
38
43
|
.editor__toolbar {
|
|
39
44
|
display: flex;
|
|
40
45
|
align-items: center;
|
|
46
|
+
flex: 0 0 auto;
|
|
41
47
|
min-height: 44px;
|
|
42
48
|
gap: var(--zn-spacing-small);
|
|
43
49
|
padding: var(--zn-spacing-small) var(--zn-spacing-medium);
|
|
@@ -59,6 +65,7 @@
|
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
.editor__controls {
|
|
68
|
+
position: relative;
|
|
62
69
|
display: flex;
|
|
63
70
|
flex-direction: column;
|
|
64
71
|
flex: 0 0 var(--controls-col);
|
|
@@ -70,9 +77,21 @@
|
|
|
70
77
|
transition: flex-basis 0.2s ease;
|
|
71
78
|
}
|
|
72
79
|
|
|
80
|
+
// Taken out of flow so the controls contribute no height to the row: expanding
|
|
81
|
+
// a section can then never stretch the editor, it just scrolls in place. The
|
|
82
|
+
// preview column alone sets the height (its own min-height, or the parent's if
|
|
83
|
+
// that is definite).
|
|
84
|
+
.editor__controls-inner {
|
|
85
|
+
position: absolute;
|
|
86
|
+
inset: 0;
|
|
87
|
+
display: flex;
|
|
88
|
+
flex-direction: column;
|
|
89
|
+
}
|
|
90
|
+
|
|
73
91
|
.editor__controls-header {
|
|
74
92
|
display: flex;
|
|
75
93
|
align-items: center;
|
|
94
|
+
flex: 0 0 auto;
|
|
76
95
|
min-height: 44px;
|
|
77
96
|
padding: var(--zn-spacing-small) var(--zn-spacing-medium);
|
|
78
97
|
}
|
|
@@ -82,6 +101,7 @@
|
|
|
82
101
|
flex-direction: column;
|
|
83
102
|
gap: var(--zn-spacing-medium);
|
|
84
103
|
flex: 1 1 auto;
|
|
104
|
+
min-height: 0;
|
|
85
105
|
}
|
|
86
106
|
|
|
87
107
|
.editor__main {
|
|
@@ -90,12 +110,17 @@
|
|
|
90
110
|
flex-direction: column;
|
|
91
111
|
flex: 1 1 auto;
|
|
92
112
|
min-width: 0;
|
|
113
|
+
min-height: 0;
|
|
93
114
|
}
|
|
94
115
|
|
|
116
|
+
// The sidebar's scroll region: the header above and the footer below stay put.
|
|
95
117
|
.editor__fields {
|
|
96
118
|
display: flex;
|
|
97
119
|
flex-direction: column;
|
|
98
120
|
gap: var(--zn-spacing-medium);
|
|
121
|
+
flex: 1 1 auto;
|
|
122
|
+
min-height: 0;
|
|
123
|
+
overflow-y: auto;
|
|
99
124
|
}
|
|
100
125
|
|
|
101
126
|
// Supports an author hand-slotting a bare zn-collapsible into the default slot.
|
|
@@ -148,16 +173,19 @@
|
|
|
148
173
|
|
|
149
174
|
.editor__footer {
|
|
150
175
|
display: flex;
|
|
176
|
+
flex: 0 0 auto;
|
|
151
177
|
gap: var(--zn-spacing-small);
|
|
152
178
|
padding-top: var(--zn-spacing-small);
|
|
153
179
|
border-top: 1px solid rgb(var(--zn-border-color));
|
|
154
180
|
margin-top: auto;
|
|
155
181
|
}
|
|
156
182
|
|
|
183
|
+
// The preview's scroll region: the toolbar above stays put.
|
|
157
184
|
.editor__preview {
|
|
158
|
-
overflow:
|
|
185
|
+
overflow: auto;
|
|
159
186
|
flex: 1 1 auto;
|
|
160
187
|
min-width: 0;
|
|
188
|
+
min-height: 0;
|
|
161
189
|
display: flex;
|
|
162
190
|
flex-direction: column;
|
|
163
191
|
}
|
|
@@ -267,8 +295,20 @@
|
|
|
267
295
|
|
|
268
296
|
// 768 must match STACKED_QUERY in theme-editor.component.ts.
|
|
269
297
|
@media (max-width: 768px) {
|
|
298
|
+
// Stacked, the two columns share one vertical axis, so they flow with the
|
|
299
|
+
// page rather than each owning a cramped scroller of its own.
|
|
300
|
+
:host {
|
|
301
|
+
height: auto;
|
|
302
|
+
}
|
|
303
|
+
|
|
270
304
|
.editor {
|
|
271
305
|
flex-direction: column;
|
|
306
|
+
height: auto;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.editor__fields,
|
|
310
|
+
.editor__preview {
|
|
311
|
+
overflow: visible;
|
|
272
312
|
}
|
|
273
313
|
|
|
274
314
|
.editor__controls {
|
|
@@ -278,6 +318,12 @@
|
|
|
278
318
|
border-bottom: 1px solid rgb(var(--zn-border-color));
|
|
279
319
|
}
|
|
280
320
|
|
|
321
|
+
// Stacked there is no second column to take the height from, so the controls
|
|
322
|
+
// go back in flow and size themselves.
|
|
323
|
+
.editor__controls-inner {
|
|
324
|
+
position: static;
|
|
325
|
+
}
|
|
326
|
+
|
|
281
327
|
.editor--controls-collapsed .editor__controls {
|
|
282
328
|
display: none;
|
|
283
329
|
}
|