inkbridge 0.1.0-beta.1
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 +201 -0
- package/bin/inkhouse.mjs +171 -0
- package/code.js +11802 -0
- package/manifest.json +30 -0
- package/package.json +45 -0
- package/scanner/blob-placement-regression.ts +132 -0
- package/scanner/class-collector.ts +69 -0
- package/scanner/cli.ts +336 -0
- package/scanner/component-scanner.ts +2876 -0
- package/scanner/css-patch-regression.ts +112 -0
- package/scanner/css-token-reader-regression.ts +92 -0
- package/scanner/css-token-reader.ts +477 -0
- package/scanner/font-style-resolver-regression.ts +32 -0
- package/scanner/index.ts +9 -0
- package/scanner/radial-gradient-regression.ts +53 -0
- package/scanner/style-map.ts +149 -0
- package/scanner/tailwind-parser.ts +644 -0
- package/scanner/transform-math-regression.ts +42 -0
- package/scanner/types.ts +298 -0
- package/src/blob-placement.ts +111 -0
- package/src/change-detection.ts +204 -0
- package/src/class-utils.ts +105 -0
- package/src/clip-path-decorative.ts +194 -0
- package/src/color-resolver.ts +98 -0
- package/src/colors.ts +196 -0
- package/src/component-defs.ts +54 -0
- package/src/component-gen.ts +561 -0
- package/src/component-lookup.ts +82 -0
- package/src/config.ts +115 -0
- package/src/design-system.ts +59 -0
- package/src/dev-server.ts +173 -0
- package/src/figma-globals.d.ts +3 -0
- package/src/font-style-resolver.ts +171 -0
- package/src/github.ts +1465 -0
- package/src/icon-builder.ts +607 -0
- package/src/image-cache.ts +22 -0
- package/src/inline-text.ts +271 -0
- package/src/layout-parser.ts +667 -0
- package/src/layout-utils.ts +155 -0
- package/src/main.ts +687 -0
- package/src/node-ir.ts +595 -0
- package/src/pack-provider.ts +148 -0
- package/src/packs.ts +126 -0
- package/src/radial-gradient.ts +84 -0
- package/src/render-context.ts +138 -0
- package/src/responsive-analyzer.ts +139 -0
- package/src/state-analyzer.ts +143 -0
- package/src/story-builder.ts +1706 -0
- package/src/story-layout.ts +38 -0
- package/src/tailwind.ts +2379 -0
- package/src/text-builder.ts +116 -0
- package/src/text-line.ts +42 -0
- package/src/token-source.ts +43 -0
- package/src/tokens.ts +717 -0
- package/src/transform-math.ts +44 -0
- package/src/ui-builder.ts +1996 -0
- package/src/utility-resolver.ts +125 -0
- package/src/variables.ts +1042 -0
- package/src/width-solver.ts +466 -0
- package/templates/patch-tokens-route.ts +165 -0
- package/templates/scan-components-route.ts +57 -0
- package/ui.html +1222 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type Transform2x3 = [[number, number, number], [number, number, number]];
|
|
2
|
+
|
|
3
|
+
export function rotationTransformAroundPointRadians(
|
|
4
|
+
angleRadians: number,
|
|
5
|
+
pointX: number,
|
|
6
|
+
pointY: number,
|
|
7
|
+
): Transform2x3 {
|
|
8
|
+
const cosA = Math.cos(angleRadians);
|
|
9
|
+
const sinA = Math.sin(angleRadians);
|
|
10
|
+
const tx = pointX - (cosA * pointX) + (sinA * pointY);
|
|
11
|
+
const ty = pointY - (sinA * pointX) - (cosA * pointY);
|
|
12
|
+
return [
|
|
13
|
+
[cosA, -sinA, tx],
|
|
14
|
+
[sinA, cosA, ty],
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function rotationTransformAroundPointDegrees(
|
|
19
|
+
angleDegrees: number,
|
|
20
|
+
pointX: number,
|
|
21
|
+
pointY: number,
|
|
22
|
+
): Transform2x3 {
|
|
23
|
+
return rotationTransformAroundPointRadians((angleDegrees * Math.PI) / 180, pointX, pointY);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function centerPlacedRotationTransform(
|
|
27
|
+
width: number,
|
|
28
|
+
height: number,
|
|
29
|
+
centerX: number,
|
|
30
|
+
centerY: number,
|
|
31
|
+
rotationDegrees: number,
|
|
32
|
+
): Transform2x3 {
|
|
33
|
+
const localCx = width / 2;
|
|
34
|
+
const localCy = height / 2;
|
|
35
|
+
const base = rotationTransformAroundPointDegrees(rotationDegrees, localCx, localCy);
|
|
36
|
+
const rotateTx = base[0][2];
|
|
37
|
+
const rotateTy = base[1][2];
|
|
38
|
+
const tx = centerX - localCx + rotateTx;
|
|
39
|
+
const ty = centerY - localCy + rotateTy;
|
|
40
|
+
return [
|
|
41
|
+
[base[0][0], base[0][1], tx],
|
|
42
|
+
[base[1][0], base[1][1], ty],
|
|
43
|
+
];
|
|
44
|
+
}
|