iobroker.webui 1.38.2 → 1.38.6
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/README.md +12 -0
- package/io-package.json +53 -53
- package/package.json +2 -2
- package/www/index.html +1 -1
- package/www/node_modules/@node-projects/web-component-designer/dist/elements/helper/getBoxQuads.js +152 -50
- package/www/node_modules/@node-projects/web-component-designer/dist/index-min.js +100 -100
- package/www/node_modules/esprima-next/bin/esparse.js +0 -0
- package/www/node_modules/esprima-next/bin/esvalidate.js +0 -0
package/README.md
CHANGED
|
@@ -133,6 +133,18 @@ runtime.html?screenName=screen2
|
|
|
133
133
|
Placeholder for next versions:
|
|
134
134
|
### __WORK IN PROGRESS__
|
|
135
135
|
-->
|
|
136
|
+
### 1.38.6 (2025-11-24)
|
|
137
|
+
- fix package.lock
|
|
138
|
+
|
|
139
|
+
### 1.38.5 (2025-11-24)
|
|
140
|
+
- fix package.lock
|
|
141
|
+
|
|
142
|
+
### 1.38.4 (2025-11-24)
|
|
143
|
+
- update npm packages again (for fixes in box quads)
|
|
144
|
+
|
|
145
|
+
### 1.38.3 (2025-11-22)
|
|
146
|
+
- update npm packges (fixes box quads)
|
|
147
|
+
|
|
136
148
|
### 1.38.2 (2025-11-22)
|
|
137
149
|
- update npm packges
|
|
138
150
|
|
package/io-package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "webui",
|
|
4
|
-
"version": "1.38.
|
|
4
|
+
"version": "1.38.6",
|
|
5
5
|
"titleLang": {
|
|
6
6
|
"en": "webui",
|
|
7
7
|
"de": "webui",
|
|
@@ -29,6 +29,58 @@
|
|
|
29
29
|
"zh-cn": "使用万维网传送器的高锰用户接口"
|
|
30
30
|
},
|
|
31
31
|
"news": {
|
|
32
|
+
"1.38.6": {
|
|
33
|
+
"en": "fix package.lock",
|
|
34
|
+
"de": "paket reparieren.lock",
|
|
35
|
+
"ru": "исправить упаковку",
|
|
36
|
+
"pt": "corrigir pacote.lock",
|
|
37
|
+
"nl": "fix pakket.lock",
|
|
38
|
+
"fr": "réparer paquet.lock",
|
|
39
|
+
"it": "fix package.lock",
|
|
40
|
+
"es": "arreglar paquete.lock",
|
|
41
|
+
"pl": "fix package.lock",
|
|
42
|
+
"uk": "засупу 10 ток",
|
|
43
|
+
"zh-cn": "固定软件包.lock"
|
|
44
|
+
},
|
|
45
|
+
"1.38.5": {
|
|
46
|
+
"en": "fix package.lock",
|
|
47
|
+
"de": "paket reparieren.lock",
|
|
48
|
+
"ru": "исправить упаковку",
|
|
49
|
+
"pt": "corrigir pacote.lock",
|
|
50
|
+
"nl": "fix pakket.lock",
|
|
51
|
+
"fr": "réparer paquet.lock",
|
|
52
|
+
"it": "fix package.lock",
|
|
53
|
+
"es": "arreglar paquete.lock",
|
|
54
|
+
"pl": "fix package.lock",
|
|
55
|
+
"uk": "засупу 10 ток",
|
|
56
|
+
"zh-cn": "固定软件包.lock"
|
|
57
|
+
},
|
|
58
|
+
"1.38.4": {
|
|
59
|
+
"en": "update npm packages again (for fixes in box quads)",
|
|
60
|
+
"de": "npm pakete erneut aktualisieren (für fixes in box quads)",
|
|
61
|
+
"ru": "обновление пакетов npm (для исправлений в квадратах коробки)",
|
|
62
|
+
"pt": "atualizar pacotes npm novamente (para correções em quads de caixa)",
|
|
63
|
+
"nl": "npm-pakketten opnieuw bijwerken (voor fixes in box quads)",
|
|
64
|
+
"fr": "mettre à jour à nouveau les paquets npm (pour les corrections dans la case quads)",
|
|
65
|
+
"it": "aggiornamento npm pacchetti di nuovo (per correzioni in box quads)",
|
|
66
|
+
"es": "actualizar paquetes npm de nuevo (para correcciones en cuádruples de caja)",
|
|
67
|
+
"pl": "aktualizacja pakietów npm ponownie (dla poprawek w kwadratach pola)",
|
|
68
|
+
"uk": "оновлення npm пакетів знову (для фіксації в квадроциклах коробки)",
|
|
69
|
+
"zh-cn": "再次更新 npm 包( 用于在框四区修正)"
|
|
70
|
+
},
|
|
71
|
+
"1.38.3": {
|
|
72
|
+
"en": "update npm packges (fixes box quads)",
|
|
73
|
+
"de": "update npm packges (fixes box quads)",
|
|
74
|
+
"ru": "обновление npm пакетов (fixes box quads)",
|
|
75
|
+
"pt": "atualizar pacotes npm (fixes quads)",
|
|
76
|
+
"nl": "npm-pakketten bijwerken (fixeert doos quads)",
|
|
77
|
+
"fr": "mettre à jour npm packges (fixe les quads de la boîte)",
|
|
78
|
+
"it": "aggiornamento npm packges (fixes box quads)",
|
|
79
|
+
"es": "actualización npm packges (cuartos de caja de carga)",
|
|
80
|
+
"pl": "update npm packges (fixed box quads)",
|
|
81
|
+
"uk": "оновлення npm packges (фіксує квадроцикли)",
|
|
82
|
+
"zh-cn": "更新 npm 包( 固定框四)"
|
|
83
|
+
},
|
|
32
84
|
"1.38.2": {
|
|
33
85
|
"en": "update npm packges",
|
|
34
86
|
"de": "update npm packs",
|
|
@@ -67,58 +119,6 @@
|
|
|
67
119
|
"pl": "update npms",
|
|
68
120
|
"uk": "оновлення npms",
|
|
69
121
|
"zh-cn": "更新 npms"
|
|
70
|
-
},
|
|
71
|
-
"1.37.0": {
|
|
72
|
-
"en": "fix bug in bundled code\nuse minified code for config",
|
|
73
|
-
"de": "fehler in gebündeltem code beheben\nminified code für config",
|
|
74
|
-
"ru": "исправить ошибку in bundled code\nминифицированный код для конфигурирования",
|
|
75
|
-
"pt": "corrigir o erro no código empacotado\nusar código minimizado para configuração",
|
|
76
|
-
"nl": "fix bug in gebundelde code\nvermineerde code voor config gebruiken",
|
|
77
|
-
"fr": "correction du bogue dans le code groupé\nutiliser le code minifié pour la configuration",
|
|
78
|
-
"it": "fix bug in codice bundle\nutilizzare il codice miniificato per la configurazione",
|
|
79
|
-
"es": "solucionar error en código incluido\nuse minified code for config",
|
|
80
|
-
"pl": "fix błąd w kodzie pakietowym\nużyj minionego kodu dla konfiguracji",
|
|
81
|
-
"uk": "виправлення помилок в коді\nвикористовуйте норифікований код для налаштування",
|
|
82
|
-
"zh-cn": "在捆绑的代码中修复错误\n配置使用已修改的代码"
|
|
83
|
-
},
|
|
84
|
-
"1.36.0": {
|
|
85
|
-
"en": "fix some boxQuads edge cases",
|
|
86
|
-
"de": "befestigen Sie einige BoxQuads Randgehäuse",
|
|
87
|
-
"ru": "исправьте некоторые случаи BoxQuads edge",
|
|
88
|
-
"pt": "corrigir algumas caixasQuads edge cases",
|
|
89
|
-
"nl": "fix sommige doosQuads rand gevallen",
|
|
90
|
-
"fr": "fixer quelques cas de bord de boxQuads",
|
|
91
|
-
"it": "risolvere alcuni casi di bordo boxQuads",
|
|
92
|
-
"es": "arreglar algunas cajas de borde Cuads",
|
|
93
|
-
"pl": "naprawić kilka skrzynek boxQuads krawędzi",
|
|
94
|
-
"uk": "закріпити якусь коробкуШвидких крайових випадків",
|
|
95
|
-
"zh-cn": "修补一些框 Quads 边框"
|
|
96
|
-
},
|
|
97
|
-
"1.35.4": {
|
|
98
|
-
"en": "clear cache on reload",
|
|
99
|
-
"de": "löschen cache auf nachladen",
|
|
100
|
-
"ru": "чистый кэш на перезагрузке",
|
|
101
|
-
"pt": "limpar cache ao recarregar",
|
|
102
|
-
"nl": "cache wissen bij herladen",
|
|
103
|
-
"fr": "effacer le cache lors du rechargement",
|
|
104
|
-
"it": "cache chiara su ricarica",
|
|
105
|
-
"es": "caché transparente en la recarga",
|
|
106
|
-
"pl": "klarowna pamięć podręczna przy ponownym załadowaniu",
|
|
107
|
-
"uk": "прозорий кеш на перевантаження",
|
|
108
|
-
"zh-cn": "重新装入时清除缓存"
|
|
109
|
-
},
|
|
110
|
-
"1.35.3": {
|
|
111
|
-
"en": "object changed to all clients",
|
|
112
|
-
"de": "objekt geändert für alle kunden",
|
|
113
|
-
"ru": "измененный объект для всех клиентов",
|
|
114
|
-
"pt": "objeto alterado para todos os clientes",
|
|
115
|
-
"nl": "object veranderd naar alle clients",
|
|
116
|
-
"fr": "objet changé à tous les clients",
|
|
117
|
-
"it": "oggetto cambiato in tutti i client",
|
|
118
|
-
"es": "objeto cambiado a todos los clientes",
|
|
119
|
-
"pl": "obiekt zmieniony na wszystkich klientów",
|
|
120
|
-
"uk": "об’єкт змінився для всіх клієнтів",
|
|
121
|
-
"zh-cn": "对象更改为全部客户端"
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
124
|
"icon": "logo.png",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.webui",
|
|
3
|
-
"version": "1.38.
|
|
3
|
+
"version": "1.38.6",
|
|
4
4
|
"description": "ioBroker webui",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/backend/main.js",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@node-projects/node-html-parser-esm": "^6.4.1",
|
|
61
61
|
"@node-projects/propertygrid.webcomponent": "^1.4.1",
|
|
62
62
|
"@node-projects/splitview.webcomponent": "^1.0.1",
|
|
63
|
-
"@node-projects/web-component-designer": "^0.1.
|
|
63
|
+
"@node-projects/web-component-designer": "^0.1.318",
|
|
64
64
|
"@node-projects/web-component-designer-codeview-monaco": "^0.1.33",
|
|
65
65
|
"@node-projects/web-component-designer-htmlparserservice-nodehtmlparser": "^0.1.12",
|
|
66
66
|
"@node-projects/web-component-designer-stylesheetservice-css-tools": "^0.1.11",
|
package/www/index.html
CHANGED
|
@@ -217,7 +217,7 @@
|
|
|
217
217
|
</button>
|
|
218
218
|
<button data-command="save" title="save" disabled><img src="./node_modules/@node-projects/web-component-designer/assets/icons/save.svg"></button>
|
|
219
219
|
<div style="margin-left: 30px;">
|
|
220
|
-
webui - 1.38.
|
|
220
|
+
webui - 1.38.6 - 668ba5e
|
|
221
221
|
</div>
|
|
222
222
|
<button style="margin-left: 30px;" data-command="paste" title="paste" disabled><img
|
|
223
223
|
src="./node_modules/@node-projects/web-component-designer/assets/icons/paste.svg"></button>
|
package/www/node_modules/@node-projects/web-component-designer/dist/elements/helper/getBoxQuads.js
CHANGED
|
@@ -69,11 +69,11 @@ export function convertQuadFromNode(node, quad, from, options) {
|
|
|
69
69
|
const m1 = getResultingTransformationBetweenElementAndAllAncestors(from, document.body, options?.iframes);
|
|
70
70
|
const m2 = getResultingTransformationBetweenElementAndAllAncestors(node, document.body, options?.iframes).inverse();
|
|
71
71
|
if (options?.fromBox && options?.fromBox !== 'border') {
|
|
72
|
-
quad = new DOMQuad(transformPointBox(quad.p1, options.fromBox, (
|
|
72
|
+
quad = new DOMQuad(transformPointBox(quad.p1, options.fromBox, getCachedComputedStyle(from), -1), transformPointBox(quad.p2, options.fromBox, getCachedComputedStyle(from), -1), transformPointBox(quad.p3, options.fromBox, getCachedComputedStyle(from), -1), transformPointBox(quad.p4, options.fromBox, getCachedComputedStyle(from), -1));
|
|
73
73
|
}
|
|
74
74
|
let res = new DOMQuad(m2.transformPoint(m1.transformPoint(quad.p1)), m2.transformPoint(m1.transformPoint(quad.p2)), m2.transformPoint(m1.transformPoint(quad.p3)), m2.transformPoint(m1.transformPoint(quad.p4)));
|
|
75
75
|
if (options?.toBox && options?.toBox !== 'border' && (node instanceof Element || node instanceof (node.ownerDocument.defaultView ?? window).Element)) {
|
|
76
|
-
res = new DOMQuad(transformPointBox(res.p1, options.toBox, (node
|
|
76
|
+
res = new DOMQuad(transformPointBox(res.p1, options.toBox, getCachedComputedStyle(node), -1), transformPointBox(res.p2, options.toBox, getCachedComputedStyle(node), -1), transformPointBox(res.p3, options.toBox, getCachedComputedStyle(node), -1), transformPointBox(res.p4, options.toBox, getCachedComputedStyle(node), -1));
|
|
77
77
|
}
|
|
78
78
|
return res;
|
|
79
79
|
}
|
|
@@ -88,12 +88,12 @@ export function convertRectFromNode(node, rect, from, options) {
|
|
|
88
88
|
const m1 = getResultingTransformationBetweenElementAndAllAncestors(from, (node.ownerDocument.defaultView ?? window).document.body.parentElement, options?.iframes);
|
|
89
89
|
const m2 = getResultingTransformationBetweenElementAndAllAncestors(node, (node.ownerDocument.defaultView ?? window).document.body.parentElement, options?.iframes).inverse();
|
|
90
90
|
if (options?.fromBox && options?.fromBox !== 'border') {
|
|
91
|
-
const p = transformPointBox(new DOMPoint(rect.x, rect.y), options.fromBox, (
|
|
91
|
+
const p = transformPointBox(new DOMPoint(rect.x, rect.y), options.fromBox, getCachedComputedStyle(from), 1);
|
|
92
92
|
rect = new DOMRect(p.x, p.y, rect.width, rect.height);
|
|
93
93
|
}
|
|
94
94
|
let res = new DOMQuad(m2.transformPoint(m1.transformPoint(new DOMPoint(rect.x, rect.y))), m2.transformPoint(m1.transformPoint(new DOMPoint(rect.x + rect.width, rect.y))), m2.transformPoint(m1.transformPoint(new DOMPoint(rect.x + rect.width, rect.y + rect.height))), m2.transformPoint(m1.transformPoint(new DOMPoint(rect.x, rect.y + rect.height))));
|
|
95
95
|
if (options?.toBox && options?.toBox !== 'border' && (node instanceof Element || node instanceof (node.ownerDocument.defaultView ?? window).Element)) {
|
|
96
|
-
res = new DOMQuad(transformPointBox(res.p1, options.toBox, (node
|
|
96
|
+
res = new DOMQuad(transformPointBox(res.p1, options.toBox, getCachedComputedStyle(node), -1), transformPointBox(res.p2, options.toBox, getCachedComputedStyle(node), -1), transformPointBox(res.p3, options.toBox, getCachedComputedStyle(node), -1), transformPointBox(res.p4, options.toBox, getCachedComputedStyle(node), -1));
|
|
97
97
|
}
|
|
98
98
|
return res;
|
|
99
99
|
}
|
|
@@ -108,11 +108,11 @@ export function convertPointFromNode(node, point, from, options) {
|
|
|
108
108
|
const m1 = getResultingTransformationBetweenElementAndAllAncestors(from, (node.ownerDocument.defaultView ?? window).document.body.parentElement, options?.iframes);
|
|
109
109
|
const m2 = getResultingTransformationBetweenElementAndAllAncestors(node, document.body, options?.iframes).inverse();
|
|
110
110
|
if (options?.fromBox && options?.fromBox !== 'border') {
|
|
111
|
-
point = transformPointBox(point, options.fromBox, (
|
|
111
|
+
point = transformPointBox(point, options.fromBox, getCachedComputedStyle(from), 1);
|
|
112
112
|
}
|
|
113
113
|
let res = m2.transformPoint(m1.transformPoint(point));
|
|
114
114
|
if (options?.toBox && options?.toBox !== 'border' && (node instanceof Element || node instanceof (node.ownerDocument.defaultView ?? window).Element)) {
|
|
115
|
-
res = transformPointBox(res, options.toBox, (node
|
|
115
|
+
res = transformPointBox(res, options.toBox, getCachedComputedStyle(node), -1);
|
|
116
116
|
}
|
|
117
117
|
return res;
|
|
118
118
|
}
|
|
@@ -142,15 +142,34 @@ let hash;
|
|
|
142
142
|
let boxQuadsCache;
|
|
143
143
|
/** @type { Map<string, DOMMatrix> } */
|
|
144
144
|
let transformCache;
|
|
145
|
+
/** @type { WeakMap<Node, CSSStyleDeclaration> } */
|
|
146
|
+
let computedStyleCache;
|
|
145
147
|
let hashId = 0;
|
|
146
148
|
export function clearCache() {
|
|
147
149
|
boxQuadsCache.clear();
|
|
148
150
|
transformCache.clear();
|
|
151
|
+
computedStyleCache = new WeakMap();
|
|
149
152
|
}
|
|
150
153
|
export function useCache() {
|
|
151
154
|
hash = new WeakMap();
|
|
152
155
|
boxQuadsCache = new Map();
|
|
153
156
|
transformCache = new Map();
|
|
157
|
+
computedStyleCache = new WeakMap();
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* @param {Element} element
|
|
161
|
+
* @returns {CSSStyleDeclaration}
|
|
162
|
+
*/
|
|
163
|
+
function getCachedComputedStyle(element) {
|
|
164
|
+
if (!computedStyleCache) {
|
|
165
|
+
return (element.ownerDocument.defaultView ?? window).getComputedStyle(element);
|
|
166
|
+
}
|
|
167
|
+
let style = computedStyleCache.get(element);
|
|
168
|
+
if (!style) {
|
|
169
|
+
style = (element.ownerDocument.defaultView ?? window).getComputedStyle(element);
|
|
170
|
+
computedStyleCache.set(element, style);
|
|
171
|
+
}
|
|
172
|
+
return style;
|
|
154
173
|
}
|
|
155
174
|
/**
|
|
156
175
|
* @param {Node} node
|
|
@@ -182,15 +201,15 @@ export function getBoxQuads(node, options) {
|
|
|
182
201
|
let o = null;
|
|
183
202
|
if ((node instanceof Element || node instanceof (node.ownerDocument.defaultView ?? window).Element)) {
|
|
184
203
|
if (options?.box === 'margin') {
|
|
185
|
-
const cs = (node
|
|
204
|
+
const cs = getCachedComputedStyle(node);
|
|
186
205
|
o = [{ x: parseFloat(cs.marginLeft), y: parseFloat(cs.marginTop) }, { x: -parseFloat(cs.marginRight), y: parseFloat(cs.marginTop) }, { x: -parseFloat(cs.marginRight), y: -parseFloat(cs.marginBottom) }, { x: parseFloat(cs.marginLeft), y: -parseFloat(cs.marginBottom) }];
|
|
187
206
|
}
|
|
188
207
|
else if (options?.box === 'padding') {
|
|
189
|
-
const cs = (node
|
|
208
|
+
const cs = getCachedComputedStyle(node);
|
|
190
209
|
o = [{ x: -parseFloat(cs.borderLeftWidth), y: -parseFloat(cs.borderTopWidth) }, { x: parseFloat(cs.borderRightWidth), y: -parseFloat(cs.borderTopWidth) }, { x: parseFloat(cs.borderRightWidth), y: parseFloat(cs.borderBottomWidth) }, { x: -parseFloat(cs.borderLeftWidth), y: parseFloat(cs.borderBottomWidth) }];
|
|
191
210
|
}
|
|
192
211
|
else if (options?.box === 'content') {
|
|
193
|
-
const cs = (node
|
|
212
|
+
const cs = getCachedComputedStyle(node);
|
|
194
213
|
o = [{ x: -parseFloat(cs.borderLeftWidth) - parseFloat(cs.paddingLeft), y: -parseFloat(cs.borderTopWidth) - parseFloat(cs.paddingTop) }, { x: parseFloat(cs.borderRightWidth) + parseFloat(cs.paddingRight), y: -parseFloat(cs.borderTopWidth) - parseFloat(cs.paddingTop) }, { x: parseFloat(cs.borderRightWidth) + parseFloat(cs.paddingRight), y: parseFloat(cs.borderBottomWidth) + parseFloat(cs.paddingBottom) }, { x: -parseFloat(cs.borderLeftWidth) - parseFloat(cs.paddingLeft), y: parseFloat(cs.borderBottomWidth) + parseFloat(cs.paddingBottom) }];
|
|
195
214
|
}
|
|
196
215
|
}
|
|
@@ -268,8 +287,12 @@ export function getElementSize(node, matrix) {
|
|
|
268
287
|
*/
|
|
269
288
|
function getElementOffsetsInContainer(node, includeScroll, iframes) {
|
|
270
289
|
if ((node instanceof HTMLElement || node instanceof (node.ownerDocument.defaultView ?? window).HTMLElement)) {
|
|
290
|
+
let cs = getCachedComputedStyle(node);
|
|
291
|
+
if (cs.offsetPath && cs.offsetPath !== 'none') {
|
|
292
|
+
return new DOMPoint(0, 0);
|
|
293
|
+
}
|
|
271
294
|
if (includeScroll) {
|
|
272
|
-
const cs = (node
|
|
295
|
+
const cs = getCachedComputedStyle(node);
|
|
273
296
|
return new DOMPoint(node.offsetLeft - (includeScroll ? node.scrollLeft - parseFloat(cs.borderLeftWidth) : 0), node.offsetTop - (includeScroll ? node.scrollTop - parseFloat(cs.borderTopWidth) : 0));
|
|
274
297
|
}
|
|
275
298
|
else {
|
|
@@ -293,16 +316,16 @@ function getElementOffsetsInContainer(node, includeScroll, iframes) {
|
|
|
293
316
|
const bb = node.getBBox();
|
|
294
317
|
return new DOMPoint(bb.x, bb.y);
|
|
295
318
|
}
|
|
296
|
-
const cs = (node
|
|
319
|
+
const cs = getCachedComputedStyle(node);
|
|
297
320
|
if (cs.position === 'absolute') {
|
|
298
321
|
return new DOMPoint(parseFloat(cs.left), parseFloat(cs.top));
|
|
299
322
|
}
|
|
300
323
|
const par = getParentElementIncludingSlots(node, iframes);
|
|
301
|
-
const m = getResultingTransformationBetweenElementAndAllAncestors(par, document.body, iframes);
|
|
324
|
+
const m = getResultingTransformationBetweenElementAndAllAncestors(par, document.body, iframes).inverse();
|
|
302
325
|
const r1 = node.getBoundingClientRect();
|
|
303
|
-
const r1t = m.
|
|
326
|
+
const r1t = m.transformPoint(r1);
|
|
304
327
|
const r2 = par.getBoundingClientRect();
|
|
305
|
-
const r2t = m.
|
|
328
|
+
const r2t = m.transformPoint(r2);
|
|
306
329
|
return new DOMPoint(r1t.x - r2t.x, r1t.y - r2t.y);
|
|
307
330
|
}
|
|
308
331
|
}
|
|
@@ -334,7 +357,7 @@ export function getResultingTransformationBetweenElementAndAllAncestors(node, an
|
|
|
334
357
|
let originalElementAndAllParentsMultipliedMatrix = getElementCombinedTransform(actualElement, iframes);
|
|
335
358
|
let perspectiveParentElement = getParentElementIncludingSlots(actualElement, iframes);
|
|
336
359
|
if (perspectiveParentElement) {
|
|
337
|
-
let s = (
|
|
360
|
+
let s = getCachedComputedStyle(perspectiveParentElement);
|
|
338
361
|
if (s.transformStyle !== 'preserve-3d') {
|
|
339
362
|
projectTo2D(originalElementAndAllParentsMultipliedMatrix);
|
|
340
363
|
}
|
|
@@ -343,26 +366,25 @@ export function getResultingTransformationBetweenElementAndAllAncestors(node, an
|
|
|
343
366
|
while (actualElement != ancestor && actualElement != null) {
|
|
344
367
|
const parentElement = getParentElementIncludingSlots(actualElement, iframes);
|
|
345
368
|
if (actualElement.assignedSlot != null) {
|
|
346
|
-
const
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
}
|
|
369
|
+
const l = offsetTopLeftPolyfill(actualElement, 'offsetLeft');
|
|
370
|
+
const t = offsetTopLeftPolyfill(actualElement, 'offsetTop');
|
|
371
|
+
const mvMat = new DOMMatrix().translateSelf(l, t);
|
|
372
|
+
originalElementAndAllParentsMultipliedMatrix = mvMat.multiplySelf(originalElementAndAllParentsMultipliedMatrix);
|
|
351
373
|
}
|
|
352
374
|
else {
|
|
353
375
|
if ((actualElement instanceof HTMLElement || actualElement instanceof (actualElement.ownerDocument.defaultView ?? window).HTMLElement)) {
|
|
354
376
|
if (lastOffsetParent !== actualElement.offsetParent && !((actualElement instanceof HTMLSlotElement || actualElement instanceof (actualElement.ownerDocument.defaultView ?? window).HTMLSlotElement))) {
|
|
355
377
|
const offsets = getElementOffsetsInContainer(actualElement, actualElement !== node, iframes);
|
|
356
378
|
lastOffsetParent = actualElement.offsetParent;
|
|
357
|
-
const mvMat = new DOMMatrix().
|
|
358
|
-
originalElementAndAllParentsMultipliedMatrix = mvMat.
|
|
379
|
+
const mvMat = new DOMMatrix().translateSelf(offsets.x, offsets.y);
|
|
380
|
+
originalElementAndAllParentsMultipliedMatrix = mvMat.multiplySelf(originalElementAndAllParentsMultipliedMatrix);
|
|
359
381
|
}
|
|
360
382
|
}
|
|
361
383
|
else {
|
|
362
384
|
const offsets = getElementOffsetsInContainer(actualElement, actualElement !== node, iframes);
|
|
363
385
|
lastOffsetParent = null;
|
|
364
|
-
const mvMat = new DOMMatrix().
|
|
365
|
-
originalElementAndAllParentsMultipliedMatrix = mvMat.
|
|
386
|
+
const mvMat = new DOMMatrix().translateSelf(offsets.x, offsets.y);
|
|
387
|
+
originalElementAndAllParentsMultipliedMatrix = mvMat.multiplySelf(originalElementAndAllParentsMultipliedMatrix);
|
|
366
388
|
}
|
|
367
389
|
}
|
|
368
390
|
if (parentElement) {
|
|
@@ -371,7 +393,7 @@ export function getResultingTransformationBetweenElementAndAllAncestors(node, an
|
|
|
371
393
|
originalElementAndAllParentsMultipliedMatrix = parentElementMatrix.multiply(originalElementAndAllParentsMultipliedMatrix);
|
|
372
394
|
perspectiveParentElement = getParentElementIncludingSlots(parentElement, iframes);
|
|
373
395
|
if (perspectiveParentElement) {
|
|
374
|
-
const s = (perspectiveParentElement
|
|
396
|
+
const s = getCachedComputedStyle(perspectiveParentElement);
|
|
375
397
|
if (s.transformStyle !== 'preserve-3d') {
|
|
376
398
|
projectTo2D(originalElementAndAllParentsMultipliedMatrix);
|
|
377
399
|
}
|
|
@@ -419,16 +441,13 @@ export function getElementCombinedTransform(element, iframes) {
|
|
|
419
441
|
if ((element instanceof Text || element instanceof (element.ownerDocument.defaultView ?? window).Text))
|
|
420
442
|
return new DOMMatrix;
|
|
421
443
|
//https://www.w3.org/TR/css-transforms-2/#ctm
|
|
422
|
-
let s = (element
|
|
444
|
+
let s = getCachedComputedStyle(element);
|
|
423
445
|
let m = new DOMMatrix();
|
|
424
446
|
const origin = s.transformOrigin.split(' ');
|
|
425
447
|
const originX = parseFloat(origin[0]);
|
|
426
448
|
const originY = parseFloat(origin[1]);
|
|
427
449
|
const originZ = origin[2] ? parseFloat(origin[2]) : 0;
|
|
428
450
|
const mOri = new DOMMatrix().translate(originX, originY, originZ);
|
|
429
|
-
if (s.offsetPath && s.offsetPath !== 'none') {
|
|
430
|
-
m = m.multiply(computeOffsetTransformMatrix(element));
|
|
431
|
-
}
|
|
432
451
|
if (s.translate != 'none' && s.translate) {
|
|
433
452
|
let tr = s.translate;
|
|
434
453
|
if (tr.includes('%')) {
|
|
@@ -440,24 +459,27 @@ export function getElementCombinedTransform(element, iframes) {
|
|
|
440
459
|
v[1] = (parseFloat(v[1]) * r.height / 100) + 'px';
|
|
441
460
|
tr = v.join(',');
|
|
442
461
|
}
|
|
443
|
-
m
|
|
462
|
+
m.multiplySelf(new DOMMatrix('translate(' + tr.replaceAll(' ', ',') + ')'));
|
|
444
463
|
}
|
|
445
464
|
if (s.rotate != 'none' && s.rotate) {
|
|
446
|
-
m
|
|
465
|
+
m.multiplySelf(new DOMMatrix('rotate(' + s.rotate.replaceAll(' ', ',') + ')'));
|
|
447
466
|
}
|
|
448
467
|
if (s.scale != 'none' && s.scale) {
|
|
449
|
-
m
|
|
468
|
+
m.multiplySelf(new DOMMatrix('scale(' + s.scale.replaceAll(' ', ',') + ')'));
|
|
450
469
|
}
|
|
451
470
|
if (s.transform != 'none' && s.transform) {
|
|
452
|
-
m
|
|
471
|
+
m.multiplySelf(new DOMMatrix(s.transform));
|
|
472
|
+
}
|
|
473
|
+
m = mOri.multiply(m.multiply(mOri.inverse()));
|
|
474
|
+
if (s.offsetPath && s.offsetPath !== 'none') {
|
|
475
|
+
m.multiplySelf(computeOffsetTransformMatrix(element));
|
|
453
476
|
}
|
|
454
|
-
let res = mOri.multiply(m.multiply(mOri.inverse()));
|
|
455
477
|
//@ts-ignore
|
|
456
478
|
const pt = getElementPerspectiveTransform(element, iframes);
|
|
457
479
|
if (pt != null) {
|
|
458
|
-
|
|
480
|
+
m = pt.multiply(m);
|
|
459
481
|
}
|
|
460
|
-
return
|
|
482
|
+
return m;
|
|
461
483
|
}
|
|
462
484
|
/**
|
|
463
485
|
* project a DOM-Matrix to 2D (from firefox matrix.h)
|
|
@@ -499,7 +521,7 @@ function getElementPerspectiveTransform(element, iframes) {
|
|
|
499
521
|
const perspectiveNode = getParentElementIncludingSlots(element, iframes);
|
|
500
522
|
if (perspectiveNode) {
|
|
501
523
|
//https://drafts.csswg.org/css-transforms-2/#perspective-matrix-computation
|
|
502
|
-
let s = (
|
|
524
|
+
let s = getCachedComputedStyle(perspectiveNode);
|
|
503
525
|
if (s.perspective !== 'none') {
|
|
504
526
|
let m = new DOMMatrix();
|
|
505
527
|
let p = parseFloat(s.perspective);
|
|
@@ -518,11 +540,12 @@ function getElementPerspectiveTransform(element, iframes) {
|
|
|
518
540
|
return null;
|
|
519
541
|
}
|
|
520
542
|
function computeOffsetTransformMatrix(elem) {
|
|
521
|
-
const cs = (elem
|
|
543
|
+
const cs = getCachedComputedStyle(elem);
|
|
522
544
|
const offsetPath = cs.offsetPath; // e.g. "path('M0,0 ...')"
|
|
523
545
|
const offsetDistance = cs.offsetDistance; // e.g. "50%"
|
|
524
546
|
const offsetRotate = cs.offsetRotate; // e.g. "auto", "45deg", "auto 30deg"
|
|
525
547
|
const offsetAnchor = cs.offsetAnchor;
|
|
548
|
+
const transformOrigin = cs.transformOrigin;
|
|
526
549
|
// Parse offset-distance (px or %)
|
|
527
550
|
let distance = parseOffsetDistance(offsetDistance);
|
|
528
551
|
// Compute position & tangent on path
|
|
@@ -537,21 +560,19 @@ function computeOffsetTransformMatrix(elem) {
|
|
|
537
560
|
else {
|
|
538
561
|
rotateFinal = parseFloat(offsetRotate);
|
|
539
562
|
}
|
|
540
|
-
|
|
541
|
-
const anchorMatrix = new DOMMatrix()
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
m
|
|
563
|
+
const anchor = parseOffsetAnchor(offsetAnchor, transformOrigin, elem);
|
|
564
|
+
const anchorMatrix = new DOMMatrix().translateSelf(-anchor.x, -anchor.y);
|
|
565
|
+
let m = anchorMatrix.translate(x, y);
|
|
566
|
+
m.multiplySelf(anchorMatrix.invertSelf());
|
|
567
|
+
m.rotateSelf(rotateFinal);
|
|
568
|
+
m.translateSelf(-anchor.x, -anchor.y);
|
|
545
569
|
return m;
|
|
546
570
|
}
|
|
547
|
-
function parseOffsetAnchor(str, elem) {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
//if (!(elem instanceof HTMLElement)) {
|
|
551
|
-
// const rect = elem.getBoundingClientRect();
|
|
552
|
-
//}
|
|
571
|
+
function parseOffsetAnchor(str, transformOrigin, elem) {
|
|
572
|
+
const width = elem.offsetWidth;
|
|
573
|
+
const height = elem.offsetHeight;
|
|
553
574
|
if (!str || str === "auto") {
|
|
554
|
-
|
|
575
|
+
str = transformOrigin;
|
|
555
576
|
}
|
|
556
577
|
const parts = str.split(/\s+/);
|
|
557
578
|
if (parts.length === 1) {
|
|
@@ -769,4 +790,85 @@ function rectPath(top, left, right, bottom, t) {
|
|
|
769
790
|
let y = bottom - dist;
|
|
770
791
|
return { x: left, y, angle: 270 };
|
|
771
792
|
}
|
|
793
|
+
//Code from: https://github.com/floating-ui/floating-ui/blob/master/packages/utils/src/dom.ts
|
|
794
|
+
const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
|
|
795
|
+
const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
|
|
796
|
+
const containValues = ['paint', 'layout', 'strict', 'content'];
|
|
797
|
+
function isElement(value) {
|
|
798
|
+
return value instanceof Element || value instanceof value?.ownerDocument?.defaultView?.Element;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
*
|
|
802
|
+
* @param {Element | CSSStyleDeclaration} elementOrCss
|
|
803
|
+
* @returns {boolean}
|
|
804
|
+
*/
|
|
805
|
+
function isContainingBlock(elementOrCss) {
|
|
806
|
+
/** @type {CSSStyleDeclaration } */
|
|
807
|
+
//@ts-ignore
|
|
808
|
+
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
809
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
810
|
+
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
|
811
|
+
return (transformProperties.some((value) => css[value] ? css[value] !== 'none' : false) ||
|
|
812
|
+
(css.containerType ? css.containerType !== 'normal' : false) ||
|
|
813
|
+
(css.backdropFilter ? css.backdropFilter !== 'none' : false) ||
|
|
814
|
+
(css.filter ? css.filter !== 'none' : false) ||
|
|
815
|
+
willChangeValues.some((value) => (css.willChange || '').includes(value)) ||
|
|
816
|
+
containValues.some((value) => (css.contain || '').includes(value)));
|
|
817
|
+
}
|
|
818
|
+
//Code from: https://github.com/jcfranco/composed-offset-position/blob/main/src/index.ts
|
|
819
|
+
function flatTreeParent(element) {
|
|
820
|
+
if (element.assignedSlot)
|
|
821
|
+
return element.assignedSlot;
|
|
822
|
+
if (element.parentNode instanceof ShadowRoot)
|
|
823
|
+
return element.parentNode.host;
|
|
824
|
+
return element.parentNode;
|
|
825
|
+
}
|
|
826
|
+
function ancestorTreeScopes(element) {
|
|
827
|
+
const scopes = new Set();
|
|
828
|
+
let currentScope = element.getRootNode();
|
|
829
|
+
while (currentScope) {
|
|
830
|
+
scopes.add(currentScope);
|
|
831
|
+
currentScope = currentScope.parentNode
|
|
832
|
+
? currentScope.parentNode.getRootNode()
|
|
833
|
+
: null;
|
|
834
|
+
}
|
|
835
|
+
return scopes;
|
|
836
|
+
}
|
|
837
|
+
function offsetParentPolyfill(element) {
|
|
838
|
+
// Do an initial walk to check for display:none ancestors.
|
|
839
|
+
for (let ancestor = element; ancestor; ancestor = flatTreeParent(ancestor)) {
|
|
840
|
+
if (!(ancestor instanceof Element))
|
|
841
|
+
continue;
|
|
842
|
+
if (getCachedComputedStyle(ancestor).display === 'none')
|
|
843
|
+
return null;
|
|
844
|
+
}
|
|
845
|
+
for (let ancestor = flatTreeParent(element); ancestor; ancestor = flatTreeParent(ancestor)) {
|
|
846
|
+
if (!(ancestor instanceof Element))
|
|
847
|
+
continue;
|
|
848
|
+
const style = getCachedComputedStyle(ancestor);
|
|
849
|
+
if (style.display === 'contents')
|
|
850
|
+
continue;
|
|
851
|
+
if (style.position !== 'static' || isContainingBlock(style))
|
|
852
|
+
return ancestor;
|
|
853
|
+
if (ancestor.tagName === 'BODY')
|
|
854
|
+
return ancestor;
|
|
855
|
+
}
|
|
856
|
+
return null;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
*
|
|
860
|
+
* @param {*} element
|
|
861
|
+
* @param {'offsetTop' | 'offsetLeft'} offsetTopOrLeft
|
|
862
|
+
* @returns
|
|
863
|
+
*/
|
|
864
|
+
function offsetTopLeftPolyfill(element, offsetTopOrLeft) {
|
|
865
|
+
let value = element[offsetTopOrLeft];
|
|
866
|
+
let nextOffsetParent = offsetParentPolyfill(element);
|
|
867
|
+
const scopes = ancestorTreeScopes(element);
|
|
868
|
+
while (nextOffsetParent && !scopes.has(nextOffsetParent.getRootNode())) {
|
|
869
|
+
value -= nextOffsetParent[offsetTopOrLeft];
|
|
870
|
+
nextOffsetParent = offsetParentPolyfill(nextOffsetParent);
|
|
871
|
+
}
|
|
872
|
+
return value;
|
|
873
|
+
}
|
|
772
874
|
//# sourceMappingURL=getBoxQuads.js.map
|