@social-mail/social-mail-client 1.2.20 → 1.2.21

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 (44) hide show
  1. package/dist/admin/AdminAppIndex.pack.js +130 -18
  2. package/dist/admin/AdminAppIndex.pack.js.map +1 -1
  3. package/dist/admin/AdminAppIndex.pack.min.js +5 -5
  4. package/dist/admin/AdminAppIndex.pack.min.js.map +1 -1
  5. package/dist/code-editor/CodeEditorPage.d.ts +9 -2
  6. package/dist/code-editor/CodeEditorPage.d.ts.map +1 -1
  7. package/dist/code-editor/CodeEditorPage.js +72 -5
  8. package/dist/code-editor/CodeEditorPage.js.map +1 -1
  9. package/dist/code-editor/MonaoEditor.d.ts +5 -0
  10. package/dist/code-editor/MonaoEditor.d.ts.map +1 -1
  11. package/dist/code-editor/MonaoEditor.js +21 -2
  12. package/dist/code-editor/MonaoEditor.js.map +1 -1
  13. package/dist/common/pages/websites/studio/WebSiteStudioPage.d.ts +4 -0
  14. package/dist/common/pages/websites/studio/WebSiteStudioPage.d.ts.map +1 -1
  15. package/dist/common/pages/websites/studio/WebSiteStudioPage.js +11 -0
  16. package/dist/common/pages/websites/studio/WebSiteStudioPage.js.map +1 -1
  17. package/dist/site-editor/editor/HtmlPageEditor.d.ts +1 -0
  18. package/dist/site-editor/editor/HtmlPageEditor.d.ts.map +1 -1
  19. package/dist/site-editor/editor/HtmlPageEditor.js +17 -7
  20. package/dist/site-editor/editor/HtmlPageEditor.js.map +1 -1
  21. package/dist/site-editor/editor/WebSitePageEditor.d.ts.map +1 -1
  22. package/dist/site-editor/editor/WebSitePageEditor.js +4 -2
  23. package/dist/site-editor/editor/WebSitePageEditor.js.map +1 -1
  24. package/dist/site-editor/styler/StylerSet.d.ts +1 -0
  25. package/dist/site-editor/styler/StylerSet.d.ts.map +1 -1
  26. package/dist/site-editor/styler/StylerSet.js +1 -0
  27. package/dist/site-editor/styler/StylerSet.js.map +1 -1
  28. package/dist/tsconfig.tsbuildinfo +1 -1
  29. package/dist/web/AppIndex.pack.js +130 -18
  30. package/dist/web/AppIndex.pack.js.map +1 -1
  31. package/dist/web/AppIndex.pack.min.js +5 -5
  32. package/dist/web/AppIndex.pack.min.js.map +1 -1
  33. package/dist/web/page/files/service/CloudFileService.d.ts +1 -0
  34. package/dist/web/page/files/service/CloudFileService.d.ts.map +1 -1
  35. package/dist/web/page/files/service/CloudFileService.js +4 -2
  36. package/dist/web/page/files/service/CloudFileService.js.map +1 -1
  37. package/package.json +1 -1
  38. package/src/code-editor/CodeEditorPage.tsx +50 -1
  39. package/src/code-editor/MonaoEditor.tsx +23 -3
  40. package/src/common/pages/websites/studio/WebSiteStudioPage.tsx +18 -0
  41. package/src/site-editor/editor/HtmlPageEditor.tsx +16 -6
  42. package/src/site-editor/editor/WebSitePageEditor.tsx +4 -2
  43. package/src/site-editor/styler/StylerSet.ts +2 -0
  44. package/src/web/page/files/service/CloudFileService.ts +3 -2
@@ -18584,11 +18584,13 @@ System.register(["tslib", "@web-atoms/core/dist/di/DISingleton", "@web-atoms/cor
18584
18584
  const {
18585
18585
  appFileID,
18586
18586
  content,
18587
- parentID
18587
+ parentID,
18588
+ folder
18588
18589
  } = fm;
18589
18590
  return this.localFileService.uploadFile(content, {
18590
18591
  appFileID,
18591
- parentID
18592
+ parentID,
18593
+ folder
18592
18594
  });
18593
18595
  });
18594
18596
  }
