bestax-migrate 2.25.6 → 2.26.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.
@@ -0,0 +1,84 @@
1
+ /**
2
+ * A Bulma HTML page → a React module, written beside it.
3
+ *
4
+ * The page is parsed the way a browser builds it (`_shared/html/`), its body
5
+ * becomes the JSX a component returns, laid out with Bulma's displays so the
6
+ * whitespace beside a block, flex or grid box goes, and then the bulma-classes
7
+ * transform runs on that module unchanged, so the HTML converts exactly as
8
+ * the same markup written as JSX would. A number attribute on a plain element
9
+ * is written as a number last, since the planner reads attributes as strings.
10
+ *
11
+ * What a component can't carry becomes a `TODO(bestax-migrate)` line and a
12
+ * report entry under the `html-*` rules (`html-rules.ts`): the head, the
13
+ * `<html>` and `<body>` attributes, scripts (dropped, since a component runs
14
+ * none; their code stays in the page), and what the converter couldn't write
15
+ * as it was. Document-level ones sit above the component, the rest above its
16
+ * `return`, where the planner's own go. A report entry names the page and
17
+ * its line, never the module's.
18
+ *
19
+ * Nothing is ever overwritten: a module already beside the page stops it
20
+ * (`html-file:exists`), so a second run changes nothing, and the page itself
21
+ * stays as it was. A page with no Bulma component class writes nothing (a
22
+ * Vite `index.html` is a page like any other), and a server template
23
+ * (`{{`, `{%`, `<?php`, `<%`) is refused rather than read as HTML.
24
+ */
25
+ import type { HtmlResult, TodoCollector, TodoEntry, TransformOptions } from '../../types.js';
26
+ import { type DisplayOf } from '../_shared/html/whitespace.js';
27
+ /**
28
+ * One display that keeps every run of whitespace any of `displays` would.
29
+ * An inline box keeps the runs beside it, `none` (or a box out of the flow)
30
+ * leaves them to what is past it, and a block drops them, so the result sits
31
+ * inline if any of them does, and is no box if any is, before it is a block.
32
+ * Inside, flowing on the line keeps the most and laying children out as boxes
33
+ * the least.
34
+ */
35
+ export declare function keepingMost(displays: ReadonlySet<string>): string;
36
+ /**
37
+ * An element's display on a Bulma page: its inline `style`'s when CSS reads
38
+ * it, else what Bulma's classes give it at each viewport (its tag's own where
39
+ * no rule reaches), else its tag's own. Bulma's display helpers are
40
+ * `!important`, so beside one an inline display is one case among theirs.
41
+ * A box Bulma takes out of the flow is beside nothing, so `none` counts too.
42
+ * Where the cases differ, the one display kept is the one that keeps every
43
+ * run any of them would (`keepingMost`): whitespace beside an element goes
44
+ * only when every case drops it.
45
+ *
46
+ * The page's own stylesheets are out of reach, as they are for the
47
+ * converter: a class of the page's that changes a display is the limit.
48
+ */
49
+ export declare const pageDisplayOf: DisplayOf;
50
+ /**
51
+ * The component a page becomes: its file's name in PascalCase (its folder's
52
+ * for an `index.html`) and `Page`, so `hero.html` can't shadow bestax's
53
+ * `Hero`. A name starting with a digit starts with `Page` instead
54
+ * (`404.html` is `Page404`), and one with nothing to go by is `Page`.
55
+ */
56
+ export declare function componentName(file: string): string;
57
+ /**
58
+ * Where a page's module goes: beside it, `.tsx` when the package around it is
59
+ * TypeScript (a tsconfig, or a dependency on `typescript`), `.jsx` otherwise.
60
+ */
61
+ export declare function outputPathFor(file: string, options?: TransformOptions): string;
62
+ /**
63
+ * For a page a folder walk found but left out: whether to say so. `-e`
64
+ * matches an extension exactly, as it does for every other file, so the
65
+ * advice names the page's own (`-e html` takes no `.htm` page).
66
+ */
67
+ export declare function excludedHtml(file: string, source: string): TodoEntry | null;
68
+ /**
69
+ * The module as written, after the planner: a number attribute on a plain
70
+ * element as a number (`tabIndex="-1"` as `tabIndex={-1}`), which React's
71
+ * types want and React renders the same, when it is spelled the way it
72
+ * renders; a component's are the planner's. And a blank line after the
73
+ * imports, which the transform puts straight above the component.
74
+ */
75
+ export declare function finishModule(code: string): string;
76
+ /** A page as a module: the one written, and the one before the planner ran. */
77
+ export interface ConvertedPage extends HtmlResult {
78
+ /** The page's content as plain JSX, before the bulma-classes transform. */
79
+ intermediate: string | null;
80
+ }
81
+ export declare function convertPage(file: string, source: string, collector: TodoCollector | undefined, options?: TransformOptions): ConvertedPage;
82
+ /** The `transformHtml` the CLI calls. */
83
+ export declare function transformHtml(file: string, source: string, collector: TodoCollector | undefined, options?: TransformOptions): HtmlResult;
84
+ //# sourceMappingURL=html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../src/sources/bulma-classes/html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,KAAK,EAEV,UAAU,EACV,aAAa,EACb,SAAS,EACT,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AAexB,OAAO,EAIL,KAAK,SAAS,EAEf,MAAM,+BAA+B,CAAC;AAiDvC;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,CAYjE;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,EAAE,SAoB3B,CAAC;AAIF;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAiBlD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,gBAAqB,GAC7B,MAAM,CAQR;AAsBD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAU3E;AAqrBD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA4BjD;AAID,+EAA+E;AAC/E,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC/C,2EAA2E;IAC3E,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAWD,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,aAAa,GAAG,SAAS,EACpC,OAAO,GAAE,gBAAqB,GAC7B,aAAa,CAsGf;AAED,yCAAyC;AACzC,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,aAAa,GAAG,SAAS,EACpC,OAAO,GAAE,gBAAqB,GAC7B,UAAU,CAGZ"}