bestax-migrate 2.21.0 → 2.22.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/sources/_shared/props.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAUL,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAIxB;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,OAAO,EAAE,GAAG,EACZ,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,IAAI,CAEN;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,OAAO,EAAE,GAAG,EACZ,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,GAAG,GACR,IAAI,CAmBN;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,OAAO,EAAE,GAAG,EACZ,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,GACnB,IAAI,CAoBN;AAED,mDAAmD;AACnD,wBAAgB,eAAe,CAC7B,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,OAAO,EAAE,GAAG,EACZ,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,UAAU,GACjB,IAAI,CAqLN;AAED;;;;GAIG;AACH,wBAAgB,mBAAm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,EAAE,GAAG,EACT,MAAM,EAAE,UAAU,GACjB,IAAI,CA8LN;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,EACpB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GACzC,IAAI,CAQN"}
@@ -94,10 +94,17 @@ export function applyPropAction(ctx, path, element, attr, action) {
94
94
  return;
95
95
  }
96
96
  const literal = literalValueOf(attr);
97
+ // A number literal is keyed by its string form (`delta={0}` by `'0'`).
98
+ const todoKey = literal.kind === 'string' || literal.kind === 'number'
99
+ ? String(literal.value)
100
+ : undefined;
97
101
  if (action.valueTodo &&
98
- literal.kind === 'string' &&
99
- action.valueTodo[literal.value]) {
100
- addTodo(ctx, path, `prop:${originalName}`, `\`${originalName}="${literal.value}"\` — ${action.valueTodo[literal.value]}`);
102
+ todoKey !== undefined &&
103
+ Object.hasOwn(action.valueTodo, todoKey)) {
104
+ const written = literal.kind === 'number'
105
+ ? `${originalName}={${todoKey}}`
106
+ : `${originalName}="${todoKey}"`;
107
+ addTodo(ctx, path, `prop:${originalName}`, `\`${written}\` — ${action.valueTodo[todoKey]}`);
101
108
  return;
102
109
  }
103
110
  if (action.valueToProp) {
@@ -35,6 +35,15 @@ export interface Modifier {
35
35
  * handed to the prop as it is.
36
36
  */
37
37
  readonly onlyTrue?: boolean;
38
+ /**
39
+ * The prop renders this attribute too, unless the element sets its own
40
+ * (`Pagination.Link`'s `active` and `aria-current`), so the class converts
41
+ * only beside one written out, and stays a class otherwise.
42
+ */
43
+ readonly needsAttr?: {
44
+ readonly name: string;
45
+ readonly value: string;
46
+ };
38
47
  }
39
48
  /**
40
49
  * - `mapped`: converts to `target`.
@@ -203,6 +212,25 @@ export interface RootEntry {
203
212
  readonly folds?: readonly PropWrite[];
204
213
  /** The target renders the element's only child itself. */
205
214
  readonly absorbs?: Absorbs;
215
+ /**
216
+ * The target renders a bare `<tag>` around the element too
217
+ * (`Pagination.Link`'s `<li>`), so the element converts only as the only
218
+ * child of a bare one, which it takes the place of.
219
+ */
220
+ readonly parent?: {
221
+ readonly tag: string;
222
+ };
223
+ /**
224
+ * The target renders this text as its content, whatever it's given
225
+ * (`Pagination.Ellipsis`' `…`), so the element converts only holding
226
+ * exactly it, and closes itself.
227
+ */
228
+ readonly rendersText?: string;
229
+ /**
230
+ * The target writes a given `className` in place of its own class, so the
231
+ * element converts only with no other class.
232
+ */
233
+ readonly classNameReplaces?: boolean;
206
234
  /** Props the target needs to render this class at all (`variant="lines"`). */
207
235
  readonly writes?: readonly PropWrite[];
208
236
  /**
@@ -227,9 +255,10 @@ export interface RootEntry {
227
255
  };
228
256
  /**
229
257
  * Attributes the target types as numbers, among the ones it is given (the
230
- * child's, when it `absorbs` the child and puts them there). A numeric
231
- * string (`value="40"`) becomes a number, which renders the same; any
232
- * other string refuses.
258
+ * child's, when it `absorbs` the child and puts them there), beside
259
+ * `NUMBER_ATTRS`, which every target types that way. A numeric string
260
+ * (`value="40"`) becomes a number, which renders the same; any other
261
+ * string refuses.
233
262
  */
234
263
  readonly numberAttrs?: readonly string[];
235
264
  /** Attributes the target drops: on these tags, or on all tags except these. */
@@ -284,6 +313,13 @@ export declare const PLACED: Readonly<Record<string, RootEntry>>;
284
313
  * other root stays in `className`, which renders the same either way.
285
314
  */
286
315
  export declare const PRECEDENCE: readonly string[];
316
+ /**
317
+ * Attributes every target types as a number, as React types them on any
318
+ * element: a `tabIndex="0"` converts as `tabIndex={0}`.
319
+ */
320
+ export declare const NUMBER_ATTRS: readonly string[];
321
+ /** The attributes an entry's target types as numbers. */
322
+ export declare function numberAttrsOf(entry: RootEntry): readonly string[];
287
323
  /** Refs reach the element only through these targets. */
288
324
  export declare const FORWARDS_REF: readonly string[];
289
325
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"class-map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,CAAC,MAAM,CAS3C,CAAC;AAIH;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CA0CA,CAAC;AAEF;;;;;GAKG;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"}
@@ -1448,6 +1448,13 @@ export const ROOTS = {
1448
1448
  'total',
1449
1449
  'current',
1450
1450
  'onPageChange',
1451
+ 'siblingCount',
1452
+ 'boundaryCount',
1453
+ 'previousLabel',
1454
+ 'nextLabel',
1455
+ 'disabled',
1456
+ 'getPageHref',
1457
+ 'getPageLabel',
1451
1458
  ],
