create-bestax 4.2.7 → 4.2.8
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-bestax",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.8",
|
|
4
4
|
"description": "Create a new bestax-bulma project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"figures": "^6.1.0",
|
|
40
40
|
"fs-extra": "^11.4.0",
|
|
41
41
|
"prompts": "^2.4.2",
|
|
42
|
-
"@allxsmith/bestax-bulma": "^5.15.
|
|
42
|
+
"@allxsmith/bestax-bulma": "^5.15.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@jest/globals": "^30.0.0",
|
|
@@ -97,6 +97,34 @@ Rules that keep components consistent:
|
|
|
97
97
|
- **Spread `rest`, not `props`**, onto the DOM node — `useBulmaClasses` has already stripped the
|
|
98
98
|
helper props out of `rest`, so they don't leak to the DOM as invalid attributes.
|
|
99
99
|
- **Set `displayName`** on `forwardRef` components (needed for tests and Storybook autodocs).
|
|
100
|
+
- **A polymorphic `as` means the props follow it, and usually the ref too.** If `as` accepts any
|
|
101
|
+
`React.ElementType`, do not pin the props to one element — split them into a
|
|
102
|
+
`FooOwnProps` interface and intersect it with `ComponentPropsWithoutRef<T>`, then cast
|
|
103
|
+
the `forwardRef` result to `PolymorphicComponent<FooOwnProps, 'default-tag'>`
|
|
104
|
+
(`src/helpers/polymorphic.ts`). `Button.tsx` is the reference.
|
|
105
|
+
**Write that intersection out in the alias; do not build it from
|
|
106
|
+
`PolymorphicProps<T, FooOwnProps>`.** The API-docs extractor walks heritage
|
|
107
|
+
syntactically, and it cannot see through a generic alias or a distributive
|
|
108
|
+
conditional — routing the alias through the helper drops most of the props
|
|
109
|
+
table without failing (#667). `PolymorphicProps` is for consumer and wrapper
|
|
110
|
+
types; `PolymorphicComponent<FooOwnProps, 'default-tag'>` is the cast target,
|
|
111
|
+
and `PolymorphicComponentWithoutRef` the one for a component that forwards no
|
|
112
|
+
ref. Add type-level checks in `src/__typetests__/` both ways — that the
|
|
113
|
+
default `as` accepts its element's props and a different `as` rejects them —
|
|
114
|
+
since nothing else in the repo type-checks this. Pinning the props instead
|
|
115
|
+
rejects correct code and accepts incorrect code at the same time, which is what #641 fixed
|
|
116
|
+
across eight components. A literal union (`Title.tsx`) escapes the generic only when its
|
|
117
|
+
members genuinely **share** a prop and ref surface — `h1`–`h6` and `p` all carry plain
|
|
118
|
+
`HTMLAttributes`, so one interface describes them all. It is not a general exemption:
|
|
119
|
+
`Dropdown.Item`'s `'a' | 'div' | 'button'` differ in `href`, `disabled`, `type` and their ref
|
|
120
|
+
element, and pinning them to one interface reproduces exactly this defect (#663). When the
|
|
121
|
+
members differ, constrain `T` to the union rather than dropping the generic.
|
|
122
|
+
Forward the ref unless the component owns the node it needs: `Reveal` observes
|
|
123
|
+
an element for scroll intersection and wraps a custom `as` in its own `div`,
|
|
124
|
+
so the element `as` names is not the one it holds — it uses
|
|
125
|
+
`PolymorphicComponentWithoutRef` and forwards none. That is the exception, not
|
|
126
|
+
a licence to skip refs; everything a consumer might focus or measure should
|
|
127
|
+
forward one.
|
|
100
128
|
- **Element sizing uses an inline `'small' | 'medium' | 'large'` union**, mapped to `is-small` /
|
|
101
129
|
`is-medium` / `is-large` (see `Tabs.tsx`, `Control.tsx`). Do **not** reach for the `validSizes`
|
|
102
130
|
constant — that one is `'0'…'6' | 'auto'` and exists for **spacing** helpers, not element size.
|
|
@@ -243,7 +243,8 @@ a navbar that mounts conditionally.
|
|
|
243
243
|
|
|
244
244
|
**Routing:** in a routed app, don't use `href="#"` — render items as the router's link
|
|
245
245
|
component. `Menu.Item as={Link} to="/x"` and `Navbar.Item as={Link} to="/x"` both compile
|
|
246
|
-
without casts (their props
|
|
246
|
+
without casts (their props follow `as`, so `to` is checked against the router's own link
|
|
247
|
+
type). Drive `active` from `useLocation().pathname`.
|
|
247
248
|
Full patterns (including Buttons that navigate and Next.js `href`): the docs guide at
|
|
248
249
|
https://bestax.io/docs/guides/features/routing.
|
|
249
250
|
|