bestax-migrate 2.37.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.
@@ -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
+ }
@@ -11,13 +11,37 @@ import { type TransformContext } from './jsx-utils.js';
11
11
  * name, to the library's types.
12
12
  */
13
13
  export declare const NO_TEXT_COLOR: ReadonlySet<string>;
14
+ /**
15
+ * The targets in `NO_TEXT_COLOR` whose `color` prop is the text color helper
16
+ * (`Table` and its `Thead`, `Tbody` and `Tfoot`, `Menu` and its parts, and
17
+ * `Dropdown` and its `Item`, but not `Table.Tr`, `Td` or `Th`, whose `color`
18
+ * is their own modifier),
19
+ * rendering `has-text-<color>` as a source's `textColor` did, so `textColor`
20
+ * becomes `color` there. A component's own `color` can share the helper's
21
+ * type and mean something else (Hero's renders `is-<color>`), so
22
+ * `e2e/text-color-props.test.ts` renders each one to check.
23
+ */
24
+ export declare const TEXT_COLOR_VIA_COLOR: ReadonlySet<string>;
14
25
  /** The TODO a target that takes no `textColor` gets. */
15
26
  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
27
  /**
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.
28
+ * The values the rename writes into `color`: bestax's color names, which the
29
+ * bulma-classes tests hold to its own, and the two keywords. The e2e checks
30
+ * every listed target's `color` takes all of them.
31
+ */
32
+ export declare const HELPER_COLORS: readonly string[];
33
+ /** The TODO where `color` carries the text color but the element already sets it. */
34
+ export declare const COLOR_TAKEN_TODO = "this bestax component takes no `textColor` prop, and its `color`, which renders `has-text-*` here, is set on this element or may come from a spread; reconcile the two by hand";
35
+ /** The TODO where `color` carries the text color but may not take this value. */
36
+ export declare const COLOR_VALUE_TODO = "this bestax component takes no `textColor` prop; its `color` renders `has-text-*` for bestax's color names, with `colorShade` for a shade, so use those, or move the color to a `has-text-*` class in `className`";
37
+ /**
38
+ * Handle the element's `textColor` where `target` takes no such prop: rename
39
+ * it to `color` where that is the target's text color helper, the element
40
+ * sets no `color` of its own (nor has a spread that could) and the value is
41
+ * one of bestax's color names,
42
+ * and leave a TODO otherwise. Either way it's marked handled, so the
43
+ * universal pass leaves it alone. Should a component's own prop map ever
44
+ * claim `textColor`, it wins, as it does for every prop.
21
45
  */
22
46
  export declare function applyTextColor(ctx: TransformContext, path: ASTPath<any>, element: any, target: string, handled: Set<string>): void;
23
47
  //# sourceMappingURL=text-color-props.d.ts.map
@@ -1 +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"}
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;AAE3C,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAKxB;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,MAAM,CAgD5C,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAWnD,CAAC;AAEH,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,2GAC2E,CAAC;AAE3G;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAI1C,CAAC;AAEF,qFAAqF;AACrF,eAAO,MAAM,gBAAgB,mLACqJ,CAAC;AAEnL,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,sNACwL,CAAC;AAEtN;;;;;;;;GAQG;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,CA0BN"}
@@ -1,4 +1,5 @@
1
- import { findAttr } from './jsx-utils.js';
1
+ import { COLORS } from '../bulma-classes/class-map.js';
2
+ import { findAttr, literalValueOf, } from './jsx-utils.js';
2
3
  import { applyPropAction } from './props.js';
3
4
  /* eslint-disable @typescript-eslint/no-explicit-any */
4
5
  /**
@@ -60,13 +61,52 @@ export const NO_TEXT_COLOR = new Set([
60
61
  'Tags',
61
62
  'TextArea',
62
63
  ]);
64
+ /**
65
+ * The targets in `NO_TEXT_COLOR` whose `color` prop is the text color helper
66
+ * (`Table` and its `Thead`, `Tbody` and `Tfoot`, `Menu` and its parts, and
67
+ * `Dropdown` and its `Item`, but not `Table.Tr`, `Td` or `Th`, whose `color`
68
+ * is their own modifier),
69
+ * rendering `has-text-<color>` as a source's `textColor` did, so `textColor`
70
+ * becomes `color` there. A component's own `color` can share the helper's
71
+ * type and mean something else (Hero's renders `is-<color>`), so
72
+ * `e2e/text-color-props.test.ts` renders each one to check.
73
+ */
74
+ export const TEXT_COLOR_VIA_COLOR = new Set([
75
+ 'Dropdown',
76
+ 'Dropdown.Item',
77
+ 'Menu',
78
+ 'Menu.Item',
79
+ 'Menu.Label',
80
+ 'Menu.List',
81
+ 'Table',
82
+ 'Table.Tbody',
83
+ 'Table.Tfoot',
84
+ 'Table.Thead',
85
+ ]);
63
86
  /** The TODO a target that takes no `textColor` gets. */
