@kubex/zinc 1.1.76 → 1.1.77
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 +885 -885
- package/dist/vscode.html-custom-data.json +31 -31
- package/dist/web-types.json +107 -107
- package/dist/zn.d.ts +8 -1
- package/dist/zn.min.js +9 -6
- package/docs/pages/components/preview-frame.md +14 -6
- package/docs/pages/components/theme-editor.md +4 -0
- package/package.json +1 -1
- package/src/components/preview-frame/preview-frame.component.ts +12 -2
- package/src/components/preview-frame/preview-frame.test.ts +38 -0
- package/src/components/theme-editor/theme-editor.component.ts +7 -4
- package/src/components/theme-editor/theme-editor.scss +4 -2
- package/src/components/theme-editor/theme-editor.test.ts +16 -0
|
@@ -683,6 +683,44 @@ describe('<zn-preview-frame>', () => {
|
|
|
683
683
|
const stage = el.shadowRoot!.querySelector<HTMLDivElement>('.preview__stage')!;
|
|
684
684
|
expect(stage.style.height).to.equal('max(1500px, 100%)');
|
|
685
685
|
});
|
|
686
|
+
|
|
687
|
+
it('leaves an interactive frame at the panel height, so the embed scrolls itself', async () => {
|
|
688
|
+
const el = await fixture(html`
|
|
689
|
+
<zn-preview-frame
|
|
690
|
+
src="about:blank"
|
|
691
|
+
frame-origin="https://site.example"
|
|
692
|
+
data-uri="/payload"
|
|
693
|
+
fill
|
|
694
|
+
interactive></zn-preview-frame>`);
|
|
695
|
+
|
|
696
|
+
const iframe = el.shadowRoot!.querySelector('iframe')!;
|
|
697
|
+
const panel = el.shadowRoot!.querySelector<HTMLDivElement>('.preview')!;
|
|
698
|
+
const stage = el.shadowRoot!.querySelector<HTMLDivElement>('.preview__stage')!;
|
|
699
|
+
|
|
700
|
+
reportHeight(el, 1500);
|
|
701
|
+
await new Promise(resolve => setTimeout(resolve, 50));
|
|
702
|
+
|
|
703
|
+
expect(iframe.style.height).to.equal('100%');
|
|
704
|
+
expect(stage.style.height).to.equal('');
|
|
705
|
+
expect(panel.scrollHeight).to.equal(panel.clientHeight);
|
|
706
|
+
});
|
|
707
|
+
|
|
708
|
+
it('inflates the frame again when interactive is turned off', async () => {
|
|
709
|
+
const el = await fixture(html`
|
|
710
|
+
<zn-preview-frame
|
|
711
|
+
src="about:blank"
|
|
712
|
+
frame-origin="https://site.example"
|
|
713
|
+
data-uri="/payload"
|
|
714
|
+
interactive></zn-preview-frame>`) as HTMLElement & {interactive: boolean};
|
|
715
|
+
const iframe = el.shadowRoot!.querySelector('iframe')!;
|
|
716
|
+
|
|
717
|
+
reportHeight(el, 1400);
|
|
718
|
+
await new Promise(resolve => setTimeout(resolve, 50));
|
|
719
|
+
expect(iframe.style.height).to.equal('480px');
|
|
720
|
+
|
|
721
|
+
el.interactive = false;
|
|
722
|
+
await waitUntil(() => iframe.style.height === '1400px', 'kept the reported height unused');
|
|
723
|
+
});
|
|
686
724
|
});
|
|
687
725
|
|
|
688
726
|
it('skips the config fetch when data-uri is empty', async () => {
|
|
@@ -840,12 +840,14 @@ export default class ZnThemeEditor extends ZincElement {
|
|
|
840
840
|
<slot @slotchange="${this._onSlotChange}"></slot>
|
|
841
841
|
${this._hasNestedGroups()
|
|
842
842
|
? this._renderTabs(section => html`
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
843
|
+
${this._hasAssignedControls(section.name) ? html`
|
|
844
|
+
<slot name="${section.name}" class="editor__section-slot"
|
|
845
|
+
@slotchange="${this._onSlotChange}"></slot>` : nothing}
|
|
846
|
+
${this._renderGroups(section)}`)
|
|
846
847
|
: this.sectionLayout === 'tabs'
|
|
847
848
|
? this._renderTabs(section => html`
|
|
848
|
-
|
|
849
|
+
<slot name="${section.name}" class="editor__section-slot"
|
|
850
|
+
@slotchange="${this._onSlotChange}"></slot>`)
|
|
849
851
|
: this._renderSections()}
|
|
850
852
|
</div>
|
|
851
853
|
${this.hasSlotController.test('footer') ? html`
|
|
@@ -910,6 +912,7 @@ export default class ZnThemeEditor extends ZincElement {
|
|
|
910
912
|
device="${this.device}"
|
|
911
913
|
min-height="${this.minHeight}"
|
|
912
914
|
fill
|
|
915
|
+
interactive
|
|
913
916
|
backdrop="${this.standalone ? 'panel' : 'dots'}"
|
|
914
917
|
exportparts="base:preview__base,stage:preview__stage,iframe:preview__iframe,error:preview__error"
|
|
915
918
|
@zn-error="${this._onFrameError}"></zn-preview-frame>
|
|
@@ -180,9 +180,11 @@
|
|
|
180
180
|
margin-top: auto;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
//
|
|
183
|
+
// Holds the preview below the toolbar, and never scrolls: the frame is its own
|
|
184
|
+
// scroll region (interactive, the embed is), so a scroller here would only ever
|
|
185
|
+
// be a second scrollbar beside that one.
|
|
184
186
|
.editor__preview {
|
|
185
|
-
overflow:
|
|
187
|
+
overflow: hidden;
|
|
186
188
|
flex: 1 1 auto;
|
|
187
189
|
min-width: 0;
|
|
188
190
|
min-height: 0;
|
|
@@ -729,6 +729,22 @@ describe('<zn-theme-editor>', () => {
|
|
|
729
729
|
expect(controlsHeader).to.exist;
|
|
730
730
|
expect(controlsHeader!.textContent?.trim()).to.equal('');
|
|
731
731
|
});
|
|
732
|
+
|
|
733
|
+
it('gives the preview an interactive frame that scrolls itself, so the column never adds a second scrollbar', async () => {
|
|
734
|
+
const el = await fixture(FIXTURE);
|
|
735
|
+
await (el as HTMLElement & {updateComplete: Promise<unknown>}).updateComplete;
|
|
736
|
+
|
|
737
|
+
const preview = el.shadowRoot!.querySelector<HTMLElement>('[part="preview"]')!;
|
|
738
|
+
const frame = el.shadowRoot!.querySelector<HTMLElement>('zn-preview-frame')!;
|
|
739
|
+
await (frame as HTMLElement & {updateComplete: Promise<unknown>}).updateComplete;
|
|
740
|
+
|
|
741
|
+
expect(frame.hasAttribute('interactive')).to.equal(true);
|
|
742
|
+
expect(getComputedStyle(preview).overflowY).to.equal('hidden');
|
|
743
|
+
expect(preview.scrollHeight).to.equal(preview.clientHeight);
|
|
744
|
+
|
|
745
|
+
const iframe = frame.shadowRoot!.querySelector('iframe')!;
|
|
746
|
+
expect(getComputedStyle(iframe).pointerEvents).to.equal('auto');
|
|
747
|
+
});
|
|
732
748
|
});
|
|
733
749
|
|
|
734
750
|
describe('tabbed sections (section-layout="tabs")', () => {
|