@social-mail/social-mail-client 1.4.21 → 1.4.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-client",
3
- "version": "1.4.21",
3
+ "version": "1.4.23",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -27,3 +27,34 @@ export const GridBox = Block({
27
27
  });
28
28
 
29
29
 
30
+ StylerSets.register("low", styled.css `
31
+ display: grid;
32
+ gap: ${stylerVars.sizeDefault};
33
+ padding: ${stylerVars.sizeDefault};
34
+ border-radius: ${stylerVars.sizeDefault};
35
+ align-items: center;
36
+ justify-content: center;
37
+ overflow: hidden;
38
+ grid-template-columns: 1fr;
39
+ grid-template-rows: 1fr;
40
+
41
+ & > * {
42
+ grid-row: 1;
43
+ grid-column: 1;
44
+ }
45
+
46
+ `.expand("[styler-layout=grid-1x1]"));
47
+
48
+
49
+ export const Grid1x1Box = Block({
50
+ className: "fa-duotone fa-solid fa-grid-5",
51
+ title: "Add Grid Box",
52
+ // text: "\uf73f",
53
+ factory: () => <section
54
+ styler-layout="grid-1x1">
55
+ <section></section>
56
+ <section></section>
57
+ </section>
58
+ });
59
+
60
+
@@ -81,7 +81,7 @@ import { GridBox } from "../blocks/GridBox";
81
81
 
82
82
  & > [data-element=left] {
83
83
  background-color: canvas;
84
- grid-row: 1 / span 3;
84
+ grid-row: 1 / span 2;
85
85
  grid-column: 1;
86
86
  border-right: solid 1px lightgray;
87
87
  border-radius: 0;
@@ -90,7 +90,7 @@ import { GridBox } from "../blocks/GridBox";
90
90
 
91
91
  & > [data-element=right] {
92
92
  background-color: canvas;
93
- grid-row: 1 / span 3;
93
+ grid-row: 1 / span 2;
94
94
  grid-column: 3;
95
95
  border-left: solid 1px lightgray;
96
96
  border-radius: 0;
@@ -40,6 +40,7 @@ export class SelectedElement {
40
40
 
41
41
  private dragTimeout: number;
42
42
  private mo: MutationObserver;
43
+ private ro: ResizeObserver;
43
44
  private e: HTMLElement;
44
45
  private styles = new Map();
45
46
  private cachedStyle: CSSStyleDeclaration;
@@ -75,6 +76,10 @@ export class SelectedElement {
75
76
  AtomBinder.refreshValue(iterator, "custom");
76
77
  }
77
78
  });
79
+
80
+ this.ro = new ResizeObserver(() => this.updateRect());
81
+
82
+ // setInterval(() => this.updateRect(), 1000);
78
83
  }
79
84
 
80
85
  setDraggable() {
@@ -188,6 +193,7 @@ export class SelectedElement {
188
193
  clearTimeout(this.dragTimeout);
189
194
  this.dragTimeout = 0;
190
195
  }
196
+ this.ro.disconnect();
191
197
  }
192
198
  this.e = e;
193
199
  AtomBinder.refreshValue(this, "element");
@@ -198,6 +204,8 @@ export class SelectedElement {
198
204
  AtomBinder.refreshValue(this, "attributes");
199
205
  AtomBinder.refreshValue(this, "styleProperty");
200
206
  this.mo.observe(e, { attributes: true });
207
+ this.ro.observe(e.ownerDocument.body);
208
+ this.ro.observe(e);
201
209
  }
202
210
  e = this.e;
203
211
  if (!e) {
@@ -205,15 +213,28 @@ export class SelectedElement {
205
213
  }
206
214
  this.name = e.tagName.toLowerCase();
207
215
  this.parentName = e.parentElement?.tagName.toLowerCase();
208
- const r = e.getBoundingClientRect();
209
216
  this.isImage = /^(img|video|pdf)/i.test(this.name);
217
+ this.updateRect();
218
+
219
+ for (const iterator of this.styles.values()) {
220
+ AtomBinder.refreshValue(iterator, "value");
221
+ AtomBinder.refreshValue(iterator, "custom");
222
+ }
223
+ }
224
+
225
+ private updateRect() {
226
+ const { e } = this;
227
+ if (!e) {
228
+ return;
229
+ }
230
+ const r = e.getBoundingClientRect();
210
231
  const minusWidth = Math.min(0, r.left);
211
232
  this.top = `${r.top + 10}px`;
212
233
  this.left = `${Math.max(0, r.left) + 10}px`;
213
234
  this.width = `${r.width + minusWidth}px`;
214
235
  this.height = `${r.height}px`;
215
236
 
216
- switch(this.dropAnchor) {
237
+ switch (this.dropAnchor) {
217
238
  case "top":
218
239
  this.height = "2px";
219
240
  break;
@@ -229,10 +250,5 @@ export class SelectedElement {
229
250
  this.width = "2px";
230
251
  break;
231
252
  }
232
-
233
- for (const iterator of this.styles.values()) {
234
- AtomBinder.refreshValue(iterator, "value");
235
- AtomBinder.refreshValue(iterator, "custom");
236
- }
237
253
  }
238
254
  }
@@ -19,6 +19,7 @@ export default function LayoutEditor () {
19
19
  "component",
20
20
  "feature",
21
21
  "grid",
22
+ "grid-1x1",
22
23
  "image-box",
23
24
  "image-card",
24
25
  "main",