bestax-migrate 2.36.5 → 2.36.6
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/text-color-props.d.ts +23 -0
- package/dist/sources/_shared/text-color-props.d.ts.map +1 -0
- package/dist/sources/_shared/text-color-props.js +79 -0
- package/dist/sources/rbx/transform.d.ts.map +1 -1
- package/dist/sources/rbx/transform.js +2 -0
- package/dist/sources/react-bulma-components/mapping.js +1 -1
- package/dist/sources/react-bulma-components/transform.d.ts.map +1 -1
- package/dist/sources/react-bulma-components/transform.js +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ASTPath } from 'jscodeshift';
|
|
2
|
+
import { type TransformContext } from './jsx-utils.js';
|
|
3
|
+
/**
|
|
4
|
+
* The bestax targets whose props have no `textColor`, by the name the
|
|
5
|
+
* mappings and structural handlers use as their `target`.
|
|
6
|
+
* react-bulma-components and rbx pass `textColor` through on every
|
|
7
|
+
* component, which is right everywhere else.
|
|
8
|
+
*
|
|
9
|
+
* bulma-ui declares `textColor` per component, so this is a hand copy.
|
|
10
|
+
* `e2e/text-color-props.test.ts` holds it, and every target the two sources
|
|
11
|
+
* name, to the library's types.
|
|
12
|
+
*/
|
|
13
|
+
export declare const NO_TEXT_COLOR: ReadonlySet<string>;
|
|
14
|
+
/** The TODO a target that takes no `textColor` gets. */
|
|
15
|
+
export declare const NO_TEXT_COLOR_TODO = "this bestax component takes no `textColor` prop; move the color to a `has-text-*` class in `className`";
|
|
16
|
+
/**
|
|
17
|
+
* Leave a TODO on the element's `textColor` where `target` takes no such
|
|
18
|
+
* prop, and mark it handled so the universal pass leaves it alone. Should a
|
|
19
|
+
* component's own prop map ever claim `textColor`, it wins, as it does for
|
|
20
|
+
* every prop.
|
|
21
|
+
*/
|
|
22
|
+
export declare function applyTextColor(ctx: TransformContext, path: ASTPath<any>, element: any, target: string, handled: Set<string>): void;
|
|
23
|
+
//# sourceMappingURL=text-color-props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-color-props.d.ts","sourceRoot":"","sources":["../../../src/sources/_shared/text-color-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAY,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAKjE;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,MAAM,CAgD5C,CAAC;AAEH,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,2GAC2E,CAAC;AAE3G;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,OAAO,EAAE,GAAG,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,GACnB,IAAI,CAMN"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { findAttr } from './jsx-utils.js';
|
|
2
|
+
import { applyPropAction } from './props.js';
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
|
+
/**
|
|
5
|
+
* The bestax targets whose props have no `textColor`, by the name the
|
|
6
|
+
* mappings and structural handlers use as their `target`.
|
|
7
|
+
* react-bulma-components and rbx pass `textColor` through on every
|
|
8
|
+
* component, which is right everywhere else.
|
|
9
|
+
*
|
|
10
|
+
* bulma-ui declares `textColor` per component, so this is a hand copy.
|
|
11
|
+
* `e2e/text-color-props.test.ts` holds it, and every target the two sources
|
|
12
|
+
* name, to the library's types.
|
|
13
|
+
*/
|
|
14
|
+
export const NO_TEXT_COLOR = new Set([
|
|
15
|
+
'Breadcrumb',
|
|
16
|
+
'Divider',
|
|
17
|
+
'Dropdown',
|
|
18
|
+
'Dropdown.Divider',
|
|
19
|
+
'Dropdown.Item',
|
|
20
|
+
'File',
|
|
21
|
+
'Hero',
|
|
22
|
+
'Input',
|
|
23
|
+
'Loading',
|
|
24
|
+
'Menu',
|
|
25
|
+
'Menu.Item',
|
|
26
|
+
'Menu.Label',
|
|
27
|
+
'Menu.List',
|
|
28
|
+
'Message.Body',
|
|
29
|
+
'Message.Header',
|
|
30
|
+
'Modal.Background',
|
|
31
|
+
'Modal.Card',
|
|
32
|
+
'Modal.Card.Body',
|
|
33
|
+
'Modal.Card.Foot',
|
|
34
|
+
'Modal.Card.Head',
|
|
35
|
+
'Modal.Card.Title',
|
|
36
|
+
'Modal.Close',
|
|
37
|
+
'Modal.Content',
|
|
38
|
+
'Navbar.Divider',
|
|
39
|
+
'Navbar.Dropdown',
|
|
40
|
+
'Navbar.DropdownMenu',
|
|
41
|
+
'Pagination.Ellipsis',
|
|
42
|
+
'Pagination.Next',
|
|
43
|
+
'Pagination.Previous',
|
|
44
|
+
'Panel',
|
|
45
|
+
'Panel.Block',
|
|
46
|
+
'Panel.Heading',
|
|
47
|
+
'Panel.Tabs',
|
|
48
|
+
'Progress',
|
|
49
|
+
'Select',
|
|
50
|
+
'Table',
|
|
51
|
+
'Table.Tbody',
|
|
52
|
+
'Table.Td',
|
|
53
|
+
'Table.Tfoot',
|
|
54
|
+
'Table.Th',
|
|
55
|
+
'Table.Thead',
|
|
56
|
+
'Table.Tr',
|
|
57
|
+
'Tabs',
|
|
58
|
+
'Tabs.Item',
|
|
59
|
+
'Tag',
|
|
60
|
+
'Tags',
|
|
61
|
+
'TextArea',
|
|
62
|
+
]);
|
|
63
|
+
/** The TODO a target that takes no `textColor` gets. */
|
|
64
|
+
export const NO_TEXT_COLOR_TODO = 'this bestax component takes no `textColor` prop; move the color to a `has-text-*` class in `className`';
|
|
65
|
+
/**
|
|
66
|
+
* Leave a TODO on the element's `textColor` where `target` takes no such
|
|
67
|
+
* prop, and mark it handled so the universal pass leaves it alone. Should a
|
|
68
|
+
* component's own prop map ever claim `textColor`, it wins, as it does for
|
|
69
|
+
* every prop.
|
|
70
|
+
*/
|
|
71
|
+
export function applyTextColor(ctx, path, element, target, handled) {
|
|
72
|
+
if (handled.has('textColor') || !NO_TEXT_COLOR.has(target))
|
|
73
|
+
return;
|
|
74
|
+
const attr = findAttr(element, 'textColor');
|
|
75
|
+
if (!attr)
|
|
76
|
+
return;
|
|
77
|
+
handled.add('textColor');
|
|
78
|
+
applyPropAction(ctx, path, element, attr, { todo: NO_TEXT_COLOR_TODO });
|
|
79
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/sources/rbx/transform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/sources/rbx/transform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAqDvD,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,OAAO,GAAE,gBAAqB,GAC7B,MAAM,GAAG,SAAS,CAw+BpB"}
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
import { BADGE_PROPS, MAPPING, TOOLTIP_PROPS, UNIVERSAL_PROPS, resolveMapping, } from './mapping.js';
|
|
23
23
|
import { addTodo, attributesOf, findAttr, forgetJsxParens, jsxNameParts, literalValueOf, removeAttr, renameElement, reprintDirectives, } from '../_shared/jsx-utils.js';
|
|
24
24
|
import { applyPropAction, applyUniversalProps } from '../_shared/props.js';
|
|
25
|
+
import { applyTextColor } from '../_shared/text-color-props.js';
|
|
25
26
|
import { enforcePolymorphicProps } from '../_shared/polymorphic.js';
|
|
26
27
|
import { BESTAX, bestaxValueLocals, buildBestaxImport, carryPrunedComments, placeBestaxImport, seedBestaxImport, } from '../_shared/bestax-import.js';
|
|
27
28
|
import { rewriteStylesheetImports } from '../_shared/css-imports.js';
|
|
@@ -487,6 +488,7 @@ export default function transform(fileInfo, api, options = {}) {
|
|
|
487
488
|
applyPropAction(ctx, path, element, attr, action);
|
|
488
489
|
}
|
|
489
490
|
}
|
|
491
|
+
applyTextColor(ctx, path, element, target, handled);
|
|
490
492
|
applyUniversalProps(ctx, path, element, handled, UNIVERSAL_PROPS);
|
|
491
493
|
// After every prop pass: bestax's props follow `as`, so the element
|
|
492
494
|
// decides which of the props just written it can actually take. The
|
|
@@ -33,7 +33,7 @@ export const UNIVERSAL_PROPS = {
|
|
|
33
33
|
backgroundColor: { rename: 'bgColor' },
|
|
34
34
|
textColor: {},
|
|
35
35
|
colorVariant: {
|
|
36
|
-
todo: "no direct equivalent; use isLight (Button/Notification) or a color shade like bgColor='primary' backgroundColorShade='90'",
|
|
36
|
+
todo: "no direct equivalent; for 'light', use isLight (Button/Notification/Tag) or a color shade like bgColor='primary' backgroundColorShade='90'",
|
|
37
37
|
},
|
|
38
38
|
// TypographyProps
|
|
39
39
|
textSize: { numberToString: true },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/sources/react-bulma-components/transform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/sources/react-bulma-components/transform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAqCvD,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,OAAO,GAAE,gBAAqB,GAC7B,MAAM,GAAG,SAAS,CA8wBpB"}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import { MAPPING, UNIVERSAL_PROPS, resolveMapping } from './mapping.js';
|
|
17
17
|
import { addTodo, attributesOf, forgetJsxParens, jsxNameParts, renameElement, reprintDirectives, } from '../_shared/jsx-utils.js';
|
|
18
18
|
import { applyPropAction, applyUniversalProps } from '../_shared/props.js';
|
|
19
|
+
import { applyTextColor } from '../_shared/text-color-props.js';
|
|
19
20
|
import { enforcePolymorphicProps } from '../_shared/polymorphic.js';
|
|
20
21
|
import { bestaxValueLocals, buildBestaxImport, carryPrunedComments, placeBestaxImport, seedBestaxImport, } from '../_shared/bestax-import.js';
|
|
21
22
|
import { rewriteStylesheetImports } from '../_shared/css-imports.js';
|
|
@@ -348,6 +349,7 @@ export default function transform(fileInfo, api, options = {}) {
|
|
|
348
349
|
applyPropAction(ctx, path, element, attr, action);
|
|
349
350
|
}
|
|
350
351
|
}
|
|
352
|
+
applyTextColor(ctx, path, element, target, handled);
|
|
351
353
|
applyUniversalProps(ctx, path, element, handled, UNIVERSAL_PROPS);
|
|
352
354
|
// Last: bestax's props follow `as`, so the element decides which of the
|
|
353
355
|
// props just written it can actually take.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bestax-migrate",
|
|
3
|
-
"version": "2.36.
|
|
3
|
+
"version": "2.36.6",
|
|
4
4
|
"description": "Codemods for migrating existing React apps from other Bulma libraries to @allxsmith/bestax-bulma",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"jscodeshift": "^17.3.0",
|
|
41
41
|
"parse5": "^8.1.1",
|
|
42
42
|
"property-information": "^7.2.0",
|
|
43
|
-
"@allxsmith/bestax-bulma": "^5.68.
|
|
43
|
+
"@allxsmith/bestax-bulma": "^5.68.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/jscodeshift": "^17.3.0",
|