@ngrok/mantle 0.93.7 → 0.94.1

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 (311) hide show
  1. package/README.md +11 -2
  2. package/dist/accordion.d.ts +73 -21
  3. package/dist/accordion.js +1 -1
  4. package/dist/agent.json +1234 -84
  5. package/dist/alert-BkJHDx9X.js +1 -0
  6. package/dist/{alert-BcSBNR3S.d.ts → alert-D0zRRUHV.d.ts} +35 -25
  7. package/dist/alert-center.d.ts +67 -55
  8. package/dist/alert-center.js +1 -1
  9. package/dist/alert-dialog.d.ts +35 -10
  10. package/dist/alert-dialog.js +1 -1
  11. package/dist/alert.d.ts +6 -1
  12. package/dist/alert.js +1 -1
  13. package/dist/anchor-Dc6IgvXV.js +1 -0
  14. package/dist/anchor.d.ts +17 -5
  15. package/dist/anchor.js +1 -1
  16. package/dist/app-layout.d.ts +33 -18
  17. package/dist/app-layout.js +1 -1
  18. package/dist/area-chart.d.ts +153 -97
  19. package/dist/area-chart.js +1 -1
  20. package/dist/avatar.d.ts +36 -24
  21. package/dist/avatar.js +1 -1
  22. package/dist/badge.d.ts +19 -7
  23. package/dist/badge.js +1 -1
  24. package/dist/bar-chart.d.ts +155 -100
  25. package/dist/bar-chart.js +1 -1
  26. package/dist/breadcrumb.d.ts +47 -36
  27. package/dist/breadcrumb.js +1 -1
  28. package/dist/browser-only-CZfkNw5A.js +1 -0
  29. package/dist/browser-only-ymFoM3Ya.js +1 -0
  30. package/dist/browser-only.d.ts +8 -0
  31. package/dist/browser-only.js +1 -1
  32. package/dist/{button-BX-4lYUn.d.ts → button-5Pc7Mby_.d.ts} +4 -4
  33. package/dist/button-B9bChDgl.js +1 -0
  34. package/dist/button-D8jixIbH.js +1 -0
  35. package/dist/button-DNLTJ32M.js +1 -0
  36. package/dist/{button-CPsKGDK0.d.ts → button-Ddj6yr10.d.ts} +34 -27
  37. package/dist/{button-Yxyu1XMd.d.ts → button-DnYv7IOT.d.ts} +29 -22
  38. package/dist/button.d.ts +9 -3
  39. package/dist/button.js +1 -1
  40. package/dist/calendar.d.ts +8 -1
  41. package/dist/calendar.js +1 -1
  42. package/dist/card.d.ts +7 -2
  43. package/dist/card.js +1 -1
  44. package/dist/centered-layout.d.ts +34 -23
  45. package/dist/centered-layout.js +1 -1
  46. package/dist/chart-BLCqzt56.js +1 -0
  47. package/dist/chart-CChZiCrt.js +1 -0
  48. package/dist/chart-CUmSu9d7.js +1 -0
  49. package/dist/{chart-BpfbtOUN.d.ts → chart-Dl8gFo_D.d.ts} +117 -121
  50. package/dist/chart-DtgZBAas.js +2 -0
  51. package/dist/checkbox-Cu5cgZmk.js +1 -0
  52. package/dist/checkbox.d.ts +15 -2
  53. package/dist/checkbox.js +1 -1
  54. package/dist/choice-CCVG2hb9.js +1 -0
  55. package/dist/{choice-BLR0_MeB.d.ts → choice-CNiOSzqV.d.ts} +26 -20
  56. package/dist/choice.d.ts +6 -1
  57. package/dist/choice.js +1 -1
  58. package/dist/code-BPKNY1_w.js +1 -0
  59. package/dist/{code-block-BGdV4Yty.d.ts → code-block-BDw6MEwH.d.ts} +9 -9
  60. package/dist/{code-block-W3kWPxCJ.js → code-block-CKzsAMzj.js} +3 -3
  61. package/dist/code-block.d.ts +28 -19
  62. package/dist/code-block.js +1 -1
  63. package/dist/code-block_highlight-utils.d.ts +6 -1
  64. package/dist/code-block_highlight-utils.js +1 -1
  65. package/dist/code.d.ts +16 -3
  66. package/dist/code.js +1 -1
  67. package/dist/color-CHZbU1Ww.js +1 -0
  68. package/dist/color.js +1 -1
  69. package/dist/combobox.d.ts +42 -28
  70. package/dist/combobox.js +1 -1
  71. package/dist/command.d.ts +59 -47
  72. package/dist/command.js +1 -1
  73. package/dist/compose-refs-BdRUneoc.js +1 -0
  74. package/dist/{copy-to-clipboard-DInu78k_.js → copy-to-clipboard-Dd83caRw.js} +1 -1
  75. package/dist/cx.d.ts +4 -4
  76. package/dist/cx.js +1 -1
  77. package/dist/{data-slot-B-LqAcBB.d.ts → data-slot-BW8KQ9Xo.d.ts} +2 -2
  78. package/dist/data-table.d.ts +83 -52
  79. package/dist/data-table.js +1 -1
  80. package/dist/description-list.d.ts +13 -2
  81. package/dist/description-list.js +1 -1
  82. package/dist/{dialog-2fRO4ca4.d.ts → dialog-CIEuwNys.d.ts} +32 -8
  83. package/dist/dialog-CbEEA0fl.d.ts +32 -0
  84. package/dist/dialog-DmzoDfY3.js +1 -0
  85. package/dist/dialog.d.ts +7 -2
  86. package/dist/dialog.js +1 -1
  87. package/dist/{dropdown-menu-CpjRwMWe.d.ts → dropdown-menu-CeY498yk.d.ts} +41 -33
  88. package/dist/dropdown-menu-uheL0prz.js +1 -0
  89. package/dist/dropdown-menu.d.ts +6 -1
  90. package/dist/dropdown-menu.js +1 -1
  91. package/dist/empty.d.ts +7 -2
  92. package/dist/empty.js +1 -1
  93. package/dist/field-Bpvn4tQp.js +1 -0
  94. package/dist/{field-V_gnkcmN.d.ts → field-BshcNVe_.d.ts} +1 -1
  95. package/dist/field-Cai_4c1l.js +1 -0
  96. package/dist/field.d.ts +53 -42
  97. package/dist/field.js +1 -1
  98. package/dist/flag.d.ts +11 -3
  99. package/dist/flag.js +1 -1
  100. package/dist/hooks.d.ts +35 -10
  101. package/dist/hooks.js +1 -1
  102. package/dist/hover-card.d.ts +25 -14
  103. package/dist/hover-card.js +1 -1
  104. package/dist/{icon-CgNqu-fl.d.ts → icon--purqHRo.d.ts} +1 -1
  105. package/dist/{icon-ByLVhdYq.d.ts → icon-DuIYoyft.d.ts} +8 -2
  106. package/dist/{icon-DXDyhy2N.d.ts → icon-QCm1ui29.d.ts} +2 -2
  107. package/dist/icon-xb7d9M7X.js +1 -0
  108. package/dist/icon.d.ts +8 -3
  109. package/dist/icon.js +1 -1
  110. package/dist/icons-DEDCLZ8B.js +1 -0
  111. package/dist/icons-DXadFwpo.js +1 -0
  112. package/dist/icons-DcesO4Ng.js +1 -0
  113. package/dist/icons.d.ts +13 -1
  114. package/dist/icons.js +1 -1
  115. package/dist/{in-view-B3nMAzfE.d.ts → in-view-C_daNafg.d.ts} +4 -23
  116. package/dist/{index-BhfgyurF.d.ts → index-KJ06KK6t.d.ts} +3 -3
  117. package/dist/input-BjCDSOPA.js +1 -0
  118. package/dist/{input-Dx5owTCc.d.ts → input-DC4nW0Sr.d.ts} +12 -2
  119. package/dist/input-fW8QSZEO.js +1 -0
  120. package/dist/input.d.ts +37 -5
  121. package/dist/input.js +1 -1
  122. package/dist/kbd-P1nQshWo.js +1 -0
  123. package/dist/kbd.d.ts +17 -5
  124. package/dist/kbd.js +1 -1
  125. package/dist/label-DO1RlMKl.js +1 -0
  126. package/dist/{label-Dn5CPJUj.d.ts → label-epgtywRz.d.ts} +14 -8
  127. package/dist/label.d.ts +6 -1
  128. package/dist/label.js +1 -1
  129. package/dist/layer-container-DL4yclOu.js +1 -0
  130. package/dist/layer-container.d.ts +2 -2
  131. package/dist/layer-container.js +1 -1
  132. package/dist/line-chart.d.ts +147 -90
  133. package/dist/line-chart.js +1 -1
  134. package/dist/list-cQZPSjfz.js +1 -0
  135. package/dist/list.d.ts +34 -16
  136. package/dist/list.js +1 -1
  137. package/dist/live-region-Dhapu8a5.js +1 -0
  138. package/dist/live-region.d.ts +15 -2
  139. package/dist/live-region.js +1 -1
  140. package/dist/llms.txt +82 -79
  141. package/dist/main-CHyWYDak.js +1 -0
  142. package/dist/main.d.ts +13 -1
  143. package/dist/main.js +1 -1
  144. package/dist/mantle.css +133 -88
  145. package/dist/media-object.d.ts +16 -4
  146. package/dist/media-object.js +1 -1
  147. package/dist/migrations/0014-chart-named-colors.yml +1389 -0
  148. package/dist/migrations/0015-segmented-control.yml +788 -0
  149. package/dist/multi-select.d.ts +42 -29
  150. package/dist/multi-select.js +1 -1
  151. package/dist/otp-input.d.ts +20 -8
  152. package/dist/otp-input.js +1 -1
  153. package/dist/pagination.d.ts +93 -4
  154. package/dist/pagination.js +1 -1
  155. package/dist/{popover-BfB2I9G0.d.ts → popover-Bei0jyfH.d.ts} +87 -12
  156. package/dist/popover-DhgunktK.js +1 -0
  157. package/dist/popover-T2EyaqGK.d.ts +1 -0
  158. package/dist/popover.d.ts +7 -2
  159. package/dist/popover.js +1 -1
  160. package/dist/primitive-D8CzV_Ft.js +1 -0
  161. package/dist/progress.d.ts +28 -11
  162. package/dist/progress.js +1 -1
  163. package/dist/qr-code.d.ts +11 -3
  164. package/dist/qr-code.js +1 -1
  165. package/dist/query-filter.d.ts +6 -6
  166. package/dist/query.d.ts +9 -4
  167. package/dist/query.js +1 -1
  168. package/dist/radio-group-BJQ6EOqh.d.ts +27 -0
  169. package/dist/radio-group-BliblUqe.js +1 -0
  170. package/dist/radio-group-ggEkCi0V.js +1 -0
  171. package/dist/radio-group.d.ts +21 -100
  172. package/dist/radio-group.js +1 -1
  173. package/dist/sandbar.d.ts +43 -30
  174. package/dist/sandbar.js +1 -1
  175. package/dist/sandboxed-on-click-D4PL5_GR.js +1 -0
  176. package/dist/sandboxed-on-click.d.ts +8 -0
  177. package/dist/sandboxed-on-click.js +1 -1
  178. package/dist/scatter-plot.d.ts +137 -76
  179. package/dist/scatter-plot.js +1 -1
  180. package/dist/segmented-control.d.ts +136 -0
  181. package/dist/segmented-control.js +1 -0
  182. package/dist/select-1xuUx_os.js +1 -0
  183. package/dist/{select-BkhBxtOT.d.ts → select-BpaXHxJm.d.ts} +33 -25
  184. package/dist/select.d.ts +6 -1
  185. package/dist/select.js +1 -1
  186. package/dist/selectable-list.d.ts +29 -18
  187. package/dist/selectable-list.js +1 -1
  188. package/dist/{separator-D9AWEkcJ.d.ts → separator-Ck4sPrdN.d.ts} +4 -2
  189. package/dist/separator-DnvhwY2J.js +1 -0
  190. package/dist/separator.d.ts +6 -1
  191. package/dist/separator.js +1 -1
  192. package/dist/{shake-DL6WhMXM.js → shake-CAUpKBHe.js} +1 -1
  193. package/dist/sheet-DHy_vlme.js +1 -0
  194. package/dist/sheet.d.ts +36 -7
  195. package/dist/sheet.js +1 -1
  196. package/dist/sidebar.d.ts +53 -37
  197. package/dist/sidebar.js +1 -1
  198. package/dist/skeleton-DHfyjuQi.js +1 -0
  199. package/dist/skeleton.d.ts +15 -4
  200. package/dist/skeleton.js +1 -1
  201. package/dist/skip-to-main-link.d.ts +12 -1
  202. package/dist/skip-to-main-link.js +1 -1
  203. package/dist/slider.d.ts +11 -1
  204. package/dist/slider.js +1 -1
  205. package/dist/slot-B7rwscwd.js +1 -0
  206. package/dist/{slot-C0OCJjdJ.d.ts → slot-BEMQMbk3.d.ts} +6 -4
  207. package/dist/slot.d.ts +6 -1
  208. package/dist/slot.js +1 -1
  209. package/dist/source-all.css +5 -1
  210. package/dist/split-button.d.ts +20 -9
  211. package/dist/split-button.js +1 -1
  212. package/dist/strata.d.ts +35 -22
  213. package/dist/strata.js +1 -1
  214. package/dist/{suggestions-NkqYTT49.d.ts → suggestions-BJeGvwDa.d.ts} +7 -7
  215. package/dist/switch.d.ts +14 -2
  216. package/dist/switch.js +1 -1
  217. package/dist/table-BnLdXUai.js +1 -0
  218. package/dist/{table-vT6Okwfa.d.ts → table-Ii9hHUWN.d.ts} +84 -5
  219. package/dist/table.d.ts +6 -1
  220. package/dist/table.js +1 -1
  221. package/dist/tabs.d.ts +24 -12
  222. package/dist/tabs.js +1 -1
  223. package/dist/text-area.d.ts +12 -2
  224. package/dist/text-area.js +1 -1
  225. package/dist/theme-BNdZl352.js +1 -0
  226. package/dist/theme-switcher.d.ts +18 -4
  227. package/dist/theme-switcher.js +1 -1
  228. package/dist/theme.d.ts +25 -11
  229. package/dist/theme.js +1 -1
  230. package/dist/toast.d.ts +15 -2
  231. package/dist/toast.js +1 -1
  232. package/dist/tokens.dark.json +3261 -0
  233. package/dist/tokens.json +4933 -0
  234. package/dist/tokens.resolver.json +37 -0
  235. package/dist/{tooltip-NcLIeBy5.d.ts → tooltip-CstGDKwy.d.ts} +18 -11
  236. package/dist/tooltip-DQO40Mrq.js +1 -0
  237. package/dist/tooltip.d.ts +6 -1
  238. package/dist/tooltip.js +1 -1
  239. package/dist/truncated-text.d.ts +28 -14
  240. package/dist/truncated-text.js +1 -1
  241. package/dist/types.d.ts +1 -1
  242. package/dist/types.js +1 -1
  243. package/dist/use-breakpoint-B4Kh0xE6.js +1 -0
  244. package/dist/use-callback-ref-DiOXFQzM.js +1 -0
  245. package/dist/use-composed-refs-DPYmLDSe.js +1 -0
  246. package/dist/use-copy-to-clipboard-hBL6_65i.js +1 -0
  247. package/dist/use-inert-siblings-C4RHXrZc.js +1 -0
  248. package/dist/use-is-apple-platform-Bq6_KbVX.js +1 -0
  249. package/dist/use-is-hydrated-BeLOGKwE.js +1 -0
  250. package/dist/use-is-hydrated-after-paint-CrHt3OHw.js +1 -0
  251. package/dist/use-isomorphic-layout-effect-CL6iq0Bj.js +1 -0
  252. package/dist/use-matches-media-query-FfvtNKQe.js +1 -0
  253. package/dist/use-prefers-reduced-motion-Ck6dnOM9.js +1 -0
  254. package/dist/use-swipe-to-dismiss-BYdlca8r.js +1 -0
  255. package/dist/utils.d.ts +1 -1
  256. package/dist/utils.js +1 -1
  257. package/dist/visually-hidden.d.ts +14 -1
  258. package/dist/visually-hidden.js +1 -1
  259. package/dist/well.d.ts +7 -2
  260. package/dist/well.js +1 -1
  261. package/package.json +21 -7
  262. package/src/components/chart/d3-license.md +25 -0
  263. package/dist/alert-P9lwn25X.js +0 -1
  264. package/dist/anchor-CgcbWEUs.js +0 -1
  265. package/dist/browser-only-BTSrYWLj.js +0 -1
  266. package/dist/button-69InNC_m.js +0 -1
  267. package/dist/button-B8k98Pby.js +0 -1
  268. package/dist/button-Dge0D5bl.js +0 -1
  269. package/dist/chart-BpWfQAwf.js +0 -2
  270. package/dist/checkbox-DmSQXs26.js +0 -1
  271. package/dist/choice-2Lrv8_nl.js +0 -1
  272. package/dist/code-DUJzSl4K.js +0 -1
  273. package/dist/compose-refs-sFdxsL7k.js +0 -1
  274. package/dist/dialog-7TUgiSzX.js +0 -1
  275. package/dist/dialog-Dp0QGWwo.d.ts +0 -28
  276. package/dist/dropdown-menu-BHBzCDSZ.js +0 -1
  277. package/dist/field-Bihblt8U.js +0 -1
  278. package/dist/field-CPvjazWN.js +0 -1
  279. package/dist/icon-kK0c-POG.js +0 -1
  280. package/dist/icons-CDLz5lpI.js +0 -1
  281. package/dist/icons-CSwTVV2m.js +0 -1
  282. package/dist/icons-DP3lQw5O.js +0 -1
  283. package/dist/input-CpQ6jlpI.js +0 -1
  284. package/dist/kbd-CLHsJ99p.js +0 -1
  285. package/dist/label-nHqqYS7e.js +0 -1
  286. package/dist/layer-container-kEQiE4zV.js +0 -1
  287. package/dist/list-RFRIQxU2.js +0 -1
  288. package/dist/live-region-DQ1QLv3L.js +0 -1
  289. package/dist/main-CC1L9IsH.js +0 -1
  290. package/dist/popover-C96V8SXi.d.ts +0 -1
  291. package/dist/popover-DxOqLKxy.js +0 -1
  292. package/dist/primitive-Dz9Al-us.js +0 -1
  293. package/dist/radio-group-HDVxTNPi.js +0 -1
  294. package/dist/sandboxed-on-click-C7pPu-2M.js +0 -1
  295. package/dist/select-CAAYk4Yj.js +0 -1
  296. package/dist/separator-DfzxVutO.js +0 -1
  297. package/dist/sheet-CSJc_sB4.js +0 -1
  298. package/dist/skeleton-DBpI-ko5.js +0 -1
  299. package/dist/slot-DdYN1L1C.js +0 -1
  300. package/dist/table-CFHiDBW8.js +0 -1
  301. package/dist/theme-C-glc5Q-.js +0 -1
  302. package/dist/tooltip-b6oiTaWq.js +0 -1
  303. package/dist/use-breakpoint--mo7kr9d.js +0 -1
  304. package/dist/use-callback-ref-BvVyI5K1.js +0 -1
  305. package/dist/use-copy-to-clipboard-Dy_0Qzb7.js +0 -1
  306. package/dist/use-is-apple-platform-D4nifHMx.js +0 -1
  307. package/dist/use-is-hydrated-after-paint-r9Cl2mGp.js +0 -1
  308. package/dist/use-isomorphic-layout-effect-CLSmHzo4.js +0 -1
  309. package/dist/use-matches-media-query-m860lols.js +0 -1
  310. package/dist/use-prefers-reduced-motion-CU6mWmOe.js +0 -1
  311. package/dist/use-swipe-to-dismiss-DceYk1Id.js +0 -1
