@social-mail/social-mail-client 1.8.312 → 1.8.314

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.
Files changed (41) hide show
  1. package/dist/site-editor/editor/HtmlPageEditor.d.ts +2 -2
  2. package/dist/site-editor/editor/HtmlPageEditor.d.ts.map +1 -1
  3. package/dist/site-editor/editor/HtmlPageEditor.global.css +1 -1
  4. package/dist/site-editor/editor/HtmlPageEditor.global.css.map +1 -1
  5. package/dist/site-editor/editor/HtmlPageEditor.js +14 -56
  6. package/dist/site-editor/editor/HtmlPageEditor.js.map +1 -1
  7. package/dist/site-editor/editor/SelectedElement.d.ts +1 -1
  8. package/dist/site-editor/editor/SelectedElement.d.ts.map +1 -1
  9. package/dist/site-editor/editor/SelectedElement.js.map +1 -1
  10. package/dist/site-editor/editor/sizes.d.ts +4 -0
  11. package/dist/site-editor/editor/sizes.d.ts.map +1 -0
  12. package/dist/site-editor/editor/sizes.js +14 -0
  13. package/dist/site-editor/editor/sizes.js.map +1 -0
  14. package/dist/site-editor/editor/ui/SelectionUI.d.ts +10 -0
  15. package/dist/site-editor/editor/ui/SelectionUI.d.ts.map +1 -0
  16. package/dist/site-editor/editor/ui/SelectionUI.global.css +2 -0
  17. package/dist/site-editor/editor/ui/SelectionUI.global.css.map +1 -0
  18. package/dist/site-editor/editor/ui/SelectionUI.js +193 -0
  19. package/dist/site-editor/editor/ui/SelectionUI.js.map +1 -0
  20. package/dist/site-editor-app/SiteEditorApp.pack.global.css +1 -1
  21. package/dist/site-editor-app/SiteEditorApp.pack.global.css.map +1 -1
  22. package/dist/site-editor-app/SiteEditorApp.pack.js +240 -61
  23. package/dist/site-editor-app/SiteEditorApp.pack.js.map +1 -1
  24. package/dist/site-editor-app/SiteEditorApp.pack.min.js +1 -1
  25. package/dist/site-editor-app/SiteEditorApp.pack.min.js.map +1 -1
  26. package/dist/site-editor-app/drawer/SiteEditorDrawer.d.ts +1 -0
  27. package/dist/site-editor-app/drawer/SiteEditorDrawer.d.ts.map +1 -1
  28. package/dist/site-editor-app/drawer/SiteEditorDrawer.global.css +2 -0
  29. package/dist/site-editor-app/drawer/SiteEditorDrawer.global.css.map +1 -0
  30. package/dist/site-editor-app/drawer/SiteEditorDrawer.js +12 -4
  31. package/dist/site-editor-app/drawer/SiteEditorDrawer.js.map +1 -1
  32. package/dist/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +1 -1
  34. package/src/site-editor/editor/HtmlPageEditor.global.css +3 -58
  35. package/src/site-editor/editor/HtmlPageEditor.tsx +12 -55
  36. package/src/site-editor/editor/SelectedElement.tsx +1 -1
  37. package/src/site-editor/editor/sizes.ts +3 -0
  38. package/src/site-editor/editor/ui/SelectionUI.global.css +78 -0
  39. package/src/site-editor/editor/ui/SelectionUI.tsx +218 -0
  40. package/src/site-editor-app/drawer/SiteEditorDrawer.global.css +25 -0
  41. package/src/site-editor-app/drawer/SiteEditorDrawer.tsx +9 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-client",
3
- "version": "1.8.312",
3
+ "version": "1.8.314",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -71,71 +71,16 @@
71
71
  }
72
72
  }
73
73
 
