@promptui-lib/figma-parser 0.1.8 → 0.1.9
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semantic-detector.d.ts","sourceRoot":"","sources":["../../src/parser/semantic-detector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAmQrD;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAalD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,UAAU,EAChB,UAAU,CAAC,EAAE,UAAU,EACvB,KAAK,GAAE,MAAU,GAChB,MAAM,CAmKR;
|
|
1
|
+
{"version":3,"file":"semantic-detector.d.ts","sourceRoot":"","sources":["../../src/parser/semantic-detector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAmQrD;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAalD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,UAAU,EAChB,UAAU,CAAC,EAAE,UAAU,EACvB,KAAK,GAAE,MAAU,GAChB,MAAM,CAmKR;AA4JD;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,MAAM,GACrB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAkKxB"}
|
|
@@ -400,8 +400,15 @@ function detectTextTag(node, parentNode, normalizedName) {
|
|
|
400
400
|
if (SEMANTIC_PATTERNS.label.test(name)) {
|
|
401
401
|
return 'label';
|
|
402
402
|
}
|
|
403
|
-
// Links
|
|
403
|
+
// Links - mas não se o pai já é um link (evita <a> aninhado)
|
|
404
404
|
if (SEMANTIC_PATTERNS.link.test(name)) {
|
|
405
|
+
// Verifica se o pai já é um link
|
|
406
|
+
if (parentNode) {
|
|
407
|
+
const parentName = normalizeName(parentNode.name);
|
|
408
|
+
if (SEMANTIC_PATTERNS.link.test(parentName)) {
|
|
409
|
+
return 'span'; // Texto dentro de link vira span
|
|
410
|
+
}
|
|
411
|
+
}
|
|
405
412
|
return 'a';
|
|
406
413
|
}
|
|
407
414
|
// Citações
|
|
@@ -506,13 +513,11 @@ function hasInputChild(node) {
|
|
|
506
513
|
*/
|
|
507
514
|
export function getSemanticAttributes(node, tag, normalizedName) {
|
|
508
515
|
const attrs = {};
|
|
509
|
-
// Links -
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
// attrs['target'] = '_blank';
|
|
515
|
-
}
|
|
516
|
+
// Links - não adiciona href automático para evitar warnings de a11y
|
|
517
|
+
// O desenvolvedor deve preencher o href correto
|
|
518
|
+
// if (tag === 'a') {
|
|
519
|
+
// attrs['href'] = '#'; // Removido - causa warning jsx-a11y/anchor-is-valid
|
|
520
|
+
// }
|
|
516
521
|
// Inputs
|
|
517
522
|
if (tag === 'input') {
|
|
518
523
|
// Detecta tipo de input
|
|
@@ -13,6 +13,7 @@ export interface IStyleProperties {
|
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Parseia background color de um node
|
|
16
|
+
* NOTA: Para nós TEXT, o fills representa a cor do texto, não background
|
|
16
17
|
*/
|
|
17
18
|
export declare function parseBackgroundColor(node: IFigmaNode): IStyleProperty | null;
|
|
18
19
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-parser.d.ts","sourceRoot":"","sources":["../../src/parser/style-parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,UAAU,EAIV,cAAc,EACf,MAAM,oBAAoB,CAAC;AAS5B,MAAM,WAAW,gBAAgB;IAC/B,eAAe,CAAC,EAAE,cAAc,CAAC;IACjC,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B;AAWD
|
|
1
|
+
{"version":3,"file":"style-parser.d.ts","sourceRoot":"","sources":["../../src/parser/style-parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,UAAU,EAIV,cAAc,EACf,MAAM,oBAAoB,CAAC;AAS5B,MAAM,WAAW,gBAAgB;IAC/B,eAAe,CAAC,EAAE,cAAc,CAAC;IACjC,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B;AAWD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,GAAG,IAAI,CA2B5E;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,GAAG,IAAI,CAuBnE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,GAAG,IAAI,CAyBzE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,GAAG,IAAI,CAmCtE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,GAAG,IAAI,CASpE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,EAAE,CAmB9D"}
|
|
@@ -13,8 +13,13 @@ function extractSolidColor(fill) {
|
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Parseia background color de um node
|
|
16
|
+
* NOTA: Para nós TEXT, o fills representa a cor do texto, não background
|
|
16
17
|
*/
|
|
17
18
|
export function parseBackgroundColor(node) {
|
|
19
|
+
// Não aplicar background-color em nós TEXT (fills é a cor do texto)
|
|
20
|
+
if (node.type === 'TEXT') {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
18
23
|
if (!node.fills || node.fills.length === 0) {
|
|
19
24
|
return null;
|
|
20
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptui-lib/figma-parser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Figma API client and parser for PromptUI",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@promptui-lib/core": "0.1.
|
|
33
|
+
"@promptui-lib/core": "0.1.9"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^20.0.0",
|