fomantic-ui 2.9.3-beta.9 → 2.9.4-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.all-contributorsrc +2 -2
- package/.github/FUNDING.yml +1 -1
- package/.github/auto_assign.yml +1 -1
- package/.github/workflows/ci.yml +5 -5
- package/.github/workflows/nightly.yml +1 -1
- package/.github/workflows/release.yml +1 -1
- package/CHANGELOG.md +131 -0
- package/CONTRIBUTORS.md +1 -1
- package/README.md +5 -2
- package/SECURITY.md +2 -1
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +2 -2
- package/dist/components/accordion.min.css +1 -1
- package/dist/components/accordion.min.js +2 -2
- package/dist/components/ad.css +1 -1
- package/dist/components/ad.min.css +1 -1
- package/dist/components/api.js +10 -9
- package/dist/components/api.min.js +2 -2
- package/dist/components/breadcrumb.css +1 -1
- package/dist/components/breadcrumb.min.css +1 -1
- package/dist/components/button.css +2 -2
- package/dist/components/button.min.css +2 -2
- package/dist/components/calendar.css +140 -3
- package/dist/components/calendar.js +2 -2
- package/dist/components/calendar.min.css +2 -2
- package/dist/components/calendar.min.js +2 -2
- package/dist/components/card.css +1 -1
- package/dist/components/card.min.css +1 -1
- package/dist/components/checkbox.css +50 -6
- package/dist/components/checkbox.js +5 -3
- package/dist/components/checkbox.min.css +2 -2
- package/dist/components/checkbox.min.js +2 -2
- package/dist/components/comment.css +6 -1
- package/dist/components/comment.min.css +2 -2
- package/dist/components/container.css +62 -1
- package/dist/components/container.min.css +2 -2
- package/dist/components/dimmer.css +3 -3
- package/dist/components/dimmer.js +2 -2
- package/dist/components/dimmer.min.css +2 -2
- package/dist/components/dimmer.min.js +2 -2
- package/dist/components/divider.css +1 -1
- package/dist/components/divider.min.css +1 -1
- package/dist/components/dropdown.css +101 -25
- package/dist/components/dropdown.js +29 -21
- package/dist/components/dropdown.min.css +2 -2
- package/dist/components/dropdown.min.js +2 -2
- package/dist/components/embed.css +1 -1
- package/dist/components/embed.js +2 -2
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +2 -2
- package/dist/components/emoji.css +697 -249
- package/dist/components/emoji.min.css +2 -2
- package/dist/components/feed.css +486 -5
- package/dist/components/feed.min.css +2 -2
- package/dist/components/flag.css +3 -2
- package/dist/components/flag.min.css +2 -2
- package/dist/components/flyout.css +1 -1
- package/dist/components/flyout.js +2 -33
- package/dist/components/flyout.min.css +1 -1
- package/dist/components/flyout.min.js +2 -2
- package/dist/components/form.css +34 -32
- package/dist/components/form.js +72 -31
- package/dist/components/form.min.css +2 -2
- package/dist/components/form.min.js +2 -2
- package/dist/components/grid.css +107 -107
- package/dist/components/grid.min.css +2 -2
- package/dist/components/header.css +1 -1
- package/dist/components/header.min.css +1 -1
- package/dist/components/icon.css +62 -62
- package/dist/components/icon.min.css +2 -2
- package/dist/components/image.css +1 -1
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +3 -27
- package/dist/components/input.min.css +2 -2
- package/dist/components/item.css +6 -1
- package/dist/components/item.min.css +2 -2
- package/dist/components/label.css +21 -2
- package/dist/components/label.min.css +2 -2
- package/dist/components/list.css +13 -13
- package/dist/components/list.min.css +2 -2
- package/dist/components/loader.css +282 -282
- package/dist/components/loader.min.css +2 -2
- package/dist/components/menu.css +13 -7
- package/dist/components/menu.min.css +2 -2
- package/dist/components/message.css +1 -1
- package/dist/components/message.min.css +1 -1
- package/dist/components/modal.css +5 -1
- package/dist/components/modal.js +3 -3
- package/dist/components/modal.min.css +2 -2
- package/dist/components/modal.min.js +2 -2
- package/dist/components/nag.css +1 -1
- package/dist/components/nag.js +3 -3
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +2 -2
- package/dist/components/placeholder.css +1 -1
- package/dist/components/placeholder.min.css +1 -1
- package/dist/components/popup.css +3 -3
- package/dist/components/popup.js +11 -9
- package/dist/components/popup.min.css +2 -2
- package/dist/components/popup.min.js +2 -2
- package/dist/components/progress.css +1 -1
- package/dist/components/progress.js +2 -2
- package/dist/components/progress.min.css +1 -1
- package/dist/components/progress.min.js +2 -2
- package/dist/components/rail.css +1 -1
- package/dist/components/rail.min.css +1 -1
- package/dist/components/rating.css +1 -1
- package/dist/components/rating.js +2 -2
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +2 -2
- package/dist/components/reset.css +1 -1
- package/dist/components/reset.min.css +1 -1
- package/dist/components/reveal.css +1 -1
- package/dist/components/reveal.min.css +1 -1
- package/dist/components/search.css +26 -1
- package/dist/components/search.js +5 -4
- package/dist/components/search.min.css +2 -2
- package/dist/components/search.min.js +2 -2
- package/dist/components/segment.css +159 -33
- package/dist/components/segment.min.css +2 -2
- package/dist/components/shape.css +1 -1
- package/dist/components/shape.js +2 -2
- package/dist/components/shape.min.css +1 -1
- package/dist/components/shape.min.js +2 -2
- package/dist/components/sidebar.css +1 -1
- package/dist/components/sidebar.js +2 -32
- package/dist/components/sidebar.min.css +1 -1
- package/dist/components/sidebar.min.js +2 -2
- package/dist/components/site.css +1 -1
- package/dist/components/site.js +2 -2
- package/dist/components/site.min.css +1 -1
- package/dist/components/site.min.js +2 -2
- package/dist/components/slider.css +1 -1
- package/dist/components/slider.js +126 -26
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +2 -2
- package/dist/components/state.js +2 -2
- package/dist/components/state.min.js +2 -2
- package/dist/components/statistic.css +1 -1
- package/dist/components/statistic.min.css +1 -1
- package/dist/components/step.css +1 -1
- package/dist/components/step.min.css +1 -1
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +2 -2
- package/dist/components/sticky.min.css +1 -1
- package/dist/components/sticky.min.js +2 -2
- package/dist/components/tab.css +1 -1
- package/dist/components/tab.js +6 -4
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +2 -2
- package/dist/components/table.css +65 -1
- package/dist/components/table.min.css +2 -2
- package/dist/components/text.css +1 -1
- package/dist/components/text.min.css +1 -1
- package/dist/components/toast.css +6 -1
- package/dist/components/toast.js +2 -2
- package/dist/components/toast.min.css +2 -2
- package/dist/components/toast.min.js +2 -2
- package/dist/components/transition.css +1 -1
- package/dist/components/transition.js +3 -3
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +2 -2
- package/dist/components/visibility.js +2 -2
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +2822 -954
- package/dist/semantic.js +302 -206
- package/dist/semantic.min.css +2 -2
- package/dist/semantic.min.js +2 -2
- package/package.json +4 -3
- package/scripts/nightly-version.js +2 -2
- package/src/definitions/behaviors/api.js +9 -8
- package/src/definitions/behaviors/form.js +71 -30
- package/src/definitions/behaviors/state.js +1 -1
- package/src/definitions/behaviors/visibility.js +1 -1
- package/src/definitions/collections/form.less +9 -14
- package/src/definitions/collections/grid.less +106 -106
- package/src/definitions/collections/menu.less +29 -22
- package/src/definitions/collections/table.less +66 -0
- package/src/definitions/elements/button.less +1 -1
- package/src/definitions/elements/container.less +63 -0
- package/src/definitions/elements/icon.less +5 -5
- package/src/definitions/elements/input.less +2 -2
- package/src/definitions/elements/label.less +21 -1
- package/src/definitions/elements/list.less +13 -13
- package/src/definitions/elements/loader.less +71 -71
- package/src/definitions/elements/segment.less +110 -13
- package/src/definitions/globals/site.js +1 -1
- package/src/definitions/modules/accordion.js +1 -1
- package/src/definitions/modules/calendar.js +1 -1
- package/src/definitions/modules/calendar.less +40 -11
- package/src/definitions/modules/checkbox.js +4 -2
- package/src/definitions/modules/checkbox.less +61 -5
- package/src/definitions/modules/dimmer.js +1 -1
- package/src/definitions/modules/dimmer.less +2 -2
- package/src/definitions/modules/dropdown.js +28 -20
- package/src/definitions/modules/dropdown.less +124 -21
- package/src/definitions/modules/embed.js +1 -1
- package/src/definitions/modules/flyout.js +1 -32
- package/src/definitions/modules/modal.js +2 -2
- package/src/definitions/modules/modal.less +6 -0
- package/src/definitions/modules/nag.js +2 -2
- package/src/definitions/modules/popup.js +10 -8
- package/src/definitions/modules/popup.less +4 -4
- package/src/definitions/modules/progress.js +1 -1
- package/src/definitions/modules/rating.js +1 -1
- package/src/definitions/modules/search.js +4 -3
- package/src/definitions/modules/search.less +31 -0
- package/src/definitions/modules/shape.js +1 -1
- package/src/definitions/modules/sidebar.js +1 -31
- package/src/definitions/modules/slider.js +125 -25
- package/src/definitions/modules/sticky.js +1 -1
- package/src/definitions/modules/tab.js +5 -3
- package/src/definitions/modules/toast.js +1 -1
- package/src/definitions/modules/toast.less +7 -0
- package/src/definitions/modules/transition.js +2 -2
- package/src/definitions/views/comment.less +7 -0
- package/src/definitions/views/feed.less +238 -32
- package/src/definitions/views/item.less +7 -0
- package/src/theme.less +1 -1
- package/src/themes/amazon/elements/button.variables +5 -1
- package/src/themes/bootstrap3/elements/button.variables +5 -1
- package/src/themes/chubby/elements/header.variables +6 -1
- package/src/themes/default/collections/message.variables +3 -9
- package/src/themes/default/collections/table.variables +11 -8
- package/src/themes/default/elements/button.variables +8 -10
- package/src/themes/default/elements/container.variables +3 -0
- package/src/themes/default/elements/emoji.variables +179 -67
- package/src/themes/default/elements/flag.variables +1 -1
- package/src/themes/default/elements/label.variables +6 -1
- package/src/themes/default/elements/segment.variables +8 -0
- package/src/themes/default/globals/site.variables +362 -341
- package/src/themes/default/globals/variation.variables +24 -1
- package/src/themes/default/modules/calendar.variables +11 -0
- package/src/themes/default/modules/checkbox.variables +12 -0
- package/src/themes/default/modules/dropdown.variables +10 -4
- package/src/themes/default/modules/modal.variables +3 -0
- package/src/themes/default/modules/popup.variables +1 -1
- package/src/themes/default/modules/search.variables +3 -0
- package/src/themes/default/modules/toast.variables +6 -5
- package/src/themes/default/views/card.variables +4 -12
- package/src/themes/default/views/feed.variables +55 -1
- package/src/themes/default/views/item.variables +5 -5
- package/src/themes/flat/collections/form.variables +4 -4
- package/src/themes/flat/globals/site.variables +1 -1
- package/src/themes/github/elements/button.variables +5 -1
- package/src/themes/joypixels/elements/emoji.variables +182 -70
- package/src/themes/material/globals/site.variables +1 -1
- package/src/themes/twitter/elements/button.variables +5 -1
- package/src/themes/twitter/elements/emoji.variables +178 -66
- package/tasks/admin/components/create.js +1 -2
- package/tasks/admin/components/init.js +3 -4
- package/tasks/admin/components/update.js +2 -3
- package/tasks/admin/distributions/create.js +9 -5
- package/tasks/admin/distributions/init.js +3 -4
- package/tasks/admin/distributions/update.js +2 -3
- package/tasks/config/project/install.js +3 -0
- package/tasks/config/tasks.js +1 -8
- package/tasks/config/user.js +1 -1
- package/tasks/docs/build.js +2 -2
- package/tasks/docs/metadata.js +1 -1
- package/tasks/docs/serve.js +1 -1
- package/tasks/install.js +19 -10
- package/tasks/watch.js +1 -2
- package/types/fomantic-ui-accordion.d.ts +244 -0
- package/types/fomantic-ui-api.d.ts +555 -0
- package/types/fomantic-ui-calendar.d.ts +766 -0
- package/types/fomantic-ui-checkbox.d.ts +332 -0
- package/types/fomantic-ui-dimmer.d.ts +408 -0
- package/types/fomantic-ui-dropdown.d.ts +1183 -0
- package/types/fomantic-ui-embed.d.ts +326 -0
- package/types/fomantic-ui-flyout.d.ts +525 -0
- package/types/fomantic-ui-form.d.ts +651 -0
- package/types/fomantic-ui-modal.d.ts +471 -0
- package/types/fomantic-ui-nag.d.ts +270 -0
- package/types/fomantic-ui-popup.d.ts +523 -0
- package/types/fomantic-ui-progress.d.ts +459 -0
- package/types/fomantic-ui-rating.d.ts +187 -0
- package/types/fomantic-ui-search.d.ts +496 -0
- package/types/fomantic-ui-shape.d.ts +274 -0
- package/types/fomantic-ui-sidebar.d.ts +402 -0
- package/types/fomantic-ui-slider.d.ts +316 -0
- package/types/fomantic-ui-sticky.d.ts +215 -0
- package/types/fomantic-ui-tab.d.ts +361 -0
- package/types/fomantic-ui-tests.ts +25 -0
- package/types/fomantic-ui-toast.d.ts +514 -0
- package/types/fomantic-ui-transition.d.ts +355 -0
- package/types/fomantic-ui-visibility.d.ts +355 -0
- package/types/index.d.ts +63 -0
- package/types/tsconfig.json +23 -0
- package/types/tslint.json +1 -0
@@ -0,0 +1,555 @@
|
|
1
|
+
declare namespace FomanticUI {
|
2
|
+
interface API {
|
3
|
+
settings: APISettings;
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Execute query using existing API settings.
|
7
|
+
*/
|
8
|
+
(behavior: 'query'): JQuery;
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Adds data to existing templated url and returns full url string.
|
12
|
+
*/
|
13
|
+
(behavior: 'add url data', url: string, data: any): JQuery;
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Gets promise for current API request.
|
17
|
+
*/
|
18
|
+
(behavior: 'get request'): JQuery;
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Aborts current API request.
|
22
|
+
*/
|
23
|
+
(behavior: 'abort'): JQuery;
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Returns whether last request was cancelled.
|
27
|
+
*/
|
28
|
+
(behavior: 'was cancelled'): boolean;
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Returns whether last request was failure.
|
32
|
+
*/
|
33
|
+
(behavior: 'was failure'): boolean;
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Returns whether last request was successful.
|
37
|
+
*/
|
38
|
+
(behavior: 'was successful'): boolean;
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Returns whether last request was completed.
|
42
|
+
*/
|
43
|
+
(behavior: 'was complete'): boolean;
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Returns whether element is disabled.
|
47
|
+
*/
|
48
|
+
(behavior: 'is disabled'): boolean;
|
49
|
+
|
50
|
+
/**
|
51
|
+
* Returns whether element response is mocked.
|
52
|
+
*/
|
53
|
+
(behavior: 'is mocked'): boolean;
|
54
|
+
|
55
|
+
/**
|
56
|
+
* Returns whether element is loading.
|
57
|
+
*/
|
58
|
+
(behavior: 'is loading'): boolean;
|
59
|
+
|
60
|
+
/**
|
61
|
+
* Sets loading state to element.
|
62
|
+
*/
|
63
|
+
(behavior: 'set loading'): void;
|
64
|
+
|
65
|
+
/**
|
66
|
+
* Sets error state to element.
|
67
|
+
*/
|
68
|
+
(behavior: 'set error'): void;
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Removes loading state to element.
|
72
|
+
*/
|
73
|
+
(behavior: 'remove loading'): void;
|
74
|
+
|
75
|
+
/**
|
76
|
+
* Removes error state to element.
|
77
|
+
*/
|
78
|
+
(behavior: 'remove error'): void;
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Gets event that API request will occur on.
|
82
|
+
*/
|
83
|
+
(behavior: 'get event'): string;
|
84
|
+
|
85
|
+
/**
|
86
|
+
* Returns 'encodeURIComponent' value only if value passed is not already encoded.
|
87
|
+
*/
|
88
|
+
(behavior: 'get url encoded value', value: any): string;
|
89
|
+
|
90
|
+
/**
|
91
|
+
* Reads a locally cached response for a URL.
|
92
|
+
*/
|
93
|
+
(behavior: 'read cached response', url: string): any;
|
94
|
+
|
95
|
+
/**
|
96
|
+
* Writes a cached response for a URL.
|
97
|
+
*/
|
98
|
+
(behavior: 'write cached response', url: string, response: any): void;
|
99
|
+
|
100
|
+
/**
|
101
|
+
* Creates new cache, removing all locally cached URLs.
|
102
|
+
*/
|
103
|
+
(behavior: 'create cache'): void;
|
104
|
+
|
105
|
+
/**
|
106
|
+
* Removes API settings from the page and all events.
|
107
|
+
*/
|
108
|
+
(behavior: 'destroy'): JQuery;
|
109
|
+
|
110
|
+
<K extends keyof APISettings | JQueryAjaxSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<APISettings, keyof APISettings>> | Partial<Pick<JQueryAjaxSettings, keyof JQueryAjaxSettings>>;
|
111
|
+
<K extends keyof APISettings>(behavior: 'setting', name: K, value: APISettings[K]): JQuery;
|
112
|
+
(behavior: 'setting', value: Partial<Pick<APISettings, keyof APISettings>> | Partial<Pick<JQueryAjaxSettings, keyof JQueryAjaxSettings>>): JQuery;
|
113
|
+
(settings?: Partial<Pick<APISettings, keyof APISettings>> | Partial<Pick<JQueryAjaxSettings, keyof JQueryAjaxSettings>>): JQuery;
|
114
|
+
}
|
115
|
+
|
116
|
+
/**
|
117
|
+
* @see {@link https://fomantic-ui.com/behaviors/api.html#/settings}
|
118
|
+
*/
|
119
|
+
interface APISettings {
|
120
|
+
// region API Settings
|
121
|
+
|
122
|
+
/**
|
123
|
+
* When API event should occur.
|
124
|
+
* @default 'auto'
|
125
|
+
*/
|
126
|
+
on: string;
|
127
|
+
|
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';
|
135
|
+
|
136
|
+
/**
|
137
|
+
* UI state will be applied to this element, defaults to triggering element.
|
138
|
+
* @default false
|
139
|
+
*/
|
140
|
+
stateContext: false | JQuery;
|
141
|
+
|
142
|
+
/**
|
143
|
+
* Whether to encode parameters with 'encodeURIComponent' before adding into url string.
|
144
|
+
* @default true
|
145
|
+
*/
|
146
|
+
encodeParameters: boolean;
|
147
|
+
|
148
|
+
/**
|
149
|
+
* Whether to automatically include default data like {value} and {text}.
|
150
|
+
* @default true
|
151
|
+
*/
|
152
|
+
defaultData: boolean;
|
153
|
+
|
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;
|
161
|
+
|
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;
|
167
|
+
|
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;
|
275
|
+
|
276
|
+
// endregion
|
277
|
+
|
278
|
+
// region Callbacks
|
279
|
+
|
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;
|
306
|
+
|
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;
|
419
|
+
}
|
420
|
+
|
421
|
+
interface ClassNames {
|
422
|
+
/**
|
423
|
+
* @default 'loading'
|
424
|
+
*/
|
425
|
+
loading: string;
|
426
|
+
|
427
|
+
/**
|
428
|
+
* @default 'error'
|
429
|
+
*/
|
430
|
+
error: string;
|
431
|
+
}
|
432
|
+
|
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
|
+
}
|
469
|
+
|
470
|
+
interface Metadatas {
|
471
|
+
/**
|
472
|
+
* @default 'action'
|
473
|
+
*/
|
474
|
+
action: string;
|
475
|
+
|
476
|
+
/**
|
477
|
+
* @default 'url'
|
478
|
+
*/
|
479
|
+
url: string;
|
480
|
+
}
|
481
|
+
|
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;
|
552
|
+
}
|
553
|
+
}
|
554
|
+
}
|
555
|
+
}
|