bestax-migrate 2.32.0 → 2.33.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/html/parse.d.ts +10 -0
- package/dist/sources/_shared/html/parse.d.ts.map +1 -1
- package/dist/sources/_shared/html/parse.js +13 -1
- package/dist/sources/bulma-classes/class-map.d.ts +41 -11
- package/dist/sources/bulma-classes/class-map.d.ts.map +1 -1
- package/dist/sources/bulma-classes/class-map.js +101 -4
- package/dist/sources/bulma-classes/glyph.d.ts +22 -7
- package/dist/sources/bulma-classes/glyph.d.ts.map +1 -1
- package/dist/sources/bulma-classes/glyph.js +50 -20
- package/dist/sources/bulma-classes/html-assets.d.ts +8 -1
- package/dist/sources/bulma-classes/html-assets.d.ts.map +1 -1
- package/dist/sources/bulma-classes/html-assets.js +35 -8
- package/dist/sources/bulma-classes/html-extensions.d.ts +69 -0
- package/dist/sources/bulma-classes/html-extensions.d.ts.map +1 -0
- package/dist/sources/bulma-classes/html-extensions.js +146 -0
- package/dist/sources/bulma-classes/html-rules.d.ts +5 -0
- package/dist/sources/bulma-classes/html-rules.d.ts.map +1 -1
- package/dist/sources/bulma-classes/html-rules.js +6 -0
- package/dist/sources/bulma-classes/html.d.ts +3 -2
- package/dist/sources/bulma-classes/html.d.ts.map +1 -1
- package/dist/sources/bulma-classes/html.js +143 -33
- package/dist/sources/bulma-classes/plan.d.ts +25 -2
- package/dist/sources/bulma-classes/plan.d.ts.map +1 -1
- package/dist/sources/bulma-classes/plan.js +108 -11
- package/dist/sources/bulma-classes/transform.d.ts +20 -2
- package/dist/sources/bulma-classes/transform.d.ts.map +1 -1
- package/dist/sources/bulma-classes/transform.js +113 -11
- package/package.json +2 -2
|
@@ -59,6 +59,12 @@ export interface ParsedHtml {
|
|
|
59
59
|
*/
|
|
60
60
|
outsideComments: CommentNode[];
|
|
61
61
|
errors: HtmlParseError[];
|
|
62
|
+
/**
|
|
63
|
+
* Whether a browser reads the document in quirks mode (no doctype, or an
|
|
64
|
+
* old one), where class and id selectors ignore ASCII case. A fragment is
|
|
65
|
+
* read as in no-quirks mode.
|
|
66
|
+
*/
|
|
67
|
+
quirks: boolean;
|
|
62
68
|
}
|
|
63
69
|
/** Whether parse5 should read this source as a whole document. */
|
|
64
70
|
export declare function isDocument(source: string): boolean;
|
|
@@ -67,5 +73,9 @@ export declare function isText(node: Node): node is TextNode;
|
|
|
67
73
|
export declare function isComment(node: Node): node is CommentNode;
|
|
68
74
|
/** An element's children, or a `<template>`'s content, which holds them. */
|
|
69
75
|
export declare function childrenOf(node: ParentNode): ChildNode[];
|
|
76
|
+
/** An attribute's value as written, by its unprefixed name. */
|
|
77
|
+
export declare function attributeOf(element: Element, name: string): string | undefined;
|
|
78
|
+
/** An element's classes, split on HTML's whitespace. */
|
|
79
|
+
export declare function classesOf(element: Element): string[];
|
|
70
80
|
export declare function parseHtml(source: string): ParsedHtml;
|
|
71
81
|
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/sources/_shared/html/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/sources/_shared/html/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAIL,KAAK,qBAAqB,EAE1B,KAAK,KAAK,EACX,MAAM,QAAQ,CAAC;AAEhB,MAAM,MAAM,IAAI,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;AACjD,MAAM,MAAM,UAAU,GAAG,qBAAqB,CAAC,YAAY,CAAC,CAAC;AAC7D,MAAM,MAAM,SAAS,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAC;AAC3D,MAAM,MAAM,OAAO,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;AACvD,MAAM,MAAM,QAA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,IAAI,WAAW,CAEzD;AAED,4EAA4E;AAC5E,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,EAAE,CAIxD;AAED,+DAA+D;AAC/D,wBAAgB,WAAW,CACzB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CAEpB;AAED,wDAAwD;AACxD,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CAIpD;AA2ED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CA4DpD"}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* `<noscript>` holds markup rather than text, which is what it means to
|
|
12
12
|
* someone reading the page.
|
|
13
13
|
*/
|
|
14
|
-
import { parse, parseFragment, } from 'parse5';
|
|
14
|
+
import { html as spec, parse, parseFragment, } from 'parse5';
|
|
15
15
|
/**
|
|
16
16
|
* The tags that make HTML a document rather than a partial, wherever they
|
|
17
17
|
* sit outside a comment. `<head` is not `<header`.
|
|
@@ -36,6 +36,16 @@ export function childrenOf(node) {
|
|
|
36
36
|
? node.content.childNodes
|
|
37
37
|
: node.childNodes;
|
|
38
38
|
}
|
|
39
|
+
/** An attribute's value as written, by its unprefixed name. */
|
|
40
|
+
export function attributeOf(element, name) {
|
|
41
|
+
return element.attrs.find(attr => attr.name === name && !attr.prefix)?.value;
|
|
42
|
+
}
|
|
43
|
+
/** An element's classes, split on HTML's whitespace. */
|
|
44
|
+
export function classesOf(element) {
|
|
45
|
+
return (attributeOf(element, 'class') ?? '')
|
|
46
|
+
.split(/[ \t\n\f\r]+/)
|
|
47
|
+
.filter(Boolean);
|
|
48
|
+
}
|
|
39
49
|
function find(nodes, tag) {
|
|
40
50
|
return nodes.find((node) => isElement(node) && node.tagName === tag);
|
|
41
51
|
}
|
|
@@ -130,6 +140,7 @@ export function parseHtml(source) {
|
|
|
130
140
|
bodyAttributes: [],
|
|
131
141
|
outsideComments: [],
|
|
132
142
|
errors,
|
|
143
|
+
quirks: false,
|
|
133
144
|
};
|
|
134
145
|
}
|
|
135
146
|
const document = parse(source, options);
|
|
@@ -151,5 +162,6 @@ export function parseHtml(source) {
|
|
|
151
162
|
bodyAttributes: body?.attrs ?? [],
|
|
152
163
|
outsideComments,
|
|
153
164
|
errors,
|
|
165
|
+
quirks: document.mode === spec.DOCUMENT_MODE.QUIRKS,
|
|
154
166
|
};
|
|
155
167
|
}
|
|
@@ -9,9 +9,14 @@
|
|
|
9
9
|
* library and compared with the raw markup it replaces. The exceptions are
|
|
10
10
|
* on purpose. Font Awesome's own `<i aria-hidden="true">` alone in a `.icon`
|
|
11
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
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* the attribute on the `.icon` instead, since the glyph is hidden either way;
|
|
13
|
+
* a `.icon` around a bare glyph in a link or button its own label names
|
|
14
|
+
* converts too, and `Icon` writes the attribute it doesn't carry, since that
|
|
15
|
+
* label is what assistive tech reads for the control; and Font Awesome 6's
|
|
16
|
+
* long name for a style (`fa-brands`) is written as the skill's `variant`,
|
|
17
|
+
* which `Icon` renders as the short one (`fab`), the same style (see
|
|
18
|
+
* `readsGlyph`). And a Bulma 0.9 helper v1 removed, which styles nothing
|
|
19
|
+
* under v1, converts as the v1 helper that does its job (see
|
|
15
20
|
* `REPLACED_IN_V1`).
|
|
16
21
|
*
|
|
17
22
|
* Data only: `scripts/gen-mcp-index.mjs` imports it directly for the MCP
|
|
@@ -166,13 +171,14 @@ export interface Absorbs {
|
|
|
166
171
|
export interface ReadsGlyph {
|
|
167
172
|
/**
|
|
168
173
|
* The attributes the element may carry and still take Font Awesome's
|
|
169
|
-
* `aria-hidden` up off its `<i
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
174
|
+
* `aria-hidden` up off its `<i>`, or take the one the target writes on an
|
|
175
|
+
* icon in a link or button its own label names: ones the target renders
|
|
176
|
+
* as given that assistive tech doesn't read, a name ending in `*` standing
|
|
177
|
+
* for every attribute it starts. Read by name, whatever the value, since
|
|
178
|
+
* an expression may render as anything. Anything else (a name, a
|
|
179
|
+
* description, a `title`, a `role`, a `tabIndex`, a handler) keeps the
|
|
180
|
+
* element as it is: the attribute would hide what it exposes, and `Icon`
|
|
181
|
+
* writes no `aria-hidden` beside a `role` or `tabIndex` at all.
|
|
176
182
|
*/
|
|
177
183
|
readonly hiddenMovesBeside: readonly string[];
|
|
178
184
|
}
|
|
@@ -339,7 +345,9 @@ export interface RootEntry {
|
|
|
339
345
|
* the `aria-hidden` the target writes, as Font Awesome's own markup does,
|
|
340
346
|
* reads too when the element carries nothing assistive tech reads: the
|
|
341
347
|
* attribute moves up onto it, a difference in markup a conversion makes
|
|
342
|
-
* on purpose.
|
|
348
|
+
* on purpose. So does a bare `<i>` in an element that carries no
|
|
349
|
+
* `aria-hidden` and nothing else assistive tech reads, in a link or button
|
|
350
|
+
* its own label names: the target writes the attribute there.
|
|
343
351
|
*/
|
|
344
352
|
readonly readsGlyph?: ReadsGlyph;
|
|
345
353
|
/**
|
|
@@ -480,6 +488,28 @@ export declare const FORWARDS_REF: readonly string[];
|
|
|
480
488
|
export declare const WRAPPERS: Readonly<Record<string, string>>;
|
|
481
489
|
/** The wrappers' own props, as `ROOTS` lists them for the components. */
|
|
482
490
|
export declare const WRAPPER_OWN_PROPS: Readonly<Record<string, readonly string[]>>;
|
|
491
|
+
/**
|
|
492
|
+
* Plain tags a bestax component renders as they are, with no class of its
|
|
493
|
+
* own, that this source leaves as markup all the same: it converts a table's
|
|
494
|
+
* `.table` and not the rows and cells inside it. Never read by the codemod.
|
|
495
|
+
* The MCP lookup names the component for one of these, which would otherwise
|
|
496
|
+
* say bestax has no component for the tag (#1236), and the index carries the
|
|
497
|
+
* props each takes beside the helper props, read off its record.
|
|
498
|
+
*/
|
|
499
|
+
export declare const BY_HAND: Readonly<Record<string, string>>;
|
|
500
|
+
/**
|
|
501
|
+
* Classes no Bulma 1 rule matches that a page takes from another stylesheet
|
|
502
|
+
* it loads, grouped by that stylesheet, each with what to do about them. The
|
|
503
|
+
* codemod leaves a class it doesn't convert where it is, so it never reads
|
|
504
|
+
* these; the MCP lookup does, for a class Bulma 1's stylesheet lacks, which
|
|
505
|
+
* it would otherwise call a class nothing styles (#1236). A `glyph` group's
|
|
506
|
+
* classes name an icon font's glyph, which bestax `Icon` writes from props.
|
|
507
|
+
*/
|
|
508
|
+
export declare const ELSEWHERE: ReadonlyArray<{
|
|
509
|
+
readonly why: string;
|
|
510
|
+
readonly match: RegExp;
|
|
511
|
+
readonly glyph?: boolean;
|
|
512
|
+
}>;
|
|
483
513
|
/**
|
|
484
514
|
* Every class Bulma 0.9.4's compiled stylesheet has and v1's does not, read
|
|
485
515
|
* off the two with the class walk `e2e/bulma-classes-vocabulary.test.ts`
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;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,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AAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE5D;AAED,4DAA4D;AAC5D,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"}
|
|
@@ -9,9 +9,14 @@
|
|
|
9
9
|
* library and compared with the raw markup it replaces. The exceptions are
|
|
10
10
|
* on purpose. Font Awesome's own `<i aria-hidden="true">` alone in a `.icon`
|
|
11
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
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* the attribute on the `.icon` instead, since the glyph is hidden either way;
|
|
13
|
+
* a `.icon` around a bare glyph in a link or button its own label names
|
|
14
|
+
* converts too, and `Icon` writes the attribute it doesn't carry, since that
|
|
15
|
+
* label is what assistive tech reads for the control; and Font Awesome 6's
|
|
16
|
+
* long name for a style (`fa-brands`) is written as the skill's `variant`,
|
|
17
|
+
* which `Icon` renders as the short one (`fab`), the same style (see
|
|
18
|
+
* `readsGlyph`). And a Bulma 0.9 helper v1 removed, which styles nothing
|
|
19
|
+
* under v1, converts as the v1 helper that does its job (see
|
|
15
20
|
* `REPLACED_IN_V1`).
|
|
16
21
|
*
|
|
17
22
|
* Data only: `scripts/gen-mcp-index.mjs` imports it directly for the MCP
|
|
@@ -1405,7 +1410,11 @@ export const ROOTS = {
|
|
|
1405
1410
|
ownProps: ['variant', 'lines'],
|
|
1406
1411
|
},
|
|
1407
1412
|
// ---- Families bestax has but that do not map element by element yet ------
|
|
1408
|
-
|
|
1413
|
+
// `Checkbox` renders a `<label class="styled-checkbox checkbox">` around
|
|
1414
|
+
// its `<input>`, hidden, and a box of its own drawn beside it. It puts its
|
|
1415
|
+
// `className` on the `<label>` and the rest of what it's given on the
|
|
1416
|
+
// `<input>`, and its `indeterminate` sets the input's mixed state.
|
|
1417
|
+
checkbox: todo('Checkbox', "bestax `Checkbox` renders its own styled markup, not Bulma's. Write it by hand in place of the element that carries `.checkbox`, Bulma's `<label>` or a bare `<input>`, with the `<input>`'s attributes on it: `id`, `name`, `aria-label` and the rest reach its `<input>`, and a `<label>`'s text is its children. Drive it with `checked` and `onChange`, and add `indeterminate` for a select-all box. Its `className` goes on its `<label>`, which declares the `--bulma-checkbox-*` variables, so set the page's colors with those in a rule for your class beside `.styled-checkbox`. Where the page put `.checkbox` on a bare `<input>`, drop its own rules for that box, since bestax draws its own and `.checkbox` is on its `<label>` now"),
|
|
1409
1418
|
checkboxes: todo('Checkboxes', 'bestax `Checkboxes` renders its own `.field` and `.control` wrappers'),
|
|
1410
1419
|
radio: todo('Radio', "bestax `Radio` renders its own styled markup, not Bulma's"),
|
|
1411
1420
|
radios: todo('Radios', 'bestax `Radios` renders its own `.field` and `.control` wrappers'),
|
|
@@ -1483,6 +1492,16 @@ export const ROOTS = {
|
|
|
1483
1492
|
tag: 'span',
|
|
1484
1493
|
readsGlyph: { hiddenMovesBeside: ['id', 'style', 'key', 'data-*'] },
|
|
1485
1494
|
modifiers: tokens('is-', ['small', 'medium', 'large'], 'size'),
|
|
1495
|
+
// Bulma places an icon with these inside a `.control` that has icons on
|
|
1496
|
+
// that side, and `Control` renders that icon itself from a prop, which
|
|
1497
|
+
// writes the class with the rest of the icon. On `Icon` the class stays.
|
|
1498
|
+
omits: Object.fromEntries(['left', 'right'].map(side => {
|
|
1499
|
+
const prop = side === 'left' ? 'iconLeft' : 'iconRight';
|
|
1500
|
+
return [
|
|
1501
|
+
`is-${side}`,
|
|
1502
|
+
`Bulma places it inside a \`.control\` with \`has-icons-${side}\`, and bestax \`Control\` renders that icon itself from \`${prop}\` (\`${prop}={{ library: "fa", name: "envelope", size: "small" }}\`), after its children, so a hidden \`.icon\` there can go as that prop; on \`Icon\` the class stays in \`className\`, which renders the same`,
|
|
1503
|
+
];
|
|
1504
|
+
})),
|
|
1486
1505
|
defaults: { 'aria-hidden': 'true' },
|
|
1487
1506
|
namedDefaults: {
|
|
1488
1507
|
by: ['aria-label', 'aria-labelledby'],
|
|
@@ -2110,6 +2129,84 @@ export const WRAPPER_OWN_PROPS = {
|
|
|
2110
2129
|
UnorderedList: ['textColor', 'bgColor'],
|
|
2111
2130
|
Figure: ['textColor', 'bgColor'],
|
|
2112
2131
|
};
|
|
2132
|
+
/**
|
|
2133
|
+
* Plain tags a bestax component renders as they are, with no class of its
|
|
2134
|
+
* own, that this source leaves as markup all the same: it converts a table's
|
|
2135
|
+
* `.table` and not the rows and cells inside it. Never read by the codemod.
|
|
2136
|
+
* The MCP lookup names the component for one of these, which would otherwise
|
|
2137
|
+
* say bestax has no component for the tag (#1236), and the index carries the
|
|
2138
|
+
* props each takes beside the helper props, read off its record.
|
|
2139
|
+
*/
|
|
2140
|
+
export const BY_HAND = {
|
|
2141
|
+
thead: 'Table.Thead',
|
|
2142
|
+
tbody: 'Table.Tbody',
|
|
2143
|
+
tfoot: 'Table.Tfoot',
|
|
2144
|
+
tr: 'Table.Tr',
|
|
2145
|
+
th: 'Table.Th',
|
|
2146
|
+
td: 'Table.Td',
|
|
2147
|
+
};
|
|
2148
|
+
/**
|
|
2149
|
+
* The bulma-social brand colors, the classes it adds to Bulma's `.button`,
|
|
2150
|
+
* across its majors: read off the stylesheet each publishes (`css/all.css`
|
|
2151
|
+
* in 2 and 3, `bin/bulma-social.css` in 1). Nothing here installs it, so a
|
|
2152
|
+
* brand a later release adds is missing until it is added here.
|
|
2153
|
+
*/
|
|
2154
|
+
const BULMA_SOCIAL = [
|
|
2155
|
+
'apple',
|
|
2156
|
+
'bitbucket',
|
|
2157
|
+
'discord',
|
|
2158
|
+
'dropbox',
|
|
2159
|
+
'facebook',
|
|
2160
|
+
'flickr',
|
|
2161
|
+
'foursquare',
|
|
2162
|
+
'github',
|
|
2163
|
+
'gitlab',
|
|
2164
|
+
'instagram',
|
|
2165
|
+
'linkedin',
|
|
2166
|
+
'microsoft',
|
|
2167
|
+
'odnoklassniki',
|
|
2168
|
+
'openid',
|
|
2169
|
+
'pinterest',
|
|
2170
|
+
'reddit',
|
|
2171
|
+
'slack',
|
|
2172
|
+
'soundcloud',
|
|
2173
|
+
'tumblr',
|
|
2174
|
+
'twitch',
|
|
2175
|
+
'twitter',
|
|
2176
|
+
'vimeo',
|
|
2177
|
+
'vk',
|
|
2178
|
+
'x',
|
|
2179
|
+
'yahoo',
|
|
2180
|
+
'youtube',
|
|
2181
|
+
];
|
|
2182
|
+
/**
|
|
2183
|
+
* Classes no Bulma 1 rule matches that a page takes from another stylesheet
|
|
2184
|
+
* it loads, grouped by that stylesheet, each with what to do about them. The
|
|
2185
|
+
* codemod leaves a class it doesn't convert where it is, so it never reads
|
|
2186
|
+
* these; the MCP lookup does, for a class Bulma 1's stylesheet lacks, which
|
|
2187
|
+
* it would otherwise call a class nothing styles (#1236). A `glyph` group's
|
|
2188
|
+
* classes name an icon font's glyph, which bestax `Icon` writes from props.
|
|
2189
|
+
*/
|
|
2190
|
+
export const ELSEWHERE = [
|
|
2191
|
+
{
|
|
2192
|
+
why: "a Font Awesome class: Font Awesome's own stylesheet styles it, not Bulma's, so keep loading Font Awesome (the bestax-migrate skill's `html-asset:font-awesome` says how). bestax `Icon` writes these classes from its props, on the <i> it renders inside a `.icon`",
|
|
2193
|
+
match: /^(?:fa|fa[srbldt]|fa-[a-z0-9]+(?:-[a-z0-9]+)*|svg-inline--fa)$/,
|
|
2194
|
+
glyph: true,
|
|
2195
|
+
},
|
|
2196
|
+
{
|
|
2197
|
+
why: 'a Material Design Icons class: its own stylesheet styles it, not Bulma\'s, so keep loading it. bestax `Icon` writes these classes from its props, with `library="mdi"`, on the <i> it renders inside a `.icon`',
|
|
2198
|
+
match: /^mdi(?:-[a-z0-9]+)*$/,
|
|
2199
|
+
glyph: true,
|
|
2200
|
+
},
|
|
2201
|
+
{
|
|
2202
|
+
why: "a bulma-social class, a Bulma extension's brand color for Bulma's `.button`, which bestax's `Button` renders: keep loading bulma-social and keep the class on `Button` in `className`, since bestax has no component for it (the bestax-migrate skill's `html-asset:bulma-extension` has the recipe)",
|
|
2203
|
+
match: new RegExp(`^is-(?:${BULMA_SOCIAL.join('|')}|animated)$`),
|
|
2204
|
+
},
|
|
2205
|
+
{
|
|
2206
|
+
why: "a bulma-carousel class, a Bulma extension bestax's `Carousel` does the job of (the bestax-migrate skill's `html-asset:bulma-extension` says how). Once the page stops loading bulma-carousel nothing styles it: `is-covered`'s `object-fit: cover` on a slide's image goes in the app's own CSS",
|
|
2207
|
+
match: /^(?:has-carousel|hero-carousel|is-background|is-covered|slider-(?:container|item|navigation-next|navigation-previous|page|pagination)|video-container)$/,
|
|
2208
|
+
},
|
|
2209
|
+
];
|
|
2113
2210
|
/**
|
|
2114
2211
|
* Every class Bulma 0.9.4's compiled stylesheet has and v1's does not, read
|
|
2115
2212
|
* off the two with the class walk `e2e/bulma-classes-vocabulary.test.ts`
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Read an icon's glyph, the `<i>` inside a `.icon`, as the props bestax
|
|
3
|
-
* `Icon` builds it from
|
|
4
|
-
* given those props, renders that `<i>`
|
|
5
|
-
*
|
|
6
|
-
* `
|
|
3
|
+
* `Icon` builds it from, spelled the way the bestax-icons skill writes them.
|
|
4
|
+
* Pure: a glyph reads only when `Icon`, given those props, renders that `<i>`
|
|
5
|
+
* with exactly its classes and nothing else, but for one exception on
|
|
6
|
+
* purpose. Font Awesome 6's long name for a style (`fa-brands`) is written as
|
|
7
|
+
* the skill's `variant` (`brands`), which `Icon` renders as the short name
|
|
8
|
+
* (`fab`), the same style in 6 and 7 (`longStyle` says so). `library` is left
|
|
9
|
+
* out for Font Awesome, `Icon`'s default, as the skill writes it: like every
|
|
10
|
+
* conversion, this assumes no `ConfigProvider` sets another default (its
|
|
11
|
+
* `iconLibrary` here, as its `classPrefix` would for any component).
|
|
7
12
|
*/
|
|
8
13
|
import type { ChildFacts } from './plan.js';
|
|
9
14
|
export interface Glyph {
|
|
@@ -13,6 +18,13 @@ export interface Glyph {
|
|
|
13
18
|
variant?: string;
|
|
14
19
|
/** The glyph's other classes, which `Icon` renders after its own. */
|
|
15
20
|
features?: string[];
|
|
21
|
+
/**
|
|
22
|
+
* The long name of Font Awesome's style the `<i>` was written with
|
|
23
|
+
* (`fa-brands`), when `variant` is the skill's name for it, which `Icon`
|
|
24
|
+
* renders as the short one (`fab`): a way a conversion's markup differs
|
|
25
|
+
* on purpose. The render tests compare it with the short name restated.
|
|
26
|
+
*/
|
|
27
|
+
longStyle?: string;
|
|
16
28
|
}
|
|
17
29
|
/**
|
|
18
30
|
* The props `Icon` renders this glyph from, or undefined when it can't: the
|
|
@@ -28,8 +40,9 @@ export declare function readGlyph(glyph: ChildFacts | undefined): Glyph | undefi
|
|
|
28
40
|
*/
|
|
29
41
|
export declare function readHiddenGlyph(glyph: ChildFacts | undefined): Glyph | undefined;
|
|
30
42
|
/**
|
|
31
|
-
* A glyph as the props `Icon` is given, in the order they're written:
|
|
32
|
-
*
|
|
43
|
+
* A glyph as the props `Icon` is given, in the order they're written: no
|
|
44
|
+
* `library` for Font Awesome, `Icon`'s default, and one feature as a string,
|
|
45
|
+
* more than one as a list.
|
|
33
46
|
*/
|
|
34
47
|
export declare function glyphProps(glyph: Glyph): Array<[name: string, value: string | readonly string[]]>;
|
|
35
48
|
/**
|
|
@@ -37,7 +50,9 @@ export declare function glyphProps(glyph: Glyph): Array<[name: string, value: st
|
|
|
37
50
|
* as the props `Icon` renders the `<i>` it was drawn from: the name from its
|
|
38
51
|
* `data-icon` (else its one class naming a glyph), the style from its
|
|
39
52
|
* `data-prefix`, and its other classes but the width one the script adds.
|
|
40
|
-
*
|
|
53
|
+
* The script is Font Awesome 5's or later, which reads the `fa` prefix as
|
|
54
|
+
* solid, so that one is `Icon`'s default here. For advice only: `Icon`
|
|
55
|
+
* renders that `<i>`, never the `<svg>`.
|
|
41
56
|
*/
|
|
42
57
|
export declare function readDrawnGlyph(svg: ChildFacts | undefined): Glyph | undefined;
|
|
43
58
|
//# 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
|
|
1
|
+
{"version":3,"file":"glyph.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/glyph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;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;IACpB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAuGD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,CAsC1E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,UAAU,GAAG,SAAS,GAC5B,KAAK,GAAG,SAAS,CAMnB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,KAAK,GACX,KAAK,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC,CAAC,CAiB1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,CA0B7E"}
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Read an icon's glyph, the `<i>` inside a `.icon`, as the props bestax
|
|
3
|
-
* `Icon` builds it from
|
|
4
|
-
* given those props, renders that `<i>`
|
|
5
|
-
*
|
|
6
|
-
* `
|
|
3
|
+
* `Icon` builds it from, spelled the way the bestax-icons skill writes them.
|
|
4
|
+
* Pure: a glyph reads only when `Icon`, given those props, renders that `<i>`
|
|
5
|
+
* with exactly its classes and nothing else, but for one exception on
|
|
6
|
+
* purpose. Font Awesome 6's long name for a style (`fa-brands`) is written as
|
|
7
|
+
* the skill's `variant` (`brands`), which `Icon` renders as the short name
|
|
8
|
+
* (`fab`), the same style in 6 and 7 (`longStyle` says so). `library` is left
|
|
9
|
+
* out for Font Awesome, `Icon`'s default, as the skill writes it: like every
|
|
10
|
+
* conversion, this assumes no `ConfigProvider` sets another default (its
|
|
11
|
+
* `iconLibrary` here, as its `classPrefix` would for any component).
|
|
7
12
|
*/
|
|
8
13
|
/**
|
|
9
|
-
* Font Awesome's style classes
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
14
|
+
* Font Awesome's style classes, as the `variant` the bestax-icons skill
|
|
15
|
+
* writes for each. `Icon` renders its `variant` through a table of the
|
|
16
|
+
* skill's names (`regular` as `far`), and as written otherwise, so `fa`, Font
|
|
17
|
+
* Awesome 4's, reads as itself: 4 styles nothing else, and 5 and later read
|
|
18
|
+
* it as solid. `fas` is `Icon`'s default.
|
|
13
19
|
*/
|
|
14
20
|
const FA_STYLES = {
|
|
15
21
|
fas: undefined,
|
|
@@ -19,13 +25,29 @@ const FA_STYLES = {
|
|
|
19
25
|
fad: 'duotone',
|
|
20
26
|
fat: 'thin',
|
|
21
27
|
fa: 'fa',
|
|
22
|
-
'fa-solid':
|
|
23
|
-
'fa-regular': '
|
|
24
|
-
'fa-brands': '
|
|
25
|
-
'fa-light': '
|
|
26
|
-
'fa-thin': '
|
|
27
|
-
'fa-duotone': '
|
|
28
|
+
'fa-solid': undefined,
|
|
29
|
+
'fa-regular': 'regular',
|
|
30
|
+
'fa-brands': 'brands',
|
|
31
|
+
'fa-light': 'light',
|
|
32
|
+
'fa-thin': 'thin',
|
|
33
|
+
'fa-duotone': 'duotone',
|
|
28
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Font Awesome 6's long names for its styles, which `Icon` writes as the
|
|
37
|
+
* short ones (`fab`) once read as the skill's `variant`. Font Awesome 6
|
|
38
|
+
* styles an `<i>` the same either way, and 7 does too, but that its short
|
|
39
|
+
* names also set the classic family: so beside `fa-sharp`, which sets
|
|
40
|
+
* another, the long name is kept as written. 5 and older have no long
|
|
41
|
+
* names.
|
|
42
|
+
*/
|
|
43
|
+
const LONG_STYLES = new Set([
|
|
44
|
+
'fa-solid',
|
|
45
|
+
'fa-regular',
|
|
46
|
+
'fa-brands',
|
|
47
|
+
'fa-light',
|
|
48
|
+
'fa-thin',
|
|
49
|
+
'fa-duotone',
|
|
50
|
+
]);
|
|
29
51
|
/** Font Awesome's classes that modify a glyph rather than name one. */
|
|
30
52
|
const FA_MODIFIERS = new Set([
|
|
31
53
|
'fa-2xs',
|
|
@@ -105,12 +127,15 @@ export function readGlyph(glyph) {
|
|
|
105
127
|
const named = nameIn(tokens, 'fa-', FA_MODIFIERS, style);
|
|
106
128
|
if (!named)
|
|
107
129
|
return undefined;
|
|
108
|
-
|
|
130
|
+
// Beside another family, the long name stays as written (`LONG_STYLES`).
|
|
131
|
+
const long = LONG_STYLES.has(style) && !tokens.includes('fa-sharp');
|
|
132
|
+
const variant = long || !LONG_STYLES.has(style) ? FA_STYLES[style] : style;
|
|
109
133
|
return {
|
|
110
134
|
library: 'fa',
|
|
111
135
|
name: named.name,
|
|
112
136
|
...(variant && { variant }),
|
|
113
137
|
...(named.features.length > 0 && { features: named.features }),
|
|
138
|
+
...(long && { longStyle: style }),
|
|
114
139
|
};
|
|
115
140
|
}
|
|
116
141
|
if (mdi && styles.length === 0) {
|
|
@@ -139,13 +164,16 @@ export function readHiddenGlyph(glyph) {
|
|
|
139
164
|
return readGlyph({ ...glyph, attributes: new Map() });
|
|
140
165
|
}
|
|
141
166
|
/**
|
|
142
|
-
* A glyph as the props `Icon` is given, in the order they're written:
|
|
143
|
-
*
|
|
167
|
+
* A glyph as the props `Icon` is given, in the order they're written: no
|
|
168
|
+
* `library` for Font Awesome, `Icon`'s default, and one feature as a string,
|
|
169
|
+
* more than one as a list.
|
|
144
170
|
*/
|
|
145
171
|
export function glyphProps(glyph) {
|
|
146
172
|
const { features } = glyph;
|
|
147
173
|
return [
|
|
148
|
-
|
|
174
|
+
...(glyph.library === 'fa'
|
|
175
|
+
? []
|
|
176
|
+
: [['library', glyph.library]]),
|
|
149
177
|
['name', glyph.name],
|
|
150
178
|
...(glyph.variant ? [['variant', glyph.variant]] : []),
|
|
151
179
|
...(features
|
|
@@ -160,7 +188,9 @@ export function glyphProps(glyph) {
|
|
|
160
188
|
* as the props `Icon` renders the `<i>` it was drawn from: the name from its
|
|
161
189
|
* `data-icon` (else its one class naming a glyph), the style from its
|
|
162
190
|
* `data-prefix`, and its other classes but the width one the script adds.
|
|
163
|
-
*
|
|
191
|
+
* The script is Font Awesome 5's or later, which reads the `fa` prefix as
|
|
192
|
+
* solid, so that one is `Icon`'s default here. For advice only: `Icon`
|
|
193
|
+
* renders that `<i>`, never the `<svg>`.
|
|
164
194
|
*/
|
|
165
195
|
export function readDrawnGlyph(svg) {
|
|
166
196
|
if (svg?.tag !== 'svg' || !svg.tokens?.includes(DRAWN))
|
|
@@ -179,7 +209,7 @@ export function readDrawnGlyph(svg) {
|
|
|
179
209
|
: nameIn(tokens, 'fa-', FA_MODIFIERS, style);
|
|
180
210
|
if (!named)
|
|
181
211
|
return undefined;
|
|
182
|
-
const variant = FA_STYLES[style];
|
|
212
|
+
const variant = style === 'fa' ? undefined : FA_STYLES[style];
|
|
183
213
|
return {
|
|
184
214
|
library: 'fa',
|
|
185
215
|
name: named.name,
|
|
@@ -75,7 +75,14 @@ export declare function fontAwesomeMessage(asset: Extract<Asset, {
|
|
|
75
75
|
* name alone), with the component that does what the extension did.
|
|
76
76
|
*/
|
|
77
77
|
export declare const EXTENSION_COMPONENTS: Readonly<Record<string, string>>;
|
|
78
|
-
|
|
78
|
+
/** An extension's package without its scope, in lower case (`bulma-tooltip`). */
|
|
79
|
+
export declare function extensionPackage(name: string): string;
|
|
80
|
+
/**
|
|
81
|
+
* What a page's link to an extension leaves to do. `covered`: the page has
|
|
82
|
+
* images with bulma-carousel's `is-covered`, which its stylesheet crops only
|
|
83
|
+
* inside its own slides, so keeping the extension doesn't keep them cropped.
|
|
84
|
+
*/
|
|
85
|
+
export declare function extensionMessage(name: string, quoted: string[], loads: ReadonlySet<Loads>, css: CssMode, covered?: boolean): string;
|
|
79
86
|
export declare function jqueryMessage(quoted: string): string;
|
|
80
87
|
export declare function webfontMessage(asset: Extract<Asset, {
|
|
81
88
|
kind: 'webfont';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-assets.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/html-assets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,MAAM,MAAM,KAAK,GAAG,YAAY,GAAG,QAAQ,CAAC;AAE5C,MAAM,MAAM,KAAK;AACf,iEAAiE;AAC/D;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAC/D;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,GAAG,EAAE,OAAO,CAAA;CAAE;AAC9D,sEAAsE;GACpE;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,gBAAgB,GAAG,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