@social-mail/social-mail-client 1.8.338 → 1.8.342

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.
@@ -22027,7 +22027,7 @@ System.register(["tslib", "@web-atoms/core/dist/App", "@web-atoms/core/dist/core
22027
22027
  const fud = new FileUploader(this);
22028
22028
  while (size > 0) {
22029
22029
  const blobSize = Math.min(maxSize, file.size - start);
22030
- const part = new File([file.slice(start, blobSize === maxSize ? blobSize : void 0)], "file.dat");
22030
+ const part = new File([file.slice(start, start + blobSize)], "file.dat");
22031
22031
  size -= blobSize;
22032
22032
  start += blobSize;
22033
22033
  const uploadRequest = fud.upload({
@@ -55962,12 +55962,13 @@ 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, setCapture, eventPointerDown;
55965
+ var XNode, EditorPopupMenu, BindEditor, mobileScreenWidth, tabletScreenWidth, SelectedCapture, ps, setCapture, eventPointerDown, keyboardEditingSymbol, eventKeyDown;
55966
55966
  function SelectionUI() {
55967
55967
  return XNode.create("selected-element", {
55968
55968
  "data-element": "selection",
55969
55969
  "data-edit": BindEditor.oneWay(e => /relative/i.test(e.selection.parentStyle.position) && /absolute|fixed/i.test(e.selection.currentStyle.position) ? "1" : null),
55970
55970
  "event-pointerdown": BindEditor.event(eventPointerDown),
55971
+ "event-keydown": BindEditor.event(eventKeyDown),
55971
55972
  "style-left": BindEditor.oneWay(e => e.selection.left),
55972
55973
  "style-top": BindEditor.oneWay(e => e.selection.top),
55973
55974
  "style-width": BindEditor.oneWay(e => e.selection.width),
@@ -56035,61 +56036,89 @@ System.register(["@web-atoms/core/dist/core/XNode", "../../menus/EditorPopupMenu
56035
56036
  tabletScreenWidth = _sizes.tabletScreenWidth;
56036
56037
  }],
56037
56038
  execute: function () {
56038
- setCapture = (editor, element, e, fx) => {
56039
- const prefix = editor.maxWidth === tabletScreenWidth ? "styler-tablet" : editor.maxWidth === mobileScreenWidth ? "styler-mobile" : "styler-desktop";
56040
- const sx = e.clientX;
56041
- const sy = e.clientY;
56042
- const {
56043
- selection,
56044
- hover
56045
- } = editor;
56046
- const selectedElement = selection.element;
56047
- const selectedParent = selectedElement.parentElement;
56048
- const frameDocument = selectedElement.ownerDocument;
56049
- const frame = editor.contentEditor;
56050
- const insetAttribute = `${prefix}-inset`;
56051
- const widthAttribute = `${prefix}-width`;
56052
- const heightAttribute = `${prefix}-height`;
56053
- const oldWidth = selectedElement.getAttribute(widthAttribute);
56054
- const oldHeight = selectedElement.getAttribute(heightAttribute);
56055
- const oldInset = selectedElement.getAttribute(insetAttribute);
56056
- const records = [];
56057
- const style = selectedElement.ownerDocument.defaultView.getComputedStyle(selectedElement);
56058
- const width = selectedParent.offsetWidth;
56059
- const height = selectedParent.offsetHeight;
56060
- const ps = (v, max) => (v * 100 / (max || 1)).toFixed(2);
56061
- const {
56062
- undoRedo
56063
- } = editor;
56064
- const d = undoRedo.beginPause();
56065
- const left = parseFloat(style.left || "0");
56066
- const top = parseFloat(style.top || "0");
56067
- const bottom = parseFloat(style.bottom || "0");
56068
- const right = parseFloat(style.right || "0");
56069
- let moved = false;
56070
- let changed = false;
56071
- const captureMove = evt => {
56072
- const dx = evt.clientX - sx;
56073
- const dy = evt.clientY - sy;
56074
- if (dx === 0 && dy === 0) {
56075
- return;
56076
- }
56039
+ ps = (v, max) => (v * 100 / (max || 1)).toFixed(2);
56040
+ SelectedCapture = class SelectedCapture {
56041
+ constructor(editor, element) {
56042
+ this.editor = editor;
56043
+ this.element = element;
56044
+ const prefix = editor.maxWidth === tabletScreenWidth ? "styler-tablet" : editor.maxWidth === mobileScreenWidth ? "styler-mobile" : "styler-desktop";
56045
+ const {
56046
+ selection,
56047
+ hover
56048
+ } = editor;
56049
+ const selectedElement = selection.element;
56050
+ const selectedParent = selectedElement.parentElement;
56051
+ this.selectedElement = selectedElement;
56052
+ this.selectedParent = selectedParent;
56053
+ this.selection = selection;
56054
+ this.hover = hover;
56055
+ const insetAttribute = `${prefix}-inset`;
56056
+ const widthAttribute = `${prefix}-width`;
56057
+ const heightAttribute = `${prefix}-height`;
56058
+ this.insetAttribute = insetAttribute;
56059
+ this.widthAttribute = widthAttribute;
56060
+ this.heightAttribute = heightAttribute;
56061
+ const oldWidth = selectedElement.getAttribute(widthAttribute);
56062
+ const oldHeight = selectedElement.getAttribute(heightAttribute);
56063
+ const oldInset = selectedElement.getAttribute(insetAttribute);
56064
+ const style = selectedElement.ownerDocument.defaultView.getComputedStyle(selectedElement);
56065
+ const width = selectedParent.offsetWidth;
56066
+ const height = selectedParent.offsetHeight;
56067
+ const left = parseFloat(style.left || "0");
56068
+ const top = parseFloat(style.top || "0");
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({
56089
+ dx,
56090
+ dy,
56091
+ fx
56092
+ }) {
56093
+ this.changed = true;
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;
56077
56109
  const ri = {
56078
56110
  left,
56079
56111
  top,
56080
56112
  right,
56081
56113
  bottom,
56082
- sx,
56083
- sy,
56084
56114
  dx,
56085
56115
  dy
56086
56116
  };
56087
- changed = true;
56088
56117
  const r = fx(ri);
56089
56118
  const inset = `${ps(r.top, height)}% ${ps(r.right, width)}% ${ps(r.bottom, height)}% ${ps(r.left, width)}%`;
56090
56119
  selectedElement.setAttribute(insetAttribute, inset);
56091
56120
  if (!r.move) {
56092
- moved = true;
56121
+ this.resized = true;
56093
56122
  let widthDiff = -r.left;
56094
56123
  let heightDiff = -r.top;
56095
56124
  if (ri.bottom === r.bottom) {
@@ -56103,10 +56132,75 @@ System.register(["@web-atoms/core/dist/core/XNode", "../../menus/EditorPopupMenu
56103
56132
  const newHeight = ps(height + heightDiff, height) + "%";
56104
56133
  selectedElement.setAttribute(heightAttribute, newHeight);
56105
56134
  }
56106
- setTimeout(() => {
56135
+ clearTimeout(this.timer);
56136
+ this.timer = setTimeout(() => {
56137
+ selection.updateRect();
56138
+ hover.updateRect();
56139
+ }, 1);
56140
+ }
56141
+ commit() {
56142
+ this.d.resume();
56143
+ 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
+ records.push({
56158
+ type: "attributes",
56159
+ oldValue: oldInset,
56160
+ target: selectedElement,
56161
+ attributeName: insetAttribute,
56162
+ attributeNamespace: ""
56163
+ });
56164
+ if (this.resized) {
56165
+ records.push({
56166
+ type: "attributes",
56167
+ oldValue: oldWidth,
56168
+ target: selectedElement,
56169
+ attributeName: widthAttribute,
56170
+ attributeNamespace: ""
56171
+ });
56172
+ records.push({
56173
+ type: "attributes",
56174
+ oldValue: oldHeight,
56175
+ target: selectedElement,
56176
+ attributeName: heightAttribute,
56177
+ attributeNamespace: ""
56178
+ });
56179
+ }
56180
+ undoRedo.observe(records);
56181
+ editor.commit();
56182
+ clearTimeout(this.timer);
56183
+ this.timer = setTimeout(() => {
56107
56184
  selection.updateRect();
56108
56185
  hover.updateRect();
56109
56186
  }, 1);
56187
+ }
56188
+ };
56189
+ setCapture = (editor, element, e, fx) => {
56190
+ const sc = new SelectedCapture(editor, element);
56191
+ const sx = e.clientX;
56192
+ const sy = e.clientY;
56193
+ const captureMove = evt => {
56194
+ const dx = evt.clientX - sx;
56195
+ const dy = evt.clientY - sy;
56196
+ if (dx === 0 && dy === 0) {
56197
+ return;
56198
+ }
56199
+ sc.move({
56200
+ dx,
56201
+ dy,
56202
+ fx
56203
+ });
56110
56204
  };
56111
56205
  element.addEventListener("pointermove", captureMove);
56112
56206
  element.setPointerCapture(e.pointerId);
@@ -56114,9 +56208,13 @@ System.register(["@web-atoms/core/dist/core/XNode", "../../menus/EditorPopupMenu
56114
56208
  element.releasePointerCapture(e.pointerId);
56115
56209
  element.removeEventListener("pointermove", captureMove);
56116
56210
  element.removeEventListener("pointerup", release);
56117
- captureMove(e1);
56118
- d.resume();
56119
- if (!changed) {
56211
+ if (!sc.changed) {
56212
+ const {
56213
+ selectedElement,
56214
+ selectedParent
56215
+ } = sc;
56216
+ const frameDocument = selectedElement.ownerDocument;
56217
+ const frame = editor.contentEditor;
56120
56218
  const frameRect = frame.getBoundingClientRect();
56121
56219
  let {
56122
56220
  clientX,
@@ -56145,35 +56243,7 @@ System.register(["@web-atoms/core/dist/core/XNode", "../../menus/EditorPopupMenu
56145
56243
  }
56146
56244
  return;
56147
56245
  }
56148
- records.push({
56149
- type: "attributes",
56150
- oldValue: oldInset,
56151
- target: selectedElement,
56152
- attributeName: insetAttribute,
56153
- attributeNamespace: ""
56154
- });
56155
- if (moved) {
56156
- records.push({
56157
- type: "attributes",
56158
- oldValue: oldWidth,
56159
- target: selectedElement,
56160
- attributeName: widthAttribute,
56161
- attributeNamespace: ""
56162
- });
56163
- records.push({
56164
- type: "attributes",
56165
- oldValue: oldHeight,
56166
- target: selectedElement,
56167
- attributeName: heightAttribute,
56168
- attributeNamespace: ""
56169
- });
56170
- }
56171
- undoRedo.observe(records);
56172
- editor.commit();
56173
- setTimeout(() => {
56174
- selection.updateRect();
56175
- hover.updateRect();
56176
- }, 1);
56246
+ sc.commit();
56177
56247
  };
56178
56248
  element.addEventListener("pointerup", release);
56179
56249
  };
@@ -56183,6 +56253,8 @@ System.register(["@web-atoms/core/dist/core/XNode", "../../menus/EditorPopupMenu
56183
56253
  if (!currentElement.hasAttribute("data-edit")) {
56184
56254
  return;
56185
56255
  }
56256
+ currentElement.tabIndex = 0;
56257
+ currentElement.focus();
56186
56258
  const resize = element.getAttribute("data-resize");
56187
56259
  if (resize) {
56188
56260
  switch (resize) {
@@ -56229,6 +56301,62 @@ System.register(["@web-atoms/core/dist/core/XNode", "../../menus/EditorPopupMenu
56229
56301
  return r;
56230
56302
  });
56231
56303
  };
56304
+ keyboardEditingSymbol = Symbol("keyboardEditing");
56305
+ eventKeyDown = (editor, e) => {
56306
+ const element = e.target;
56307
+ const currentElement = e.currentTarget;
56308
+ if (!currentElement.hasAttribute("data-edit")) {
56309
+ return;
56310
+ }
56311
+ let dx = 0;
56312
+ let dy = 0;
56313
+ switch (e.key) {
56314
+ case "ArrowDown":
56315
+ dy = e.repeat ? 5 : 1;
56316
+ break;
56317
+ case "ArrowUp":
56318
+ dy = e.repeat ? -5 : -1;
56319
+ break;
56320
+ case "ArrowLeft":
56321
+ dx = e.repeat ? -5 : -1;
56322
+ break;
56323
+ case "ArrowRight":
56324
+ dx = e.repeat ? 5 : 1;
56325
+ break;
56326
+ default:
56327
+ return;
56328
+ }
56329
+ let sc = currentElement[keyboardEditingSymbol];
56330
+ if (!sc) {
56331
+ const fx = r => {
56332
+ r.top += r.dy;
56333
+ r.left += r.dx;
56334
+ r.bottom -= r.dy;
56335
+ r.right -= r.dx;
56336
+ r.move = true;
56337
+ return r;
56338
+ };
56339
+ sc = new SelectedCapture(editor, element);
56340
+ currentElement[keyboardEditingSymbol] = sc;
56341
+ sc.move({
56342
+ dx,
56343
+ dy,
56344
+ fx
56345
+ });
56346
+ const timer = setInterval(() => sc.move({
56347
+ dx,
56348
+ dy,
56349
+ fx
56350
+ }), 250);
56351
+ const release = () => {
56352
+ clearInterval(timer);
56353
+ currentElement[keyboardEditingSymbol] = void 0;
56354
+ currentElement.removeEventListener("keyup", release);
56355
+ sc.commit();
56356
+ };
56357
+ currentElement.addEventListener("keyup", release);
56358
+ }
56359
+ };
56232
56360
  }
56233
56361
  };
56234
56362
  });