@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
@@ -26083,11 +26083,13 @@ System.register(["tslib", "@web-atoms/core/dist/di/DISingleton", "@web-atoms/cor
26083
26083
  const {
26084
26084
  appFileID,
26085
26085
  content,
26086
- parentID
26086
+ parentID,
26087
+ folder
26087
26088
  } = fm;
26088
26089
  return this.localFileService.uploadFile(content, {
26089
26090
  appFileID,
26090
- parentID
26091
+ parentID,
26092
+ folder
26091
26093
  });
26092
26094
  });
26093
26095
  }
@@ -33759,6 +33761,7 @@ System.register(["./Styler", "./properties/stylerBorder", "./properties/layouts/
33759
33761
  _export("StylerSet", StylerSet = class StylerSet {
33760
33762
  constructor() {
33761
33763
  this.vars = vars;
33764
+ this.varsCss = this.vars.join("\n\t\t\t");
33762
33765
  this.properties = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
33763
33766
  stylerLayout,
33764
33767
  stylerColorSets,
@@ -34991,10 +34994,15 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
34991
34994
  }, 100);
34992
34995
  return;
34993
34996
  }
34994
- void this.ready.then(() => {
34997
+ void this.ready.then(() => __awaiter(this, void 0, void 0, function* () {
34995
34998
  if (!this.htmlDocument) {
34996
34999
  return;
34997
35000
  }
35001
+ const iframe = this.element;
35002
+ if (this.htmlDocument !== iframe.contentDocument) {
35003
+ this.htmlDocument = void 0;
35004
+ yield this.loadContentDocument();
35005
+ }
34998
35006
  this.htmlDocument.open();
34999
35007
  this.htmlDocument.write(v);
35000
35008
  this.htmlDocument.addEventListener("click", e => {
@@ -35072,7 +35080,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
35072
35080
  this.loadVariables();
35073
35081
  }));
35074
35082
  }, 10);
35075
- });
35083
+ }));
35076
35084
  }
35077
35085
  constructor(app, e) {
35078
35086
  super(app, e);
@@ -35173,11 +35181,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
35173
35181
  }, XNode.create("i", {
35174
35182
  class: "fas fa-code"
35175
35183
  }), "Variables"), XNode.create(Properties, null))));
35176
- this.contentEditor = this.element.querySelector(`[data-element="content-editor"]`);
35177
- while (!this.htmlDocument) {
35178
- this.htmlDocument = this.contentEditor.contentDocument;
35179
- yield sleep(100);
35180
- }
35184
+ yield this.loadContentDocument();
35181
35185
  });
35182
35186
  }
35183
35187
  buildXNode(node) {
@@ -35358,6 +35362,15 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
35358
35362
  };
35359
35363
  this.pageVariables = StylerSet.instance.vars.map(x => new StylerVariable(x.name, x.value, this.htmlDocument, onChange));
35360
35364
  }
35365
+ loadContentDocument() {
35366
+ return __awaiter(this, void 0, void 0, function* () {
35367
+ this.contentEditor = this.element.querySelector(`[data-element="content-editor"]`);
35368
+ while (!this.htmlDocument) {
35369
+ this.htmlDocument = this.contentEditor.contentDocument;
35370
+ yield sleep(100);
35371
+ }
35372
+ });
35373
+ }
35361
35374
  });
