synthesisui 0.16.72 → 0.16.73

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.
@@ -11,7 +11,7 @@ import { describeConvention, describeRemainder, detectConventions, } from "../do
11
11
  import { diagnose, scanSource } from "../doctor/scan.js";
12
12
  import { parseSchemeBlocks } from "../doctor/scheme-blocks.js";
13
13
  import { buildTable } from "../doctor/tokens.js";
14
- import { rootClasses, rootTag, transcribe, } from "../doctor/transcribe.js";
14
+ import { rootClasses, rootTag, transcribe, transcribeParts, } from "../doctor/transcribe.js";
15
15
  import { body, paint, section } from "../output.js";
16
16
  import { walk, walkAll } from "./doctor.js";
17
17
  /**
@@ -958,6 +958,46 @@ function sayReach(c) {
958
958
  console.log(body(`Your neutrals only reach the ${has} end, so this system gets one scheme. A ${missing} mode would need surfaces you do not declare.`));
959
959
  }
960
960
  }
961
+ /**
962
+ * Fold the skill's named parts into the transcription, in place.
963
+ *
964
+ * Their declared tokens come from the census itself, so a run that only sends a
965
+ * file it was handed still resolves a `bg-ocean-500` by their own name.
966
+ */
967
+ function resolveReadParts(census) {
968
+ const read = census.reading?.components;
969
+ if (!read)
970
+ return;
971
+ const declared = new Map(Object.entries(census.declared));
972
+ const looks = census.looks ?? (census.looks = {});
973
+ let named = 0;
974
+ for (const [component, entry] of Object.entries(read)) {
975
+ const parts = entry?.parts;
976
+ if (!Array.isArray(parts) || parts.length === 0)
977
+ continue;
978
+ const resolved = transcribeParts(parts, declared);
979
+ if (Object.keys(resolved).length === 0)
980
+ continue;
981
+ const look = looks[component];
982
+ looks[component] = look
983
+ ? { ...look, parts: { ...(look.parts ?? {}), ...resolved } }
984
+ : {
985
+ base: {},
986
+ dark: {},
987
+ states: {},
988
+ skipped: [],
989
+ literals: [],
990
+ fromToken: 0,
991
+ fromLiteral: 0,
992
+ parts: resolved,
993
+ };
994
+ named += Object.keys(resolved).length;
995
+ }
996
+ if (named > 0) {
997
+ console.log("");
998
+ console.log(body(`${named} part${named === 1 ? "" : "s"} your reading named across ${Object.keys(read).length} component${Object.keys(read).length === 1 ? "" : "s"} - each previews as what it IS rather than as a text box`));
999
+ }
1000
+ }
961
1001
  export async function runImport(opts) {
962
1002
  const root = opts.root ?? process.cwd();
963
1003
  /**
@@ -993,6 +1033,18 @@ export async function runImport(opts) {
993
1033
  console.log(body("That file is not a census this version can send."));
994
1034
  return;
995
1035
  }
1036
+ /**
1037
+ * THE SKILL NAMED PARTS; THE CLI KNOWS WHAT THEIR CLASSES DO.
1038
+ *
1039
+ * A clean split of who knows what: only the skill can say that a span holds
1040
+ * the title, and only this side can say that `text-ocean-500` is
1041
+ * `{color.ocean.500}`. The platform then turns declarations into roles,
1042
+ * because only it has the two palettes.
1043
+ *
1044
+ * Resolved here rather than at measure time because the reading arrives
1045
+ * AFTER the census was taken - this is the first moment both halves exist.
1046
+ */
1047
+ resolveReadParts(census);
996
1048
  }
