@iebh/tera-fy 1.0.23 → 1.1.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [1.1.0](https://github.com/IEBH/TERA-fy/compare/v1.0.24...v1.1.0) (2024-04-09)
6
+
7
+
8
+ ### Features
9
+
10
+ * File saving UI ([b2f8809](https://github.com/IEBH/TERA-fy/commit/b2f8809a960880b951072127d7492b31aa29b03a))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * Yet more files added to prerelease step ([399c6f8](https://github.com/IEBH/TERA-fy/commit/399c6f8d6c5080238c079c12b16add7eebeb1d7e))
16
+
17
+ ## [1.0.24](https://github.com/IEBH/TERA-fy/compare/v1.0.23...v1.0.24) (2024-04-05)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * Yet another fix for setProjectState() throwing when trying to save + remove defunct {sync:Boolean} option ([4e320ec](https://github.com/IEBH/TERA-fy/commit/4e320ec8f171237387db7404a7209b4ca51898c8))
23
+
5
24
  ## [1.0.23](https://github.com/IEBH/TERA-fy/compare/v1.0.22...v1.0.23) (2024-04-04)
6
25
 
7
26
  ## <small>1.0.22 (2024-04-04)</small>
package/api.md CHANGED
@@ -646,9 +646,8 @@ Paths can be any valid Lodash.set() value such as:
646
646
  * `options` **[Object][120]?** Additional options to mutate behaviour
647
647
 
648
648
  * `options.save` **[Boolean][127]** Save the changes to the server immediately, disable to queue up multiple writes (optional, default `true`)
649
- * `options.sync` **[Boolean][127]** Wait for the server to acknowledge the write, you almost never need to do this (optional, default `false`)
650
649
 
651
- Returns **[Promise][126]** A promise which resolves when the operation has synced with the server
650
+ Returns **[Promise][126]** A promise which resolves when the operation has been dispatched to the server
652
651
 
653
652
  ## setProjectStateDefaults
654
653
 
@@ -722,6 +721,7 @@ Prompt the user to select a library to operate on
722
721
 
723
722
  * `options.title` **[String][119]** The title of the dialog to display (optional, default `"Select a file"`)
724
723
  * `options.hint` **([String][119] | [Array][125]<[String][119]>)?** Hints to identify the file to select in array order of preference
724
+ * `options.save` **[Boolean][127]** Set to truthy if saving a new file, UI will adjust to allowing overwrite OR new file name input (optional, default `false`)
725
725
  * `options.filters` **[FileFilters][99]?** Optional file filters
726
726
  * `options.allowUpload` **[Boolean][127]** Allow uploading new files (optional, default `true`)
727
727
  * `options.allowRefresh` **[Boolean][127]** Allow the user to manually refresh the file list (optional, default `true`)
@@ -780,9 +780,8 @@ export default class TeraFy {
780
780
  *
781
781
  * @param {Object} [options] Additional options to mutate behaviour
782
782
  * @param {Boolean} [options.save=true] Save the changes to the server immediately, disable to queue up multiple writes
783
- * @param {Boolean} [options.sync=false] Wait for the server to acknowledge the write, you almost never need to do this
784
783
  *
785
- * @returns {Promise} A promise which resolves when the operation has synced with the server
784
+ * @returns {Promise} A promise which resolves when the operation has been dispatched to the server
786
785
  */
787
786
 
788
787
 
@@ -855,6 +854,7 @@ export default class TeraFy {
855
854
  * @param {Object} [options] Additional options to mutate behaviour
856
855
  * @param {String} [options.title="Select a file"] The title of the dialog to display
857
856
  * @param {String|Array<String>} [options.hint] Hints to identify the file to select in array order of preference
857
+ * @param {Boolean} [options.save=false] Set to truthy if saving a new file, UI will adjust to allowing overwrite OR new file name input
858
858
  * @param {FileFilters} [options.filters] Optional file filters
859
859
  * @param {Boolean} [options.allowUpload=true] Allow uploading new files
860
860
  * @param {Boolean} [options.allowRefresh=true] Allow the user to manually refresh the file list
@@ -718,14 +718,12 @@ export default class TeraFyServer {
718
718
  *
719
719
  * @param {Object} [options] Additional options to mutate behaviour
720
720
  * @param {Boolean} [options.save=true] Save the changes to the server immediately, disable to queue up multiple writes
721
- * @param {Boolean} [options.sync=false] Wait for the server to acknowledge the write, you almost never need to do this
722
721
  *
723
- * @returns {Promise} A promise which resolves when the operation has synced with the server
722
+ * @returns {Promise} A promise which resolves when the operation has been dispatched to the server
724
723
  */
725
724
  setProjectState(path, value, options) {
726
725
  let settings = {
727
726
  save: true,
728
- sync: false,
729
727
  ...options,
730
728
  };
731
729
 
@@ -734,11 +732,8 @@ export default class TeraFyServer {
734
732
 
735
733
  this._pathSet(app.service('$projects').active, path, value);
736
734
 
737
- return (
738
- settings.save && settings.sync ? this.saveProjectState()
739
- : settings.save ? Promise.resolve(void this.saveProjectState())
740
- : (()=> { throw new Error('setProjectState({sync: true, save: false}) makes no sense') })()
741
- );
735
+ return Promise.resolve()
736
+ .then(()=> settings.save && this.saveProjectState())
742
737
  }
743
738
 
744
739
 
@@ -891,6 +886,8 @@ export default class TeraFyServer {
891
886
  * @param {Object} [options] Additional options to mutate behaviour
892
887
  * @param {String} [options.title="Select a file"] The title of the dialog to display
893
888
  * @param {String|Array<String>} [options.hint] Hints to identify the file to select in array order of preference
889
+ * @param {Boolean} [options.save=false] Set to truthy if saving a new file, UI will adjust to allowing overwrite OR new file name input
890
+ * @param {String} [options.saveFilename] File name to save as, if omitted the hinting system is used otherwise 'My File.unknown' is assumed
894
891
  * @param {FileFilters} [options.filters] Optional file filters
895
892
  * @param {Boolean} [options.allowUpload=true] Allow uploading new files
896
893
  * @param {Boolean} [options.allowRefresh=true] Allow the user to manually refresh the file list
@@ -905,6 +902,8 @@ export default class TeraFyServer {
905
902
  let settings = {
906
903
  title: 'Select a file',
907
904
  hint: null,
905
+ save: false,
906
+ saveFilename: null,
908
907
  filters: {},
909
908
  allowUpload: true,
910
909
  allowRefresh: true,
@@ -919,9 +918,10 @@ export default class TeraFyServer {
919
918
  .then(files => this.requestFocus(()=>
920
919
  app.service('$prompt').dialog({
921
920
  title: settings.title,
922
- component: 'filesSelect',
921
+ component: settings.save ? 'filesSave' : 'filesOpen',
923
922
  componentProps: {
924
923
  hint: settings.hint,
924
+ saveFilename: settings.saveFilename,
925
925
  allowNavigate: false,
926
926
  allowUpload: settings.allowUpload,
927
927
  allowRefresh: settings.allowRefresh,
@@ -931,6 +931,9 @@ export default class TeraFyServer {
931
931
  filters: settings.filters,
932
932
  },
933
933
  componentEvents: {
934
+ fileSave(filePath) {
935
+ app.service('$prompt').close(true, filePath);
936
+ },
934
937
  fileSelect(file) {
935
938
  app.service('$prompt').close(true, file);
936
939
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iebh/tera-fy",
3
- "version": "1.0.23",
3
+ "version": "1.1.0",
4
4
  "description": "TERA website worker",
5
5
  "scripts": {
6
6
  "dev": "esbuild --platform=browser --format=esm --bundle lib/terafy.client.js --outfile=dist/terafy.js --minify --serve --servedir=.",
@@ -86,7 +86,8 @@
86
86
  },
87
87
  "commit-and-tag-version": {
88
88
  "scripts": {
89
- "prerelease": "npm run build && git add docs dist"
89
+ "prerelease": "npm run build && git add api.md docs dist",
90
+ "postcommit": "npm publish"
90
91
  }
91
92
  },
92
93
  "eslintConfig": {