synthesisui 0.16.334 → 0.16.336

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.
@@ -2220,12 +2220,47 @@ function ownReturn(source, declAt) {
2220
2220
  }
2221
2221
  return -1;
2222
2222
  }
2223
+ /**
2224
+ * A RAIZ POLIMÓRFICA RESOLVIDA PARA O ELEMENTO QUE ELA REALMENTE É (T21, dono, 26/08).
2225
+ *
2226
+ * O QUE O CLIENTE VIA: o blueprint do botão dele anunciando a raiz como `Tag` - o nome de uma
2227
+ * variável local que só existe dentro do arquivo dele, apresentado como se fosse um elemento. O
2228
+ * código é `const Tag = (as ?? "button") as ElementType`, e a raiz é um `<button>`.
2229
+ *
2230
+ * A LEI 13 pede a ORIGEM, e um identificador local não tem nenhuma: não há especificador de import
2231
+ * atrás de `Tag`. Onde o próprio arquivo declara o DEFAULT, ele é a origem - e lê-lo é derivar, não
2232
+ * supor.
2233
+ *
2234
+ * SÓ O QUE É DERIVÁVEL, e a fronteira é o literal. Medido nos dois repositórios vivos em 30/08:
2235
+ *
2236
+ * 4 declarações polimórficas no `codelevel`, 0 no `frontend-hub`
2237
+ * Button.tsx `const Tag = (as ?? "button") as ElementType` -> button
2238
+ * Card.tsx `const Tag = (as ?? "div") as ElementType` -> div
2239
+ * Typography `const Tag: ElementType = as ?? MAPA[variante]` -> fica `Tag`
2240
+ * SkillNode `const Icon = icon ?? MAPA[estado]` -> fica `Icon`
2241
+ *
2242
+ * As duas últimas definem a regra: o default vem de um mapa indexado em runtime, então não existe
2243
+ * UM elemento para resolver. Escolher um seria inventar a raiz do componente dele - e a raiz decide
2244
+ * a marcação que a gente devolve. Sem literal, o nome fica como está.
2245
+ *
2246
+ * (A primeira contagem deste dia disse TRÊS: a régua exigia o literal na mesma linha e não via o
2247
+ * `SkillNode`. Remedida com a régua larga, que é a que responde "quantos a forma alcança".)
2248
+ */
2249
+ const POLYMORPHIC_DEFAULT = /(?:const|let)\s+NAME\s*(?::[^=]*)?=\s*\(?\s*[A-Za-z_$][\w$]*\s*(?:\?\?|\|\|)\s*["']([a-z][a-z0-9-]*)["']/;
2223
2250
  export function rootTag(source, name) {
2224
2251
  const ret = returnAt(source, name);
2225
2252
  if (ret === -1)
2226
2253
  return null;
2227
2254
  const m = /<([A-Za-z][A-Za-z0-9.]*)/.exec(source.slice(ret));
2228
- return m ? m[1] : null;
2255
+ if (!m)
2256
+ return null;
2257
+ const tag = m[1];
2258
+ // Só um identificador local pode ser uma raiz polimórfica: uma tag HTML já é o elemento, e um
2259
+ // nome com ponto (`Tabs.Root`) é membro de um objeto importado, não uma variável com default.
2260
+ if (!/^[A-Z][A-Za-z0-9]*$/.test(tag))
2261
+ return tag;
2262
+ const declared = new RegExp(POLYMORPHIC_DEFAULT.source.replace("NAME", tag)).exec(source);
2263
+ return declared ? declared[1] : tag;
2229
2264
  }
2230
2265
  export function rootClasses(source, name) {
2231
2266
  const ret = returnAt(source, name);
@@ -198,10 +198,35 @@ const NON_RENDERING = new Set([
198
198
  */
199
199
  "root",
200
200
  ]);
201
- /** `BaseDialog.Portal` → true. `BaseSelect.Positioner` with `z-50 pt-1` → false. */
201
+ /**
202
+ * `BaseDialog.Portal` → true. `BaseSelect.Positioner` with `z-50 pt-1` → false.
203
+ *
204
+ * AND THE ROLE IS READ AT THE END OF THE NAME, not only as the whole of it. React's own
205
+ * vocabulary composes: a context provider is spelled `ThemeProvider`, `ConfigProvider`,
206
+ * `LocalizationProvider` - never the bare word - and every one of them renders no element
207
+ * at all. Reading only the exact word meant the list named the role and missed every
208
+ * component that carries it.
209
+ *
210
+ * Measured on the two populations before widening (29/08), and the class gate is what keeps
211
+ * it honest - it is still the fact that separates a role from a real box:
212
+ *
213
+ * frontend-hub 14 nodes end in `Provider`, and NONE of them carries a class
214
+ * 3 end in `Root` (`DialogRoot`, `RadioCardRoot`), none with classes
215
+ * codelevel-ui none of either
216
+ *
217
+ * A styled `Positioner` still survives as a real box, which is exactly what happens in
218
+ * their Select - the gate above reads the class list first and answers `false`.
219
+ */
202
220
  export function rendersNothing(tag, classes) {
203
221
  if (classes?.trim())
204
222
  return false;
205
- const member = tag.includes(".") ? tag.split(".").pop() : tag;
206
- return NON_RENDERING.has((member ?? "").toLowerCase());
223
+ const member = (tag.includes(".") ? tag.split(".").pop() : tag)?.toLowerCase();
224
+ if (!member)
225
+ return false;
226
+ if (NON_RENDERING.has(member))
227
+ return true;
228
+ for (const role of NON_RENDERING)
229
+ if (member.endsWith(role))
230
+ return true;
231
+ return false;
207
232
  }
@@ -361,13 +361,21 @@ export const CHECKER_SINCE = "0.16.308";
361
361
  * componentes que devolvem um Fragment recuperam as classes que hoje caem no vazio, e 386 de 386
362
362
  * looks legados leem exatamente como liam.
363
363
  *
364
+ * 0.16.334 -> 0.16.336 em 30/08 (T21-CLI): `rootTag` passou a resolver a raiz polimórfica para o
365
+ * elemento que ela é - `const Tag = (as ?? "button")` grava `button`, e não mais o nome da variável
366
+ * local. Um censo já gravado carrega `rootTag: "Tag"` e não há como derivar o elemento a partir
367
+ * dele: o default mora no CÓDIGO, que só a remedição lê. Por isso a marca sobe.
368
+ *
369
+ * Medido nos dois repositórios vivos: 4 declarações da forma no `codelevel` (2 resolvem para um
370
+ * elemento, 2 têm default vindo de um mapa em runtime e ficam com o nome), 0 no `frontend-hub`.
371
+ *
364
372
  * 0.16.328 -> 0.16.329 em 28/08: `rootClasses` passou a ler só o `className` do PRÓPRIO elemento.
365
373
  * Antes ele ancorava no primeiro `className=` do texto da tag de abertura, então a classe de um JSX
366
374
  * escrito dentro de uma prop virava classe da raiz - e o `className` da raiz, quando vinha depois,
367
375
  * nunca era alcançado. Medido: 1134 componentes, 77 mudaram, e a receita que o cliente recebe muda
368
376
  * com eles. Uma medição anterior não produz o conserto, então a marca sobe.
369
377
  */
370
- export const READER_SINCE = "0.16.334";
378
+ export const READER_SINCE = "0.16.336";
371
379
  /**
372
380
  * O QUE ESTÁ INSTALADO AQUI FICOU PARA TRÁS - e as DUAS condições que fazem isso ser verdade.
373
381
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synthesisui",
3
- "version": "0.16.334",
3
+ "version": "0.16.336",
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": {