Index of every page on this site: llms.txt
All skills
allxsmith avatar

/bestax-migrate

@9cf369a
by Alex Smithallxsmith/bestax15 stars
2
Run it yourself

Migrate an existing React app to @allxsmith/bestax-bulma on Bulma v1, from raw Bulma CSS classes on plain JSX (className="button is-primary") or in static HTML pages and templates styled with Bulma, or from an unmaintained React Bulma library (react-bulma-components v4, rbx v2, bloomer 0.6). Run the bestax-migrate codemod, then resolve every TODO(bestax-migrate) comment it leaves using the per-source mapping references. Use when a React app styles its markup with Bulma classes and wants bestax components instead, when static HTML pages or templates styled with Bulma should become React components, when a repo imports react-bulma-components, rbx or bloomer, when TODO(bestax-migrate) comments are present in a codebase, or when asked to convert Bulma classNames to bestax-bulma.

Use this Skill: https://skilld.dev/gh/allxsmith/bestax/bestax-migrate

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesbloomerunmappables.md

≈5.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Recipes for every TODO(bestax-migrate) the bloomer codemod leaves

Ordered by how often they appear when the codemod runs over bloomer's own documentation. Resolve the comment, then delete it. Never silence a TODO without converting the code.

component:Icon, component:PanelIcon — Font Awesome 4 classes

bloomer's Icon put the icon-font classes on its own className, and its era was Font Awesome 4. Classes the parser can read — Font Awesome 5/6 (fas fa-home, fa-solid fa-home) and MDI (mdi mdi-account) — become bestax's props automatically:

<Icon className="fas fa-home" isSize="large" />
<Icon name="home" library="fa" variant="solid" size="large" />

Modifier classes the library documents (fa-spin, fa-lg, mdi-24px) become bestax's features. Anything else — FA4's fa fa-home above all, or an app's own class beside the icon — is moved onto an <i> child, which renders exactly what bloomer rendered, and flagged: bestax's optional Font Awesome peer is 6.7+, where many v4 names changed and brand icons moved to variant="brands". Either keep FA4 loaded, or convert to the prop form:

<Icon><i className="fa fa-github" aria-hidden="true" /></Icon>
<Icon name="github" library="fa" variant="brands" />

library is fa | mdi | ion | material-icons | material-symbols. PanelIcon has the same className API and converts the same way. An Icon with no className and no children is flagged too — it gets an empty <i> child so it compiles until you set a name or a child — and so is a className that is not a string (prop:className). An Icon written with children is flagged as well: bloomer never rendered them — beside a className they are removed (the classes win), without one they are kept and bestax will render them.

component:Nav — Bulma 0.4's nav

Nav, NavLeft, NavCenter, NavRight, NavToggle and NavItem (component:NavLeft, component:NavCenter, component:NavRight, component:NavToggle, component:NavItem) are Bulma 0.4's .nav, which Bulma removed in 0.5 — bloomer kept the components, but no stylesheet you can install today styles them. Rebuild on Navbar:

<Nav><NavLeft><NavItem isActive>Home</NavItem></NavLeft><NavToggle /></Nav>

<Navbar>
  <Navbar.Brand><Navbar.Burger /></Navbar.Brand>
  <Navbar.Menu><Navbar.Start><Navbar.Item active>Home</Navbar.Item></Navbar.Start></Navbar.Menu>
</Navbar>

component:Tile — Bulma v1 removed tiles

Use Grid and Cell. Tile isAncestor becomes <Grid>, isParent/isChild become <Cell>, and isSize={n} becomes a column span:

<Tile isAncestor><Tile isParent isSize={4}><Tile isChild>x</Tile></Tile></Tile>
<Grid><Cell colSpan={4}>x</Cell></Grid>

component:Modal — what carries over

bloomer's Modal was an inert shell: isActive toggled the class and nothing else. bestax's Modal closes on Escape (calling onClose), locks body scroll, and traps focus by default, and renders inline unless portal is set. So every conversion changes behaviour, and every one is flagged. Pass onClose for Escape and Modal.Close to close it. Modal.Background doesn't call onClose on its own, so give it the same handler as onClick for the background to close it too. The open modal is a dialog, so give it a name with aria-label, or aria-labelledby pointing at its title (name:Modal):

<Modal active={open} onClose={() => setOpen(false)} aria-label="Edit profile">
  <Modal.Background onClick={() => setOpen(false)} />

or keep bloomer's inert behaviour with closeOnEscape={false} lockScroll={false}. Add portal if the modal must escape a transformed ancestor.

name:Modal: a modal with no name

