@ngrok/mantle 0.90.3 → 0.91.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.
Files changed (168) hide show
  1. package/dist/accordion.d.ts +3 -5
  2. package/dist/agent.json +7 -7
  3. package/dist/{alert-CTAmHdLa.d.ts → alert-BV0VWU2o.d.ts} +5 -7
  4. package/dist/{alert-xJELJxL4.js → alert-BVQcPzmf.js} +1 -1
  5. package/dist/alert-center.d.ts +2 -4
  6. package/dist/alert-center.js +1 -1
  7. package/dist/alert-dialog.d.ts +5 -7
  8. package/dist/alert-dialog.js +1 -1
  9. package/dist/alert.d.ts +1 -1
  10. package/dist/alert.js +1 -1
  11. package/dist/anchor.d.ts +2 -6
  12. package/dist/app-layout.d.ts +3 -7
  13. package/dist/app-layout.js +1 -1
  14. package/dist/area-chart.d.ts +2 -4
  15. package/dist/area-chart.js +1 -1
  16. package/dist/{as-child-D23mGo4f.d.ts → as-child-DFxX3U2i.d.ts} +0 -2
  17. package/dist/avatar.d.ts +2 -4
  18. package/dist/badge.d.ts +3 -5
  19. package/dist/bar-chart.d.ts +2 -4
  20. package/dist/bar-chart.js +1 -1
  21. package/dist/breadcrumb.d.ts +2 -6
  22. package/dist/breadcrumb.js +1 -1
  23. package/dist/browser-only.d.ts +0 -2
  24. package/dist/{button-BZT5f79d.d.ts → button-BFAvonp1.d.ts} +3 -7
  25. package/dist/{button-mzUR1U0Y.d.ts → button-BOCRKR5v.d.ts} +3 -7
  26. package/dist/button-CZ-q7fYv.js +1 -0
  27. package/dist/button-Cwrv2Mwv.js +1 -0
  28. package/dist/{button-BRjAW1ec.d.ts → button-Dt9LZMT5.d.ts} +5 -7
  29. package/dist/{button-BCoI4bhP.d.ts → button-L4exxu_L.d.ts} +0 -2
  30. package/dist/button.d.ts +4 -4
  31. package/dist/button.js +1 -1
  32. package/dist/calendar.d.ts +1 -3
  33. package/dist/card.d.ts +3 -5
  34. package/dist/centered-layout.d.ts +9 -32
  35. package/dist/chart-D2LtDZtV.js +2 -0
  36. package/dist/{chart-23KQ1ZNO.d.ts → chart-ynMysD16.d.ts} +40 -15
  37. package/dist/checkbox.d.ts +2 -4
  38. package/dist/{choice-BCiyqLgO.d.ts → choice-BLR0_MeB.d.ts} +3 -5
  39. package/dist/choice.d.ts +1 -1
  40. package/dist/{code-block-D5eDP379.d.ts → code-block-Bqw9VyK_.d.ts} +0 -22
  41. package/dist/code-block.d.ts +4 -12
  42. package/dist/code-block.js +6 -6
  43. package/dist/code-block_highlight-utils.d.ts +1 -1
  44. package/dist/code.d.ts +2 -4
  45. package/dist/color.d.ts +1 -1
  46. package/dist/combobox.d.ts +4 -6
  47. package/dist/combobox.js +1 -1
  48. package/dist/command.d.ts +3 -13
  49. package/dist/command.js +1 -1
  50. package/dist/cx.d.ts +0 -6
  51. package/dist/{data-slot-CChfb_cv.d.ts → data-slot-B-LqAcBB.d.ts} +0 -2
  52. package/dist/data-table.d.ts +111 -21
  53. package/dist/data-table.js +1 -1
  54. package/dist/description-list.d.ts +3 -5
  55. package/dist/{dialog-C9QGvVNG.js → dialog-D333NTyf.js} +1 -1
  56. package/dist/{dialog-CgwSNHs1.d.ts → dialog-DedsCsnk.d.ts} +3 -5
  57. package/dist/{dialog-CZYD3xL-.d.ts → dialog-Dp0QGWwo.d.ts} +0 -2
  58. package/dist/dialog.d.ts +2 -2
  59. package/dist/dialog.js +1 -1
  60. package/dist/{direction-BjU0bPST.d.ts → direction-CpRzTtZh.d.ts} +0 -2
  61. package/dist/{dropdown-menu-Cef0Cz2B.d.ts → dropdown-menu-ByQQIsQE.d.ts} +2 -4
  62. package/dist/dropdown-menu.d.ts +1 -2
  63. package/dist/empty.d.ts +3 -5
  64. package/dist/{field-7QeiTFwl.d.ts → field-V_gnkcmN.d.ts} +0 -2
  65. package/dist/field.d.ts +7 -15
  66. package/dist/field.js +1 -1
  67. package/dist/flag.d.ts +1 -5
  68. package/dist/hooks.d.ts +1 -37
  69. package/dist/hover-card.d.ts +1 -3
  70. package/dist/{icon-ucVgZeXn.d.ts → icon-ByLVhdYq.d.ts} +2 -4
  71. package/dist/{icon-D1RY5Tcj.d.ts → icon-CgNqu-fl.d.ts} +0 -2
  72. package/dist/{icon-r2NvfTWW.d.ts → icon-DXDyhy2N.d.ts} +2 -4
  73. package/dist/icon.d.ts +3 -3
  74. package/dist/icons-DykpsXNX.js +1 -0
  75. package/dist/icons.d.ts +3 -17
  76. package/dist/icons.js +1 -1
  77. package/dist/{in-view-Ch5vJtWo.d.ts → in-view-B3nMAzfE.d.ts} +0 -6
  78. package/dist/{index-DorCusfG.d.ts → index-BZhHLrBi.d.ts} +0 -2
  79. package/dist/{index-DA4ig3gj.d.ts → index-C6s5cGCr.d.ts} +2 -10
  80. package/dist/{input-eEKzP3cE.js → input-CpQ6jlpI.js} +1 -1
  81. package/dist/{input-bbB1tC0h.d.ts → input-Dx5owTCc.d.ts} +2 -6
  82. package/dist/input.d.ts +3 -7
  83. package/dist/input.js +1 -1
  84. package/dist/kbd.d.ts +1 -3
  85. package/dist/{label-C-KbNls8.d.ts → label-Dn5CPJUj.d.ts} +1 -3
  86. package/dist/label.d.ts +1 -1
  87. package/dist/layer-container.d.ts +0 -2
  88. package/dist/line-chart.d.ts +2 -4
  89. package/dist/line-chart.js +1 -1
  90. package/dist/list.d.ts +2 -8
  91. package/dist/live-region.d.ts +2 -4
  92. package/dist/llms.txt +4 -4
  93. package/dist/main.d.ts +1 -3
  94. package/dist/mantle-dark.css +2 -12
  95. package/dist/mantle.css +75 -13
  96. package/dist/media-object.d.ts +2 -4
  97. package/dist/migrations/0011-eliminate-high-contrast.yml +869 -0
  98. package/dist/multi-select.d.ts +4 -6
  99. package/dist/multi-select.js +1 -1
  100. package/dist/otp-input.d.ts +3 -5
  101. package/dist/pagination.d.ts +3 -7
  102. package/dist/pagination.js +1 -1
  103. package/dist/{popover-Dvls7-j4.d.ts → popover-BfB2I9G0.d.ts} +1 -3
  104. package/dist/popover.d.ts +1 -1
  105. package/dist/progress.d.ts +1 -7
  106. package/dist/qr-code.d.ts +2 -4
  107. package/dist/radio-group.d.ts +2 -4
  108. package/dist/radio-group.js +1 -1
  109. package/dist/sandbar.d.ts +5 -8
  110. package/dist/sandbar.js +1 -1
  111. package/dist/sandboxed-on-click.d.ts +1 -3
  112. package/dist/scatter-plot.d.ts +2 -4
  113. package/dist/scatter-plot.js +1 -1
  114. package/dist/{select-DlohFa54.d.ts → select-CRp_ndSJ.d.ts} +3 -5
  115. package/dist/select-iMsy6TFv.js +1 -0
  116. package/dist/select.d.ts +1 -1
  117. package/dist/select.js +1 -1
  118. package/dist/selectable-list.d.ts +3 -5
  119. package/dist/selectable-list.js +1 -1
  120. package/dist/{separator-BWGjCIl7.d.ts → separator-DNovVsrx.d.ts} +3 -5
  121. package/dist/separator.d.ts +1 -1
  122. package/dist/{sheet-CAFS09pT.js → sheet-gMTepUM_.js} +1 -1
  123. package/dist/sheet.d.ts +3 -5
  124. package/dist/sheet.js +1 -1
  125. package/dist/sidebar.d.ts +5 -9
  126. package/dist/sidebar.js +1 -1
  127. package/dist/{skeleton-zfqoDAxT.js → skeleton-DBpI-ko5.js} +1 -1
  128. package/dist/skeleton.d.ts +2 -4
  129. package/dist/skeleton.js +1 -1
  130. package/dist/skip-to-main-link.d.ts +1 -3
  131. package/dist/slider.d.ts +1 -3
  132. package/dist/{slot-Q996Hqk9.d.ts → slot-C0OCJjdJ.d.ts} +2 -4
  133. package/dist/slot.d.ts +1 -1
  134. package/dist/split-button.d.ts +5 -7
  135. package/dist/split-button.js +1 -1
  136. package/dist/strata.d.ts +2 -4
  137. package/dist/switch.d.ts +2 -4
  138. package/dist/{table-BhzITa19.d.ts → table-vT6Okwfa.d.ts} +1 -3
  139. package/dist/table.d.ts +1 -1
  140. package/dist/tabs.d.ts +3 -5
  141. package/dist/text-area.d.ts +2 -4
  142. package/dist/text-area.js +1 -1
  143. package/dist/theme-BD0ly6jo.js +1 -0
  144. package/dist/theme-switcher.d.ts +67 -213
  145. package/dist/theme-switcher.js +1 -1
  146. package/dist/{theme-6OxNhf6l.d.ts → theme-w1CrMM-x.d.ts} +3 -5
  147. package/dist/theme.d.ts +78 -177
  148. package/dist/theme.js +1 -1
  149. package/dist/toast.d.ts +4 -6
  150. package/dist/toast.js +1 -1
  151. package/dist/{tooltip-CngH7Kl6.d.ts → tooltip-NcLIeBy5.d.ts} +1 -3
  152. package/dist/tooltip.d.ts +1 -1
  153. package/dist/truncated-text.d.ts +2 -4
  154. package/dist/types.d.ts +3 -3
  155. package/dist/utils.d.ts +2 -4
  156. package/dist/visually-hidden.d.ts +2 -4
  157. package/dist/well.d.ts +3 -5
  158. package/dist/{with-style-props-Dq5Vntqy.d.ts → with-style-props-CuT30s0W.d.ts} +0 -2
  159. package/package.json +2 -10
  160. package/dist/button-Bkl_QYpp.js +0 -1
  161. package/dist/button-b2HKEIE2.js +0 -1
  162. package/dist/chart-BfJ835dr.js +0 -2
  163. package/dist/dropdown-menu-DMA8dGxZ.d.ts +0 -1
  164. package/dist/icons-CW9lV9E1.js +0 -1
  165. package/dist/mantle-dark-high-contrast.css +0 -354
  166. package/dist/mantle-light-high-contrast.css +0 -353
  167. package/dist/select-Os5GVejP.js +0 -1
  168. package/dist/theme-Dzem-qRB.js +0 -1
