bestax-migrate 2.25.3 → 2.25.5
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/sources/_shared/specials-utils.d.ts +31 -0
- package/dist/sources/_shared/specials-utils.d.ts.map +1 -1
- package/dist/sources/_shared/specials-utils.js +80 -0
- package/dist/sources/bloomer/mapping.d.ts.map +1 -1
- package/dist/sources/bloomer/mapping.js +4 -1
- package/dist/sources/bloomer/specials.d.ts.map +1 -1
- package/dist/sources/bloomer/specials.js +27 -9
- package/dist/sources/bulma-classes/class-map.d.ts +3 -1
- package/dist/sources/bulma-classes/class-map.d.ts.map +1 -1
- package/dist/sources/bulma-classes/class-map.js +8 -1
- package/dist/sources/bulma-classes/plan.js +7 -0
- package/dist/sources/bulma-classes/rules.d.ts.map +1 -1
- package/dist/sources/bulma-classes/rules.js +5 -0
- package/dist/sources/rbx/mapping.js +1 -1
- package/dist/sources/rbx/specials.d.ts.map +1 -1
- package/dist/sources/rbx/specials.js +11 -2
- package/dist/sources/react-bulma-components/mapping.js +1 -1
- package/dist/sources/react-bulma-components/specials.d.ts.map +1 -1
- package/dist/sources/react-bulma-components/specials.js +16 -5
- package/package.json +2 -2
|
@@ -76,6 +76,37 @@ export declare function modifierClass(ctx: TransformContext, path: ASTPath<any>,
|
|
|
76
76
|
* it is picked.
|
|
77
77
|
*/
|
|
78
78
|
export declare function restrictAsToTargets(ctx: TransformContext, path: ASTPath<any>, element: any, target: string | undefined, allowed: string[], prop?: string): void;
|
|
79
|
+
/** What a source's title handler tells `keepTitleLevel` about it. */
|
|
80
|
+
export interface TitleSource {
|
|
81
|
+
/** The source component, for the TODO (`Heading`, `Subtitle`). */
|
|
82
|
+
where: string;
|
|
83
|
+
/** The bestax component it becomes: `Title` or `SubTitle`. */
|
|
84
|
+
target: string;
|
|
85
|
+
/** The source's size prop: `isSize` in bloomer, `size` elsewhere. */
|
|
86
|
+
size: string;
|
|
87
|
+
/** The source's element prop: `tag`, `renderAs` or `as`. */
|
|
88
|
+
tag: string;
|
|
89
|
+
/** The element the source rendered when no tag was given. */
|
|
90
|
+
level: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Carry a title's size across without changing its heading level.
|
|
94
|
+
*
|
|
95
|
+
* Every source library rendered a title at the element its tag prop named,
|
|
96
|
+
* or at its own default, whatever the size. bestax's `Title` and `SubTitle`
|
|
97
|
+
* render the heading their `size` names unless `as="p"`, so `<Title size={4}>`
|
|
98
|
+
* is an <h4>. A size therefore stays `size` only where that renders the
|
|
99
|
+
* element the source did: a <p>, or the <hN> the size names, at a size bestax
|
|
100
|
+
* takes. Anywhere else it moves to the `textSize` helper, which sets the same
|
|
101
|
+
* font size and leaves the level to `as`. Any other size gets a TODO.
|
|
102
|
+
*
|
|
103
|
+
* bestax defaults to an <h1>, so a source whose default is another level gets
|
|
104
|
+
* it written out as `as`, unless the size already renders it or a spread may
|
|
105
|
+
* name the element.
|
|
106
|
+
*
|
|
107
|
+
* Returns the props it consumed, for the handler's `handledProps`.
|
|
108
|
+
*/
|
|
109
|
+
export declare function keepTitleLevel(ctx: TransformContext, path: ASTPath<any>, element: any, source: TitleSource): string[];
|
|
79
110
|
/**
|
|
80
111
|
* Strip the link attributes a plain element cannot carry.
|
|
81
112
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specials-utils.d.ts","sourceRoot":"","sources":["../../../src/sources/_shared/specials-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAQjD,OAAO,EAUL,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAIxB,MAAM,WAAW,aAAa;IAC5B,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,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AAM,EAAE,KAC1B,aAAa,GAAG,IAAI;EA8CxB"}
|
|
@@ -225,6 +225,86 @@ export function restrictAsToTargets(ctx, path, element, target, allowed, prop =
|
|
|
225
225
|
.join(' / ')} does); render the tag directly or restructure`);
|
|
226
226
|
ctx.dirty = true;
|
|
227
227
|
}
|
|
228
|
+
/** The sizes bestax's Title and SubTitle turn into a heading level. */
|
|
229
|
+
const TITLE_SIZES = ['1', '2', '3', '4', '5', '6'];
|
|
230
|
+
/** Bulma's seven sizes, all of which `textSize` takes. */
|
|
231
|
+
const TEXT_SIZES = [...TITLE_SIZES, '7'];
|
|
232
|
+
/**
|
|
233
|
+
* Carry a title's size across without changing its heading level.
|
|
234
|
+
*
|
|
235
|
+
* Every source library rendered a title at the element its tag prop named,
|
|
236
|
+
* or at its own default, whatever the size. bestax's `Title` and `SubTitle`
|
|
237
|
+
* render the heading their `size` names unless `as="p"`, so `<Title size={4}>`
|
|
238
|
+
* is an <h4>. A size therefore stays `size` only where that renders the
|
|
239
|
+
* element the source did: a <p>, or the <hN> the size names, at a size bestax
|
|
240
|
+
* takes. Anywhere else it moves to the `textSize` helper, which sets the same
|
|
241
|
+
* font size and leaves the level to `as`. Any other size gets a TODO.
|
|
242
|
+
*
|
|
243
|
+
* bestax defaults to an <h1>, so a source whose default is another level gets
|
|
244
|
+
* it written out as `as`, unless the size already renders it or a spread may
|
|
245
|
+
* name the element.
|
|
246
|
+
*
|
|
247
|
+
* Returns the props it consumed, for the handler's `handledProps`.
|
|
248
|
+
*/
|
|
249
|
+
export function keepTitleLevel(ctx, path, element, source) {
|
|
250
|
+
const { j } = ctx;
|
|
251
|
+
const tagAttr = findAttr(element, source.tag) ?? findAttr(element, 'as');
|
|
252
|
+
const spread = (element.openingElement.attributes ?? []).some((a) => a.type === 'JSXSpreadAttribute');
|
|
253
|
+
// The element the source rendered, where the codemod can see it. A spread
|
|
254
|
+
// names the element only where the source spells its tag prop `as`, the
|
|
255
|
+
// name bestax reads: a `tag` or `renderAs` inside one never reaches `as`.
|
|
256
|
+
let rendered;
|
|
257
|
+
if (tagAttr) {
|
|
258
|
+
const literal = literalValueOf(tagAttr);
|
|
259
|
+
if (literal.kind === 'string')
|
|
260
|
+
rendered = literal.value;
|
|
261
|
+
}
|
|
262
|
+
else if (!spread || source.tag !== 'as') {
|
|
263
|
+
rendered = source.level;
|
|
264
|
+
}
|
|
265
|
+
const handled = [];
|
|
266
|
+
let sizeRendersLevel = false;
|
|
267
|
+
const sizeAttr = findAttr(element, source.size);
|
|
268
|
+
if (sizeAttr) {
|
|
269
|
+
const literal = literalValueOf(sizeAttr);
|
|
270
|
+
const size = literal.kind === 'string' || literal.kind === 'number'
|
|
271
|
+
? String(literal.value)
|
|
272
|
+
: undefined;
|
|
273
|
+
const movable = size !== undefined && TEXT_SIZES.includes(size);
|
|
274
|
+
const textSize = findAttr(element, 'textSize');
|
|
275
|
+
// A size the codemod cannot read is still safe beside a <p>; a literal
|
|
276
|
+
// has to be one bestax's `size` takes, or its class goes.
|
|
277
|
+
const takes = size === undefined
|
|
278
|
+
? literal.kind === 'expression'
|
|
279
|
+
: TITLE_SIZES.includes(size);
|
|
280
|
+
if (takes && (rendered === 'p' || rendered === `h${size}`)) {
|
|
281
|
+
// `size` renders this element too, so the prop map carries it as is.
|
|
282
|
+
sizeRendersLevel = true;
|
|
283
|
+
}
|
|
284
|
+
else if (movable && !textSize) {
|
|
285
|
+
sizeAttr.name = j.jsxIdentifier('textSize');
|
|
286
|
+
sizeAttr.value = j.stringLiteral(size);
|
|
287
|
+
handled.push(source.size);
|
|
288
|
+
ctx.dirty = true;
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
const level = `bestax's \`${source.target}\` renders the heading its \`size\` names unless \`as="p"\``;
|
|
292
|
+
addTodo(ctx, path, `prop:${source.size}`, !takes
|
|
293
|
+
? `bestax's \`${source.target}\` takes a \`size\` from 1 to 6 and renders no size class for this one; drop it, or set a \`textSize\` from '1' to '7' instead`
|
|
294
|
+
: textSize
|
|
295
|
+
? `\`${source.where}\` sets a size and \`textSize\` both, and ${level}; to keep the level, drop \`size\` and let \`textSize\` set the font size`
|
|
296
|
+
: `\`${source.where}\` kept its element at every size, but ${level}; to keep the level, carry the size with \`textSize\`, which takes '1' to '7' as strings`);
|
|
297
|
+
// Written as bestax's prop either way, so the prop map adds nothing.
|
|
298
|
+
sizeAttr.name = j.jsxIdentifier('size');
|
|
299
|
+
handled.push(source.size);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
if (!tagAttr && rendered && source.level !== 'h1' && !sizeRendersLevel) {
|
|
303
|
+
addAttr(element, makeAttr(j, 'as', source.level));
|
|
304
|
+
ctx.dirty = true;
|
|
305
|
+
}
|
|
306
|
+
return handled;
|
|
307
|
+
}
|
|
228
308
|
/**
|
|
229
309
|
* Strip the link attributes a plain element cannot carry.
|
|
230
310
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../../../src/sources/bloomer/mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAkBnE;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,UAEzB,CAAC;AA8CF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAsBtD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAG1D,CAAC;AAEF;;;;;GAKG;AACH;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,aAG/B,CAAC;AAEH,eAAO,MAAM,kBAAkB,aAqB7B,CAAC;AAEH,8EAA8E;AAC9E,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GAAG,MAAM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cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,gBAAgB,GAAG,SAAS,CAM3E"}
|
|
@@ -310,10 +310,13 @@ export const MAPPING = {
|
|
|
310
310
|
props: { isColor: color, isSize: size },
|
|
311
311
|
},
|
|
312
312
|
// bestax's `Title.size` accepts the numbers 1–6 as well as their string
|
|
313
|
-
// forms,
|
|
313
|
+
// forms, but it also picks the heading level, which bloomer's `isSize`
|
|
314
|
+
// never did. The special keeps the level, moving the size to `textSize`
|
|
315
|
+
// where `size` would change it; `isSize: size` covers the rest.
|
|
314
316
|
Title: {
|
|
315
317
|
status: 'mapped',
|
|
316
318
|
target: 'Title',
|
|
319
|
+
special: 'title',
|
|
317
320
|
props: {
|
|
318
321
|
hasTextColor: TEXT_COLOR_OK,
|
|
319
322
|
isSize: size,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specials.d.ts","sourceRoot":"","sources":["../../../src/sources/bloomer/specials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAUL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,
|
|
1
|
+
{"version":3,"file":"specials.d.ts","sourceRoot":"","sources":["../../../src/sources/bloomer/specials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAUL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EASL,KAAK,aAAa,EACnB,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EAAE,aAAa,EAAE,CAAC;AA6oC9B,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,OAAO,EAAE,GAAG,GACX,aAAa,CAQf;AAED,eAAO,MAAM,aAAa,UAAwB,CAAC"}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import { RENDER_TODO, RESPONSIVE_PROPS, UNIVERSAL_PROPS } from './mapping.js';
|
|
14
14
|
import { addAttr, attrSource, addTodo, attributesOf, findAttr, literalValueOf, makeAttr, removeAttr, resolveBooleanish, } from '../_shared/jsx-utils.js';
|
|
15
15
|
import { applyPropAction } from '../_shared/props.js';
|
|
16
|
-
import { applyIconProps, makeStripModifierProps, makeStructuralHelpers, modifierClass, parseIconClasses, restrictAsToTargets, } from '../_shared/specials-utils.js';
|
|
16
|
+
import { applyIconProps, keepTitleLevel, makeStripModifierProps, makeStructuralHelpers, modifierClass, parseIconClasses, restrictAsToTargets, } from '../_shared/specials-utils.js';
|
|
17
17
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
18
18
|
const stripModifierProps = makeStripModifierProps(UNIVERSAL_PROPS, RESPONSIVE_PROPS);
|
|
19
19
|
/**
|
|
@@ -810,15 +810,33 @@ const SPECIALS = {
|
|
|
810
810
|
return replaceWithPlain(ctx, path, element, tag, cls, 'HeroVideo');
|
|
811
811
|
},
|
|
812
812
|
/**
|
|
813
|
-
* bloomer's
|
|
814
|
-
*
|
|
813
|
+
* bloomer's Title rendered an <h1> and its Subtitle an <h2> at every
|
|
814
|
+
* `isSize`, while bestax's render the heading their `size` names. Keeping
|
|
815
|
+
* the heading level is what a screen reader hears, so the size moves to
|
|
816
|
+
* `textSize` wherever `size` would change it (see `keepTitleLevel`).
|
|
815
817
|
*/
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
818
|
+
title(ctx, path, element) {
|
|
819
|
+
return {
|
|
820
|
+
handledProps: keepTitleLevel(ctx, path, element, {
|
|
821
|
+
where: 'Title',
|
|
822
|
+
target: 'Title',
|
|
823
|
+
size: 'isSize',
|
|
824
|
+
tag: 'tag',
|
|
825
|
+
level: 'h1',
|
|
826
|
+
}),
|
|
827
|
+
};
|
|
828
|
+
},
|
|
829
|
+
/** As `title`, from bloomer's <h2>; bestax's SubTitle defaults to an <h1>. */
|
|
830
|
+
subtitle(ctx, path, element) {
|
|
831
|
+
return {
|
|
832
|
+
handledProps: keepTitleLevel(ctx, path, element, {
|
|
833
|
+
where: 'Subtitle',
|
|
834
|
+
target: 'SubTitle',
|
|
835
|
+
size: 'isSize',
|
|
836
|
+
tag: 'tag',
|
|
837
|
+
level: 'h2',
|
|
838
|
+
}),
|
|
839
|
+
};
|
|
822
840
|
},
|
|
823
841
|
/**
|
|
824
842
|
* bloomer's ModalClose always rendered Bulma's `.modal-close` overlay
|
|
@@ -38,7 +38,9 @@ export interface Modifier {
|
|
|
38
38
|
/**
|
|
39
39
|
* The prop renders this attribute too, unless the element sets its own
|
|
40
40
|
* (`Pagination.Link`'s `active` and `aria-current`), so the class converts
|
|
41
|
-
* only beside one written out, and stays a class otherwise.
|
|
41
|
+
* only beside one written out, and stays a class otherwise. On a child the
|
|
42
|
+
* target renders itself (`Menu.Item`'s `<a>`), there is no class to keep,
|
|
43
|
+
* so the element stays markup instead.
|
|
42
44
|
*/
|
|
43
45
|
readonly needsAttr?: {
|
|
44
46
|
readonly name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-map.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/class-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,MAAM,MAAM,GAChB;IAAE,QAAQ,CAAC,EAAE,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,MAA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;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEnE;AAiBD,qCAAqC;AACrC,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAE5D;AAED,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAE7D;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAGlE;AAED,qCAAqC;AACrC,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,MAAM,GACZ,QAAQ,GAAG,SAAS,CAEtB;AAED,kDAAkD;AAClD,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE5D;AAED,0CAA0C;AAC1C,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE1D"}
|
|
@@ -1825,6 +1825,8 @@ function plain(why) {
|
|
|
1825
1825
|
export const PLACED = {
|
|
1826
1826
|
// `Menu.Item` renders the `<li>` and the `<a>` inside it together. Its
|
|
1827
1827
|
// helper props go on the `<a>`, so the `<li>`'s classes all stay classes.
|
|
1828
|
+
// `active` writes `aria-current="page"` on the `<a>` unless it has its own,
|
|
1829
|
+
// as `Pagination.Link`'s does.
|
|
1828
1830
|
'menu-list': {
|
|
1829
1831
|
...BASE,
|
|
1830
1832
|
target: 'Menu.Item',
|
|
@@ -1837,7 +1839,12 @@ export const PLACED = {
|
|
|
1837
1839
|
tag: 'a',
|
|
1838
1840
|
attributesOn: 'split',
|
|
1839
1841
|
elementProps: ['id', 'title', 'role', 'tabIndex', 'style', 'data-testid'],
|
|
1840
|
-
modifiers:
|
|
1842
|
+
modifiers: {
|
|
1843
|
+
'is-active': {
|
|
1844
|
+
writes: [{ prop: 'active' }],
|
|
1845
|
+
needsAttr: { name: 'aria-current', value: 'page' },
|
|
1846
|
+
},
|
|
1847
|
+
},
|
|
1841
1848
|
after: { tag: 'ul', target: 'Menu.List' },
|
|
1842
1849
|
},
|
|
1843
1850
|
ownProps: ['as', 'active'],
|
|
@@ -769,6 +769,13 @@ function absorb(facts, where, entry, target, refuse) {
|
|
|
769
769
|
const allowed = Object.keys(modifiers);
|
|
770
770
|
return refuse('attr', 'className', `${itself}, with no class on it${allowed.length > 0 ? ` but ${orList(allowed)}` : ''}, so its \`${token}\` would be lost; keep this element as markup`);
|
|
771
771
|
}
|
|
772
|
+
// The prop writes an attribute too, unless the child has its own, and
|
|
773
|
+
// the class can't stay a class on a child the target renders itself.
|
|
774
|
+
const needs = modifier.needsAttr;
|
|
775
|
+
if (needs && !child.attributes.has(needs.name)) {
|
|
776
|
+
const attr = `\`${needs.name}="${needs.value}"\``;
|
|
777
|
+
return refuse('attr', needs.name, `${itself}, and the ${andList(modifier.writes.map(write => write.prop))} its \`${token}\` becomes renders ${attr} on it too, so it converts only beside an \`${needs.name}\` of its own. If this is the current ${needs.value}, add ${attr} to the <${spec.tag}>, then re-run; if not, keep this element as markup`);
|
|
778
|
+
}
|
|
772
779
|
for (const write of modifier.writes) {
|
|
773
780
|
props.push([write.prop, write.value ?? true]);
|
|
774
781
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAYH,eAAO,MAAM,KAAK,EAAE,WAAW,CAAC,MAAM,CAapC,CAAC;
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAYH,eAAO,MAAM,KAAK,EAAE,WAAW,CAAC,MAAM,CAapC,CAAC;AAqCH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAK1D"}
|
|
@@ -39,6 +39,11 @@ const VOCABULARY = new Set([
|
|
|
39
39
|
...(entry.defaultsUnless ?? []),
|
|
40
40
|
...Object.keys(entry.dropsAttr ?? {}),
|
|
41
41
|
...Object.keys(entry.writesAttr ?? {}),
|
|
42
|
+
// The attribute a class converts only beside (`aria-current`).
|
|
43
|
+
...[
|
|
44
|
+
...Object.values(entry.modifiers ?? {}),
|
|
45
|
+
...Object.values(entry.absorbs?.modifiers ?? {}),
|
|
46
|
+
].flatMap(modifier => modifier.needsAttr ? [modifier.needsAttr.name] : []),
|
|
42
47
|
]),
|
|
43
48
|
...Object.values(WRAPPERS),
|
|
44
49
|
...Object.values(WRAPPER_OWN_PROPS).flat(),
|
|
@@ -129,7 +129,7 @@ export const MAPPING = {
|
|
|
129
129
|
},
|
|
130
130
|
forwardRefAs: {
|
|
131
131
|
status: 'todo',
|
|
132
|
-
todo: '`forwardRefAs` is rbx-internal and has no counterpart. bestax forwards a ref from the form controls, plus `Avatar`, `Button`, `Carousel`, `CarouselItem`, `Dialog`, `Dropdown`, `Link`, `LinkButton`, `Loader`, `Menu.Item`, `Modal`, `Navbar`, `Navbar.Burger`, `Navbar.Dropdown`, `Navbar.Item`, `Navbar.Link`, `Sidebar`, `Toast` and `ToggleButton` — pass `ref` directly on those, though not on the `Field`, `Field.Label`, `Field.Body`, `Checkboxes` and `Radios` wrappers, which forward none. Mind the `Navbar.Dropdown` collision: your rbx `Navbar.Dropdown` is the menu and becomes `Navbar.DropdownMenu`, which forwards no ref, while bestax `Navbar.Dropdown` — the container your `<Navbar.Item dropdown>` becomes — does. The rest, `Box` included, forward no ref: React 18 drops it with a warning, React 19 leaves it wherever the rest props go, so put the ref on a wrapping element you control',
|
|
132
|
+
todo: '`forwardRefAs` is rbx-internal and has no counterpart. bestax forwards a ref from the form controls, plus `Avatar`, `Button`, `Carousel`, `CarouselItem`, `Dialog`, `Dropdown`, `EmptyState`, `Kbd`, `Kbd.Group`, `Link`, `LinkButton`, `Loader`, `Menu.Item`, `Modal`, `Navbar`, `Navbar.Burger`, `Navbar.Dropdown`, `Navbar.Item`, `Navbar.Link`, `SegmentedControl`, `SegmentedControl.Segment`, `Sidebar`, `Toast` and `ToggleButton` — pass `ref` directly on those, though not on the `Field`, `Field.Label`, `Field.Body`, `Checkboxes` and `Radios` wrappers, which forward none. Mind the `Navbar.Dropdown` collision: your rbx `Navbar.Dropdown` is the menu and becomes `Navbar.DropdownMenu`, which forwards no ref, while bestax `Navbar.Dropdown` — the container your `<Navbar.Item dropdown>` becomes — does. The rest, `Box` included, forward no ref: React 18 drops it with a warning, React 19 leaves it wherever the rest props go, so put the ref on a wrapping element you control',
|
|
133
133
|
},
|
|
134
134
|
// ---- elements -----------------------------------------------------------
|
|
135
135
|
Block: { status: 'mapped', target: 'Block' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specials.d.ts","sourceRoot":"","sources":["../../../src/sources/rbx/specials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAO3C,OAAO,EAYL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,
|
|
1
|
+
{"version":3,"file":"specials.d.ts","sourceRoot":"","sources":["../../../src/sources/rbx/specials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAO3C,OAAO,EAYL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAWL,KAAK,aAAa,EACnB,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EAAE,aAAa,EAAE,CAAC;AAg2B9B,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,OAAO,EAAE,GAAG,GACX,aAAa,CAIf"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { BADGE_PROPS, RESPONSIVE_BREAKPOINTS, TOOLTIP_PROPS, UNIVERSAL_PROPS, } from './mapping.js';
|
|
17
17
|
import { addAttr, addTodo, buildJsxName, attributesOf, findAttr, jsxNameParts, literalValueOf, makeAttr, plainElement, removeAttr, resolveBooleanish, } from '../_shared/jsx-utils.js';
|
|
18
|
-
import { alignTarget, applyIconProps, makeStripModifierProps, makeStructuralHelpers, mergeClassName, modifierClass, parseIconClasses, restrictAsToTargets, } from '../_shared/specials-utils.js';
|
|
18
|
+
import { alignTarget, applyIconProps, keepTitleLevel, makeStripModifierProps, makeStructuralHelpers, mergeClassName, modifierClass, parseIconClasses, restrictAsToTargets, } from '../_shared/specials-utils.js';
|
|
19
19
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
20
20
|
const stripModifierProps = makeStripModifierProps(UNIVERSAL_PROPS, RESPONSIVE_BREAKPOINTS, 'innerRef');
|
|
21
21
|
/**
|
|
@@ -68,6 +68,8 @@ const SPECIALS = {
|
|
|
68
68
|
* rbx folds title and subtitle into one component behind a `subtitle`
|
|
69
69
|
* boolean; bestax splits them into `Title` and `SubTitle`. rbx also ignores
|
|
70
70
|
* `spaced` when `subtitle` is set, so a subtitle never carries isSpaced.
|
|
71
|
+
* Both rendered an <h1> at every `size`, which bestax's turn into the
|
|
72
|
+
* heading the size names, so `keepTitleLevel` decides where the size goes.
|
|
71
73
|
*/
|
|
72
74
|
title(ctx, path, element) {
|
|
73
75
|
const subtitleAttr = findAttr(element, 'subtitle');
|
|
@@ -110,7 +112,14 @@ const SPECIALS = {
|
|
|
110
112
|
}
|
|
111
113
|
ctx.dirty = true;
|
|
112
114
|
}
|
|
113
|
-
|
|
115
|
+
const sized = keepTitleLevel(ctx, path, element, {
|
|
116
|
+
where: 'Title',
|
|
117
|
+
target,
|
|
118
|
+
size: 'size',
|
|
119
|
+
tag: 'as',
|
|
120
|
+
level: 'h1',
|
|
121
|
+
});
|
|
122
|
+
return { target, handledProps: ['subtitle', 'spaced', ...sized] };
|
|
114
123
|
},
|
|
115
124
|
/**
|
|
116
125
|
* bestax's Icon takes a `name` (plus `library`/`variant`) instead of an
|
|
@@ -27,7 +27,7 @@ export const UNIVERSAL_PROPS = {
|
|
|
27
27
|
todo: 'this bestax component has no `as` prop; restructure the element instead',
|
|
28
28
|
},
|
|
29
29
|
domRef: {
|
|
30
|
-
todo: 'bestax-bulma has no `domRef`. The form controls, plus `Avatar`, `Button`, `Carousel`, `CarouselItem`, `Dialog`, `Dropdown`, `Link`, `LinkButton`, `Loader`, `Menu.Item`, `Modal`, `Navbar`, `Navbar.Burger`, `Navbar.Dropdown`, `Navbar.Item`, `Navbar.Link`, `Sidebar`, `Toast` and `ToggleButton` forward a ref — on those, rename `domRef` to `ref`, though not on the `Field`, `Field.Label`, `Field.Body`, `Checkboxes` and `Radios` wrappers, which forward none. Mind the `Navbar.Dropdown` collision: the `Navbar.Item` that wrapped your dropdown became bestax `Navbar.Dropdown` and forwards one, while your `Navbar.Dropdown` became `Navbar.DropdownMenu` and does not. The rest forward no ref: React 18 drops it with a warning, React 19 leaves it wherever the rest props go, so put the ref on a DOM child or wrap the component',
|
|
30
|
+
todo: 'bestax-bulma has no `domRef`. The form controls, plus `Avatar`, `Button`, `Carousel`, `CarouselItem`, `Dialog`, `Dropdown`, `EmptyState`, `Kbd`, `Kbd.Group`, `Link`, `LinkButton`, `Loader`, `Menu.Item`, `Modal`, `Navbar`, `Navbar.Burger`, `Navbar.Dropdown`, `Navbar.Item`, `Navbar.Link`, `SegmentedControl`, `SegmentedControl.Segment`, `Sidebar`, `Toast` and `ToggleButton` forward a ref — on those, rename `domRef` to `ref`, though not on the `Field`, `Field.Label`, `Field.Body`, `Checkboxes` and `Radios` wrappers, which forward none. Mind the `Navbar.Dropdown` collision: the `Navbar.Item` that wrapped your dropdown became bestax `Navbar.Dropdown` and forwards one, while your `Navbar.Dropdown` became `Navbar.DropdownMenu` and does not. The rest forward no ref: React 18 drops it with a warning, React 19 leaves it wherever the rest props go, so put the ref on a DOM child or wrap the component',
|
|
31
31
|
},
|
|
32
32
|
// ColorProps
|
|
33
33
|
backgroundColor: { rename: 'bgColor' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specials.d.ts","sourceRoot":"","sources":["../../../src/sources/react-bulma-components/specials.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAWL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,
|
|
1
|
+
{"version":3,"file":"specials.d.ts","sourceRoot":"","sources":["../../../src/sources/react-bulma-components/specials.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAWL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EASL,KAAK,aAAa,EACnB,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EAAE,aAAa,EAAE,CAAC;AAw3B9B,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,OAAO,EAAE,GAAG,GACX,aAAa,CAIf;AAED,kEAAkE;AAClE,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,QAAQ,CAGjE,CAAC"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { RESPONSIVE_BREAKPOINTS, UNIVERSAL_PROPS } from './mapping.js';
|
|
11
11
|
import { addAttr, addTodo, attributesOf, buildJsxName, findAttr, literalValueOf, makeAttr, plainElement, removeAttr, resolveBooleanish, } from '../_shared/jsx-utils.js';
|
|
12
12
|
import { enforcePolymorphicProps } from '../_shared/polymorphic.js';
|
|
13
|
-
import { alignTarget, dropLinkAttrsForPlainTag, makeStripModifierProps, mergeClassName, applyIconProps, parseIconClasses, } from '../_shared/specials-utils.js';
|
|
13
|
+
import { alignTarget, dropLinkAttrsForPlainTag, keepTitleLevel, makeStripModifierProps, mergeClassName, applyIconProps, parseIconClasses, } from '../_shared/specials-utils.js';
|
|
14
14
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
15
15
|
/**
|
|
16
16
|
* The attributes a plain-element rewrite keeps: the modifier strip decides
|
|
@@ -159,13 +159,24 @@ const SPECIALS = {
|
|
|
159
159
|
removeAttr(element, headingAttr);
|
|
160
160
|
ctx.dirty = true;
|
|
161
161
|
}
|
|
162
|
+
// Dynamic subtitle (attr kept) or no subtitle → conservative Title.
|
|
163
|
+
let target = 'Title';
|
|
162
164
|
if (subtitleAttr && !subtitleDynamic) {
|
|
163
165
|
removeAttr(element, subtitleAttr);
|
|
164
166
|
ctx.dirty = true;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
if (subtitleTruthy)
|
|
168
|
+
target = 'SubTitle';
|
|
169
|
+
}
|
|
170
|
+
// RBC rendered an <h1> (its `renderAs` default) at every `size`; bestax
|
|
171
|
+
// renders the heading the size names, so the size may move to `textSize`.
|
|
172
|
+
const handledProps = keepTitleLevel(ctx, path, element, {
|
|
173
|
+
where: 'Heading',
|
|
174
|
+
target,
|
|
175
|
+
size: 'size',
|
|
176
|
+
tag: 'renderAs',
|
|
177
|
+
level: 'h1',
|
|
178
|
+
});
|
|
179
|
+
return { target, handledProps };
|
|
169
180
|
},
|
|
170
181
|
'level-side'(ctx, path, element) {
|
|
171
182
|
return alignTarget(ctx, path, element, 'align', { left: 'Level.Left', right: 'Level.Right' }, 'Level.Left');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bestax-migrate",
|
|
3
|
-
"version": "2.25.
|
|
3
|
+
"version": "2.25.5",
|
|
4
4
|
"description": "Codemods for migrating existing React apps from other Bulma libraries to @allxsmith/bestax-bulma",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"chalk": "^6.0.0",
|
|
39
39
|
"commander": "^15.0.0",
|
|
40
40
|
"jscodeshift": "^17.3.0",
|
|
41
|
-
"@allxsmith/bestax-bulma": "^5.
|
|
41
|
+
"@allxsmith/bestax-bulma": "^5.35.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@jest/globals": "^30.0.0",
|