A converted Modal with no aria-label or aria-labelledby, and no spread that could hold one. bestax's Modal is a dialog while it's open, and a dialog with no name is announced as just "dialog". Only the legacy form's modalCardTitle names it for you, and the codemod never writes that. Give the Modal an aria-label, as above, or point aria-labelledby at the id of its title, such as its Modal.Card.Title when it has one:

<Modal active={open} onClose={close} aria-labelledby="terms-title">
  <Modal.Background onClick={close} />
  <Modal.Card>
    <Modal.Card.Head>
      <Modal.Card.Title id="terms-title">Terms</Modal.Card.Title>
    </Modal.Card.Head>
    <Modal.Card.Body>…</Modal.Card.Body>
  </Modal.Card>
</Modal>

component:Dropdown and its parts

bestax's Dropdown takes a label and renders its own trigger and menu, so bloomer's DropdownTrigger, DropdownMenu and DropdownContent have nothing to become (component:DropdownTrigger, component:DropdownMenu, component:DropdownContent). Keep the <DropdownItem>s, which become <Dropdown.Item>:

<Dropdown isActive isAlign="right">
  <DropdownTrigger><Button>Open</Button></DropdownTrigger>
  <DropdownMenu><DropdownContent>
    <DropdownItem href="/a">A</DropdownItem>
  </DropdownContent></DropdownMenu>
</Dropdown>

<Dropdown label="Open" active right>
  <Dropdown.Item href="/a">A</Dropdown.Item>
</Dropdown>

bestax's Dropdown.Item renders an <a> by default and takes that anchor's props, so the href carries over. It keeps one only where the element it renders is the anchor: on as="div" or as="button" the attribute is dropped (prop:href), and the item is a link again if you drop the as. isHoverable → hoverable, isActive → active carry over on the Dropdown itself.

prop:tag — polymorphism

bestax declares as on only some components (the list is in prop-map.md). Elsewhere, render the element you wanted directly, or move the bestax component inside it:

<Box tag="section">…</Box>
<section><Box>…</Box></section>

A dynamic tag on a component that becomes plain markup is flagged the same way — the plain element takes bloomer's default tag.

prop:as — a tag the component does not render

Several bestax components accept as but narrow it to the tags Bulma's markup allows there, so a literal tag outside that union (<Media tag="section">, <Control tag="span">) becomes a prop:as TODO listing the tags that component does render. Wrap the component in the element you wanted, or restructure.

prop:href — a link needs the anchor

bestax gives an element the attributes of the tag as names, so an href belongs on an <a> or on a custom component you pass to as, never on another intrinsic tag. bloomer's MenuLink, NavbarLink and the components that become plain markup rendered their tag whatever href said, so <MenuLink href="/x" tag="span"> really was a <span href="/x"> — an attribute no browser acts on. The element stays, the dead attribute goes:

<MenuLink href="/x" tag="span">Home</MenuLink>
<Menu.Item as="span">Home</Menu.Item>

Drop the tag where the link was the point. On the components that switched to an <a> on href the codemod does that for you — see prop-map.md.

Most targets take no href at all. It lives on Menu.Item, Navbar.Item, Navbar.Link, Panel.Block, Dropdown.Item and the three Pagination controls, which render an <a> unless told otherwise, and on Button and Level.Item once as="a" names one — those two render a <button> and a <div> by default, and drop the attribute. Everywhere else the codemod removes it.

Dropdown.Item is the one to read twice: it accepts as="a" | "div" | "button" and takes the props of whichever you name, so the default <a> keeps an href and the other two do not. Drop the as to make it a link again; inside the <button> form an <a> would nest interactive content, so navigate in onClick there.

prop:target, prop:download, prop:hrefLang, prop:ping, prop:referrerPolicy, prop:media

target, download, hrefLang, ping, referrerPolicy and media follow the element the same way href does, and they are invalid on the wrong one whether or not an href is beside them — <Navbar.Link as="span" target="_blank"> does not compile on its own. Each is judged against the element that actually renders, not as a group, so a referrerPolicy on an <img> or a target on a <form> stays where it is legal. Where one is removed the TODO quotes it. Put it on an <a> inside, or make the element one that takes it.

rel is never touched: React declares it on HTMLAttributes, so it is valid on every element.

A component can be narrower than its element. One that takes no href at any as takes none of these either. Level.Item is not narrower: it declares the anchor's whole attribute surface at every as and forwards it only on the <a>, so all of these survive at as="a" and none of them reaches a <p> or a <div>.

prop:type — a <button> item that no longer submits its form

Navbar.Item, Navbar.Link, Menu.Item and Dropdown.Item write type="button" on the <button> an as makes them render, whenever the element sets no type or one HTML doesn't define. A plain <button> with neither submits the form around it, so an item you rendered as a button with tag="button" stops submitting once migrated. The codemod can't tell whether one sits in a form, so each gets a TODO:

<NavbarItem tag="button">Search</NavbarItem>
<Navbar.Item as="button">Search</Navbar.Item>

Add type="submit" if it should still submit, or type="button" to say it shouldn't, then delete the comment. An item whose type is written out as button, submit or reset, or comes from a spread or an expression, gets no TODO.

prop:render — the render prop

bloomer's render handed the computed props (className included) to your own renderer:

<Button isColor="info" render={props => <MyButton {...props} />} />

bestax has no render-prop escape hatch. Render the bestax component and put your element inside it, or — if you need the classes on your own element — call useBulmaClasses in it:

<Button color="info" as={MyButton} />

Button, Navbar.Item, Navbar.Link and Menu.Item take as as a custom component, which covers the common "render as a router link" case.

component:Heading — Bulma v1 dropped .heading

bloomer's Heading is Bulma 0.9's small uppercase label, and bestax has no component for it. It becomes the plain <p className="heading"> bloomer rendered (or the element its tag named), but Bulma v1 has no rule for that class, so the label renders as body text. Restyle it with helper props, as a small, uppercase, semibold Paragraph:

<Heading>Followers</Heading>
<Paragraph textSize="7" textTransform="uppercase" textWeight="semibold" mb="1">
  Followers
</Paragraph>

Or keep the class and give it a rule of your own. Bulma 0.9's was:

.heading {
  display: block;
  font-size: 11px;
  letter-spacing: 1px;
  margin-bottom: 5px;
  text-transform: uppercase;
}

prop:isFullWidth — not a universal helper in bestax

bloomer accepted isFullWidth on everything; Bulma's is-fullwidth only means something on a few elements. Where bestax has a prop for it (Button, Select, Table, Tabs), it becomes isFullwidth. Elsewhere, drop it, or add className="is-fullwidth" if your own CSS styled the class.

Modifiers bestax has no prop for — converted to classes

Bulma v1 still ships every one of these, so the codemod writes the class into className instead of leaving a TODO: Hero isBold → className="is-bold", isHalfHeight → is-halfheight, Media isSize="large" → is-large, Subtitle isSpaced → is-spaced, Input isActive → is-active, NavbarLink isActive → is-active, PageLink/PageControl/ PageEllipsis isActive/isFocused, PanelBlock isWrapped → is-wrapped, LevelItem isFlexible → is-flexible, NavbarDropdown/NavbarDivider isBoxed → is-boxed. The same goes for a universal helper on a part that takes no helper props (Pagination.Previous/Next/ Ellipsis, Navbar.Dropdown/DropdownMenu/Divider, Panel.Heading/Tabs/Block, Tabs.Item, Message.Header/Body, the Modal parts): isPulled="right" → is-pulled-right, isMarginless → m-0, isHidden="mobile" → is-hidden-mobile. A dynamic value, or a dynamic className the class cannot be spliced into, is flagged with the class to add. PageEllipsis gets these classes only where the project gets bestax-bulma 5.78.4 or later, as the prop map says, and a TODO naming that release otherwise.

Props with no counterpart

Each of these raises a TODO. Most are left on the element for you to resolve; the href rows are the exception — bestax types no href onto the element these ended up on, so the codemod removes the attribute and the TODO quotes what it was:

prop on what to do
isHoverable NavbarItem without hasDropdown move to the Navbar.Dropdown, or className="is-hoverable"
hasAddons="fullwidth" Field hasAddons plus className="has-addons-fullwidth"
isAlign TabList set align on the <Tabs> — Bulma aligns the container
isGrid Columns Bulma removed columns.is-grid in 0.5; use isMultiline with sized columns, or Grid
href CardFooterItem, CardHeaderIcon, Delete put an <a> inside, or handle it in onClick
href beside a tag MenuLink, NavbarLink, and anything that becomes plain markup the tag bloomer rendered was no anchor, so the href did nothing; drop the tag
href={expr} (dynamic) Button, LevelItem and the other components that switched to an <a> on href resolved to the anchor; render the other element by hand where the href is empty
href NavbarItem hasDropdown bestax's Navbar.Dropdown is the container; put the href on the Navbar.Link inside
isRatio beside isSize Image bestax's one size took the fixed size; restore the ratio if that was the point

component:MenuLink, component:Breadcrumb, component:Page — lists bestax renders itself

bestax's Menu.Item renders its own <li><a>, its Breadcrumb its own <ul>, and its Pagination.Link/Pagination.Ellipsis their own <li>. bloomer's docs wrote those elements by hand, so the codemod folds a literal <li> around a MenuLink, a literal <ul> inside a Breadcrumb, and a Page around a single link away — carrying their attributes. It flags the shapes it cannot fold: a MenuLink sharing its <li> with other content, a <ul> carrying attributes, and a Page whose link sits in an expression or beside siblings — remove the wrapper by hand, or the lists nest.