997
1049
  else {
998
1050
  console.log(section("Reading your project"));
@@ -365,3 +365,20 @@ export function rootClasses(source) {
365
365
  .flatMap((m) => m[1].split(/\s+/))
366
366
  .filter((c) => c.length > 0 && !c.includes("${"));
367
367
  }
368
+ /**
369
+ * Transcribe the parts a skill named, using the same reader the root used.
370
+ *
371
+ * `declared` comes from the census itself on the `--census` path, so a run that
372
+ * only sends a file it was handed still resolves their tokens by name.
373
+ */
374
+ export function transcribeParts(parts, declared) {
375
+ const out = {};
376
+ for (const part of parts) {
377
+ const name = part.name?.trim();
378
+ if (!name || typeof part.classes !== "string")
379
+ continue;
380
+ const t = transcribe(part.classes.split(/\s+/).filter(Boolean), declared);
381
+ out[name] = { base: t.base, dark: t.dark, states: t.states };
382
+ }
383
+ return out;
384
+ }
@@ -134,6 +134,15 @@ Open the project and answer the questions below. Then add a \`reading\` object t
134
134
  "roles": { "canvas": "#050505", "foreground": "#f9fafb", "primary": "#4A90E2" },
135
135
  "fonts": { "display": "Inter", "body": "Inter" },
136
136
  "concept": "one paragraph on what this product is",
137
+ "components": {
138
+ "MetricCard": {
139
+ "parts": [
140
+ { "name": "icon", "classes": "size-8 text-ocean-500" },
141
+ { "name": "label", "classes": "text-xs uppercase text-lightgray-500" },
142
+ { "name": "value", "classes": "text-2xl font-bold" }
143
+ ]
144
+ }
145
+ },
137
146
  "by": "claude"
138
147
  }
139
148
  \`\`\`
@@ -166,6 +175,34 @@ about which one is the page. Read a screen and see.
166
175
  **\`fonts\` and \`concept\`** - the voice, and one paragraph on what this product is. The concept
167
176
  feeds every recommendation downstream, so a real one beats a generic one by a wide margin.
168
177
 
178
+ **\`components[Name].parts\` - what each component is MADE OF.** This is the field that decides
179
+ whether a component previews as itself or as a grey box with a sentence in it, and only you can
180
+ fill it.
181
+
182
+ The census reads the ROOT element's classes and stops there, on purpose: descending a fixed
183
+ number of levels picks a layout wrapper as often as a semantic part. **You decide how far down a
184
+ part lives**, because you read the component. Send a name and the classes on it; the CLI turns
185
+ those classes into declarations and the platform turns declarations into roles.
186
+
187
+ **The name is load-bearing, not a label.** The renderer infers a part's role from it:
188
+
189
+ - \`root\`, \`wrapper\`, \`container\`, \`base\`, \`content\` - the element itself, and **skipped**. Do not
190
+ send these; their styles already sit on the component.
191
+ - anything matching \`icon\`, \`dot\`, \`indicator\`, \`bar\`, \`avatar\`, \`media\`, \`swatch\` - renders as a
192
+ bare span, sized and coloured by its own styles
193
+ - anything matching \`button\`, \`action\`, \`cta\` - renders as a real button carrying the label
194
+ - everything else - carries text
195
+
196
+ So a part named \`div2\` previews as a text node reading "Div2". Name what it IS: \`label\`, \`value\`,
197
+ \`delta\`, \`icon\`, \`action\`, \`title\`, \`meta\`.
198
+
199
+ Send them **in the order they appear**, because that is the order they render. Three or four
200
+ named parts is a recognisable component; twelve is a transcription of their DOM, and nobody
201
+ needs the layout divs.
202
+
203
+ If a component genuinely has no parts - a \`Divider\`, a \`Spinner\` - send none. An empty list is
204
+ a real answer.
205
+
169
206
  ### 3. Walk them through the decisions, one at a time
170
207
 
171
208
  Four decisions are theirs. **Ask them as separate questions with selectable options** - use your
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synthesisui",
3
- "version": "0.16.72",
3
+ "version": "0.16.73",
4
4
  "description": "Bring SynthesisUI design systems into any project - tokens, typed components, whole pages and an agent-ready CLAUDE.md manifest.",
5
5
  "type": "module",
6
6
  "bin": {