@@ -37170,6 +37172,7 @@ System.register(["./Styler", "./properties/stylerBorder", "./properties/layouts/
37170
37172
  _export("StylerSet", StylerSet = class StylerSet {
37171
37173
  constructor() {
37172
37174
  this.vars = vars;
37175
+ this.varsCss = this.vars.join("\n\t\t\t");
37173
37176
  this.properties = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
37174
37177
  stylerLayout,
37175
37178
  stylerColorSets,
@@ -38402,10 +38405,15 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
38402
38405
  }, 100);
38403
38406
  return;
38404
38407
  }
38405
- void this.ready.then(() => {
38408
+ void this.ready.then(() => __awaiter(this, void 0, void 0, function* () {
38406
38409
  if (!this.htmlDocument) {
38407
38410
  return;
38408
38411
  }
38412
+ const iframe = this.element;
38413
+ if (this.htmlDocument !== iframe.contentDocument) {
38414
+ this.htmlDocument = void 0;
38415
+ yield this.loadContentDocument();
38416
+ }
38409
38417
  this.htmlDocument.open();
38410
38418
  this.htmlDocument.write(v);
38411
38419
  this.htmlDocument.addEventListener("click", e => {
@@ -38483,7 +38491,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
38483
38491
  this.loadVariables();
38484
38492
  }));
38485
38493
  }, 10);
38486
- });
38494
+ }));
38487
38495
  }
38488
38496
  constructor(app, e) {
38489
38497
  super(app, e);
@@ -38584,11 +38592,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
38584
38592
  }, XNode.create("i", {
38585
38593
  class: "fas fa-code"
38586
38594
  }), "Variables"), XNode.create(Properties, null))));
38587
- this.contentEditor = this.element.querySelector(`[data-element="content-editor"]`);
38588
- while (!this.htmlDocument) {
38589
- this.htmlDocument = this.contentEditor.contentDocument;
38590
- yield sleep(100);
38591
- }
38595
+ yield this.loadContentDocument();
38592
38596
  });
38593
38597
  }
38594
38598
  buildXNode(node) {
@@ -38769,6 +38773,15 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
38769
38773
  };
38770
38774
  this.pageVariables = StylerSet.instance.vars.map(x => new StylerVariable(x.name, x.value, this.htmlDocument, onChange));
38771
38775
  }
38776
+ loadContentDocument() {
38777
+ return __awaiter(this, void 0, void 0, function* () {
38778
+ this.contentEditor = this.element.querySelector(`[data-element="content-editor"]`);
38779
+ while (!this.htmlDocument) {
38780
+ this.htmlDocument = this.contentEditor.contentDocument;
38781
+ yield sleep(100);
38782
+ }
38783
+ });
38784
+ }
38772
38785
  });
