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