prop:isLink — beside isColor

isLink is Bulma's is-link colour. Alone it becomes color="link"; beside an isColor there are two colours for bestax's one color prop — pick one.

prop:isDisplay, prop:isHidden, prop:isSize, prop:isOffset — dynamic helper values

The three-shape helpers flatten only from literals. A dynamic value is dropped (bestax has no prop of that name, so leaving it would be a type error) and flagged; set the matching bestax prop conditionally:

<Box isHidden={collapsed} />
<Box visibility={collapsed ? 'hidden' : undefined} />

Column's isSize/isOffset follow the same rule, and a touch key has no sizeTouch counterpart in bestax (only isNarrowTouch) — Bulma keeps the is-*-touch classes, so use className.

prop:isSize on Title and Subtitle: a size the codemod cannot carry

bloomer's Title and Subtitle kept their element at every size. bestax's render the heading their size names, so a literal isSize moves to textSize to keep the level (see "Title and Subtitle sizes" in the prop map). A dynamic one cannot move, because textSize takes a string, so it becomes size. Pass it to textSize yourself:

<Subtitle isSize={compact ? 5 : 4}>Report</Subtitle>
<SubTitle textSize={compact ? '5' : '4'} as="h2">Report</SubTitle>

A literal outside 1 to 7 has no Bulma class, and bestax renders none for it either: drop it, or set a textSize from '1' to '7'.

A dynamic size beside tag="p" is not flagged, since bestax never turns a <p> into a heading.

value-reference — a component used as a value

const Wrapped = Box and { Subtitle } are rewritten to the bestax binding (Hero.Foot, SubTitle) when the target is a plain rename, and export { Subtitle } becomes export { SubTitle as Subtitle } so the public name survives. A re-export of a component whose bestax counterpart is a member of a compound (export { CardHeader } → Card.Header) cannot be expressed and is flagged; so is a barrel export { X } from 'bloomer' (imports) and a namespace import used as a plain value (const { Box } = B), through which nothing was migrated. A retained component (Tile, the Nav family, withHelpersModifiers) used as a value keeps the bloomer import with this flag: migrate the usage by hand. withHelpersModifiers in particular has nothing to become — every bestax component already takes the helper props, and a custom component gets them from useBulmaClasses.

imports — a bloomer import the codemod left alone

A default import (import Bloomer from 'bloomer') never worked — bloomer has no default export — and a deep import (bloomer/lib/elements/Box) reaches compiled internals the mapping does not know. Convert either to a named import from 'bloomer' and re-run the codemod.

plain-element — helper props on markup that became plain HTML

When a component becomes plain markup (Help, Label, PanelTab, …), bloomer's helper props on it have no home and are dropped with this flag. On the <ul> a TabList becomes, a helper whose literal value names one class becomes that class instead, as on the parts that take none. Re-apply them as classes (className="is-pulled-right"), or wrap the element in a bestax Box/Block that takes them.

Dynamic values

Any prop whose value the codemod cannot read — isColor={c}, isNext={n}, hasIcons={sides}, tag={t}, isTransparent={t}, isFullHeight={f}, isNormal={n} — is either renamed as-is (when the rename is unconditional) or flagged with the specific prop to set. The comment names it.

prop:display-base — a base display beside a per-viewport one

bestax leaves a base display out once any per-viewport display prop (displayMobile and the rest) is set, so the codemod keeps the base value as the class it stood for, in className, where the display attribute was (is-flex, is-hidden for none). With a flex base and no per-viewport flex display, the flex container props (justifyContent, alignItems and the rest) render only beside a flex display prop, so they move into className too (is-justify-content-center), and a container value bestax doesn't take stays where it was. This TODO, whose message starts "bestax leaves display out beside a per-viewport display prop", is the case where nothing moves, because a per-viewport display, the base value, the className or a container prop is dynamic, or the element takes a spread, which could hold any of them:

<Box className={cls} display="flex" displayMobile="block" />
<Box className={`is-flex ${cls}`} displayMobile="block" />

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts18d3 checks · Risk SAFE
  • Gen Agent Trust Hub18d

    The skill provides comprehensive instructions and reference material for migrating React applications or static HTML pages to the @allxsmith/bestax-bulma library using the bestax-migrate codemod. No malicious patterns or security risks were identified.

  • Socket18d

    No alerts

  • Snyk1mo

    Risk: LOW · No issues

Signed by skilld at 9cf369a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 4 days ago

README badge

README badge for allxsmith/bestax/bestax-migrate