64
87
  export const NO_TEXT_COLOR_TODO = 'this bestax component takes no `textColor` prop; move the color to a `has-text-*` class in `className`';
65
88
  /**
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.
89
+ * The values the rename writes into `color`: bestax's color names, which the
90
+ * bulma-classes tests hold to its own, and the two keywords. The e2e checks
91
+ * every listed target's `color` takes all of them.
92
+ */
93
+ export const HELPER_COLORS = [
94
+ ...COLORS,
95
+ 'inherit',
96
+ 'current',
97
+ ];
98
+ /** The TODO where `color` carries the text color but the element already sets it. */
99
+ export const COLOR_TAKEN_TODO = 'this bestax component takes no `textColor` prop, and its `color`, which renders `has-text-*` here, is set on this element or may come from a spread; reconcile the two by hand';
100
+ /** The TODO where `color` carries the text color but may not take this value. */
101
+ export const COLOR_VALUE_TODO = "this bestax component takes no `textColor` prop; its `color` renders `has-text-*` for bestax's color names, with `colorShade` for a shade, so use those, or move the color to a `has-text-*` class in `className`";
102
+ /**
103
+ * Handle the element's `textColor` where `target` takes no such prop: rename
104
+ * it to `color` where that is the target's text color helper, the element
105
+ * sets no `color` of its own (nor has a spread that could) and the value is
106
+ * one of bestax's color names,
107
+ * and leave a TODO otherwise. Either way it's marked handled, so the
108
+ * universal pass leaves it alone. Should a component's own prop map ever
109
+ * claim `textColor`, it wins, as it does for every prop.
70
110
  */
71
111
  export function applyTextColor(ctx, path, element, target, handled) {
72
112
  if (handled.has('textColor') || !NO_TEXT_COLOR.has(target))
@@ -75,5 +115,16 @@ export function applyTextColor(ctx, path, element, target, handled) {
75
115
  if (!attr)
76
116
  return;
77
117
  handled.add('textColor');
78
- applyPropAction(ctx, path, element, attr, { todo: NO_TEXT_COLOR_TODO });
118
+ if (!TEXT_COLOR_VIA_COLOR.has(target)) {
119
+ applyPropAction(ctx, path, element, attr, { todo: NO_TEXT_COLOR_TODO });
120
+ return;
121
+ }
122
+ const spread = element.openingElement.attributes.some((a) => a.type === 'JSXSpreadAttribute');
123
+ if (spread || findAttr(element, 'color')) {
124
+ applyPropAction(ctx, path, element, attr, { todo: COLOR_TAKEN_TODO });
125
+ return;
126
+ }
127
+ const literal = literalValueOf(attr);
128
+ const known = literal.kind === 'string' && HELPER_COLORS.includes(literal.value);
129
+ applyPropAction(ctx, path, element, attr, known ? { rename: 'color' } : { todo: COLOR_VALUE_TODO });
79
130
  }
@@ -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']} /> → display="flex" displayMobile="block"
13
+ * <Box isDisplay={['flex', 'block-mobile']} /> → className="is-flex" displayMobile="block"
14
14
  * <Box isDisplay={{ flex: ['default', 'desktop'] }} />
15
- * → display="flex" displayDesktop="flex"
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;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"}
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']} /> → display="flex" displayMobile="block"
13
+ * <Box isDisplay={['flex', 'block-mobile']} /> → className="is-flex" displayMobile="block"
14
14
  * <Box isDisplay={{ flex: ['default', 'desktop'] }} />
15
- * → display="flex" displayDesktop="flex"
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;AAgDvD,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,OAAO,GAAE,gBAAqB,GAC7B,MAAM,GAAG,SAAS,CA8uBpB"}
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,CAkrBpD,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"}
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;AAuCvD,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,OAAO,GAAE,gBAAqB,GAC7B,MAAM,GAAG,SAAS,CAgxBpB"}
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.37.0",
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.68.3"
43
+ "@allxsmith/bestax-bulma": "^5.72.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/jscodeshift": "^17.3.0",