synthesisui 0.16.70 → 0.16.71
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/commands/import.js +5 -3
- package/dist/doctor/transcribe.js +19 -0
- package/package.json +1 -1
package/dist/commands/import.js
CHANGED
|
@@ -10,7 +10,7 @@ import { describeConvention, describeRemainder, detectConventions, } from "../do
|
|
|
10
10
|
import { diagnose, scanSource } from "../doctor/scan.js";
|
|
11
11
|
import { parseSchemeBlocks } from "../doctor/scheme-blocks.js";
|
|
12
12
|
import { buildTable } from "../doctor/tokens.js";
|
|
13
|
-
import { rootClasses, transcribe, } from "../doctor/transcribe.js";
|
|
13
|
+
import { rootClasses, rootTag, transcribe, } from "../doctor/transcribe.js";
|
|
14
14
|
import { body, paint, section } from "../output.js";
|
|
15
15
|
import { walk, walkAll } from "./doctor.js";
|
|
16
16
|
/**
|
|
@@ -312,8 +312,10 @@ export async function takeCensus(root) {
|
|
|
312
312
|
const size = Object.keys(t.base).length +
|
|
313
313
|
Object.keys(t.dark).length +
|
|
314
314
|
Object.keys(t.states).length;
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
const tag = rootTag(src);
|
|
316
|
+
if (size > 0 || tag) {
|
|
317
|
+
looks[found[0].name] = tag ? { ...t, rootTag: tag } : t;
|
|
318
|
+
}
|
|
317
319
|
}
|
|
318
320
|
}
|
|
319
321
|
}
|
|
@@ -309,6 +309,25 @@ export function transcribe(classes, declared) {
|
|
|
309
309
|
* nothing, and nothing is a contract with an empty base - which is exactly what
|
|
310
310
|
* the import already produces, so failing here costs no ground.
|
|
311
311
|
*/
|
|
312
|
+
/**
|
|
313
|
+
* The TAG of the element a component returns - `button`, `input`, `div`.
|
|
314
|
+
*
|
|
315
|
+
* Cheap, and it is half of what decides a preview's anatomy: a component whose
|
|
316
|
+
* root is a `<button>` is an action however it is named, and one whose root is a
|
|
317
|
+
* bare `<span>` is an indicator. The platform pairs this with the name; see
|
|
318
|
+
* `preview-kind.ts`.
|
|
319
|
+
*
|
|
320
|
+
* A composed root (`<Radio.Root>`) returns the component name, not an HTML tag -
|
|
321
|
+
* which is still a signal, just a weaker one, so it travels as written and the
|
|
322
|
+
* platform decides what to do with it.
|
|
323
|
+
*/
|
|
324
|
+
export function rootTag(source) {
|
|
325
|
+
const ret = source.search(/return\s*\(/);
|
|
326
|
+
if (ret === -1)
|
|
327
|
+
return null;
|
|
328
|
+
const m = /<([A-Za-z][A-Za-z0-9.]*)/.exec(source.slice(ret));
|
|
329
|
+
return m ? m[1] : null;
|
|
330
|
+
}
|
|
312
331
|
export function rootClasses(source) {
|
|
313
332
|
const ret = source.search(/return\s*\(/);
|
|
314
333
|
if (ret === -1)
|
package/package.json
CHANGED