@opentech0/js-helpers 1.0.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/.editorconfig ADDED
@@ -0,0 +1,534 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ indent_size = 4
7
+ indent_style = space
8
+ insert_final_newline = false
9
+ max_line_length = 140
10
+ tab_width = 4
11
+ ij_continuation_indent_size = 8
12
+ ij_formatter_off_tag = @formatter:off
13
+ ij_formatter_on_tag = @formatter:on
14
+ ij_formatter_tags_enabled = true
15
+ ij_smart_tabs = false
16
+ ij_visual_guides = none
17
+ ij_wrap_on_typing = true
18
+
19
+ [*.yml]
20
+ indent_size = 2
21
+ tab_width = 2
22
+
23
+ [*.js]
24
+ indent_size = 2
25
+ tab_width = 2
26
+
27
+ [*.json]
28
+ indent_size = 2
29
+ tab_width = 2
30
+
31
+ [*rc]
32
+ indent_size = 2
33
+ tab_width = 2
34
+
35
+ [*.neon]
36
+ indent_size = 2
37
+ tab_width = 2
38
+
39
+ [*.css]
40
+ ij_css_align_closing_brace_with_properties = false
41
+ ij_css_blank_lines_around_nested_selector = 1
42
+ ij_css_blank_lines_between_blocks = 1
43
+ ij_css_brace_placement = end_of_line
44
+ ij_css_enforce_quotes_on_format = false
45
+ ij_scss_hex_color_long_format = false
46
+ ij_scss_hex_color_lower_case = true
47
+ ij_scss_hex_color_short_format = true
48
+ ij_scss_hex_color_upper_case = false
49
+ ij_css_keep_blank_lines_in_code = 2
50
+ ij_css_keep_indents_on_empty_lines = false
51
+ ij_css_keep_single_line_blocks = false
52
+ ij_css_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow
53
+ ij_css_space_after_colon = true
54
+ ij_css_space_before_opening_brace = true
55
+ ij_css_use_double_quotes = true
56
+ ij_css_value_alignment = do_not_align
57
+
58
+ [*.sass]
59
+ indent_size = 2
60
+ ij_sass_align_closing_brace_with_properties = false
61
+ ij_sass_blank_lines_around_nested_selector = 1
62
+ ij_sass_blank_lines_between_blocks = 1
63
+ ij_sass_brace_placement = 0
64
+ ij_sass_enforce_quotes_on_format = false
65
+ ij_scss_hex_color_long_format = false
66
+ ij_scss_hex_color_lower_case = true
67
+ ij_scss_hex_color_short_format = true
68
+ ij_scss_hex_color_upper_case = false
69
+ ij_sass_keep_blank_lines_in_code = 2
70
+ ij_sass_keep_indents_on_empty_lines = false
71
+ ij_sass_keep_single_line_blocks = false
72
+ ij_sass_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow
73
+ ij_sass_space_after_colon = true
74
+ ij_sass_space_before_opening_brace = true
75
+ ij_sass_use_double_quotes = true
76
+ ij_sass_value_alignment = 0
77
+
78
+ [*.scss]
79
+ indent_size = 2
80
+ ij_scss_align_closing_brace_with_properties = false
81
+ ij_scss_blank_lines_around_nested_selector = 1
82
+ ij_scss_blank_lines_between_blocks = 0
83
+ ij_scss_brace_placement = 0
84
+ ij_scss_enforce_quotes_on_format = false
85
+ ij_scss_hex_color_long_format = false
86
+ ij_scss_hex_color_lower_case = true
87
+ ij_scss_hex_color_short_format = true
88
+ ij_scss_hex_color_upper_case = false
89
+ ij_scss_keep_blank_lines_in_code = 1
90
+ ij_scss_keep_indents_on_empty_lines = false
91
+ ij_scss_keep_single_line_blocks = false
92
+ ij_scss_properties_order = --(.*), grid-area, grid-column, grid-row, content, display, flex-direction, flex-wrap, flex-flow, align-items, align-content, justify-content, order, align-self, flex-grow, flex-shrink, flex-basis, flex, grid-template-areas, grid-template-columns, grid-template-rows, grid-auto-columns, grid-auto-rows, grid-auto-flow, grid-gap, grid-column-gap, grid-row-gap, width, min-width, max-width, height, min-height, max-height, position, z-index, top, right, bottom, left, float, clear, cursor, opacity, overflow, clip, font-family, font-size, color, font-weight, line-height, letter-spacing, text-align, text-transform, word-spacing, margin, margin-top, margin-right, margin-bottom, margin-left, border, border-radius, box-sizing, padding, padding-top, padding-right, padding-bottom, padding-left, background, background-image, background-size, background-position, background-repeat, background-clip, background-origin, background-attachment, background-color, box-shadow, outline, user-select, animation, transition
93
+ ij_scss_space_after_colon = true
94
+ ij_scss_space_before_opening_brace = true
95
+ ij_scss_use_double_quotes = false
96
+ ij_scss_value_alignment = 0
97
+
98
+ [.editorconfig]
99
+ ij_editorconfig_align_group_field_declarations = false
100
+ ij_editorconfig_space_after_colon = false
101
+ ij_editorconfig_space_after_comma = true
102
+ ij_editorconfig_space_before_colon = false
103
+ ij_editorconfig_space_before_comma = false
104
+ ij_editorconfig_spaces_around_assignment_operators = true
105
+
106
+ [{*.cjs,*.js}]
107
+ max_line_length = 160
108
+ ij_continuation_indent_size = 2
109
+ ij_smart_tabs = true
110
+ ij_javascript_align_imports = false
111
+ ij_javascript_align_multiline_array_initializer_expression = true
112
+ ij_javascript_align_multiline_binary_operation = true
113
+ ij_javascript_align_multiline_chained_methods = false
114
+ ij_javascript_align_multiline_extends_list = true
115
+ ij_javascript_align_multiline_for = false
116
+ ij_javascript_align_multiline_parameters = true
117
+ ij_javascript_align_multiline_parameters_in_calls = false
118
+ ij_javascript_align_multiline_ternary_operation = true
119
+ ij_javascript_align_object_properties = 0
120
+ ij_javascript_align_union_types = false
121
+ ij_javascript_align_var_statements = 1
122
+ ij_javascript_array_initializer_new_line_after_left_brace = true
123
+ ij_javascript_array_initializer_right_brace_on_new_line = true
124
+ ij_javascript_array_initializer_wrap = on_every_item
125
+ ij_javascript_assignment_wrap = off
126
+ ij_javascript_binary_operation_sign_on_next_line = true
127
+ ij_javascript_binary_operation_wrap = on_every_item
128
+ ij_javascript_blacklist_imports = rxjs/Rx, node_modules/**, **/node_modules/**, @angular/material, @angular/material/typings/**
129
+ ij_javascript_blank_lines_after_imports = 1
130
+ ij_javascript_blank_lines_around_class = 1
131
+ ij_javascript_blank_lines_around_field = 0
132
+ ij_javascript_blank_lines_around_function = 1
133
+ ij_javascript_blank_lines_around_method = 1
134
+ ij_javascript_block_brace_style = end_of_line
135
+ ij_javascript_call_parameters_new_line_after_left_paren = true
136
+ ij_javascript_call_parameters_right_paren_on_new_line = true
137
+ ij_javascript_call_parameters_wrap = on_every_item
138
+ ij_javascript_catch_on_new_line = false
139
+ ij_javascript_chained_call_dot_on_new_line = true
140
+ ij_javascript_class_brace_style = end_of_line
141
+ ij_javascript_comma_on_new_line = false
142
+ ij_javascript_do_while_brace_force = never
143
+ ij_javascript_else_on_new_line = false
144
+ ij_javascript_enforce_trailing_comma = remove
145
+ ij_javascript_extends_keyword_wrap = normal
146
+ ij_javascript_extends_list_wrap = on_every_item
147
+ ij_javascript_field_prefix = _
148
+ ij_javascript_file_name_style = camel_case
149
+ ij_javascript_finally_on_new_line = false
150
+ ij_javascript_for_brace_force = never
151
+ ij_javascript_for_statement_new_line_after_left_paren = false
152
+ ij_javascript_for_statement_right_paren_on_new_line = false
153
+ ij_javascript_for_statement_wrap = off
154
+ ij_javascript_force_quote_style = false
155
+ ij_javascript_force_semicolon_style = true
156
+ ij_javascript_function_expression_brace_style = end_of_line
157
+ ij_javascript_if_brace_force = never
158
+ ij_javascript_import_merge_members = global
159
+ ij_javascript_import_prefer_absolute_path = global
160
+ ij_javascript_import_sort_members = true
161
+ ij_javascript_import_sort_module_name = false
162
+ ij_javascript_import_use_node_resolution = true
163
+ ij_javascript_imports_wrap = on_every_item
164
+ ij_javascript_indent_case_from_switch = true
165
+ ij_javascript_indent_chained_calls = false
166
+ ij_javascript_indent_package_children = 0
167
+ ij_javascript_jsx_attribute_value = braces
168
+ ij_javascript_keep_blank_lines_in_code = 2
169
+ ij_javascript_keep_first_column_comment = false
170
+ ij_javascript_keep_indents_on_empty_lines = false
171
+ ij_javascript_keep_line_breaks = true
172
+ ij_javascript_keep_simple_blocks_in_one_line = true
173
+ ij_javascript_keep_simple_methods_in_one_line = true
174
+ ij_javascript_line_comment_add_space = true
175
+ ij_javascript_line_comment_at_first_column = false
176
+ ij_javascript_method_brace_style = end_of_line
177
+ ij_javascript_method_call_chain_wrap = on_every_item
178
+ ij_javascript_method_parameters_new_line_after_left_paren = true
179
+ ij_javascript_method_parameters_right_paren_on_new_line = true
180
+ ij_javascript_method_parameters_wrap = on_every_item
181
+ ij_javascript_object_literal_wrap = on_every_item
182
+ ij_javascript_parentheses_expression_new_line_after_left_paren = true
183
+ ij_javascript_parentheses_expression_right_paren_on_new_line = true
184
+ ij_javascript_place_assignment_sign_on_next_line = true
185
+ ij_javascript_prefer_as_type_cast = false
186
+ ij_javascript_prefer_explicit_types_function_expression_returns = false
187
+ ij_javascript_prefer_explicit_types_function_returns = false
188
+ ij_javascript_prefer_explicit_types_vars_fields = false
189
+ ij_javascript_prefer_parameters_wrap = true
190
+ ij_javascript_reformat_c_style_comments = true
191
+ ij_javascript_space_after_colon = true
192
+ ij_javascript_space_after_comma = true
193
+ ij_javascript_space_after_dots_in_rest_parameter = false
194
+ ij_javascript_space_after_generator_mult = true
195
+ ij_javascript_space_after_property_colon = true
196
+ ij_javascript_space_after_quest = true
197
+ ij_javascript_space_after_type_colon = true
198
+ ij_javascript_space_after_unary_not = false
199
+ ij_javascript_space_before_async_arrow_lparen = true
200
+ ij_javascript_space_before_catch_keyword = true
201
+ ij_javascript_space_before_catch_left_brace = true
202
+ ij_javascript_space_before_catch_parentheses = true
203
+ ij_javascript_space_before_class_lbrace = true
204
+ ij_javascript_space_before_class_left_brace = true
205
+ ij_javascript_space_before_colon = true
206
+ ij_javascript_space_before_comma = false
207
+ ij_javascript_space_before_do_left_brace = true
208
+ ij_javascript_space_before_else_keyword = true
209
+ ij_javascript_space_before_else_left_brace = true
210
+ ij_javascript_space_before_finally_keyword = true
211
+ ij_javascript_space_before_finally_left_brace = true
212
+ ij_javascript_space_before_for_left_brace = true
213
+ ij_javascript_space_before_for_parentheses = true
214
+ ij_javascript_space_before_for_semicolon = true
215
+ ij_javascript_space_before_function_left_parenth = true
216
+ ij_javascript_space_before_generator_mult = false
217
+ ij_javascript_space_before_if_left_brace = true
218
+ ij_javascript_space_before_if_parentheses = true
219
+ ij_javascript_space_before_method_call_parentheses = false
220
+ ij_javascript_space_before_method_left_brace = true
221
+ ij_javascript_space_before_method_parentheses = false
222
+ ij_javascript_space_before_property_colon = false
223
+ ij_javascript_space_before_quest = true
224
+ ij_javascript_space_before_switch_left_brace = true
225
+ ij_javascript_space_before_switch_parentheses = true
226
+ ij_javascript_space_before_try_left_brace = true
227
+ ij_javascript_space_before_type_colon = false
228
+ ij_javascript_space_before_unary_not = false
229
+ ij_javascript_space_before_while_keyword = true
230
+ ij_javascript_space_before_while_left_brace = true
231
+ ij_javascript_space_before_while_parentheses = true
232
+ ij_javascript_spaces_around_additive_operators = true
233
+ ij_javascript_spaces_around_arrow_function_operator = true
234
+ ij_javascript_spaces_around_assignment_operators = true
235
+ ij_javascript_spaces_around_bitwise_operators = true
236
+ ij_javascript_spaces_around_equality_operators = true
237
+ ij_javascript_spaces_around_logical_operators = true
238
+ ij_javascript_spaces_around_multiplicative_operators = true
239
+ ij_javascript_spaces_around_relational_operators = true
240
+ ij_javascript_spaces_around_shift_operators = true
241
+ ij_javascript_spaces_around_unary_operator = false
242
+ ij_javascript_spaces_within_array_initializer_brackets = false
243
+ ij_javascript_spaces_within_brackets = false
244
+ ij_javascript_spaces_within_catch_parentheses = false
245
+ ij_javascript_spaces_within_for_parentheses = false
246
+ ij_javascript_spaces_within_if_parentheses = false
247
+ ij_javascript_spaces_within_imports = true
248
+ ij_javascript_spaces_within_interpolation_expressions = false
249
+ ij_javascript_spaces_within_method_call_parentheses = false
250
+ ij_javascript_spaces_within_method_parentheses = false
251
+ ij_javascript_spaces_within_object_literal_braces = false
252
+ ij_javascript_spaces_within_object_type_braces = true
253
+ ij_javascript_spaces_within_parentheses = false
254
+ ij_javascript_spaces_within_switch_parentheses = false
255
+ ij_javascript_spaces_within_type_assertion = false
256
+ ij_javascript_spaces_within_union_types = true
257
+ ij_javascript_spaces_within_while_parentheses = false
258
+ ij_javascript_special_else_if_treatment = true
259
+ ij_javascript_ternary_operation_signs_on_next_line = true
260
+ ij_javascript_ternary_operation_wrap = on_every_item
261
+ ij_javascript_union_types_wrap = on_every_item
262
+ ij_javascript_use_chained_calls_group_indents = true
263
+ ij_javascript_use_double_quotes = false
264
+ ij_javascript_use_explicit_js_extension = global
265
+ ij_javascript_use_path_mapping = always
266
+ ij_javascript_use_public_modifier = false
267
+ ij_javascript_use_semicolon_after_statement = true
268
+ ij_javascript_var_declaration_wrap = on_every_item
269
+ ij_javascript_while_brace_force = never
270
+ ij_javascript_while_on_new_line = false
271
+ ij_javascript_wrap_comments = true
272
+
273
+ [{*.ctp,*.hphp,*.inc,*.module,*.php,*.php4,*.php5,*.phtml,artisan,wp-switch-comments}]
274
+ max_line_length = 160
275
+ ij_continuation_indent_size = 4
276
+ ij_smart_tabs = true
277
+ ij_wrap_on_typing = false
278
+ ij_php_align_assignments = false
279
+ ij_php_align_class_constants = true
280
+ ij_php_align_group_field_declarations = false
281
+ ij_php_align_inline_comments = false
282
+ ij_php_align_key_value_pairs = true
283
+ ij_php_align_match_arm_bodies = false
284
+ ij_php_align_multiline_array_initializer_expression = true
285
+ ij_php_align_multiline_binary_operation = false
286
+ ij_php_align_multiline_chained_methods = true
287
+ ij_php_align_multiline_extends_list = false
288
+ ij_php_align_multiline_for = false
289
+ ij_php_align_multiline_parameters = false
290
+ ij_php_align_multiline_parameters_in_calls = false
291
+ ij_php_align_multiline_ternary_operation = false
292
+ ij_php_align_named_arguments = false
293
+ ij_php_align_phpdoc_comments = true
294
+ ij_php_align_phpdoc_param_names = true
295
+ ij_php_anonymous_brace_style = next_line
296
+ ij_php_api_weight = 28
297
+ ij_php_array_initializer_new_line_after_left_brace = true
298
+ ij_php_array_initializer_right_brace_on_new_line = true
299
+ ij_php_array_initializer_wrap = on_every_item
300
+ ij_php_assignment_wrap = off
301
+ ij_php_attributes_wrap = off
302
+ ij_php_author_weight = 28
303
+ ij_php_binary_operation_sign_on_next_line = false
304
+ ij_php_binary_operation_wrap = off
305
+ ij_php_blank_lines_after_class_header = 0
306
+ ij_php_blank_lines_after_function = 1
307
+ ij_php_blank_lines_after_imports = 1
308
+ ij_php_blank_lines_after_opening_tag = 1
309
+ ij_php_blank_lines_after_package = 1
310
+ ij_php_blank_lines_around_class = 1
311
+ ij_php_blank_lines_around_constants = 0
312
+ ij_php_blank_lines_around_field = 1
313
+ ij_php_blank_lines_around_method = 1
314
+ ij_php_blank_lines_before_class_end = 0
315
+ ij_php_blank_lines_before_imports = 1
316
+ ij_php_blank_lines_before_method_body = 0
317
+ ij_php_blank_lines_before_package = 1
318
+ ij_php_blank_lines_before_return_statement = 0
319
+ ij_php_blank_lines_between_imports = 0
320
+ ij_php_block_brace_style = end_of_line
321
+ ij_php_call_parameters_new_line_after_left_paren = true
322
+ ij_php_call_parameters_right_paren_on_new_line = true
323
+ ij_php_call_parameters_wrap = on_every_item
324
+ ij_php_catch_on_new_line = false
325
+ ij_php_category_weight = 28
326
+ ij_php_class_brace_style = next_line
327
+ ij_php_comma_after_last_array_element = true
328
+ ij_php_concat_spaces = true
329
+ ij_php_copyright_weight = 28
330
+ ij_php_deprecated_weight = 28
331
+ ij_php_do_while_brace_force = never
332
+ ij_php_else_if_style = separate
333
+ ij_php_else_on_new_line = false
334
+ ij_php_example_weight = 28
335
+ ij_php_extends_keyword_wrap = normal
336
+ ij_php_extends_list_wrap = on_every_item
337
+ ij_php_fields_default_visibility = private
338
+ ij_php_filesource_weight = 28
339
+ ij_php_finally_on_new_line = false
340
+ ij_php_for_brace_force = never
341
+ ij_php_for_statement_new_line_after_left_paren = false
342
+ ij_php_for_statement_right_paren_on_new_line = false
343
+ ij_php_for_statement_wrap = off
344
+ ij_php_force_short_declaration_array_style = true
345
+ ij_php_getters_setters_naming_style = camel_case
346
+ ij_php_getters_setters_order_style = getters_first
347
+ ij_php_global_weight = 28
348
+ ij_php_group_use_wrap = on_every_item
349
+ ij_php_if_brace_force = if_multiline
350
+ ij_php_if_lparen_on_next_line = true
351
+ ij_php_if_rparen_on_next_line = true
352
+ ij_php_ignore_weight = 28
353
+ ij_php_import_sorting = alphabetic
354
+ ij_php_indent_break_from_case = true
355
+ ij_php_indent_case_from_switch = true
356
+ ij_php_indent_code_in_php_tags = false
357
+ ij_php_internal_weight = 28
358
+ ij_php_keep_blank_lines_after_lbrace = 2
359
+ ij_php_keep_blank_lines_before_right_brace = 2
360
+ ij_php_keep_blank_lines_in_code = 2
361
+ ij_php_keep_blank_lines_in_declarations = 2
362
+ ij_php_keep_control_statement_in_one_line = true
363
+ ij_php_keep_first_column_comment = false
364
+ ij_php_keep_indents_on_empty_lines = false
365
+ ij_php_keep_line_breaks = true
366
+ ij_php_keep_rparen_and_lbrace_on_one_line = false
367
+ ij_php_keep_simple_classes_in_one_line = true
368
+ ij_php_keep_simple_methods_in_one_line = true
369
+ ij_php_lambda_brace_style = end_of_line
370
+ ij_php_license_weight = 28
371
+ ij_php_line_comment_add_space = true
372
+ ij_php_line_comment_at_first_column = false
373
+ ij_php_link_weight = 28
374
+ ij_php_lower_case_boolean_const = true
375
+ ij_php_lower_case_keywords = true
376
+ ij_php_lower_case_null_const = true
377
+ ij_php_method_brace_style = next_line
378
+ ij_php_method_call_chain_wrap = on_every_item
379
+ ij_php_method_parameters_new_line_after_left_paren = true
380
+ ij_php_method_parameters_right_paren_on_new_line = true
381
+ ij_php_method_parameters_wrap = on_every_item
382
+ ij_php_method_weight = 28
383
+ ij_php_modifier_list_wrap = false
384
+ ij_php_multiline_chained_calls_semicolon_on_new_line = false
385
+ ij_php_namespace_brace_style = 2
386
+ ij_php_new_line_after_php_opening_tag = false
387
+ ij_php_null_type_position = in_the_end
388
+ ij_php_package_weight = 28
389
+ ij_php_param_weight = 0
390
+ ij_php_parameters_attributes_wrap = off
391
+ ij_php_parentheses_expression_new_line_after_left_paren = false
392
+ ij_php_parentheses_expression_right_paren_on_new_line = false
393
+ ij_php_phpdoc_blank_line_before_tags = true
394
+ ij_php_phpdoc_blank_lines_around_parameters = true
395
+ ij_php_phpdoc_keep_blank_lines = true
396
+ ij_php_phpdoc_param_spaces_between_name_and_description = 1
397
+ ij_php_phpdoc_param_spaces_between_tag_and_type = 1
398
+ ij_php_phpdoc_param_spaces_between_type_and_name = 1
399
+ ij_php_phpdoc_use_fqcn = false
400
+ ij_php_phpdoc_wrap_long_lines = true
401
+ ij_php_place_assignment_sign_on_next_line = false
402
+ ij_php_place_parens_for_constructor = 0
403
+ ij_php_property_read_weight = 28
404
+ ij_php_property_weight = 28
405
+ ij_php_property_write_weight = 28
406
+ ij_php_return_type_on_new_line = false
407
+ ij_php_return_weight = 1
408
+ ij_php_see_weight = 28
409
+ ij_php_since_weight = 28
410
+ ij_php_sort_phpdoc_elements = true
411
+ ij_php_space_after_colon = true
412
+ ij_php_space_after_colon_in_enum_backed_type = true
413
+ ij_php_space_after_colon_in_named_argument = true
414
+ ij_php_space_after_colon_in_return_type = true
415
+ ij_php_space_after_comma = true
416
+ ij_php_space_after_for_semicolon = true
417
+ ij_php_space_after_quest = true
418
+ ij_php_space_after_type_cast = true
419
+ ij_php_space_after_unary_not = false
420
+ ij_php_space_before_array_initializer_left_brace = false
421
+ ij_php_space_before_catch_keyword = true
422
+ ij_php_space_before_catch_left_brace = true
423
+ ij_php_space_before_catch_parentheses = true
424
+ ij_php_space_before_class_left_brace = true
425
+ ij_php_space_before_closure_left_parenthesis = true
426
+ ij_php_space_before_colon = true
427
+ ij_php_space_before_colon_in_enum_backed_type = false
428
+ ij_php_space_before_colon_in_named_argument = false
429
+ ij_php_space_before_colon_in_return_type = false
430
+ ij_php_space_before_comma = false
431
+ ij_php_space_before_do_left_brace = true
432
+ ij_php_space_before_else_keyword = true
433
+ ij_php_space_before_else_left_brace = true
434
+ ij_php_space_before_finally_keyword = true
435
+ ij_php_space_before_finally_left_brace = true
436
+ ij_php_space_before_for_left_brace = true
437
+ ij_php_space_before_for_parentheses = true
438
+ ij_php_space_before_for_semicolon = true
439
+ ij_php_space_before_if_left_brace = true
440
+ ij_php_space_before_if_parentheses = true
441
+ ij_php_space_before_method_call_parentheses = false
442
+ ij_php_space_before_method_left_brace = true
443
+ ij_php_space_before_method_parentheses = false
444
+ ij_php_space_before_quest = true
445
+ ij_php_space_before_short_closure_left_parenthesis = true
446
+ ij_php_space_before_switch_left_brace = true
447
+ ij_php_space_before_switch_parentheses = true
448
+ ij_php_space_before_try_left_brace = true
449
+ ij_php_space_before_unary_not = false
450
+ ij_php_space_before_while_keyword = true
451
+ ij_php_space_before_while_left_brace = true
452
+ ij_php_space_before_while_parentheses = true
453
+ ij_php_space_between_ternary_quest_and_colon = false
454
+ ij_php_spaces_around_additive_operators = true
455
+ ij_php_spaces_around_arrow = false
456
+ ij_php_spaces_around_assignment_in_declare = true
457
+ ij_php_spaces_around_assignment_operators = true
458
+ ij_php_spaces_around_bitwise_operators = true
459
+ ij_php_spaces_around_equality_operators = true
460
+ ij_php_spaces_around_logical_operators = true
461
+ ij_php_spaces_around_multiplicative_operators = true
462
+ ij_php_spaces_around_null_coalesce_operator = true
463
+ ij_php_spaces_around_pipe_in_union_type = false
464
+ ij_php_spaces_around_relational_operators = true
465
+ ij_php_spaces_around_shift_operators = true
466
+ ij_php_spaces_around_unary_operator = false
467
+ ij_php_spaces_around_var_within_brackets = false
468
+ ij_php_spaces_within_array_initializer_braces = false
469
+ ij_php_spaces_within_brackets = false
470
+ ij_php_spaces_within_catch_parentheses = false
471
+ ij_php_spaces_within_for_parentheses = false
472
+ ij_php_spaces_within_if_parentheses = false
473
+ ij_php_spaces_within_method_call_parentheses = false
474
+ ij_php_spaces_within_method_parentheses = false
475
+ ij_php_spaces_within_parentheses = false
476
+ ij_php_spaces_within_short_echo_tags = true
477
+ ij_php_spaces_within_switch_parentheses = false
478
+ ij_php_spaces_within_while_parentheses = false
479
+ ij_php_special_else_if_treatment = true
480
+ ij_php_subpackage_weight = 28
481
+ ij_php_ternary_operation_signs_on_next_line = false
482
+ ij_php_ternary_operation_wrap = off
483
+ ij_php_throws_weight = 2
484
+ ij_php_todo_weight = 28
485
+ ij_php_unknown_tag_weight = 28
486
+ ij_php_upper_case_boolean_const = false
487
+ ij_php_upper_case_null_const = false
488
+ ij_php_uses_weight = 28
489
+ ij_php_var_weight = 28
490
+ ij_php_variable_naming_style = camel_case
491
+ ij_php_version_weight = 28
492
+ ij_php_while_brace_force = never
493
+ ij_php_while_on_new_line = false
494
+
495
+ [{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}]
496
+ ij_continuation_indent_size = 2
497
+ ij_html_add_new_line_before_tags = body, div, p, form, h1, h2, h3
498
+ ij_html_align_attributes = true
499
+ ij_html_align_text = false
500
+ ij_html_attribute_wrap = on_every_item
501
+ ij_html_block_comment_at_first_column = true
502
+ ij_html_do_not_align_children_of_min_lines = 0
503
+ ij_html_do_not_break_if_inline_tags = title, h1, h2, h3, h4, h5, h6, p
504
+ ij_html_do_not_indent_children_of_tags = html, body, thead, tbody, tfoot
505
+ ij_html_enforce_quotes = true
506
+ ij_html_inline_tags = none
507
+ ij_html_keep_blank_lines = 1
508
+ ij_html_keep_indents_on_empty_lines = false
509
+ ij_html_keep_line_breaks = true
510
+ ij_html_keep_line_breaks_in_text = true
511
+ ij_html_keep_whitespaces = false
512
+ ij_html_keep_whitespaces_inside = none
513
+ ij_html_line_comment_at_first_column = true
514
+ ij_html_new_line_after_last_attribute = when multiline
515
+ ij_html_new_line_before_first_attribute = when multiline
516
+ ij_html_quote_style = double
517
+ ij_html_remove_new_line_before_tags = br
518
+ ij_html_space_after_tag_name = false
519
+ ij_html_space_around_equality_in_attribute = false
520
+ ij_html_space_inside_empty_tag = true
521
+ ij_html_text_wrap = off
522
+
523
+ [{*.markdown,*.md}]
524
+ ij_markdown_force_one_space_after_blockquote_symbol = true
525
+ ij_markdown_force_one_space_after_header_symbol = true
526
+ ij_markdown_force_one_space_after_list_bullet = true
527
+ ij_markdown_force_one_space_between_words = true
528
+ ij_markdown_keep_indents_on_empty_lines = false
529
+ ij_markdown_max_lines_around_block_elements = 1
530
+ ij_markdown_max_lines_around_header = 1
531
+ ij_markdown_max_lines_between_paragraphs = 1
532
+ ij_markdown_min_lines_around_block_elements = 1
533
+ ij_markdown_min_lines_around_header = 1
534
+ ij_markdown_min_lines_between_paragraphs = 1
package/.eslintrc.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "@opentech0/eslint-config-opentech"
3
+ }
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: "🐞 Rapport de bug"
3
+ about: Créez un rapport de bug
4
+ title: ''
5
+ labels: ['bug', 'status:Unconfirmed']
6
+ assignees: 'Androlax2'
7
+
8
+ ---
9
+
10
+ <!--- Fournir un résumé général du problème dans le titre ci-dessus -->
11
+
12
+ ## Description
13
+ <!--- Fournissez une introduction plus détaillée au problème lui-même, et pourquoi vous considérez qu'il s'agit d'un bug -->
14
+
15
+ ## Comportement attendu
16
+ <!--- Dites-nous ce qu'il devrait se passer -->
17
+
18
+ ## Comportement réel
19
+ <!--- Dites-nous ce qu'il se passe à la place -->
20
+
21
+ ## Correction possible
22
+ <!--- Non obligatoire, mais suggérez un correctif ou une raison pour le bug -->
23
+
24
+ ## Étapes à reproduire
25
+ <!--- Fournissez un lien vers un exemple vivant, ou un ensemble non ambigu d'étapes pour reproduire ce bug. Inclure le code à reproduire, le cas échéant -->
26
+ 1.
27
+ 2.
28
+ 3.
29
+ 4.
30
+
31
+ ## Contexte
32
+ <!--- Comment ce bug vous a-t-il affecté ? Qu'essayiez-vous d'accomplir ? -->
33
+
34
+ ## Votre environnement
35
+ <!--- Incluez autant de détails pertinents sur l'environnement dans lequel vous avez rencontré le bug -->
36
+ * Version utilisée :
37
+ * Nom et version de l'environnement (par exemple, Chrome 39, node.js 5.4) :
38
+ * Système d'exploitation et version (bureau ou mobile) :
39
+ * Lien vers votre projet :
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: "📚 Documentation"
3
+ about: Suggérer des modifications pour la documentation.
4
+ title: ''
5
+ labels: 'documentation'
6
+ assignees: 'Androlax2'
7
+
8
+ ---
9
+
10
+ <!--
11
+ Résumez le changement de documentation que vous suggérez dans le titre du problème.
12
+ -->
13
+
14
+ ### Section pertinente de la documentation.
15
+
16
+ <!--
17
+ Copiez le lien de la section ici.
18
+ -->
19
+
20
+ ### Détails
21
+
22
+ <!--
23
+ Fournissez une description claire et concise de ce que vous voulez qu'il se passe.
24
+ -->
25
+
26
+ (Écrivez votre réponse ici.)
27
+
28
+ <!--
29
+ Si vous suggérez un changement très spécifique à la documentation, n'hésitez pas à soumettre directement une pull request.
30
+ -->
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: "🚀 Demande de fonctionnalité"
3
+ about: Suggérer une idée pour améliorer le produit.
4
+ title: ''
5
+ labels: 'enhancement'
6
+ assignees: 'Androlax2'
7
+
8
+ ---
9
+
10
+ <!--- Fournir un résumé général du problème dans le titre ci-dessus -->
11
+
12
+ ## Description détaillée
13
+ <!--- Fournissez une description détaillée du changement ou de l'ajout que vous proposez -->
14
+
15
+ ## Contexte
16
+ <!--- Pourquoi ce changement est-il important pour vous ? Comment l'utiliseriez-vous ? -->
17
+ <!--- Comment peut-il bénéficier aux autres utilisateurs ? -->
18
+
19
+ ## Mise en œuvre possible
20
+ <!--- Non obligatoire, mais suggérez une idée pour mettre en œuvre l'ajout ou le changement -->
@@ -0,0 +1,34 @@
1
+ <!--- Fournissez un résumé général de vos changements dans le titre ci-dessus -->
2
+
3
+ ## Description
4
+ <!--- Décrivez vos changements en détail -->
5
+
6
+ ## Motivation et contexte
7
+ <!--- Pourquoi ce changement est-il nécessaire ? Quel problème résout-il ? -->
8
+ <!--- Si elle corrige un problème ouvert, veuillez établir un lien vers ce problème ici. -->
9
+
10
+ ## Comment cela a-t-il été testé ?
11
+ <!--- Veuillez décrire en détail comment vous avez testé vos modifications. -->
12
+ <!--- Incluez les détails de votre environnement de test, et les tests que vous avez exécutés pour -->
13
+ <!--- voir comment votre changement affecte d'autres zones du code, etc. -->
14
+
15
+ ## Captures d'écran (le cas échéant) :
16
+
17
+ ## Types de changements
18
+ <!--- Quels types de changements votre code introduit-il ? Mettez un `x` dans toutes les cases qui s'appliquent : -->
19
+ - [ ] Correction de bug (changement non cassant qui corrige un problème).
20
+ - [ ] Nouvelle fonctionnalité (changement non cassant qui ajoute une fonctionnalité)
21
+ - [ ] Breaking change (correction ou fonctionnalité qui entraînerait un changement des fonctionnalités existante)
22
+
23
+ ## Liste de contrôle :
24
+ <!--- Passez en revue tous les points suivants, et mettez un `x` dans toutes les cases qui s'appliquent. -->
25
+ <!--- Si vous n'êtes pas sûr de l'un de ces points, n'hésitez pas à demander. Nous sommes là pour vous aider ! -->
26
+ - [ ] Mon code suit le style de code de ce projet.
27
+ - [ ] Mon changement nécessite une modification de la documentation.
28
+ - [ ] J'ai mis à jour la documentation en conséquence.
29
+ - [ ] J'ai linter mon code
30
+ - [ ] composer lint
31
+ - [ ] yarn eslint
32
+ - [ ] yarn stylelint
33
+ - [ ] J'ai ajouté des tests pour couvrir mes changements. <!--- Dans le cas où le projet contient des tests --->
34
+ - [ ] Tous les tests nouveaux et existants sont passés. <!--- Dans le cas où le projet contient des tests --->
@@ -0,0 +1,21 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "composer" # See documentation for possible values
9
+ directory: "/" # Location of package manifests
10
+ schedule:
11
+ interval: daily
12
+ time: "08:00"
13
+ timezone: Europe/Berlin
14
+ open-pull-requests-limit: 10
15
+ - package-ecosystem: "npm" # See documentation for possible values
16
+ directory: "/" # Location of package manifests
17
+ schedule:
18
+ interval: daily
19
+ time: "08:00"
20
+ timezone: Europe/Berlin
21
+ open-pull-requests-limit: 10
@@ -0,0 +1,33 @@
1
+ name: '📑 Changelog Builder'
2
+
3
+ on:
4
+ release:
5
+ types: [created]
6
+
7
+ jobs:
8
+ release:
9
+ if: startsWith(github.ref, 'refs/tags/')
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout
13
+ uses: actions/checkout@v2
14
+
15
+ - name: Build Changelog
16
+ id: github_release
17
+ uses: mikepenz/release-changelog-builder-action@v2
18
+ with:
19
+ configuration: "./changelog-configuration.json"
20
+ env:
21
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22
+
23
+ - name: Get the version
24
+ id: get_version
25
+ run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
26
+
27
+ - name: Update GitHub Release
28
+ uses: tubone24/update_release@v1.3.1
29
+ with:
30
+ release_name: ${{ steps.get_version.outputs.VERSION }}
31
+ body: ${{steps.github_release.outputs.changelog}}
32
+ env:
33
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,22 @@
1
+ name: Create a Release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ build:
10
+ name: Release
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Checkout
14
+ uses: actions/checkout@v2
15
+ with:
16
+ fetch-depth: 0
17
+ - name: Release
18
+ uses: justincy/github-action-npm-release@2.0.2
19
+ id: release
20
+ - name: Print release output
21
+ if: ${{ steps.release.outputs.released == 'true' }}
22
+ run: echo Release ID ${{ steps.release.outputs.release_id }}
@@ -0,0 +1,24 @@
1
+ name: Publish the package to NPM
2
+
3
+ on:
4
+ release:
5
+ types: [created]
6
+ workflow_run:
7
+ workflows: ["Create a Release"]
8
+ types:
9
+ - completed
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ # Setup .npmrc file to publish to npm
17
+ - uses: actions/setup-node@v2
18
+ with:
19
+ node-version: "12.x"
20
+ registry-url: "https://registry.npmjs.org"
21
+ - run: npm install
22
+ - run: npm publish --access public
23
+ env:
24
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -0,0 +1,24 @@
1
+ name: "🚨 Script Linter"
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ branches:
9
+ - master
10
+
11
+ jobs:
12
+ lint:
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+
18
+ - name: Setup node 16
19
+ uses: actions/setup-node@v2
20
+ with:
21
+ node-version: 16.x
22
+
23
+ - run: npm install
24
+ - run: npm run eslint
package/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # Javascript helpers
2
+
3
+ ## Installation
4
+
5
+ ```bash
6
+ yarn add @opentech0/js-helpers
7
+ ```
8
+
9
+ ## Utilisation
10
+
11
+ ```javascript
12
+ import { debounce } from '@opentech0/js-helpers';
13
+ ```"# js-helpers"
@@ -0,0 +1,30 @@
1
+ {
2
+ "categories": [
3
+ {
4
+ "title": "## 🚀 Features",
5
+ "labels": ["feature"]
6
+ },
7
+ {
8
+ "title": "## 🐛 Fixes",
9
+ "labels": ["fix"]
10
+ },
11
+ {
12
+ "title": "## 🧪 Tests",
13
+ "labels": ["test"]
14
+ },
15
+ {
16
+ "title": "## 📦️ Dependencies",
17
+ "labels": ["dependencies"]
18
+ },
19
+ {
20
+ "title": "## 💬 Other",
21
+ "labels": ["other"]
22
+ },
23
+ {
24
+ "title": "## 🧪 Tests and some 🪄 Magic",
25
+ "labels": ["test", "magic"],
26
+ "exclude_labels": ["no-magic"],
27
+ "exhaustive": true
28
+ }
29
+ ]
30
+ }
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@opentech0/js-helpers",
3
+ "version": "1.0.0",
4
+ "main": "src/index.js",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\" && exit 1",
7
+ "eslint": "./node_modules/.bin/eslint '**/*.js'",
8
+ "eslint:fix": "./node_modules/.bin/eslint '**/*.js' --fix"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/opentech0/js-helpers.git"
13
+ },
14
+ "author": "",
15
+ "license": "ISC",
16
+ "bugs": {
17
+ "url": "https://github.com/opentech0/js-helpers/issues"
18
+ },
19
+ "homepage": "https://github.com/opentech0/js-helpers#readme",
20
+ "description": "",
21
+ "devDependencies": {
22
+ "@opentech0/eslint-config-opentech": "^1.1.0"
23
+ }
24
+ }
package/src/index.js ADDED
@@ -0,0 +1,180 @@
1
+ /**
2
+ * Is touch device ?
3
+ *
4
+ * @type {boolean}
5
+ * @formatter:off
6
+ */
7
+ export const isTouchDevice = (('ontouchstart' in window) || (navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0));
8
+ //@formatter:on
9
+
10
+ /**
11
+ * Return top and left offset of an element depending on a parent
12
+ *
13
+ * @param el
14
+ * @param parent
15
+ * @returns {{top: number, left: number}}
16
+ */
17
+ export const childOffset = (el, parent) => {
18
+ const childrenOffset = offsetOf(el),
19
+ parentOffset = offsetOf(parent);
20
+
21
+ return {
22
+ top: childrenOffset.top - parentOffset.top,
23
+ left: childrenOffset.left - parentOffset.left
24
+ };
25
+ };
26
+
27
+ /**
28
+ * Add multiple events to an element
29
+ *
30
+ * @param element
31
+ * @param events
32
+ * @param handler
33
+ */
34
+ export const addMultipleEventListener = (element, events, handler) => events.forEach(e => element.addEventListener(e, handler));
35
+
36
+ /**
37
+ * Call callback function after a certain delay
38
+ *
39
+ * @param callback
40
+ * @param delay
41
+ * @returns {function(...[*]=)}
42
+ */
43
+ export const debounce = (callback, delay) => {
44
+ let timer;
45
+ return function () {
46
+ const args = arguments;
47
+ const context = this;
48
+
49
+ clearTimeout(timer);
50
+ timer = setTimeout(() => callback.apply(context, args), delay);
51
+ };
52
+ };
53
+
54
+ /**
55
+ * Hide an element on click outside
56
+ *
57
+ * @param element
58
+ * @param className
59
+ */
60
+ export const hideOnClickOutside = (element, className = 'hover') => {
61
+ const outsideClickListener = event => {
62
+ if (!element.contains(event.target) && isVisible(element)) {
63
+ element.classList.remove(className);
64
+ removeClickListener();
65
+ }
66
+ };
67
+
68
+ const removeClickListener = () => {
69
+ document.removeEventListener('click', outsideClickListener);
70
+ };
71
+
72
+ document.addEventListener('click', outsideClickListener);
73
+ };
74
+
75
+ /**
76
+ * Is the element visible ?
77
+ *
78
+ * @param elem
79
+ * @returns {boolean}
80
+ */
81
+ //@formatter:off
82
+ export const isVisible = elem => !!elem && !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
83
+ //@formatter:on
84
+
85
+ /**
86
+ * Avoid callback call too many time
87
+ *
88
+ * @param callback
89
+ * @param delay
90
+ * @returns {function(...[*]=)}
91
+ */
92
+ export const throttle = (callback, delay) => {
93
+ let last;
94
+ let timer;
95
+
96
+ return function () {
97
+ const context = this;
98
+ const now = +new Date();
99
+ const args = arguments;
100
+
101
+ if (last && now < last + delay) {
102
+ clearTimeout(timer);
103
+ timer = setTimeout(() => {
104
+ last = now;
105
+ callback.apply(context, args);
106
+ }, delay);
107
+ } else {
108
+ last = now;
109
+ callback.apply(context, args);
110
+ }
111
+ };
112
+ };
113
+
114
+ /**
115
+ * Get an array of the focusable elements
116
+ *
117
+ * @returns {string[]}
118
+ */
119
+ export const getFocusableElements = () =>
120
+ [
121
+ 'a',
122
+ 'button:not([disabled])',
123
+ 'input:not([disabled])',
124
+ 'select:not([disabled])',
125
+ 'textarea:not([disabled])',
126
+ '[tabindex]:not([tabindex="-1"])'
127
+ ];
128
+
129
+ /**
130
+ * Return top and left offset of an element
131
+ *
132
+ * @param el
133
+ * @returns {{top: number, left: number}}
134
+ */
135
+ export const offsetOf = el => {
136
+ const rect = el.getBoundingClientRect();
137
+ const bodyEl = document.body;
138
+
139
+ return {
140
+ top: rect.top + bodyEl.scrollTop,
141
+ left: rect.left + bodyEl.scrollLeft
142
+ };
143
+ };
144
+
145
+ /**
146
+ * Unwrap an element
147
+ *
148
+ * @param wrapper
149
+ */
150
+ export const unwrap = wrapper => {
151
+ // place childNodes in document fragment
152
+ const docFrag = document.createDocumentFragment();
153
+ while (wrapper.firstChild) {
154
+ const child = wrapper.removeChild(wrapper.firstChild);
155
+ docFrag.appendChild(child);
156
+ }
157
+
158
+ // replace wrapper with document fragment
159
+ wrapper.parentNode.replaceChild(docFrag, wrapper);
160
+ };
161
+
162
+ /**
163
+ * Wrap and HTML structure around an element
164
+ *
165
+ * @param el
166
+ * @param wrapper
167
+ */
168
+ export const wrap = (el, wrapper) => {
169
+ el.parentNode.insertBefore(wrapper, el);
170
+ wrapper.appendChild(el);
171
+ };
172
+
173
+ /**
174
+ * Returns true if the element or one of its parents has the selector
175
+ *
176
+ * @param target
177
+ * @param selector
178
+ * @returns {boolean}
179
+ */
180
+ export const hasParentWithMatchingSelector = (target, selector) => [...document.querySelectorAll(selector)].some(el => el !== target && el.contains(target));