1452
1459
  },
1453
1460
  'pagination-list': {
@@ -1466,7 +1473,6 @@ export const ROOTS = {
1466
1473
  bgColor: null,
1467
1474
  noHelpers: true,
1468
1475
  defaults: { tabIndex: '0' },
1469
- numberAttrs: ['tabIndex'],
1470
1476
  omits: {
1471
1477
  'is-disabled': '`disabled` also writes `aria-disabled` and `tabIndex="-1"`',
1472
1478
  },
@@ -1480,14 +1486,44 @@ export const ROOTS = {
1480
1486
  bgColor: null,
1481
1487
  noHelpers: true,
1482
1488
  defaults: { tabIndex: '0' },
1483
- numberAttrs: ['tabIndex'],
1484
1489
  omits: {
1485
1490
  'is-disabled': '`disabled` also writes `aria-disabled` and `tabIndex="-1"`',
1486
1491
  },
1487
1492
  ownProps: ['disabled'],
1488
1493
  },
1489
- 'pagination-link': todo('Pagination.Link', 'bestax `Pagination.Link` renders its own `<li>` around the `<a>`'),
1490
- 'pagination-ellipsis': todo('Pagination.Ellipsis', 'bestax `Pagination.Ellipsis` renders its own `<li>` and its own `&hellip;`'),
1494
+ // A page link and the ellipsis each render the bare `<li>` around them, so
1495
+ // each converts in its `<li>`'s place. A link writes `tabIndex` before the
1496
+ // props it's given, and `active` writes `aria-current="page"` the same way.
1497
+ 'pagination-link': {
1498
+ ...BASE,
1499
+ target: 'Pagination.Link',
1500
+ tag: 'a',
1501
+ parent: { tag: 'li' },
1502
+ modifiers: {
1503
+ 'is-current': {
1504
+ writes: [{ prop: 'active' }],
1505
+ needsAttr: { name: 'aria-current', value: 'page' },
1506
+ },
1507
+ },
1508
+ defaults: { tabIndex: '0' },
1509
+ omits: {
1510
+ 'is-disabled': '`disabled` also writes `aria-disabled` and `tabIndex="-1"`',
1511
+ },
1512
+ ownProps: ['color', 'textColor', 'bgColor', 'active', 'disabled'],
1513
+ },
1514
+ // It renders its own `…`, and a `className` it's given replaces its class.
1515
+ 'pagination-ellipsis': {
1516
+ status: 'mapped',
1517
+ target: 'Pagination.Ellipsis',
1518
+ tag: 'span',
1519
+ textColor: null,
1520
+ bgColor: null,
1521
+ noHelpers: true,
1522
+ parent: { tag: 'li' },
1523
+ rendersText: '\u2026',
1524
+ classNameReplaces: true,
1525
+ ownProps: [],
1526
+ },
1491
1527
  // `Panel`'s `color` renders `has-text-<color>` as well as `is-<color>`, and it
1492
1528
  // has no text or background color prop. Its heading, tabs and block are
1493
1529
  // plain elements with their class, and take no helper props.
@@ -1657,7 +1693,6 @@ export const PLACED = {
1657
1693
  modifiers: flags({ 'is-active': 'active' }),
1658
1694
  after: { tag: 'ul', target: 'Menu.List' },
1659
1695
  },
1660
- numberAttrs: ['tabIndex'],
1661
1696
  ownProps: ['as', 'active'],
1662
1697
  passThrough: ['id', 'title', 'role', 'tabIndex', 'style', 'data-testid'],
1663
1698
  },
@@ -1724,6 +1759,15 @@ export const PRECEDENCE = [
1724
1759
  'content',
1725
1760
  'block',
1726
1761
  ];
1762
+ /**
1763
+ * Attributes every target types as a number, as React types them on any
1764
+ * element: a `tabIndex="0"` converts as `tabIndex={0}`.
1765
+ */
1766
+ export const NUMBER_ATTRS = ['tabIndex'];
1767
+ /** The attributes an entry's target types as numbers. */
1768
+ export function numberAttrsOf(entry) {
1769
+ return [...new Set([...NUMBER_ATTRS, ...(entry.numberAttrs ?? [])])];
1770
+ }
1727
1771
  /** Refs reach the element only through these targets. */
1728
1772
  export const FORWARDS_REF = [
1729
1773
  'Button',
@@ -88,6 +88,20 @@ export interface ElementFacts {
88
88
  * (`tokens` is empty either way).
89
89
  */
90
90
  emptyClass?: boolean;
91
+ /**
92
+ * The plain HTML element around this one, when this is its only child:
93
+ * what an entry whose target renders that element too reads.
94
+ */
95
+ soleChildOf?: ChildFacts;
96
+ /**
97
+ * The component that element is the only child of, if any: `onlyChildOf`
98
+ * for the element such an entry takes the place of.
99
+ */
100
+ holderOnlyChildOf?: string;
101
+ /**
102
+ * The string the element's content renders, when it is one static text.
103
+ */
104
+ text?: string;
91
105
  }
92
106
  export interface ChildFacts {
93
107
  tag: string;
@@ -149,6 +163,11 @@ export interface Conversion {
149
163
  * they go, and the element closes itself.
150
164
  */
151
165
  rendersChildren?: true;
166
+ /**
167
+ * The target renders the bare element around this one too: the component
168
+ * takes that element's place, with its `key`.
169
+ */
170
+ replacesParent?: true;
152
171
  /**
153
172
  * Conditional classes (`ElementFacts.conditional`) that become a boolean
154
173
  * prop set to their condition, each once. The rest stay in the joiner call.
@@ -1 +1 @@
1
- {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAkBH,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,2DAA2D;IAC3D,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC;IAC7C;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B;;;OAGG;IACH,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;IACtD,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,4EAA4E;IAC5E,WAAW,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB;;;;OAIG;IACH,aAAa,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACtC,qEAAqE;IACrE,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,qEAAqE;IACrE,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;OAGG;IACH,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,U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A4D;IAC5D,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,mEAAmE;IACnE,IAAI,EAAE,MAAM,EAAE,CAAC;IACf;;;OAGG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE;QACR,oEAAoE;QACpE,KAAK,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;QACnD,4DAA4D;QAC5D,OAAO,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;QAC3C,qDAAqD;QACrD,IAAI,EAAE,MAAM,EAAE,CAAC;QACf;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF;;;OAGG;IACH,eAAe,CAAC,EAAE,IAAI,CAAC;IACvB;;;OAGG;IACH,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,IAAI;IACnB,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B;;;OAGG;IACH,IAAI,CAAC,EAAE;QACL,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;QACnD,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;IACF,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AA+BD,wBAAgB,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CA6d9C"}
@@ -9,7 +9,7 @@
9
9
  * the whole element with a TODO (an attribute or tag the component would
10
10
  * render differently).
11
11
  */
12
- import { FORWARDS_REF, HELPER_PROPS, HELPER_TOKENS, inTagSet, legacyHint, modifierFor, placedFor, PRECEDENCE, rootFor, WRAPPER_OWN_PROPS, wrapperFor, } from './class-map.js';
12
+ import { FORWARDS_REF, HELPER_PROPS, HELPER_TOKENS, inTagSet, legacyHint, modifierFor, numberAttrsOf, placedFor, PRECEDENCE, rootFor, WRAPPER_OWN_PROPS, wrapperFor, } from './class-map.js';
13
13
  import { ruleId } from './rules.js';
14
14
  function wrapperEntry(tag) {
15
15
  const target = wrapperFor(tag);
@@ -96,6 +96,13 @@ export function plan(facts) {
96
96
  entry = wrapperEntry(tag);
97
97
  if (!entry)
98
98
  return { conversion: null, todos };
99
+ // A wrapper exists only to carry helper props, so a tag none of whose
100
+ // classes becomes one stays as it is, and nothing else about it is worth
101
+ // a TODO.
102
+ if (propsFrom(entry, tokens, tag, undefined, facts.attributes).writes.size ===
103
+ 0) {
104
+ return { conversion: null, todos };
105
+ }
99
106
  }
100
107
  const target = entry.target;
101
108
  const refuse = (kind, token, message) => ({
@@ -112,6 +119,26 @@ export function plan(facts) {
112
119
  if (facts.onlyChildOf) {
113
120
  return refuse('only-child', target, `this element is the only child of \`<${facts.onlyChildOf}>\`, which may hand it props or a ref with \`cloneElement\` (next/link's legacy behavior, a tooltip, a Radix \`asChild\` trigger) that bestax \`${target}\` would not take the same way; convert it by hand if \`<${facts.onlyChildOf}>\` only renders its children`);
114
121
  }
122
+ const parent = entry.parent;
123
+ if (parent) {
124
+ const holder = facts.soleChildOf;
125
+ const bare = holder?.tag === parent.tag &&
126
+ holder.tokens === undefined &&
127
+ !holder.hasSpread &&
128
+ [...holder.attributes.keys()].every(name => name === 'key');
129
+ if (!bare) {
130
+ return refuse('context', target, `bestax \`${target}\` renders its own bare <${parent.tag}> around the <${tag}>, so this converts only as the only thing inside a bare <${parent.tag}>, which it takes the place of; keep it as markup`);
131
+ }
132
+ if (facts.holderOnlyChildOf) {
133
+ return refuse('only-child', target, `the <${parent.tag}> around this element is the only child of \`<${facts.holderOnlyChildOf}>\`, which may hand it props or a ref with \`cloneElement\`, and bestax \`${target}\` in its place would put them on the <${tag}>; convert it by hand if \`<${facts.holderOnlyChildOf}>\` only renders its children`);
134
+ }
135
+ if (holder.attributes.has('key') && facts.attributes.has('key')) {
136
+ return refuse('attr', 'key', `bestax \`${target}\` takes the place of the <${parent.tag}> around this element, and both have a \`key\`; keep one, then re-run`);
137
+ }
138
+ }
139
+ if (entry.rendersText !== undefined && facts.text !== entry.rendersText) {
140
+ return refuse('children', target, `bestax \`${target}\` renders its own \`${entry.rendersText}\` as its content, so this converts only holding exactly that; keep it as markup`);
141
+ }
115
142
  // An element converts with no class left only when found by where it sits,
116
143
  // and then an empty `className` would go with nothing to render it.
117
144
  if (placed && facts.emptyClass) {
@@ -174,7 +201,7 @@ export function plan(facts) {
174
201
  return refuse('attr', name, `bestax \`${target}\`'s props take no \`${name}\`${entry.defaults?.[name] ? `, and it renders \`${name}="${entry.defaults[name]}"\` when none is given` : ''}; keep this element as markup`);
175
202
  }
176
203
  const numbers = [];
177
- for (const name of entry.numberAttrs ?? []) {
204
+ for (const name of numberAttrsOf(entry)) {
178
205
  const value = attributes.get(name);
179
206
  if (typeof value !== 'string')
180
207
  continue;
@@ -268,66 +295,9 @@ export function plan(facts) {
268
295
  }
269
296
  }
270
297
  // ---- Tokens → props ---------------------------------------------------------
271
- // What the root itself needs comes first, so no class can take its prop.
272
- const writes = new Map((entry.writes ?? []).map(write => [write.prop, write.value ?? true]));
273
- /** The tokens each written prop came from, so a group rule can undo it. */
274
- const sourceOf = new Map();
275
- const groupOf = new Map();
276
- const converted = new Set(root ? [root] : []);
277
- for (const token of tokens) {
278
- if (converted.has(token))
279
- continue;
280
- const modifier = modifierFor(entry, token);
281
- if (modifier) {
282
- if (modifier.tagIn && !modifier.tagIn.includes(tag))
283
- continue;
284
- if (modifier.writes.some(write => writes.has(write.prop)))
285
- continue;
286
- for (const write of modifier.writes) {
287
- writes.set(write.prop, write.value ?? true);
288
- sourceOf.set(write.prop, token);
289
- if (write.numeric)
290
- numbers.push(write.prop);
291
- }
292
- converted.add(token);
293
- continue;
294
- }
295
- const helper = entry.noHelpers ? undefined : HELPER_TOKENS.get(token);
296
- if (!helper)
297
- continue;
298
- const prop = helper.group === 'text-color'
299
- ? entry.textColor
300
- : helper.group === 'background'
301
- ? entry.bgColor
302
- : helper.write.prop;
303
- if (!prop || writes.has(prop))
304
- continue;
305
- writes.set(prop, helper.write.value ?? true);
306
- sourceOf.set(prop, token);
307
- groupOf.set(prop, helper.group);
308
- converted.add(token);
309
- }
310
- const undo = (prop) => {
311
- converted.delete(sourceOf.get(prop));
312
- writes.delete(prop);
313
- };
314
- const displayProps = [...writes.keys()].filter(prop => groupOf.get(prop) === 'display');
315
- // bestax drops a base `display` whenever a per-viewport one is set.
316
- if (displayProps.includes('display') && displayProps.length > 1) {
317
- undo('display');
318
- }
319
- // Flex-container helpers only render beside a flex `display`.
320
- const flexDisplay = [...writes].some(([prop, value]) => groupOf.get(prop) === 'display' &&
321
- (value === 'flex' || value === 'inline-flex'));
322
- if (!flexDisplay) {
323
- for (const prop of [...writes.keys()]) {
324
- if (groupOf.get(prop) === 'flex-container')
325
- undo(prop);
326
- }
327
- }
328
- // A wrapper exists only to carry helper props; with none, leave the tag.
329
- if (!root && !placed && writes.size === 0)
330
- return { conversion: null, todos };
298
+ const fromTokens = propsFrom(entry, tokens, tag, root, attributes);
299
+ const { writes, converted } = fromTokens;
300
+ numbers.push(...fromTokens.numbers);
331
301
  // ---- The tag ------------------------------------------------------------
332
302
  let renders = entry.tag;
333
303
  if (entry.sizeDrivesTag && tag !== 'p' && writes.has('size')) {
@@ -375,6 +345,7 @@ export function plan(facts) {
375
345
  write.value === undefined &&
376
346
  !modifier.onlyTrue &&
377
347
  (!modifier.tagIn || modifier.tagIn.includes(tag)) &&
348
+ (!modifier.needsAttr || attributes.has(modifier.needsAttr.name)) &&
378
349
  !writes.has(write.prop) &&
379
350
  !conditional.some(([prop]) => prop === write.prop);
380
351
  // Written as a prop, the condition is evaluated before any left in the
@@ -390,6 +361,9 @@ export function plan(facts) {
390
361
  }
391
362
  });
392
363
  const rest = tokens.filter(token => !converted.has(token));
364
+ if (entry.classNameReplaces && (rest.length > 0 || conditionalStays)) {
365
+ return refuse('attr', 'className', `bestax \`${target}\` writes a \`className\` it's given in place of \`.${root}\`, so this converts only with no other class; keep it as markup`);
366
+ }
393
367
  return {
394
368
  conversion: {
395
369
  target,
@@ -398,12 +372,87 @@ export function plan(facts) {
398
372
  drop,
399
373
  numbers,
400
374
  ...(absorbed ? { absorbs: absorbed } : {}),
401
- ...(counts ? { rendersChildren: true } : {}),
375
+ ...(counts || entry.rendersText !== undefined
376
+ ? { rendersChildren: true }
377
+ : {}),
378
+ ...(parent ? { replacesParent: true } : {}),
402
379
  ...(conditional.length > 0 ? { conditional } : {}),
403
380
  },
404
381
  todos,
405
382
  };
406
383
  }
384
+ /**
385
+ * What an element's classes become on `entry`'s target: the props they
386
+ * write, the classes that leave `className`, and the props written as
387
+ * numbers. The group rules apply, so a helper the target would drop (a
388
+ * base `display` beside a per-viewport one, a flex-container helper with no
389
+ * flex `display`) stays a class, and so does a modifier missing the
390
+ * attribute it needs.
391
+ */
392
+ function propsFrom(entry, tokens, tag, root, attributes) {
393
+ const numbers = [];
394
+ // What the root itself needs comes first, so no class can take its prop.
395
+ const writes = new Map((entry.writes ?? []).map(write => [write.prop, write.value ?? true]));
396
+ /** The tokens each written prop came from, so a group rule can undo it. */
397
+ const sourceOf = new Map();
398
+ const groupOf = new Map();
399
+ const converted = new Set(root ? [root] : []);
400
+ for (const token of tokens) {
401
+ if (converted.has(token))
402
+ continue;
403
+ const modifier = modifierFor(entry, token);
404
+ if (modifier) {
405
+ if (modifier.tagIn && !modifier.tagIn.includes(tag))
406
+ continue;
407
+ if (modifier.needsAttr && !attributes.has(modifier.needsAttr.name)) {
408
+ continue;
409
+ }
410
+ if (modifier.writes.some(write => writes.has(write.prop)))
411
+ continue;
412
+ for (const write of modifier.writes) {
413
+ writes.set(write.prop, write.value ?? true);
414
+ sourceOf.set(write.prop, token);
415
+ if (write.numeric)
416
+ numbers.push(write.prop);
417
+ }
418
+ converted.add(token);
419
+ continue;
420
+ }
421
+ const helper = entry.noHelpers ? undefined : HELPER_TOKENS.get(token);
422
+ if (!helper)
423
+ continue;
424
+ const prop = helper.group === 'text-color'
425
+ ? entry.textColor
426
+ : helper.group === 'background'
427
+ ? entry.bgColor
428
+ : helper.write.prop;
429
+ if (!prop || writes.has(prop))
430
+ continue;
431
+ writes.set(prop, helper.write.value ?? true);
432
+ sourceOf.set(prop, token);
433
+ groupOf.set(prop, helper.group);
434
+ converted.add(token);
435
+ }
436
+ const undo = (prop) => {
437
+ converted.delete(sourceOf.get(prop));
438
+ writes.delete(prop);
439
+ };
440
+ const displayProps = [...writes.keys()].filter(prop => groupOf.get(prop) === 'display');
441
+ // bestax drops a base `display` whenever a per-viewport one is set.
442
+ if (displayProps.includes('display') && displayProps.length > 1) {
443
+ undo('display');
444
+ }
445
+ // Flex-container helpers only render beside a flex `display`.
446
+ const flexDisplay = [...writes].some(([prop, value]) => groupOf.get(prop) === 'display' &&
447
+ (value === 'flex' || value === 'inline-flex'));
448
+ if (!flexDisplay) {
449
+ for (const prop of [...writes.keys()]) {
450
+ if (groupOf.get(prop) === 'flex-container')
451
+ undo(prop);
452
+ }
453
+ }
454
+ return { writes, converted, numbers };
455
+ }
407
456
  /** `a`, `a or b`, `a, b or c`, each in backticks. */
408
457
  function orList(names, word = 'or') {
409
458
  const quoted = names.map(name => `\`${name}\``);
@@ -1 +1 @@
1
- {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAWH,eAAO,MAAM,KAAK,EAAE,WAAW,CAAC,MAAM,CAapC,CAAC;AA2BH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAK1D"}
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;AA4BH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAK1D"}
@@ -10,7 +10,7 @@
10
10
  * tests sweep every refusal the table can produce and hold each id to the
11
11
  * vocabulary, so a gap is still caught.
12
12
  */
13
- import { HELPER_PROPS, LEGACY_09, PLACED, ROOTS, WRAPPERS, WRAPPER_OWN_PROPS, } from './class-map.js';
13
+ import { HELPER_PROPS, LEGACY_09, NUMBER_ATTRS, PLACED, ROOTS, WRAPPERS, WRAPPER_OWN_PROPS, } from './class-map.js';
14
14
  export const KINDS = new Set([
15
15
  'attr',
16
16
  'children',
@@ -41,6 +41,7 @@ const VOCABULARY = new Set([
41
41
  ...Object.values(WRAPPERS),
42
42
  ...Object.values(WRAPPER_OWN_PROPS).flat(),
43
43
  ...HELPER_PROPS,
44
+ ...NUMBER_ATTRS,
44
45
  // Refused on every target, so no entry lists them.
45
46
  'dangerouslySetInnerHTML',
46
47
  'children',
@@ -1 +1 @@
1
- {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/transform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAW,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AA+xBvD,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,OAAO,GAAE,gBAAqB,GAC7B,MAAM,GAAG,SAAS,CA2nBpB"}
1
+ {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/transform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAW,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAyyBvD,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,OAAO,GAAE,gBAAqB,GAC7B,MAAM,GAAG,SAAS,CAgqBpB"}
@@ -615,6 +615,13 @@ function isMapCall(call) {
615
615
  !callee.computed &&
616
616
  (callee.property?.name === 'map' || callee.property?.name === 'flatMap'));
617
617
  }
618
+ /** The string an element's content renders, when it is one static text. */
619
+ function textOf(element) {
620
+ const content = (element.children ?? []).filter((child) => !dropped(child));
621
+ return content.length === 1 && content[0].type === 'JSXText'
622
+ ? jsxTextRenders(content[0].value)
623
+ : undefined;
624
+ }
618
625
  /** Whitespace React drops, which nothing is lost with. A comment is kept. */
619
626
  function dropped(child) {
620
627
  return child.type === 'JSXText' && !reachesReact(child);
@@ -887,6 +894,13 @@ export default function transform(fileInfo, api, options = {}) {
887
894
  ? root
888
895
  : undefined;
889
896
  };
897
+ /** The element directly around this one, when this is its only child. */
898
+ const holderOf = (elementPath) => {
899
+ const up = elementPath.parent?.node;
900
+ return up?.type === 'JSXElement' && soleChild(up) === elementPath.node
901
+ ? up
902
+ : undefined;
903
+ };
890
904
  // `converts` is whether the element would become a component with its
891
905
  // classes written out, so it holds for a computed className too.
892
906
  const elements = [];
@@ -927,6 +941,11 @@ export default function transform(fileInfo, api, options = {}) {
927
941
  onlyChildOf: onlyChildOf(elementPath, bestaxLocals),
928
942
  ...(item && { itemOf: item }),
929
943
  ...(classAttr && className?.trim() === '' && { emptyClass: true }),
944
+ ...(holderOf(elementPath) && {
945
+ soleChildOf: childFacts(holderOf(elementPath)),
946
+ holderOnlyChildOf: onlyChildOf(elementPath.parent, bestaxLocals),
947
+ }),
948
+ ...(textOf(element) !== undefined && { text: textOf(element) }),
930
949
  };
931
950
  // A joiner call the codemod can read converts exactly: its fixed classes
932
951
  // as for a static className, and each condition on a flag as its prop.
@@ -1202,8 +1221,33 @@ export default function transform(fileInfo, api, options = {}) {
1202
1221
  // an attribute the element already had.
1203
1222
  for (const name of conversion.numbers) {
1204
1223
  const attr = findAttr(written, name);
1224
+ // One the conversion dropped has nothing left to write.
1225
+ if (!attr)
1226
+ continue;
1205
1227
  attr.value = j.jsxExpressionContainer(j.numericLiteral(Number(attributeValue(attr))));
1206
1228
  }
1229
+ if (conversion.replacesParent) {
1230
+ // The component renders the element around this one too, so it takes
1231
+ // that one's place, with its `key` and its comments.
1232
+ const holderPath = elementPath.parent;
1233
+ const holder = holderPath.node;
1234
+ const key = findAttr(holder, 'key');
1235
+ if (key) {
1236
+ written.openingElement.attributes = [
1237
+ key,
1238
+ ...(written.openingElement.attributes ?? []),
1239
+ ];
1240
+ }
1241
+ const inTags = tagComments(holder);
1242
+ if (inTags.length) {
1243
+ const name = written.openingElement.name;
1244
+ name.comments = [...(name.comments ?? []), ...inTags.map(afterTagName)];
1245
+ }
1246
+ if (holder.comments?.length) {
1247
+ written.comments = [...holder.comments, ...(written.comments ?? [])];
1248
+ }
1249
+ holderPath.replace(written);
1250
+ }
1207
1251
  ctx.dirty = true;
1208
1252
  }
1209
1253
  // A joiner import only these rewrites stopped using goes too, so the file
@@ -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;AAOnE;;;;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,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CA6pBpD,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;AAOnE;;;;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,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAsqBpD,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"}
@@ -668,11 +668,20 @@ export const MAPPING = {
668
668
  rounded: {},
669
669
  onChange: { rename: 'onPageChange' },
670
670
  align: { valueMap: { center: 'centered', right: 'right' } },
671
- delta: { todo: 'no delta prop in bestax Pagination' },
672
- next: { todo: 'no custom next label in bestax Pagination' },
673
- previous: { todo: 'no custom previous label in bestax Pagination' },
674
- showPrevNext: { todo: 'no showPrevNext prop in bestax Pagination' },
675
- showFirstLast: { todo: 'no showFirstLast prop in bestax Pagination' },
671
+ delta: {
672
+ rename: 'siblingCount',
673
+ valueTodo: {
674
+ '0': 'RBC renders no page links for it, and bestax Pagination still shows the current, first and last pages from `siblingCount={0}`; compose the parts by hand for a Pagination with no page links',
675
+ },
676
+ },
677
+ next: { rename: 'nextLabel' },
678
+ previous: { rename: 'previousLabel' },
679
+ showPrevNext: {
680
+ todo: 'bestax Pagination always renders Previous and Next from `total`',
681
+ },
682
+ showFirstLast: {
683
+ todo: 'bestax Pagination always shows the first and last pages from `total`, `boundaryCount` of each (1 by default)',
684
+ },
676
685
  autoHide: {
677
686
  todo: 'no autoHide prop in bestax Pagination; render conditionally',
678
687
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bestax-migrate",
3
- "version": "2.21.0",
3
+ "version": "2.22.0",
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.17.0"
41
+ "@allxsmith/bestax-bulma": "^5.18.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@jest/globals": "^30.0.0",