@iebh/tera-fy 1.0.17 → 1.0.18

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