@@ -0,0 +1,788 @@
1
+ # Every rule binds $RG to the local name of the `RadioGroup` import from
2
+ # `@ngrok/mantle/radio-group`, so an aliased import matches and another
3
+ # library's `RadioGroup` does not.
4
+ id: radio-group-button-group-to-segmented-control-root
5
+ language: tsx
6
+ message: RadioGroup.ButtonGroup is SegmentedControl.Root
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
+ # The `RadioGroup` import from `@ngrok/mantle/radio-group`. It binds $RG to
51
+ # the local name, so an aliased import matches and another library's
52
+ # `RadioGroup` does not.
53
+ radio-group-import:
54
+ kind: import_statement
55
+ all:
56
+ - has:
57
+ field: source
58
+ regex: ^["']@ngrok/mantle/radio-group["']$
59
+ - has:
60
+ stopBy: end
61
+ kind: import_specifier
62
+ has:
63
+ field: name
64
+ regex: ^RadioGroup$
65
+ any:
66
+ - kind: import_specifier
67
+ has:
68
+ field: alias
69
+ pattern: $RG
70
+ - kind: import_specifier
71
+ not:
72
+ has:
73
+ field: alias
74
+ kind: identifier
75
+ has:
76
+ field: name
77
+ pattern: $RG
78
+ # A JSX tag name or a `typeof` type query, `$RG.ButtonGroup` or
79
+ # `$RG.Button`, that reads the import.
80
+ old-part-name:
81
+ kind: member_expression
82
+ all:
83
+ - has:
84
+ field: object
85
+ pattern: $RG
86
+ - has:
87
+ field: property
88
+ regex: ^(ButtonGroup|Button)$
89
+ - any:
90
+ - inside: { kind: jsx_opening_element, field: name }
91
+ - inside: { kind: jsx_closing_element, field: name }
92
+ - inside: { kind: jsx_self_closing_element, field: name }
93
+ - inside: { kind: type_query }
94
+ - inside:
95
+ stopBy: end
96
+ kind: program
97
+ has:
98
+ matches: radio-group-import
99
+ # Why: a parameter or a local under the import's name shadows it, and the
100
+ # rules cannot tell which binding the element reads.
101
+ - not:
102
+ inside:
103
+ stopBy: end
104
+ matches: scope
105
+ has:
106
+ stopBy:
107
+ matches: scope
108
+ any:
109
+ - matches: binding-name
110
+ pattern: $RG
111
+ - matches: function-declaration
112
+ has:
113
+ field: name
114
+ pattern: $RG
115
+ rule:
116
+ matches: old-part-name
117
+ has:
118
+ field: property
119
+ regex: ^ButtonGroup$
120
+ fix: SegmentedControl.Root
121
+ ---
122
+ id: radio-group-button-to-segmented-control-item
123
+ language: tsx
124
+ message: RadioGroup.Button is SegmentedControl.Item
125
+ utils:
126
+ # A node that opens a lexical scope. The shadow search below stops at a
127
+ # nested one, so a sibling function's local name does not count.
128
+ scope:
129
+ any:
130
+ - kind: statement_block
131
+ - kind: function_declaration
132
+ - kind: generator_function_declaration
133
+ - kind: function_expression
134
+ - kind: generator_function
135
+ - kind: arrow_function
136
+ - kind: method_definition
137
+ - kind: class_body
138
+ - kind: for_statement
139
+ - kind: for_in_statement
140
+ - kind: catch_clause
141
+ # An identifier in a binding position: a parameter, a destructured name, a
142
+ # local variable, a function name, or a class name.
143
+ binding-name:
144
+ any:
145
+ - kind: shorthand_property_identifier_pattern
146
+ - kind: identifier
147
+ any:
148
+ - inside: { kind: variable_declarator, field: name }
149
+ - inside: { kind: function_declaration, field: name }
150
+ - inside: { kind: generator_function_declaration, field: name }
151
+ - inside: { kind: function_expression, field: name }
152
+ - inside: { kind: required_parameter, field: pattern }
153
+ - inside: { kind: optional_parameter, field: pattern }
154
+ - inside: { kind: assignment_pattern, field: left }
155
+ - inside: { kind: pair_pattern, field: value }
156
+ - inside: { kind: array_pattern }
157
+ - inside: { kind: rest_pattern }
158
+ - inside: { kind: arrow_function, field: parameter }
159
+ - inside: { kind: catch_clause, field: parameter }
160
+ - kind: type_identifier
161
+ inside: { kind: class_declaration, field: name }
162
+ # A function declaration opens a scope, so the search above stops at it and
163
+ # never reads its name. This matches the declaration itself instead.
164
+ function-declaration:
165
+ any:
166
+ - kind: function_declaration
167
+ - kind: generator_function_declaration
168
+ # The `RadioGroup` import from `@ngrok/mantle/radio-group`. It binds $RG to
169
+ # the local name, so an aliased import matches and another library's
170
+ # `RadioGroup` does not.
171
+ radio-group-import:
172
+ kind: import_statement
173
+ all:
174
+ - has:
175
+ field: source
176
+ regex: ^["']@ngrok/mantle/radio-group["']$
177
+ - has:
178
+ stopBy: end
179
+ kind: import_specifier
180
+ has:
181
+ field: name
182
+ regex: ^RadioGroup$
183
+ any:
184
+ - kind: import_specifier
185
+ has:
186
+ field: alias
187
+ pattern: $RG
188
+ - kind: import_specifier
189
+ not:
190
+ has:
191
+ field: alias
192
+ kind: identifier
193
+ has:
194
+ field: name
195
+ pattern: $RG
196
+ # A JSX tag name or a `typeof` type query, `$RG.ButtonGroup` or
197
+ # `$RG.Button`, that reads the import.
198
+ old-part-name:
199
+ kind: member_expression
200
+ all:
201
+ - has:
202
+ field: object
203
+ pattern: $RG
204
+ - has:
205
+ field: property
206
+ regex: ^(ButtonGroup|Button)$
207
+ - any:
208
+ - inside: { kind: jsx_opening_element, field: name }
209
+ - inside: { kind: jsx_closing_element, field: name }
210
+ - inside: { kind: jsx_self_closing_element, field: name }
211
+ - inside: { kind: type_query }
212
+ - inside:
213
+ stopBy: end
214
+ kind: program
215
+ has:
216
+ matches: radio-group-import
217
+ # Why: a parameter or a local under the import's name shadows it, and the
218
+ # rules cannot tell which binding the element reads.
219
+ - not:
220
+ inside:
221
+ stopBy: end
222
+ matches: scope
223
+ has:
224
+ stopBy:
225
+ matches: scope
226
+ any:
227
+ - matches: binding-name
228
+ pattern: $RG
229
+ - matches: function-declaration
230
+ has:
231
+ field: name
232
+ pattern: $RG
233
+ rule:
234
+ matches: old-part-name
235
+ has:
236
+ field: property
237
+ regex: ^Button$
238
+ fix: SegmentedControl.Item
239
+ ---
240
+ id: add-segmented-control-import
241
+ language: tsx
242
+ message: import SegmentedControl from @ngrok/mantle/segmented-control
243
+ utils:
244
+ # A node that opens a lexical scope. The shadow search below stops at a
245
+ # nested one, so a sibling function's local name does not count.
246
+ scope:
247
+ any:
248
+ - kind: statement_block
249
+ - kind: function_declaration
250
+ - kind: generator_function_declaration
251
+ - kind: function_expression
252
+ - kind: generator_function
253
+ - kind: arrow_function
254
+ - kind: method_definition
255
+ - kind: class_body
256
+ - kind: for_statement
257
+ - kind: for_in_statement
258
+ - kind: catch_clause
259
+ # An identifier in a binding position: a parameter, a destructured name, a
260
+ # local variable, a function name, or a class name.
261
+ binding-name:
262
+ any:
263
+ - kind: shorthand_property_identifier_pattern
264
+ - kind: identifier
265
+ any:
266
+ - inside: { kind: variable_declarator, field: name }
267
+ - inside: { kind: function_declaration, field: name }
268
+ - inside: { kind: generator_function_declaration, field: name }
269
+ - inside: { kind: function_expression, field: name }
270
+ - inside: { kind: required_parameter, field: pattern }
271
+ - inside: { kind: optional_parameter, field: pattern }
272
+ - inside: { kind: assignment_pattern, field: left }
273
+ - inside: { kind: pair_pattern, field: value }
274
+ - inside: { kind: array_pattern }
275
+ - inside: { kind: rest_pattern }
276
+ - inside: { kind: arrow_function, field: parameter }
277
+ - inside: { kind: catch_clause, field: parameter }
278
+ - kind: type_identifier
279
+ inside: { kind: class_declaration, field: name }
280
+ # A function declaration opens a scope, so the search above stops at it and
281
+ # never reads its name. This matches the declaration itself instead.
282
+ function-declaration:
283
+ any:
284
+ - kind: function_declaration
285
+ - kind: generator_function_declaration
286
+ # The `RadioGroup` import from `@ngrok/mantle/radio-group`. It binds $RG to
287
+ # the local name, so an aliased import matches and another library's
288
+ # `RadioGroup` does not.
289
+ radio-group-import:
290
+ kind: import_statement
291
+ all:
292
+ - has:
293
+ field: source
294
+ regex: ^["']@ngrok/mantle/radio-group["']$
295
+ - has:
296
+ stopBy: end
297
+ kind: import_specifier
298
+ has:
299
+ field: name
300
+ regex: ^RadioGroup$
301
+ any:
302
+ - kind: import_specifier
303
+ has:
304
+ field: alias
305
+ pattern: $RG
306
+ - kind: import_specifier
307
+ not:
308
+ has:
309
+ field: alias
310
+ kind: identifier
311
+ has:
312
+ field: name
313
+ pattern: $RG
314
+ # A JSX tag name or a `typeof` type query, `$RG.ButtonGroup` or
315
+ # `$RG.Button`, that reads the import.
316
+ old-part-name:
317
+ kind: member_expression
318
+ all:
319
+ - has:
320
+ field: object
321
+ pattern: $RG
322
+ - has:
323
+ field: property
324
+ regex: ^(ButtonGroup|Button)$
325
+ - any:
326
+ - inside: { kind: jsx_opening_element, field: name }
327
+ - inside: { kind: jsx_closing_element, field: name }
328
+ - inside: { kind: jsx_self_closing_element, field: name }
329
+ - inside: { kind: type_query }
330
+ - inside:
331
+ stopBy: end
332
+ kind: program
333
+ has:
334
+ matches: radio-group-import
335
+ # Why: a parameter or a local under the import's name shadows it, and the
336
+ # rules cannot tell which binding the element reads.
337
+ - not:
338
+ inside:
339
+ stopBy: end
340
+ matches: scope
341
+ has:
342
+ stopBy:
343
+ matches: scope
344
+ any:
345
+ - matches: binding-name
346
+ pattern: $RG
347
+ - matches: function-declaration
348
+ has:
349
+ field: name
350
+ pattern: $RG
351
+ # A `@ngrok/mantle/radio-group` import, of any name.
352
+ any-radio-group-import:
353
+ kind: import_statement
354
+ has:
355
+ field: source
356
+ regex: ^["']@ngrok/mantle/radio-group["']$
357
+ # An import that supplies the name the renames write: `SegmentedControl`
358
+ # from `@ngrok/mantle/segmented-control`, with no alias. An aliased import
359
+ # does not supply it.
360
+ segmented-control-import:
361
+ kind: import_statement
362
+ all:
363
+ - has:
364
+ field: source
365
+ regex: ^["']@ngrok/mantle/segmented-control["']$
366
+ - has:
367
+ stopBy: end
368
+ kind: import_specifier
369
+ all:
370
+ - has:
371
+ field: name
372
+ regex: ^SegmentedControl$
373
+ - not:
374
+ has:
375
+ field: alias
376
+ kind: identifier
377
+ rule:
378
+ all:
379
+ - pattern: $IMPORT
380
+ # Why the first one: a file with two radio-group imports gets the new
381
+ # import once.
382
+ - matches: any-radio-group-import
383
+ - not:
384
+ follows:
385
+ stopBy: end
386
+ matches: any-radio-group-import
387
+ # A file with a part to rename gets the import. Why no $RG here: the part
388
+ # binds $RG itself, so it can read any of the file's radio-group imports.
389
+ - inside:
390
+ kind: program
391
+ all:
392
+ - has:
393
+ stopBy: end
394
+ matches: old-part-name
395
+ - not:
396
+ has:
397
+ matches: segmented-control-import
398
+ fix: |-
399
+ $IMPORT
400
+ import { SegmentedControl } from "@ngrok/mantle/segmented-control";
401
+ ---
402
+ # The same three rules for `.ts` files, with no JSX: a rule reaches only its
403
+ # own language.
404
+ id: radio-group-button-group-to-segmented-control-root
405
+ language: typescript
406
+ message: RadioGroup.ButtonGroup is SegmentedControl.Root
407
+ utils:
408
+ # A node that opens a lexical scope. The shadow search below stops at a
409
+ # nested one, so a sibling function's local name does not count.
410
+ scope:
411
+ any:
412
+ - kind: statement_block
413
+ - kind: function_declaration
414
+ - kind: generator_function_declaration
415
+ - kind: function_expression
416
+ - kind: generator_function
417
+ - kind: arrow_function
418
+ - kind: method_definition
419
+ - kind: class_body
420
+ - kind: for_statement
421
+ - kind: for_in_statement
422
+ - kind: catch_clause
423
+ # An identifier in a binding position: a parameter, a destructured name, a
424
+ # local variable, a function name, or a class name.
425
+ binding-name:
426
+ any:
427
+ - kind: shorthand_property_identifier_pattern
428
+ - kind: identifier
429
+ any:
430
+ - inside: { kind: variable_declarator, field: name }
431
+ - inside: { kind: function_declaration, field: name }
432
+ - inside: { kind: generator_function_declaration, field: name }
433
+ - inside: { kind: function_expression, field: name }
434
+ - inside: { kind: required_parameter, field: pattern }
435
+ - inside: { kind: optional_parameter, field: pattern }
436
+ - inside: { kind: assignment_pattern, field: left }
437
+ - inside: { kind: pair_pattern, field: value }
438
+ - inside: { kind: array_pattern }
439
+ - inside: { kind: rest_pattern }
440
+ - inside: { kind: arrow_function, field: parameter }
441
+ - inside: { kind: catch_clause, field: parameter }
442
+ - kind: type_identifier
443
+ inside: { kind: class_declaration, field: name }
444
+ # A function declaration opens a scope, so the search above stops at it and
445
+ # never reads its name. This matches the declaration itself instead.
446
+ function-declaration:
447
+ any:
448
+ - kind: function_declaration
449
+ - kind: generator_function_declaration
450
+ # The `RadioGroup` import from `@ngrok/mantle/radio-group`. It binds $RG to
451
+ # the local name, so an aliased import matches and another library's
452
+ # `RadioGroup` does not.
453
+ radio-group-import:
454
+ kind: import_statement
455
+ all:
456
+ - has:
457
+ field: source
458
+ regex: ^["']@ngrok/mantle/radio-group["']$
459
+ - has:
460
+ stopBy: end
461
+ kind: import_specifier
462
+ has:
463
+ field: name
464
+ regex: ^RadioGroup$
465
+ any:
466
+ - kind: import_specifier
467
+ has:
468
+ field: alias
469
+ pattern: $RG
470
+ - kind: import_specifier
471
+ not:
472
+ has:
473
+ field: alias
474
+ kind: identifier
475
+ has:
476
+ field: name
477
+ pattern: $RG
478
+ # A `typeof` type query, `$RG.ButtonGroup` or `$RG.Button`, that reads the
479
+ # import.
480
+ old-part-name:
481
+ kind: member_expression
482
+ all:
483
+ - has:
484
+ field: object
485
+ pattern: $RG
486
+ - has:
487
+ field: property
488
+ regex: ^(ButtonGroup|Button)$
489
+ - inside: { kind: type_query }
490
+ - inside:
491
+ stopBy: end
492
+ kind: program
493
+ has:
494
+ matches: radio-group-import
495
+ # Why: a parameter or a local under the import's name shadows it, and the
496
+ # rules cannot tell which binding the element reads.
497
+ - not:
498
+ inside:
499
+ stopBy: end
500
+ matches: scope
501
+ has:
502
+ stopBy:
503
+ matches: scope
504
+ any:
505
+ - matches: binding-name
506
+ pattern: $RG
507
+ - matches: function-declaration
508
+ has:
509
+ field: name
510
+ pattern: $RG
511
+ rule:
512
+ matches: old-part-name
513
+ has:
514
+ field: property
515
+ regex: ^ButtonGroup$
516
+ fix: SegmentedControl.Root
517
+ ---
518
+ id: radio-group-button-to-segmented-control-item
519
+ language: typescript
520
+ message: RadioGroup.Button is SegmentedControl.Item
521
+ utils:
522
+ # A node that opens a lexical scope. The shadow search below stops at a
523
+ # nested one, so a sibling function's local name does not count.
524
+ scope:
525
+ any:
526
+ - kind: statement_block
527
+ - kind: function_declaration
528
+ - kind: generator_function_declaration
529
+ - kind: function_expression
530
+ - kind: generator_function
531
+ - kind: arrow_function
532
+ - kind: method_definition
533
+ - kind: class_body
534
+ - kind: for_statement
535
+ - kind: for_in_statement
536
+ - kind: catch_clause
537
+ # An identifier in a binding position: a parameter, a destructured name, a
538
+ # local variable, a function name, or a class name.
539
+ binding-name:
540
+ any:
541
+ - kind: shorthand_property_identifier_pattern
542
+ - kind: identifier
543
+ any:
544
+ - inside: { kind: variable_declarator, field: name }
545
+ - inside: { kind: function_declaration, field: name }
546
+ - inside: { kind: generator_function_declaration, field: name }
547
+ - inside: { kind: function_expression, field: name }
548
+ - inside: { kind: required_parameter, field: pattern }
549
+ - inside: { kind: optional_parameter, field: pattern }
550
+ - inside: { kind: assignment_pattern, field: left }
551
+ - inside: { kind: pair_pattern, field: value }
552
+ - inside: { kind: array_pattern }
553
+ - inside: { kind: rest_pattern }
554
+ - inside: { kind: arrow_function, field: parameter }
555
+ - inside: { kind: catch_clause, field: parameter }
556
+ - kind: type_identifier
557
+ inside: { kind: class_declaration, field: name }
558
+ # A function declaration opens a scope, so the search above stops at it and
559
+ # never reads its name. This matches the declaration itself instead.
560
+ function-declaration:
561
+ any:
562
+ - kind: function_declaration
563
+ - kind: generator_function_declaration
564
+ # The `RadioGroup` import from `@ngrok/mantle/radio-group`. It binds $RG to
565
+ # the local name, so an aliased import matches and another library's
566
+ # `RadioGroup` does not.
567
+ radio-group-import:
568
+ kind: import_statement
569
+ all:
570
+ - has:
571
+ field: source
572
+ regex: ^["']@ngrok/mantle/radio-group["']$
573
+ - has:
574
+ stopBy: end
575
+ kind: import_specifier
576
+ has:
577
+ field: name
578
+ regex: ^RadioGroup$
579
+ any:
580
+ - kind: import_specifier
581
+ has:
582
+ field: alias
583
+ pattern: $RG
584
+ - kind: import_specifier
585
+ not:
586
+ has:
587
+ field: alias
588
+ kind: identifier
589
+ has:
590
+ field: name
591
+ pattern: $RG
592
+ # A `typeof` type query, `$RG.ButtonGroup` or `$RG.Button`, that reads the
593
+ # import.
594
+ old-part-name:
595
+ kind: member_expression
596
+ all:
597
+ - has:
598
+ field: object
599
+ pattern: $RG
600
+ - has:
601
+ field: property
602
+ regex: ^(ButtonGroup|Button)$
603
+ - inside: { kind: type_query }
604
+ - inside:
605
+ stopBy: end
606
+ kind: program
607
+ has:
608
+ matches: radio-group-import
609
+ # Why: a parameter or a local under the import's name shadows it, and the
610
+ # rules cannot tell which binding the element reads.
611
+ - not:
612
+ inside:
613
+ stopBy: end
614
+ matches: scope
615
+ has:
616
+ stopBy:
617
+ matches: scope
618
+ any:
619
+ - matches: binding-name
620
+ pattern: $RG
621
+ - matches: function-declaration
622
+ has:
623
+ field: name
624
+ pattern: $RG
625
+ rule:
626
+ matches: old-part-name
627
+ has:
628
+ field: property
629
+ regex: ^Button$
630
+ fix: SegmentedControl.Item
631
+ ---
632
+ id: add-segmented-control-import
633
+ language: typescript
634
+ message: import SegmentedControl from @ngrok/mantle/segmented-control
635
+ utils:
636
+ # A node that opens a lexical scope. The shadow search below stops at a
637
+ # nested one, so a sibling function's local name does not count.
638
+ scope:
639
+ any:
640
+ - kind: statement_block
641
+ - kind: function_declaration
642
+ - kind: generator_function_declaration
643
+ - kind: function_expression
644
+ - kind: generator_function
645
+ - kind: arrow_function
646
+ - kind: method_definition
647
+ - kind: class_body
648
+ - kind: for_statement
649
+ - kind: for_in_statement
650
+ - kind: catch_clause
651
+ # An identifier in a binding position: a parameter, a destructured name, a
652
+ # local variable, a function name, or a class name.
653
+ binding-name:
654
+ any:
655
+ - kind: shorthand_property_identifier_pattern
656
+ - kind: identifier
657
+ any:
658
+ - inside: { kind: variable_declarator, field: name }
659
+ - inside: { kind: function_declaration, field: name }
660
+ - inside: { kind: generator_function_declaration, field: name }
661
+ - inside: { kind: function_expression, field: name }
662
+ - inside: { kind: required_parameter, field: pattern }
663
+ - inside: { kind: optional_parameter, field: pattern }
664
+ - inside: { kind: assignment_pattern, field: left }
665
+ - inside: { kind: pair_pattern, field: value }
666
+ - inside: { kind: array_pattern }
667
+ - inside: { kind: rest_pattern }
668
+ - inside: { kind: arrow_function, field: parameter }
669
+ - inside: { kind: catch_clause, field: parameter }
670
+ - kind: type_identifier
671
+ inside: { kind: class_declaration, field: name }
672
+ # A function declaration opens a scope, so the search above stops at it and
673
+ # never reads its name. This matches the declaration itself instead.
674
+ function-declaration:
675
+ any:
676
+ - kind: function_declaration
677
+ - kind: generator_function_declaration
678
+ # The `RadioGroup` import from `@ngrok/mantle/radio-group`. It binds $RG to
679
+ # the local name, so an aliased import matches and another library's
680
+ # `RadioGroup` does not.
681
+ radio-group-import:
682
+ kind: import_statement
683
+ all:
684
+ - has:
685
+ field: source
686
+ regex: ^["']@ngrok/mantle/radio-group["']$
687
+ - has:
688
+ stopBy: end
689
+ kind: import_specifier
690
+ has:
691
+ field: name
692
+ regex: ^RadioGroup$
693
+ any:
694
+ - kind: import_specifier
695
+ has:
696
+ field: alias
697
+ pattern: $RG
698
+ - kind: import_specifier
699
+ not:
700
+ has:
701
+ field: alias
702
+ kind: identifier
703
+ has:
704
+ field: name
705
+ pattern: $RG
706
+ # A `typeof` type query, `$RG.ButtonGroup` or `$RG.Button`, that reads the
707
+ # import.
708
+ old-part-name:
709
+ kind: member_expression
710
+ all:
711
+ - has:
712
+ field: object
713
+ pattern: $RG
714
+ - has:
715
+ field: property
716
+ regex: ^(ButtonGroup|Button)$
717
+ - inside: { kind: type_query }
718
+ - inside:
719
+ stopBy: end
720
+ kind: program
721
+ has:
722
+ matches: radio-group-import
723
+ # Why: a parameter or a local under the import's name shadows it, and the
724
+ # rules cannot tell which binding the element reads.
725
+ - not:
726
+ inside:
727
+ stopBy: end
728
+ matches: scope
729
+ has:
730
+ stopBy:
731
+ matches: scope
732
+ any:
733
+ - matches: binding-name
734
+ pattern: $RG
735
+ - matches: function-declaration
736
+ has:
737
+ field: name
738
+ pattern: $RG
739
+ # A `@ngrok/mantle/radio-group` import, of any name.
740
+ any-radio-group-import:
741
+ kind: import_statement
742
+ has:
743
+ field: source
744
+ regex: ^["']@ngrok/mantle/radio-group["']$
745
+ # An import that supplies the name the renames write: `SegmentedControl`
746
+ # from `@ngrok/mantle/segmented-control`, with no alias. An aliased import
747
+ # does not supply it.
748
+ segmented-control-import:
749
+ kind: import_statement
750
+ all:
751
+ - has:
752
+ field: source
753
+ regex: ^["']@ngrok/mantle/segmented-control["']$
754
+ - has:
755
+ stopBy: end
756
+ kind: import_specifier
757
+ all:
758
+ - has:
759
+ field: name
760
+ regex: ^SegmentedControl$
761
+ - not:
762
+ has:
763
+ field: alias
764
+ kind: identifier
765
+ rule:
766
+ all:
767
+ - pattern: $IMPORT
768
+ # Why the first one: a file with two radio-group imports gets the new
769
+ # import once.
770
+ - matches: any-radio-group-import
771
+ - not:
772
+ follows:
773
+ stopBy: end
774
+ matches: any-radio-group-import
775
+ # A file with a part to rename gets the import. Why no $RG here: the part
776
+ # binds $RG itself, so it can read any of the file's radio-group imports.
777
+ - inside:
778
+ kind: program
779
+ all:
780
+ - has:
781
+ stopBy: end
782
+ matches: old-part-name
783
+ - not:
784
+ has:
785
+ matches: segmented-control-import
786
+ fix: |-
787
+ $IMPORT
788
+ import { SegmentedControl } from "@ngrok/mantle/segmented-control";