@iebh/tera-fy 1.0.19 → 1.0.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.
- package/api.md +586 -360
- package/dist/terafy.es2019.js +11 -2
- package/dist/terafy.js +11 -2
- package/lib/projectFile.js +179 -0
- package/lib/terafy.client.js +72 -26
- package/lib/terafy.server.js +124 -54
- package/package.json +5 -4
- package/widgets/tera-file-select.vue +136 -0
- package/widgets/tera-library-select.vue +0 -8
package/api.md
CHANGED
|
@@ -2,98 +2,263 @@
|
|
|
2
2
|
|
|
3
3
|
### Table of Contents
|
|
4
4
|
|
|
5
|
-
* [
|
|
6
|
-
* [
|
|
7
|
-
* [
|
|
8
|
-
* [
|
|
9
|
-
* [
|
|
10
|
-
|
|
11
|
-
* [
|
|
12
|
-
|
|
13
|
-
* [
|
|
14
|
-
|
|
15
|
-
* [
|
|
16
|
-
|
|
17
|
-
* [
|
|
18
|
-
|
|
19
|
-
* [
|
|
20
|
-
|
|
21
|
-
* [
|
|
22
|
-
* [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* [
|
|
5
|
+
* [ProjectFile][1]
|
|
6
|
+
* [tera][2]
|
|
7
|
+
* [Parameters][3]
|
|
8
|
+
* [id][4]
|
|
9
|
+
* [name][5]
|
|
10
|
+
* [path][6]
|
|
11
|
+
* [parsedName][7]
|
|
12
|
+
* [Properties][8]
|
|
13
|
+
* [created][9]
|
|
14
|
+
* [createdFormatted][10]
|
|
15
|
+
* [modified][11]
|
|
16
|
+
* [modifiedFormatted][12]
|
|
17
|
+
* [accessed][13]
|
|
18
|
+
* [accessedFormatted][14]
|
|
19
|
+
* [size][15]
|
|
20
|
+
* [sizeFormatted][16]
|
|
21
|
+
* [mime][17]
|
|
22
|
+
* [getContents][18]
|
|
23
|
+
* [setContents][19]
|
|
24
|
+
* [Parameters][20]
|
|
25
|
+
* [getRefs][21]
|
|
26
|
+
* [setRefs][22]
|
|
27
27
|
* [Parameters][23]
|
|
28
|
-
|
|
29
|
-
* [
|
|
30
|
-
|
|
31
|
-
* [
|
|
32
|
-
* [
|
|
33
|
-
* [
|
|
34
|
-
* [
|
|
35
|
-
|
|
36
|
-
* [
|
|
28
|
+
* [TeraFy][24]
|
|
29
|
+
* [settings][25]
|
|
30
|
+
* [Properties][26]
|
|
31
|
+
* [events][27]
|
|
32
|
+
* [dom][28]
|
|
33
|
+
* [Properties][29]
|
|
34
|
+
* [methods][30]
|
|
35
|
+
* [plugins][31]
|
|
36
|
+
* [send][32]
|
|
37
37
|
* [Parameters][33]
|
|
38
|
-
* [
|
|
38
|
+
* [sendRaw][34]
|
|
39
39
|
* [Parameters][35]
|
|
40
|
-
* [
|
|
40
|
+
* [rpc][36]
|
|
41
41
|
* [Parameters][37]
|
|
42
|
-
* [
|
|
42
|
+
* [acceptMessage][38]
|
|
43
43
|
* [Parameters][39]
|
|
44
|
-
* [
|
|
45
|
-
|
|
46
|
-
* [
|
|
47
|
-
* [
|
|
48
|
-
* [
|
|
49
|
-
* [
|
|
50
|
-
* [
|
|
51
|
-
* [
|
|
52
|
-
* [
|
|
53
|
-
* [][49]
|
|
54
|
-
* [
|
|
55
|
-
* [
|
|
56
|
-
* [
|
|
57
|
-
* [
|
|
58
|
-
|
|
59
|
-
* [
|
|
60
|
-
|
|
61
|
-
* [
|
|
62
|
-
|
|
63
|
-
* [
|
|
64
|
-
|
|
65
|
-
* [
|
|
66
|
-
|
|
67
|
-
* [
|
|
68
|
-
|
|
69
|
-
* [
|
|
70
|
-
* [
|
|
71
|
-
* [
|
|
72
|
-
* [
|
|
73
|
-
* [
|
|
74
|
-
* [
|
|
75
|
-
* [
|
|
44
|
+
* [acceptPostboxes][40]
|
|
45
|
+
* [createProjectStatePatch][41]
|
|
46
|
+
* [Parameters][42]
|
|
47
|
+
* [applyProjectStatePatchLocal][43]
|
|
48
|
+
* [Parameters][44]
|
|
49
|
+
* [init][45]
|
|
50
|
+
* [Parameters][46]
|
|
51
|
+
* [detectMode][47]
|
|
52
|
+
* [injectComms][48]
|
|
53
|
+
* [injectStylesheet][49]
|
|
54
|
+
* [injectMethods][50]
|
|
55
|
+
* [debug][51]
|
|
56
|
+
* [Parameters][52]
|
|
57
|
+
* [set][53]
|
|
58
|
+
* [Parameters][54]
|
|
59
|
+
* [setIfDev][55]
|
|
60
|
+
* [Parameters][56]
|
|
61
|
+
* [use][57]
|
|
62
|
+
* [Parameters][58]
|
|
63
|
+
* [mixin][59]
|
|
64
|
+
* [Parameters][60]
|
|
65
|
+
* [toggleDevMode][61]
|
|
66
|
+
* [Parameters][62]
|
|
67
|
+
* [toggleFocus][63]
|
|
68
|
+
* [Parameters][64]
|
|
69
|
+
* [selectProjectFile][65]
|
|
70
|
+
* [Parameters][66]
|
|
71
|
+
* [getProjectFiles][67]
|
|
72
|
+
* [Parameters][68]
|
|
73
|
+
* [getProjectFile][69]
|
|
74
|
+
* [Parameters][70]
|
|
75
|
+
* [handshake][71]
|
|
76
76
|
* [Properties][72]
|
|
77
|
-
* [
|
|
77
|
+
* [User][73]
|
|
78
78
|
* [Properties][74]
|
|
79
|
-
* [
|
|
80
|
-
|
|
81
|
-
* [
|
|
82
|
-
|
|
83
|
-
* [
|
|
84
|
-
|
|
85
|
-
* [
|
|
79
|
+
* [getUser][75]
|
|
80
|
+
* [requireUser][76]
|
|
81
|
+
* [Parameters][77]
|
|
82
|
+
* [Project][78]
|
|
83
|
+
* [getProject][79]
|
|
84
|
+
* [getProjects][80]
|
|
85
|
+
* [setActiveProject][81]
|
|
86
86
|
* [Parameters][82]
|
|
87
|
-
* [
|
|
87
|
+
* [requireProject][83]
|
|
88
88
|
* [Parameters][84]
|
|
89
|
-
* [
|
|
89
|
+
* [selectProject][85]
|
|
90
90
|
* [Parameters][86]
|
|
91
|
-
* [
|
|
91
|
+
* [getProjectState][87]
|
|
92
92
|
* [Parameters][88]
|
|
93
|
-
* [
|
|
93
|
+
* [setProjectState][89]
|
|
94
94
|
* [Parameters][90]
|
|
95
|
-
* [
|
|
95
|
+
* [setProjectStateDefaults][91]
|
|
96
96
|
* [Parameters][92]
|
|
97
|
+
* [saveProjectState][93]
|
|
98
|
+
* [replaceProjectState][94]
|
|
99
|
+
* [Parameters][95]
|
|
100
|
+
* [applyProjectStatePatch][96]
|
|
101
|
+
* [Parameters][97]
|
|
102
|
+
* [subscribeProjectState][98]
|
|
103
|
+
* [FileFilters][99]
|
|
104
|
+
* [Properties][100]
|
|
105
|
+
* [selectProjectFile][101]
|
|
106
|
+
* [Parameters][102]
|
|
107
|
+
* [setProjectFile][103]
|
|
108
|
+
* [Parameters][104]
|
|
109
|
+
* [selectProjectLibrary][105]
|
|
110
|
+
* [Parameters][106]
|
|
111
|
+
* [parseProjectLibrary][107]
|
|
112
|
+
* [Parameters][108]
|
|
113
|
+
* [setProjectLibrary][109]
|
|
114
|
+
* [Parameters][110]
|
|
115
|
+
* [setProjectLibrary][111]
|
|
116
|
+
* [Parameters][112]
|
|
117
|
+
* [uiAlert][113]
|
|
118
|
+
* [Parameters][114]
|
|
119
|
+
* [uiSplat][115]
|
|
120
|
+
* [Parameters][116]
|
|
121
|
+
* [uiWindow][117]
|
|
122
|
+
* [Parameters][118]
|
|
123
|
+
|
|
124
|
+
## ProjectFile
|
|
125
|
+
|
|
126
|
+
A project file fetched from TERA
|
|
127
|
+
|
|
128
|
+
### tera
|
|
129
|
+
|
|
130
|
+
Parent TeraClient instance used by all helper functions
|
|
131
|
+
|
|
132
|
+
#### Parameters
|
|
133
|
+
|
|
134
|
+
* `TeraClient`  
|
|
135
|
+
|
|
136
|
+
### id
|
|
137
|
+
|
|
138
|
+
A UUID string representing the unique ID of the file
|
|
139
|
+
|
|
140
|
+
Type: [String][119]
|
|
141
|
+
|
|
142
|
+
### name
|
|
143
|
+
|
|
144
|
+
Relative name path (can contain prefix directories) for the human readable file name
|
|
145
|
+
|
|
146
|
+
Type: [String][119]
|
|
147
|
+
|
|
148
|
+
### path
|
|
149
|
+
|
|
150
|
+
Full path to the file
|
|
151
|
+
This is also used as the unique identifier within the project
|
|
152
|
+
|
|
153
|
+
Type: [String][119]
|
|
154
|
+
|
|
155
|
+
### parsedName
|
|
156
|
+
|
|
157
|
+
An object representing meta file parts of a file name
|
|
158
|
+
|
|
159
|
+
Type: [Object][120]
|
|
160
|
+
|
|
161
|
+
#### Properties
|
|
162
|
+
|
|
163
|
+
* `basename` **[String][119]** The filename + extention (i.e. everything without directory name)
|
|
164
|
+
* `filename` **[String][119]** The file portion of the name (basename without the extension)
|
|
165
|
+
* `ext` **[String][119]** The extension portion of the name (always lower case)
|
|
166
|
+
* `dirName` **[String][119]** The directory path portion of the name
|
|
167
|
+
|
|
168
|
+
### created
|
|
169
|
+
|
|
170
|
+
A date representing when the file was created
|
|
171
|
+
|
|
172
|
+
Type: [Date][121]
|
|
173
|
+
|
|
174
|
+
### createdFormatted
|
|
175
|
+
|
|
176
|
+
A human readable, formatted version of "created"
|
|
177
|
+
|
|
178
|
+
Type: [String][119]
|
|
179
|
+
|
|
180
|
+
### modified
|
|
181
|
+
|
|
182
|
+
A date representing when the file was created
|
|
183
|
+
|
|
184
|
+
Type: [Date][121]
|
|
185
|
+
|
|
186
|
+
### modifiedFormatted
|
|
187
|
+
|
|
188
|
+
A human readable, formatted version of "modified"
|
|
189
|
+
|
|
190
|
+
Type: [String][119]
|
|
191
|
+
|
|
192
|
+
### accessed
|
|
193
|
+
|
|
194
|
+
A date representing when the file was last accessed
|
|
195
|
+
|
|
196
|
+
Type: [Date][121]
|
|
197
|
+
|
|
198
|
+
### accessedFormatted
|
|
199
|
+
|
|
200
|
+
A human readable, formatted version of "accessed"
|
|
201
|
+
|
|
202
|
+
Type: [String][119]
|
|
203
|
+
|
|
204
|
+
### size
|
|
205
|
+
|
|
206
|
+
Size, in bytes, of the file
|
|
207
|
+
|
|
208
|
+
Type: [Number][122]
|
|
209
|
+
|
|
210
|
+
### sizeFormatted
|
|
211
|
+
|
|
212
|
+
A human readable, formatted version of the file size
|
|
213
|
+
|
|
214
|
+
Type: [String][119]
|
|
215
|
+
|
|
216
|
+
### mime
|
|
217
|
+
|
|
218
|
+
The associated mime type for the file
|
|
219
|
+
|
|
220
|
+
Type: [String][119]
|
|
221
|
+
|
|
222
|
+
### getContents
|
|
223
|
+
|
|
224
|
+
* **See**: getProjectFile()
|
|
225
|
+
|
|
226
|
+
Fetch the raw file contents as a Blob
|
|
227
|
+
|
|
228
|
+
returns {Blob} The eventual raw file contents as a Blob
|
|
229
|
+
|
|
230
|
+
### setContents
|
|
231
|
+
|
|
232
|
+
* **See**: setProjectFile()
|
|
233
|
+
|
|
234
|
+
Overwrite the contents of a file with new content
|
|
235
|
+
|
|
236
|
+
#### Parameters
|
|
237
|
+
|
|
238
|
+
* `contents` **(File | [Blob][123] | [FormData][124] | [Object][120] | [Array][125])** The new file contents
|
|
239
|
+
|
|
240
|
+
Returns **[Promise][126]** A promise which resolves when the operation has completed
|
|
241
|
+
|
|
242
|
+
### getRefs
|
|
243
|
+
|
|
244
|
+
* **See**: parseProjectLibrary()
|
|
245
|
+
|
|
246
|
+
Fetch the file contents as an array of Reflib refs
|
|
247
|
+
|
|
248
|
+
Returns **[Promise][126]<[Array][125]\<Ref>>** An eventual array of RefLib references
|
|
249
|
+
|
|
250
|
+
### setRefs
|
|
251
|
+
|
|
252
|
+
* **See**: setProjectLibrary()
|
|
253
|
+
|
|
254
|
+
Overwrite the contents of a file with a new collection of Reflib refs
|
|
255
|
+
|
|
256
|
+
#### Parameters
|
|
257
|
+
|
|
258
|
+
* `refs`  
|
|
259
|
+
* `Collection` **[Array][125]\<RefLibRef>** of references for the selected library
|
|
260
|
+
|
|
261
|
+
Returns **[Promise][126]** A promise which resolves when the operation has completed
|
|
97
262
|
|
|
98
263
|
## TeraFy
|
|
99
264
|
|
|
@@ -103,18 +268,18 @@ Main Tera-Fy Client (class singleton) to be used in a frontend browser
|
|
|
103
268
|
|
|
104
269
|
Various settings to configure behaviour
|
|
105
270
|
|
|
106
|
-
Type: [Object][
|
|
271
|
+
Type: [Object][120]
|
|
107
272
|
|
|
108
273
|
#### Properties
|
|
109
274
|
|
|
110
|
-
* `devMode` **[Boolean][
|
|
275
|
+
* `devMode` **[Boolean][127]** Operate in devMode - i.e. force outer refresh when encountering an existing TeraFy instance
|
|
111
276
|
* `mode` **(`"detect"` | `"parent"` | `"child"` | `"popup"`)** How to communicate with TERA. 'parent' assumes that the parent of the current document is TERA, 'child' spawns an iFrame and uses TERA there, 'detect' tries parent and switches to `modeFallback` if communication fails
|
|
112
|
-
* `modeFallback` **[String][
|
|
113
|
-
* `modeTimeout` **[Number][
|
|
114
|
-
* `siteUrl` **[String][
|
|
115
|
-
* `restrictOrigin` **[String][
|
|
116
|
-
* `List` **[Array][
|
|
117
|
-
* `handshakeInterval` **[Number][
|
|
277
|
+
* `modeFallback` **[String][119]** Method to use when all method detection fails
|
|
278
|
+
* `modeTimeout` **[Number][122]** How long entities have in 'detect' mode to identify themselves
|
|
279
|
+
* `siteUrl` **[String][119]** The TERA URL to connect to
|
|
280
|
+
* `restrictOrigin` **[String][119]** URL to restrict communications to
|
|
281
|
+
* `List` **[Array][125]<[String][119]>** of sandbox allowables for the embedded if in embed mode
|
|
282
|
+
* `handshakeInterval` **[Number][122]** Interval in milliseconds when sanning for a handshake
|
|
118
283
|
|
|
119
284
|
### events
|
|
120
285
|
|
|
@@ -126,13 +291,13 @@ Type: Mitt
|
|
|
126
291
|
|
|
127
292
|
DOMElements for this TeraFy instance
|
|
128
293
|
|
|
129
|
-
Type: [Object][
|
|
294
|
+
Type: [Object][120]
|
|
130
295
|
|
|
131
296
|
#### Properties
|
|
132
297
|
|
|
133
298
|
* `el` **DOMElement** The main tera-fy div wrapper
|
|
134
299
|
* `iframe` **DOMElement** The internal iFrame element (if `settings.mode == 'child'`)
|
|
135
|
-
* `popup` **[Window][
|
|
300
|
+
* `popup` **[Window][128]** The popup window context (if `settings.mode == 'popup'`)
|
|
136
301
|
* `stylesheet` **DOMElement** The corresponding stylesheet
|
|
137
302
|
|
|
138
303
|
### methods
|
|
@@ -140,13 +305,13 @@ Type: [Object][93]
|
|
|
140
305
|
List of function stubs mapped here from the server
|
|
141
306
|
This array is forms the reference of `TeraFy.METHOD()` objects to provide locally which will be mapped via `TeraFy.rpc(METHOD, ...args)`
|
|
142
307
|
|
|
143
|
-
Type: [Array][
|
|
308
|
+
Type: [Array][125]<[String][119]>
|
|
144
309
|
|
|
145
310
|
### plugins
|
|
146
311
|
|
|
147
312
|
Loaded plugins via Use()
|
|
148
313
|
|
|
149
|
-
Type: [Array][
|
|
314
|
+
Type: [Array][125]\<TeraFyPlugin>
|
|
150
315
|
|
|
151
316
|
### send
|
|
152
317
|
|
|
@@ -154,9 +319,9 @@ Send a message + wait for a response object
|
|
|
154
319
|
|
|
155
320
|
#### Parameters
|
|
156
321
|
|
|
157
|
-
* `message` **[Object][
|
|
322
|
+
* `message` **[Object][120]** Message object to send
|
|
158
323
|
|
|
159
|
-
Returns **[Promise][
|
|
324
|
+
Returns **[Promise][126]\<any>** A promise which resolves when the operation has completed with the remote reply
|
|
160
325
|
|
|
161
326
|
### sendRaw
|
|
162
327
|
|
|
@@ -165,7 +330,7 @@ This function does not return or wait for a reply - use `send()` for that
|
|
|
165
330
|
|
|
166
331
|
#### Parameters
|
|
167
332
|
|
|
168
|
-
* `message` **[Object][
|
|
333
|
+
* `message` **[Object][120]** Message object to send
|
|
169
334
|
|
|
170
335
|
### rpc
|
|
171
336
|
|
|
@@ -173,10 +338,10 @@ Call an RPC function in the server instance
|
|
|
173
338
|
|
|
174
339
|
#### Parameters
|
|
175
340
|
|
|
176
|
-
* `method` **[String][
|
|
341
|
+
* `method` **[String][119]** The method name to call
|
|
177
342
|
* `args` **...any** 
|
|
178
343
|
|
|
179
|
-
Returns **[Promise][
|
|
344
|
+
Returns **[Promise][126]\<any>** The resolved output of the server function
|
|
180
345
|
|
|
181
346
|
### acceptMessage
|
|
182
347
|
|
|
@@ -185,7 +350,7 @@ Accept an incoming message
|
|
|
185
350
|
#### Parameters
|
|
186
351
|
|
|
187
352
|
* `rawMessage`  
|
|
188
|
-
* `Raw` **[MessageEvent][
|
|
353
|
+
* `Raw` **[MessageEvent][129]** message event to process
|
|
189
354
|
|
|
190
355
|
### acceptPostboxes
|
|
191
356
|
|
|
@@ -194,27 +359,27 @@ Listening postboxes, these correspond to outgoing message IDs that expect a resp
|
|
|
194
359
|
### createProjectStatePatch
|
|
195
360
|
|
|
196
361
|
Create + transmit a new project state patch base on the current and previous states
|
|
197
|
-
The transmitted patch follows the [JSPatch][
|
|
362
|
+
The transmitted patch follows the [JSPatch][130] standard
|
|
198
363
|
This function accepts an entire projectState instance, computes the delta and transmits that to the server for merging
|
|
199
364
|
|
|
200
365
|
#### Parameters
|
|
201
366
|
|
|
202
|
-
* `newState` **[Object][
|
|
203
|
-
* `oldState` **[Object][
|
|
367
|
+
* `newState` **[Object][120]** The local projectState to accept
|
|
368
|
+
* `oldState` **[Object][120]** The previous projectState to examine against
|
|
204
369
|
|
|
205
|
-
Returns **[Promise][
|
|
370
|
+
Returns **[Promise][126]** A promise which will resolve when the operation has completed
|
|
206
371
|
|
|
207
372
|
### applyProjectStatePatchLocal
|
|
208
373
|
|
|
209
374
|
Client function which accepts a patch from the server and applies it to local project state
|
|
210
|
-
The patch should follow the [JSPatch][
|
|
375
|
+
The patch should follow the [JSPatch][130] standard
|
|
211
376
|
This function is expected to be sub-classed by a plugin
|
|
212
377
|
|
|
213
378
|
#### Parameters
|
|
214
379
|
|
|
215
|
-
* `patch` **[Array][
|
|
380
|
+
* `patch` **[Array][125]** A JSPatch patch to apply
|
|
216
381
|
|
|
217
|
-
Returns **[Promise][
|
|
382
|
+
Returns **[Promise][126]** A promise which will resolve when the operation has completed
|
|
218
383
|
|
|
219
384
|
### init
|
|
220
385
|
|
|
@@ -223,22 +388,22 @@ This function can only be called once and will return the existing init() worker
|
|
|
223
388
|
|
|
224
389
|
#### Parameters
|
|
225
390
|
|
|
226
|
-
* `options` **[Object][
|
|
391
|
+
* `options` **[Object][120]?** Additional options to merge into `settings` via `set`
|
|
227
392
|
|
|
228
|
-
Returns **[Promise][
|
|
393
|
+
Returns **[Promise][126]<[TeraFy][24]>** An eventual promise which will resovle with this terafy instance
|
|
229
394
|
|
|
230
395
|
### detectMode
|
|
231
396
|
|
|
232
397
|
Populate `settings.mode`
|
|
233
398
|
Try to communicate with a parent frame, if none assume we need to fallback to child mode
|
|
234
399
|
|
|
235
|
-
Returns **[Promise][
|
|
400
|
+
Returns **[Promise][126]<[String][119]>** A promise which will resolve with the detected mode to use
|
|
236
401
|
|
|
237
402
|
### injectComms
|
|
238
403
|
|
|
239
404
|
Find an existing active TERA server OR initalize one
|
|
240
405
|
|
|
241
|
-
Returns **[Promise][
|
|
406
|
+
Returns **[Promise][126]** A promise which will resolve when the loading has completed and we have found a parent TERA instance or initiallized a child
|
|
242
407
|
|
|
243
408
|
### injectStylesheet
|
|
244
409
|
|
|
@@ -265,10 +430,10 @@ This function also routes 'special' keys like `devMode` to their internal handle
|
|
|
265
430
|
|
|
266
431
|
#### Parameters
|
|
267
432
|
|
|
268
|
-
* `key` **([String][
|
|
433
|
+
* `key` **([String][119] | [Object][120])** Either a single setting key to set or an object to merge
|
|
269
434
|
* `value` **any** The value to set if `key` is a string
|
|
270
435
|
|
|
271
|
-
Returns **[TeraFy][
|
|
436
|
+
Returns **[TeraFy][24]** This chainable terafy instance
|
|
272
437
|
|
|
273
438
|
### setIfDev
|
|
274
439
|
|
|
@@ -278,10 +443,10 @@ Set or merge settings - but only in dev mode and only if the value is not undefi
|
|
|
278
443
|
|
|
279
444
|
#### Parameters
|
|
280
445
|
|
|
281
|
-
* `key` **([String][
|
|
446
|
+
* `key` **([String][119] | [Object][120])** Either a single setting key to set or an object to merge
|
|
282
447
|
* `value` **any** The value to set if `key` is a string
|
|
283
448
|
|
|
284
|
-
Returns **[TeraFy][
|
|
449
|
+
Returns **[TeraFy][24]** This chainable terafy instance
|
|
285
450
|
|
|
286
451
|
### use
|
|
287
452
|
|
|
@@ -290,10 +455,10 @@ Include a TeraFy client plugin
|
|
|
290
455
|
#### Parameters
|
|
291
456
|
|
|
292
457
|
* `mod`  
|
|
293
|
-
* `options` **[Object][
|
|
294
|
-
* `The` **[Object][
|
|
458
|
+
* `options` **[Object][120]?** Additional options to mutate behaviour during construction (pass options to init() to intialize later options)
|
|
459
|
+
* `The` **[Object][120]** module function to include. Invoked as `(teraClient:TeraFy, options:Object)`
|
|
295
460
|
|
|
296
|
-
Returns **[TeraFy][
|
|
461
|
+
Returns **[TeraFy][24]** This chainable terafy instance
|
|
297
462
|
|
|
298
463
|
### mixin
|
|
299
464
|
|
|
@@ -301,8 +466,8 @@ Internal function used by use() to merge an external declared singleton against
|
|
|
301
466
|
|
|
302
467
|
#### Parameters
|
|
303
468
|
|
|
304
|
-
* `target` **[Object][
|
|
305
|
-
* `source` **[Object][
|
|
469
|
+
* `target` **[Object][120]** Initalied class instance to extend
|
|
470
|
+
* `source` **[Object][120]** Initalized source object to extend from
|
|
306
471
|
|
|
307
472
|
### toggleDevMode
|
|
308
473
|
|
|
@@ -310,9 +475,9 @@ Set or toggle devMode
|
|
|
310
475
|
|
|
311
476
|
#### Parameters
|
|
312
477
|
|
|
313
|
-
* `devModeEnabled` **([String][
|
|
478
|
+
* `devModeEnabled` **([String][119] | [Boolean][127])** Optional boolean to force dev mode (optional, default `'toggle'`)
|
|
314
479
|
|
|
315
|
-
Returns **[TeraFy][
|
|
480
|
+
Returns **[TeraFy][24]** This chainable terafy instance
|
|
316
481
|
|
|
317
482
|
### toggleFocus
|
|
318
483
|
|
|
@@ -321,7 +486,42 @@ This is usually because the server component wants to perform some user activity
|
|
|
321
486
|
|
|
322
487
|
#### Parameters
|
|
323
488
|
|
|
324
|
-
* `isFocused` **([String][
|
|
489
|
+
* `isFocused` **([String][119] | [Boolean][127])** Whether to fullscreen the embedded component (optional, default `'toggle'`)
|
|
490
|
+
|
|
491
|
+
### selectProjectFile
|
|
492
|
+
|
|
493
|
+
Require a user login to TERA
|
|
494
|
+
If there is no user OR they are not logged in a prompt is shown to go and do so
|
|
495
|
+
This is an pre-requisite step for requireProject()
|
|
496
|
+
|
|
497
|
+
#### Parameters
|
|
498
|
+
|
|
499
|
+
* `options`  
|
|
500
|
+
|
|
501
|
+
Returns **[Promise][126]** A promise which will resolve if the there is a user and they are logged in
|
|
502
|
+
|
|
503
|
+
### getProjectFiles
|
|
504
|
+
|
|
505
|
+
Fetch the files associated with a given project
|
|
506
|
+
|
|
507
|
+
#### Parameters
|
|
508
|
+
|
|
509
|
+
* `options` **[Object][120]** Options which mutate behaviour
|
|
510
|
+
|
|
511
|
+
* `options.autoRequire` **[Boolean][127]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
512
|
+
* `options.meta` **[Boolean][127]** Pull meta information for each file entity (optional, default `true`)
|
|
513
|
+
|
|
514
|
+
Returns **[Promise][126]<[Array][125]<[ProjectFile][1]>>** A collection of project files for the given project
|
|
515
|
+
|
|
516
|
+
### getProjectFile
|
|
517
|
+
|
|
518
|
+
Fetch a project file
|
|
519
|
+
|
|
520
|
+
#### Parameters
|
|
521
|
+
|
|
522
|
+
* `path` **[String][119]** File path to read
|
|
523
|
+
|
|
524
|
+
Returns **[Promise][126]<[Blob][123]>** The eventual fetched file as a blob
|
|
325
525
|
|
|
326
526
|
## handshake
|
|
327
527
|
|
|
@@ -329,9 +529,9 @@ Return basic server information as a form of validation
|
|
|
329
529
|
|
|
330
530
|
### Properties
|
|
331
531
|
|
|
332
|
-
* `date` **[Date][
|
|
532
|
+
* `date` **[Date][121]** Server date
|
|
333
533
|
|
|
334
|
-
Returns **[Promise][
|
|
534
|
+
Returns **[Promise][126]<[Object][120]>** Basic promise result
|
|
335
535
|
|
|
336
536
|
## User
|
|
337
537
|
|
|
@@ -339,16 +539,16 @@ User / active session within TERA
|
|
|
339
539
|
|
|
340
540
|
### Properties
|
|
341
541
|
|
|
342
|
-
* `id` **[String][
|
|
343
|
-
* `email` **[String][
|
|
344
|
-
* `name` **[String][
|
|
345
|
-
* `isSubscribed` **[Boolean][
|
|
542
|
+
* `id` **[String][119]** Unique identifier of the user
|
|
543
|
+
* `email` **[String][119]** The email address of the current user
|
|
544
|
+
* `name` **[String][119]** The provided full name of the user
|
|
545
|
+
* `isSubscribed` **[Boolean][127]** Whether the active user has a TERA subscription
|
|
346
546
|
|
|
347
547
|
## getUser
|
|
348
548
|
|
|
349
549
|
Fetch the current session user
|
|
350
550
|
|
|
351
|
-
Returns **[Promise][
|
|
551
|
+
Returns **[Promise][126]<[User][73]>** The current logged in user or null if none
|
|
352
552
|
|
|
353
553
|
## requireUser
|
|
354
554
|
|
|
@@ -358,19 +558,11 @@ This is an pre-requisite step for requireProject()
|
|
|
358
558
|
|
|
359
559
|
### Parameters
|
|
360
560
|
|
|
361
|
-
* `options` **[Object][
|
|
362
|
-
|
|
363
|
-
* `options.forceRetry` **[Boolean][94]** Forcabily try to refresh the user state (optional, default `false`)
|
|
561
|
+
* `options` **[Object][120]?** Additional options to mutate behaviour
|
|
364
562
|
|
|
365
|
-
|
|
563
|
+
* `options.forceRetry` **[Boolean][127]** Forcabily try to refresh the user state (optional, default `false`)
|
|
366
564
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
Require a user login to TERA
|
|
370
|
-
If there is no user OR they are not logged in a prompt is shown to go and do so
|
|
371
|
-
This is an pre-requisite step for requireProject()
|
|
372
|
-
|
|
373
|
-
Returns **[Promise][99]** A promise which will resolve if the there is a user and they are logged in
|
|
565
|
+
Returns **[Promise][126]<[User][73]>** The current logged in user or null if none
|
|
374
566
|
|
|
375
567
|
## Project
|
|
376
568
|
|
|
@@ -380,13 +572,13 @@ Project entry within TERA
|
|
|
380
572
|
|
|
381
573
|
Get the currently active project, if any
|
|
382
574
|
|
|
383
|
-
Returns **[Promise][
|
|
575
|
+
Returns **[Promise][126]<([Project][78] | null)>** The currently active project, if any
|
|
384
576
|
|
|
385
577
|
## getProjects
|
|
386
578
|
|
|
387
579
|
Get a list of projects the current session user has access to
|
|
388
580
|
|
|
389
|
-
Returns **[Promise][
|
|
581
|
+
Returns **[Promise][126]<[Array][125]<[Project][78]>>** Collection of projects the user has access to
|
|
390
582
|
|
|
391
583
|
## setActiveProject
|
|
392
584
|
|
|
@@ -394,7 +586,7 @@ Set the currently active project within TERA
|
|
|
394
586
|
|
|
395
587
|
### Parameters
|
|
396
588
|
|
|
397
|
-
* `project` **([Object][
|
|
589
|
+
* `project` **([Object][120] | [String][119])** The project to set as active - either the full Project object or its ID
|
|
398
590
|
|
|
399
591
|
## requireProject
|
|
400
592
|
|
|
@@ -403,14 +595,14 @@ Note that this function will percist in asking the uesr even if they try to canc
|
|
|
403
595
|
|
|
404
596
|
### Parameters
|
|
405
597
|
|
|
406
|
-
* `options` **[Object][
|
|
598
|
+
* `options` **[Object][120]?** Additional options to mutate behaviour
|
|
407
599
|
|
|
408
|
-
* `options.autoSetActiveProject` **[Boolean][
|
|
409
|
-
* `options.title` **[String][
|
|
410
|
-
* `options.noSelectTitle` **[String][
|
|
411
|
-
* `options.noSelectBody` **[String][
|
|
600
|
+
* `options.autoSetActiveProject` **[Boolean][127]** After selecting a project set that project as active in TERA (optional, default `true`)
|
|
601
|
+
* `options.title` **[String][119]** The title of the dialog to display (optional, default `"Select a project to work with"`)
|
|
602
|
+
* `options.noSelectTitle` **[String][119]** Dialog title when warning the user they need to select something (optional, default `'Select project'`)
|
|
603
|
+
* `options.noSelectBody` **[String][119]** Dialog body when warning the user they need to select something (optional, default `'A project needs to be selected to continue'`)
|
|
412
604
|
|
|
413
|
-
Returns **[Promise][
|
|
605
|
+
Returns **[Promise][126]<[Project][78]>** The active project
|
|
414
606
|
|
|
415
607
|
## selectProject
|
|
416
608
|
|
|
@@ -418,13 +610,13 @@ Prompt the user to select a project from those available
|
|
|
418
610
|
|
|
419
611
|
### Parameters
|
|
420
612
|
|
|
421
|
-
* `options` **[Object][
|
|
613
|
+
* `options` **[Object][120]?** Additional options to mutate behaviour
|
|
422
614
|
|
|
423
|
-
* `options.title` **[String][
|
|
424
|
-
* `options.allowCancel` **[Boolean][
|
|
425
|
-
* `options.setActive` **[Boolean][
|
|
615
|
+
* `options.title` **[String][119]** The title of the dialog to display (optional, default `"Select a project to work with"`)
|
|
616
|
+
* `options.allowCancel` **[Boolean][127]** Advertise cancelling the operation, the dialog can still be cancelled by closing it (optional, default `true`)
|
|
617
|
+
* `options.setActive` **[Boolean][127]** Also set the project as active when selected (optional, default `false`)
|
|
426
618
|
|
|
427
|
-
Returns **[Promise][
|
|
619
|
+
Returns **[Promise][126]<[Project][78]>** The active project
|
|
428
620
|
|
|
429
621
|
## getProjectState
|
|
430
622
|
|
|
@@ -432,12 +624,12 @@ Return the current, full snapshot state of the active project
|
|
|
432
624
|
|
|
433
625
|
### Parameters
|
|
434
626
|
|
|
435
|
-
* `options` **[Object][
|
|
627
|
+
* `options` **[Object][120]?** Additional options to mutate behaviour
|
|
436
628
|
|
|
437
|
-
* `options.autoRequire` **[Boolean][
|
|
438
|
-
* `Paths` **[Array][
|
|
629
|
+
* `options.autoRequire` **[Boolean][127]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
630
|
+
* `Paths` **[Array][125]<[String][119]>** to subscribe to e.g. \['/users/'],
|
|
439
631
|
|
|
440
|
-
Returns **[Promise][
|
|
632
|
+
Returns **[Promise][126]<[Object][120]>** The current project state snapshot
|
|
441
633
|
|
|
442
634
|
## setProjectState
|
|
443
635
|
|
|
@@ -449,14 +641,14 @@ Paths can be any valid Lodash.set() value such as:
|
|
|
449
641
|
|
|
450
642
|
### Parameters
|
|
451
643
|
|
|
452
|
-
* `path` **([String][
|
|
644
|
+
* `path` **([String][119] | [Array][125]<[String][119]>)** The sub-path within the project state to set
|
|
453
645
|
* `value` **any** The value to set
|
|
454
|
-
* `options` **[Object][
|
|
646
|
+
* `options` **[Object][120]?** Additional options to mutate behaviour
|
|
455
647
|
|
|
456
|
-
* `options.save` **[Boolean][
|
|
457
|
-
* `options.sync` **[Boolean][
|
|
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`)
|
|
458
650
|
|
|
459
|
-
Returns **[Promise][
|
|
651
|
+
Returns **[Promise][126]** A promise which resolves when the operation has synced with the server
|
|
460
652
|
|
|
461
653
|
## setProjectStateDefaults
|
|
462
654
|
|
|
@@ -466,17 +658,17 @@ Set a nested value within the project state - just like `setProjectState()` - bu
|
|
|
466
658
|
|
|
467
659
|
### Parameters
|
|
468
660
|
|
|
469
|
-
* `path` **([String][
|
|
661
|
+
* `path` **([String][119] | [Array][125]<[String][119]>)** The sub-path within the project state to set
|
|
470
662
|
* `value` **any** The value to set
|
|
471
|
-
* `options` **[Object][
|
|
663
|
+
* `options` **[Object][120]?** Additional options to mutate behaviour, see setProjectState() for the full list of supported options
|
|
472
664
|
|
|
473
|
-
Returns **[Promise][
|
|
665
|
+
Returns **[Promise][126]<[Boolean][127]>** A promise which resolves to whether any changes were made - True if defaults were applied, false otherwise
|
|
474
666
|
|
|
475
667
|
## saveProjectState
|
|
476
668
|
|
|
477
669
|
Force-Save the currently active project state
|
|
478
670
|
|
|
479
|
-
Returns **[Promise][
|
|
671
|
+
Returns **[Promise][126]** A promise which resolves when the operation has completed
|
|
480
672
|
|
|
481
673
|
## replaceProjectState
|
|
482
674
|
|
|
@@ -487,9 +679,9 @@ You almost never want to use this function directly, see `setProjectState(path,
|
|
|
487
679
|
|
|
488
680
|
### Parameters
|
|
489
681
|
|
|
490
|
-
* `newState` **[Object][
|
|
682
|
+
* `newState` **[Object][120]** The new state to replace the current state with
|
|
491
683
|
|
|
492
|
-
Returns **[Promise][
|
|
684
|
+
Returns **[Promise][126]** A promise which resolves when the operation has completed
|
|
493
685
|
|
|
494
686
|
## applyProjectStatePatch
|
|
495
687
|
|
|
@@ -497,9 +689,9 @@ Apply a computed `just-diff` patch to the current project state
|
|
|
497
689
|
|
|
498
690
|
### Parameters
|
|
499
691
|
|
|
500
|
-
* `Patch` **[Object][
|
|
692
|
+
* `Patch` **[Object][120]** to apply
|
|
501
693
|
|
|
502
|
-
Returns **[Promise][
|
|
694
|
+
Returns **[Promise][126]** A promise which resolves when the operation has completed
|
|
503
695
|
|
|
504
696
|
## subscribeProjectState
|
|
505
697
|
|
|
@@ -507,27 +699,7 @@ Subscribe to project state changes
|
|
|
507
699
|
This will dispatch an RPC call to the source object `applyProjectStatePatchLocal()` function with the patch
|
|
508
700
|
If the above call fails the subscriber is assumed as dead and unsubscribed from the polling list
|
|
509
701
|
|
|
510
|
-
Returns **[Promise][
|
|
511
|
-
|
|
512
|
-
## ProjectFile
|
|
513
|
-
|
|
514
|
-
Data structure for a project file
|
|
515
|
-
|
|
516
|
-
### Properties
|
|
517
|
-
|
|
518
|
-
* `id` **[String][95]** A UUID string representing the unique ID of the file
|
|
519
|
-
* `name` **[String][95]** Relative name path (can contain prefix directories) for the human readable file name
|
|
520
|
-
* `parsedName` **[Object][93]** An object representing meta file parts of a file name
|
|
521
|
-
|
|
522
|
-
* `parsedName.basename` **[String][95]** The filename + extention (i.e. everything without directory name)
|
|
523
|
-
* `parsedName.filename` **[String][95]** The file portion of the name (basename without the extension)
|
|
524
|
-
* `parsedName.ext` **[String][95]** The extension portion of the name (always lower case)
|
|
525
|
-
* `parsedName.dirName` **[String][95]** The directory path portion of the name
|
|
526
|
-
* `created` **[Date][102]** A date representing when the file was created
|
|
527
|
-
* `modified` **[Date][102]** A date representing when the file was created
|
|
528
|
-
* `accessed` **[Date][102]** A date representing when the file was last accessed
|
|
529
|
-
* `size` **[Number][96]** Size, in bytes, of the file
|
|
530
|
-
* `mime` **[String][95]** The associated mime type for the file
|
|
702
|
+
Returns **[Promise][126]<[Function][131]>** A promise which resolves when a subscription has been created, call the resulting function to unsubscribe
|
|
531
703
|
|
|
532
704
|
## FileFilters
|
|
533
705
|
|
|
@@ -535,10 +707,10 @@ Data structure for a file filter
|
|
|
535
707
|
|
|
536
708
|
### Properties
|
|
537
709
|
|
|
538
|
-
* `library` **[Boolean][
|
|
539
|
-
* `filename` **[String][
|
|
540
|
-
* `basename` **[String][
|
|
541
|
-
* `ext` **[String][
|
|
710
|
+
* `library` **[Boolean][127]?** Restrict to library files only
|
|
711
|
+
* `filename` **[String][119]?** CSV of @momsfriendlydevco/match expressions to filter the filename by (filenames are the basename sans extension)
|
|
712
|
+
* `basename` **[String][119]?** CSV of @momsfriendlydevco/match expressions to filter the basename by
|
|
713
|
+
* `ext` **[String][119]?** CSV of @momsfriendlydevco/match expressions to filter the file extension by
|
|
542
714
|
|
|
543
715
|
## selectProjectFile
|
|
544
716
|
|
|
@@ -546,32 +718,30 @@ Prompt the user to select a library to operate on
|
|
|
546
718
|
|
|
547
719
|
### Parameters
|
|
548
720
|
|
|
549
|
-
* `options` **[Object][
|
|
721
|
+
* `options` **[Object][120]?** Additional options to mutate behaviour
|
|
550
722
|
|
|
551
|
-
* `options.title` **[String][
|
|
552
|
-
* `options.hint` **([String][
|
|
553
|
-
* `options.filters` **[FileFilters][
|
|
554
|
-
* `options.allowUpload` **[Boolean][
|
|
555
|
-
* `options.allowRefresh` **[Boolean][
|
|
556
|
-
* `options.allowDownloadZip` **[Boolean][
|
|
557
|
-
* `options.allowCancel` **[Boolean][
|
|
558
|
-
* `options.autoRequire` **[Boolean][
|
|
559
|
-
* `options.filter` **[FileFilters][
|
|
723
|
+
* `options.title` **[String][119]** The title of the dialog to display (optional, default `"Select a file"`)
|
|
724
|
+
* `options.hint` **([String][119] | [Array][125]<[String][119]>)?** Hints to identify the file to select in array order of preference
|
|
725
|
+
* `options.filters` **[FileFilters][99]?** Optional file filters
|
|
726
|
+
* `options.allowUpload` **[Boolean][127]** Allow uploading new files (optional, default `true`)
|
|
727
|
+
* `options.allowRefresh` **[Boolean][127]** Allow the user to manually refresh the file list (optional, default `true`)
|
|
728
|
+
* `options.allowDownloadZip` **[Boolean][127]** Allow the user to download a Zip of all files (optional, default `true`)
|
|
729
|
+
* `options.allowCancel` **[Boolean][127]** Allow cancelling the operation. Will throw `'CANCEL'` as the promise rejection if acationed (optional, default `true`)
|
|
730
|
+
* `options.autoRequire` **[Boolean][127]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
731
|
+
* `options.filter` **[FileFilters][99]?** Optional file filters
|
|
560
732
|
|
|
561
|
-
Returns **[Promise][
|
|
733
|
+
Returns **[Promise][126]<[ProjectFile][1]>** The eventually selected file
|
|
562
734
|
|
|
563
|
-
##
|
|
735
|
+
## setProjectFile
|
|
564
736
|
|
|
565
|
-
|
|
737
|
+
Replace a project files contents
|
|
566
738
|
|
|
567
739
|
### Parameters
|
|
568
740
|
|
|
569
|
-
* `
|
|
741
|
+
* `path` **[String][119]** File path to write
|
|
742
|
+
* `contents` **(File | [Blob][123] | [FormData][124] | [Object][120] | [Array][125])** The new file contents
|
|
570
743
|
|
|
571
|
-
|
|
572
|
-
* `options.meta` **[Boolean][94]** Pull meta information for each file entity (optional, default `true`)
|
|
573
|
-
|
|
574
|
-
Returns **[Promise][99]<[Array][97]<[ProjectFile][71]>>** A collection of project files for the given project
|
|
744
|
+
Returns **[Promise][126]** A promise which will resolve when the write operation has completed
|
|
575
745
|
|
|
576
746
|
## selectProjectLibrary
|
|
577
747
|
|
|
@@ -579,18 +749,18 @@ Prompt the user to select a library to operate on and return a array of referenc
|
|
|
579
749
|
|
|
580
750
|
### Parameters
|
|
581
751
|
|
|
582
|
-
* `options` **[Object][
|
|
752
|
+
* `options` **[Object][120]?** Additional options to mutate behaviour
|
|
583
753
|
|
|
584
|
-
* `options.title` **[String][
|
|
585
|
-
* `options.hint` **([String][
|
|
586
|
-
* `options.allowUpload` **[Boolean][
|
|
587
|
-
* `options.allowRefresh` **[Boolean][
|
|
588
|
-
* `options.allowDownloadZip` **[Boolean][
|
|
589
|
-
* `options.allowCancel` **[Boolean][
|
|
590
|
-
* `options.autoRequire` **[Boolean][
|
|
591
|
-
* `options.filters` **[FileFilters][
|
|
754
|
+
* `options.title` **[String][119]** The title of the dialog to display (optional, default `"Select a citation library"`)
|
|
755
|
+
* `options.hint` **([String][119] | [Array][125]<[String][119]>)?** Hints to identify the library to select in array order of preference. Generally corresponds to the previous stage - e.g. 'deduped', 'review1', 'review2', 'dedisputed'
|
|
756
|
+
* `options.allowUpload` **[Boolean][127]** Allow uploading new files (optional, default `true`)
|
|
757
|
+
* `options.allowRefresh` **[Boolean][127]** Allow the user to manually refresh the file list (optional, default `true`)
|
|
758
|
+
* `options.allowDownloadZip` **[Boolean][127]** Allow the user to download a Zip of all files (optional, default `true`)
|
|
759
|
+
* `options.allowCancel` **[Boolean][127]** Allow cancelling the operation. Will throw `'CANCEL'` as the promise rejection if acationed (optional, default `true`)
|
|
760
|
+
* `options.autoRequire` **[Boolean][127]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
761
|
+
* `options.filters` **[FileFilters][99]?** Optional file filters, defaults to citation library selection only
|
|
592
762
|
|
|
593
|
-
Returns **[Promise][
|
|
763
|
+
Returns **[Promise][126]<[Array][125]\<Ref>>** A collection of references from the selected file
|
|
594
764
|
|
|
595
765
|
## parseProjectLibrary
|
|
596
766
|
|
|
@@ -598,15 +768,15 @@ Convert a project file into a library of citations
|
|
|
598
768
|
|
|
599
769
|
### Parameters
|
|
600
770
|
|
|
601
|
-
* `path` **[String][
|
|
602
|
-
* `options` **[Object][
|
|
771
|
+
* `path` **[String][119]** File path to read, if omitted the contents of `options` are used to guess at a suitable file
|
|
772
|
+
* `options` **[Object][120]?** Additional options to mutate behaviour
|
|
603
773
|
|
|
604
|
-
* `options.format` **[String][
|
|
605
|
-
* `options.autoRequire` **[Boolean][
|
|
606
|
-
* `options.filter` **[Function][
|
|
607
|
-
* `options.find` **[Function][
|
|
774
|
+
* `options.format` **[String][119]** Format for the file. ENUM: 'pojo' (return a parsed JS collection), 'blob' (raw JS Blob object), 'file' (named JS File object) (optional, default `'json'`)
|
|
775
|
+
* `options.autoRequire` **[Boolean][127]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
776
|
+
* `options.filter` **[Function][131]?** Optional async file filter, called each time as `(File:ProjectFile)`
|
|
777
|
+
* `options.find` **[Function][131]?** Optional async final stage file filter to reduce all candidates down to one subject file
|
|
608
778
|
|
|
609
|
-
Returns **([Promise][
|
|
779
|
+
Returns **([Promise][126]<[Array][125]\<Ref>> | [Promise][126]\<any>)** A collection of references (default bevahiour) or a whatever format was requested
|
|
610
780
|
|
|
611
781
|
## setProjectLibrary
|
|
612
782
|
|
|
@@ -614,17 +784,17 @@ Save back a citation library from some input
|
|
|
614
784
|
|
|
615
785
|
### Parameters
|
|
616
786
|
|
|
617
|
-
* `path` **[String][
|
|
618
|
-
* `Collection` **[Array][
|
|
619
|
-
* `options` **[Object][
|
|
787
|
+
* `path` **[String][119]?** File path to save back to
|
|
788
|
+
* `Collection` **[Array][125]\<RefLibRef>** of references for the selected library
|
|
789
|
+
* `options` **[Object][120]?** Additional options to mutate behaviour
|
|
620
790
|
|
|
621
|
-
* `options.format` **[String][
|
|
622
|
-
* `options.autoRequire` **[Boolean][
|
|
623
|
-
* `options.hint` **[String][
|
|
624
|
-
* `options.overwrite` **[Boolean][
|
|
625
|
-
* `options.meta` **[Object][
|
|
791
|
+
* `options.format` **[String][119]** Input format used. ENUM: 'pojo' (return a parsed JS collection), 'blob' (raw JS Blob object), 'file' (named JS File object) (optional, default `'json'`)
|
|
792
|
+
* `options.autoRequire` **[Boolean][127]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
793
|
+
* `options.hint` **[String][119]?** Hint to store against the library. Generally corresponds to the current operation being performed - e.g. 'deduped'
|
|
794
|
+
* `options.overwrite` **[Boolean][127]** Allow existing file upsert (optional, default `true`)
|
|
795
|
+
* `options.meta` **[Object][120]?** Optional meta data to merge into the file data
|
|
626
796
|
|
|
627
|
-
Returns **[Promise][
|
|
797
|
+
Returns **[Promise][126]** A promise which resolves when the save operation has completed
|
|
628
798
|
|
|
629
799
|
## setProjectLibrary
|
|
630
800
|
|
|
@@ -632,13 +802,13 @@ Save back a projects citation library
|
|
|
632
802
|
|
|
633
803
|
### Parameters
|
|
634
804
|
|
|
635
|
-
* `Collection` **[Array][
|
|
636
|
-
* `options` **[Object][
|
|
805
|
+
* `Collection` **[Array][125]\<RefLibRef>** of references for the selected library
|
|
806
|
+
* `options` **[Object][120]?** Additional options to mutate behaviour
|
|
637
807
|
|
|
638
|
-
* `options.autoRequire` **[Boolean][
|
|
639
|
-
* `options.hint` **[String][
|
|
808
|
+
* `options.autoRequire` **[Boolean][127]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
809
|
+
* `options.hint` **[String][119]?** Hint to store against the library. Generally corresponds to the current operation being performed - e.g. 'deduped'
|
|
640
810
|
|
|
641
|
-
Returns **[Promise][
|
|
811
|
+
Returns **[Promise][126]** A promise which resolves when the save operation has completed
|
|
642
812
|
|
|
643
813
|
## uiAlert
|
|
644
814
|
|
|
@@ -646,13 +816,13 @@ Display simple text within TERA
|
|
|
646
816
|
|
|
647
817
|
### Parameters
|
|
648
818
|
|
|
649
|
-
* `text` **[String][
|
|
650
|
-
* `options` **[Object][
|
|
819
|
+
* `text` **[String][119]** The text to display
|
|
820
|
+
* `options` **[Object][120]?** Additional options to mutate behaviour
|
|
651
821
|
|
|
652
|
-
* `options.title` **[String][
|
|
653
|
-
* `options.isHtml` **[Boolean][
|
|
822
|
+
* `options.title` **[String][119]** The title of the alert box (optional, default `'TERA'`)
|
|
823
|
+
* `options.isHtml` **[Boolean][127]** If falsy the text is rendered as plain-text otherwise it will be assumed as HTML content (optional, default `false`)
|
|
654
824
|
|
|
655
|
-
Returns **[Promise][
|
|
825
|
+
Returns **[Promise][126]** A promise which resolves when the alert has been dismissed
|
|
656
826
|
|
|
657
827
|
## uiSplat
|
|
658
828
|
|
|
@@ -661,10 +831,10 @@ This function is ideally called within a requestFocus() wrapper
|
|
|
661
831
|
|
|
662
832
|
### Parameters
|
|
663
833
|
|
|
664
|
-
* `content` **(DOMElement | [String][
|
|
665
|
-
* `options` **[Object][
|
|
834
|
+
* `content` **(DOMElement | [String][119] | `false`)** Either a prepared DOM element or string to compile, set to falsy to remove existing content
|
|
835
|
+
* `options` **[Object][120]?** Additional options to mutate behaviour
|
|
666
836
|
|
|
667
|
-
* `options.logo` **([Boolean][
|
|
837
|
+
* `options.logo` **([Boolean][127] | [String][119])** Add a logo to the output, if boolean true the Tera-tools logo is used otherwise specify a path or URL (optional, default `false`)
|
|
668
838
|
|
|
669
839
|
## uiWindow
|
|
670
840
|
|
|
@@ -672,218 +842,274 @@ Open a popup window containing a new site
|
|
|
672
842
|
|
|
673
843
|
### Parameters
|
|
674
844
|
|
|
675
|
-
* `url` **[String][
|
|
676
|
-
* `options` **[Object][
|
|
845
|
+
* `url` **[String][119]** The URL to open
|
|
846
|
+
* `options` **[Object][120]?** Additional options to mutate behaviour
|
|
677
847
|
|
|
678
|
-
* `options.width` **[Number][
|
|
679
|
-
* `options.height` **[Number][
|
|
680
|
-
* `options.center` **[Boolean][
|
|
681
|
-
* `options.permissions` **[Object][
|
|
848
|
+
* `options.width` **[Number][122]** The desired width of the window (optional, default `500`)
|
|
849
|
+
* `options.height` **[Number][122]** The desired height of the window (optional, default `600`)
|
|
850
|
+
* `options.center` **[Boolean][127]** Attempt to center the window on the screen (optional, default `true`)
|
|
851
|
+
* `options.permissions` **[Object][120]?** Additional permissions to set on opening, defaults to a suitable set of permission for popups (see code)
|
|
682
852
|
|
|
683
853
|
Returns **WindowProxy** The opened window object (if `noopener` is not set in permissions)
|
|
684
854
|
|
|
685
|
-
[1]: #
|
|
855
|
+
[1]: #projectfile
|
|
856
|
+
|
|
857
|
+
[2]: #tera
|
|
858
|
+
|
|
859
|
+
[3]: #parameters
|
|
860
|
+
|
|
861
|
+
[4]: #id
|
|
862
|
+
|
|
863
|
+
[5]: #name
|
|
864
|
+
|
|
865
|
+
[6]: #path
|
|
866
|
+
|
|
867
|
+
[7]: #parsedname
|
|
868
|
+
|
|
869
|
+
[8]: #properties
|
|
870
|
+
|
|
871
|
+
[9]: #created
|
|
872
|
+
|
|
873
|
+
[10]: #createdformatted
|
|
874
|
+
|
|
875
|
+
[11]: #modified
|
|
876
|
+
|
|
877
|
+
[12]: #modifiedformatted
|
|
878
|
+
|
|
879
|
+
[13]: #accessed
|
|
880
|
+
|
|
881
|
+
[14]: #accessedformatted
|
|
882
|
+
|
|
883
|
+
[15]: #size
|
|
884
|
+
|
|
885
|
+
[16]: #sizeformatted
|
|
886
|
+
|
|
887
|
+
[17]: #mime
|
|
888
|
+
|
|
889
|
+
[18]: #getcontents
|
|
890
|
+
|
|
891
|
+
[19]: #setcontents
|
|
892
|
+
|
|
893
|
+
[20]: #parameters-1
|
|
894
|
+
|
|
895
|
+
[21]: #getrefs
|
|
896
|
+
|
|
897
|
+
[22]: #setrefs
|
|
898
|
+
|
|
899
|
+
[23]: #parameters-2
|
|
900
|
+
|
|
901
|
+
[24]: #terafy
|
|
902
|
+
|
|
903
|
+
[25]: #settings
|
|
904
|
+
|
|
905
|
+
[26]: #properties-1
|
|
906
|
+
|
|
907
|
+
[27]: #events
|
|
908
|
+
|
|
909
|
+
[28]: #dom
|
|
910
|
+
|
|
911
|
+
[29]: #properties-2
|
|
686
912
|
|
|
687
|
-
[
|
|
913
|
+
[30]: #methods
|
|
688
914
|
|
|
689
|
-
[
|
|
915
|
+
[31]: #plugins
|
|
690
916
|
|
|
691
|
-
[
|
|
917
|
+
[32]: #send
|
|
692
918
|
|
|
693
|
-
[
|
|
919
|
+
[33]: #parameters-3
|
|
694
920
|
|
|
695
|
-
[
|
|
921
|
+
[34]: #sendraw
|
|
696
922
|
|
|
697
|
-
[
|
|
923
|
+
[35]: #parameters-4
|
|
698
924
|
|
|
699
|
-
[
|
|
925
|
+
[36]: #rpc
|
|
700
926
|
|
|
701
|
-
[
|
|
927
|
+
[37]: #parameters-5
|
|
702
928
|
|
|
703
|
-
[
|
|
929
|
+
[38]: #acceptmessage
|
|
704
930
|
|
|
705
|
-
[
|
|
931
|
+
[39]: #parameters-6
|
|
706
932
|
|
|
707
|
-
[
|
|
933
|
+
[40]: #acceptpostboxes
|
|
708
934
|
|
|
709
|
-
[
|
|
935
|
+
[41]: #createprojectstatepatch
|
|
710
936
|
|
|
711
|
-
[
|
|
937
|
+
[42]: #parameters-7
|
|
712
938
|
|
|
713
|
-
[
|
|
939
|
+
[43]: #applyprojectstatepatchlocal
|
|
714
940
|
|
|
715
|
-
[
|
|
941
|
+
[44]: #parameters-8
|
|
716
942
|
|
|
717
|
-
[
|
|
943
|
+
[45]: #init
|
|
718
944
|
|
|
719
|
-
[
|
|
945
|
+
[46]: #parameters-9
|
|
720
946
|
|
|
721
|
-
[
|
|
947
|
+
[47]: #detectmode
|
|
722
948
|
|
|
723
|
-
[
|
|
949
|
+
[48]: #injectcomms
|
|
724
950
|
|
|
725
|
-
[
|
|
951
|
+
[49]: #injectstylesheet
|
|
726
952
|
|
|
727
|
-
[
|
|
953
|
+
[50]: #injectmethods
|
|
728
954
|
|
|
729
|
-
[
|
|
955
|
+
[51]: #debug
|
|
730
956
|
|
|
731
|
-
[
|
|
957
|
+
[52]: #parameters-10
|
|
732
958
|
|
|
733
|
-
[
|
|
959
|
+
[53]: #set
|
|
734
960
|
|
|
735
|
-
[
|
|
961
|
+
[54]: #parameters-11
|
|
736
962
|
|
|
737
|
-
[
|
|
963
|
+
[55]: #setifdev
|
|
738
964
|
|
|
739
|
-
[
|
|
965
|
+
[56]: #parameters-12
|
|
740
966
|
|
|
741
|
-
[
|
|
967
|
+
[57]: #use
|
|
742
968
|
|
|
743
|
-
[
|
|
969
|
+
[58]: #parameters-13
|
|
744
970
|
|
|
745
|
-
[
|
|
971
|
+
[59]: #mixin
|
|
746
972
|
|
|
747
|
-
[
|
|
973
|
+
[60]: #parameters-14
|
|
748
974
|
|
|
749
|
-
[
|
|
975
|
+
[61]: #toggledevmode
|
|
750
976
|
|
|
751
|
-
[
|
|
977
|
+
[62]: #parameters-15
|
|
752
978
|
|
|
753
|
-
[
|
|
979
|
+
[63]: #togglefocus
|
|
754
980
|
|
|
755
|
-
[
|
|
981
|
+
[64]: #parameters-16
|
|
756
982
|
|
|
757
|
-
[
|
|
983
|
+
[65]: #selectprojectfile
|
|
758
984
|
|
|
759
|
-
[
|
|
985
|
+
[66]: #parameters-17
|
|
760
986
|
|
|
761
|
-
[
|
|
987
|
+
[67]: #getprojectfiles
|
|
762
988
|
|
|
763
|
-
[
|
|
989
|
+
[68]: #parameters-18
|
|
764
990
|
|
|
765
|
-
[
|
|
991
|
+
[69]: #getprojectfile
|
|
766
992
|
|
|
767
|
-
[
|
|
993
|
+
[70]: #parameters-19
|
|
768
994
|
|
|
769
|
-
[
|
|
995
|
+
[71]: #handshake
|
|
770
996
|
|
|
771
|
-
[
|
|
997
|
+
[72]: #properties-3
|
|
772
998
|
|
|
773
|
-
[
|
|
999
|
+
[73]: #user
|
|
774
1000
|
|
|
775
|
-
[
|
|
1001
|
+
[74]: #properties-4
|
|
776
1002
|
|
|
777
|
-
[
|
|
1003
|
+
[75]: #getuser
|
|
778
1004
|
|
|
779
|
-
[
|
|
1005
|
+
[76]: #requireuser
|
|
780
1006
|
|
|
781
|
-
[
|
|
1007
|
+
[77]: #parameters-20
|
|
782
1008
|
|
|
783
|
-
[
|
|
1009
|
+
[78]: #project
|
|
784
1010
|
|
|
785
|
-
[
|
|
1011
|
+
[79]: #getproject
|
|
786
1012
|
|
|
787
|
-
[
|
|
1013
|
+
[80]: #getprojects
|
|
788
1014
|
|
|
789
|
-
[
|
|
1015
|
+
[81]: #setactiveproject
|
|
790
1016
|
|
|
791
|
-
[
|
|
1017
|
+
[82]: #parameters-21
|
|
792
1018
|
|
|
793
|
-
[
|
|
1019
|
+
[83]: #requireproject
|
|
794
1020
|
|
|
795
|
-
[
|
|
1021
|
+
[84]: #parameters-22
|
|
796
1022
|
|
|
797
|
-
[
|
|
1023
|
+
[85]: #selectproject
|
|
798
1024
|
|
|
799
|
-
[
|
|
1025
|
+
[86]: #parameters-23
|
|
800
1026
|
|
|
801
|
-
[
|
|
1027
|
+
[87]: #getprojectstate
|
|
802
1028
|
|
|
803
|
-
[
|
|
1029
|
+
[88]: #parameters-24
|
|
804
1030
|
|
|
805
|
-
[
|
|
1031
|
+
[89]: #setprojectstate
|
|
806
1032
|
|
|
807
|
-
[
|
|
1033
|
+
[90]: #parameters-25
|
|
808
1034
|
|
|
809
|
-
[
|
|
1035
|
+
[91]: #setprojectstatedefaults
|
|
810
1036
|
|
|
811
|
-
[
|
|
1037
|
+
[92]: #parameters-26
|
|
812
1038
|
|
|
813
|
-
[
|
|
1039
|
+
[93]: #saveprojectstate
|
|
814
1040
|
|
|
815
|
-
[
|
|
1041
|
+
[94]: #replaceprojectstate
|
|
816
1042
|
|
|
817
|
-
[
|
|
1043
|
+
[95]: #parameters-27
|
|
818
1044
|
|
|
819
|
-
[
|
|
1045
|
+
[96]: #applyprojectstatepatch
|
|
820
1046
|
|
|
821
|
-
[
|
|
1047
|
+
[97]: #parameters-28
|
|
822
1048
|
|
|
823
|
-
[
|
|
1049
|
+
[98]: #subscribeprojectstate
|
|
824
1050
|
|
|
825
|
-
[
|
|
1051
|
+
[99]: #filefilters
|
|
826
1052
|
|
|
827
|
-
[
|
|
1053
|
+
[100]: #properties-5
|
|
828
1054
|
|
|
829
|
-
[
|
|
1055
|
+
[101]: #selectprojectfile-1
|
|
830
1056
|
|
|
831
|
-
[
|
|
1057
|
+
[102]: #parameters-29
|
|
832
1058
|
|
|
833
|
-
[
|
|
1059
|
+
[103]: #setprojectfile
|
|
834
1060
|
|
|
835
|
-
[
|
|
1061
|
+
[104]: #parameters-30
|
|
836
1062
|
|
|
837
|
-
[
|
|
1063
|
+
[105]: #selectprojectlibrary
|
|
838
1064
|
|
|
839
|
-
[
|
|
1065
|
+
[106]: #parameters-31
|
|
840
1066
|
|
|
841
|
-
[
|
|
1067
|
+
[107]: #parseprojectlibrary
|
|
842
1068
|
|
|
843
|
-
[
|
|
1069
|
+
[108]: #parameters-32
|
|
844
1070
|
|
|
845
|
-
[
|
|
1071
|
+
[109]: #setprojectlibrary
|
|
846
1072
|
|
|
847
|
-
[
|
|
1073
|
+
[110]: #parameters-33
|
|
848
1074
|
|
|
849
|
-
[
|
|
1075
|
+
[111]: #setprojectlibrary-1
|
|
850
1076
|
|
|
851
|
-
[
|
|
1077
|
+
[112]: #parameters-34
|
|
852
1078
|
|
|
853
|
-
[
|
|
1079
|
+
[113]: #uialert
|
|
854
1080
|
|
|
855
|
-
[
|
|
1081
|
+
[114]: #parameters-35
|
|
856
1082
|
|
|
857
|
-
[
|
|
1083
|
+
[115]: #uisplat
|
|
858
1084
|
|
|
859
|
-
[
|
|
1085
|
+
[116]: #parameters-36
|
|
860
1086
|
|
|
861
|
-
[
|
|
1087
|
+
[117]: #uiwindow
|
|
862
1088
|
|
|
863
|
-
[
|
|
1089
|
+
[118]: #parameters-37
|
|
864
1090
|
|
|
865
|
-
[
|
|
1091
|
+
[119]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
866
1092
|
|
|
867
|
-
[
|
|
1093
|
+
[120]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
868
1094
|
|
|
869
|
-
[
|
|
1095
|
+
[121]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date
|
|
870
1096
|
|
|
871
|
-
[
|
|
1097
|
+
[122]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
872
1098
|
|
|
873
|
-
[
|
|
1099
|
+
[123]: https://developer.mozilla.org/docs/Web/API/Blob
|
|
874
1100
|
|
|
875
|
-
[
|
|
1101
|
+
[124]: https://developer.mozilla.org/docs/Web/API/FormData
|
|
876
1102
|
|
|
877
|
-
[
|
|
1103
|
+
[125]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
878
1104
|
|
|
879
|
-
[
|
|
1105
|
+
[126]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
880
1106
|
|
|
881
|
-
[
|
|
1107
|
+
[127]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
882
1108
|
|
|
883
|
-
[
|
|
1109
|
+
[128]: https://developer.mozilla.org/docs/Web/API/Window
|
|
884
1110
|
|
|
885
|
-
[
|
|
1111
|
+
[129]: https://developer.mozilla.org/docs/Web/API/MessageEvent
|
|
886
1112
|
|
|
887
|
-
[
|
|
1113
|
+
[130]: http://jsonpatch.com
|
|
888
1114
|
|
|
889
|
-
[
|
|
1115
|
+
[131]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|