bestax-migrate 2.38.0 → 2.38.1
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/display.d.ts +27 -0
- package/dist/sources/_shared/display.d.ts.map +1 -0
- package/dist/sources/_shared/display.js +123 -0
- package/dist/sources/bloomer/responsive.d.ts +4 -2
- package/dist/sources/bloomer/responsive.d.ts.map +1 -1
- package/dist/sources/bloomer/responsive.js +4 -2
- package/dist/sources/bloomer/transform.d.ts.map +1 -1
- package/dist/sources/bloomer/transform.js +4 -0
- package/dist/sources/rbx/mapping.js +1 -1
- package/dist/sources/react-bulma-components/mapping.d.ts.map +1 -1
- package/dist/sources/react-bulma-components/mapping.js +4 -2
- package/dist/sources/react-bulma-components/transform.d.ts.map +1 -1
- package/dist/sources/react-bulma-components/transform.js +4 -0
- package/package.json +2 -2
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeps a base `display` that a source wrote beside a per-viewport one.
|
|
3
|
+
*
|
|
4
|
+
* bestax leaves the base `display`'s class out once any per-viewport display
|
|
5
|
+
* prop is set (`useVisibilityClasses` in bestax-bulma, which #1748 proposes to
|
|
6
|
+
* change in the next major), so a source that flattened
|
|
7
|
+
* `isDisplay={['inline-block', 'flex-desktop']}` or
|
|
8
|
+
* `display="flex" mobile={{ display: 'block' }}` into `display` plus
|
|
9
|
+
* `display<Viewport>` lost the base value: the source rendered
|
|
10
|
+
* `is-inline-block is-flex-desktop`, and bestax only `is-flex-desktop`.
|
|
11
|
+
*
|
|
12
|
+
* So the base value stays the class it stood for, in `className`, as the
|
|
13
|
+
* bulma-classes source keeps one. The flex container props render only beside
|
|
14
|
+
* a flex `display` prop, so when the base value was the flex display and no
|
|
15
|
+
* per-viewport one is, they go into `className` the same way. A value bestax
|
|
16
|
+
* doesn't take is left where it was, as the source left it: the lists are the
|
|
17
|
+
* class map's, which its value-union test holds to bestax-bulma's constants.
|
|
18
|
+
*
|
|
19
|
+
* Where a per-viewport display, the base value, the `className` or a
|
|
20
|
+
* container prop it would move is dynamic, or the element takes a spread,
|
|
21
|
+
* which could hold any of them, it changes nothing and leaves a TODO naming
|
|
22
|
+
* what to move.
|
|
23
|
+
*/
|
|
24
|
+
import type { ASTPath } from 'jscodeshift';
|
|
25
|
+
import { type TransformContext } from './jsx-utils.js';
|
|
26
|
+
export declare function keepBaseDisplay(ctx: TransformContext, path: ASTPath<any>, element: any): void;
|
|
27
|
+
//# sourceMappingURL=display.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../../src/sources/_shared/display.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAS3C,OAAO,EAOL,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AA6BxB,wBAAgB,eAAe,CAC7B,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,OAAO,EAAE,GAAG,GACX,IAAI,CA4FN"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeps a base `display` that a source wrote beside a per-viewport one.
|
|
3
|
+
*
|
|
4
|
+
* bestax leaves the base `display`'s class out once any per-viewport display
|
|
5
|
+
* prop is set (`useVisibilityClasses` in bestax-bulma, which #1748 proposes to
|
|
6
|
+
* change in the next major), so a source that flattened
|
|
7
|
+
* `isDisplay={['inline-block', 'flex-desktop']}` or
|
|
8
|
+
* `display="flex" mobile={{ display: 'block' }}` into `display` plus
|
|
9
|
+
* `display<Viewport>` lost the base value: the source rendered
|
|
10
|
+
* `is-inline-block is-flex-desktop`, and bestax only `is-flex-desktop`.
|
|
11
|
+
*
|
|
12
|
+
* So the base value stays the class it stood for, in `className`, as the
|
|
13
|
+
* bulma-classes source keeps one. The flex container props render only beside
|
|
14
|
+
* a flex `display` prop, so when the base value was the flex display and no
|
|
15
|
+
* per-viewport one is, they go into `className` the same way. A value bestax
|
|
16
|
+
* doesn't take is left where it was, as the source left it: the lists are the
|
|
17
|
+
* class map's, which its value-union test holds to bestax-bulma's constants.
|
|
18
|
+
*
|
|
19
|
+
* Where a per-viewport display, the base value, the `className` or a
|
|
20
|
+
* container prop it would move is dynamic, or the element takes a spread,
|
|
21
|
+
* which could hold any of them, it changes nothing and leaves a TODO naming
|
|
22
|
+
* what to move.
|
|
23
|
+
*/
|
|
24
|
+
import { ALIGN_CONTENTS, ALIGN_ITEMS, DISPLAYS, FLEX_DIRECTIONS, FLEX_WRAPS, JUSTIFY_CONTENTS, } from '../bulma-classes/class-map.js';
|
|
25
|
+
import { addTodo, findAttr, jsxStringValue, literalValueOf, makeAttr, removeAttr, } from './jsx-utils.js';
|
|
26
|
+
import { VIEWPORT_SUFFIX } from './viewports.js';
|
|
27
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
28
|
+
/** bestax's per-viewport display props. */
|
|
29
|
+
const VIEWPORT_DISPLAYS = Object.values(VIEWPORT_SUFFIX).map(suffix => `display${suffix}`);
|
|
30
|
+
/** The class a bestax display value writes, or none for a value it doesn't take. */
|
|
31
|
+
const displayClass = (value) => value === 'none'
|
|
32
|
+
? 'is-hidden'
|
|
33
|
+
: DISPLAYS.includes(value)
|
|
34
|
+
? `is-${value}`
|
|
35
|
+
: undefined;
|
|
36
|
+
/** The flex container props: the class prefix, and the values bestax takes. */
|
|
37
|
+
const FLEX_CONTAINER = {
|
|
38
|
+
flexDirection: ['is-flex-direction-', FLEX_DIRECTIONS],
|
|
39
|
+
flexWrap: ['is-flex-wrap-', FLEX_WRAPS],
|
|
40
|
+
justifyContent: ['is-justify-content-', JUSTIFY_CONTENTS],
|
|
41
|
+
alignContent: ['is-align-content-', ALIGN_CONTENTS],
|
|
42
|
+
alignItems: ['is-align-items-', ALIGN_ITEMS],
|
|
43
|
+
};
|
|
44
|
+
const isFlex = (value) => value === 'flex' || value === 'inline-flex';
|
|
45
|
+
export function keepBaseDisplay(ctx, path, element) {
|
|
46
|
+
const display = findAttr(element, 'display');
|
|
47
|
+
if (!display)
|
|
48
|
+
return;
|
|
49
|
+
const perViewport = VIEWPORT_DISPLAYS.map(name => findAttr(element, name)).filter(Boolean);
|
|
50
|
+
if (!perViewport.length)
|
|
51
|
+
return;
|
|
52
|
+
const todo = (message) => addTodo(ctx, path, 'prop:display-base', `bestax leaves \`display\` out beside a per-viewport display prop; ${message}`);
|
|
53
|
+
const base = literalValueOf(display);
|
|
54
|
+
if (base.kind !== 'string') {
|
|
55
|
+
todo('put the class it stands for in `className` by hand');
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const baseClass = displayClass(base.value);
|
|
59
|
+
if (!baseClass)
|
|
60
|
+
return;
|
|
61
|
+
// The container props that go with a flex base: every one written, since
|
|
62
|
+
// bestax drops all of them once no `display` prop is flex.
|
|
63
|
+
const values = perViewport.map(attr => literalValueOf(attr));
|
|
64
|
+
const flexBeside = values.some(value => value.kind === 'string' && isFlex(value.value));
|
|
65
|
+
const container = isFlex(base.value) && !flexBeside
|
|
66
|
+
? Object.keys(FLEX_CONTAINER)
|
|
67
|
+
.map(name => findAttr(element, name))
|
|
68
|
+
.filter(Boolean)
|
|
69
|
+
: [];
|
|
70
|
+
const moving = [display, ...container];
|
|
71
|
+
const names = moving.map(attr => `\`${attr.name.name}\``).join(', ');
|
|
72
|
+
const refuse = (why) => todo(`${why}, so move ${names} into \`className\` as classes by hand`);
|
|
73
|
+
if (values.some(value => value.kind !== 'string')) {
|
|
74
|
+
refuse('a per-viewport display is dynamic');
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const classes = [baseClass];
|
|
78
|
+
const moved = [display];
|
|
79
|
+
for (const attr of container) {
|
|
80
|
+
const value = literalValueOf(attr);
|
|
81
|
+
if (value.kind !== 'string') {
|
|
82
|
+
refuse(`\`${attr.name.name}\` is dynamic`);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const [prefix, allowed] = FLEX_CONTAINER[attr.name.name];
|
|
86
|
+
// bestax ignored a value it doesn't take, and the typecheck still flags it.
|
|
87
|
+
if (!allowed.includes(value.value))
|
|
88
|
+
continue;
|
|
89
|
+
classes.push(`${prefix}${value.value}`);
|
|
90
|
+
moved.push(attr);
|
|
91
|
+
}
|
|
92
|
+
const { j } = ctx;
|
|
93
|
+
const attributes = element.openingElement.attributes;
|
|
94
|
+
const className = findAttr(element, 'className');
|
|
95
|
+
// A spread could hold any prop this reads, before the written one or after
|
|
96
|
+
// it, so the pass leaves an element that takes one to the reader.
|
|
97
|
+
if (attributes.some((attr) => attr.type === 'JSXSpreadAttribute')) {
|
|
98
|
+
refuse('the element takes a spread, which could hold any of them');
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (className) {
|
|
102
|
+
const value = literalValueOf(className);
|
|
103
|
+
if (value.kind !== 'string') {
|
|
104
|
+
refuse('the `className` is dynamic');
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const written = value.value.split(/\s+/).filter(Boolean);
|
|
108
|
+
const merged = [
|
|
109
|
+
...classes.filter(cls => !written.includes(cls)),
|
|
110
|
+
...written,
|
|
111
|
+
];
|
|
112
|
+
className.value = jsxStringValue(j, merged.join(' '));
|
|
113
|
+
for (const attr of moved)
|
|
114
|
+
removeAttr(element, attr);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
// In the place of `display`.
|
|
118
|
+
attributes[attributes.indexOf(display)] = makeAttr(j, 'className', classes.join(' '));
|
|
119
|
+
for (const attr of moved.slice(1))
|
|
120
|
+
removeAttr(element, attr);
|
|
121
|
+
}
|
|
122
|
+
ctx.dirty = true;
|
|
123
|
+
}
|
|
@@ -10,9 +10,11 @@
|
|
|
10
10
|
* 1. `isDisplay` — a display, optionally suffixed with a viewport; an array
|
|
11
11
|
* of those; or an object keyed by display whose values are viewports:
|
|
12
12
|
* <Box isDisplay="flex-tablet" /> → displayTablet="flex"
|
|
13
|
-
* <Box isDisplay={['flex', 'block-mobile']} /> →
|
|
13
|
+
* <Box isDisplay={['flex', 'block-mobile']} /> → className="is-flex" displayMobile="block"
|
|
14
14
|
* <Box isDisplay={{ flex: ['default', 'desktop'] }} />
|
|
15
|
-
* →
|
|
15
|
+
* → className="is-flex" displayDesktop="flex"
|
|
16
|
+
* A plain display beside a per-viewport one stays its class, since
|
|
17
|
+
* bestax leaves `display` out beside one (`_shared/display.ts`).
|
|
16
18
|
* 2. `isHidden` — a boolean, a viewport, or an array of viewports:
|
|
17
19
|
* <Box isHidden /> → visibility="hidden"
|
|
18
20
|
* <Box isHidden="touch" /> → visibilityTouch="hidden"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responsive.d.ts","sourceRoot":"","sources":["../../../src/sources/bloomer/responsive.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"responsive.d.ts","sourceRoot":"","sources":["../../../src/sources/bloomer/responsive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EAWL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AAKjC,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,QAAQ,CAAC;AAElD,yEAAyE;AACzE,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAE3D,CAAC;AAmSF,qEAAqE;AACrE,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,OAAO,EAAE,GAAG,EACZ,IAAI,EAAE,cAAc,GACnB,IAAI,CAIN"}
|
|
@@ -10,9 +10,11 @@
|
|
|
10
10
|
* 1. `isDisplay` — a display, optionally suffixed with a viewport; an array
|
|
11
11
|
* of those; or an object keyed by display whose values are viewports:
|
|
12
12
|
* <Box isDisplay="flex-tablet" /> → displayTablet="flex"
|
|
13
|
-
* <Box isDisplay={['flex', 'block-mobile']} /> →
|
|
13
|
+
* <Box isDisplay={['flex', 'block-mobile']} /> → className="is-flex" displayMobile="block"
|
|
14
14
|
* <Box isDisplay={{ flex: ['default', 'desktop'] }} />
|
|
15
|
-
* →
|
|
15
|
+
* → className="is-flex" displayDesktop="flex"
|
|
16
|
+
* A plain display beside a per-viewport one stays its class, since
|
|
17
|
+
* bestax leaves `display` out beside one (`_shared/display.ts`).
|
|
16
18
|
* 2. `isHidden` — a boolean, a viewport, or an array of viewports:
|
|
17
19
|
* <Box isHidden /> → visibility="hidden"
|
|
18
20
|
* <Box isHidden="touch" /> → visibilityTouch="hidden"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/sources/bloomer/transform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;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/bloomer/transform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAiDvD,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,OAAO,GAAE,gBAAqB,GAC7B,MAAM,GAAG,SAAS,CAkvBpB"}
|
|
@@ -25,6 +25,7 @@ import { HELPERLESS_TARGETS, MAPPING, NO_CLASSNAME_TARGETS, UNIVERSAL_PROPS, hel
|
|
|
25
25
|
import { addTodo, attributesOf, forgetJsxParens, jsxNameParts, literalValueOf, removeAttr, renameElement, reprintDirectives, } from '../_shared/jsx-utils.js';
|
|
26
26
|
import { applyPropAction, applyUniversalProps, mergeClass, } from '../_shared/props.js';
|
|
27
27
|
import { enforcePolymorphicProps } from '../_shared/polymorphic.js';
|
|
28
|
+
import { keepBaseDisplay } from '../_shared/display.js';
|
|
28
29
|
import { bestaxValueLocals, buildBestaxImport, carryPrunedComments, placeBestaxImport, seedBestaxImport, } from '../_shared/bestax-import.js';
|
|
29
30
|
import { rewriteStylesheetImports } from '../_shared/css-imports.js';
|
|
30
31
|
import { collectBoundNames, makeReserve, nameOf, prefersTabs, resolvesToBinding, } from '../_shared/imports.js';
|
|
@@ -351,6 +352,9 @@ export default function transform(fileInfo, api, options = {}) {
|
|
|
351
352
|
}
|
|
352
353
|
}
|
|
353
354
|
applyUniversalProps(ctx, path, element, handled, UNIVERSAL_PROPS);
|
|
355
|
+
// bestax leaves a base `display` out beside a per-viewport one, so it
|
|
356
|
+
// stays the class it stood for.
|
|
357
|
+
keepBaseDisplay(ctx, path, element);
|
|
354
358
|
// Last: bestax's props follow `as`, so the element decides which of the
|
|
355
359
|
// props just written it can actually take.
|
|
356
360
|
enforcePolymorphicProps(ctx, path, element, target);
|
|
@@ -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 `Affix`, `AppFrame`, `AppFrame.Aside`, `AppFrame.Burger`, `AppFrame.Footer`, `AppFrame.Header`, `AppFrame.Main`, `AppFrame.Nav`, `Avatar`, `Button`, `Carousel`, `CarouselItem`, `Center`, `ColorSwatch`, `Command`, `Command.Dialog`, `Command.Input`, `CopyButton`, `DataTable`, `DescriptionList`, `DescriptionList.Item`, `DescriptionList.Label`, `DescriptionList.Value`, `Dialog`, `Dropdown`, `EmptyState`, `Flex`, `Group`, `IconButton`, `Kbd`, `Kbd.Group`, `Lightbox`, `Lightbox.Trigger`, `Link`, `LinkButton`, `Loader`, `LocaleProvider`, `Menu.Item`, `Modal`, `Navbar`, `Navbar.Burger`, `Navbar.Dropdown`, `Navbar.Item`, `Navbar.Link`, `NumberFormatter`, `RingProgress`, `ScrollArea`, `SegmentedControl`, `SegmentedControl.Segment`, `Sidebar`, `Splitter`, `Splitter.Pane`, `Stack`, `Stat`, `Stat.Change`, `Stat.Description`, `Stat.Label`, `Stat.Value`, `Stats`, `TableOfContents`, `Timeline`, `Timeline.Item`, `Toast`, `ToggleButton`, `TreeView` and `TreeView.Item` — 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 `Affix`, `AppFrame`, `AppFrame.Aside`, `AppFrame.Burger`, `AppFrame.Footer`, `AppFrame.Header`, `AppFrame.Main`, `AppFrame.Nav`, `Avatar`, `Button`, `Carousel`, `CarouselItem`, `Center`, `ColorSwatch`, `Command`, `Command.Dialog`, `Command.Input`, `CopyButton`, `DataTable`, `DescriptionList`, `DescriptionList.Item`, `DescriptionList.Label`, `DescriptionList.Value`, `Dialog`, `Dropdown`, `EmptyState`, `Flex`, `FloatButton`, `FloatButton.BackToTop`, `FloatButton.SpeedDial`, `FloatButtons`, `Group`, `IconButton`, `Kbd`, `Kbd.Group`, `Lightbox`, `Lightbox.Trigger`, `Link`, `LinkButton`, `Loader`, `LocaleProvider`, `Menu.Item`, `Modal`, `Navbar`, `Navbar.Burger`, `Navbar.Dropdown`, `Navbar.Item`, `Navbar.Link`, `NumberFormatter`, `RingProgress`, `ScrollArea`, `SegmentedControl`, `SegmentedControl.Segment`, `Sidebar`, `Splitter`, `Splitter.Pane`, `Stack`, `Stat`, `Stat.Change`, `Stat.Description`, `Stat.Label`, `Stat.Value`, `Stats`, `TableOfContents`, `Timeline`, `Timeline.Item`, `Toast`, `ToggleButton`, `Tour`, `Tour.Back`, `Tour.Next`, `Tour.Skip`, `Tour.Step`, `TreeView` and `TreeView.Item` — 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":"mapping.d.ts","sourceRoot":"","sources":["../../../src/sources/react-bulma-components/mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAQnE;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAgFtD,CAAC;AAEF,gEAAgE;AAChE,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAUhE,CAAC;AAIF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAI7C,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../../../src/sources/react-bulma-components/mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAQnE;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAgFtD,CAAC;AAEF,gEAAgE;AAChE,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAUhE,CAAC;AAIF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAI7C,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAorBpD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAsEhD,CAAC;AAEF,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,gBAAgB,GAAG,SAAS,CAM3E"}
|
|
@@ -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 `Affix`, `AppFrame`, `AppFrame.Aside`, `AppFrame.Burger`, `AppFrame.Footer`, `AppFrame.Header`, `AppFrame.Main`, `AppFrame.Nav`, `Avatar`, `Button`, `Carousel`, `CarouselItem`, `Center`, `ColorSwatch`, `Command`, `Command.Dialog`, `Command.Input`, `CopyButton`, `DataTable`, `DescriptionList`, `DescriptionList.Item`, `DescriptionList.Label`, `DescriptionList.Value`, `Dialog`, `Dropdown`, `EmptyState`, `Flex`, `Group`, `IconButton`, `Kbd`, `Kbd.Group`, `Lightbox`, `Lightbox.Trigger`, `Link`, `LinkButton`, `Loader`, `LocaleProvider`, `Menu.Item`, `Modal`, `Navbar`, `Navbar.Burger`, `Navbar.Dropdown`, `Navbar.Item`, `Navbar.Link`, `NumberFormatter`, `RingProgress`, `ScrollArea`, `SegmentedControl`, `SegmentedControl.Segment`, `Sidebar`, `Splitter`, `Splitter.Pane`, `Stack`, `Stat`, `Stat.Change`, `Stat.Description`, `Stat.Label`, `Stat.Value`, `Stats`, `TableOfContents`, `Timeline`, `Timeline.Item`, `Toast`, `ToggleButton`, `TreeView` and `TreeView.Item` 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 `Affix`, `AppFrame`, `AppFrame.Aside`, `AppFrame.Burger`, `AppFrame.Footer`, `AppFrame.Header`, `AppFrame.Main`, `AppFrame.Nav`, `Avatar`, `Button`, `Carousel`, `CarouselItem`, `Center`, `ColorSwatch`, `Command`, `Command.Dialog`, `Command.Input`, `CopyButton`, `DataTable`, `DescriptionList`, `DescriptionList.Item`, `DescriptionList.Label`, `DescriptionList.Value`, `Dialog`, `Dropdown`, `EmptyState`, `Flex`, `FloatButton`, `FloatButton.BackToTop`, `FloatButton.SpeedDial`, `FloatButtons`, `Group`, `IconButton`, `Kbd`, `Kbd.Group`, `Lightbox`, `Lightbox.Trigger`, `Link`, `LinkButton`, `Loader`, `LocaleProvider`, `Menu.Item`, `Modal`, `Navbar`, `Navbar.Burger`, `Navbar.Dropdown`, `Navbar.Item`, `Navbar.Link`, `NumberFormatter`, `RingProgress`, `ScrollArea`, `SegmentedControl`, `SegmentedControl.Segment`, `Sidebar`, `Splitter`, `Splitter.Pane`, `Stack`, `Stat`, `Stat.Change`, `Stat.Description`, `Stat.Label`, `Stat.Value`, `Stats`, `TableOfContents`, `Timeline`, `Timeline.Item`, `Toast`, `ToggleButton`, `Tour`, `Tour.Back`, `Tour.Next`, `Tour.Skip`, `Tour.Step`, `TreeView` and `TreeView.Item` 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' },
|
|
@@ -290,7 +290,9 @@ export const MAPPING = {
|
|
|
290
290
|
target: 'Dropdown',
|
|
291
291
|
props: {
|
|
292
292
|
label: {},
|
|
293
|
-
color: {
|
|
293
|
+
color: {
|
|
294
|
+
todo: "react-bulma-components colored the dropdown's trigger button with it, and bestax's Dropdown has no prop for that: its own `color` is the text color helper on the root, so remove it",
|
|
295
|
+
},
|
|
294
296
|
hoverable: {},
|
|
295
297
|
right: {},
|
|
296
298
|
up: {},
|
|
@@ -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;AAwCvD,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,OAAO,GAAE,gBAAqB,GAC7B,MAAM,GAAG,SAAS,CAoxBpB"}
|
|
@@ -19,6 +19,7 @@ import { applyBackgroundColor } from '../_shared/background-props.js';
|
|
|
19
19
|
import { applyPropAction, applyUniversalProps } from '../_shared/props.js';
|
|
20
20
|
import { applyTextColor } from '../_shared/text-color-props.js';
|
|
21
21
|
import { enforcePolymorphicProps } from '../_shared/polymorphic.js';
|
|
22
|
+
import { keepBaseDisplay } from '../_shared/display.js';
|
|
22
23
|
import { bestaxValueLocals, buildBestaxImport, carryPrunedComments, placeBestaxImport, seedBestaxImport, } from '../_shared/bestax-import.js';
|
|
23
24
|
import { rewriteStylesheetImports } from '../_shared/css-imports.js';
|
|
24
25
|
import { collectBoundNames, makeAliasRegistry, makeReserve, nameOf, prefersTabs, resolvesToBinding, } from '../_shared/imports.js';
|
|
@@ -355,6 +356,9 @@ export default function transform(fileInfo, api, options = {}) {
|
|
|
355
356
|
applyBackgroundColor(ctx, path, element, target, handled);
|
|
356
357
|
applyTextColor(ctx, path, element, target, handled);
|
|
357
358
|
applyUniversalProps(ctx, path, element, handled, UNIVERSAL_PROPS);
|
|
359
|
+
// bestax leaves a base `display` out beside a per-viewport one, so it
|
|
360
|
+
// stays the class it stood for.
|
|
361
|
+
keepBaseDisplay(ctx, path, element);
|
|
358
362
|
// Last: bestax's props follow `as`, so the element decides which of the
|
|
359
363
|
// props just written it can actually take.
|
|
360
364
|
enforcePolymorphicProps(ctx, path, element, target);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bestax-migrate",
|
|
3
|
-
"version": "2.38.
|
|
3
|
+
"version": "2.38.1",
|
|
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.
|
|
43
|
+
"@allxsmith/bestax-bulma": "^5.72.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/jscodeshift": "^17.3.0",
|