@deneb-ui/cli 2.0.22 → 2.0.24
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/README.md +62 -114
- package/bin/index.js +55 -12
- package/package.json +25 -5
- package/src/arc/__fixtures__/next-app-basic/package.json +10 -0
- package/src/arc/__fixtures__/next-app-basic/src/app/globals.css +3 -0
- package/src/arc/__fixtures__/next-app-basic/src/app/layout.tsx +9 -0
- package/src/arc/__fixtures__/next-app-basic/src/app/page.tsx +11 -0
- package/src/arc/__fixtures__/next-app-basic/src/components/Header.tsx +13 -0
- package/src/arc/__fixtures__/next-app-basic/src/components/Hero.tsx +12 -0
- package/src/arc/__fixtures__/next-app-basic/src/components/PromoBanner.tsx +10 -0
- package/src/arc/__fixtures__/next-app-basic/tsconfig.json +12 -0
- package/src/arc/__fixtures__/next-app-storefront/components.json +14 -0
- package/src/arc/__fixtures__/next-app-storefront/package.json +22 -0
- package/src/arc/__fixtures__/next-app-storefront/src/app/about/page.tsx +13 -0
- package/src/arc/__fixtures__/next-app-storefront/src/app/globals.css +5 -0
- package/src/arc/__fixtures__/next-app-storefront/src/app/layout.tsx +19 -0
- package/src/arc/__fixtures__/next-app-storefront/src/app/page.tsx +13 -0
- package/src/arc/__fixtures__/next-app-storefront/src/components/Features.tsx +31 -0
- package/src/arc/__fixtures__/next-app-storefront/src/components/Hero.tsx +45 -0
- package/src/arc/__fixtures__/next-app-storefront/src/components/ProductGrid.tsx +49 -0
- package/src/arc/__fixtures__/next-app-storefront/src/components/SiteFooter.tsx +22 -0
- package/src/arc/__fixtures__/next-app-storefront/src/components/SiteHeader.tsx +21 -0
- package/src/arc/__fixtures__/next-app-storefront/src/components/ui/button.tsx +36 -0
- package/src/arc/__fixtures__/next-app-storefront/tsconfig.json +15 -0
- package/src/arc/__fixtures__/next-pages-basic/package.json +10 -0
- package/src/arc/__fixtures__/next-pages-basic/pages/_app.jsx +5 -0
- package/src/arc/__fixtures__/next-pages-basic/pages/contact.jsx +9 -0
- package/src/arc/__fixtures__/next-pages-basic/pages/index.jsx +11 -0
- package/src/arc/__fixtures__/next-pages-basic/styles/globals.css +9 -0
- package/src/arc/__tests__/arc.test.cjs +498 -0
- package/src/arc/adapters.cjs +184 -0
- package/src/arc/ast.cjs +339 -0
- package/src/arc/field-paths.cjs +165 -0
- package/src/arc/fivora-contract.cjs +521 -0
- package/src/arc/font-plan.cjs +65 -0
- package/src/arc/fs-utils.cjs +170 -0
- package/src/arc/index.cjs +627 -0
- package/src/arc/learning.cjs +211 -0
- package/src/arc/manifest.cjs +438 -0
- package/src/arc/next-config.cjs +279 -0
- package/src/arc/planner.cjs +252 -0
- package/src/arc/printer.cjs +183 -0
- package/src/arc/recipes-v2.cjs +49 -0
- package/src/arc/scanner.cjs +613 -0
- package/src/arc/semantic.cjs +651 -0
- package/src/arc/style-candidates.cjs +72 -0
- package/src/arc/transformer.cjs +677 -0
- package/src/arc/validator.cjs +173 -0
- package/src/arc/version.cjs +22 -0
- package/src/common/style-validation.ts +30 -0
- package/src/tools/deneb-fonts.cjs +114 -0
- package/src/tools/template-preview-focus-bridge.cjs +3 -3
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const TEXT_OPS = new Set(['extract-text', 'wrap-text-span']);
|
|
4
|
+
const BUTTON_TAGS = new Set(['button', 'Button', 'CTAButton']);
|
|
5
|
+
|
|
6
|
+
function inferStyleKind(transform) {
|
|
7
|
+
if (transform.operation === 'collection-conversion') return 'grid';
|
|
8
|
+
if (transform.operation === 'split-action-contract') return 'text';
|
|
9
|
+
if (BUTTON_TAGS.has(transform.tag) && transform.operation === 'extract-text') return 'button';
|
|
10
|
+
if (TEXT_OPS.has(transform.operation)) return 'text';
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function stylePathFor(transform, kind) {
|
|
15
|
+
if (kind === 'grid' && transform.listField) return `${transform.listField}.grid`;
|
|
16
|
+
if (kind === 'card' && transform.listField) return `${transform.listField}[*].card`;
|
|
17
|
+
if (transform.operation === 'split-action-contract') return transform.labelField;
|
|
18
|
+
return transform.field || transform.labelField || null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Adds explainable style-bind operations next to content transforms so
|
|
23
|
+
* developers see why Fivora can restyle a node without CSS rewrites.
|
|
24
|
+
*/
|
|
25
|
+
function appendStyleBindTransforms(filePlans) {
|
|
26
|
+
for (const file of filePlans || []) {
|
|
27
|
+
const extra = [];
|
|
28
|
+
for (const transform of file.transformations || []) {
|
|
29
|
+
if (transform.operation === 'style-bind') continue;
|
|
30
|
+
if (transform.operation === 'wrap-text-span') continue;
|
|
31
|
+
if (transform.operation === 'collection-conversion' && transform.listField) {
|
|
32
|
+
extra.push(makeStyleBind(transform, `${transform.listField}.grid`, 'grid'));
|
|
33
|
+
extra.push(makeStyleBind(transform, `${transform.listField}[*].card`, 'card'));
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
const kind = inferStyleKind(transform);
|
|
37
|
+
const stylePath = stylePathFor(transform, kind);
|
|
38
|
+
if (!kind || !stylePath) continue;
|
|
39
|
+
extra.push(makeStyleBind(transform, stylePath, kind));
|
|
40
|
+
}
|
|
41
|
+
file.transformations = [...(file.transformations || []), ...extra];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function makeStyleBind(transform, stylePath, kind) {
|
|
46
|
+
return {
|
|
47
|
+
loc: transform.loc,
|
|
48
|
+
operation: 'style-bind',
|
|
49
|
+
tag: transform.tag,
|
|
50
|
+
file: transform.file,
|
|
51
|
+
confidence: Math.min(0.99, (transform.confidence || 0.9) - 0.02),
|
|
52
|
+
decision: transform.decision === 'skip' ? 'skip' : 'auto',
|
|
53
|
+
reason: `Bind Fivora style contract (${kind}) without rewriting CSS`,
|
|
54
|
+
field: transform.field,
|
|
55
|
+
stylePath,
|
|
56
|
+
styleKind: kind,
|
|
57
|
+
fingerprint: transform.fingerprint,
|
|
58
|
+
recipeId: transform.recipeId || null,
|
|
59
|
+
explain: {
|
|
60
|
+
detected: `${transform.tag} style-${kind}`,
|
|
61
|
+
why: 'Fivora visual editor patches --deneb-* CSS variables via FIVORA_PREVIEW_STYLE_PATCH',
|
|
62
|
+
recipe: transform.recipeId || null,
|
|
63
|
+
confidence: transform.confidence,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
module.exports = {
|
|
69
|
+
appendStyleBindTransforms,
|
|
70
|
+
inferStyleKind,
|
|
71
|
+
stylePathFor,
|
|
72
|
+
};
|