38773
38786
  __decorate([Action({
38774
38787
  onEvent: "delete-element"
@@ -39012,6 +39025,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/types", "@web-atoms/core/di
39012
39025
  this.runAfterInit(() => this.app.runAsync(() => this.init()));
39013
39026
  }
39014
39027
  onPropertyChanged(name) {
39028
+ super.onPropertyChanged(name);
39015
39029
  switch (name) {
39016
39030
  case "file":
39017
39031
  this.app.runAsync(() => this.loadFile());
@@ -39051,14 +39065,16 @@ System.register(["tslib", "@web-atoms/core/dist/core/types", "@web-atoms/core/di
39051
39065
  return editor;
39052
39066
  }
39053
39067
  loadFile() {
39068
+ var _a;
39054
39069
  return __awaiter(this, void 0, void 0, function* () {
39055
39070
  yield this.init();
39071
+ (_a = this.codeModelDisposable) === null || _a === void 0 ? void 0 : _a.dispose();
39056
39072
  const editor = yield this.createEditor();
39057
39073
  const {
39058
39074
  file,
39059
39075
  monaco
39060
39076
  } = this;
39061
- const content = yield FetchBuilder.get(file.downloadUrl).responseAsText();
39077
+ const originalContent = yield FetchBuilder.get(file.downloadUrl).responseAsText();
39062
39078
  const name = file.name;
39063
39079
  let language = "html";
39064
39080
  if (/\.(ts|tsx)$/i.test(name)) {
@@ -39072,8 +39088,24 @@ System.register(["tslib", "@web-atoms/core/dist/core/types", "@web-atoms/core/di
39072
39088
  }
39073
39089
  const uri = monaco.Uri.parse(`http://a/${file.path}-${file.name}`);
39074
39090
  const m = monaco.editor.getModel(uri);
39075
- const model = monaco.editor.createModel(content, language, uri);
39091
+ const model = monaco.editor.createModel(originalContent, language, uri);
39076
39092
  editor.setModel(model);
39093
+ let id = 0;
39094
+ this.codeModelDisposable = this.registerDisposable(model.onDidChangeContent(() => {
39095
+ if (id) {
39096
+ clearTimeout(id);
39097
+ }
39098
+ id = setTimeout(() => {
39099
+ const content = model.getValue();
39100
+ this.element.dispatchEvent(new CustomEvent("fileChanged", {
39101
+ detail: {
39102
+ file: this.file,
39103
+ content,
39104
+ originalContent
39105
+ }
39106
+ }));
39107
+ }, 500);
39108
+ }));
39077
39109
  });
39078
39110
  }
39079
39111
  });
@@ -39085,23 +39117,39 @@ System.register(["tslib", "@web-atoms/core/dist/core/types", "@web-atoms/core/di
39085
39117
 
39086
39118
  AmdLoader.instance.setup("@social-mail/social-mail-client/dist/code-editor/MonaoEditor");
39087
39119
 
39088
- System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "@web-atoms/core/dist/core/XNode", "./MonaoEditor"], function (_export, _context) {
39120
+ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "@web-atoms/core/dist/core/XNode", "./MonaoEditor", "../common/controls/buttons/IconButton", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dist/view-model/Action", "@web-atoms/core/dist/core/InjectProperty", "../web/page/files/service/CloudFileService"], function (_export, _context) {
39089
39121
  "use strict";
39090
39122
 
39091
- var __awaiter, PopupWindowPage, XNode, MonacoEditor, CodeEditorPage;
39123
+ var __awaiter, __decorate, __metadata, ContentPage, XNode, MonacoEditor, SaveIconTextButton, Bind, Action, InjectProperty, CloudFileService, CodeEditorPage;
39092
39124
  _export("default", void 0);
39093
39125
  return {
39094
39126
  setters: [function (_tslib) {
39095
39127
  __awaiter = _tslib.__awaiter;
39128
+ __decorate = _tslib.__decorate;
39129
+ __metadata = _tslib.__metadata;
39096
39130
  }, function (_webAtomsWebControlsDistMobileAppMobileApp) {
39097
- PopupWindowPage = _webAtomsWebControlsDistMobileAppMobileApp.PopupWindowPage;
39131
+ ContentPage = _webAtomsWebControlsDistMobileAppMobileApp.ContentPage;
39098
39132
  }, function (_webAtomsCoreDistCoreXNode) {
39099
39133
  XNode = _webAtomsCoreDistCoreXNode.default;
39100
39134
  }, function (_MonaoEditor) {
39101
39135
  MonacoEditor = _MonaoEditor.default;
39136
+ }, function (_commonControlsButtonsIconButton) {
39137
+ SaveIconTextButton = _commonControlsButtonsIconButton.SaveIconTextButton;
39138
+ }, function (_webAtomsCoreDistCoreBind) {
39139
+ Bind = _webAtomsCoreDistCoreBind.default;
39140
+ }, function (_webAtomsCoreDistViewModelAction) {
39141
+ Action = _webAtomsCoreDistViewModelAction.default;
39142
+ }, function (_webAtomsCoreDistCoreInjectProperty) {
39143
+ InjectProperty = _webAtomsCoreDistCoreInjectProperty.default;
39144
+ }, function (_webPageFilesServiceCloudFileService) {
39145
+ CloudFileService = _webPageFilesServiceCloudFileService.default;
39102
39146
  }],
39103
39147
  execute: function () {
39104
- _export("default", CodeEditorPage = class CodeEditorPage extends PopupWindowPage {
39148
+ _export("default", CodeEditorPage = class CodeEditorPage extends ContentPage {
39149
+ constructor() {
39150
+ super(...arguments);
39151
+ this.modified = false;
39152
+ }
39105
39153
  init() {
39106
39154
  return __awaiter(this, void 0, void 0, function* () {
39107
39155
  this.title = this.parameters.name;
@@ -39110,11 +39158,62 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
39110
39158
  "data-align-items": "stretch",
39111
39159
  "data-justify-items": "stretch"
39112
39160
  }, XNode.create(MonacoEditor, {
39113
- file: this.parameters
39161
+ file: this.parameters,
39162
+ "event-file-changed": ({
39163
+ detail: {
39164
+ content,
39165
+ originalContent,
39166
+ file
39167
+ }
39168
+ }) => {
39169
+ this.file = file;
39170
+ this.modified = content !== originalContent;
39171
+ this.content = content;
39172
+ }
39114
39173
  }));
39174
+ this.footerRenderer = () => XNode.create("div", {
39175
+ "data-layout": "command-row",
39176
+ "style-display": Bind.oneWay(() => this.modified, false)
39177
+ }, XNode.create(SaveIconTextButton, {
39178
+ "data-click-event": "save-file",
39179
+ text: "Save"
39180
+ }));
39181
+ });
39182
+ }
39183
+ saveFile() {
39184
+ return __awaiter(this, void 0, void 0, function* () {
39185
+ const {
39186
+ file: {
39187
+ appFileID,
39188
+ name,
39189
+ contentType
39190
+ },
39191
+ content
39192
+ } = this;
39193
+ yield this.cloudFileService.saveFile({
39194
+ content: new File([content], name, {
39195
+ type: contentType
39196
+ }),
39197
+ appFileID
39198
+ });
39199
+ return yield this.cloudFileService.getFile(appFileID);
39115
39200
  });
39116
39201
  }
39202
+ hide() {
39203
+ this.element.setAttribute("data-page-state", "hidden");
39204
+ }
39205
+ show() {
39206
+ if (!this.element._logicalParent.contains(this.element)) {
39207
+ this.element._logicalParent.appendChild(this.element);
39208
+ }
39209
+ setTimeout(() => this.element.setAttribute("data-page-state", "ready"), 1);
39210
+ }
39117
39211
  });
39212
+ __decorate([InjectProperty, __metadata("design:type", CloudFileService)], CodeEditorPage.prototype, "cloudFileService", void 0);
39213
+ __decorate([Action({
39214
+ onEvent: "save-file",
39215
+ close: true
39216
+ }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], CodeEditorPage.prototype, "saveFile", null);
39118
39217
  }
39119
39218
  };
39120
39219
  });
@@ -39172,8 +39271,9 @@ System.register(["tslib", "@web-atoms/core/dist/core/BindableProperty", "./HtmlP
39172
39271
  }
39173
39272
  openVariables() {
39174
39273
  return __awaiter(this, void 0, void 0, function* () {
39175
- const file = yield this.cloudFileService.children(this.folder.appFileID, "vars.css").firstOrDefault();
39176
- yield PageNavigator.pushPage(CodeEditorPage, file);
39274
+ const file = yield this.cloudFileService.children(this.folder.appFileID, "styles/vars.css").firstOrDefault();
39275
+ const changedFile = yield PageNavigator.pushPage(CodeEditorPage, file);
39276
+ yield this.addStyleSheet(changedFile);
39177
39277
  });
39178
39278
  }
39179
39279
  setStylerSheet() {
@@ -39183,6 +39283,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/BindableProperty", "./HtmlP
39183
39283
  let vars = yield this.cloudFileService.children(this.folder.appFileID, "styles/vars.css").firstOrDefault();
39184
39284
  if (!vars) {
39185
39285
  vars = yield this.createFile("vars.css", `* {
39286
+ ${StylerSet.instance.varsCss}
39186
39287
  }`);
39187
39288
  }
39188
39289
  yield this.addStyleSheet(vars);
@@ -39401,6 +39502,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
39401
39502
  }), XNode.create(WebSitePageEditor, {
39402
39503
  class: "file-list",
39403
39504
  folder: this.root,
39505
+ presenter: Bind.presenter(c => this.htmlEditor = c),
39404
39506
  "event-html-page-changed": ce => this.pageContent = ce.detail,
39405
39507
  htmlPage: Bind.oneWayAsync((s, e, cancelToken) => this.selectedFile ? FetchBuilder.get(this.selectedFile.downloadUrl).cancelToken(cancelToken).responseAsText(true) : void 0)
39406
39508
  }));
@@ -39470,6 +39572,16 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
39470
39572
  this.pageContent = "";
39471
39573
  });
39472
39574
  }
39575
+ hide() {
39576
+ this.pageContent = this.htmlEditor.htmlPage;
39577
+ super.hide();
39578
+ }
39579
+ show() {
39580
+ super.show();
39581
+ if (this.pageContent) {
39582
+ setTimeout(() => this.htmlEditor.htmlPage = this.pageContent, 400);
39583
+ }
39584
+ }
39473
39585
  });
39474
39586
  __decorate([InjectProperty, __metadata("design:type", CloudFileService)], WebSiteStudioPage.prototype, "cloudFileService", void 0);
39475
39587
  __decorate([Action({