fomantic-ui 2.9.3-beta.46 → 2.9.3-beta.47

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.
Files changed (184) hide show
  1. package/dist/components/accordion.css +1 -1
  2. package/dist/components/accordion.js +1 -1
  3. package/dist/components/accordion.min.css +1 -1
  4. package/dist/components/accordion.min.js +1 -1
  5. package/dist/components/ad.css +1 -1
  6. package/dist/components/ad.min.css +1 -1
  7. package/dist/components/api.js +1 -1
  8. package/dist/components/api.min.js +1 -1
  9. package/dist/components/breadcrumb.css +1 -1
  10. package/dist/components/breadcrumb.min.css +1 -1
  11. package/dist/components/button.css +1 -1
  12. package/dist/components/button.min.css +1 -1
  13. package/dist/components/calendar.css +1 -1
  14. package/dist/components/calendar.js +1 -1
  15. package/dist/components/calendar.min.css +1 -1
  16. package/dist/components/calendar.min.js +1 -1
  17. package/dist/components/card.css +1 -1
  18. package/dist/components/card.min.css +1 -1
  19. package/dist/components/checkbox.css +1 -1
  20. package/dist/components/checkbox.js +1 -1
  21. package/dist/components/checkbox.min.css +1 -1
  22. package/dist/components/checkbox.min.js +1 -1
  23. package/dist/components/comment.css +1 -1
  24. package/dist/components/comment.min.css +1 -1
  25. package/dist/components/container.css +1 -1
  26. package/dist/components/container.min.css +1 -1
  27. package/dist/components/dimmer.css +1 -1
  28. package/dist/components/dimmer.js +1 -1
  29. package/dist/components/dimmer.min.css +1 -1
  30. package/dist/components/dimmer.min.js +1 -1
  31. package/dist/components/divider.css +1 -1
  32. package/dist/components/divider.min.css +1 -1
  33. package/dist/components/dropdown.css +1 -1
  34. package/dist/components/dropdown.js +1 -1
  35. package/dist/components/dropdown.min.css +1 -1
  36. package/dist/components/dropdown.min.js +1 -1
  37. package/dist/components/embed.css +1 -1
  38. package/dist/components/embed.js +1 -1
  39. package/dist/components/embed.min.css +1 -1
  40. package/dist/components/embed.min.js +1 -1
  41. package/dist/components/emoji.css +1 -1
  42. package/dist/components/emoji.min.css +1 -1
  43. package/dist/components/feed.css +1 -1
  44. package/dist/components/feed.min.css +1 -1
  45. package/dist/components/flag.css +1 -1
  46. package/dist/components/flag.min.css +1 -1
  47. package/dist/components/flyout.css +1 -1
  48. package/dist/components/flyout.js +1 -1
  49. package/dist/components/flyout.min.css +1 -1
  50. package/dist/components/flyout.min.js +1 -1
  51. package/dist/components/form.css +1 -1
  52. package/dist/components/form.js +1 -1
  53. package/dist/components/form.min.css +1 -1
  54. package/dist/components/form.min.js +1 -1
  55. package/dist/components/grid.css +1 -1
  56. package/dist/components/grid.min.css +1 -1
  57. package/dist/components/header.css +1 -1
  58. package/dist/components/header.min.css +1 -1
  59. package/dist/components/icon.css +1 -1
  60. package/dist/components/icon.min.css +1 -1
  61. package/dist/components/image.css +1 -1
  62. package/dist/components/image.min.css +1 -1
  63. package/dist/components/input.css +1 -1
  64. package/dist/components/input.min.css +1 -1
  65. package/dist/components/item.css +1 -1
  66. package/dist/components/item.min.css +1 -1
  67. package/dist/components/label.css +1 -1
  68. package/dist/components/label.min.css +1 -1
  69. package/dist/components/list.css +1 -1
  70. package/dist/components/list.min.css +1 -1
  71. package/dist/components/loader.css +1 -1
  72. package/dist/components/loader.min.css +1 -1
  73. package/dist/components/menu.css +1 -1
  74. package/dist/components/menu.min.css +1 -1
  75. package/dist/components/message.css +1 -1
  76. package/dist/components/message.min.css +1 -1
  77. package/dist/components/modal.css +1 -1
  78. package/dist/components/modal.js +1 -1
  79. package/dist/components/modal.min.css +1 -1
  80. package/dist/components/modal.min.js +1 -1
  81. package/dist/components/nag.css +1 -1
  82. package/dist/components/nag.js +1 -1
  83. package/dist/components/nag.min.css +1 -1
  84. package/dist/components/nag.min.js +1 -1
  85. package/dist/components/placeholder.css +1 -1
  86. package/dist/components/placeholder.min.css +1 -1
  87. package/dist/components/popup.css +1 -1
  88. package/dist/components/popup.js +1 -1
  89. package/dist/components/popup.min.css +1 -1
  90. package/dist/components/popup.min.js +1 -1
  91. package/dist/components/progress.css +1 -1
  92. package/dist/components/progress.js +1 -1
  93. package/dist/components/progress.min.css +1 -1
  94. package/dist/components/progress.min.js +1 -1
  95. package/dist/components/rail.css +1 -1
  96. package/dist/components/rail.min.css +1 -1
  97. package/dist/components/rating.css +1 -1
  98. package/dist/components/rating.js +1 -1
  99. package/dist/components/rating.min.css +1 -1
  100. package/dist/components/rating.min.js +1 -1
  101. package/dist/components/reset.css +1 -1
  102. package/dist/components/reset.min.css +1 -1
  103. package/dist/components/reveal.css +1 -1
  104. package/dist/components/reveal.min.css +1 -1
  105. package/dist/components/search.css +1 -1
  106. package/dist/components/search.js +1 -1
  107. package/dist/components/search.min.css +1 -1
  108. package/dist/components/search.min.js +1 -1
  109. package/dist/components/segment.css +1 -1
  110. package/dist/components/segment.min.css +1 -1
  111. package/dist/components/shape.css +1 -1
  112. package/dist/components/shape.js +1 -1
  113. package/dist/components/shape.min.css +1 -1
  114. package/dist/components/shape.min.js +1 -1
  115. package/dist/components/sidebar.css +1 -1
  116. package/dist/components/sidebar.js +1 -1
  117. package/dist/components/sidebar.min.css +1 -1
  118. package/dist/components/sidebar.min.js +1 -1
  119. package/dist/components/site.css +1 -1
  120. package/dist/components/site.js +1 -1
  121. package/dist/components/site.min.css +1 -1
  122. package/dist/components/site.min.js +1 -1
  123. package/dist/components/slider.css +1 -1
  124. package/dist/components/slider.js +1 -1
  125. package/dist/components/slider.min.css +1 -1
  126. package/dist/components/slider.min.js +1 -1
  127. package/dist/components/state.js +1 -1
  128. package/dist/components/state.min.js +1 -1
  129. package/dist/components/statistic.css +1 -1
  130. package/dist/components/statistic.min.css +1 -1
  131. package/dist/components/step.css +1 -1
  132. package/dist/components/step.min.css +1 -1
  133. package/dist/components/sticky.css +1 -1
  134. package/dist/components/sticky.js +1 -1
  135. package/dist/components/sticky.min.css +1 -1
  136. package/dist/components/sticky.min.js +1 -1
  137. package/dist/components/tab.css +1 -1
  138. package/dist/components/tab.js +1 -1
  139. package/dist/components/tab.min.css +1 -1
  140. package/dist/components/tab.min.js +1 -1
  141. package/dist/components/table.css +1 -1
  142. package/dist/components/table.min.css +1 -1
  143. package/dist/components/text.css +1 -1
  144. package/dist/components/text.min.css +1 -1
  145. package/dist/components/toast.css +1 -1
  146. package/dist/components/toast.js +1 -1
  147. package/dist/components/toast.min.css +1 -1
  148. package/dist/components/toast.min.js +1 -1
  149. package/dist/components/transition.css +1 -1
  150. package/dist/components/transition.js +1 -1
  151. package/dist/components/transition.min.css +1 -1
  152. package/dist/components/transition.min.js +1 -1
  153. package/dist/components/visibility.js +1 -1
  154. package/dist/components/visibility.min.js +1 -1
  155. package/dist/semantic.css +53 -53
  156. package/dist/semantic.js +26 -26
  157. package/dist/semantic.min.css +1 -1
  158. package/dist/semantic.min.js +1 -1
  159. package/package.json +1 -1
  160. package/types/fomantic-ui-accordion.d.ts +166 -172
  161. package/types/fomantic-ui-api.d.ts +418 -470
  162. package/types/fomantic-ui-calendar.d.ts +425 -479
  163. package/types/fomantic-ui-checkbox.d.ts +148 -194
  164. package/types/fomantic-ui-dimmer.d.ts +188 -265
  165. package/types/fomantic-ui-dropdown.d.ts +447 -666
  166. package/types/fomantic-ui-embed.d.ts +243 -289
  167. package/types/fomantic-ui-flyout.d.ts +259 -292
  168. package/types/fomantic-ui-form.d.ts +478 -607
  169. package/types/fomantic-ui-modal.d.ts +389 -471
  170. package/types/fomantic-ui-nag.d.ts +228 -277
  171. package/types/fomantic-ui-popup.d.ts +438 -534
  172. package/types/fomantic-ui-progress.d.ts +278 -352
  173. package/types/fomantic-ui-rating.d.ts +137 -168
  174. package/types/fomantic-ui-search.d.ts +359 -453
  175. package/types/fomantic-ui-shape.d.ts +152 -194
  176. package/types/fomantic-ui-sidebar.d.ts +315 -391
  177. package/types/fomantic-ui-slider.d.ts +259 -322
  178. package/types/fomantic-ui-sticky.d.ts +198 -244
  179. package/types/fomantic-ui-tab.d.ts +284 -350
  180. package/types/fomantic-ui-tests.ts +4 -2
  181. package/types/fomantic-ui-toast.d.ts +318 -424
  182. package/types/fomantic-ui-transition.d.ts +223 -273
  183. package/types/fomantic-ui-visibility.d.ts +286 -353
  184. package/types/index.d.ts +0 -1
