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