@social-mail/social-mail-client 1.8.342 → 1.8.344
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/site-editor/editor/ui/SelectionUI.d.ts.map +1 -1
- package/dist/site-editor/editor/ui/SelectionUI.js +94 -122
- package/dist/site-editor/editor/ui/SelectionUI.js.map +1 -1
- package/dist/site-editor-app/SiteEditorApp.pack.js +94 -122
- package/dist/site-editor-app/SiteEditorApp.pack.js.map +1 -1
- package/dist/site-editor-app/SiteEditorApp.pack.min.js +1 -1
- package/dist/site-editor-app/SiteEditorApp.pack.min.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/site-editor/editor/ui/SelectionUI.tsx +107 -151
|
@@ -55962,11 +55962,12 @@ System.register([], function (_export, _context) {
|
|
|
55962
55962
|
System.register(["@web-atoms/core/dist/core/XNode", "../../menus/EditorPopupMenu", "../../properties/controls/PropertyEditor", "./SelectionUI.global.css", "../sizes"], function (_export, _context) {
|
|
55963
55963
|
"use strict";
|
|
55964
55964
|
|
|
55965
|
-
var XNode, EditorPopupMenu, BindEditor, mobileScreenWidth, tabletScreenWidth,
|
|
55965
|
+
var XNode, EditorPopupMenu, BindEditor, mobileScreenWidth, tabletScreenWidth, ps, beginDrag, setCapture, eventPointerDown, keyboardEditingSymbol, eventKeyDown, updateFocus;
|
|
55966
55966
|
function SelectionUI() {
|
|
55967
55967
|
return XNode.create("selected-element", {
|
|
55968
55968
|
"data-element": "selection",
|
|
55969
|
-
|
|
55969
|
+
tabIndex: "-1",
|
|
55970
|
+
"data-edit": BindEditor.oneWay((editor, e) => updateFocus(e, /relative/i.test(editor.selection.parentStyle.position) && /absolute|fixed/i.test(editor.selection.currentStyle.position) ? "1" : null)),
|
|
55970
55971
|
"event-pointerdown": BindEditor.event(eventPointerDown),
|
|
55971
55972
|
"event-keydown": BindEditor.event(eventKeyDown),
|
|
55972
55973
|
"style-left": BindEditor.oneWay(e => e.selection.left),
|
|
@@ -56037,75 +56038,40 @@ System.register(["@web-atoms/core/dist/core/XNode", "../../menus/EditorPopupMenu
|
|
|
56037
56038
|
}],
|
|
56038
56039
|
execute: function () {
|
|
56039
56040
|
ps = (v, max) => (v * 100 / (max || 1)).toFixed(2);
|
|
56040
|
-
|
|
56041
|
-
|
|
56042
|
-
|
|
56043
|
-
|
|
56044
|
-
|
|
56045
|
-
|
|
56046
|
-
|
|
56047
|
-
|
|
56048
|
-
|
|
56049
|
-
|
|
56050
|
-
|
|
56051
|
-
|
|
56052
|
-
|
|
56053
|
-
|
|
56054
|
-
|
|
56055
|
-
|
|
56056
|
-
|
|
56057
|
-
|
|
56058
|
-
|
|
56059
|
-
|
|
56060
|
-
|
|
56061
|
-
|
|
56062
|
-
|
|
56063
|
-
|
|
56064
|
-
|
|
56065
|
-
|
|
56066
|
-
|
|
56067
|
-
|
|
56068
|
-
|
|
56069
|
-
const bottom = parseFloat(style.bottom || "0");
|
|
56070
|
-
const right = parseFloat(style.right || "0");
|
|
56071
|
-
this.left = left;
|
|
56072
|
-
this.top = top;
|
|
56073
|
-
this.bottom = bottom;
|
|
56074
|
-
this.right = right;
|
|
56075
|
-
this.width = width;
|
|
56076
|
-
this.height = height;
|
|
56077
|
-
this.oldWidth = oldWidth;
|
|
56078
|
-
this.oldHeight = oldHeight;
|
|
56079
|
-
this.oldInset = oldInset;
|
|
56080
|
-
const {
|
|
56081
|
-
undoRedo
|
|
56082
|
-
} = editor;
|
|
56083
|
-
this.undoRedo = undoRedo;
|
|
56084
|
-
const d = undoRedo.beginPause();
|
|
56085
|
-
this.d = d;
|
|
56086
|
-
this.resized = false;
|
|
56087
|
-
}
|
|
56088
|
-
move({
|
|
56041
|
+
beginDrag = (editor, element) => {
|
|
56042
|
+
const prefix = editor.maxWidth === tabletScreenWidth ? "styler-tablet" : editor.maxWidth === mobileScreenWidth ? "styler-mobile" : "styler-desktop";
|
|
56043
|
+
const {
|
|
56044
|
+
selection,
|
|
56045
|
+
hover
|
|
56046
|
+
} = editor;
|
|
56047
|
+
const selectedElement = selection.element;
|
|
56048
|
+
const selectedParent = selectedElement.parentElement;
|
|
56049
|
+
const insetAttribute = `${prefix}-inset`;
|
|
56050
|
+
const widthAttribute = `${prefix}-width`;
|
|
56051
|
+
const heightAttribute = `${prefix}-height`;
|
|
56052
|
+
const oldWidth = selectedElement.getAttribute(widthAttribute);
|
|
56053
|
+
const oldHeight = selectedElement.getAttribute(heightAttribute);
|
|
56054
|
+
const oldInset = selectedElement.getAttribute(insetAttribute);
|
|
56055
|
+
const style = selectedElement.ownerDocument.defaultView.getComputedStyle(selectedElement);
|
|
56056
|
+
const width = selectedParent.offsetWidth;
|
|
56057
|
+
const height = selectedParent.offsetHeight;
|
|
56058
|
+
const left = parseFloat(style.left || "0");
|
|
56059
|
+
const top = parseFloat(style.top || "0");
|
|
56060
|
+
const bottom = parseFloat(style.bottom || "0");
|
|
56061
|
+
const right = parseFloat(style.right || "0");
|
|
56062
|
+
const {
|
|
56063
|
+
undoRedo
|
|
56064
|
+
} = editor;
|
|
56065
|
+
const d = undoRedo.beginPause();
|
|
56066
|
+
let resized = false;
|
|
56067
|
+
let changed = false;
|
|
56068
|
+
let timer = void 0;
|
|
56069
|
+
const move = ({
|
|
56089
56070
|
dx,
|
|
56090
56071
|
dy,
|
|
56091
56072
|
fx
|
|
56092
|
-
}) {
|
|
56093
|
-
|
|
56094
|
-
const {
|
|
56095
|
-
left,
|
|
56096
|
-
top,
|
|
56097
|
-
bottom,
|
|
56098
|
-
right,
|
|
56099
|
-
height,
|
|
56100
|
-
width,
|
|
56101
|
-
selectedElement,
|
|
56102
|
-
oldInset,
|
|
56103
|
-
insetAttribute,
|
|
56104
|
-
widthAttribute,
|
|
56105
|
-
heightAttribute,
|
|
56106
|
-
selection,
|
|
56107
|
-
hover
|
|
56108
|
-
} = this;
|
|
56073
|
+
}) => {
|
|
56074
|
+
changed = true;
|
|
56109
56075
|
const ri = {
|
|
56110
56076
|
left,
|
|
56111
56077
|
top,
|
|
@@ -56118,7 +56084,7 @@ System.register(["@web-atoms/core/dist/core/XNode", "../../menus/EditorPopupMenu
|
|
|
56118
56084
|
const inset = `${ps(r.top, height)}% ${ps(r.right, width)}% ${ps(r.bottom, height)}% ${ps(r.left, width)}%`;
|
|
56119
56085
|
selectedElement.setAttribute(insetAttribute, inset);
|
|
56120
56086
|
if (!r.move) {
|
|
56121
|
-
|
|
56087
|
+
resized = true;
|
|
56122
56088
|
let widthDiff = -r.left;
|
|
56123
56089
|
let heightDiff = -r.top;
|
|
56124
56090
|
if (ri.bottom === r.bottom) {
|
|
@@ -56132,28 +56098,14 @@ System.register(["@web-atoms/core/dist/core/XNode", "../../menus/EditorPopupMenu
|
|
|
56132
56098
|
const newHeight = ps(height + heightDiff, height) + "%";
|
|
56133
56099
|
selectedElement.setAttribute(heightAttribute, newHeight);
|
|
56134
56100
|
}
|
|
56135
|
-
|
|
56136
|
-
this.timer = setTimeout(() => {
|
|
56101
|
+
setTimeout(() => {
|
|
56137
56102
|
selection.updateRect();
|
|
56138
56103
|
hover.updateRect();
|
|
56139
56104
|
}, 1);
|
|
56140
|
-
}
|
|
56141
|
-
commit() {
|
|
56142
|
-
|
|
56105
|
+
};
|
|
56106
|
+
const commit = () => {
|
|
56107
|
+
d.resume();
|
|
56143
56108
|
const records = [];
|
|
56144
|
-
const {
|
|
56145
|
-
oldInset,
|
|
56146
|
-
oldHeight,
|
|
56147
|
-
oldWidth,
|
|
56148
|
-
selectedElement,
|
|
56149
|
-
insetAttribute,
|
|
56150
|
-
widthAttribute,
|
|
56151
|
-
heightAttribute,
|
|
56152
|
-
undoRedo,
|
|
56153
|
-
editor,
|
|
56154
|
-
selection,
|
|
56155
|
-
hover
|
|
56156
|
-
} = this;
|
|
56157
56109
|
records.push({
|
|
56158
56110
|
type: "attributes",
|
|
56159
56111
|
oldValue: oldInset,
|
|
@@ -56161,7 +56113,7 @@ System.register(["@web-atoms/core/dist/core/XNode", "../../menus/EditorPopupMenu
|
|
|
56161
56113
|
attributeName: insetAttribute,
|
|
56162
56114
|
attributeNamespace: ""
|
|
56163
56115
|
});
|
|
56164
|
-
if (
|
|
56116
|
+
if (resized) {
|
|
56165
56117
|
records.push({
|
|
56166
56118
|
type: "attributes",
|
|
56167
56119
|
oldValue: oldWidth,
|
|
@@ -56179,15 +56131,24 @@ System.register(["@web-atoms/core/dist/core/XNode", "../../menus/EditorPopupMenu
|
|
|
56179
56131
|
}
|
|
56180
56132
|
undoRedo.observe(records);
|
|
56181
56133
|
editor.commit();
|
|
56182
|
-
clearTimeout(
|
|
56183
|
-
|
|
56134
|
+
clearTimeout(timer);
|
|
56135
|
+
timer = setTimeout(() => {
|
|
56184
56136
|
selection.updateRect();
|
|
56185
56137
|
hover.updateRect();
|
|
56186
56138
|
}, 1);
|
|
56187
|
-
}
|
|
56139
|
+
};
|
|
56140
|
+
return {
|
|
56141
|
+
move,
|
|
56142
|
+
commit,
|
|
56143
|
+
selectedElement,
|
|
56144
|
+
selectedParent,
|
|
56145
|
+
get changed() {
|
|
56146
|
+
return changed;
|
|
56147
|
+
}
|
|
56148
|
+
};
|
|
56188
56149
|
};
|
|
56189
56150
|
setCapture = (editor, element, e, fx) => {
|
|
56190
|
-
const sc =
|
|
56151
|
+
const sc = beginDrag(editor, element);
|
|
56191
56152
|
const sx = e.clientX;
|
|
56192
56153
|
const sy = e.clientY;
|
|
56193
56154
|
const captureMove = evt => {
|
|
@@ -56253,8 +56214,6 @@ System.register(["@web-atoms/core/dist/core/XNode", "../../menus/EditorPopupMenu
|
|
|
56253
56214
|
if (!currentElement.hasAttribute("data-edit")) {
|
|
56254
56215
|
return;
|
|
56255
56216
|
}
|
|
56256
|
-
currentElement.tabIndex = 0;
|
|
56257
|
-
currentElement.focus();
|
|
56258
56217
|
const resize = element.getAttribute("data-resize");
|
|
56259
56218
|
if (resize) {
|
|
56260
56219
|
switch (resize) {
|
|
@@ -56308,54 +56267,67 @@ System.register(["@web-atoms/core/dist/core/XNode", "../../menus/EditorPopupMenu
|
|
|
56308
56267
|
if (!currentElement.hasAttribute("data-edit")) {
|
|
56309
56268
|
return;
|
|
56310
56269
|
}
|
|
56270
|
+
let sc = currentElement[keyboardEditingSymbol];
|
|
56271
|
+
if (sc) {
|
|
56272
|
+
return;
|
|
56273
|
+
}
|
|
56311
56274
|
let dx = 0;
|
|
56312
56275
|
let dy = 0;
|
|
56313
56276
|
switch (e.key) {
|
|
56314
56277
|
case "ArrowDown":
|
|
56315
|
-
dy =
|
|
56278
|
+
dy = 1;
|
|
56316
56279
|
break;
|
|
56317
56280
|
case "ArrowUp":
|
|
56318
|
-
dy =
|
|
56281
|
+
dy = -1;
|
|
56319
56282
|
break;
|
|
56320
56283
|
case "ArrowLeft":
|
|
56321
|
-
dx =
|
|
56284
|
+
dx = -1;
|
|
56322
56285
|
break;
|
|
56323
56286
|
case "ArrowRight":
|
|
56324
|
-
dx =
|
|
56287
|
+
dx = 1;
|
|
56325
56288
|
break;
|
|
56326
56289
|
default:
|
|
56327
56290
|
return;
|
|
56328
56291
|
}
|
|
56329
|
-
|
|
56330
|
-
|
|
56331
|
-
|
|
56332
|
-
|
|
56333
|
-
|
|
56334
|
-
|
|
56335
|
-
|
|
56336
|
-
|
|
56337
|
-
|
|
56338
|
-
|
|
56339
|
-
|
|
56340
|
-
|
|
56292
|
+
const sx = dx * 5;
|
|
56293
|
+
const sy = dy * 5;
|
|
56294
|
+
const fx = r => {
|
|
56295
|
+
r.top += r.dy;
|
|
56296
|
+
r.left += r.dx;
|
|
56297
|
+
r.bottom -= r.dy;
|
|
56298
|
+
r.right -= r.dx;
|
|
56299
|
+
r.move = true;
|
|
56300
|
+
return r;
|
|
56301
|
+
};
|
|
56302
|
+
sc = beginDrag(editor, element);
|
|
56303
|
+
currentElement[keyboardEditingSymbol] = sc;
|
|
56304
|
+
sc.move({
|
|
56305
|
+
dx,
|
|
56306
|
+
dy,
|
|
56307
|
+
fx
|
|
56308
|
+
});
|
|
56309
|
+
const timer = setInterval(() => {
|
|
56310
|
+
dx += sx;
|
|
56311
|
+
dy += sy;
|
|
56341
56312
|
sc.move({
|
|
56342
56313
|
dx,
|
|
56343
56314
|
dy,
|
|
56344
56315
|
fx
|
|
56345
56316
|
});
|
|
56346
|
-
|
|
56347
|
-
|
|
56348
|
-
|
|
56349
|
-
|
|
56350
|
-
|
|
56351
|
-
|
|
56352
|
-
|
|
56353
|
-
|
|
56354
|
-
|
|
56355
|
-
|
|
56356
|
-
|
|
56357
|
-
|
|
56317
|
+
}, 250);
|
|
56318
|
+
const release = () => {
|
|
56319
|
+
clearInterval(timer);
|
|
56320
|
+
currentElement[keyboardEditingSymbol] = void 0;
|
|
56321
|
+
currentElement.removeEventListener("keyup", release);
|
|
56322
|
+
sc.commit();
|
|
56323
|
+
};
|
|
56324
|
+
currentElement.addEventListener("keyup", release);
|
|
56325
|
+
};
|
|
56326
|
+
updateFocus = (e, b) => {
|
|
56327
|
+
if (b) {
|
|
56328
|
+
e.focus();
|
|
56358
56329
|
}
|
|
56330
|
+
return b;
|
|
56359
56331
|
};
|
|
56360
56332
|
}
|
|
56361
56333
|
};
|