@@ -0,0 +1,869 @@
1
+ # Every JSX rule binds the local name of the part's import from its
2
+ # `@ngrok/mantle/<subpath>`, so an aliased import matches and another
3
+ # library's part of the same name does not.
4
+ id: theme-switcher-compound
5
+ language: tsx
6
+ message: ThemeSwitcher is one component; Root, Trigger, and Content are gone
7
+ utils:
8
+ # A node that opens a lexical scope. The shadow search below stops at a
9
+ # nested one, so a sibling function's local name does not count.
10
+ scope:
11
+ any:
12
+ - kind: statement_block
13
+ - kind: function_declaration
14
+ - kind: generator_function_declaration
15
+ - kind: function_expression
16
+ - kind: generator_function
17
+ - kind: arrow_function
18
+ - kind: method_definition
19
+ - kind: class_body
20
+ - kind: for_statement
21
+ - kind: for_in_statement
22
+ - kind: catch_clause
23
+ # An identifier in a binding position: a parameter, a destructured name, a
24
+ # local variable, a function name, or a class name.
25
+ binding-name:
26
+ any:
27
+ - kind: shorthand_property_identifier_pattern
28
+ - kind: identifier
29
+ any:
30
+ - inside: { kind: variable_declarator, field: name }
31
+ - inside: { kind: function_declaration, field: name }
32
+ - inside: { kind: generator_function_declaration, field: name }
33
+ - inside: { kind: function_expression, field: name }
34
+ - inside: { kind: required_parameter, field: pattern }
35
+ - inside: { kind: optional_parameter, field: pattern }
36
+ - inside: { kind: assignment_pattern, field: left }
37
+ - inside: { kind: pair_pattern, field: value }
38
+ - inside: { kind: array_pattern }
39
+ - inside: { kind: rest_pattern }
40
+ - inside: { kind: arrow_function, field: parameter }
41
+ - inside: { kind: catch_clause, field: parameter }
42
+ - kind: type_identifier
43
+ inside: { kind: class_declaration, field: name }
44
+ # A function declaration opens a scope, so the search above stops at it and
45
+ # never reads its name. This matches the declaration itself instead.
46
+ function-declaration:
47
+ any:
48
+ - kind: function_declaration
49
+ - kind: generator_function_declaration
50
+ theme-switcher-import:
51
+ kind: import_statement
52
+ all:
53
+ - has:
54
+ field: source
55
+ regex: ^["']@ngrok/mantle/theme-switcher["']$
56
+ - has:
57
+ stopBy: end
58
+ kind: import_specifier
59
+ has:
60
+ field: name
61
+ regex: ^ThemeSwitcher$
62
+ any:
63
+ - kind: import_specifier
64
+ has:
65
+ field: alias
66
+ pattern: $TS
67
+ - kind: import_specifier
68
+ not:
69
+ has:
70
+ field: alias
71
+ kind: identifier
72
+ has:
73
+ field: name
74
+ pattern: $TS
75
+ rule:
76
+ kind: jsx_element
77
+ all:
78
+ # Why bind the name first: `inside` runs before `has` in one object, so the
79
+ # import gate must read a name that is already bound.
80
+ - has:
81
+ field: open_tag
82
+ kind: jsx_opening_element
83
+ has:
84
+ field: name
85
+ kind: member_expression
86
+ all:
87
+ - has: { field: object, pattern: $TS }
88
+ - has: { field: property, regex: ^Root$ }
89
+ # Why no attributes: a controlled Root (`open`, `onOpenChange`) needs a
90
+ # menu, which the toggle does not have. That case stays manual.
91
+ not:
92
+ has:
93
+ any:
94
+ - kind: jsx_attribute
95
+ - kind: jsx_expression
96
+ - has:
97
+ pattern: <$TS.Trigger $$$ATTRS />
98
+ - has:
99
+ kind: jsx_self_closing_element
100
+ has:
101
+ field: name
102
+ kind: member_expression
103
+ all:
104
+ - has: { field: object, pattern: $TS }
105
+ - has: { field: property, regex: ^Content$ }
106
+ # Why: a `children` prop or a spread can pass menu items. That case
107
+ # stays manual.
108
+ not:
109
+ has:
110
+ any:
111
+ - kind: jsx_expression
112
+ - kind: jsx_attribute
113
+ has: { kind: property_identifier, regex: ^children$ }
114
+ # Why only one Trigger and one Content: Content with children or any other
115
+ # child carries menu items the toggle cannot hold, and the fix keeps the
116
+ # props of one Trigger only. That case stays manual.
117
+ - not:
118
+ has:
119
+ any:
120
+ - kind: jsx_element
121
+ - kind: jsx_expression
122
+ - kind: jsx_text
123
+ regex: \S
124
+ - kind: jsx_self_closing_element
125
+ not:
126
+ has:
127
+ field: name
128
+ kind: member_expression
129
+ all:
130
+ - has: { field: object, pattern: $TS }
131
+ - has: { field: property, regex: ^(Trigger|Content)$ }
132
+ - kind: jsx_self_closing_element
133
+ has:
134
+ field: name
135
+ kind: member_expression
136
+ all:
137
+ - has: { field: object, pattern: $TS }
138
+ - has: { field: property, regex: ^(Trigger|Content)$ }
139
+ - pattern: $PART
140
+ follows:
141
+ stopBy: end
142
+ kind: jsx_self_closing_element
143
+ has:
144
+ field: name
145
+ pattern: $PART
146
+ - inside:
147
+ stopBy: end
148
+ kind: program
149
+ has:
150
+ matches: theme-switcher-import
151
+ # Why: a parameter or a local under the import's name shadows it, and the
152
+ # rules cannot tell which binding the element reads.
153
+ - not:
154
+ inside:
155
+ stopBy: end
156
+ matches: scope
157
+ has:
158
+ stopBy:
159
+ matches: scope
160
+ any:
161
+ - matches: binding-name
162
+ pattern: $TS
163
+ - matches: function-declaration
164
+ has:
165
+ field: name
166
+ pattern: $TS
167
+ fix: <$TS $$$ATTRS />
168
+ ---
169
+ id: mantle-style-sheets-removed-props
170
+ language: tsx
171
+ message: MantleStyleSheets takes only darkCssUrl
172
+ utils:
173
+ # A node that opens a lexical scope. The shadow search below stops at a
174
+ # nested one, so a sibling function's local name does not count.
175
+ scope:
176
+ any:
177
+ - kind: statement_block
178
+ - kind: function_declaration
179
+ - kind: generator_function_declaration
180
+ - kind: function_expression
181
+ - kind: generator_function
182
+ - kind: arrow_function
183
+ - kind: method_definition
184
+ - kind: class_body
185
+ - kind: for_statement
186
+ - kind: for_in_statement
187
+ - kind: catch_clause
188
+ # An identifier in a binding position: a parameter, a destructured name, a
189
+ # local variable, a function name, or a class name.
190
+ binding-name:
191
+ any:
192
+ - kind: shorthand_property_identifier_pattern
193
+ - kind: identifier
194
+ any:
195
+ - inside: { kind: variable_declarator, field: name }
196
+ - inside: { kind: function_declaration, field: name }
197
+ - inside: { kind: generator_function_declaration, field: name }
198
+ - inside: { kind: function_expression, field: name }
199
+ - inside: { kind: required_parameter, field: pattern }
200
+ - inside: { kind: optional_parameter, field: pattern }
201
+ - inside: { kind: assignment_pattern, field: left }
202
+ - inside: { kind: pair_pattern, field: value }
203
+ - inside: { kind: array_pattern }
204
+ - inside: { kind: rest_pattern }
205
+ - inside: { kind: arrow_function, field: parameter }
206
+ - inside: { kind: catch_clause, field: parameter }
207
+ - kind: type_identifier
208
+ inside: { kind: class_declaration, field: name }
209
+ # A function declaration opens a scope, so the search above stops at it and
210
+ # never reads its name. This matches the declaration itself instead.
211
+ function-declaration:
212
+ any:
213
+ - kind: function_declaration
214
+ - kind: generator_function_declaration
215
+ mantle-style-sheets-import:
216
+ kind: import_statement
217
+ all:
218
+ - has:
219
+ field: source
220
+ regex: ^["']@ngrok/mantle/theme["']$
221
+ - has:
222
+ stopBy: end
223
+ kind: import_specifier
224
+ has:
225
+ field: name
226
+ regex: ^MantleStyleSheets$
227
+ any:
228
+ - kind: import_specifier
229
+ has:
230
+ field: alias
231
+ pattern: $SHEETS
232
+ - kind: import_specifier
233
+ not:
234
+ has:
235
+ field: alias
236
+ kind: identifier
237
+ has:
238
+ field: name
239
+ pattern: $SHEETS
240
+ rule:
241
+ kind: jsx_attribute
242
+ has:
243
+ kind: property_identifier
244
+ regex: ^(lightHighContrastCssUrl|darkHighContrastCssUrl|forceTheme|ssrCookie|nonce)$
245
+ inside:
246
+ any:
247
+ - kind: jsx_opening_element
248
+ - kind: jsx_self_closing_element
249
+ all:
250
+ - has:
251
+ field: name
252
+ kind: identifier
253
+ pattern: $SHEETS
254
+ - inside:
255
+ stopBy: end
256
+ kind: program
257
+ has:
258
+ matches: mantle-style-sheets-import
259
+ # Why: a parameter or a local under the import's name shadows it, and the
260
+ # rules cannot tell which binding the element reads.
261
+ - not:
262
+ inside:
263
+ stopBy: end
264
+ matches: scope
265
+ has:
266
+ stopBy:
267
+ matches: scope
268
+ any:
269
+ - matches: binding-name
270
+ pattern: $SHEETS
271
+ - matches: function-declaration
272
+ has:
273
+ field: name
274
+ pattern: $SHEETS
275
+ fix: ""
276
+ ---
277
+ id: mantle-style-sheet-urls-high-contrast-keys
278
+ language: tsx
279
+ message: mantleStyleSheetUrls takes only darkCssUrl
280
+ utils:
281
+ # A node that opens a lexical scope. The shadow search below stops at a
282
+ # nested one, so a sibling function's local name does not count.
283
+ scope:
284
+ any:
285
+ - kind: statement_block
286
+ - kind: function_declaration
287
+ - kind: generator_function_declaration
288
+ - kind: function_expression
289
+ - kind: generator_function
290
+ - kind: arrow_function
291
+ - kind: method_definition
292
+ - kind: class_body
293
+ - kind: for_statement
294
+ - kind: for_in_statement
295
+ - kind: catch_clause
296
+ # An identifier in a binding position: a parameter, a destructured name, a
297
+ # local variable, a function name, or a class name.
298
+ binding-name:
299
+ any:
300
+ - kind: shorthand_property_identifier_pattern
301
+ - kind: identifier
302
+ any:
303
+ - inside: { kind: variable_declarator, field: name }
304
+ - inside: { kind: function_declaration, field: name }
305
+ - inside: { kind: generator_function_declaration, field: name }
306
+ - inside: { kind: function_expression, field: name }
307
+ - inside: { kind: required_parameter, field: pattern }
308
+ - inside: { kind: optional_parameter, field: pattern }
309
+ - inside: { kind: assignment_pattern, field: left }
310
+ - inside: { kind: pair_pattern, field: value }
311
+ - inside: { kind: array_pattern }
312
+ - inside: { kind: rest_pattern }
313
+ - inside: { kind: arrow_function, field: parameter }
314
+ - inside: { kind: catch_clause, field: parameter }
315
+ - kind: type_identifier
316
+ inside: { kind: class_declaration, field: name }
317
+ # A function declaration opens a scope, so the search above stops at it and
318
+ # never reads its name. This matches the declaration itself instead.
319
+ function-declaration:
320
+ any:
321
+ - kind: function_declaration
322
+ - kind: generator_function_declaration
323
+ style-sheet-urls-import:
324
+ kind: import_statement
325
+ all:
326
+ - has:
327
+ field: source
328
+ regex: ^["']@ngrok/mantle/theme["']$
329
+ - has:
330
+ stopBy: end
331
+ kind: import_specifier
332
+ has:
333
+ field: name
334
+ regex: ^mantleStyleSheetUrls$
335
+ any:
336
+ - kind: import_specifier
337
+ has:
338
+ field: alias
339
+ pattern: $URLS
340
+ - kind: import_specifier
341
+ not:
342
+ has:
343
+ field: alias
344
+ kind: identifier
345
+ has:
346
+ field: name
347
+ pattern: $URLS
348
+ rule:
349
+ any:
350
+ - kind: shorthand_property_identifier
351
+ regex: ^(lightHighContrastCssUrl|darkHighContrastCssUrl)$
352
+ - kind: pair
353
+ has:
354
+ field: key
355
+ regex: ^["']?(lightHighContrastCssUrl|darkHighContrastCssUrl)["']?$
356
+ inside:
357
+ kind: object
358
+ inside:
359
+ kind: arguments
360
+ inside:
361
+ kind: call_expression
362
+ all:
363
+ - has:
364
+ field: function
365
+ kind: identifier
366
+ pattern: $URLS
367
+ - inside:
368
+ stopBy: end
369
+ kind: program
370
+ has:
371
+ matches: style-sheet-urls-import
372
+ # Why: a parameter or a local under the import's name shadows it, and the
373
+ # rules cannot tell which binding the element reads.
374
+ - not:
375
+ inside:
376
+ stopBy: end
377
+ matches: scope
378
+ has:
379
+ stopBy:
380
+ matches: scope
381
+ any:
382
+ - matches: binding-name
383
+ pattern: $URLS
384
+ - matches: function-declaration
385
+ has:
386
+ field: name
387
+ pattern: $URLS
388
+ fix:
389
+ template: ""
390
+ expandEnd: { regex: "^,$" }
391
+ ---
392
+ id: high-contrast-stylesheet-import
393
+ language: tsx
394
+ message: the high-contrast stylesheets are gone
395
+ utils:
396
+ # A node that opens a lexical scope. The shadow search below stops at a
397
+ # nested one, so a sibling function's local name does not count.
398
+ scope:
399
+ any:
400
+ - kind: statement_block
401
+ - kind: function_declaration
402
+ - kind: generator_function_declaration
403
+ - kind: function_expression
404
+ - kind: generator_function
405
+ - kind: arrow_function
406
+ - kind: method_definition
407
+ - kind: class_body
408
+ - kind: for_statement
409
+ - kind: for_in_statement
410
+ - kind: catch_clause
411
+ # An identifier in a binding position: a parameter, a destructured name, a
412
+ # local variable, a function name, or a class name.
413
+ binding-name:
414
+ any:
415
+ - kind: shorthand_property_identifier_pattern
416
+ - kind: identifier
417
+ any:
418
+ - inside: { kind: variable_declarator, field: name }
419
+ - inside: { kind: function_declaration, field: name }
420
+ - inside: { kind: generator_function_declaration, field: name }
421
+ - inside: { kind: function_expression, field: name }
422
+ - inside: { kind: required_parameter, field: pattern }
423
+ - inside: { kind: optional_parameter, field: pattern }
424
+ - inside: { kind: assignment_pattern, field: left }
425
+ - inside: { kind: pair_pattern, field: value }
426
+ - inside: { kind: array_pattern }
427
+ - inside: { kind: rest_pattern }
428
+ - inside: { kind: arrow_function, field: parameter }
429
+ - inside: { kind: catch_clause, field: parameter }
430
+ - kind: type_identifier
431
+ inside: { kind: class_declaration, field: name }
432
+ # A function declaration opens a scope, so the search above stops at it and
433
+ # never reads its name. This matches the declaration itself instead.
434
+ function-declaration:
435
+ any:
436
+ - kind: function_declaration
437
+ - kind: generator_function_declaration
438
+ style-sheet-urls-import:
439
+ kind: import_statement
440
+ all:
441
+ - has:
442
+ field: source
443
+ regex: ^["']@ngrok/mantle/theme["']$
444
+ - has:
445
+ stopBy: end
446
+ kind: import_specifier
447
+ has:
448
+ field: name
449
+ regex: ^mantleStyleSheetUrls$
450
+ any:
451
+ - kind: import_specifier
452
+ has:
453
+ field: alias
454
+ pattern: $URLS
455
+ - kind: import_specifier
456
+ not:
457
+ has:
458
+ field: alias
459
+ kind: identifier
460
+ has:
461
+ field: name
462
+ pattern: $URLS
463
+ mantle-style-sheets-import:
464
+ kind: import_statement
465
+ all:
466
+ - has:
467
+ field: source
468
+ regex: ^["']@ngrok/mantle/theme["']$
469
+ - has:
470
+ stopBy: end
471
+ kind: import_specifier
472
+ has:
473
+ field: name
474
+ regex: ^MantleStyleSheets$
475
+ any:
476
+ - kind: import_specifier
477
+ has:
478
+ field: alias
479
+ pattern: $SHEETS
480
+ - kind: import_specifier
481
+ not:
482
+ has:
483
+ field: alias
484
+ kind: identifier
485
+ has:
486
+ field: name
487
+ pattern: $SHEETS
488
+ # An element of mantle's `MantleStyleSheets`.
489
+ mantle-style-sheets-element:
490
+ any:
491
+ - kind: jsx_opening_element
492
+ - kind: jsx_self_closing_element
493
+ all:
494
+ - has:
495
+ field: name
496
+ kind: identifier
497
+ pattern: $SHEETS
498
+ - inside:
499
+ stopBy: end
500
+ kind: program
501
+ has:
502
+ matches: mantle-style-sheets-import
503
+ - not:
504
+ inside:
505
+ stopBy: end
506
+ matches: scope
507
+ has:
508
+ stopBy:
509
+ matches: scope
510
+ any:
511
+ - matches: binding-name
512
+ pattern: $SHEETS
513
+ - matches: function-declaration
514
+ has:
515
+ field: name
516
+ pattern: $SHEETS
517
+ # The object passed to a mantle `mantleStyleSheetUrls` call.
518
+ style-sheet-urls-object:
519
+ kind: object
520
+ inside:
521
+ kind: arguments
522
+ inside:
523
+ kind: call_expression
524
+ all:
525
+ - has:
526
+ field: function
527
+ kind: identifier
528
+ pattern: $URLS
529
+ - inside:
530
+ stopBy: end
531
+ kind: program
532
+ has:
533
+ matches: style-sheet-urls-import
534
+ # Why: a parameter or a local under the import's name shadows it, and the
535
+ # rules cannot tell which binding the element reads.
536
+ - not:
537
+ inside:
538
+ stopBy: end
539
+ matches: scope
540
+ has:
541
+ stopBy:
542
+ matches: scope
543
+ any:
544
+ - matches: binding-name
545
+ pattern: $URLS
546
+ - matches: function-declaration
547
+ has:
548
+ field: name
549
+ pattern: $URLS
550
+ # A reference the key rule deletes with its key.
551
+ deleted-reference:
552
+ any:
553
+ - kind: shorthand_property_identifier
554
+ regex: ^(lightHighContrastCssUrl|darkHighContrastCssUrl)$
555
+ inside: { matches: style-sheet-urls-object }
556
+ - kind: identifier
557
+ inside:
558
+ kind: pair
559
+ field: value
560
+ all:
561
+ - has:
562
+ field: key
563
+ regex: ^["']?(lightHighContrastCssUrl|darkHighContrastCssUrl)["']?$
564
+ - inside: { matches: style-sheet-urls-object }
565
+ - kind: identifier
566
+ inside:
567
+ kind: jsx_expression
568
+ inside:
569
+ kind: jsx_attribute
570
+ all:
571
+ - has:
572
+ kind: property_identifier
573
+ regex: ^(lightHighContrastCssUrl|darkHighContrastCssUrl)$
574
+ - inside: { matches: mantle-style-sheets-element }
575
+ rule:
576
+ kind: import_statement
577
+ all:
578
+ - has:
579
+ field: source
580
+ regex: ^["']@ngrok/mantle/mantle-(light|dark)-high-contrast\.css(\?url)?["']$
581
+ # Why: deleting a binding that other code still reads leaves an undefined
582
+ # name. That import stays, and its missing module flags the manual work.
583
+ - any:
584
+ - not:
585
+ has: { kind: import_clause }
586
+ - all:
587
+ - has:
588
+ kind: import_clause
589
+ has: { kind: identifier, pattern: $NAME }
590
+ - not:
591
+ inside:
592
+ stopBy: end
593
+ kind: program
594
+ has:
595
+ stopBy: end
596
+ any:
597
+ - kind: identifier
598
+ - kind: shorthand_property_identifier
599
+ pattern: $NAME
600
+ not:
601
+ any:
602
+ - inside: { stopBy: end, kind: import_statement }
603
+ - matches: deleted-reference
604
+ fix: ""
605
+ ---
606
+ id: mantle-style-sheet-urls-high-contrast-keys
607
+ language: typescript
608
+ message: mantleStyleSheetUrls takes only darkCssUrl
609
+ utils:
610
+ # A node that opens a lexical scope. The shadow search below stops at a
611
+ # nested one, so a sibling function's local name does not count.
612
+ scope:
613
+ any:
614
+ - kind: statement_block
615
+ - kind: function_declaration
616
+ - kind: generator_function_declaration
617
+ - kind: function_expression
618
+ - kind: generator_function
619
+ - kind: arrow_function
620
+ - kind: method_definition
621
+ - kind: class_body
622
+ - kind: for_statement
623
+ - kind: for_in_statement
624
+ - kind: catch_clause
625
+ # An identifier in a binding position: a parameter, a destructured name, a
626
+ # local variable, a function name, or a class name.
627
+ binding-name:
628
+ any:
629
+ - kind: shorthand_property_identifier_pattern
630
+ - kind: identifier
631
+ any:
632
+ - inside: { kind: variable_declarator, field: name }
633
+ - inside: { kind: function_declaration, field: name }
634
+ - inside: { kind: generator_function_declaration, field: name }
635
+ - inside: { kind: function_expression, field: name }
636
+ - inside: { kind: required_parameter, field: pattern }
637
+ - inside: { kind: optional_parameter, field: pattern }
638
+ - inside: { kind: assignment_pattern, field: left }
639
+ - inside: { kind: pair_pattern, field: value }
640
+ - inside: { kind: array_pattern }
641
+ - inside: { kind: rest_pattern }
642
+ - inside: { kind: arrow_function, field: parameter }
643
+ - inside: { kind: catch_clause, field: parameter }
644
+ - kind: type_identifier
645
+ inside: { kind: class_declaration, field: name }
646
+ # A function declaration opens a scope, so the search above stops at it and
647
+ # never reads its name. This matches the declaration itself instead.
648
+ function-declaration:
649
+ any:
650
+ - kind: function_declaration
651
+ - kind: generator_function_declaration
652
+ style-sheet-urls-import:
653
+ kind: import_statement
654
+ all:
655
+ - has:
656
+ field: source
657
+ regex: ^["']@ngrok/mantle/theme["']$
658
+ - has:
659
+ stopBy: end
660
+ kind: import_specifier
661
+ has:
662
+ field: name
663
+ regex: ^mantleStyleSheetUrls$
664
+ any:
665
+ - kind: import_specifier
666
+ has:
667
+ field: alias
668
+ pattern: $URLS
669
+ - kind: import_specifier
670
+ not:
671
+ has:
672
+ field: alias
673
+ kind: identifier
674
+ has:
675
+ field: name
676
+ pattern: $URLS
677
+ rule:
678
+ any:
679
+ - kind: shorthand_property_identifier
680
+ regex: ^(lightHighContrastCssUrl|darkHighContrastCssUrl)$
681
+ - kind: pair
682
+ has:
683
+ field: key
684
+ regex: ^["']?(lightHighContrastCssUrl|darkHighContrastCssUrl)["']?$
685
+ inside:
686
+ kind: object
687
+ inside:
688
+ kind: arguments
689
+ inside:
690
+ kind: call_expression
691
+ all:
692
+ - has:
693
+ field: function
694
+ kind: identifier
695
+ pattern: $URLS
696
+ - inside:
697
+ stopBy: end
698
+ kind: program
699
+ has:
700
+ matches: style-sheet-urls-import
701
+ # Why: a parameter or a local under the import's name shadows it, and the
702
+ # rules cannot tell which binding the element reads.
703
+ - not:
704
+ inside:
705
+ stopBy: end
706
+ matches: scope
707
+ has:
708
+ stopBy:
709
+ matches: scope
710
+ any:
711
+ - matches: binding-name
712
+ pattern: $URLS
713
+ - matches: function-declaration
714
+ has:
715
+ field: name
716
+ pattern: $URLS
717
+ fix:
718
+ template: ""
719
+ expandEnd: { regex: "^,$" }
720
+ ---
721
+ id: high-contrast-stylesheet-import
722
+ language: typescript
723
+ message: the high-contrast stylesheets are gone
724
+ utils:
725
+ # A node that opens a lexical scope. The shadow search below stops at a
726
+ # nested one, so a sibling function's local name does not count.
727
+ scope:
728
+ any:
729
+ - kind: statement_block
730
+ - kind: function_declaration
731
+ - kind: generator_function_declaration
732
+ - kind: function_expression
733
+ - kind: generator_function
734
+ - kind: arrow_function
735
+ - kind: method_definition
736
+ - kind: class_body
737
+ - kind: for_statement
738
+ - kind: for_in_statement
739
+ - kind: catch_clause
740
+ # An identifier in a binding position: a parameter, a destructured name, a
741
+ # local variable, a function name, or a class name.
742
+ binding-name:
743
+ any:
744
+ - kind: shorthand_property_identifier_pattern
745
+ - kind: identifier
746
+ any:
747
+ - inside: { kind: variable_declarator, field: name }
748
+ - inside: { kind: function_declaration, field: name }
749
+ - inside: { kind: generator_function_declaration, field: name }
750
+ - inside: { kind: function_expression, field: name }
751
+ - inside: { kind: required_parameter, field: pattern }
752
+ - inside: { kind: optional_parameter, field: pattern }
753
+ - inside: { kind: assignment_pattern, field: left }
754
+ - inside: { kind: pair_pattern, field: value }
755
+ - inside: { kind: array_pattern }
756
+ - inside: { kind: rest_pattern }
757
+ - inside: { kind: arrow_function, field: parameter }
758
+ - inside: { kind: catch_clause, field: parameter }
759
+ - kind: type_identifier
760
+ inside: { kind: class_declaration, field: name }
761
+ # A function declaration opens a scope, so the search above stops at it and
762
+ # never reads its name. This matches the declaration itself instead.
763
+ function-declaration:
764
+ any:
765
+ - kind: function_declaration
766
+ - kind: generator_function_declaration
767
+ style-sheet-urls-import:
768
+ kind: import_statement
769
+ all:
770
+ - has:
771
+ field: source
772
+ regex: ^["']@ngrok/mantle/theme["']$
773
+ - has:
774
+ stopBy: end
775
+ kind: import_specifier
776
+ has:
777
+ field: name
778
+ regex: ^mantleStyleSheetUrls$
779
+ any:
780
+ - kind: import_specifier
781
+ has:
782
+ field: alias
783
+ pattern: $URLS
784
+ - kind: import_specifier
785
+ not:
786
+ has:
787
+ field: alias
788
+ kind: identifier
789
+ has:
790
+ field: name
791
+ pattern: $URLS
792
+ # The object passed to a mantle `mantleStyleSheetUrls` call.
793
+ style-sheet-urls-object:
794
+ kind: object
795
+ inside:
796
+ kind: arguments
797
+ inside:
798
+ kind: call_expression
799
+ all:
800
+ - has:
801
+ field: function
802
+ kind: identifier
803
+ pattern: $URLS
804
+ - inside:
805
+ stopBy: end
806
+ kind: program
807
+ has:
808
+ matches: style-sheet-urls-import
809
+ # Why: a parameter or a local under the import's name shadows it, and the
810
+ # rules cannot tell which binding the element reads.
811
+ - not:
812
+ inside:
813
+ stopBy: end
814
+ matches: scope
815
+ has:
816
+ stopBy:
817
+ matches: scope
818
+ any:
819
+ - matches: binding-name
820
+ pattern: $URLS
821
+ - matches: function-declaration
822
+ has:
823
+ field: name
824
+ pattern: $URLS
825
+ # A reference the key rule deletes with its key.
826
+ deleted-reference:
827
+ any:
828
+ - kind: shorthand_property_identifier
829
+ regex: ^(lightHighContrastCssUrl|darkHighContrastCssUrl)$
830
+ inside: { matches: style-sheet-urls-object }
831
+ - kind: identifier
832
+ inside:
833
+ kind: pair
834
+ field: value
835
+ all:
836
+ - has:
837
+ field: key
838
+ regex: ^["']?(lightHighContrastCssUrl|darkHighContrastCssUrl)["']?$
839
+ - inside: { matches: style-sheet-urls-object }
840
+ rule:
841
+ kind: import_statement
842
+ all:
843
+ - has:
844
+ field: source
845
+ regex: ^["']@ngrok/mantle/mantle-(light|dark)-high-contrast\.css(\?url)?["']$
846
+ # Why: deleting a binding that other code still reads leaves an undefined
847
+ # name. That import stays, and its missing module flags the manual work.
848
+ - any:
849
+ - not:
850
+ has: { kind: import_clause }
851
+ - all:
852
+ - has:
853
+ kind: import_clause
854
+ has: { kind: identifier, pattern: $NAME }
855
+ - not:
856
+ inside:
857
+ stopBy: end
858
+ kind: program
859
+ has:
860
+ stopBy: end
861
+ any:
862
+ - kind: identifier
863
+ - kind: shorthand_property_identifier
864
+ pattern: $NAME
865
+ not:
866
+ any:
867
+ - inside: { stopBy: end, kind: import_statement }
868
+ - matches: deleted-reference
869
+ fix: ""