35362
35375
  __decorate([Action({
35363
35376
  onEvent: "delete-element"
@@ -35751,6 +35764,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/types", "@web-atoms/core/di
35751
35764
  this.runAfterInit(() => this.app.runAsync(() => this.init()));
35752
35765
  }
35753
35766
  onPropertyChanged(name) {
35767
+ super.onPropertyChanged(name);
35754
35768
  switch (name) {
35755
35769
  case "file":
35756
35770
  this.app.runAsync(() => this.loadFile());
@@ -35790,14 +35804,16 @@ System.register(["tslib", "@web-atoms/core/dist/core/types", "@web-atoms/core/di
35790
35804
  return editor;
35791
35805
  }
35792
35806
  loadFile() {
35807
+ var _a;
35793
35808
  return __awaiter(this, void 0, void 0, function* () {
35794
35809
  yield this.init();
35810
+ (_a = this.codeModelDisposable) === null || _a === void 0 ? void 0 : _a.dispose();
35795
35811
  const editor = yield this.createEditor();
35796
35812
  const {
35797
35813
  file,
35798
35814
  monaco
35799
35815
  } = this;
35800
- const content = yield FetchBuilder.get(file.downloadUrl).responseAsText();
35816
+ const originalContent = yield FetchBuilder.get(file.downloadUrl).responseAsText();
35801
35817
  const name = file.name;
35802
35818
  let language = "html";
35803
35819
  if (/\.(ts|tsx)$/i.test(name)) {
@@ -35811,8 +35827,24 @@ System.register(["tslib", "@web-atoms/core/dist/core/types", "@web-atoms/core/di
35811
35827
  }
35812
35828
  const uri = monaco.Uri.parse(`http://a/${file.path}-${file.name}`);
35813
35829
  const m = monaco.editor.getModel(uri);
35814
- const model = monaco.editor.createModel(content, language, uri);
35830
+ const model = monaco.editor.createModel(originalContent, language, uri);
35815
35831
  editor.setModel(model);
35832
+ let id = 0;
35833
+ this.codeModelDisposable = this.registerDisposable(model.onDidChangeContent(() => {
35834
+ if (id) {
35835
+ clearTimeout(id);
35836
+ }
35837
+ id = setTimeout(() => {
35838
+ const content = model.getValue();
35839
+ this.element.dispatchEvent(new CustomEvent("fileChanged", {
35840
+ detail: {
35841
+ file: this.file,
35842
+ content,
35843
+ originalContent
35844
+ }
35845
+ }));
35846
+ }, 500);
35847
+ }));
35816
35848
  });
35817
35849
  }
35818
35850
  });
@@ -35824,23 +35856,39 @@ System.register(["tslib", "@web-atoms/core/dist/core/types", "@web-atoms/core/di
35824
35856
 
35825
35857
  AmdLoader.instance.setup("@social-mail/social-mail-client/dist/code-editor/MonaoEditor");
35826
35858
 
35827
- System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "@web-atoms/core/dist/core/XNode", "./MonaoEditor"], function (_export, _context) {
35859
+ 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) {
35828
35860
  "use strict";
35829
35861
 
35830
- var __awaiter, PopupWindowPage, XNode, MonacoEditor, CodeEditorPage;
35862
+ var __awaiter, __decorate, __metadata, ContentPage, XNode, MonacoEditor, SaveIconTextButton, Bind, Action, InjectProperty, CloudFileService, CodeEditorPage;
35831
35863
  _export("default", void 0);
35832
35864
  return {
35833
35865
  setters: [function (_tslib) {
35834
35866
  __awaiter = _tslib.__awaiter;
35867
+ __decorate = _tslib.__decorate;
35868
+ __metadata = _tslib.__metadata;
35835
35869
  }, function (_webAtomsWebControlsDistMobileAppMobileApp) {
35836
- PopupWindowPage = _webAtomsWebControlsDistMobileAppMobileApp.PopupWindowPage;
35870
+ ContentPage = _webAtomsWebControlsDistMobileAppMobileApp.ContentPage;
35837
35871
  }, function (_webAtomsCoreDistCoreXNode) {
35838
35872
  XNode = _webAtomsCoreDistCoreXNode.default;
35839
35873
  }, function (_MonaoEditor) {
35840
35874
  MonacoEditor = _MonaoEditor.default;
35875
+ }, function (_commonControlsButtonsIconButton) {
35876
+ SaveIconTextButton = _commonControlsButtonsIconButton.SaveIconTextButton;
35877
+ }, function (_webAtomsCoreDistCoreBind) {
35878
+ Bind = _webAtomsCoreDistCoreBind.default;
35879
+ }, function (_webAtomsCoreDistViewModelAction) {
35880
+ Action = _webAtomsCoreDistViewModelAction.default;
35881
+ }, function (_webAtomsCoreDistCoreInjectProperty) {
35882
+ InjectProperty = _webAtomsCoreDistCoreInjectProperty.default;
35883
+ }, function (_webPageFilesServiceCloudFileService) {
35884
+ CloudFileService = _webPageFilesServiceCloudFileService.default;
35841
35885
  }],
35842
35886
  execute: function () {
35843
- _export("default", CodeEditorPage = class CodeEditorPage extends PopupWindowPage {
35887
+ _export("default", CodeEditorPage = class CodeEditorPage extends ContentPage {
35888
+ constructor() {
35889
+ super(...arguments);
35890
+ this.modified = false;
35891
+ }
35844
35892
  init() {
35845
35893
  return __awaiter(this, void 0, void 0, function* () {
35846
35894
  this.title = this.parameters.name;
@@ -35849,11 +35897,62 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
35849
35897
  "data-align-items": "stretch",
35850
35898
  "data-justify-items": "stretch"
35851
35899
  }, XNode.create(MonacoEditor, {
35852
- file: this.parameters
35900
+ file: this.parameters,
35901
+ "event-file-changed": ({
35902
+ detail: {
35903
+ content,
35904
+ originalContent,
35905
+ file
35906
+ }
35907
+ }) => {
35908
+ this.file = file;
35909
+ this.modified = content !== originalContent;
35910
+ this.content = content;
35911
+ }
35912
+ }));
35913
+ this.footerRenderer = () => XNode.create("div", {
35914
+ "data-layout": "command-row",
35915
+ "style-display": Bind.oneWay(() => this.modified, false)
35916
+ }, XNode.create(SaveIconTextButton, {
35917
+ "data-click-event": "save-file",
35918
+ text: "Save"
35853
35919
  }));
35854
35920
  });
35855
35921
  }
35922
+ saveFile() {
35923
+ return __awaiter(this, void 0, void 0, function* () {
35924
+ const {
35925
+ file: {
35926
+ appFileID,
35927
+ name,
35928
+ contentType
35929
+ },
35930
+ content
35931
+ } = this;
35932
+ yield this.cloudFileService.saveFile({
35933
+ content: new File([content], name, {
35934
+ type: contentType
35935
+ }),
35936
+ appFileID
35937
+ });
35938
+ return yield this.cloudFileService.getFile(appFileID);
35939
+ });
35940
+ }
35941
+ hide() {
35942
+ this.element.setAttribute("data-page-state", "hidden");
35943
+ }
35944
+ show() {
35945
+ if (!this.element._logicalParent.contains(this.element)) {
35946
+ this.element._logicalParent.appendChild(this.element);
35947
+ }
35948
+ setTimeout(() => this.element.setAttribute("data-page-state", "ready"), 1);
35949
+ }
35856
35950
  });
35951
+ __decorate([InjectProperty, __metadata("design:type", CloudFileService)], CodeEditorPage.prototype, "cloudFileService", void 0);
35952
+ __decorate([Action({
35953
+ onEvent: "save-file",
35954
+ close: true
35955
+ }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], CodeEditorPage.prototype, "saveFile", null);
35857
35956
  }
35858
35957
  };
35859
35958
  });
@@ -35911,8 +36010,9 @@ System.register(["tslib", "@web-atoms/core/dist/core/BindableProperty", "./HtmlP
35911
36010
  }
35912
36011
  openVariables() {
35913
36012
  return __awaiter(this, void 0, void 0, function* () {
35914
- const file = yield this.cloudFileService.children(this.folder.appFileID, "vars.css").firstOrDefault();
35915
- yield PageNavigator.pushPage(CodeEditorPage, file);
36013
+ const file = yield this.cloudFileService.children(this.folder.appFileID, "styles/vars.css").firstOrDefault();
36014
+ const changedFile = yield PageNavigator.pushPage(CodeEditorPage, file);
36015
+ yield this.addStyleSheet(changedFile);
35916
36016
  });
35917
36017
  }
35918
36018
  setStylerSheet() {
@@ -35922,6 +36022,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/BindableProperty", "./HtmlP
35922
36022
  let vars = yield this.cloudFileService.children(this.folder.appFileID, "styles/vars.css").firstOrDefault();
35923
36023
  if (!vars) {
35924
36024
  vars = yield this.createFile("vars.css", `* {
36025
+ ${StylerSet.instance.varsCss}
35925
36026
  }`);
35926
36027
  }
35927
36028
  yield this.addStyleSheet(vars);
@@ -36140,6 +36241,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
36140
36241
  }), XNode.create(WebSitePageEditor, {
36141
36242
  class: "file-list",
36142
36243
  folder: this.root,
36244
+ presenter: Bind.presenter(c => this.htmlEditor = c),
36143
36245
  "event-html-page-changed": ce => this.pageContent = ce.detail,
36144
36246
  htmlPage: Bind.oneWayAsync((s, e, cancelToken) => this.selectedFile ? FetchBuilder.get(this.selectedFile.downloadUrl).cancelToken(cancelToken).responseAsText(true) : void 0)
36145
36247
  }));
@@ -36209,6 +36311,16 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
36209
36311
  this.pageContent = "";
36210
36312
  });
36211
36313
  }
36314
+ hide() {
36315
+ this.pageContent = this.htmlEditor.htmlPage;
36316
+ super.hide();
36317
+ }
36318
+ show() {
36319
+ super.show();
36320
+ if (this.pageContent) {
36321
+ setTimeout(() => this.htmlEditor.htmlPage = this.pageContent, 400);
36322
+ }
36323
+ }
36212
36324
  });
36213
36325
  __decorate([InjectProperty, __metadata("design:type", CloudFileService)], WebSiteStudioPage.prototype, "cloudFileService", void 0);
36214
36326
  __decorate([Action({