@@ -107,500 +107,448 @@ declare namespace FomanticUI {
107
107
  */
108
108
  (behavior: 'destroy'): JQuery;
109
109
 
110
- <K extends keyof APISettings>(behavior: 'setting', name: K, value?: undefined): APISettings._Impl[K];
111
- <K extends keyof APISettings>(behavior: 'setting', name: K, value: APISettings._Impl[K]): JQuery;
112
- (behavior: 'setting', value: APISettings): JQuery;
113
- (settings?: APISettings): JQuery;
110
+ <K extends keyof AccordionSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<AccordionSettings, keyof AccordionSettings>>;
111
+ <K extends keyof AccordionSettings>(behavior: 'setting', name: K, value: AccordionSettings[K]): JQuery;
112
+ (behavior: 'setting', value: Partial<Pick<AccordionSettings, keyof AccordionSettings>>): JQuery;
113
+ (settings?: Partial<Pick<AccordionSettings, keyof AccordionSettings>>): JQuery;
114
114
  }
115
115
 
116
116
  /**
117
117
  * @see {@link https://fomantic-ui.com/behaviors/api.html#/settings}
118
118
  */
119
- type APISettings = APISettings.Param;
120
-
121
- namespace APISettings {
122
- type Param = (
123
- | Pick<_Impl, 'on'>
124
- | Pick<_Impl, 'cache'>
125
- | Pick<_Impl, 'stateContext'>
126
- | Pick<_Impl, 'encodeParameters'>
127
- | Pick<_Impl, 'defaultData'>
128
- | Pick<_Impl, 'serializeForm'>
129
- | Pick<_Impl, 'throttle'>
130
- | Pick<_Impl, 'throttleFirstRequest'>
131
- | Pick<_Impl, 'interruptRequests'>
132
- | Pick<_Impl, 'loadingDuration'>
133
- | Pick<_Impl, 'hideError'>
134
- | Pick<_Impl, 'errorDuration'>
135
- | Pick<_Impl, 'action'>
136
- | Pick<_Impl, 'url'>
137
- | Pick<_Impl, 'base'>
138
- | Pick<_Impl, 'urlData'>
139
- | Pick<_Impl, 'response'>
140
- | Pick<_Impl, 'responseAsync'>
141
- | Pick<_Impl, 'mockResponse'>
142
- | Pick<_Impl, 'mockResponseAsync'>
143
- | Pick<_Impl, 'rawResponse'>
144
- | Pick<_Impl, 'method'>
145
- | Pick<_Impl, 'dataType'>
146
- | Pick<_Impl, 'data'>
147
- | Pick<_Impl, 'beforeSend'>
148
- | Pick<_Impl, 'beforeXHR'>
149
- | Pick<_Impl, 'onRequest'>
150
- | Pick<_Impl, 'onResponse'>
151
- | Pick<_Impl, 'successTest'>
152
- | Pick<_Impl, 'onSuccess'>
153
- | Pick<_Impl, 'onComplete'>
154
- | Pick<_Impl, 'onFailure'>
155
- | Pick<_Impl, 'onError'>
156
- | Pick<_Impl, 'onAbort'>
157
- | Pick<_Impl, 'selector'>
158
- | Pick<_Impl, 'className'>
159
- | Pick<_Impl, 'regExp'>
160
- | Pick<_Impl, 'metadata'>
161
- | Pick<_Impl, 'name'>
162
- | Pick<_Impl, 'namespace'>
163
- | Pick<_Impl, 'silent'>
164
- | Pick<_Impl, 'debug'>
165
- | Pick<_Impl, 'performance'>
166
- | Pick<_Impl, 'verbose'>
167
- | Pick<_Impl, 'errors'>
168
- ) &
169
- Partial<Pick<_Impl, keyof _Impl>>;
170
-
171
- interface _Impl {
172
- // region API Settings
173
-
174
- /**
175
- * When API event should occur.
176
- * @default 'auto'
177
- */
178
- on: string;
179
-
180
- /**
181
- * Can be set to 'local' to cache successful returned AJAX responses when using a JSON API.
182
- * This helps avoid server roundtrips when API endpoints will return the same results when accessed repeatedly.
183
- * Setting to 'false', will add cache busting parameters to the URL.
184
- * @default true
185
- */
186
- cache: boolean | 'local';
187
-
188
- /**
189
- * UI state will be applied to this element, defaults to triggering element.
190
- * @default this
191
- */
192
- stateContext: string | JQuery;
193
-
194
- /**
195
- * Whether to encode parameters with 'encodeURIComponent' before adding into url string.
196
- * @default true
197
- */
198
- encodeParameters: boolean;
199
-
200
- /**
201
- * Whether to automatically include default data like {value} and {text}.
202
- * @default true
203
- */
204
- defaultData: boolean;
205
-
206
- /**
207
- * Whether to serialize closest form and include in request.
208
- * @default false
209
- */
210
- serializeForm: boolean;
211
-
212
- /**
213
- * How long to wait when a request is made before triggering request, useful for rate limiting 'oninput'.
214
- * @default 0
215
- */
216
- throttle: number;
217
-
218
- /**
219
- * When set to false will not delay the first request made, when no others are queued.
220
- * @default true
221
- */
222
- throttleFirstRequest: boolean;
223
-
224
- /**
225
- * Whether an API request can occur while another request is still pending.
226
- * @default false
227
- */
228
- interruptRequests: boolean;
229
-
230
- /**
231
- * Minimum duration to show loading indication.
232
- * @default 0
233
- */
234
- loadingDuration: number;
235
-
236
- /**
237
- * The default 'auto' will automatically remove error state after error duration, unless the element is a 'form'.
238
- * @default 'auto'
239
- */
240
- hideError: 'auto' | boolean;
241
-
242
- /**
243
- * Setting to 'true', will not remove error. Setting to a duration in milliseconds to show error state after request error.
244
- * @default 2000
245
- */
246
- errorDuration: true | number;
247
-
248
- // endregion
249
-
250
- // region API Settings
251
-
252
- /**
253
- * Named API action for query, originally specified in '$.fn.settings.api'.
254
- * @default false
255
- */
256
- action: string | false;
257
-
258
- /**
259
- * Templated URL for query, will override specified action.
260
- * @default false
261
- */
262
- url: string | false;
263
-
264
- /**
265
- * base URL to apply to all endpoints. Will be prepended to each given url.
266
- * @default ''
267
- */
268
- base: string;
269
-
270
- /**
271
- * Variables to use for replacement.
272
- * @default false
273
- */
274
- urlData: any;
275
-
276
- /**
277
- * Can be set to a Javascript object which will be returned automatically instead of requesting JSON from server.
278
- * @default false
279
- */
280
- response: any;
281
-
282
- /**
283
- * When specified, this function can be used to retrieve content from a server and return it asynchronously instead of a standard AJAX call.
284
- * The callback function should return the server response.
285
- * @default false
286
- */
287
- responseAsync: ((settings: APISettings, callback: (response: any) => void) => void) | false;
288
-
289
- /**
290
- * Alias of 'response'.
291
- * @default false
292
- */
293
- mockResponse: any;
294
-
295
- /**
296
- * Alias of 'responseAsync'.
297
- * @default false
298
- */
299
- mockResponseAsync: ((settings: APISettings, callback: (response: any) => void) => void) | false;
300
-
301
- /**
302
- * If set, the onResponse event handler is able to handle an raw Array Object, which is probably returned by the requested source.
303
- * Even if the datatype is json, it won't be force converted into an object anymore then.
304
- * @default false
305
- */
306
- rawResponse: boolean;
307
-
308
- /**
309
- * Method for transmitting request to server.
310
- * @default 'get'
311
- */
312
- method: 'get' | 'post' | 'put' | 'delete' | 'head' | 'options' | 'patch';
313
-
314
- /**
315
- * Expected data type of response.
316
- * @default 'json'
317
- */
318
- dataType: 'xml' | 'json' | 'jsonp' | 'script' | 'html' | 'text';
319
-
320
- /**
321
- * Expected data type of response.
322
- * @default {}
323
- */
324
- data: any;
325
-
326
- // endregion
327
-
328
- // region Callbacks
329
-
330
- /**
331
- * Allows modifying settings before request, or cancelling request.
332
- */
333
- beforeSend(settings: APISettings): any;
334
-
335
- /**
336
- * Allows modifying XHR object for request.
337
- */
338
- beforeXHR(xhrObject: JQuery.jqXHR): any;
339
-
340
- /**
341
- * Callback that occurs when request is made. Receives both the API success promise and the XHR request promise.
342
- */
343
- onRequest(promise: JQuery.Deferred<any>, xhr: JQuery.jqXHR): void;
344
-
345
- /**
346
- * Allows modifying the server's response before parsed by other callbacks to determine API event success.
347
- */
348
- onResponse(response: any): void;
349
-
350
- /**
351
- * Determines whether completed JSON response should be treated as successful.
352
- *
353
- * @see {@link http://fomantic-ui.com/behaviors/api.html#determining-json-success}
354
- */
355
- successTest(response: any): boolean;
356
-
357
- /**
358
- * Callback after successful response, JSON response must pass 'successTest'.
359
- */
360
- onSuccess(response: any, element: JQuery, xhr: JQuery.jqXHR): void;
361
-
362
- /**
363
- * Callback on request complete regardless of conditions.
364
- */
365
- onComplete(response: any, element: JQuery, xhr: JQuery.jqXHR): void;
366
-
367
- /**
368
- * Callback on failed response, or JSON response that fails 'successTest'.
369
- */
370
- onFailure(response: any, element: JQuery): void;
371
-
372
- /**
373
- * Callback on server error from returned status code, or XHR failure.
374
- */
375
- onError(errorMessage: string, element: JQuery, xhr: JQuery.jqXHR): void;
376
-
377
- /**
378
- * Callback on abort caused by user clicking a link or manually cancelling request.
379
- */
380
- onAbort(errorMessage: string, element: JQuery, xhr: JQuery.jqXHR): void;
381
-
382
- // endregion
383
-
384
- // region DOM Settings
385
-
386
- /**
387
- * Selectors used to find parts of a module.
388
- */
389
- selector: API.SelectorSettings;
390
-
391
- /**
392
- * Class names used to determine element state.
393
- */
394
- className: API.ClassNameSettings;
395
-
396
- /**
397
- * Regular expressions used for template matching.
398
- */
399
- regExp: API.RegExpSettings;
400
-
401
- /**
402
- * Metadata used to store XHR and response promise.
403
- */
404
- metadata: API.MetadataSettings;
405
-
406
- // endregion
407
-
408
- // region Debug Settings
409
-
410
- /**
411
- * Name used in log statements.
412
- */
413
- name: string;
414
-
415
- /**
416
- * Event namespace. Makes sure module teardown does not effect other events attached to an element.
417
- */
418
- namespace: string;
419
-
420
- /**
421
- * Silences all console output including error messages, regardless of other debug settings.
422
- */
423
- silent: boolean;
424
-
425
- /**
426
- * Debug output to console.
427
- */
428
- debug: boolean;
429
-
430
- /**
431
- * Show 'console.table' output with performance metrics.
432
- */
433
- performance: boolean;
434
-
435
- /**
436
- * Debug output includes all internal behaviors.
437
- */
438
- verbose: boolean;
439
-
440
- errors: API.ErrorSettings;
441
-
442
- // endregion
443
- }
119
+ interface APISettings {
120
+ // region API Settings
444
121
 
445
- namespace API {
446
- type SelectorSettings = SelectorSettings.Param;
122
+ /**
123
+ * When API event should occur.
124
+ * @default 'auto'
125
+ */
126
+ on: string;
447
127
 
448
- namespace SelectorSettings {
449
- type Param = (Pick<_Impl, 'disabled'> | Pick<_Impl, 'form'>) & Partial<Pick<_Impl, keyof _Impl>>;
128
+ /**
129
+ * Can be set to 'local' to cache successful returned AJAX responses when using a JSON API.
130
+ * This helps avoid server roundtrips when API endpoints will return the same results when accessed repeatedly.
131
+ * Setting to 'false', will add cache busting parameters to the URL.
132
+ * @default true
133
+ */
134
+ cache: boolean | 'local';
450
135
 
451
- interface _Impl {
452
- /**
453
- * @default '.disabled'
454
- */
455
- disabled: string;
136
+ /**
137
+ * UI state will be applied to this element, defaults to triggering element.
138
+ * @default false
139
+ */
140
+ stateContext: false | JQuery;
456
141
 
457
- /**
458
- * @default 'form'
459
- */
460
- form: string;
461
- }
462
- }
142
+ /**
143
+ * Whether to encode parameters with 'encodeURIComponent' before adding into url string.
144
+ * @default true
145
+ */
146
+ encodeParameters: boolean;
463
147
 
464
- type ClassNameSettings = ClassNameSettings.Param;
148
+ /**
149
+ * Whether to automatically include default data like {value} and {text}.
150
+ * @default true
151
+ */
152
+ defaultData: boolean;
465
153
 
466
- namespace ClassNameSettings {
467
- type Param = (Pick<_Impl, 'loading'> | Pick<_Impl, 'error'>) & Partial<Pick<_Impl, keyof _Impl>>;
154
+ /**
155
+ * Whether to serialize closest form and include in request.
156
+ * Use `true` to convert complex named keys like `a[b][1][c][]` into a nested object
157
+ * Use `formdata` for formdata web api
158
+ * @default false
159
+ */
160
+ serializeForm: boolean;
468
161
 
469
- interface _Impl {
470
- /**
471
- * @default 'loading'
472
- */
473
- loading: string;
162
+ /**
163
+ * How long to wait when a request is made before triggering request, useful for rate limiting 'oninput'.
164
+ * @default 0
165
+ */
166
+ throttle: number;
474
167
 
475
- /**
476
- * @default 'error'
477
- */
478
- error: string;
479
- }
480
- }
168
+ /**
169
+ * When set to false will not delay the first request made, when no others are queued.
170
+ * @default true
171
+ */
172
+ throttleFirstRequest: boolean;
173
+
174
+ /**
175
+ * Whether an API request can occur while another request is still pending.
176
+ * @default false
177
+ */
178
+ interruptRequests: boolean;
179
+
180
+ /**
181
+ * Minimum duration to show loading indication.
182
+ * @default 0
183
+ */
184
+ loadingDuration: number;
185
+
186
+ /**
187
+ * The default 'auto' will automatically remove error state after error duration, unless the element is a 'form'.
188
+ * @default 'auto'
189
+ */
190
+ hideError: 'auto' | boolean;
191
+
192
+ /**
193
+ * Setting to 'true', will not remove error. Setting to a duration in milliseconds to show error state after request error.
194
+ * @default 2000
195
+ */
196
+ errorDuration: true | number;
197
+
198
+ // endregion
199
+
200
+ // region API Settings
201
+
202
+ /**
203
+ * Named API action for query, originally specified in '$.fn.settings.api'.
204
+ * @default false
205
+ */
206
+ action: string | false;
207
+
208
+ /**
209
+ * Templated URL for query, will override specified action.
210
+ * @default false
211
+ */
212
+ url: string | false;
213
+
214
+ /**
215
+ * base URL to apply to all endpoints. Will be prepended to each given url.
216
+ * @default ''
217
+ */
218
+ base: string;
219
+
220
+ /**
221
+ * Variables to use for replacement.
222
+ * @default false
223
+ */
224
+ urlData: any;
225
+
226
+ /**
227
+ * Can be set to a Javascript object which will be returned automatically instead of requesting JSON from server.
228
+ * @default false
229
+ */
230
+ response: any;
231
+
232
+ /**
233
+ * When specified, this function can be used to retrieve content from a server and return it asynchronously instead of a standard AJAX call.
234
+ * The callback function should return the server response.
235
+ * @default false
236
+ */
237
+ responseAsync: ((settings: APISettings, callback: (response: any) => void) => void) | false;
238
+
239
+ /**
240
+ * Alias of 'response'.
241
+ * @default false
242
+ */
243
+ mockResponse: any;
244
+
245
+ /**
246
+ * Alias of 'responseAsync'.
247
+ * @default false
248
+ */
249
+ mockResponseAsync: ((settings: APISettings, callback: (response: any) => void) => void) | false;
250
+
251
+ /**
252
+ * If set, the onResponse event handler is able to handle an raw Array Object, which is probably returned by the requested source.
253
+ * Even if the datatype is json, it won't be force converted into an object anymore then.
254
+ * @default true
255
+ */
256
+ rawResponse: boolean;
257
+
258
+ /**
259
+ * Method for transmitting request to server.
260
+ * @default 'get'
261
+ */
262
+ method: 'get' | 'post' | 'put' | 'delete' | 'head' | 'options' | 'patch';
263
+
264
+ /**
265
+ * Expected data type of response.
266
+ * @default 'json'
267
+ */
268
+ dataType: 'xml' | 'json' | 'jsonp' | 'script' | 'html' | 'text';
269
+
270
+ /**
271
+ * Expected data type of response.
272
+ * @default {}
273
+ */
274
+ data: any;
481
275
 
482
- type RegExpSettings = RegExpSettings.Param;
276
+ // endregion
483
277
 
484
- namespace RegExpSettings {
485
- type Param = (Pick<_Impl, 'required'> | Pick<_Impl, 'optional'>) & Partial<Pick<_Impl, keyof _Impl>>;
278
+ // region Callbacks
486
279
 
487
- interface _Impl {
488
- /**
489
- * @default /\{\$*[A-z0-9]+\}/g
490
- */
491
- required: RegExp;
280
+ /**
281
+ * Allows modifying settings before request, or cancelling request.
282
+ */
283
+ beforeSend(settings: APISettings): any;
284
+
285
+ /**
286
+ * Allows modifying XHR object for request.
287
+ */
288
+ beforeXHR(xhrObject: JQuery.jqXHR): any;
289
+
290
+ /**
291
+ * Callback that occurs when request is made. Receives both the API success promise and the XHR request promise.
292
+ */
293
+ onRequest(promise: JQuery.Deferred<any>, xhr: JQuery.jqXHR): void;
294
+
295
+ /**
296
+ * Allows modifying the server's response before parsed by other callbacks to determine API event success.
297
+ */
298
+ onResponse(response: any): void;
299
+
300
+ /**
301
+ * Determines whether completed JSON response should be treated as successful.
302
+ *
303
+ * @see {@link http://fomantic-ui.com/behaviors/api.html#determining-json-success}
304
+ */
305
+ successTest(response: any): boolean;
492
306
 
493
- /**
494
- * @default /\{\/\$*[A-z0-9]+\}/g
495
- */
496
- optional: RegExp;
497
- }
307
+ /**
308
+ * Callback after successful response, JSON response must pass 'successTest'.
309
+ */
310
+ onSuccess(response: any, element: JQuery, xhr: JQuery.jqXHR): void;
311
+
312
+ /**
313
+ * Callback on request complete regardless of conditions.
314
+ */
315
+ onComplete(response: any, element: JQuery, xhr: JQuery.jqXHR): void;
316
+
317
+ /**
318
+ * Callback on failed response, or JSON response that fails 'successTest'.
319
+ */
320
+ onFailure(response: any, element: JQuery): void;
321
+
322
+ /**
323
+ * Callback on server error from returned status code, or XHR failure.
324
+ */
325
+ onError(errorMessage: string, element: JQuery, xhr: JQuery.jqXHR): void;
326
+
327
+ /**
328
+ * Callback on abort caused by user clicking a link or manually cancelling request.
329
+ */
330
+ onAbort(errorMessage: string, element: JQuery, xhr: JQuery.jqXHR): void;
331
+
332
+ // endregion
333
+
334
+ // region DOM Settings
335
+
336
+ /**
337
+ * Selectors used to find parts of a module.
338
+ */
339
+ selector: API.SelectorSettings;
340
+
341
+ /**
342
+ * Class names used to determine element state.
343
+ */
344
+ className: API.ClassNameSettings;
345
+
346
+ /**
347
+ * Regular expressions used for template matching.
348
+ */
349
+ regExp: API.RegExpSettings;
350
+
351
+ /**
352
+ * Metadata used to store XHR and response promise.
353
+ */
354
+ metadata: API.MetadataSettings;
355
+
356
+ // endregion
357
+
358
+ // region Debug Settings
359
+
360
+ /**
361
+ * Name used in log statements.
362
+ * @default 'API'
363
+ */
364
+ name: string;
365
+
366
+ /**
367
+ * Event namespace. Makes sure module teardown does not effect other events attached to an element.
368
+ * @default 'api'
369
+ */
370
+ namespace: string;
371
+
372
+ /**
373
+ * Silences all console output including error messages, regardless of other debug settings.
374
+ * @default false
375
+ */
376
+ silent: boolean;
377
+
378
+ /**
379
+ * Debug output to console.
380
+ * @default false
381
+ */
382
+ debug: boolean;
383
+
384
+ /**
385
+ * Show 'console.table' output with performance metrics.
386
+ * @default true
387
+ */
388
+ performance: boolean;
389
+
390
+ /**
391
+ * Debug output includes all internal behaviors.
392
+ * @default false
393
+ */
394
+ verbose: boolean;
395
+
396
+ errors: API.ErrorSettings;
397
+
398
+ // endregion
399
+ }
400
+
401
+ namespace API {
402
+ type SelectorSettings = Partial<Pick<Settings.Selectors, keyof Settings.Selectors>>;
403
+ type ClassNameSettings = Partial<Pick<Settings.ClassNames, keyof Settings.ClassNames>>;
404
+ type RegExpSettings = Partial<Pick<Settings.RegExps, keyof Settings.RegExps>>;
405
+ type MetadataSettings = Partial<Pick<Settings.Metadatas, keyof Settings.Metadatas>>;
406
+ type ErrorSettings = Partial<Pick<Settings.Errors, keyof Settings.Errors>>;
407
+
408
+ namespace Settings {
409
+ interface Selectors {
410
+ /**
411
+ * @default '.disabled'
412
+ */
413
+ disabled: string;
414
+
415
+ /**
416
+ * @default 'form'
417
+ */
418
+ form: string;
498
419
  }
499
420
 
500
- type MetadataSettings = MetadataSettings.Param;
421
+ interface ClassNames {
422
+ /**
423
+ * @default 'loading'
424
+ */
425
+ loading: string;
426
+
427
+ /**
428
+ * @default 'error'
429
+ */
430
+ error: string;
431
+ }
501
432
 
502
- namespace MetadataSettings {
503
- type Param = (Pick<_Impl, 'action'> | Pick<_Impl, 'url'>) & Partial<Pick<_Impl, keyof _Impl>>;
433
+ interface RegExps {
434
+ /**
435
+ * @default /{\$*[\da-z]+}/gi
436
+ */
437
+ required: RegExp;
438
+
439
+ /**
440
+ * @default /{\/\$*[\da-z]+}/gi
441
+ */
442
+ optional: RegExp;
443
+
444
+ /**
445
+ * @default /^[_a-z][\w-]*(?:\[[\w-]*])*$/i
446
+ */
447
+ validate: RegExp;
448
+
449
+ /**
450
+ * /[\w-]+|(?=\[])/gi
451
+ */
452
+ key: RegExp;
453
+
454
+ /**
455
+ * @default /^$/
456
+ */
457
+ push: RegExp;
458
+
459
+ /**
460
+ * @default /^\d+$/
461
+ */
462
+ fixed: RegExp;
463
+
464
+ /**
465
+ * @default /^[\w-]+$/i
466
+ */
467
+ named: RegExp;
468
+ }
504
469
 
505
- interface _Impl {
506
- /**
507
- * @default 'action'
508
- */
509
- action: string;
470
+ interface Metadatas {
471
+ /**
472
+ * @default 'action'
473
+ */
474
+ action: string;
510
475
 
511
- /**
512
- * @default 'url'
513
- */
514
- url: string;
515
- }
476
+ /**
477
+ * @default 'url'
478
+ */
479
+ url: string;
516
480
  }
517
481
 
518
- type ErrorSettings = ErrorSettings.Param;
519
-
520
- namespace ErrorSettings {
521
- type Param = (
522
- | Pick<_Impl, 'beforeSend'>
523
- | Pick<_Impl, 'error'>
524
- | Pick<_Impl, 'exitConditions'>
525
- | Pick<_Impl, 'JSONParse'>
526
- | Pick<_Impl, 'legacyParameters'>
527
- | Pick<_Impl, 'missingAction'>
528
- | Pick<_Impl, 'missingSerialize'>
529
- | Pick<_Impl, 'missingURL'>
530
- | Pick<_Impl, 'noReturnedValue'>
531
- | Pick<_Impl, 'parseError'>
532
- | Pick<_Impl, 'requiredParameter'>
533
- | Pick<_Impl, 'statusMessage'>
534
- | Pick<_Impl, 'timeout'>
535
- ) &
536
- Partial<Pick<_Impl, keyof _Impl>>;
537
-
538
- interface _Impl {
539
- /**
540
- * @default 'The before send function has aborted the request.'
541
- */
542
- beforeSend: string;
543
-
544
- /**
545
- * @default 'There was an error with your request.'
546
- */
547
- error: string;
548
-
549
- /**
550
- * @default 'API Request Aborted. Exit conditions met.'
551
- */
552
- exitConditions: string;
553
-
554
- /**
555
- * @default 'JSON could not be parsed during error handling.'
556
- */
557
- JSONParse: string;
558
-
559
- /**
560
- * @default 'You are using legacy API success callback names.'
561
- */
562
- legacyParameters: string;
563
-
564
- /**
565
- * @default 'API action used but no url was defined.'
566
- */
567
- missingAction: string;
568
-
569
- /**
570
- * @default 'Required dependency jquery-serialize-object missing, using basic serialize.'
571
- */
572
- missingSerialize: string;
573
-
574
- /**
575
- * @default 'No URL specified for API event.'
576
- */
577
- missingURL: string;
578
-
579
- /**
580
- * @default 'The beforeSend callback must return a settings object, beforeSend ignored.'
581
- */
582
- noReturnedValue: string;
583
-
584
- /**
585
- * @default 'There was an error with your request.'
586
- */
587
- parseError: string;
588
-
589
- /**
590
- * @default 'Missing a required URL parameter: '
591
- */
592
- requiredParameter: string;
593
-
594
- /**
595
- * @default 'Server gave an error: '
596
- */
597
- statusMessage: string;
598
-
599
- /**
600
- * @default 'Your request timed out.'
601
- */
602
- timeout: string;
603
- }
482
+ interface Errors {
483
+ /**
484
+ * @default 'The before send function has aborted the request.'
485
+ */
486
+ beforeSend: string;
487
+
488
+ /**
489
+ * @default 'There was an error with your request.'
490
+ */
491
+ error: string;
492
+
493
+ /**
494
+ * @default 'API Request Aborted. Exit conditions met.'
495
+ */
496
+ exitConditions: string;
497
+
498
+ /**
499
+ * @default 'JSON could not be parsed during error handling.'
500
+ */
501
+ JSONParse: string;
502
+
503
+ /**
504
+ * @default 'You are using legacy API success callback names.'
505
+ */
506
+ legacyParameters: string;
507
+
508
+ /**
509
+ * @default 'The method you called is not defined.'
510
+ */
511
+ method: string;
512
+
513
+ /**
514
+ * @default 'API action used but no url was defined.'
515
+ */
516
+ missingAction: string;
517
+
518
+ /**
519
+ * @default 'No URL specified for API event.'
520
+ */
521
+ missingURL: string;
522
+
523
+ /**
524
+ * @default 'The beforeSend callback must return a settings object, beforeSend ignored.'
525
+ */
526
+ noReturnedValue: string;
527
+
528
+ /**
529
+ * @default 'There was an error with your request.'
530
+ */
531
+ parseError: string;
532
+
533
+ /**
534
+ * @default 'Caching responses locally requires session storage.'
535
+ */
536
+ noStorage: string;
537
+
538
+ /**
539
+ * @default 'Missing a required URL parameter: '
540
+ */
541
+ requiredParameter: string;
542
+
543
+ /**
544
+ * @default 'Server gave an error: '
545
+ */
546
+ statusMessage: string;
547
+
548
+ /**
549
+ * @default 'Your request timed out.'
550
+ */
551
+ timeout: string;
604
552
  }
605
553
  }
606
554
  }