kritzel-stencil 0.4.3 → 0.4.5
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/cjs/kritzel-active-users_47.cjs.entry.js +1 -1
- package/dist/collection/constants/version.js +1 -1
- package/dist/components/index.js +1226 -1
- package/dist/components/kritzel-active-users.js +6 -1
- package/dist/components/kritzel-avatar.js +6 -1
- package/dist/components/kritzel-awareness-cursors.js +6 -1
- package/dist/components/kritzel-back-to-content.js +6 -1
- package/dist/components/kritzel-brush-style.js +64 -1
- package/dist/components/kritzel-button.js +6 -1
- package/dist/components/kritzel-color-palette.js +6 -1
- package/dist/components/kritzel-color.js +6 -1
- package/dist/components/kritzel-context-menu.js +6 -1
- package/dist/components/kritzel-controls.js +6 -1
- package/dist/components/kritzel-current-user-dialog.js +6 -1
- package/dist/components/kritzel-current-user.js +6 -1
- package/dist/components/kritzel-cursor-trail.js +6 -1
- package/dist/components/kritzel-dialog.js +6 -1
- package/dist/components/kritzel-dropdown.js +6 -1
- package/dist/components/kritzel-editor.js +4396 -1
- package/dist/components/kritzel-engine.js +6 -1
- package/dist/components/kritzel-export.js +6 -1
- package/dist/components/kritzel-font-family.js +6 -1
- package/dist/components/kritzel-font-size.js +6 -1
- package/dist/components/kritzel-font.js +6 -1
- package/dist/components/kritzel-icon.js +6 -1
- package/dist/components/kritzel-input.js +6 -1
- package/dist/components/kritzel-line-endings.js +6 -1
- package/dist/components/kritzel-loading-overlay.js +6 -1
- package/dist/components/kritzel-login-dialog.js +6 -1
- package/dist/components/kritzel-master-detail.js +6 -1
- package/dist/components/kritzel-menu-item.js +6 -1
- package/dist/components/kritzel-menu.js +6 -1
- package/dist/components/kritzel-more-menu.js +6 -1
- package/dist/components/kritzel-notification-card.js +6 -1
- package/dist/components/kritzel-numeric-input.js +6 -1
- package/dist/components/kritzel-opacity-slider.js +6 -1
- package/dist/components/kritzel-pill-tabs.js +6 -1
- package/dist/components/kritzel-portal.js +6 -1
- package/dist/components/kritzel-settings.js +6 -1
- package/dist/components/kritzel-shape-fill.js +6 -1
- package/dist/components/kritzel-share-dialog.js +6 -1
- package/dist/components/kritzel-slide-toggle.js +6 -1
- package/dist/components/kritzel-split-button.js +6 -1
- package/dist/components/kritzel-stroke-size.js +6 -1
- package/dist/components/kritzel-sync-indicator.js +6 -1
- package/dist/components/kritzel-tool-config.js +6 -1
- package/dist/components/kritzel-tooltip.js +6 -1
- package/dist/components/kritzel-utility-panel.js +6 -1
- package/dist/components/kritzel-watermark.js +6 -1
- package/dist/components/kritzel-workspace-manager.js +6 -1
- package/dist/components/kritzel-zoom-panel.js +6 -1
- package/dist/components/p--Oazz-BP.js +51657 -2
- package/dist/components/p-894OnDQV.js +39 -1
- package/dist/components/p-B43upypT.js +1500 -1
- package/dist/components/p-B5oHmPJb.js +97 -1
- package/dist/components/p-B6t5q-V4.js +63 -1
- package/dist/components/p-B8Xi4Clg.js +43 -1
- package/dist/components/p-BDzlx2hB.js +135 -1
- package/dist/components/p-BFTU3MAI.js +7 -1
- package/dist/components/p-BFYtCsZu.js +56 -1
- package/dist/components/p-BI2ng9I_.js +62 -1
- package/dist/components/p-BTzlrIxe.js +194 -1
- package/dist/components/p-BmyTdQGy.js +1090 -1
- package/dist/components/p-BsANVili.js +150 -1
- package/dist/components/p-BxpKq94F.js +290 -1
- package/dist/components/p-C38P-Vd0.js +446 -1
- package/dist/components/p-C4NrrUfN.js +77 -1
- package/dist/components/p-CW-VyJgK.js +6 -1
- package/dist/components/p-CWRSGYOE.js +57 -1
- package/dist/components/p-CXpv9Rxe.js +106 -1
- package/dist/components/p-Ca-igU1f.js +320 -1
- package/dist/components/p-CdR76C4L.js +165 -1
- package/dist/components/p-ClFprFvz.js +209 -1
- package/dist/components/p-Cm33td2O.js +122 -1
- package/dist/components/p-CqLgB8JK.js +91 -1
- package/dist/components/p-Cr682JI_.js +156 -1
- package/dist/components/p-CsvMgk_f.js +62 -1
- package/dist/components/p-CwJwsRR3.js +277 -1
- package/dist/components/p-Cymum41a.js +88 -1
- package/dist/components/p-D09kgc5Q.js +94 -1
- package/dist/components/p-D30zs0kA.js +121 -1
- package/dist/components/p-D3y_Hauo.js +85 -1
- package/dist/components/p-D5jf8wAu.js +142 -1
- package/dist/components/p-D82VaHce.js +53 -1
- package/dist/components/p-DAwPPDMS.js +101 -1
- package/dist/components/p-DEBwmRTC.js +55 -1
- package/dist/components/p-DIazmg6w.js +52 -1
- package/dist/components/p-DJ88BrIW.js +70 -1
- package/dist/components/p-DJkKlUyZ.js +182 -1
- package/dist/components/p-DUYmwrWV.js +3267 -1
- package/dist/components/p-DX2nriaq.js +486 -1
- package/dist/components/p-Dd-pMvlr.js +20 -1
- package/dist/components/p-Df3BwVGy.js +299 -1
- package/dist/components/p-DgJ0ufzr.js +43 -1
- package/dist/components/p-DkUb2czk.js +70 -1
- package/dist/components/p-Dlp84thc.js +57 -1
- package/dist/components/p-JYj3Facr.js +431 -1
- package/dist/components/p-Ka7OWbnk.js +2304 -1
- package/dist/components/p-PSFAfAyd.js +49 -1
- package/dist/components/p-U6uE85Qx.js +320 -0
- package/dist/components/p-WUdQqYnu.js +118 -1
- package/dist/components/p-djJSnjAX.js +84 -1
- package/dist/components/p-e6Zpc9Vp.js +143 -1
- package/dist/components/p-jGOpkGDl.js +30 -1
- package/dist/components/p-pagW8YF7.js +99 -1
- package/dist/esm/kritzel-active-users_47.entry.js +1 -1
- package/dist/stencil/index.esm.js +1172 -1
- package/dist/stencil/p-4463dade.entry.js +36043 -0
- package/dist/stencil/p-DQuL1Twl.js +3 -1
- package/dist/stencil/p-Dhio9uis.js +1717 -2
- package/dist/stencil/p-fb32cd8f.entry.js +29 -1
- package/dist/stencil/p-uC7_X6yr.js +30737 -1
- package/dist/stencil/stencil.esm.js +21 -1
- package/dist/types/constants/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/p-DPhYXJsM.js +0 -1
- package/dist/stencil/p-43a8dcf8.entry.js +0 -9
|
@@ -1 +1,194 @@
|
|
|
1
|
-
import{p as
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h, d as Host, t as transformTag } from './p-B43upypT.js';
|
|
2
|
+
import { K as KritzelHTMLHelper } from './p-WUdQqYnu.js';
|
|
3
|
+
|
|
4
|
+
const kritzelTooltipCss = () => `:host{width:auto}.tooltip-content{position:relative;padding:8px 12px;border-radius:4px;width:fit-content;background-color:var(--kritzel-tooltip-background-color, #ffffff);color:var(--kritzel-tooltip-color, #000000);padding:var(--kritzel-tooltip-padding, 12px);border:var(--kritzel-tooltip-border, 1px solid #ebebeb);border-radius:var(--kritzel-tooltip-border-radius, 16px);white-space:nowrap;box-shadow:var(--kritzel-tooltip-box-shadow, 0 1px 6px rgba(0, 0, 0, 0.12))}`;
|
|
5
|
+
|
|
6
|
+
const KritzelTooltip = /*@__PURE__*/ proxyCustomElement(class KritzelTooltip extends H {
|
|
7
|
+
constructor(registerHost) {
|
|
8
|
+
super();
|
|
9
|
+
if (registerHost !== false) {
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
}
|
|
12
|
+
this.__attachShadow();
|
|
13
|
+
this.tooltipClosed = createEvent(this, "tooltipClosed");
|
|
14
|
+
this.tooltipOpened = createEvent(this, "tooltipOpened");
|
|
15
|
+
}
|
|
16
|
+
get host() { return this; }
|
|
17
|
+
isVisible = false;
|
|
18
|
+
anchorElement;
|
|
19
|
+
triggerElement;
|
|
20
|
+
offsetY = 24;
|
|
21
|
+
tooltipClosed;
|
|
22
|
+
tooltipOpened;
|
|
23
|
+
positionX = 0;
|
|
24
|
+
positionY = 0;
|
|
25
|
+
handleOutsideClick(event) {
|
|
26
|
+
if (!this.isVisible)
|
|
27
|
+
return;
|
|
28
|
+
const path = event.composedPath();
|
|
29
|
+
const isInsideTooltip = path.some(el => el === this.host);
|
|
30
|
+
const isOnTrigger = this.triggerElement && path.some(el => el === this.triggerElement);
|
|
31
|
+
if (!isInsideTooltip && !isOnTrigger) {
|
|
32
|
+
this.close();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
handleOutsidePointerDown(event) {
|
|
36
|
+
if (!this.isVisible)
|
|
37
|
+
return;
|
|
38
|
+
const path = event.composedPath();
|
|
39
|
+
const isInsideTooltip = path.some(el => el === this.host);
|
|
40
|
+
const isOnTrigger = this.triggerElement && path.some(el => el === this.triggerElement);
|
|
41
|
+
if (!isInsideTooltip && !isOnTrigger) {
|
|
42
|
+
event.stopPropagation();
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
this.close();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
handleCloseAll(event) {
|
|
48
|
+
if (event.detail !== this.host) {
|
|
49
|
+
this.close();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
handleWindowResize() {
|
|
53
|
+
this.calculateAdjustedPosition();
|
|
54
|
+
}
|
|
55
|
+
handleTriggerElementChange(newTrigger, oldTrigger) {
|
|
56
|
+
if (oldTrigger) {
|
|
57
|
+
oldTrigger.removeEventListener('click', this.handleTriggerClick);
|
|
58
|
+
}
|
|
59
|
+
if (newTrigger) {
|
|
60
|
+
newTrigger.addEventListener('click', this.handleTriggerClick);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
handleVisibilityChange(newValue) {
|
|
64
|
+
if (newValue) {
|
|
65
|
+
this.calculateAdjustedPosition();
|
|
66
|
+
requestAnimationFrame(() => {
|
|
67
|
+
this.focusContent();
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async open() {
|
|
72
|
+
if (this.isVisible)
|
|
73
|
+
return;
|
|
74
|
+
document.dispatchEvent(new CustomEvent('kritzelTooltipCloseAll', { detail: this.host }));
|
|
75
|
+
this.isVisible = true;
|
|
76
|
+
this.tooltipOpened.emit();
|
|
77
|
+
}
|
|
78
|
+
async close() {
|
|
79
|
+
if (!this.isVisible)
|
|
80
|
+
return;
|
|
81
|
+
this.isVisible = false;
|
|
82
|
+
this.tooltipClosed.emit();
|
|
83
|
+
}
|
|
84
|
+
async toggle() {
|
|
85
|
+
if (this.isVisible) {
|
|
86
|
+
this.close();
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
this.open();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async focusContent() {
|
|
93
|
+
const focusableElements = KritzelHTMLHelper.getFocusableElements(this.host);
|
|
94
|
+
if (focusableElements.length > 0) {
|
|
95
|
+
focusableElements[0].focus();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
connectedCallback() {
|
|
99
|
+
if (this.triggerElement) {
|
|
100
|
+
this.triggerElement.addEventListener('click', this.handleTriggerClick);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
componentDidLoad() {
|
|
104
|
+
if (this.triggerElement) {
|
|
105
|
+
this.triggerElement.addEventListener('click', this.handleTriggerClick);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
componentWillLoad() {
|
|
109
|
+
this.calculateAdjustedPosition();
|
|
110
|
+
}
|
|
111
|
+
componentWillUpdate() {
|
|
112
|
+
this.calculateAdjustedPosition();
|
|
113
|
+
}
|
|
114
|
+
disconnectedCallback() {
|
|
115
|
+
if (this.triggerElement) {
|
|
116
|
+
this.triggerElement.removeEventListener('click', this.handleTriggerClick);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
handleTriggerClick = (event) => {
|
|
120
|
+
event.stopPropagation();
|
|
121
|
+
this.toggle();
|
|
122
|
+
};
|
|
123
|
+
calculateAdjustedPosition() {
|
|
124
|
+
if (this.isVisible && this.anchorElement) {
|
|
125
|
+
const anchorRect = this.anchorElement.getBoundingClientRect();
|
|
126
|
+
const tooltipContent = this.host.shadowRoot?.querySelector('.tooltip-content');
|
|
127
|
+
const tooltipRect = tooltipContent?.getBoundingClientRect();
|
|
128
|
+
const tooltipWidth = tooltipRect?.width || 0;
|
|
129
|
+
const viewportPadding = 12; // Minimum distance from viewport edges
|
|
130
|
+
const anchorCenterX = anchorRect.left + anchorRect.width / 2;
|
|
131
|
+
// Step 1: Try to center the tooltip above the anchor
|
|
132
|
+
let idealLeft = anchorCenterX - tooltipWidth / 2;
|
|
133
|
+
// Step 2: Clamp to viewport bounds
|
|
134
|
+
const minLeft = viewportPadding;
|
|
135
|
+
const maxLeft = window.innerWidth - tooltipWidth - viewportPadding;
|
|
136
|
+
// Apply clamping - adjust if tooltip would overflow
|
|
137
|
+
this.positionX = Math.max(minLeft, Math.min(idealLeft, maxLeft));
|
|
138
|
+
// Step 3: Calculate bottom position (distance from viewport bottom to top of anchor + offset)
|
|
139
|
+
this.positionY = window.innerHeight - anchorRect.top + this.offsetY;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
render() {
|
|
143
|
+
return (h(Host, { key: 'c0a4b682b3279b8c830dfa758284979e91c0ce2a', style: {
|
|
144
|
+
position: 'fixed',
|
|
145
|
+
zIndex: '9999',
|
|
146
|
+
transition: 'opacity 0.3s ease-in-out, transform 0.3s ease-in-out',
|
|
147
|
+
visibility: this.isVisible ? 'visible' : 'hidden',
|
|
148
|
+
left: `${this.positionX}px`,
|
|
149
|
+
bottom: `${this.positionY}px`,
|
|
150
|
+
} }, h("div", { key: '09fd259d19d42db513161b645aa19206ae81c76a', class: "tooltip-content", onClick: event => event.stopPropagation(), onPointerDown: event => event.stopPropagation(), onMouseDown: event => event.stopPropagation() }, h("slot", { key: 'f743c0ca8c415d71e0af53cdab8304df60dd9a37' }))));
|
|
151
|
+
}
|
|
152
|
+
static get watchers() { return {
|
|
153
|
+
"triggerElement": [{
|
|
154
|
+
"handleTriggerElementChange": 0
|
|
155
|
+
}],
|
|
156
|
+
"isVisible": [{
|
|
157
|
+
"handleVisibilityChange": 0
|
|
158
|
+
}]
|
|
159
|
+
}; }
|
|
160
|
+
static get style() { return kritzelTooltipCss(); }
|
|
161
|
+
}, [769, "kritzel-tooltip", {
|
|
162
|
+
"isVisible": [1028, "is-visible"],
|
|
163
|
+
"anchorElement": [16],
|
|
164
|
+
"triggerElement": [16],
|
|
165
|
+
"offsetY": [2, "offset-y"],
|
|
166
|
+
"positionX": [32],
|
|
167
|
+
"positionY": [32],
|
|
168
|
+
"open": [64],
|
|
169
|
+
"close": [64],
|
|
170
|
+
"toggle": [64],
|
|
171
|
+
"focusContent": [64]
|
|
172
|
+
}, [[4, "click", "handleOutsideClick"], [6, "pointerdown", "handleOutsidePointerDown"], [4, "kritzelTooltipCloseAll", "handleCloseAll"], [9, "resize", "handleWindowResize"]], {
|
|
173
|
+
"triggerElement": [{
|
|
174
|
+
"handleTriggerElementChange": 0
|
|
175
|
+
}],
|
|
176
|
+
"isVisible": [{
|
|
177
|
+
"handleVisibilityChange": 0
|
|
178
|
+
}]
|
|
179
|
+
}]);
|
|
180
|
+
function defineCustomElement() {
|
|
181
|
+
if (typeof customElements === "undefined") {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const components = ["kritzel-tooltip"];
|
|
185
|
+
components.forEach(tagName => { switch (tagName) {
|
|
186
|
+
case "kritzel-tooltip":
|
|
187
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
188
|
+
customElements.define(transformTag(tagName), KritzelTooltip);
|
|
189
|
+
}
|
|
190
|
+
break;
|
|
191
|
+
} });
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export { KritzelTooltip as K, defineCustomElement as d };
|