inkbridge 0.1.0-beta.2 → 0.1.0-beta.21
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 +108 -25
- package/bin/inkbridge.mjs +354 -83
- package/code.js +40 -11802
- package/manifest.json +1 -0
- package/package.json +74 -23
- package/scanner/adapter-utils-regression.ts +159 -0
- package/scanner/aspect-percent-position-regression.ts +237 -0
- package/scanner/aspect-ratio-regression.ts +90 -0
- package/scanner/blob-placement-regression.ts +2 -2
- package/scanner/block-cache-regression.ts +195 -0
- package/scanner/bundle-size-regression.ts +50 -0
- package/scanner/child-sizing-matrix-regression.ts +303 -0
- package/scanner/cli.ts +342 -13
- package/scanner/component-scanner.ts +2108 -174
- package/scanner/component-sections-regression.ts +198 -0
- package/scanner/compound-classes-lookup-regression.ts +163 -0
- package/scanner/css-token-reader-regression.ts +7 -6
- package/scanner/css-token-reader.ts +152 -31
- package/scanner/cva-jsx-child-fallback-regression.ts +98 -0
- package/scanner/cva-master-icon-regression.ts +315 -0
- package/scanner/data-attr-prop-alias-regression.ts +129 -0
- package/scanner/explicit-size-root-regression.ts +102 -0
- package/scanner/font-family-extract-regression.ts +113 -0
- package/scanner/font-style-resolver-regression.ts +1 -1
- package/scanner/framework-adapter-shadcn-regression.ts +480 -0
- package/scanner/full-width-matrix-regression.ts +338 -0
- package/scanner/grid-cols-extraction-regression.ts +110 -0
- package/scanner/image-src-collector-regression.ts +204 -0
- package/scanner/inline-flex-regression.ts +235 -0
- package/scanner/input-range-regression.ts +217 -0
- package/scanner/instance-rendering-regression.ts +224 -0
- package/scanner/jsx-prop-unresolved-regression.ts +178 -0
- package/scanner/jsx-text-regression.ts +178 -0
- package/scanner/layout-alignment-regression.ts +108 -0
- package/scanner/layout-flex-regression.ts +90 -0
- package/scanner/layout-mode-regression.ts +71 -0
- package/scanner/layout-sizing-regression.ts +227 -0
- package/scanner/layout-spacing-regression.ts +135 -0
- package/scanner/local-const-className-regression.ts +331 -0
- package/scanner/percent-position-regression.ts +105 -0
- package/scanner/provider-cascade-regression.ts +224 -0
- package/scanner/provider-flatten-regression.ts +235 -0
- package/scanner/radial-gradient-regression.ts +1 -1
- package/scanner/render-prop-parser-regression.ts +161 -0
- package/scanner/ring-utility-regression.ts +153 -0
- package/scanner/sandbox-spread-regression.ts +125 -0
- package/scanner/selection-pressed-regression.ts +241 -0
- package/scanner/size-full-normalization-regression.ts +127 -0
- package/scanner/state-classification-regression.ts +175 -0
- package/scanner/story-diagnostics-regression.ts +216 -0
- package/scanner/story-dimensioning-regression.ts +298 -0
- package/scanner/story-render-strategy-regression.ts +205 -0
- package/scanner/stretch-to-parent-width-regression.ts +147 -0
- package/scanner/svg-fill-parent-regression.ts +98 -0
- package/scanner/svg-group-inheritance-regression.ts +166 -0
- package/scanner/svg-marker-inline-regression.ts +211 -0
- package/scanner/svg-marker-regression.ts +116 -0
- package/scanner/tailwind-parser.ts +46 -4
- package/scanner/text-resize-matrix-regression.ts +173 -0
- package/scanner/transform-math-regression.ts +1 -1
- package/scanner/types.ts +26 -2
- package/src/cache/frame-cache.ts +150 -0
- package/src/cache/index.ts +2 -0
- package/src/{component-defs.ts → components/component-defs.ts} +25 -10
- package/src/{component-gen.ts → components/component-gen.ts} +43 -116
- package/src/components/component-instance.ts +386 -0
- package/src/components/component-library.ts +44 -0
- package/src/components/component-lookup.ts +161 -0
- package/src/components/index.ts +7 -0
- package/src/components/scanner-types.ts +39 -0
- package/src/components/symbol-instance-policy.ts +312 -0
- package/src/design-system/block-cache.ts +130 -0
- package/src/design-system/component-sections.ts +107 -0
- package/src/design-system/cva-inference.ts +187 -0
- package/src/design-system/cva-master.ts +427 -0
- package/src/design-system/cva-utils.ts +29 -0
- package/src/design-system/design-system.ts +334 -0
- package/src/design-system/frame-stabilizers.ts +191 -0
- package/src/design-system/frame-utils.ts +46 -0
- package/src/design-system/generated-node.ts +84 -0
- package/src/design-system/icon-rendering.ts +229 -0
- package/src/design-system/index.ts +13 -0
- package/src/design-system/instance-rendering.ts +307 -0
- package/src/design-system/master-shared.ts +133 -0
- package/src/design-system/node-helpers.ts +237 -0
- package/src/design-system/node-variants.ts +196 -0
- package/src/design-system/non-cva-master.ts +104 -0
- package/src/design-system/portal-handling.ts +138 -0
- package/src/design-system/preview-builder.ts +738 -0
- package/src/{render-context.ts → design-system/render-context.ts} +32 -6
- package/src/design-system/render-prop-parser.ts +50 -0
- package/src/design-system/responsive-resolver.ts +180 -0
- package/src/design-system/selectable-state.ts +157 -0
- package/src/design-system/state-master.ts +267 -0
- package/src/design-system/state-utils.ts +15 -0
- package/src/design-system/story-builder-context.ts +40 -0
- package/src/design-system/story-builder.ts +1322 -0
- package/src/design-system/story-diagnostics.ts +80 -0
- package/src/design-system/story-dimensioning.ts +272 -0
- package/src/design-system/story-frames.ts +400 -0
- package/src/design-system/story-instance.ts +333 -0
- package/src/{story-layout.ts → design-system/story-layout.ts} +2 -2
- package/src/design-system/story-render-strategy.ts +150 -0
- package/src/design-system/story-tree-search.ts +110 -0
- package/src/design-system/symbol-fallback.ts +89 -0
- package/src/design-system/symbol-source.ts +172 -0
- package/src/design-system/table-helpers.ts +56 -0
- package/src/design-system/tag-predicates.ts +99 -0
- package/src/design-system/theme-context.ts +52 -0
- package/src/design-system/typography.ts +100 -0
- package/src/design-system/ui-builder.ts +2676 -0
- package/src/{clip-path-decorative.ts → effects/clip-path-decorative.ts} +11 -11
- package/src/effects/icon-builder.ts +1074 -0
- package/src/effects/index.ts +5 -0
- package/src/effects/portal-panel.ts +369 -0
- package/src/{radial-gradient.ts → effects/radial-gradient.ts} +1 -1
- package/src/framework-adapters/index.ts +47 -0
- package/src/framework-adapters/shadcn.ts +541 -0
- package/src/{github.ts → github/github.ts} +46 -21
- package/src/github/index.ts +1 -0
- package/src/layout/deferred-layout.ts +1556 -0
- package/src/layout/index.ts +24 -0
- package/src/layout/layout-parser.ts +375 -0
- package/src/{layout-utils.ts → layout/layout-utils.ts} +23 -17
- package/src/layout/parser/alignment.ts +54 -0
- package/src/layout/parser/flex.ts +59 -0
- package/src/layout/parser/index.ts +65 -0
- package/src/layout/parser/ir.ts +80 -0
- package/src/layout/parser/layout-mode.ts +57 -0
- package/src/layout/parser/sizing.ts +241 -0
- package/src/layout/parser/spacing-scale.ts +78 -0
- package/src/layout/parser/spacing.ts +134 -0
- package/src/layout/ring-utils.ts +120 -0
- package/src/layout/size-utils.ts +143 -0
- package/src/layout/text-resize-decision.ts +51 -0
- package/src/{width-solver.ts → layout/width-solver.ts} +168 -37
- package/src/main.ts +444 -162
- package/src/{config.ts → plugin/config.ts} +12 -12
- package/src/{dev-server.ts → plugin/dev-server.ts} +3 -3
- package/src/plugin/image-src-collector.ts +52 -0
- package/src/plugin/index.ts +3 -0
- package/src/plugin/packs/index.ts +2 -0
- package/src/{pack-provider.ts → plugin/packs/pack-provider.ts} +12 -12
- package/src/{packs.ts → plugin/packs/packs.ts} +22 -17
- package/src/render-engine-version.ts +2 -0
- package/src/tailwind/adapter-utils.ts +137 -0
- package/src/{class-utils.ts → tailwind/class-utils.ts} +33 -6
- package/src/tailwind/index.ts +8 -0
- package/src/tailwind/jsx-utils.ts +319 -0
- package/src/{node-ir.ts → tailwind/node-ir.ts} +208 -19
- package/src/{responsive-analyzer.ts → tailwind/responsive-analyzer.ts} +32 -2
- package/src/{state-analyzer.ts → tailwind/state-analyzer.ts} +71 -5
- package/src/{tailwind.ts → tailwind/tailwind.ts} +423 -674
- package/src/{utility-resolver.ts → tailwind/utility-resolver.ts} +27 -6
- package/src/{font-style-resolver.ts → text/font-style-resolver.ts} +0 -2
- package/src/text/index.ts +4 -0
- package/src/{inline-text.ts → text/inline-text.ts} +13 -13
- package/src/{text-builder.ts → text/text-builder.ts} +24 -7
- package/src/{text-line.ts → text/text-line.ts} +2 -2
- package/src/{change-detection.ts → tokens/change-detection.ts} +12 -12
- package/src/{color-resolver.ts → tokens/color-resolver.ts} +1 -6
- package/src/{colors.ts → tokens/colors.ts} +13 -6
- package/src/tokens/index.ts +6 -0
- package/src/{token-source.ts → tokens/token-source.ts} +4 -1
- package/src/{tokens.ts → tokens/tokens.ts} +116 -20
- package/src/{variables.ts → tokens/variables.ts} +447 -102
- package/templates/patch-tokens-route.ts +25 -6
- package/templates/scan-components-route.ts +26 -5
- package/ui.html +485 -37
- package/src/component-lookup.ts +0 -82
- package/src/design-system.ts +0 -59
- package/src/icon-builder.ts +0 -607
- package/src/layout-parser.ts +0 -667
- package/src/story-builder.ts +0 -1706
- package/src/ui-builder.ts +0 -1996
- /package/src/{image-cache.ts → cache/image-cache.ts} +0 -0
- /package/src/{blob-placement.ts → effects/blob-placement.ts} +0 -0
- /package/src/{transform-math.ts → tailwind/transform-math.ts} +0 -0
package/src/component-lookup.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { COMPONENT_DEFS } from './tokens';
|
|
2
|
-
|
|
3
|
-
export type IconRegistryEntry = {
|
|
4
|
-
module: string;
|
|
5
|
-
exportName: string;
|
|
6
|
-
svg: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const REACT_ICON_MAP: Record<string, string> = {
|
|
10
|
-
HiOutlineHome: 'home',
|
|
11
|
-
HiHome: 'home',
|
|
12
|
-
RiTableView: 'portfolio',
|
|
13
|
-
HiMiniSquares2x2: 'portfolio',
|
|
14
|
-
RiCompass3Line: 'strategy',
|
|
15
|
-
RiWallet2Fill: 'pda',
|
|
16
|
-
RiAccountBoxLine: 'account',
|
|
17
|
-
HiLogout: 'logout',
|
|
18
|
-
RiLogoutBoxLine: 'logout',
|
|
19
|
-
HiMenu: 'menu',
|
|
20
|
-
HiX: 'close',
|
|
21
|
-
HiCheck: 'check',
|
|
22
|
-
ChevronDown: 'chevron-down',
|
|
23
|
-
ChevronDownIcon: 'chevron-down',
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
let COMPONENT_DEF_MAP: Record<string, any> | null = null;
|
|
27
|
-
let ICON_REGISTRY_MAP: Record<string, IconRegistryEntry> | null = null;
|
|
28
|
-
|
|
29
|
-
export function getComponentDefByName(name: string): any | null {
|
|
30
|
-
const defName = String(name || '').toLowerCase();
|
|
31
|
-
if (!COMPONENT_DEF_MAP) {
|
|
32
|
-
COMPONENT_DEF_MAP = {};
|
|
33
|
-
const defsArray = (COMPONENT_DEFS && COMPONENT_DEFS.components) ? COMPONENT_DEFS.components : [];
|
|
34
|
-
for (let i = 0; i < defsArray.length; i++) {
|
|
35
|
-
const d = defsArray[i];
|
|
36
|
-
const analysis = d.analysis || d;
|
|
37
|
-
if (!analysis || !analysis.name) continue;
|
|
38
|
-
const key = String(analysis.name).toLowerCase();
|
|
39
|
-
if (!COMPONENT_DEF_MAP[key]) {
|
|
40
|
-
COMPONENT_DEF_MAP[key] = d;
|
|
41
|
-
}
|
|
42
|
-
// Also index under dash-stripped key so PascalCase JSX refs (e.g. "HeroSection")
|
|
43
|
-
// resolve to kebab-case scanner names (e.g. "Hero-section" → "herosection").
|
|
44
|
-
const dashlessKey = key.replace(/-/g, '');
|
|
45
|
-
if (dashlessKey !== key && !COMPONENT_DEF_MAP[dashlessKey]) {
|
|
46
|
-
COMPONENT_DEF_MAP[dashlessKey] = d;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return COMPONENT_DEF_MAP[defName] || null;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function getIconRegistry(): Record<string, IconRegistryEntry> {
|
|
54
|
-
if (ICON_REGISTRY_MAP) return ICON_REGISTRY_MAP;
|
|
55
|
-
const registry = (COMPONENT_DEFS && COMPONENT_DEFS.iconRegistry) ? COMPONENT_DEFS.iconRegistry : {};
|
|
56
|
-
ICON_REGISTRY_MAP = {};
|
|
57
|
-
for (const key in registry) {
|
|
58
|
-
ICON_REGISTRY_MAP[key] = registry[key];
|
|
59
|
-
}
|
|
60
|
-
return ICON_REGISTRY_MAP;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export function getIconRegistryEntry(name: string): IconRegistryEntry | null {
|
|
64
|
-
if (!name) return null;
|
|
65
|
-
const registry = getIconRegistry();
|
|
66
|
-
if (registry[name]) return registry[name];
|
|
67
|
-
const target = name.toLowerCase();
|
|
68
|
-
for (const key in registry) {
|
|
69
|
-
if (key.toLowerCase() === target) return registry[key];
|
|
70
|
-
}
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function getReactIconKey(name: string): string | null {
|
|
75
|
-
if (!name) return null;
|
|
76
|
-
if (REACT_ICON_MAP[name]) return REACT_ICON_MAP[name];
|
|
77
|
-
const target = name.toLowerCase();
|
|
78
|
-
for (const key in REACT_ICON_MAP) {
|
|
79
|
-
if (key.toLowerCase() === target) return REACT_ICON_MAP[key];
|
|
80
|
-
}
|
|
81
|
-
return null;
|
|
82
|
-
}
|
package/src/design-system.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// Design System Page Generation
|
|
2
|
-
// Orchestrates building the full design system preview page in Figma.
|
|
3
|
-
|
|
4
|
-
import { debug } from './colors';
|
|
5
|
-
import { getThemeNames, TOKENS } from './tokens';
|
|
6
|
-
import { demoFrameColors, demoFrameRadii } from './variables';
|
|
7
|
-
import { createUIComponents } from './ui-builder';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Build a single "Design System" page containing tokens preview and all UI components.
|
|
11
|
-
* Clears any existing content on the page before rebuilding.
|
|
12
|
-
*/
|
|
13
|
-
export function buildDesignSystemSinglePage(): void {
|
|
14
|
-
let ds: any = (figma.root as any).children.find((p: any) => p.name === 'Design System');
|
|
15
|
-
if (!ds) { ds = figma.createPage(); ds.name = 'Design System'; }
|
|
16
|
-
figma.currentPage = ds;
|
|
17
|
-
const nodes = Array.from(ds.children || []);
|
|
18
|
-
for (const n of nodes as any[]) n.remove();
|
|
19
|
-
|
|
20
|
-
const tokensRow = figma.createFrame();
|
|
21
|
-
tokensRow.name = 'Design Tokens';
|
|
22
|
-
tokensRow.layoutMode = 'HORIZONTAL';
|
|
23
|
-
tokensRow.primaryAxisSizingMode = 'AUTO';
|
|
24
|
-
tokensRow.counterAxisSizingMode = 'AUTO';
|
|
25
|
-
tokensRow.itemSpacing = 32;
|
|
26
|
-
tokensRow.paddingLeft = tokensRow.paddingRight = 32;
|
|
27
|
-
tokensRow.paddingTop = tokensRow.paddingBottom = 24;
|
|
28
|
-
tokensRow.fills = [];
|
|
29
|
-
tokensRow.strokes = [];
|
|
30
|
-
const themeNames = getThemeNames(TOKENS);
|
|
31
|
-
for (const themeName of themeNames) {
|
|
32
|
-
tokensRow.appendChild(demoFrameColors(themeName));
|
|
33
|
-
}
|
|
34
|
-
tokensRow.appendChild(demoFrameRadii());
|
|
35
|
-
tokensRow.x = 48;
|
|
36
|
-
tokensRow.y = 48;
|
|
37
|
-
ds.appendChild(tokensRow);
|
|
38
|
-
debug('Tokens row', { columns: tokensRow.children.length, height: tokensRow.height });
|
|
39
|
-
|
|
40
|
-
// Scanner names components after their file (capitalised, dashes kept): gradient-showcase.tsx → 'Gradient-showcase'
|
|
41
|
-
const EFFECTS_COMPONENTS = ['Gradient-showcase'];
|
|
42
|
-
|
|
43
|
-
const offset = tokensRow.y + tokensRow.height + 80;
|
|
44
|
-
const uiSection = createUIComponents(ds, {
|
|
45
|
-
themeNames,
|
|
46
|
-
yOffset: offset,
|
|
47
|
-
xOffset: 48,
|
|
48
|
-
excludeComponents: EFFECTS_COMPONENTS,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
const effectsOffset = offset + (uiSection ? uiSection.height : 0) + 80;
|
|
52
|
-
createUIComponents(ds, {
|
|
53
|
-
themeNames,
|
|
54
|
-
yOffset: effectsOffset,
|
|
55
|
-
xOffset: 48,
|
|
56
|
-
sectionTitle: 'Effects',
|
|
57
|
-
onlyComponents: EFFECTS_COMPONENTS,
|
|
58
|
-
});
|
|
59
|
-
}
|