1 | declare namespace FomanticUI {
|
2 | interface Shape {
|
3 | settings: ShapeSettings;
|
4 |
|
5 | /**
|
6 | * Flips the shape upward.
|
7 | */
|
8 | (behavior: 'flip up'): JQuery;
|
9 |
|
10 | /**
|
11 | * Flips the shape downward.
|
12 | */
|
13 | (behavior: 'flip down'): JQuery;
|
14 |
|
15 | /**
|
16 | * Flips the shape right.
|
17 | */
|
18 | (behavior: 'flip right'): JQuery;
|
19 |
|
20 | /**
|
21 | * Flips the shape left.
|
22 | */
|
23 | (behavior: 'flip left'): JQuery;
|
24 |
|
25 | /**
|
26 | * Flips the shape over clock-wise.
|
27 | */
|
28 | (behavior: 'flip over'): JQuery;
|
29 |
|
30 | /**
|
31 | * Flips the shape over counter-clockwise.
|
32 | */
|
33 | (behavior: 'flip back'): JQuery;
|
34 |
|
35 | /**
|
36 | * Set the next side to a specific selector.
|
37 | */
|
38 | (behavior: 'set next side', selector: string): JQuery;
|
39 |
|
40 | /**
|
41 | * Returns whether shape is currently animating.
|
42 | */
|
43 | (behavior: 'is animating'): boolean;
|
44 |
|
45 | /**
|
46 | * Removes all inline styles.
|
47 | */
|
48 | (behavior: 'reset'): JQuery;
|
49 |
|
50 | /**
|
51 | * Queues an animation after current animation.
|
52 | */
|
53 | (behavior: 'queue', animation: string): JQuery;
|
54 |
|
55 | /**
|
56 | * Forces a reflow on element.
|
57 | */
|
58 | (behavior: 'repaint', animation: string): JQuery;
|
59 |
|
60 | /**
|
61 | * Set the next side to next sibling to active element.
|
62 | */
|
63 | (behavior: 'set default side'): JQuery;
|
64 |
|
65 | /**
|
66 | * Sets shape to the content size of the next side.
|
67 | */
|
68 | (behavior: 'set stage size'): JQuery;
|
69 |
|
70 | /**
|
71 | * Refreshes the selector cache for element sides.
|
72 | */
|
73 | (behavior: 'refresh'): JQuery;
|
74 |
|
75 | /**
|
76 | * Returns translation for next side staged below.
|
77 | */
|
78 | (behavior: 'get transform down'): object;
|
79 |
|
80 | /**
|
81 | * Returns translation for next side staged left.
|
82 | */
|
83 | (behavior: 'get transform left'): object;
|
84 |
|
85 | /**
|
86 | * Returns translation for next side staged right.
|
87 | */
|
88 | (behavior: 'get transform right'): object;
|
89 |
|
90 | /**
|
91 | * Returns translation for next side staged up.
|
92 | */
|
93 | (behavior: 'get transform up'): object;
|
94 |
|
95 | /**
|
96 | * Returns translation for next side staged down.
|
97 | */
|
98 | (behavior: 'get transform down'): object;
|
99 |
|
100 | /**
|
101 | * Destroys instance and removes all events.
|
102 | */
|
103 | (behavior: 'destroy'): JQuery;
|
104 |
|
105 | <K extends keyof ShapeSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<ShapeSettings, keyof ShapeSettings>>;
|
106 | <K extends keyof ShapeSettings>(behavior: 'setting', name: K, value: ShapeSettings[K]): JQuery;
|
107 | (behavior: 'setting', value: Partial<Pick<ShapeSettings, keyof ShapeSettings>>): JQuery;
|
108 | (settings?: Partial<Pick<ShapeSettings, keyof ShapeSettings>>): JQuery;
|
109 | }
|
110 |
|
111 | /**
|
112 | * @see {@link https://fomantic-ui.com/modules/shape.html#/settings}
|
113 | */
|
114 | interface ShapeSettings {
|
115 | // region Shape Settings
|
116 |
|
117 | /**
|
118 | * Duration of side change animation.
|
119 | * @default false
|
120 | */
|
121 | duration: false | string;
|
122 |
|
123 | /**
|
124 | * Width during animation, can be set to 'auto', 'initial', 'next' or pixel amount.
|
125 | * @default 'initial'
|
126 | */
|
127 | width: 'auto' | 'initial' | 'next' | number;
|
128 |
|
129 | /**
|
130 | * Height during animation, can be set to 'auto', 'initial', 'next' or pixel amount.
|
131 | * @default 'initial'
|
132 | */
|
133 | height: 'auto' | 'initial' | 'next' | number;
|
134 |
|
135 | /**
|
136 | * Fudge factor in pixels when swapping from 2d to 3d (can be useful to correct rounding errors).
|
137 | * @default 0
|
138 | */
|
139 | jitter: number;
|
140 |
|
141 | /**
|
142 | * Allow animation to same side.
|
143 | * @default false
|
144 | */
|
145 | allowRepeats: boolean;
|
146 |
|
147 | // endregion
|
148 |
|
149 | // region Callbacks
|
150 |
|
151 | /**
|
152 | * Is called before side change.
|
153 | */
|
154 | onBeforeChange(this: JQuery): void;
|
155 |
|
156 | /**
|
157 | * Is called after visible side change.
|
158 | */
|
159 | onChange(this: JQuery): void;
|
160 |
|
161 | // endregion
|
162 |
|
163 | // region DOM Settings
|
164 |
|
165 | /**
|
166 | * DOM Selectors used internally.
|
167 | * Selectors used to find parts of a module.
|
168 | */
|
169 | selector: Shape.SelectorSettings;
|
170 |
|
171 | /**
|
172 | * Class names used to determine element state.
|
173 | */
|
174 | className: Shape.ClassNameSettings;
|
175 |
|
176 | // endregion
|
177 |
|
178 | // region Debug Settings
|
179 |
|
180 | /**
|
181 | * Name used in log statements
|
182 | * @default 'Shape'
|
183 | */
|
184 | name: string;
|
185 |
|
186 | /**
|
187 | * Event namespace. Makes sure module teardown does not effect other events attached to an element.
|
188 | * @default 'shape'
|
189 | */
|
190 | namespace: string;
|
191 |
|
192 | /**
|
193 | * Silences all console output including error messages, regardless of other debug settings.
|
194 | * @default false
|
195 | */
|
196 | silent: boolean;
|
197 |
|
198 | /**
|
199 | * Debug output to console
|
200 | * @default false
|
201 | */
|
202 | debug: boolean;
|
203 |
|
204 | /**
|
205 | * Show console.table output with performance metrics
|
206 | * @default true
|
207 | */
|
208 | performance: boolean;
|
209 |
|
210 | /**
|
211 | * Debug output includes all internal behaviors
|
212 | * @default false
|
213 | */
|
214 | verbose: boolean;
|
215 |
|
216 | error: Shape.ErrorSettings;
|
217 |
|
218 | // endregion
|
219 | }
|
220 |
|
221 | namespace Shape {
|
222 | type SelectorSettings = Partial<Pick<Settings.Selectors, keyof Settings.Selectors>>;
|
223 | type ClassNameSettings = Partial<Pick<Settings.ClassNames, keyof Settings.ClassNames>>;
|
224 | type ErrorSettings = Partial<Pick<Settings.Errors, keyof Settings.Errors>>;
|
225 |
|
226 | namespace Settings {
|
227 | interface Selectors {
|
228 | /**
|
229 | * @default '.sides'
|
230 | */
|
231 | sides: string;
|
232 |
|
233 | /**
|
234 | * @default '.side'
|
235 | */
|
236 | side: string;
|
237 | }
|
238 |
|
239 | interface ClassNames {
|
240 | /**
|
241 | * @default 'animating'
|
242 | */
|
243 | animating: string;
|
244 |
|
245 | /**
|
246 | * @default 'hidden'
|
247 | */
|
248 | hidden: string;
|
249 |
|
250 | /**
|
251 | * @default 'loading'
|
252 | */
|
253 | loading: string;
|
254 |
|
255 | /**
|
256 | * @default 'active'
|
257 | */
|
258 | active: string;
|
259 | }
|
260 |
|
261 | interface Errors {
|
262 | /**
|
263 | * @default 'You tried to switch to a side that does not exist.'
|
264 | */
|
265 | side: string;
|
266 |
|
267 | /**
|
268 | * @default 'The method you called is not defined'
|
269 | */
|
270 | method: string;
|
271 | }
|
272 | }
|
273 | }
|
274 | }
|