@kubex/zinc 1.1.89 → 1.1.90
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 +837 -805
- package/dist/vscode.html-custom-data.json +94 -94
- package/dist/web-types.json +250 -250
- package/dist/zn.d.ts +7 -1
- package/dist/zn.min.js +5 -5
- package/docs/pages/components/editor.md +0 -1
- package/package.json +1 -1
- package/src/components/absolute-container/absolute-container.component.ts +23 -4
- package/src/components/scroll-container/scroll-container.component.ts +31 -6
|
@@ -321,7 +321,6 @@ Add custom quick actions to the context menu using the `zn-editor-quick-action`
|
|
|
321
321
|
```html:preview
|
|
322
322
|
<zn-editor
|
|
323
323
|
name="content"
|
|
324
|
-
value="<p>Select this text to see custom quick actions in the context menu</p>"
|
|
325
324
|
style="height: 300px">
|
|
326
325
|
<zn-editor-quick-action
|
|
327
326
|
slot="context-items"
|
package/package.json
CHANGED
|
@@ -14,6 +14,7 @@ import type {PropertyValues} from 'lit';
|
|
|
14
14
|
*
|
|
15
15
|
*/
|
|
16
16
|
export default class ZnAbsoluteContainer extends ZincElement {
|
|
17
|
+
private _resizeFrame: number | null = null;
|
|
17
18
|
|
|
18
19
|
constructor() {
|
|
19
20
|
super();
|
|
@@ -30,12 +31,30 @@ export default class ZnAbsoluteContainer extends ZincElement {
|
|
|
30
31
|
this.resize();
|
|
31
32
|
}
|
|
32
33
|
|
|
34
|
+
disconnectedCallback() {
|
|
35
|
+
super.disconnectedCallback();
|
|
36
|
+
if (this._resizeFrame !== null) {
|
|
37
|
+
cancelAnimationFrame(this._resizeFrame);
|
|
38
|
+
this._resizeFrame = null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
33
42
|
resize() {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
if (this._resizeFrame !== null) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this._resizeFrame = requestAnimationFrame(() => {
|
|
47
|
+
this._resizeFrame = null;
|
|
48
|
+
let newSize = 0;
|
|
49
|
+
Array.from(this.children).forEach((child) => {
|
|
50
|
+
newSize += child.getBoundingClientRect().height;
|
|
51
|
+
});
|
|
52
|
+
const minHeight = newSize + 'px';
|
|
53
|
+
// Guarded write: setting style re-triggers our own MutationController
|
|
54
|
+
if (this.style.minHeight !== minHeight) {
|
|
55
|
+
this.style.minHeight = minHeight;
|
|
56
|
+
}
|
|
37
57
|
});
|
|
38
|
-
this.style.minHeight = newSize + 'px';
|
|
39
58
|
}
|
|
40
59
|
|
|
41
60
|
// the height of this element is set to the height of its children (absolute positioned)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {type CSSResultGroup, html,
|
|
1
|
+
import {type CSSResultGroup, html, type PropertyValues, unsafeCSS} from 'lit';
|
|
2
2
|
import {MutationController} from '@lit-labs/observers/mutation-controller.js';
|
|
3
3
|
import {property, query} from "lit/decorators.js";
|
|
4
4
|
import {ResizeController} from '@lit-labs/observers/resize-controller.js';
|
|
@@ -34,6 +34,9 @@ export default class ZnScrollContainer extends ZincElement {
|
|
|
34
34
|
@query('.scroll-footer')
|
|
35
35
|
private footer: HTMLElement;
|
|
36
36
|
|
|
37
|
+
private _footerObserved: boolean = false;
|
|
38
|
+
private _footerHeightFrame: number | null = null;
|
|
39
|
+
|
|
37
40
|
protected firstUpdated(_changedProperties: PropertyValues) {
|
|
38
41
|
super.firstUpdated(_changedProperties);
|
|
39
42
|
if (this.startScrolled && this.container) {
|
|
@@ -41,15 +44,34 @@ export default class ZnScrollContainer extends ZincElement {
|
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
46
|
|
|
47
|
+
disconnectedCallback() {
|
|
48
|
+
super.disconnectedCallback();
|
|
49
|
+
if (this._footerHeightFrame !== null) {
|
|
50
|
+
cancelAnimationFrame(this._footerHeightFrame);
|
|
51
|
+
this._footerHeightFrame = null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
44
55
|
scrollEnd() {
|
|
45
56
|
this.container.scrollTop = this.container.scrollHeight;
|
|
46
57
|
}
|
|
47
58
|
|
|
59
|
+
private _syncFooterHeight() {
|
|
60
|
+
if (this._footerHeightFrame !== null) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
this._footerHeightFrame = requestAnimationFrame(() => {
|
|
64
|
+
this._footerHeightFrame = null;
|
|
65
|
+
const height = `${this.footer?.clientHeight ?? 0}px`;
|
|
66
|
+
if (this.style.getPropertyValue('--zn-scroll-footer-height') !== height) {
|
|
67
|
+
this.style.setProperty('--zn-scroll-footer-height', height);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
48
72
|
private readonly _footerResizeObserver = new ResizeController(this, {
|
|
49
73
|
target: null,
|
|
50
|
-
callback: () =>
|
|
51
|
-
this.style.setProperty('--zn-scroll-footer-height', `${this.footer?.clientHeight ?? 0}px`);
|
|
52
|
-
},
|
|
74
|
+
callback: () => this._syncFooterHeight(),
|
|
53
75
|
});
|
|
54
76
|
|
|
55
77
|
private readonly _domObserver = new MutationController(this, {
|
|
@@ -58,8 +80,11 @@ export default class ZnScrollContainer extends ZincElement {
|
|
|
58
80
|
callback: () => {
|
|
59
81
|
setTimeout(() => this.scrollEnd(), 100);
|
|
60
82
|
if (this.footer) {
|
|
61
|
-
this.
|
|
62
|
-
|
|
83
|
+
this._syncFooterHeight();
|
|
84
|
+
if (!this._footerObserved) {
|
|
85
|
+
this._footerObserved = true;
|
|
86
|
+
this._footerResizeObserver.observe(this.footer);
|
|
87
|
+
}
|
|
63
88
|
}
|
|
64
89
|
},
|
|
65
90
|
});
|