bestax-migrate 2.6.0 → 2.7.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.
- package/dist/sources/bulma-classes/class-map.d.ts +13 -0
- package/dist/sources/bulma-classes/class-map.d.ts.map +1 -1
- package/dist/sources/bulma-classes/class-map.js +171 -6
- package/dist/sources/bulma-classes/plan.d.ts +9 -0
- package/dist/sources/bulma-classes/plan.d.ts.map +1 -1
- package/dist/sources/bulma-classes/plan.js +13 -0
- package/dist/sources/bulma-classes/rules.d.ts.map +1 -1
- package/dist/sources/bulma-classes/rules.js +1 -0
- package/dist/sources/bulma-classes/transform.d.ts.map +1 -1
- package/dist/sources/bulma-classes/transform.js +57 -11
- package/package.json +1 -1
|
@@ -73,7 +73,20 @@ export interface RootEntry {
|
|
|
73
73
|
readonly in: string;
|
|
74
74
|
readonly unless: readonly string[];
|
|
75
75
|
readonly whenEmpty?: boolean;
|
|
76
|
+
/** Only when the element carries this class (`Field` with `is-horizontal`). */
|
|
77
|
+
readonly when?: string;
|
|
76
78
|
};
|
|
79
|
+
/**
|
|
80
|
+
* The target provides context bestax's form controls read to skip wrappers
|
|
81
|
+
* of their own, so an element around a bestax component already in the file
|
|
82
|
+
* stays markup: that component would render differently.
|
|
83
|
+
*/
|
|
84
|
+
readonly providesContext?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Inside one of these bestax components already in the file, the target
|
|
87
|
+
* takes a generated `id` when the element has none of its own.
|
|
88
|
+
*/
|
|
89
|
+
readonly adoptsIdFrom?: readonly string[];
|
|
77
90
|
/** The target takes no helper props, so every helper class stays a class. */
|
|
78
91
|
readonly noHelpers?: boolean;
|
|
79
92
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-map.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/class-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,SAAS;IACxB,QAAQ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AAO,MAAM,WAAW,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CA8BA,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;;;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"}
|
|
@@ -547,6 +547,168 @@ export const ROOTS = {
|
|
|
547
547
|
],
|
|
548
548
|
passThrough: ['onClick'],
|
|
549
549
|
},
|
|
550
|
+
// Form markup. `Field` and `Control` tell the bestax form controls inside
|
|
551
|
+
// them to skip wrappers of their own, and `InputBase` / `TextAreaBase` are
|
|
552
|
+
// the controls without wrappers (a `Field` with no `label` hands them no id).
|
|
553
|
+
field: {
|
|
554
|
+
...BASE,
|
|
555
|
+
target: 'Field',
|
|
556
|
+
tag: 'div',
|
|
557
|
+
// `has-addons-centered`, `is-grouped-right` and the like stay classes:
|
|
558
|
+
// the prop values that render them render `has-addons` too.
|
|
559
|
+
modifiers: flags({
|
|
560
|
+
'is-horizontal': 'horizontal',
|
|
561
|
+
'is-grouped': 'grouped',
|
|
562
|
+
'has-addons': 'hasAddons',
|
|
563
|
+
'is-narrow': 'narrow',
|
|
564
|
+
}),
|
|
565
|
+
wrapsChildren: {
|
|
566
|
+
in: 'field-body',
|
|
567
|
+
unless: ['Field.Label', 'Field.Body'],
|
|
568
|
+
whenEmpty: true,
|
|
569
|
+
when: 'is-horizontal',
|
|
570
|
+
},
|
|
571
|
+
providesContext: true,
|
|
572
|
+
ownProps: [
|
|
573
|
+
'horizontal',
|
|
574
|
+
'grouped',
|
|
575
|
+
'hasAddons',
|
|
576
|
+
'narrow',
|
|
577
|
+
'label',
|
|
578
|
+
'labelSize',
|
|
579
|
+
'labelProps',
|
|
580
|
+
'textColor',
|
|
581
|
+
'color',
|
|
582
|
+
'bgColor',
|
|
583
|
+
],
|
|
584
|
+
},
|
|
585
|
+
// Field.Label, Field.Body and Control spread their raw props onto the
|
|
586
|
+
// element as well, so a helper prop would reach it as an attribute too.
|
|
587
|
+
'field-label': {
|
|
588
|
+
status: 'mapped',
|
|
589
|
+
target: 'Field.Label',
|
|
590
|
+
tag: 'div',
|
|
591
|
+
textColor: null,
|
|
592
|
+
bgColor: null,
|
|
593
|
+
noHelpers: true,
|
|
594
|
+
modifiers: tokens('is-', ['small', 'normal', 'medium', 'large'], 'size'),
|
|
595
|
+
ownProps: ['size', 'textColor', 'color', 'bgColor'],
|
|
596
|
+
},
|
|
597
|
+
'field-body': {
|
|
598
|
+
status: 'mapped',
|
|
599
|
+
target: 'Field.Body',
|
|
600
|
+
tag: 'div',
|
|
601
|
+
textColor: null,
|
|
602
|
+
bgColor: null,
|
|
603
|
+
noHelpers: true,
|
|
604
|
+
ownProps: ['textColor', 'color', 'bgColor'],
|
|
605
|
+
},
|
|
606
|
+
control: {
|
|
607
|
+
status: 'mapped',
|
|
608
|
+
target: 'Control',
|
|
609
|
+
tag: 'div',
|
|
610
|
+
as: ['div', 'p'],
|
|
611
|
+
textColor: null,
|
|
612
|
+
bgColor: null,
|
|
613
|
+
noHelpers: true,
|
|
614
|
+
modifiers: {
|
|
615
|
+
...flags({
|
|
616
|
+
'has-icons-left': 'hasIconsLeft',
|
|
617
|
+
'has-icons-right': 'hasIconsRight',
|
|
618
|
+
'is-loading': 'isLoading',
|
|
619
|
+
'is-expanded': 'isExpanded',
|
|
620
|
+
}),
|
|
621
|
+
...tokens('is-', ['small', 'medium', 'large'], 'size'),
|
|
622
|
+
},
|
|
623
|
+
providesContext: true,
|
|
624
|
+
ownProps: [
|
|
625
|
+
'as',
|
|
626
|
+
'hasIconsLeft',
|
|
627
|
+
'hasIconsRight',
|
|
628
|
+
'isLoading',
|
|
629
|
+
'isExpanded',
|
|
630
|
+
'size',
|
|
631
|
+
'textColor',
|
|
632
|
+
'color',
|
|
633
|
+
'bgColor',
|
|
634
|
+
'iconLeft',
|
|
635
|
+
'iconRight',
|
|
636
|
+
'iconLeftName',
|
|
637
|
+
'iconLeftSize',
|
|
638
|
+
'iconRightName',
|
|
639
|
+
'iconRightSize',
|
|
640
|
+
],
|
|
641
|
+
passThrough: ['ref'],
|
|
642
|
+
},
|
|
643
|
+
input: {
|
|
644
|
+
...BASE,
|
|
645
|
+
target: 'InputBase',
|
|
646
|
+
tag: 'input',
|
|
647
|
+
// No text color prop, and `backgroundColor` is the one the base reads.
|
|
648
|
+
textColor: null,
|
|
649
|
+
bgColor: 'backgroundColor',
|
|
650
|
+
modifiers: {
|
|
651
|
+
...tokens('is-', ['small', 'medium', 'large'], 'size'),
|
|
652
|
+
...flags({
|
|
653
|
+
'is-rounded': 'isRounded',
|
|
654
|
+
'is-static': 'isStatic',
|
|
655
|
+
'is-hovered': 'isHovered',
|
|
656
|
+
'is-focused': 'isFocused',
|
|
657
|
+
'is-loading': 'isLoading',
|
|
658
|
+
}),
|
|
659
|
+
},
|
|
660
|
+
omits: Object.fromEntries(COMPONENT_COLORS.map(color => [
|
|
661
|
+
`is-${color}`,
|
|
662
|
+
'`color` renders `has-text-<color>` on the input as well',
|
|
663
|
+
])),
|
|
664
|
+
adoptsIdFrom: ['Field'],
|
|
665
|
+
ownProps: [
|
|
666
|
+
'color',
|
|
667
|
+
'size',
|
|
668
|
+
'isRounded',
|
|
669
|
+
'isStatic',
|
|
670
|
+
'isHovered',
|
|
671
|
+
'isFocused',
|
|
672
|
+
'isLoading',
|
|
673
|
+
],
|
|
674
|
+
passThrough: ['disabled', 'readOnly', 'ref'],
|
|
675
|
+
},
|
|
676
|
+
textarea: {
|
|
677
|
+
...BASE,
|
|
678
|
+
target: 'TextAreaBase',
|
|
679
|
+
tag: 'textarea',
|
|
680
|
+
textColor: null,
|
|
681
|
+
bgColor: 'backgroundColor',
|
|
682
|
+
// `isLoading` renders nothing here: Bulma puts `is-loading` on the control.
|
|
683
|
+
modifiers: {
|
|
684
|
+
...tokens('is-', ['small', 'medium', 'large'], 'size'),
|
|
685
|
+
...flags({
|
|
686
|
+
'is-rounded': 'isRounded',
|
|
687
|
+
'is-static': 'isStatic',
|
|
688
|
+
'is-hovered': 'isHovered',
|
|
689
|
+
'is-focused': 'isFocused',
|
|
690
|
+
'is-active': 'isActive',
|
|
691
|
+
'has-fixed-size': 'hasFixedSize',
|
|
692
|
+
}),
|
|
693
|
+
},
|
|
694
|
+
omits: Object.fromEntries(COMPONENT_COLORS.map(color => [
|
|
695
|
+
`is-${color}`,
|
|
696
|
+
'`color` renders `has-text-<color>` on the textarea as well',
|
|
697
|
+
])),
|
|
698
|
+
adoptsIdFrom: ['Field'],
|
|
699
|
+
ownProps: [
|
|
700
|
+
'color',
|
|
701
|
+
'size',
|
|
702
|
+
'isRounded',
|
|
703
|
+
'isStatic',
|
|
704
|
+
'isHovered',
|
|
705
|
+
'isFocused',
|
|
706
|
+
'isLoading',
|
|
707
|
+
'isActive',
|
|
708
|
+
'hasFixedSize',
|
|
709
|
+
],
|
|
710
|
+
passThrough: ['disabled', 'readOnly', 'rows', 'ref'],
|
|
711
|
+
},
|
|
550
712
|
footer: {
|
|
551
713
|
...BASE,
|
|
552
714
|
target: 'Footer',
|
|
@@ -870,12 +1032,6 @@ export const ROOTS = {
|
|
|
870
1032
|
checkboxes: todo('Checkboxes', 'bestax `Checkboxes` renders its own `.field` and `.control` wrappers'),
|
|
871
1033
|
radio: todo('Radio', "bestax `Radio` renders its own styled markup, not Bulma's"),
|
|
872
1034
|
radios: todo('Radios', 'bestax `Radios` renders its own `.field` and `.control` wrappers'),
|
|
873
|
-
field: todo('Field', 'bestax form controls render their own `.field` and `.control` wrappers; see the unmappables reference'),
|
|
874
|
-
'field-label': part(),
|
|
875
|
-
'field-body': part(),
|
|
876
|
-
control: part(),
|
|
877
|
-
input: todo('Input', 'bestax `Input` renders its own `.field` and `.control` wrappers'),
|
|
878
|
-
textarea: todo('TextArea', 'bestax `TextArea` renders its own `.field` and `.control` wrappers'),
|
|
879
1035
|
select: todo('Select', 'bestax `Select` renders the `.select` wrapper and the `<select>` together'),
|
|
880
1036
|
file: todo('File', 'bestax `File` renders the whole `.file-label` tree itself'),
|
|
881
1037
|
'file-label': part(),
|
|
@@ -989,6 +1145,12 @@ export const PRECEDENCE = [
|
|
|
989
1145
|
'navbar-item',
|
|
990
1146
|
'navbar-dropdown',
|
|
991
1147
|
'navbar-divider',
|
|
1148
|
+
'field',
|
|
1149
|
+
'field-label',
|
|
1150
|
+
'field-body',
|
|
1151
|
+
'control',
|
|
1152
|
+
'input',
|
|
1153
|
+
'textarea',
|
|
992
1154
|
'buttons',
|
|
993
1155
|
'tags',
|
|
994
1156
|
'button',
|
|
@@ -1009,6 +1171,9 @@ export const FORWARDS_REF = [
|
|
|
1009
1171
|
'Link',
|
|
1010
1172
|
'Navbar',
|
|
1011
1173
|
'Navbar.Item',
|
|
1174
|
+
'Control',
|
|
1175
|
+
'InputBase',
|
|
1176
|
+
'TextAreaBase',
|
|
1012
1177
|
];
|
|
1013
1178
|
/**
|
|
1014
1179
|
* Plain tags bestax wraps, for an element with helper classes and no root
|
|
@@ -28,6 +28,15 @@ export interface ElementFacts {
|
|
|
28
28
|
* counts: one in an expression may not render.
|
|
29
29
|
*/
|
|
30
30
|
childTargets?: readonly string[];
|
|
31
|
+
/** The bestax components already in the file inside this element. */
|
|
32
|
+
bestaxInside?: readonly string[];
|
|
33
|
+
/** The bestax components already in the file around this element. */
|
|
34
|
+
bestaxAround?: readonly string[];
|
|
35
|
+
/**
|
|
36
|
+
* The other components around this element (not bestax, not a fragment),
|
|
37
|
+
* any of which could render a bestax component around it.
|
|
38
|
+
*/
|
|
39
|
+
componentsAround?: readonly string[];
|
|
31
40
|
/**
|
|
32
41
|
* The component this element is the only child of, if any (`Link` for
|
|
33
42
|
* `<Link href="/x"><a className="button">`), since that component can
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAiBH,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,2DAA2D;IAC3D,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B;;;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;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,KAAK,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IACnD,4DAA4D;IAC5D,SAAS,EAAE,MAAM,GA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C,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IACnD,4DAA4D;IAC5D,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,mEAAmE;IACnE,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,8DAA8D;IAC9D,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,IAAI;IACnB,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AA+BD,wBAAgB,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CA8R9C"}
|
|
@@ -128,8 +128,21 @@ export function plan(facts) {
|
|
|
128
128
|
if (entry.requiresChildren && !facts.hasChildren) {
|
|
129
129
|
return refuse('children', target, `bestax \`${target}\` requires children, and this element has none; keep it as markup`);
|
|
130
130
|
}
|
|
131
|
+
if (entry.providesContext && facts.bestaxInside?.length) {
|
|
132
|
+
return refuse('context', target, `bestax \`${target}\` tells the bestax form controls inside it to skip wrappers of their own, and this element already holds \`${facts.bestaxInside[0]}\`, which could render differently inside it; keep this element as markup, or convert it and check that component by hand`);
|
|
133
|
+
}
|
|
134
|
+
if (entry.adoptsIdFrom && !facts.attributes.has('id')) {
|
|
135
|
+
// Context follows the render tree, not the file: a component of the app
|
|
136
|
+
// around the element can render a labelled `Field` around it just as well.
|
|
137
|
+
const around = facts.bestaxAround?.find(name => entry.adoptsIdFrom.includes(name)) ??
|
|
138
|
+
facts.componentsAround?.[0];
|
|
139
|
+
if (around) {
|
|
140
|
+
return refuse('context', target, `this element has no \`id\` and sits inside \`<${around}>\`, which is or could render a bestax \`${entry.adoptsIdFrom.join('` or `')}\` with a \`label\`; bestax \`${target}\` would then take that generated \`id\`; give the element an \`id\` of its own, then re-run`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
131
143
|
const wraps = entry.wrapsChildren;
|
|
132
144
|
if (wraps &&
|
|
145
|
+
(!wraps.when || tokens.includes(wraps.when)) &&
|
|
133
146
|
(facts.hasChildren || wraps.whenEmpty) &&
|
|
134
147
|
!facts.childTargets?.some(child => wraps.unless.includes(child))) {
|
|
135
148
|
const parts = wraps.unless.map(part => `\`${part}\``);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAUH,eAAO,MAAM,KAAK,EAAE,WAAW,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAUH,eAAO,MAAM,KAAK,EAAE,WAAW,CAAC,MAAM,CAapC,CAAC;AAuBH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAK1D"}
|
|
@@ -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;AAmSvD,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,OAAO,GAAE,gBAAqB,GAC7B,MAAM,GAAG,SAAS,
|
|
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;AAmSvD,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,OAAO,GAAE,gBAAqB,GAC7B,MAAM,GAAG,SAAS,CA4VpB"}
|
|
@@ -308,22 +308,64 @@ export default function transform(fileInfo, api, options = {}) {
|
|
|
308
308
|
// a child that is one of its parts.
|
|
309
309
|
const planned = new Map();
|
|
310
310
|
const programScope = root.find(j.Program).paths()[0]?.scope;
|
|
311
|
+
/**
|
|
312
|
+
* The bestax component an element already is, when its name is the bestax
|
|
313
|
+
* import and not a local that shadows it; `scopePath` is where the name is
|
|
314
|
+
* looked up.
|
|
315
|
+
*/
|
|
316
|
+
const bestaxTarget = (element, scopePath) => {
|
|
317
|
+
const parts = jsxNameParts(element.openingElement.name);
|
|
318
|
+
const owner = parts && bestaxNames.get(parts[0]);
|
|
319
|
+
if (!owner || !resolvesToBinding(scopePath, parts[0], programScope)) {
|
|
320
|
+
return undefined;
|
|
321
|
+
}
|
|
322
|
+
return [...owner, ...parts.slice(1)].join('.');
|
|
323
|
+
};
|
|
311
324
|
const childTargets = (elementPath) => (elementPath.node.children ?? []).flatMap((child) => {
|
|
312
325
|
if (child.type !== 'JSXElement')
|
|
313
326
|
return [];
|
|
314
|
-
const target = planned.get(child)?.conversion?.target
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
327
|
+
const target = planned.get(child)?.conversion?.target ??
|
|
328
|
+
// A direct child is looked up in the element's own scope, the child's.
|
|
329
|
+
bestaxTarget(child, elementPath);
|
|
330
|
+
return target ? [target] : [];
|
|
331
|
+
});
|
|
332
|
+
// For each element, the bestax components already in the file inside it:
|
|
333
|
+
// `Field` and `Control` change how bestax's form controls render.
|
|
334
|
+
const bestaxInside = new Map();
|
|
335
|
+
root.find(j.JSXElement).forEach(elementPath => {
|
|
336
|
+
const target = bestaxTarget(elementPath.node, elementPath);
|
|
337
|
+
if (!target)
|
|
338
|
+
return;
|
|
339
|
+
for (let up = elementPath.parent; up; up = up.parent) {
|
|
340
|
+
if (up.node?.type !== 'JSXElement')
|
|
341
|
+
continue;
|
|
342
|
+
bestaxInside.set(up.node, [...(bestaxInside.get(up.node) ?? []), target]);
|
|
324
343
|
}
|
|
325
|
-
return [[...owner, ...parts.slice(1)].join('.')];
|
|
326
344
|
});
|
|
345
|
+
/**
|
|
346
|
+
* The components around an element: the bestax ones already in the file,
|
|
347
|
+
* and the rest (not an HTML tag, not a fragment), which could render one.
|
|
348
|
+
*/
|
|
349
|
+
const around = (elementPath) => {
|
|
350
|
+
const bestax = [];
|
|
351
|
+
const other = [];
|
|
352
|
+
for (let up = elementPath.parent; up; up = up.parent) {
|
|
353
|
+
if (up.node?.type !== 'JSXElement')
|
|
354
|
+
continue;
|
|
355
|
+
const target = bestaxTarget(up.node, up);
|
|
356
|
+
if (target) {
|
|
357
|
+
bestax.push(target);
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
const parts = jsxNameParts(up.node.openingElement.name);
|
|
361
|
+
const name = parts?.join('.');
|
|
362
|
+
if (name && !INTRINSIC.test(name) && !name.includes('-')) {
|
|
363
|
+
if (!PASS_THROUGH_PARENTS.has(name))
|
|
364
|
+
other.push(name);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return { bestax, other };
|
|
368
|
+
};
|
|
327
369
|
// `converts` is whether the element would become a component with its
|
|
328
370
|
// classes written out, so it holds for a computed className too.
|
|
329
371
|
const elements = [];
|
|
@@ -346,6 +388,7 @@ export default function transform(fileInfo, api, options = {}) {
|
|
|
346
388
|
attributes.set(attributeName(attr), attributeValue(attr));
|
|
347
389
|
}
|
|
348
390
|
const className = staticClassName(classAttr);
|
|
391
|
+
const surrounding = around(elementPath);
|
|
349
392
|
const facts = {
|
|
350
393
|
tag: name.name,
|
|
351
394
|
tokens: className === null
|
|
@@ -356,6 +399,9 @@ export default function transform(fileInfo, api, options = {}) {
|
|
|
356
399
|
hasRef: attributes.has('ref'),
|
|
357
400
|
hasChildren: (element.children ?? []).some(reachesReact),
|
|
358
401
|
childTargets: childTargets(elementPath),
|
|
402
|
+
bestaxInside: bestaxInside.get(element) ?? [],
|
|
403
|
+
bestaxAround: surrounding.bestax,
|
|
404
|
+
componentsAround: surrounding.other,
|
|
359
405
|
onlyChildOf: onlyChildOf(elementPath, bestaxLocals),
|
|
360
406
|
};
|
|
361
407
|
let result = plan(facts);
|