bestax-migrate 2.27.0 → 2.29.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/_shared/articles.d.ts +8 -0
- package/dist/sources/_shared/articles.d.ts.map +1 -0
- package/dist/sources/_shared/articles.js +9 -0
- package/dist/sources/_shared/polymorphic.d.ts.map +1 -1
- package/dist/sources/_shared/polymorphic.js +22 -6
- package/dist/sources/bloomer/mapping.d.ts.map +1 -1
- package/dist/sources/bloomer/mapping.js +9 -4
- package/dist/sources/bloomer/specials.d.ts.map +1 -1
- package/dist/sources/bloomer/specials.js +33 -5
- package/dist/sources/bulma-classes/class-map.d.ts +31 -10
- package/dist/sources/bulma-classes/class-map.d.ts.map +1 -1
- package/dist/sources/bulma-classes/class-map.js +62 -15
- package/dist/sources/bulma-classes/glyph.d.ts +20 -0
- package/dist/sources/bulma-classes/glyph.d.ts.map +1 -1
- package/dist/sources/bulma-classes/glyph.js +64 -0
- package/dist/sources/bulma-classes/html-assets.js +1 -1
- package/dist/sources/bulma-classes/plan.d.ts +40 -1
- package/dist/sources/bulma-classes/plan.d.ts.map +1 -1
- package/dist/sources/bulma-classes/plan.js +176 -40
- package/dist/sources/bulma-classes/transform.d.ts +2 -1
- package/dist/sources/bulma-classes/transform.d.ts.map +1 -1
- package/dist/sources/bulma-classes/transform.js +231 -33
- package/dist/sources/rbx/mapping.d.ts +10 -0
- package/dist/sources/rbx/mapping.d.ts.map +1 -1
- package/dist/sources/rbx/mapping.js +12 -6
- package/dist/sources/react-bulma-components/mapping.d.ts.map +1 -1
- package/dist/sources/react-bulma-components/mapping.js +18 -4
- package/package.json +2 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A tag with the article it takes in a TODO message, read aloud: "an <a>",
|
|
3
|
+
* "an <input>", "an <h2>", "a <button>", "a <ul>". A tag starting with a
|
|
4
|
+
* vowel letter takes "an", but `<u>` and `<ul>` (read "you"), and so does a
|
|
5
|
+
* heading (read "aitch").
|
|
6
|
+
*/
|
|
7
|
+
export declare function aTag(tag: string): string;
|
|
8
|
+
//# sourceMappingURL=articles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"articles.d.ts","sourceRoot":"","sources":["../../../src/sources/_shared/articles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAExC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A tag with the article it takes in a TODO message, read aloud: "an <a>",
|
|
3
|
+
* "an <input>", "an <h2>", "a <button>", "a <ul>". A tag starting with a
|
|
4
|
+
* vowel letter takes "an", but `<u>` and `<ul>` (read "you"), and so does a
|
|
5
|
+
* heading (read "aitch").
|
|
6
|
+
*/
|
|
7
|
+
export function aTag(tag) {
|
|
8
|
+
return `${/^(?:[aeio]|h\d$)/.test(tag) ? 'an' : 'a'} <${tag}>`;
|
|
9
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polymorphic.d.ts","sourceRoot":"","sources":["../../../src/sources/_shared/polymorphic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"polymorphic.d.ts","sourceRoot":"","sources":["../../../src/sources/_shared/polymorphic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAML,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAyCxB,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAkB,CAAC;AAmK3E;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW,GACtB,UAAU,MAAM,GAAG,SAAS,EAC5B,eAAa,KACZ,MAmBF,CAAC;AAMF,oDAAoD;AACpD,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAElD;AAQD,mDAAmD;AACnD,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAW,CAAC;AAC1D,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAAuB,CAAC;AAkEpE;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAAkC,CAAC;AAE9E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAwH5C,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEnD;AASD,sFAAsF;AACtF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAG3E;AAED,0DAA0D;AAC1D,eAAO,MAAM,UAAU,EAAE,SAAS,MAAM,EAAoC,CAAC;AAE7E,6CAA6C;AAC7C,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAC1C,CAAC;AAqPrB;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,OAAO,EAAE,GAAG,EACZ,MAAM,EAAE,MAAM;AACd;;;;;;;;;GASG;AACH,gBAAgB,UAAQ,GACvB,IAAI,CAuEN"}
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
* Source-agnostic: what it knows is bestax's side of the rename, so all three
|
|
26
26
|
* sources run it over every element after their prop passes.
|
|
27
27
|
*/
|
|
28
|
+
import { aTag } from './articles.js';
|
|
28
29
|
import { addTodo, attrSource, findAttr, literalValueOf, removeAttr, } from './jsx-utils.js';
|
|
29
30
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
30
31
|
/**
|
|
@@ -38,13 +39,28 @@ import { addTodo, attrSource, findAttr, literalValueOf, removeAttr, } from './js
|
|
|
38
39
|
* output that does not compile.
|
|
39
40
|
*/
|
|
40
41
|
const AS_UNION_TABLE = {
|
|
42
|
+
Container: [
|
|
43
|
+
'div',
|
|
44
|
+
'main',
|
|
45
|
+
'section',
|
|
46
|
+
'article',
|
|
47
|
+
'aside',
|
|
48
|
+
'header',
|
|
49
|
+
'footer',
|
|
50
|
+
'nav',
|
|
51
|
+
],
|
|
41
52
|
Control: ['div', 'p'],
|
|
42
53
|
'Dropdown.Item': ['a', 'div', 'button'],
|
|
43
54
|
Footer: ['footer', 'div'],
|
|
55
|
+
Hero: ['section', 'div', 'main', 'header', 'footer', 'article', 'aside'],
|
|
56
|
+
'Hero.Foot': ['div', 'footer', 'nav'],
|
|
57
|
+
'Hero.Head': ['div', 'header', 'nav'],
|
|
44
58
|
Image: ['figure', 'div', 'p'],
|
|
45
59
|
'Level.Item': ['div', 'p', 'a'],
|
|
46
60
|
Media: ['article', 'div'],
|
|
47
61
|
'Media.Left': ['figure', 'div'],
|
|
62
|
+
Panel: ['nav', 'article', 'section', 'aside', 'div'],
|
|
63
|
+
'Panel.Block': ['a', 'div', 'label'],
|
|
48
64
|
SubTitle: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p'],
|
|
49
65
|
Title: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p'],
|
|
50
66
|
};
|
|
@@ -57,7 +73,7 @@ export const AS_UNIONS = AS_UNION_TABLE;
|
|
|
57
73
|
* That last group is why this set has to exist. An earlier pass flags an `as`
|
|
58
74
|
* a component cannot take and leaves the attribute in place as the marker for
|
|
59
75
|
* its TODO, so reading the element off whatever `as` is present would believe
|
|
60
|
-
* a prop the component never had -- and `<
|
|
76
|
+
* a prop the component never had -- and `<Pagination.Link as="span" href="/x">`
|
|
61
77
|
* would lose the `href` that compiles and keep the `as` that does not.
|
|
62
78
|
*/
|
|
63
79
|
const AS_ANY = new Set(['Button', 'Menu.Item', 'Navbar.Item', 'Navbar.Link']);
|
|
@@ -491,7 +507,7 @@ function restrictAsValue(ctx, path, element, target, attr, literal) {
|
|
|
491
507
|
return;
|
|
492
508
|
const offered = allowed.map(a => `\`${a}\``).join(' / ');
|
|
493
509
|
removeAttr(element, attr);
|
|
494
|
-
addTodo(ctx, path, 'prop:as', `bestax \`${target}\` renders only ${offered}, so \`as="${literal.value}"\` cannot carry across — wrap it in
|
|
510
|
+
addTodo(ctx, path, 'prop:as', `bestax \`${target}\` renders only ${offered}, so \`as="${literal.value}"\` cannot carry across — wrap it in ${aTag(String(literal.value))} or restructure`);
|
|
495
511
|
ctx.dirty = true;
|
|
496
512
|
}
|
|
497
513
|
/**
|
|
@@ -535,7 +551,7 @@ function dropInertHref(ctx, path, element, target, literal, elementKnown) {
|
|
|
535
551
|
if (rendered === undefined) {
|
|
536
552
|
if (defaultEl === ANCHOR)
|
|
537
553
|
return;
|
|
538
|
-
drop(`bestax \`${target}\` renders
|
|
554
|
+
drop(`bestax \`${target}\` renders ${aTag(defaultEl)} unless \`as\` says otherwise, and only its <a> form carries an \`href\` -- set \`as="a"\` to make this a link, or ${nestOrClick(defaultEl)}`);
|
|
539
555
|
return;
|
|
540
556
|
}
|
|
541
557
|
if (rendered === ANCHOR)
|
|
@@ -546,8 +562,8 @@ function dropInertHref(ctx, path, element, target, literal, elementKnown) {
|
|
|
546
562
|
// `Level.Item` a <div> that compiles and quietly is not a link.
|
|
547
563
|
const remedy = defaultEl === ANCHOR
|
|
548
564
|
? `drop the \`as\` to make this a link, or ${nestOrClick(rendered)}`
|
|
549
|
-
: `set \`as="a"\` to make this a link -- dropping the \`as\` gives you
|
|
550
|
-
drop(`\`href\` on \`as="${rendered}"\`: bestax gives an element the attributes of the tag \`as\` names, and
|
|
565
|
+
: `set \`as="a"\` to make this a link -- dropping the \`as\` gives you ${aTag(defaultEl)} -- or ${nestOrClick(rendered)}`;
|
|
566
|
+
drop(`\`href\` on \`as="${rendered}"\`: bestax gives an element the attributes of the tag \`as\` names, and ${aTag(rendered)} takes no \`href\` (it navigated nowhere in the source either) -- ${remedy}`);
|
|
551
567
|
}
|
|
552
568
|
/**
|
|
553
569
|
* Drop a link attribute the rendered element does not take.
|
|
@@ -586,7 +602,7 @@ function dropInertLinkAttrs(ctx, path, element, target, rendered) {
|
|
|
586
602
|
const was = attrSource(ctx.j, attr);
|
|
587
603
|
removeAttr(element, attr);
|
|
588
604
|
const because = rejectedBy === 'element'
|
|
589
|
-
? `\`${name}\` needs an element that takes it, and \`${target}\` renders
|
|
605
|
+
? `\`${name}\` needs an element that takes it, and \`${target}\` renders ${aTag(rendered)} here`
|
|
590
606
|
: `bestax \`${target}\` is not a link at any \`as\`, so it takes no \`${name}\` either`;
|
|
591
607
|
addTodo(ctx, path, `prop:${name}`, `${because} -- ${was ? `it read \`${was}\`; ` : ''}${remedyFor(target, rendered)}`);
|
|
592
608
|
ctx.dirty = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../../../src/sources/bloomer/mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAkBnE;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,UAEzB,CAAC;AA8CF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAsBtD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAG1D,CAAC;AAEF;;;;;GAKG;AACH;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,aAG/B,CAAC;AAEH,eAAO,MAAM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;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAiIpD,CAAC;AAEF,sDAAsD;AACtD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,gBAAgB,GAAG,SAAS,CAM3E"}
|
|
@@ -729,7 +729,7 @@ export const MAPPING = {
|
|
|
729
729
|
},
|
|
730
730
|
},
|
|
731
731
|
// ---- panel --------------------------------------------------------------
|
|
732
|
-
Panel: { status: 'mapped', target: 'Panel' },
|
|
732
|
+
Panel: { status: 'mapped', target: 'Panel', props: { tag: TAG_AS } },
|
|
733
733
|
PanelHeading: { status: 'mapped', target: 'Panel.Heading' },
|
|
734
734
|
PanelTabs: { status: 'mapped', target: 'Panel.Tabs' },
|
|
735
735
|
PanelTab: { status: 'mapped', special: 'panel-tab' },
|
|
@@ -776,7 +776,11 @@ export const MAPPING = {
|
|
|
776
776
|
Container: {
|
|
777
777
|
status: 'mapped',
|
|
778
778
|
target: 'Container',
|
|
779
|
-
props: {
|
|
779
|
+
props: {
|
|
780
|
+
hasTextColor: TEXT_COLOR_OK,
|
|
781
|
+
isFluid: { rename: 'fluid' },
|
|
782
|
+
tag: TAG_AS,
|
|
783
|
+
},
|
|
780
784
|
},
|
|
781
785
|
Footer: {
|
|
782
786
|
status: 'mapped',
|
|
@@ -797,12 +801,13 @@ export const MAPPING = {
|
|
|
797
801
|
isFullHeight: { booleanToProp: { name: 'size', value: 'fullheight' } },
|
|
798
802
|
isHalfHeight: { toClass: 'is-halfheight' },
|
|
799
803
|
isBold: { toClass: 'is-bold' },
|
|
804
|
+
tag: TAG_AS,
|
|
800
805
|
},
|
|
801
806
|
},
|
|
802
807
|
HeroHeader: {
|
|
803
808
|
status: 'mapped',
|
|
804
809
|
target: 'Hero.Head',
|
|
805
|
-
props: { hasTextColor: TEXT_COLOR_OK },
|
|
810
|
+
props: { hasTextColor: TEXT_COLOR_OK, tag: TAG_AS },
|
|
806
811
|
},
|
|
807
812
|
HeroBody: {
|
|
808
813
|
status: 'mapped',
|
|
@@ -813,7 +818,7 @@ export const MAPPING = {
|
|
|
813
818
|
HeroFooter: {
|
|
814
819
|
status: 'mapped',
|
|
815
820
|
target: 'Hero.Foot',
|
|
816
|
-
props: { hasTextColor: TEXT_COLOR_OK },
|
|
821
|
+
props: { hasTextColor: TEXT_COLOR_OK, tag: TAG_AS },
|
|
817
822
|
},
|
|
818
823
|
// ---- the helper HOC -----------------------------------------------------
|
|
819
824
|
withHelpersModifiers: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specials.d.ts","sourceRoot":"","sources":["../../../src/sources/bloomer/specials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAUL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"specials.d.ts","sourceRoot":"","sources":["../../../src/sources/bloomer/specials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAUL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EASL,KAAK,aAAa,EACnB,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EAAE,aAAa,EAAE,CAAC;AAyqC9B,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAClB,OAAO,EAAE,GAAG,GACX,aAAa,CAQf;AAED,eAAO,MAAM,aAAa,UAAwB,CAAC"}
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
import { RENDER_TODO, RESPONSIVE_PROPS, UNIVERSAL_PROPS } from './mapping.js';
|
|
14
14
|
import { addAttr, attrSource, addTodo, attributesOf, findAttr, literalValueOf, makeAttr, removeAttr, resolveBooleanish, } from '../_shared/jsx-utils.js';
|
|
15
15
|
import { applyPropAction } from '../_shared/props.js';
|
|
16
|
+
import { aTag } from '../_shared/articles.js';
|
|
17
|
+
import { AS_UNIONS } from '../_shared/polymorphic.js';
|
|
16
18
|
import { applyIconProps, keepTitleLevel, makeStripModifierProps, makeStructuralHelpers, modifierClass, parseIconClasses, restrictAsToTargets, } from '../_shared/specials-utils.js';
|
|
17
19
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
18
20
|
const stripModifierProps = makeStripModifierProps(UNIVERSAL_PROPS, RESPONSIVE_PROPS);
|
|
@@ -50,6 +52,8 @@ function plainTag(ctx, path, element, fallback, where) {
|
|
|
50
52
|
addTodo(ctx, path, 'prop:tag', `dynamic ${where} \`tag\`; it became a plain <${fallback}> — render the tag yourself`);
|
|
51
53
|
return fallback;
|
|
52
54
|
}
|
|
55
|
+
/** The tags bestax's `Panel.Block` renders through `as`, its default first. */
|
|
56
|
+
const PANEL_BLOCK_TAGS = new Set(AS_UNIONS['Panel.Block']);
|
|
53
57
|
/** A booleanish modifier prop → an `is-*` class fragment, always removed. */
|
|
54
58
|
function booleanClass(ctx, path, element, prop, cls, where) {
|
|
55
59
|
const attr = findAttr(element, prop);
|
|
@@ -187,9 +191,9 @@ function anchorWhenHref(ctx, path, element, options = {}) {
|
|
|
187
191
|
const other = dynamicTag
|
|
188
192
|
? 'the element `tag` named'
|
|
189
193
|
: tagValue?.kind === 'string'
|
|
190
|
-
?
|
|
194
|
+
? aTag(tagValue.value)
|
|
191
195
|
: options.bareAs
|
|
192
|
-
?
|
|
196
|
+
? aTag(options.bareAs)
|
|
193
197
|
: 'its default tag';
|
|
194
198
|
addTodo(ctx, path, 'prop:href', `bloomer chose the element at runtime — an <a> when \`href\` had a value, ${other} when it did not. bestax's \`as\` is one element or the other, and this is the anchor; render the other by hand where the \`href\` is empty`);
|
|
195
199
|
}
|
|
@@ -589,9 +593,11 @@ const SPECIALS = {
|
|
|
589
593
|
};
|
|
590
594
|
},
|
|
591
595
|
/**
|
|
592
|
-
*
|
|
593
|
-
*
|
|
594
|
-
*
|
|
596
|
+
* bloomer's PanelBlock was a <div> unless `href` was set (a checkbox label,
|
|
597
|
+
* a search box), or the `tag` it was given. bestax's Panel.Block is an <a>
|
|
598
|
+
* by default and a <div> or a <label> through `as`, so a block on one of
|
|
599
|
+
* those tags is the bestax component, and one on any other tag, or a
|
|
600
|
+
* dynamic one, stays the plain block it was.
|
|
595
601
|
*/
|
|
596
602
|
'panel-block'(ctx, path, element) {
|
|
597
603
|
// The same rule as anchorWhenHref: bloomer chose the anchor with
|
|
@@ -606,6 +612,28 @@ const SPECIALS = {
|
|
|
606
612
|
if (anchored) {
|
|
607
613
|
return { handledProps: anchorWhenHref(ctx, path, element) };
|
|
608
614
|
}
|
|
615
|
+
// bloomer had no `as`, so one on the element is a stray attribute; the
|
|
616
|
+
// plain block below keeps it where it was, rather than this pass writing
|
|
617
|
+
// a second `as` beside it.
|
|
618
|
+
const tagAttr = findAttr(element, 'tag');
|
|
619
|
+
const tagValue = tagAttr ? literalValueOf(tagAttr) : undefined;
|
|
620
|
+
const blockTag = !tagAttr
|
|
621
|
+
? 'div'
|
|
622
|
+
: tagValue?.kind === 'string'
|
|
623
|
+
? tagValue.value
|
|
624
|
+
: undefined;
|
|
625
|
+
if (blockTag &&
|
|
626
|
+
PANEL_BLOCK_TAGS.has(blockTag) &&
|
|
627
|
+
!findAttr(element, 'as')) {
|
|
628
|
+
if (tagAttr)
|
|
629
|
+
removeAttr(element, tagAttr);
|
|
630
|
+
// `a` is the default, so it needs no `as`.
|
|
631
|
+
if (blockTag !== 'a') {
|
|
632
|
+
addAttr(element, makeAttr(ctx.j, 'as', blockTag));
|
|
633
|
+
}
|
|
634
|
+
ctx.dirty = true;
|
|
635
|
+
return { handledProps: ['tag'] };
|
|
636
|
+
}
|
|
609
637
|
const cls = join('panel-block', booleanClass(ctx, path, element, 'isActive', 'is-active', 'PanelBlock'), booleanClass(ctx, path, element, 'isWrapped', 'is-wrapped', 'PanelBlock'));
|
|
610
638
|
const tag = plainTag(ctx, path, element, 'div', 'PanelBlock');
|
|
611
639
|
return replaceWithPlain(ctx, path, element, tag, cls, 'PanelBlock');
|
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
* Every conversion this table allows must render exactly the HTML the raw
|
|
7
7
|
* element rendered. That is a claim about bestax, and the render tests hold
|
|
8
8
|
* it: each root, modifier and helper here is rendered through the built
|
|
9
|
-
* library and compared with the raw markup it replaces.
|
|
9
|
+
* library and compared with the raw markup it replaces. One exception, on
|
|
10
|
+
* purpose: Font Awesome's own `<i aria-hidden="true">` alone in a `.icon`
|
|
11
|
+
* that carries nothing assistive tech reads converts to `Icon`, which writes
|
|
12
|
+
* the attribute on the `.icon` instead, since the glyph is hidden either way
|
|
13
|
+
* (see `readsGlyph`).
|
|
10
14
|
*
|
|
11
15
|
* Data only: `scripts/gen-mcp-index.mjs` imports it directly for the MCP
|
|
12
16
|
* server's `lookup_bulma_classes`, so nothing Node cannot strip (no enums, no
|
|
@@ -121,6 +125,20 @@ export interface Absorbs {
|
|
|
121
125
|
readonly beside: string;
|
|
122
126
|
}>>;
|
|
123
127
|
}
|
|
128
|
+
/** How a target that renders a glyph from props reads one (`Icon`). */
|
|
129
|
+
export interface ReadsGlyph {
|
|
130
|
+
/**
|
|
131
|
+
* The attributes the element may carry and still take Font Awesome's
|
|
132
|
+
* `aria-hidden` up off its `<i>`: ones the target renders as given that
|
|
133
|
+
* assistive tech doesn't read, a name ending in `*` standing for every
|
|
134
|
+
* attribute it starts. Read by name, whatever the value, since an
|
|
135
|
+
* expression may render as anything. Anything else (a name, a description,
|
|
136
|
+
* a `title`, a `role`, a `tabIndex`, a handler) keeps the attribute where
|
|
137
|
+
* it is: the move would hide what it exposes, and `Icon` writes no
|
|
138
|
+
* `aria-hidden` beside a `role` or `tabIndex` at all.
|
|
139
|
+
*/
|
|
140
|
+
readonly hiddenMovesBeside: readonly string[];
|
|
141
|
+
}
|
|
124
142
|
export interface RootEntry {
|
|
125
143
|
readonly status: RootStatus;
|
|
126
144
|
/**
|
|
@@ -275,6 +293,18 @@ export interface RootEntry {
|
|
|
275
293
|
* and each `.icon` converts on its own; they go.
|
|
276
294
|
*/
|
|
277
295
|
readonly buildsIcons?: boolean;
|
|
296
|
+
/**
|
|
297
|
+
* The target renders a glyph from props in place of its children (`Icon`,
|
|
298
|
+
* from `library` and `name`): when the element's only child is one bare,
|
|
299
|
+
* empty `<i>` whose classes `glyph.ts` reads, its classes become those
|
|
300
|
+
* props, the `<i>` goes and the element closes itself. Around anything
|
|
301
|
+
* else, the target renders its children as given. An `<i>` that carries
|
|
302
|
+
* the `aria-hidden` the target writes, as Font Awesome's own markup does,
|
|
303
|
+
* reads too when the element carries nothing assistive tech reads: the
|
|
304
|
+
* attribute moves up onto it, the one difference in markup a conversion
|
|
305
|
+
* makes.
|
|
306
|
+
*/
|
|
307
|
+
readonly readsGlyph?: ReadsGlyph;
|
|
278
308
|
/**
|
|
279
309
|
* The target renders the whole `.file` tree from props (`File`): its
|
|
280
310
|
* `<input>`, button text, icons and file name. The element converts only
|
|
@@ -291,15 +321,6 @@ export interface RootEntry {
|
|
|
291
321
|
* gutter). The reason is for the MCP lookup.
|
|
292
322
|
*/
|
|
293
323
|
readonly helpersLeftOut?: Readonly<Record<string, string>>;
|
|
294
|
-
/**
|
|
295
|
-
* Tags the target doesn't render, on which the element is valid Bulma that
|
|
296
|
-
* bestax renders some other way, so it stays markup with no `tag` TODO
|
|
297
|
-
* there. Any other tag still gets one. The reason is for the MCP lookup.
|
|
298
|
-
*/
|
|
299
|
-
readonly otherTagsStay?: {
|
|
300
|
-
readonly tags: readonly string[];
|
|
301
|
-
readonly why: string;
|
|
302
|
-
};
|
|
303
324
|
/**
|
|
304
325
|
* Attributes the target types as numbers, among the ones it is given (the
|
|
305
326
|
* child's, when it `absorbs` the child and puts them there), beside
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-map.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/class-map.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"class-map.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/class-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,MAAM,MAAM,GAChB;IAAE,QAAQ,CAAC,EAAE,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAE9E,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;IACtC,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACxE;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,OAAO;IACtB,uBAAuB;IACvB,QAAQ,CAAC,GAAG,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qC;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"}
|
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
* Every conversion this table allows must render exactly the HTML the raw
|
|
7
7
|
* element rendered. That is a claim about bestax, and the render tests hold
|
|
8
8
|
* it: each root, modifier and helper here is rendered through the built
|
|
9
|
-
* library and compared with the raw markup it replaces.
|
|
9
|
+
* library and compared with the raw markup it replaces. One exception, on
|
|
10
|
+
* purpose: Font Awesome's own `<i aria-hidden="true">` alone in a `.icon`
|
|
11
|
+
* that carries nothing assistive tech reads converts to `Icon`, which writes
|
|
12
|
+
* the attribute on the `.icon` instead, since the glyph is hidden either way
|
|
13
|
+
* (see `readsGlyph`).
|
|
10
14
|
*
|
|
11
15
|
* Data only: `scripts/gen-mcp-index.mjs` imports it directly for the MCP
|
|
12
16
|
* server's `lookup_bulma_classes`, so nothing Node cannot strip (no enums, no
|
|
@@ -657,6 +661,16 @@ export const ROOTS = {
|
|
|
657
661
|
...BASE,
|
|
658
662
|
target: 'Container',
|
|
659
663
|
tag: 'div',
|
|
664
|
+
as: [
|
|
665
|
+
'div',
|
|
666
|
+
'main',
|
|
667
|
+
'section',
|
|
668
|
+
'article',
|
|
669
|
+
'aside',
|
|
670
|
+
'header',
|
|
671
|
+
'footer',
|
|
672
|
+
'nav',
|
|
673
|
+
],
|
|
660
674
|
modifiers: {
|
|
661
675
|
...flags({
|
|
662
676
|
'is-fluid': 'fluid',
|
|
@@ -674,6 +688,7 @@ export const ROOTS = {
|
|
|
674
688
|
])),
|
|
675
689
|
},
|
|
676
690
|
ownProps: [
|
|
691
|
+
'as',
|
|
677
692
|
'textColor',
|
|
678
693
|
'color',
|
|
679
694
|
'bgColor',
|
|
@@ -953,6 +968,7 @@ export const ROOTS = {
|
|
|
953
968
|
...BASE,
|
|
954
969
|
target: 'Hero',
|
|
955
970
|
tag: 'section',
|
|
971
|
+
as: ['section', 'div', 'main', 'header', 'footer', 'article', 'aside'],
|
|
956
972
|
// Hero's `color` is the component color, and `textColor` reaches the DOM
|
|
957
973
|
// as an attribute rather than a class.
|
|
958
974
|
textColor: null,
|
|
@@ -960,13 +976,14 @@ export const ROOTS = {
|
|
|
960
976
|
...tokens('is-', COMPONENT_COLORS, 'color'),
|
|
961
977
|
...tokens('is-', ['small', 'medium', 'large', 'fullheight', 'fullheight-with-navbar'], 'size'),
|
|
962
978
|
},
|
|
963
|
-
ownProps: ['color', 'size', 'bgColor', 'fullheightWithNavbar'],
|
|
979
|
+
ownProps: ['as', 'color', 'size', 'bgColor', 'fullheightWithNavbar'],
|
|
964
980
|
},
|
|
965
981
|
'hero-head': {
|
|
966
982
|
...BASE,
|
|
967
983
|
target: 'Hero.Head',
|
|
968
984
|
tag: 'div',
|
|
969
|
-
|
|
985
|
+
as: ['div', 'header', 'nav'],
|
|
986
|
+
ownProps: ['as', 'color', 'bgColor', 'textColor'],
|
|
970
987
|
},
|
|
971
988
|
'hero-body': {
|
|
972
989
|
...BASE,
|
|
@@ -978,7 +995,8 @@ export const ROOTS = {
|
|
|
978
995
|
...BASE,
|
|
979
996
|
target: 'Hero.Foot',
|
|
980
997
|
tag: 'div',
|
|
981
|
-
|
|
998
|
+
as: ['div', 'footer', 'nav'],
|
|
999
|
+
ownProps: ['as', 'color', 'bgColor', 'textColor'],
|
|
982
1000
|
},
|
|
983
1001
|
level: {
|
|
984
1002
|
...BASE,
|
|
@@ -1054,10 +1072,22 @@ export const ROOTS = {
|
|
|
1054
1072
|
modifiers: {
|
|
1055
1073
|
...tokens('is-', COMPONENT_COLORS, 'color'),
|
|
1056
1074
|
...tokens('is-fixed-', ['top', 'bottom'], 'fixed'),
|
|
1057
|
-
...flags({
|
|
1075
|
+
...flags({
|
|
1076
|
+
'is-transparent': 'transparent',
|
|
1077
|
+
'is-spaced': 'isSpaced',
|
|
1078
|
+
'has-shadow': 'hasShadow',
|
|
1079
|
+
}),
|
|
1058
1080
|
},
|
|
1059
1081
|
defaults: { role: 'navigation', 'aria-label': 'main navigation' },
|
|
1060
|
-
ownProps: [
|
|
1082
|
+
ownProps: [
|
|
1083
|
+
'textColor',
|
|
1084
|
+
'color',
|
|
1085
|
+
'bgColor',
|
|
1086
|
+
'transparent',
|
|
1087
|
+
'isSpaced',
|
|
1088
|
+
'hasShadow',
|
|
1089
|
+
'fixed',
|
|
1090
|
+
],
|
|
1061
1091
|
},
|
|
1062
1092
|
// No background prop on these parts.
|
|
1063
1093
|
'navbar-brand': {
|
|
@@ -1365,13 +1395,15 @@ export const ROOTS = {
|
|
|
1365
1395
|
'dropdown-content': part(),
|
|
1366
1396
|
'dropdown-item': part(),
|
|
1367
1397
|
'dropdown-divider': part(),
|
|
1368
|
-
//
|
|
1369
|
-
// icon with no name, no `role`
|
|
1370
|
-
// `
|
|
1398
|
+
// `Icon` renders a bare `<i>` from `library` and `name`, and with children,
|
|
1399
|
+
// `.icon` around them as given. It hides an icon with no name, no `role`
|
|
1400
|
+
// and no `tabIndex`, writing `aria-hidden` on the `.icon` and never on the
|
|
1401
|
+
// `<i>`, and makes one named by `aria-label` or `aria-labelledby` an image.
|
|
1371
1402
|
icon: {
|
|
1372
1403
|
...BASE,
|
|
1373
1404
|
target: 'Icon',
|
|
1374
1405
|
tag: 'span',
|
|
1406
|
+
readsGlyph: { hiddenMovesBeside: ['id', 'style', 'key', 'data-*'] },
|
|
1375
1407
|
modifiers: tokens('is-', ['small', 'medium', 'large'], 'size'),
|
|
1376
1408
|
defaults: { 'aria-hidden': 'true' },
|
|
1377
1409
|
namedDefaults: {
|
|
@@ -1688,13 +1720,14 @@ export const ROOTS = {
|
|
|
1688
1720
|
...BASE,
|
|
1689
1721
|
target: 'Panel',
|
|
1690
1722
|
tag: 'nav',
|
|
1723
|
+
as: ['nav', 'article', 'section', 'aside', 'div'],
|
|
1691
1724
|
textColor: null,
|
|
1692
1725
|
bgColor: null,
|
|
1693
1726
|
omits: Object.fromEntries(COMPONENT_COLORS.map(color => [
|
|
1694
1727
|
`is-${color}`,
|
|
1695
1728
|
'`color` renders `has-text-<color>` on the panel as well',
|
|
1696
1729
|
])),
|
|
1697
|
-
ownProps: ['color'],
|
|
1730
|
+
ownProps: ['as', 'color'],
|
|
1698
1731
|
},
|
|
1699
1732
|
'panel-heading': {
|
|
1700
1733
|
status: 'mapped',
|
|
@@ -1718,15 +1751,29 @@ export const ROOTS = {
|
|
|
1718
1751
|
status: 'mapped',
|
|
1719
1752
|
target: 'Panel.Block',
|
|
1720
1753
|
tag: 'a',
|
|
1754
|
+
as: ['a', 'div', 'label'],
|
|
1721
1755
|
textColor: null,
|
|
1722
1756
|
bgColor: null,
|
|
1723
1757
|
noHelpers: true,
|
|
1724
1758
|
modifiers: flags({ 'is-active': 'active' }),
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1759
|
+
// The anchor attributes, and `rel`, reach only an <a>, and the label's
|
|
1760
|
+
// only a <label> (`STRIP_FROM_NON_ANCHOR` and `STRIP_FROM_NON_LABEL` in
|
|
1761
|
+
// bulma-ui's Panel.tsx).
|
|
1762
|
+
dropsAttr: Object.fromEntries([
|
|
1763
|
+
...[
|
|
1764
|
+
'href',
|
|
1765
|
+
'target',
|
|
1766
|
+
'download',
|
|
1767
|
+
'hrefLang',
|
|
1768
|
+
'ping',
|
|
1769
|
+
'referrerPolicy',
|
|
1770
|
+
'media',
|
|
1771
|
+
'type',
|
|
1772
|
+
'rel',
|
|
1773
|
+
].map(name => [name, { except: ['a'] }]),
|
|
1774
|
+
...['htmlFor', 'form'].map(name => [name, { except: ['label'] }]),
|
|
1775
|
+
]),
|
|
1776
|
+
ownProps: ['as', 'active'],
|
|
1730
1777
|
},
|
|
1731
1778
|
'panel-icon': todo('Panel.Icon', 'bestax `Panel.Icon` renders through `Icon`, which always writes an `aria-label`'),
|
|
1732
1779
|
// With no `Tabs.Content` among its children, `Tabs` renders `.tabs` around
|
|
@@ -20,4 +20,24 @@ export interface Glyph {
|
|
|
20
20
|
* Material Design Icons glyph.
|
|
21
21
|
*/
|
|
22
22
|
export declare function readGlyph(glyph: ChildFacts | undefined): Glyph | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* The glyph of Font Awesome's own markup, `<i class="fas fa-home"
|
|
25
|
+
* aria-hidden="true">`: an `<i>` that carries that attribute and nothing
|
|
26
|
+
* else, and that `readGlyph` reads once it's set aside. Undefined for any
|
|
27
|
+
* other `<i>`, one that `readGlyph` reads as it is included.
|
|
28
|
+
*/
|
|
29
|
+
export declare function readHiddenGlyph(glyph: ChildFacts | undefined): Glyph | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* A glyph as the props `Icon` is given, in the order they're written: one
|
|
32
|
+
* feature as a string, and more than one as a list.
|
|
33
|
+
*/
|
|
34
|
+
export declare function glyphProps(glyph: Glyph): Array<[name: string, value: string | readonly string[]]>;
|
|
35
|
+
/**
|
|
36
|
+
* The glyph Font Awesome's script drew an `<svg class="svg-inline--fa">` for,
|
|
37
|
+
* as the props `Icon` renders the `<i>` it was drawn from: the name from its
|
|
38
|
+
* `data-icon` (else its one class naming a glyph), the style from its
|
|
39
|
+
* `data-prefix`, and its other classes but the width one the script adds.
|
|
40
|
+
* For advice only: `Icon` renders that `<i>`, never the `<svg>`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function readDrawnGlyph(svg: ChildFacts | undefined): Glyph | undefined;
|
|
23
43
|
//# sourceMappingURL=glyph.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glyph.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/glyph.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,WAAW,KAAK;IACpB,OAAO,EAAE,IAAI,GAAG,KAAK,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;
|
|
1
|
+
{"version":3,"file":"glyph.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/glyph.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,WAAW,KAAK;IACpB,OAAO,EAAE,IAAI,GAAG,KAAK,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAqFD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,CAmC1E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,UAAU,GAAG,SAAS,GAC5B,KAAK,GAAG,SAAS,CAMnB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,KAAK,GACX,KAAK,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC,CAAC,CAe1D;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,CA0B7E"}
|
|
@@ -68,6 +68,8 @@ const FA_MODIFIERS = new Set([
|
|
|
68
68
|
'fa-sharp',
|
|
69
69
|
'fa-classic',
|
|
70
70
|
]);
|
|
71
|
+
/** The class Font Awesome's script puts on each `<svg>` it draws. */
|
|
72
|
+
const DRAWN = 'svg-inline--fa';
|
|
71
73
|
/** Material Design Icons' classes that modify a glyph rather than name one. */
|
|
72
74
|
const MDI_MODIFIERS = new Set([
|
|
73
75
|
'mdi-18px',
|
|
@@ -123,6 +125,68 @@ export function readGlyph(glyph) {
|
|
|
123
125
|
}
|
|
124
126
|
return undefined;
|
|
125
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* The glyph of Font Awesome's own markup, `<i class="fas fa-home"
|
|
130
|
+
* aria-hidden="true">`: an `<i>` that carries that attribute and nothing
|
|
131
|
+
* else, and that `readGlyph` reads once it's set aside. Undefined for any
|
|
132
|
+
* other `<i>`, one that `readGlyph` reads as it is included.
|
|
133
|
+
*/
|
|
134
|
+
export function readHiddenGlyph(glyph) {
|
|
135
|
+
const hidden = glyph?.attributes.get('aria-hidden');
|
|
136
|
+
if (glyph?.attributes.size !== 1 || (hidden !== 'true' && hidden !== true)) {
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
return readGlyph({ ...glyph, attributes: new Map() });
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* A glyph as the props `Icon` is given, in the order they're written: one
|
|
143
|
+
* feature as a string, and more than one as a list.
|
|
144
|
+
*/
|
|
145
|
+
export function glyphProps(glyph) {
|
|
146
|
+
const { features } = glyph;
|
|
147
|
+
return [
|
|
148
|
+
['library', glyph.library],
|
|
149
|
+
['name', glyph.name],
|
|
150
|
+
...(glyph.variant ? [['variant', glyph.variant]] : []),
|
|
151
|
+
...(features
|
|
152
|
+
? [
|
|
153
|
+
['features', features.length === 1 ? features[0] : features],
|
|
154
|
+
]
|
|
155
|
+
: []),
|
|
156
|
+
];
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The glyph Font Awesome's script drew an `<svg class="svg-inline--fa">` for,
|
|
160
|
+
* as the props `Icon` renders the `<i>` it was drawn from: the name from its
|
|
161
|
+
* `data-icon` (else its one class naming a glyph), the style from its
|
|
162
|
+
* `data-prefix`, and its other classes but the width one the script adds.
|
|
163
|
+
* For advice only: `Icon` renders that `<i>`, never the `<svg>`.
|
|
164
|
+
*/
|
|
165
|
+
export function readDrawnGlyph(svg) {
|
|
166
|
+
if (svg?.tag !== 'svg' || !svg.tokens?.includes(DRAWN))
|
|
167
|
+
return undefined;
|
|
168
|
+
const tokens = svg.tokens.filter(token => token !== DRAWN && !/^fa-w-\d+$/.test(token));
|
|
169
|
+
const prefix = svg.attributes.get('data-prefix');
|
|
170
|
+
const style = typeof prefix === 'string' && Object.hasOwn(FA_STYLES, prefix)
|
|
171
|
+
? prefix
|
|
172
|
+
: 'fas';
|
|
173
|
+
const icon = svg.attributes.get('data-icon');
|
|
174
|
+
const named = typeof icon === 'string' && /^[a-z0-9-]+$/.test(icon)
|
|
175
|
+
? {
|
|
176
|
+
name: icon,
|
|
177
|
+
features: tokens.filter(token => token !== `fa-${icon}`),
|
|
178
|
+
}
|
|
179
|
+
: nameIn(tokens, 'fa-', FA_MODIFIERS, style);
|
|
180
|
+
if (!named)
|
|
181
|
+
return undefined;
|
|
182
|
+
const variant = FA_STYLES[style];
|
|
183
|
+
return {
|
|
184
|
+
library: 'fa',
|
|
185
|
+
name: named.name,
|
|
186
|
+
...(variant && { variant }),
|
|
187
|
+
...(named.features.length > 0 && { features: named.features }),
|
|
188
|
+
};
|
|
189
|
+
}
|
|
126
190
|
/**
|
|
127
191
|
* The one class among `tokens` that names a glyph (`fa-home`), without its
|
|
128
192
|
* prefix, and the rest but `base`, as features. Undefined unless exactly one
|