@social-mail/social-mail-client 1.8.406 → 1.8.411
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/content/svg/angle-down.svg +1 -0
- package/content/svg/angle-right.svg +1 -0
- package/content/svg/eye-slash.svg +1 -0
- package/content/svg/eye.svg +1 -0
- package/dist/admin/AdminAppIndex.pack.global.css +1 -1
- package/dist/admin/AdminAppIndex.pack.global.css.map +1 -1
- package/dist/admin/AdminAppIndex.pack.js +2 -1
- package/dist/admin/AdminAppIndex.pack.js.map +1 -1
- package/dist/admin/AdminAppIndex.pack.min.js +1 -1
- package/dist/admin/AdminAppIndex.pack.min.js.map +1 -1
- package/dist/public/channel/ChannelApp.pack.global.css +1 -1
- package/dist/public/channel/ChannelApp.pack.global.css.map +1 -1
- package/dist/public/channel/ChannelApp.pack.js +1 -1
- package/dist/public/channel/ChannelApp.pack.js.map +1 -1
- package/dist/public/channel/ChannelApp.pack.min.js +1 -1
- package/dist/public/channel/ChannelApp.pack.min.js.map +1 -1
- package/dist/site-editor/editor/HtmlPageEditor.d.ts.map +1 -1
- package/dist/site-editor/editor/HtmlPageEditor.js +3 -7
- package/dist/site-editor/editor/HtmlPageEditor.js.map +1 -1
- package/dist/site-editor/editor/UndoRedo.d.ts +1 -0
- package/dist/site-editor/editor/UndoRedo.d.ts.map +1 -1
- package/dist/site-editor/editor/UndoRedo.js +27 -1
- package/dist/site-editor/editor/UndoRedo.js.map +1 -1
- package/dist/site-editor/suggestions/editorSuggestions.d.ts +138 -0
- package/dist/site-editor/suggestions/editorSuggestions.d.ts.map +1 -1
- package/dist/site-editor/suggestions/pair.d.ts +3 -1
- package/dist/site-editor/suggestions/pair.d.ts.map +1 -1
- package/dist/site-editor/suggestions/pair.js +3 -2
- package/dist/site-editor/suggestions/pair.js.map +1 -1
- package/dist/site-editor/suggestions/properties/animations/animations.d.ts +18 -0
- package/dist/site-editor/suggestions/properties/animations/animations.d.ts.map +1 -1
- package/dist/site-editor/suggestions/properties/background.d.ts +5 -0
- package/dist/site-editor/suggestions/properties/background.d.ts.map +1 -1
- package/dist/site-editor/suggestions/properties/border.d.ts +5 -0
- package/dist/site-editor/suggestions/properties/border.d.ts.map +1 -1
- package/dist/site-editor/suggestions/properties/clip.d.ts +1 -0
- package/dist/site-editor/suggestions/properties/clip.d.ts.map +1 -1
- package/dist/site-editor/suggestions/properties/color.d.ts +4 -0
- package/dist/site-editor/suggestions/properties/color.d.ts.map +1 -1
- package/dist/site-editor/suggestions/properties/effects.d.ts +3 -0
- package/dist/site-editor/suggestions/properties/effects.d.ts.map +1 -1
- package/dist/site-editor/suggestions/properties/fontStyles.d.ts +1 -0
- package/dist/site-editor/suggestions/properties/fontStyles.d.ts.map +1 -1
- package/dist/site-editor/suggestions/properties/gap.d.ts +3 -0
- package/dist/site-editor/suggestions/properties/gap.d.ts.map +1 -1
- package/dist/site-editor/suggestions/properties/grid.d.ts +8 -0
- package/dist/site-editor/suggestions/properties/grid.d.ts.map +1 -1
- package/dist/site-editor/suggestions/properties/mask.d.ts +2 -0
- package/dist/site-editor/suggestions/properties/mask.d.ts.map +1 -1
- package/dist/site-editor/suggestions/properties/position.d.ts +9 -0
- package/dist/site-editor/suggestions/properties/position.d.ts.map +1 -1
- package/dist/site-editor/suggestions/properties/size.d.ts +55 -0
- package/dist/site-editor/suggestions/properties/size.d.ts.map +1 -1
- package/dist/site-editor/suggestions/properties/space.d.ts +10 -0
- package/dist/site-editor/suggestions/properties/space.d.ts.map +1 -1
- package/dist/site-editor/suggestions/properties/text.d.ts +7 -0
- package/dist/site-editor/suggestions/properties/text.d.ts.map +1 -1
- package/dist/site-editor/suggestions/properties/transform.d.ts +9 -0
- package/dist/site-editor/suggestions/properties/transform.d.ts.map +1 -1
- package/dist/site-editor/tools/designs/Designs.js +1 -1
- package/dist/site-editor/tools/designs/Designs.js.map +1 -1
- package/dist/site-editor/tools/section/ToolSection.d.ts +0 -1
- package/dist/site-editor/tools/section/ToolSection.d.ts.map +1 -1
- package/dist/site-editor/tools/section/ToolSection.js +4 -13
- package/dist/site-editor/tools/section/ToolSection.js.map +1 -1
- package/dist/site-editor/tools/section/ToolSection.local.css +1 -1
- package/dist/site-editor/tools/section/ToolSection.local.css.map +1 -1
- package/dist/site-editor-app/SiteEditorApp.pack.global.css +1 -1
- package/dist/site-editor-app/SiteEditorApp.pack.global.css.map +1 -1
- package/dist/site-editor-app/SiteEditorApp.pack.js +684 -278
- package/dist/site-editor-app/SiteEditorApp.pack.js.map +1 -1
- package/dist/site-editor-app/SiteEditorApp.pack.local.css +1 -1
- package/dist/site-editor-app/SiteEditorApp.pack.local.css.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/site-editor-app/pages/websites/studio/WebSiteStudioPage.d.ts.map +1 -1
- package/dist/site-editor-app/pages/websites/studio/WebSiteStudioPage.js +56 -28
- package/dist/site-editor-app/pages/websites/studio/WebSiteStudioPage.js.map +1 -1
- package/dist/site-editor-app/pages/websites/studio/WebSiteStudioPage.local.css +1 -1
- package/dist/site-editor-app/pages/websites/studio/WebSiteStudioPage.local.css.map +1 -1
- package/dist/site-editor-app/pages/websites/studio/layers/StudioLayers.d.ts +37 -0
- package/dist/site-editor-app/pages/websites/studio/layers/StudioLayers.d.ts.map +1 -0
- package/dist/site-editor-app/pages/websites/studio/layers/StudioLayers.global.css +2 -0
- package/dist/site-editor-app/pages/websites/studio/layers/StudioLayers.global.css.map +1 -0
- package/dist/site-editor-app/pages/websites/studio/layers/StudioLayers.js +206 -0
- package/dist/site-editor-app/pages/websites/studio/layers/StudioLayers.js.map +1 -0
- package/dist/site-editor-app/pages/websites/studio/layers/TreeElement.d.ts +18 -0
- package/dist/site-editor-app/pages/websites/studio/layers/TreeElement.d.ts.map +1 -0
- package/dist/site-editor-app/pages/websites/studio/layers/TreeElement.global.css +2 -0
- package/dist/site-editor-app/pages/websites/studio/layers/TreeElement.global.css.map +1 -0
- package/dist/site-editor-app/pages/websites/studio/layers/TreeElement.js +186 -0
- package/dist/site-editor-app/pages/websites/studio/layers/TreeElement.js.map +1 -0
- package/dist/site-editor-app/pages/websites/studio/tool-bar/StudioToolBar.d.ts +43 -0
- package/dist/site-editor-app/pages/websites/studio/tool-bar/StudioToolBar.d.ts.map +1 -0
- package/dist/site-editor-app/pages/websites/studio/tool-bar/StudioToolBar.global.css +2 -0
- package/dist/site-editor-app/pages/websites/studio/tool-bar/StudioToolBar.global.css.map +1 -0
- package/dist/site-editor-app/pages/websites/studio/tool-bar/StudioToolBar.js +74 -0
- package/dist/site-editor-app/pages/websites/studio/tool-bar/StudioToolBar.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/web/AppIndex.pack.global.css +1 -1
- package/dist/web/AppIndex.pack.global.css.map +1 -1
- package/dist/web/AppIndex.pack.js +2 -1
- package/dist/web/AppIndex.pack.js.map +1 -1
- package/dist/web/AppIndex.pack.min.js +1 -1
- package/dist/web/AppIndex.pack.min.js.map +1 -1
- package/dist/web/page/mails/service/ConversationService.js +1 -1
- package/dist/web/page/mails/service/ConversationService.js.map +1 -1
- package/dist/web/page/mails/service/MailService.d.ts.map +1 -1
- package/dist/web/page/mails/service/MailService.js +1 -0
- package/dist/web/page/mails/service/MailService.js.map +1 -1
- package/dist/web/page/mails/service/MsgStyle.global.css +1 -1
- package/dist/web/page/mails/service/MsgStyle.global.css.map +1 -1
- package/package.json +1 -1
- package/src/site-editor/editor/HtmlPageEditor.tsx +0 -2
- package/src/site-editor/editor/UndoRedo.tsx +27 -1
- package/src/site-editor/suggestions/pair.ts +3 -2
- package/src/site-editor/tools/designs/Designs.tsx +2 -2
- package/src/site-editor/tools/section/ToolSection.local.css +1 -1
- package/src/site-editor/tools/section/ToolSection.tsx +1 -9
- package/src/site-editor-app/pages/websites/studio/WebSiteStudioPage.local.css +9 -4
- package/src/site-editor-app/pages/websites/studio/WebSiteStudioPage.tsx +63 -48
- package/src/site-editor-app/pages/websites/studio/layers/StudioLayers.global.css +11 -0
- package/src/site-editor-app/pages/websites/studio/layers/StudioLayers.tsx +218 -0
- package/src/site-editor-app/pages/websites/studio/layers/TreeElement.global.css +85 -0
- package/src/site-editor-app/pages/websites/studio/layers/TreeElement.tsx +202 -0
- package/src/site-editor-app/pages/websites/studio/tool-bar/StudioToolBar.global.css +60 -0
- package/src/site-editor-app/pages/websites/studio/tool-bar/StudioToolBar.tsx +79 -0
- package/src/web/page/mails/service/ConversationService.tsx +1 -1
- package/src/web/page/mails/service/MailService.ts +1 -0
- package/src/web/page/mails/service/MsgStyle.global.css +4 -0
- package/dist/site-editor/editor/BreadCrum.d.ts +0 -13
- package/dist/site-editor/editor/BreadCrum.d.ts.map +0 -1
- package/dist/site-editor/editor/BreadCrum.global.css +0 -2
- package/dist/site-editor/editor/BreadCrum.global.css.map +0 -1
- package/dist/site-editor/editor/BreadCrum.js +0 -122
- package/dist/site-editor/editor/BreadCrum.js.map +0 -1
- package/dist/site-editor/tools/Tools.d.ts +0 -5
- package/dist/site-editor/tools/Tools.d.ts.map +0 -1
- package/dist/site-editor/tools/Tools.js +0 -24
- package/dist/site-editor/tools/Tools.js.map +0 -1
- package/dist/site-editor/tools/Tools.local.css +0 -2
- package/dist/site-editor/tools/Tools.local.css.map +0 -1
- package/src/site-editor/editor/BreadCrum.global.css +0 -86
- package/src/site-editor/editor/BreadCrum.tsx +0 -131
- package/src/site-editor/tools/Tools.local.css +0 -9
- package/src/site-editor/tools/Tools.tsx +0 -13
|
@@ -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 { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Todo:
|
|
8
|
+
* https://zumerlab.github.io/snapdom/
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
declare global {
|
|
12
|
+
namespace JSX {
|
|
13
|
+
interface IntrinsicElements {
|
|
14
|
+
"studio-layers": any;
|
|
15
|
+
"layer-item": any;
|
|
16
|
+
"layer-children": any;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface HTMLElement {
|
|
21
|
+
scrollIntoViewIfNeeded(...a: any[]);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const editorElement = Symbol("editorElement");
|
|
26
|
+
const treeElement = Symbol("treeElement");
|
|
27
|
+
|
|
28
|
+
import "./StudioLayers.global.css";
|
|
29
|
+
import HtmlPageEditor from "../../../../../site-editor/editor/HtmlPageEditor";
|
|
30
|
+
import Bind from "@web-atoms/core/dist/core/Bind";
|
|
31
|
+
import TreeElement from "./TreeElement";
|
|
32
|
+
import { ChildEnumerator } from "@web-atoms/core/dist/web/core/AtomUI";
|
|
33
|
+
import Action from "@web-atoms/core/dist/view-model/Action";
|
|
34
|
+
import sleep from "@web-atoms/core/dist/core/sleep";
|
|
35
|
+
|
|
36
|
+
import eye from "@social-mail/social-mail-client/content/svg/eye.svg";
|
|
37
|
+
import eyeSlash from "@social-mail/social-mail-client/content/svg/eye-slash.svg";
|
|
38
|
+
|
|
39
|
+
export default class StudioLayers extends AtomControl {
|
|
40
|
+
|
|
41
|
+
treeElementType = TreeElement;
|
|
42
|
+
|
|
43
|
+
editor: HtmlPageEditor;
|
|
44
|
+
|
|
45
|
+
root: TreeElement;
|
|
46
|
+
|
|
47
|
+
ownerDocument: Document;
|
|
48
|
+
|
|
49
|
+
observer: MutationObserver;
|
|
50
|
+
|
|
51
|
+
constructor(app, e = document.createElement("studio-layers")) {
|
|
52
|
+
super(app, e);
|
|
53
|
+
this.pushInit();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async init() {
|
|
57
|
+
this.renderer = <div
|
|
58
|
+
update-me={Bind.oneWay(() => this.updateMe(this.editor.selection.element))}
|
|
59
|
+
>
|
|
60
|
+
</div>;
|
|
61
|
+
|
|
62
|
+
this.registerDisposable({
|
|
63
|
+
dispose: () => {
|
|
64
|
+
this.observer?.disconnect();
|
|
65
|
+
this.observer = void 0;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
await sleep(100);
|
|
70
|
+
|
|
71
|
+
if (this.editor?.selection?.element) {
|
|
72
|
+
this.updateMe(this.editor.selection.element);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
updateMe(e: HTMLElement) {
|
|
77
|
+
|
|
78
|
+
this.observer?.disconnect();
|
|
79
|
+
this.observer = void 0;
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
if (this.ownerDocument !== e.ownerDocument) {
|
|
83
|
+
this.editor.undoRedo.documentObserver.length = 0;
|
|
84
|
+
this.ownerDocument = e.ownerDocument;
|
|
85
|
+
// reset everything...
|
|
86
|
+
this.root?.remove();
|
|
87
|
+
this.root = document.createElement("tree-element") as TreeElement;
|
|
88
|
+
this.syncItems(this.root, e.ownerDocument.body.firstElementChild as HTMLElement);
|
|
89
|
+
this.element.append(this.root);
|
|
90
|
+
this.editor.undoRedo.documentObserver.push((x) => this.observe(x));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// we should sync items only on node changes...
|
|
94
|
+
this.root.selectedElement = e[treeElement];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
observe(x: MutationRecord) {
|
|
98
|
+
|
|
99
|
+
if(x.type !== "childList") {
|
|
100
|
+
const { target } = x;
|
|
101
|
+
const t = target[treeElement];
|
|
102
|
+
if (t) {
|
|
103
|
+
this.updateProperties(t, target as HTMLElement);
|
|
104
|
+
}
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const { addedNodes, removedNodes, nextSibling, previousSibling } = x;
|
|
109
|
+
|
|
110
|
+
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
111
|
+
for (let index = 0; index < addedNodes.length; index++) {
|
|
112
|
+
const added = addedNodes[index];
|
|
113
|
+
if (added.nodeType !== Node.ELEMENT_NODE) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
const newItem = document.createElement("tree-element") as TreeElement;
|
|
117
|
+
this.syncItems(newItem, added as HTMLElement);
|
|
118
|
+
if (previousSibling) {
|
|
119
|
+
const pSibling = previousSibling[treeElement] as TreeElement;
|
|
120
|
+
pSibling.insertAdjacentElement("afterend", newItem);
|
|
121
|
+
} else if (nextSibling) {
|
|
122
|
+
const nSibling = nextSibling[treeElement] as TreeElement;
|
|
123
|
+
nSibling.insertAdjacentElement("beforebegin", newItem);
|
|
124
|
+
} else {
|
|
125
|
+
const p = added.parentElement[treeElement] as TreeElement;
|
|
126
|
+
p?.insertAdjacentElement("afterbegin", newItem);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
130
|
+
for (let index = 0; index < removedNodes.length; index++) {
|
|
131
|
+
const element = removedNodes[index];
|
|
132
|
+
if (element.nodeType !== Node.ELEMENT_NODE) {
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
const t = element[treeElement] as TreeElement;
|
|
136
|
+
t?.remove();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
syncItems(root: TreeElement, e: HTMLElement) {
|
|
141
|
+
root[editorElement] = e;
|
|
142
|
+
root.innerHTML = "";
|
|
143
|
+
e[treeElement] = root;
|
|
144
|
+
this.updateProperties(root, e);
|
|
145
|
+
|
|
146
|
+
for (const child of ChildEnumerator.enumerate(e)) {
|
|
147
|
+
const node = document.createElement("tree-element") as TreeElement;
|
|
148
|
+
this.syncItems(node, child);
|
|
149
|
+
root.append(node);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
updateProperties(root: TreeElement, e: HTMLElement) {
|
|
154
|
+
const { name, fullName } = this.getName(e);
|
|
155
|
+
root.setAttribute("label", name);
|
|
156
|
+
root.setAttribute("title", fullName);
|
|
157
|
+
|
|
158
|
+
if (e.getAttribute("styler-invisible")) {
|
|
159
|
+
root.setAttribute("actions", `<img data-click-event="show-element" src="${eyeSlash}" title="Show" />`);
|
|
160
|
+
} else {
|
|
161
|
+
root.setAttribute("actions", `<img data-click-event="hide-element" src="${eye}" title="Hide" />`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
getName(start: HTMLElement) {
|
|
166
|
+
const typeName = start.className || start.getAttribute("styler-layout");
|
|
167
|
+
const name = typeName ? start.tagName + "(" + (typeName.length > 25 ? typeName.substring(0, 25) : typeName) + ")" : start.tagName;
|
|
168
|
+
const fullName = typeName ? start.tagName + "(" + typeName + ")" : start.tagName;
|
|
169
|
+
return { name, fullName };
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
@Action({ onEvent: "treeElementAction"})
|
|
174
|
+
onElementAction(d, e) {
|
|
175
|
+
const { target, detail } = e;
|
|
176
|
+
const te = target as TreeElement;
|
|
177
|
+
const element = te[editorElement];
|
|
178
|
+
const clickEvent = detail.getAttribute("data-click-event");
|
|
179
|
+
switch(clickEvent) {
|
|
180
|
+
case "hide-element":
|
|
181
|
+
element.setAttribute("styler-invisible", "true");
|
|
182
|
+
break;
|
|
183
|
+
case "show-element":
|
|
184
|
+
element.removeAttribute("styler-invisible");
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@Action({ onEvent: "treeElementHover"})
|
|
190
|
+
onElementHover(d, e) {
|
|
191
|
+
const target = e.target as TreeElement;
|
|
192
|
+
const ee = target[editorElement];
|
|
193
|
+
if (!ee) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
this.editor.hover.update(ee);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
@Action({ onEvent: "treeElementSelected"})
|
|
200
|
+
onElementSelected(d, e) {
|
|
201
|
+
const target = e.target as TreeElement;
|
|
202
|
+
const ee = target[editorElement] as HTMLElement;
|
|
203
|
+
if (!ee) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (ee === this.editor.selection.element) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
this.editor.selection.update(ee);
|
|
210
|
+
if (ee.scrollIntoViewIfNeeded) {
|
|
211
|
+
ee.scrollIntoViewIfNeeded();
|
|
212
|
+
} else {
|
|
213
|
+
ee.scrollIntoView({ behavior: "smooth" });
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
tree-element {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: auto auto auto 1fr auto;
|
|
4
|
+
grid-template-rows: auto 1fr;
|
|
5
|
+
width: 100%;
|
|
6
|
+
&[hover] {
|
|
7
|
+
&::part(bg) {
|
|
8
|
+
background-color: var(--hover-color, #c0c0c055);
|
|
9
|
+
}
|
|
10
|
+
&::part(actions) {
|
|
11
|
+
display: flex;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
&[selected] {
|
|
15
|
+
&::part(actions) {
|
|
16
|
+
display: flex;
|
|
17
|
+
}
|
|
18
|
+
&::part(bg) {
|
|
19
|
+
background-color: var(--selection-color, highlight);
|
|
20
|
+
}
|
|
21
|
+
&::part(icon),&::part(label) {
|
|
22
|
+
color: var(--selection-color-text, inherit);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
&::part(spacer) {
|
|
26
|
+
grid-row: 1;
|
|
27
|
+
grid-column: 1;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
}
|
|
30
|
+
&::part(bg) {
|
|
31
|
+
grid-row: 1;
|
|
32
|
+
grid-column: 1 / span 5;
|
|
33
|
+
}
|
|
34
|
+
&::part(label) {
|
|
35
|
+
grid-row: 1;
|
|
36
|
+
grid-column: 4;
|
|
37
|
+
white-space: nowrap;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
text-overflow: ellipsis;
|
|
40
|
+
font-size: smaller;
|
|
41
|
+
text-transform: lowercase;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
padding-top: 2px;
|
|
44
|
+
padding-bottom: 2px;
|
|
45
|
+
}
|
|
46
|
+
&::part(actions) {
|
|
47
|
+
grid-row: 1;
|
|
48
|
+
grid-column: 5;
|
|
49
|
+
display: none;
|
|
50
|
+
flex-direction: row;
|
|
51
|
+
align-items: center;
|
|
52
|
+
}
|
|
53
|
+
&::part(action-item) {
|
|
54
|
+
height: 16px;
|
|
55
|
+
padding-right: 2px;
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
}
|
|
58
|
+
&::part(icon) {
|
|
59
|
+
grid-row: 1;
|
|
60
|
+
grid-column: 3;
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
}
|
|
63
|
+
&::part(check) {
|
|
64
|
+
grid-row: 1;
|
|
65
|
+
grid-column: 2;
|
|
66
|
+
appearance: none;
|
|
67
|
+
width: 16px;
|
|
68
|
+
height: 16px;
|
|
69
|
+
margin: 0;
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
background-image: url("../../../../../../content/svg/angle-right.svg");
|
|
72
|
+
background-size: 100% 100%;
|
|
73
|
+
&:checked {
|
|
74
|
+
background-image: url("../../../../../../content/svg/angle-down.svg");
|
|
75
|
+
background-size: 100% 100%;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
&::part(container) {
|
|
79
|
+
grid-row: 2;
|
|
80
|
+
grid-column: 1 / span 5;
|
|
81
|
+
display: flex;
|
|
82
|
+
gap: 0;
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { ChildEnumerator } from "@web-atoms/core/dist/web/core/AtomUI";
|
|
2
|
+
|
|
3
|
+
import "./TreeElement.global.css";
|
|
4
|
+
|
|
5
|
+
const onTreeElementClick = (e: MouseEvent) => {
|
|
6
|
+
const target = e.target as TreeElement;
|
|
7
|
+
const root = target?.treeRoot;
|
|
8
|
+
if (!root) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
root.selectedElement = root;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const onTreeActionClick = (e: MouseEvent) => {
|
|
15
|
+
const target = e.target as TreeElement;
|
|
16
|
+
const root = target?.treeRoot;
|
|
17
|
+
if (!root) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
root.dispatchEvent(new CustomEvent("treeElementAction", {
|
|
21
|
+
bubbles: true,
|
|
22
|
+
detail: target
|
|
23
|
+
}));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const selectedElementSymbol = Symbol("selectedElement");
|
|
27
|
+
|
|
28
|
+
export default class TreeElement extends HTMLElement {
|
|
29
|
+
|
|
30
|
+
static observedAttributes = ["label", "icon", "spacing", "actions"];
|
|
31
|
+
|
|
32
|
+
root: ShadowRoot;
|
|
33
|
+
labelElement: HTMLSpanElement;
|
|
34
|
+
check: HTMLInputElement;
|
|
35
|
+
spacer: HTMLDivElement;
|
|
36
|
+
actions: HTMLElement;
|
|
37
|
+
|
|
38
|
+
get spacing() {
|
|
39
|
+
const parent = this.parentElement as TreeElement;
|
|
40
|
+
if (/tree-element/i.test(parent.tagName)) {
|
|
41
|
+
return parent.spacing + 5;
|
|
42
|
+
}
|
|
43
|
+
return 5;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
get selectedElement() {
|
|
47
|
+
const root = this.treeRoot;
|
|
48
|
+
if (!root) {
|
|
49
|
+
return void 0;
|
|
50
|
+
}
|
|
51
|
+
return root[selectedElementSymbol];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
set selectedElement(v: TreeElement) {
|
|
55
|
+
if (v && !(v instanceof TreeElement)) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const root = this.treeRoot;
|
|
59
|
+
if(!root) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const old = root[selectedElementSymbol] as TreeElement;
|
|
63
|
+
if (old === v) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
old?.removeAttribute("selected");
|
|
67
|
+
v?.setAttribute("selected", "1");
|
|
68
|
+
root[selectedElementSymbol] = v;
|
|
69
|
+
|
|
70
|
+
let start = v;
|
|
71
|
+
if (!v) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// open all root...
|
|
76
|
+
while(start?.check) {
|
|
77
|
+
start.check.checked = true;
|
|
78
|
+
start.updateSelection(true);
|
|
79
|
+
start = start.parentElement as TreeElement;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
v.dispatchEvent(new CustomEvent("treeElementSelected", {
|
|
83
|
+
bubbles: true
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
get treeRoot() {
|
|
88
|
+
let start = this as TreeElement;
|
|
89
|
+
while(/tree-element/i.test(start.parentElement?.tagName)) {
|
|
90
|
+
start = start.parentElement as TreeElement;
|
|
91
|
+
}
|
|
92
|
+
return start;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
96
|
+
switch(name) {
|
|
97
|
+
case "label":
|
|
98
|
+
if (this.labelElement) {
|
|
99
|
+
this.labelElement.textContent = newValue;
|
|
100
|
+
}
|
|
101
|
+
break;
|
|
102
|
+
case "icon":
|
|
103
|
+
break;
|
|
104
|
+
case "actions":
|
|
105
|
+
if (this.actions) {
|
|
106
|
+
this.setActions(newValue);
|
|
107
|
+
}
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
setActions(newValue) {
|
|
112
|
+
this.actions.innerHTML = newValue;
|
|
113
|
+
for (const e of ChildEnumerator.enumerate(this.actions)) {
|
|
114
|
+
e.setAttribute("part", "action-item");
|
|
115
|
+
// @ts-expect-error non existent
|
|
116
|
+
e.treeRoot = this;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
connectedCallback() {
|
|
121
|
+
this.root = this.attachShadow({ mode:"open"});
|
|
122
|
+
const spacer = document.createElement("div");
|
|
123
|
+
spacer.setAttribute("part", "spacer");
|
|
124
|
+
this.spacer = spacer;
|
|
125
|
+
this.root.appendChild(spacer);
|
|
126
|
+
const bg = document.createElement("div");
|
|
127
|
+
bg.setAttribute("part", "bg");
|
|
128
|
+
this.root.appendChild(bg);
|
|
129
|
+
const label = document.createElement("span");
|
|
130
|
+
label.setAttribute("part", "label");
|
|
131
|
+
// @ts-expect-error non existent
|
|
132
|
+
label.treeRoot = this;
|
|
133
|
+
this.labelElement = label;
|
|
134
|
+
const text = this.getAttribute("label");
|
|
135
|
+
if (text) {
|
|
136
|
+
label.textContent = text;
|
|
137
|
+
}
|
|
138
|
+
this.root.appendChild(label);
|
|
139
|
+
const check = document.createElement("input");
|
|
140
|
+
check.setAttribute("part", "check");
|
|
141
|
+
check.setAttribute("type", "checkbox");
|
|
142
|
+
this.check = check;
|
|
143
|
+
this.root.appendChild(check);
|
|
144
|
+
|
|
145
|
+
const actions= document.createElement("div");
|
|
146
|
+
actions.setAttribute("part", "actions");
|
|
147
|
+
this.actions = actions;
|
|
148
|
+
// @ts-expect-error non existent
|
|
149
|
+
actions.treeRoot = this;
|
|
150
|
+
actions.onclick = onTreeActionClick;
|
|
151
|
+
const a = this.getAttribute("actions");
|
|
152
|
+
this.root.appendChild(actions);
|
|
153
|
+
if (a) {
|
|
154
|
+
this.setActions(a);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
label.onclick = onTreeElementClick;
|
|
158
|
+
|
|
159
|
+
label.onpointerenter = () => {
|
|
160
|
+
this.setAttribute("hover", "1");
|
|
161
|
+
this.dispatchEvent(new CustomEvent("treeElementHover", { bubbles: true }));
|
|
162
|
+
};
|
|
163
|
+
label.onpointerleave = () => this.removeAttribute("hover");
|
|
164
|
+
|
|
165
|
+
const container = document.createElement("slot");
|
|
166
|
+
container.setAttribute("name", "container");
|
|
167
|
+
container.setAttribute("part", "container");
|
|
168
|
+
this.root.appendChild(container);
|
|
169
|
+
|
|
170
|
+
check.oninput = (e) => this.updateSelection(e.target !== check);
|
|
171
|
+
|
|
172
|
+
// update parent...
|
|
173
|
+
const parent = this.parentElement as TreeElement;
|
|
174
|
+
if (parent.check) {
|
|
175
|
+
if(parent.check.checked) {
|
|
176
|
+
this.slot = "container";
|
|
177
|
+
this.spacer.style.width = parent.spacing + "px";
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
updateSelection(checkOnly = false) {
|
|
183
|
+
const { check } = this;
|
|
184
|
+
if (check.checked) {
|
|
185
|
+
// show all elements....
|
|
186
|
+
const spacing = this.spacing + "px";
|
|
187
|
+
for (const element of ChildEnumerator.enumerate(this)) {
|
|
188
|
+
element.slot = "container";
|
|
189
|
+
(element as TreeElement).spacer.style.width = spacing;
|
|
190
|
+
}
|
|
191
|
+
} else {
|
|
192
|
+
if(checkOnly) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
for (const element of ChildEnumerator.enumerate(this)) {
|
|
196
|
+
element.slot = "container1";
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
customElements.define("tree-element", TreeElement);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
studio-tool-bar {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: auto 1fr;
|
|
4
|
+
grid-template-rows: 1fr;
|
|
5
|
+
gap: 0;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
& > button-bar {
|
|
8
|
+
grid-row: 1;
|
|
9
|
+
grid-column: 1;
|
|
10
|
+
border: none;
|
|
11
|
+
border-right: solid 1px lightgray;
|
|
12
|
+
border-radius: 0;
|
|
13
|
+
height: 100%;
|
|
14
|
+
|
|
15
|
+
width: 50px;
|
|
16
|
+
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
position: relative;
|
|
20
|
+
|
|
21
|
+
gap: 10px;
|
|
22
|
+
|
|
23
|
+
& > label {
|
|
24
|
+
padding: 5px;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
& input[type=radio] {
|
|
29
|
+
position: absolute;
|
|
30
|
+
left: -10px;
|
|
31
|
+
top: -10px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
& [data-element=header] {
|
|
35
|
+
display: grid;
|
|
36
|
+
grid-template-columns: 1fr;
|
|
37
|
+
grid-template-rows: 1fr auto;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-items: center;
|
|
41
|
+
align-content: center;
|
|
42
|
+
& > i {
|
|
43
|
+
grid-column: 1;
|
|
44
|
+
grid-row: 1;
|
|
45
|
+
font-size: 25px;
|
|
46
|
+
}
|
|
47
|
+
& > span {
|
|
48
|
+
grid-column: 1;
|
|
49
|
+
grid-row: 2;
|
|
50
|
+
font-size: smaller;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
& > [data-element=container] {
|
|
55
|
+
grid-row: 1;
|
|
56
|
+
grid-column: 2;
|
|
57
|
+
overflow-x: hidden;
|
|
58
|
+
overflow-y: auto;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import XNode from "@web-atoms/core/dist/core/XNode";
|
|
2
|
+
import Bind from "@web-atoms/core/dist/core/Bind";
|
|
3
|
+
import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl";
|
|
4
|
+
import ButtonBar from "@web-atoms/web-controls/dist/basic/ButtonBar";
|
|
5
|
+
import Defer from "@web-atoms/core/dist/core/Defer";
|
|
6
|
+
|
|
7
|
+
import "./StudioToolBar.global.css";
|
|
8
|
+
|
|
9
|
+
export default class StudioToolBar extends AtomControl {
|
|
10
|
+
|
|
11
|
+
static page(a: { id, title, body: XNode, className, header?: never } | { id, title?: never, header: XNode, body: XNode, className?: never }) {
|
|
12
|
+
a.header ??= <div data-element="header">
|
|
13
|
+
<i class={a.className}/>
|
|
14
|
+
<span text={a.title}/>
|
|
15
|
+
</div>;
|
|
16
|
+
(a.header.attributes ??= {})["data-element"] = "header";
|
|
17
|
+
return a;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
container: HTMLElement;
|
|
21
|
+
|
|
22
|
+
search = "";
|
|
23
|
+
|
|
24
|
+
root = null;
|
|
25
|
+
|
|
26
|
+
pages = [] as { id, title, body }[];
|
|
27
|
+
|
|
28
|
+
selectedItem = void 0;
|
|
29
|
+
|
|
30
|
+
constructor(app, e = document.createElement("studio-tool-bar")) {
|
|
31
|
+
super(app, e);
|
|
32
|
+
this.pushInit();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async init() {
|
|
36
|
+
|
|
37
|
+
this.selectedItem ??= this.pages[1].id;
|
|
38
|
+
|
|
39
|
+
this.renderer = <div>
|
|
40
|
+
<ButtonBar
|
|
41
|
+
items={this.pages}
|
|
42
|
+
itemRenderer={(x) => x.header}
|
|
43
|
+
valuePath={(x) => x.id}
|
|
44
|
+
value={Bind.twoWaysImmediate(() => this.selectedItem)}
|
|
45
|
+
event-input={() => this.updateSelected()}
|
|
46
|
+
/>
|
|
47
|
+
<div data-element="container"></div>
|
|
48
|
+
</div>;
|
|
49
|
+
|
|
50
|
+
this.container = this.element.querySelector(`[data-element="container"]`) as HTMLElement;
|
|
51
|
+
this.updateSelected();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@Defer(10)
|
|
55
|
+
updateSelected() {
|
|
56
|
+
|
|
57
|
+
this.dispose(this.container);
|
|
58
|
+
this.container.innerHTML = "";
|
|
59
|
+
|
|
60
|
+
const parent = this.parent;
|
|
61
|
+
const selected = this.pages.find((x) => x.id === this.selectedItem);
|
|
62
|
+
// @ts-expect-error private
|
|
63
|
+
parent.render( <div>{selected.body}</div>, this.container, parent);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// export default function Tools({ folder }) {
|
|
68
|
+
|
|
69
|
+
// const model = { search: ""};
|
|
70
|
+
|
|
71
|
+
// return <section class="site-editor-tools-tools">
|
|
72
|
+
// <search>
|
|
73
|
+
// <input type="search" value={Bind.sourceTwoWays(model, (x) => x.source.search)}/>
|
|
74
|
+
// </search>
|
|
75
|
+
// <BasicShapes/>
|
|
76
|
+
// <Designs/>
|
|
77
|
+
// {/* <SiteFiles root={folder}/> */}
|
|
78
|
+
// </section>;
|
|
79
|
+
// }
|
|
@@ -195,7 +195,7 @@ export const renderMailPromise = AtomControl.registerProperty<{ thread?: IMailbo
|
|
|
195
195
|
|
|
196
196
|
setTimeout(() => {
|
|
197
197
|
if(msg.scrollWidth > msg.offsetWidth) {
|
|
198
|
-
msg.style.scale = (msg.offsetWidth / msg.scrollWidth) + "";
|
|
198
|
+
msg.style.scale = Math.max(0.5, msg.offsetWidth / msg.scrollWidth) + "";
|
|
199
199
|
msg.style.transformOrigin = "top left";
|
|
200
200
|
}
|
|
201
201
|
}, 100);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
namespace JSX {
|
|
3
|
-
interface IntrinsicElements {
|
|
4
|
-
"bread-crum": any;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
import "./BreadCrum.global.css";
|
|
9
|
-
export default function BreadCrum({ selection, ...a }: {
|
|
10
|
-
[x: string]: any;
|
|
11
|
-
selection: any;
|
|
12
|
-
}): any;
|
|
13
|
-
//# sourceMappingURL=BreadCrum.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BreadCrum.d.ts","sourceRoot":"","sources":["../../../src/site-editor/editor/BreadCrum.tsx"],"names":[],"mappings":"AAOA,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,GAAG,CAAC;QACV,UAAU,iBAAiB;YACvB,YAAY,EAAE,GAAG,CAAC;SACrB;KACJ;CACJ;AAED,OAAO,wBAAwB,CAAC;AAqGhC,MAAM,CAAC,OAAO,UAAU,SAAS,CAAE,EAC/B,SAAS,EACT,GAAI,CAAC,EACR;;;CAAA,OAWA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
bread-crum{background-color:#fff;border-top:1px solid #d3d3d3;display:flex;flex-direction:row;flex-wrap:nowrap;font-size:smaller;gap:0;position:relative}bread-crum>button{background-color:transparent;border:none;cursor:pointer;outline:none;padding:2px 0;text-transform:lowercase}bread-crum>button:hover{background-color:#d3d3d3}bread-crum>button:not(:first-child):before{content:">";display:inline-block;padding-left:5px;padding-right:5px}bread-crum>i{cursor:pointer;padding:2px 5px;position:relative}bread-crum>i:hover{background-color:#d3d3d3}bread-crum>i>popup-menu{align-items:flex-start;background-color:canvas;border:none;border-radius:10px;bottom:1.3rem;box-shadow:0 0 2px 1px gray;cursor:pointer;display:flex;flex-direction:column;font-family:var(--body-font-family);gap:10px;left:0;min-width:100px;outline:none;padding:10px;position:absolute;z-index:200}bread-crum>i>popup-menu>*{text-transform:lowercase}bread-crum>i>popup-menu>[is-invisible]{text-decoration:line-through}bread-crum>i>popup-menu>:hover{background-color:#d3d3d3}
|
|
2
|
-
/*# sourceMappingURL=BreadCrum.global.css.map */
|