@jonmilner/ui 0.19.0 → 0.20.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/dist/docs/lint.md CHANGED
@@ -18,4 +18,7 @@ export default defineConfig({
18
18
 
19
19
  - The option replaces the preset's default list, so add the app's own text components (here `PageTitle`) after the library's.
20
20
  - Never copy the list into the app: it changes with the library, and an upgrade brings the new parts.
21
- - The rule matches a tag's last segment: `Tabs.Tab` is `Tab`. So `Item` and `Label` pass any component's part of that name, `Popup` (listed for `Tooltip.Popup`) passes Menu's and Dialog's popups, which do not wrap text, and `Trigger` and `Close` pass even without the look (`variant`, `size`, an icon) that makes them a Button. Give a look-less `Trigger` or `Close`, or a Menu or Dialog `Popup`, a `Text` child yourself.
21
+ - `@jonmilner/oxlint-config` 0.7.0 or later is needed: earlier versions never match a dotted entry, so they report `<Tooltip.Popup>` text.
22
+ - Import the library's components by name (`import { Tooltip } from "@jonmilner/ui"`). A dotted entry matches the tag as written, so `<UI.Tooltip.Popup>` from a namespace import or `<Hint.Popup>` from an aliased import is reported.
23
+ - An entry without a dot matches a tag's last segment: `Tabs.Tab` is `Tab`. So `Item` and `Label` pass any component's part of that name, and `Trigger` and `Close` pass even without the look (`variant`, `size`, an icon) that makes them a Button. Give a look-less `Trigger` or `Close` a `Text` child yourself.
24
+ - An entry with a dot matches that full tag only: `Tooltip.Popup` passes the tooltip's popup and still reports bare text in `Menu.Popup` or `Dialog.Popup`, which do not wrap their children in `Text`. Add an app's own compound parts the same way (`"Card.Title"`).
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "./manifest.schema.json",
3
3
  "package": "@jonmilner/ui",
4
- "version": "0.19.0",
4
+ "version": "0.20.0",
5
5
  "components": [
6
6
  {
7
7
  "name": "AlertDialog",
@@ -0,0 +1,48 @@
1
+ # 0.20.0
2
+
3
+ `textComponents` from `@jonmilner/ui/lint` lists `Tooltip.Popup` instead of `Popup`, so `ui/no-bare-text` passes text only in the tooltip's popup and reports bare text in `Menu.Popup` and `Dialog.Popup`, which do not wrap their children in `Text` (decision 0168). A dotted entry needs `@jonmilner/oxlint-config` 0.7.0 or later.
4
+
5
+ ## Find
6
+
7
+ - The lint preset's version, in the app's `package.json`: `"@jonmilner/oxlint-config"`, kept where the version is below `0.7.0`.
8
+ - An app config that lists `Popup` itself: string `"Popup"` in `vite.config.ts`.
9
+ - A namespace or aliased import of the library, whose tags a dotted entry does not match: regex `import \* as \w+ from "@jonmilner/ui"|import \{[^}]*\bTooltip as \w+` in `*.tsx`.
10
+ - Bare text in a Menu or Dialog popup: after the steps above, run `pnpm exec vp lint` and keep each `ui/no-bare-text` report on a `<Menu.Popup>` or `<Dialog.Popup>`.
11
+
12
+ ## Replace
13
+
14
+ Pin `@jonmilner/oxlint-config` at `0.7.0` or later, then `pnpm install`. From below 0.6.0 this also brings the preset's newer rules; apply its `CHANGELOG.md` entries above the old version first.
15
+
16
+ ```diff
17
+ - "@jonmilner/oxlint-config": "0.6.0",
18
+ + "@jonmilner/oxlint-config": "0.7.0",
19
+ ```
20
+
21
+ Remove the app's own `"Popup"`. If the app has a compound component whose `Popup` part wraps its children in `Text`, name that part by its full tag instead:
22
+
23
+ ```diff
24
+ -uiLint({ textComponents: [...textComponents, "Popup"] });
25
+ +uiLint({ textComponents: [...textComponents, "Hint.Popup"] });
26
+ ```
27
+
28
+ Import `Tooltip` by name, so its tag reads `Tooltip.Popup`:
29
+
30
+ ```diff
31
+ -import * as UI from "@jonmilner/ui";
32
+ -<UI.Tooltip.Popup>2 checks failed</UI.Tooltip.Popup>
33
+ +import { Tooltip } from "@jonmilner/ui";
34
+ +<Tooltip.Popup>2 checks failed</Tooltip.Popup>
35
+ ```
36
+
37
+ Wrap each reported Menu or Dialog popup's text in `Text`:
38
+
39
+ ```diff
40
+ -<Menu.Popup>No actions available</Menu.Popup>
41
+ +<Menu.Popup>
42
+ + <Text>No actions available</Text>
43
+ +</Menu.Popup>
44
+ ```
45
+
46
+ ## Verify
47
+
48
+ `pnpm exec vp lint` exits 0 with no `ui/no-bare-text` reports.
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * The library's components and parts that render their children through `Text`, plus
3
3
  * `VisuallyHidden`, whose children are hidden text, for the `textComponents` option of `uiLint()`
4
- * from `@jonmilner/oxlint-config`. A part is named by its property (`Tabs.Tab` is `Tab`). Spread
5
- * it and add the app's own text components; see `docs/lint.md`.
4
+ * from `@jonmilner/oxlint-config`. A part is named by its property (`Tabs.Tab` is `Tab`), except
5
+ * `Tooltip.Popup`, named by its full tag so Menu's and Dialog's popups are still checked (ADR 0168).
6
+ * Spread it and add the app's own text components; see `docs/lint.md`.
6
7
  */
7
8
  export declare const textComponents: readonly string[];
@@ -16,7 +16,7 @@ var e = Object.freeze([
16
16
  "Close",
17
17
  "HeaderCell",
18
18
  "Cell",
19
- "Popup",
19
+ "Tooltip.Popup",
20
20
  "VisuallyHidden"
21
21
  ]);
22
22
  export { e as textComponents };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jonmilner/ui",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "bin": {
5
5
  "ui-doctor": "./dist/cli/ui-doctor.mjs"
6
6
  },