74
- & > [data-element=selection] {
75
- position: absolute;
76
- pointer-events: none;
77
- outline: solid 1px green;
78
- z-index: 22;
79
- & > .lt, & > .rt, & > .lb, & > .rb {
80
- position: absolute;
81
- width: 10px;
82
- height: 10px;
83
- background-color: blue;
84
- border: solid 1px white;
85
- display: none;
86
- border-radius: 5px;
87
- }
88
- & > .lt {
89
- top: -5px;
90
- left: -5px;
91
- }
92
- & > .rt {
93
- top: -5px;
94
- right: -5px;
95
- }
96
- & > .lb {
97
- bottom: -5px;
98
- left: -5px;
99
- }
100
- & > .rb {
101
- bottom: -5px;
102
- right: -5px;
103
- }
104
- & > div {
105
- pointer-events: all;
106
- position: absolute;
107
- right: 0;
108
- top: -1.4rem;
109
- /* transform: translate(0, -100%); */
110
- background-color: #0000ff;
111
- color: white;
112
- font-size: smaller;
113
- text-transform: capitalize;
114
- padding: 2px;
115
- padding-left: 5px;
116
- padding-right: 5px;
117
- display: flex;
118
- gap: 5px;
119
- & > * {
120
- cursor: pointer;
121
- padding: 2px;
122
- &:hover {
123
- background-color: white;
124
- color: blue;
125
- }
126
- }
127
- }
128
- }
129
74
  & > [data-element=hover] {
130
75
  position: absolute;
131
- outline: solid 1px blue;
132
- outline-color: #0000ff6a;
76
+ outline: solid 1px green;
77
+ outline-color: #00940094;
133
78
  pointer-events: none;
134
79
  z-index: 20;
135
80
  & > label {
136
81
  position: absolute;
137
82
  transform: translate(0, -100%);
138
- background-color: #0000ff6a;
83
+ background-color: #00940094;
139
84
  color: white;
140
85
  font-size: smaller;
141
86
  text-transform: capitalize;
@@ -59,12 +59,13 @@ import { ElementBuilder } from "../properties/controls/ElementBuilder";
59
59
  import { IToolItem } from "../tools/section/ToolSection";
60
60
  import { editorSuggestions } from "../suggestions/editorSuggestions";
61
61
  import InlinePopupButton from "@web-atoms/web-controls/dist/basic/InlinePopupButton";
62
- import EditorPopupMenu from "../menus/EditorPopupMenu";
63
62
  import { IAppFile } from "../../model/model";
63
+ import { SelectionUI } from "./ui/SelectionUI";
64
+ import { desktopScreenWidth, mobileScreenWidth, tabletScreenWidth } from "./sizes";
64
65
 
65
- const desktopWidth = 992;
66
- const tabletWidth = 768;
67
- const mobileWidth = 480;
66
+ const desktopWidth = desktopScreenWidth;
67
+ const tabletWidth = tabletScreenWidth;
68
+ const mobileWidth = mobileScreenWidth;
68
69
 
69
70
  const languageSymbol = Symbol.for("language");
70
71
 
@@ -80,6 +81,9 @@ export default class HtmlPageEditor extends AtomControl {
80
81
 
81
82
  public readonly selection: SelectedElement = new SelectedElement(this);
82
83
 
84
+ public readonly hover: SelectedElement = new SelectedElement(this);
85
+
86
+
83
87
  public undoRedo = { canUndo: false, canRedo: false, dispose() { /* do nothing */ } } as any as UndoRedo;
84
88
 
85
89
  @BindableProperty
@@ -89,6 +93,9 @@ export default class HtmlPageEditor extends AtomControl {
89
93
 
90
94
  public languages = null;
91
95
 
96
+ public maxWidth = desktopWidth;
97
+
98
+
92
99
  public get modifiedDocument() {
93
100
  if (!this.undoRedo.changed) {
94
101
  return null;
@@ -225,12 +232,9 @@ export default class HtmlPageEditor extends AtomControl {
225
232
 
226
233
  private contentEditor: HTMLIFrameElement;
227
234
 
228
- private readonly hover: SelectedElement = new SelectedElement(this);
229
235
 
230
236
  private readonly dropTarget: SelectedElement = new SelectedElement(this);
231
237
 
232
- private maxWidth = desktopWidth;
233
-
234
238
  private lastCommitTimerID;
235
239
 
236
240
  constructor(app, e) {
@@ -319,54 +323,7 @@ export default class HtmlPageEditor extends AtomControl {
319
323
  style-width={Bind.oneWay(() => this.dropTarget.width)}
320
324
  style-height={Bind.oneWay(() => this.dropTarget.height)}>
321
325
  </div>
322
- <div data-element="selection"
323
- style-left={Bind.oneWay(() => this.selection.left)}
324
- style-top={Bind.oneWay(() => this.selection.top)}
325
- style-width={Bind.oneWay(() => this.selection.width)}
326
- style-height={Bind.oneWay(() => this.selection.height)}>
327
- <i class="lt" />
328
- <i class="rt" />
329
- <i class="lb" />
330
- <i class="rb" />
331
- <div>
332
- <i
333
- class="fa-regular fa-arrow-up"
334
- event-click={() => {
335
- if (this.selection.element.parentElement !== this.htmlDocument.body) {
336
- this.selection.update(this.selection.element.parentElement);
337
- }
338
- }}
339
- />
340
- <i
341
- event-click={() => {
342
- this.selection.setDraggable();
343
- }}
344
- class="fa-solid fa-up-down-left-right"
345
- data-click-event="start-drag"/>
346
- <i
347
- style-display={Bind.oneWay(() => this.selection.element.hasAttribute("styler-invisible"))}
348
- class="fa-solid fa-eye-slash"
349
- event-click={() => (this.selection.element.removeAttribute("styler-invisible"), this.selection.refresh())}
350
- title="Show Object"
351
- />
352
- <i
353
- style-display={Bind.oneWay(() => !this.selection.element.hasAttribute("styler-invisible"))}
354
- class="fa-solid fa-eye"
355
- event-click={() => (this.selection.element.setAttribute("styler-invisible", "1"), this.selection.refresh())}
356
- title="Hide to reveal objects behind this"
357
- />
358
- <i
359
- style-display={Bind.oneWay(() => this.selection.isImage)}
360
- data-click-event="change-image"
361
- title="Change Image (Double Click)"
362
- class="fa-solid fa-arrows-rotate-reverse"></i>
363
- <i
364
- title="Extract Fragment"
365
- data-click-event="extract-element"
366
- class="fad fa-file-export"/>
367
- <EditorPopupMenu/>
368
- </div>
369
- </div>
326
+ <SelectionUI/>
370
327
  <div data-element="hover"
371
328
  style-left={Bind.oneWay(() => this.hover.left)}
372
329
  style-top={Bind.oneWay(() => this.hover.top)}
@@ -247,7 +247,7 @@ export class SelectedElement {
247
247
  }
248
248
  }
249
249
 
250
- private updateRect() {
250
+ public updateRect() {
251
251
  const { e } = this;
252
252
  if (!e) {
253
253
  return;
@@ -0,0 +1,3 @@
1
+ export const desktopScreenWidth = 992;
2
+ export const tabletScreenWidth = 768;
3
+ export const mobileScreenWidth = 480;
@@ -0,0 +1,78 @@
1
+ selected-element {
2
+ position: absolute;
3
+ outline: solid 1px blue;
4
+ z-index: 22;
5
+ &:not([data-edit]) {
6
+ pointer-events: none;
7
+ & > i {
8
+ display: none;
9
+ }
10
+ }
11
+ &[data-edit] {
12
+ cursor: move;
13
+ }
14
+ & > [data-resize] {
15
+ display: block;
16
+ position: absolute;
17
+ width: 10px;
18
+ height: 10px;
19
+ background-color: blue;
20
+ border: solid 1px white;
21
+ border-radius: 5px;
22
+ }
23
+ & > [data-resize=lt] {
24
+ top: -5px;
25
+ left: -5px;
26
+ cursor: nw-resize;
27
+ }
28
+ & > [data-resize=rt] {
29
+ top: -5px;
30
+ right: -5px;
31
+ cursor: ne-resize;
32
+ }
33
+ & > [data-resize=lb] {
34
+ bottom: -5px;
35
+ left: -5px;
36
+ cursor: sw-resize;
37
+ }
38
+ & > [data-resize=rb] {
39
+ bottom: -5px;
40
+ right: -5px;
41
+ cursor: se-resize;
42
+ }
43
+ & > label {
44
+ position: absolute;
45
+ transform: translate(0, -100%);
46
+ background-color: #0000ff;
47
+ color: white;
48
+ font-size: smaller;
49
+ text-transform: capitalize;
50
+ padding: 2px;
51
+ padding-left: 5px;
52
+ padding-right: 5px;
53
+ }
54
+ & > div {
55
+ pointer-events: all;
56
+ position: absolute;
57
+ right: 0;
58
+ top: -1.4rem;
59
+ /* transform: translate(0, -100%); */
60
+ background-color: #0000ff;
61
+ color: white;
62
+ font-size: smaller;
63
+ text-transform: capitalize;
64
+ padding: 2px;
65
+ padding-left: 5px;
66
+ padding-right: 5px;
67
+ display: flex;
68
+ gap: 5px;
69
+ & > * {
70
+ cursor: pointer;
71
+ padding: 2px;
72
+ &:hover {
73
+ background-color: white;
74
+ color: blue;
75
+ }
76
+ }
77
+ }
78
+ }
@@ -0,0 +1,218 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention */
2
+ /* eslint-disable @typescript-eslint/no-namespace */
3
+ import XNode from "@web-atoms/core/dist/core/XNode";
4
+ import EditorPopupMenu from "../../menus/EditorPopupMenu";
5
+ import { BindEditor } from "../../properties/controls/PropertyEditor";
6
+
7
+ import "./SelectionUI.global.css";
8
+ import HtmlPageEditor from "../HtmlPageEditor";
9
+ import { mobileScreenWidth, tabletScreenWidth } from "../sizes";
10
+ import { AtomBinder } from "@web-atoms/core/dist/core/AtomBinder";
11
+
12
+ declare global {
13
+ namespace JSX {
14
+ interface IntrinsicElements {
15
+ "selected-element": any;
16
+ }
17
+ }
18
+ }
19
+
20
+ interface IRect {
21
+ left;
22
+ top;
23
+ right;
24
+ bottom;
25
+ dx;
26
+ dy;
27
+ sx;
28
+ sy;
29
+ }
30
+
31
+ const setCapture = (editor: HtmlPageEditor, element: HTMLElement, e: PointerEvent, fx: (r: IRect, ) => IRect) => {
32
+
33
+
34
+ const prefix = editor.maxWidth === tabletScreenWidth
35
+ ? "styler-tablet"
36
+ : (editor.maxWidth === mobileScreenWidth
37
+ ? "styler-mobile"
38
+ : "styler");
39
+
40
+ const sx = e.clientX;
41
+ const sy = e.clientY;
42
+
43
+ const { selection, hover } = editor;
44
+ const selectedElement = selection.element;
45
+ const selectedParent = selectedElement.parentElement;
46
+
47
+ const style = selectedElement.ownerDocument.defaultView.getComputedStyle(selectedElement);
48
+ const { left = "0", top = "0", right = "0", bottom = "0" } = style;
49
+ const width = selectedParent.offsetWidth;
50
+ const height = selectedParent.offsetHeight;
51
+
52
+ const ps = (v, max) => (v* 100 / (max || 1)).toFixed(2);
53
+
54
+ const captureMove = (evt: PointerEvent) => {
55
+ const dx = evt.clientX - sx;
56
+ const dy = evt.clientY - sy;
57
+ const ri = {
58
+ left: parseFloat(left),
59
+ top: parseFloat(top),
60
+ right: parseFloat(right),
61
+ bottom: parseFloat(bottom),
62
+ sx,
63
+ sy,
64
+ dx,
65
+ dy
66
+ };
67
+ const r = fx(ri);
68
+ const av = `${ps(r.top, height)}% ${ps(r.right, width)}% ${ps(r.bottom, height)}% ${ps(r.left, width)}%`;
69
+ selectedElement.setAttribute(`${prefix}-inset`, av);
70
+ if (/^img$/i.test(selectedElement.tagName)) {
71
+ // image needs width/height as well...
72
+ let widthDiff = -r.left;
73
+ let heightDiff = -r.top;
74
+ if (ri.bottom === r.bottom) {
75
+ heightDiff -= r.bottom;
76
+ }
77
+ if (ri.right === r.right) {
78
+ widthDiff -= r.right;
79
+ }
80
+ selectedElement.setAttribute(`${prefix}-width`, ps(width + widthDiff, width) + "%");
81
+ selectedElement.setAttribute(`${prefix}-height`, ps(height + heightDiff, height) + "%");
82
+ }
83
+
84
+ setTimeout(() => {
85
+ selection.updateRect();
86
+ hover.updateRect();
87
+ }, 1);
88
+ };
89
+
90
+ element.addEventListener("pointermove", captureMove);
91
+ element.setPointerCapture(e.pointerId);
92
+ const release = () => {
93
+ element.releasePointerCapture(e.pointerId);
94
+ element.removeEventListener("pointermove", captureMove);
95
+ element.removeEventListener("pointerup", release);
96
+ };
97
+ element.addEventListener("pointerup", release);
98
+ };
99
+
100
+ const eventPointerDown = (editor: HtmlPageEditor, e: PointerEvent) => {
101
+ const element = e.target as HTMLElement;
102
+ const currentElement = e.currentTarget as HTMLElement;
103
+ if (!currentElement.hasAttribute("data-edit")) {
104
+ return;
105
+ }
106
+
107
+ const resize = element.getAttribute("data-resize");
108
+ if (resize) {
109
+
110
+
111
+ // enable resizing...
112
+ switch(resize) {
113
+ case "lt":
114
+ setCapture(editor, element, e, (r) => {
115
+ r.left += r.dx;
116
+ r.top += r.dy;
117
+ return r;
118
+ });
119
+ return;
120
+ case "rt":
121
+ setCapture(editor, element, e, (r) => {
122
+ r.top += r.dy;
123
+ r.right -= r.dx;
124
+ return r;
125
+ });
126
+ return;
127
+ case "lb":
128
+ setCapture(editor, element, e, (r) => {
129
+ r.left += r.dx;
130
+ r.bottom -= r.dy;
131
+ return r;
132
+ });
133
+ return;
134
+ case "rb":
135
+ setCapture(editor, element, e, (r) => {
136
+ r.bottom -= r.dy;
137
+ r.right -= r.dx;
138
+ return r;
139
+ });
140
+ return;
141
+ }
142
+ return;
143
+ }
144
+
145
+ if(currentElement !== element) {
146
+ return;
147
+ }
148
+
149
+ setCapture(editor, element, e, (r) => {
150
+ r.top += r.dy;
151
+ r.left += r.dx;
152
+ r.bottom -= r.dy;
153
+ r.right -= r.dx;
154
+ return r;
155
+ });
156
+
157
+
158
+ };
159
+
160
+ export function SelectionUI() {
161
+ return <selected-element data-element="selection"
162
+ data-edit={BindEditor.oneWay((e) => /absolute|fixed/i.test(e.selection.currentStyle.position) ? "1" : null)}
163
+ event-pointerdown={BindEditor.event(eventPointerDown as any)}
164
+ style-left={BindEditor.oneWay((e) => e.selection.left)}
165
+ style-top={BindEditor.oneWay((e) => e.selection.top)}
166
+ style-width={BindEditor.oneWay((e) => e.selection.width)}
167
+ style-height={BindEditor.oneWay((e) => e.selection.height)}>
168
+ <label text={BindEditor.oneWay((e) => e.selection.name)}/>
169
+ <i data-resize="lt"/>
170
+ <i data-resize="rt"/>
171
+ <i data-resize="lb"/>
172
+ <i data-resize="rb"/>
173
+ <div>
174
+ <i
175
+ class="fa-regular fa-arrow-up"
176
+ event-click={BindEditor.event((e) => {
177
+ if (e.selection.element.parentElement !== e.htmlDocument.body) {
178
+ e.selection.update(e.selection.element.parentElement);
179
+ }
180
+ })}
181
+ />
182
+ <i
183
+ event-click={BindEditor.event((e) => {
184
+ e.selection.setDraggable();
185
+ })}
186
+ class="fa-solid fa-up-down-left-right"
187
+ data-click-event="start-drag"/>
188
+ <i
189
+ style-display={BindEditor.oneWay((e) => e.selection.element.hasAttribute("styler-invisible"))}
190
+ class="fa-solid fa-eye-slash"
191
+ event-click={BindEditor.event((e) => {
192
+ e.selection.element.removeAttribute("styler-invisible");
193
+ e.selection.refresh();
194
+ })}
195
+ title="Show Object"
196
+ />
197
+ <i
198
+ style-display={BindEditor.oneWay((e) => !e.selection.element.hasAttribute("styler-invisible"))}
199
+ class="fa-solid fa-eye"
200
+ event-click={BindEditor.event((e) => {
201
+ e.selection.element.setAttribute("styler-invisible", "1");
202
+ e.selection.refresh();
203
+ })}
204
+ title="Hide to reveal objects behind this"
205
+ />
206
+ <i
207
+ style-display={BindEditor.oneWay((e) => e.selection.isImage)}
208
+ data-click-event="change-image"
209
+ title="Change Image (Double Click)"
210
+ class="fa-solid fa-arrows-rotate-reverse"></i>
211
+ <i
212
+ title="Extract Fragment"
213
+ data-click-event="extract-element"
214
+ class="fad fa-file-export"/>
215
+ <EditorPopupMenu/>
216
+ </div>
217
+ </selected-element>;
218
+ }
@@ -0,0 +1,25 @@
1
+ drawer-menu {
2
+ /* & > .menus, & > section {
3
+ scrollbar-color: transparent transparent;
4
+ &:hover {
5
+ scrollbar-color: var(--accent-color, gray) var(--accent-color, gray);
6
+ }
7
+
8
+ & *:hover {
9
+ scrollbar-color: var(--accent-color, gray) var(--accent-color, gray);
10
+ }
11
+ } */
12
+
13
+ .menu-item-search {
14
+ overflow: hidden;
15
+ & input {
16
+ width: 100%;
17
+ margin-left: 16px;
18
+ border-radius: 0;
19
+ border-bottom: solid 1px transparent;
20
+ &:focus {
21
+ border-bottom: solid 1px var(--accent-color);
22
+ }
23
+ }
24
+ }
25
+ }
@@ -10,6 +10,8 @@ import MenuItem from "../../common/controls/menu/MenuItem";
10
10
  import BaseDrawer from "../../common/controls/drawer/BaseDrawer";
11
11
  import SocialMailApp from "../../common/SocialMailApp";
12
12
 
13
+ import "./SiteEditorDrawer.global.css";
14
+
13
15
  export default class SiteEditorDrawer extends BaseDrawer {
14
16
 
15
17
  @InjectProperty
@@ -20,13 +22,19 @@ export default class SiteEditorDrawer extends BaseDrawer {
20
22
  <header>
21
23
  Social Websites
22
24
  </header>
23
- <section>
25
+ <section
26
+ other={Bind.oneWayAsync((c, e, cancelToken) => this.menuService.load(this.menuService.search, cancelToken))}>
24
27
  { SocialMailApp.config.links.home !== "/"
25
28
  && <MenuItem
26
29
  icon="fas fa-home"
27
30
  label="Home"
28
31
  href={SocialMailApp.config.links.home}
29
32
  />}
33
+ <div class="menu-item-search" style-display={Bind.oneWay(() => this.menuService.showSearch)}>
34
+ <input
35
+ type="search"
36
+ value={Bind.twoWaysImmediate(() => this.menuService.search)}/>
37
+ </div>
30
38
  <AtomRepeater
31
39
  items={Bind.oneWay(() => this.menuService.websites)}
32
40
  itemRenderer={(x: IWebSite) => <ExpanderMenu isExpanded={true}>