react-native-gtkx 0.1.0-alpha.3 → 0.2.0-alpha.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 +41 -3
- package/dist/adw/index.d.ts +3 -0
- package/dist/adw/index.js +41 -0
- package/dist/adw/index.js.map +1 -0
- package/dist/adw/widgets.generated.d.ts +63 -0
- package/dist/adw/widgets.generated.js +125 -0
- package/dist/adw/widgets.generated.js.map +1 -0
- package/dist/animated/create-animated.js +1 -1
- package/dist/animated/create-animated.js.map +1 -1
- package/dist/animated/index.js +3 -3
- package/dist/animated/index.js.map +1 -1
- package/dist/common/content.d.ts +69 -0
- package/dist/common/content.js +84 -0
- package/dist/common/content.js.map +1 -0
- package/dist/common/index.d.ts +3 -0
- package/dist/common/index.js +19 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/navigation-stack.d.ts +84 -0
- package/dist/common/navigation-stack.js +313 -0
- package/dist/common/navigation-stack.js.map +1 -0
- package/dist/common/widget.d.ts +83 -0
- package/dist/common/widget.js +142 -0
- package/dist/common/widget.js.map +1 -0
- package/dist/components/animated.d.ts +3 -2
- package/dist/components/animated.js +85 -66
- package/dist/components/animated.js.map +1 -1
- package/dist/components/app-registry.d.ts +10 -1
- package/dist/components/app-registry.js +8 -3
- package/dist/components/app-registry.js.map +1 -1
- package/dist/components/pressable.js +109 -16
- package/dist/components/pressable.js.map +1 -1
- package/dist/components/rect-store.d.ts +11 -1
- package/dist/components/rect-store.js +27 -3
- package/dist/components/rect-store.js.map +1 -1
- package/dist/components/svg/animated-support.d.ts +19 -0
- package/dist/components/svg/animated-support.js +64 -0
- package/dist/components/svg/animated-support.js.map +1 -0
- package/dist/components/svg/context.d.ts +8 -0
- package/dist/components/svg/context.js +15 -0
- package/dist/components/svg/context.js.map +1 -0
- package/dist/components/svg/gradients.d.ts +31 -0
- package/dist/components/svg/gradients.js +93 -0
- package/dist/components/svg/gradients.js.map +1 -0
- package/dist/components/svg/group.d.ts +8 -0
- package/dist/components/svg/group.js +30 -0
- package/dist/components/svg/group.js.map +1 -0
- package/dist/components/svg/index.d.ts +6 -0
- package/dist/components/svg/index.js +5 -0
- package/dist/components/svg/index.js.map +1 -0
- package/dist/components/svg/node.d.ts +7 -0
- package/dist/components/svg/node.js +7 -0
- package/dist/components/svg/node.js.map +1 -0
- package/dist/components/svg/paint.d.ts +24 -0
- package/dist/components/svg/paint.js +57 -0
- package/dist/components/svg/paint.js.map +1 -0
- package/dist/components/svg/shapes.d.ts +47 -0
- package/dist/components/svg/shapes.js +51 -0
- package/dist/components/svg/shapes.js.map +1 -0
- package/dist/components/svg/svg.d.ts +14 -0
- package/dist/components/svg/svg.js +48 -0
- package/dist/components/svg/svg.js.map +1 -0
- package/dist/components/svg/use-shape-node.d.ts +12 -0
- package/dist/components/svg/use-shape-node.js +52 -0
- package/dist/components/svg/use-shape-node.js.map +1 -0
- package/dist/components/text-input.js +3 -2
- package/dist/components/text-input.js.map +1 -1
- package/dist/components/text.js +11 -2
- package/dist/components/text.js.map +1 -1
- package/dist/components/use-layout-child.js +47 -4
- package/dist/components/use-layout-child.js.map +1 -1
- package/dist/contracts.d.ts +12 -1
- package/dist/contracts.js +2 -3
- package/dist/contracts.js.map +1 -1
- package/dist/gtk/index.d.ts +6 -0
- package/dist/gtk/index.js +39 -0
- package/dist/gtk/index.js.map +1 -0
- package/dist/gtk/widgets.generated.d.ts +103 -0
- package/dist/gtk/widgets.generated.js +206 -0
- package/dist/gtk/widgets.generated.js.map +1 -0
- package/dist/gtkx/bridge/index.d.ts +9 -4
- package/dist/gtkx/bridge/index.js +41 -5
- package/dist/gtkx/bridge/index.js.map +1 -1
- package/dist/gtkx/bridge/layout-manager.d.ts +2 -1
- package/dist/gtkx/bridge/layout-manager.js +31 -9
- package/dist/gtkx/bridge/layout-manager.js.map +1 -1
- package/dist/gtkx/bridge/svg-node.d.ts +79 -0
- package/dist/gtkx/bridge/svg-node.js +367 -0
- package/dist/gtkx/bridge/svg-node.js.map +1 -0
- package/dist/gtkx/bridge/theme.js +1 -1
- package/dist/gtkx/bridge/theme.js.map +1 -1
- package/dist/gtkx/bridge/use-signal.js +21 -10
- package/dist/gtkx/bridge/use-signal.js.map +1 -1
- package/dist/gtkx/bridge/widgets.generated.d.ts +2 -0
- package/dist/gtkx/bridge/widgets.generated.js +14 -0
- package/dist/gtkx/bridge/widgets.generated.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/bin.d.ts +2 -0
- package/dist/mcp/bin.js +17 -0
- package/dist/mcp/bin.js.map +1 -0
- package/dist/mcp/data/generated.d.ts +1282 -0
- package/dist/mcp/data/generated.js +1148 -0
- package/dist/mcp/data/generated.js.map +1 -0
- package/dist/mcp/index.d.ts +5 -0
- package/dist/mcp/index.js +9 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/list.d.ts +4 -0
- package/dist/mcp/list.js +56 -0
- package/dist/mcp/list.js.map +1 -0
- package/dist/mcp/resolve.d.ts +55 -0
- package/dist/mcp/resolve.js +151 -0
- package/dist/mcp/resolve.js.map +1 -0
- package/dist/mcp/search.d.ts +13 -0
- package/dist/mcp/search.js +48 -0
- package/dist/mcp/search.js.map +1 -0
- package/dist/mcp/server.d.ts +7 -0
- package/dist/mcp/server.js +135 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tool.d.ts +21 -0
- package/dist/mcp/tool.js +36 -0
- package/dist/mcp/tool.js.map +1 -0
- package/dist/metro/index.js +10 -0
- package/dist/metro/index.js.map +1 -1
- package/dist/navigation/index.d.ts +50 -13
- package/dist/navigation/index.js +183 -148
- package/dist/navigation/index.js.map +1 -1
- package/dist/navigation/option-warnings.js +9 -1
- package/dist/navigation/option-warnings.js.map +1 -1
- package/dist/navigation/sidebar.d.ts +177 -9
- package/dist/navigation/sidebar.js +284 -10
- package/dist/navigation/sidebar.js.map +1 -1
- package/dist/runner/index.d.ts +22 -2
- package/dist/runner/index.js +163 -12
- package/dist/runner/index.js.map +1 -1
- package/dist/sea/assemble.d.ts +29 -0
- package/dist/sea/assemble.js +129 -0
- package/dist/sea/assemble.js.map +1 -0
- package/dist/sea/bundle.d.ts +61 -0
- package/dist/sea/bundle.js +202 -0
- package/dist/sea/bundle.js.map +1 -0
- package/dist/sea/gtkx-config-module.d.ts +18 -0
- package/dist/sea/gtkx-config-module.js +67 -0
- package/dist/sea/gtkx-config-module.js.map +1 -0
- package/dist/sea/native-shim.d.ts +40 -0
- package/dist/sea/native-shim.js +121 -0
- package/dist/sea/native-shim.js.map +1 -0
- package/dist/sea/react-anchor-plugin.d.ts +2 -0
- package/dist/sea/react-anchor-plugin.js +30 -0
- package/dist/sea/react-anchor-plugin.js.map +1 -0
- package/dist/style/colors.js +3 -1
- package/dist/style/colors.js.map +1 -1
- package/dist/style/index.d.ts +1 -0
- package/dist/style/index.js +3 -2
- package/dist/style/index.js.map +1 -1
- package/dist/style/registry.gtkx.js +1 -1
- package/dist/style/registry.gtkx.js.map +1 -1
- package/dist/style/split-style.js +3 -3
- package/dist/style/split-style.js.map +1 -1
- package/dist/style/text-align.js +1 -1
- package/dist/style/text-align.js.map +1 -1
- package/dist/style/transform.d.ts +22 -0
- package/dist/style/transform.js +137 -0
- package/dist/style/transform.js.map +1 -0
- package/dist/style/visual-css.js +3 -2
- package/dist/style/visual-css.js.map +1 -1
- package/dist/svg/geometry.d.ts +19 -0
- package/dist/svg/geometry.js +80 -0
- package/dist/svg/geometry.js.map +1 -0
- package/dist/svg/gradient-geometry.d.ts +15 -0
- package/dist/svg/gradient-geometry.js +18 -0
- package/dist/svg/gradient-geometry.js.map +1 -0
- package/dist/svg/transform.d.ts +22 -0
- package/dist/svg/transform.js +74 -0
- package/dist/svg/transform.js.map +1 -0
- package/dist/svg/view-box.d.ts +34 -0
- package/dist/svg/view-box.js +108 -0
- package/dist/svg/view-box.js.map +1 -0
- package/dist/svg-compat/index.d.ts +1 -0
- package/dist/svg-compat/index.js +16 -0
- package/dist/svg-compat/index.js.map +1 -0
- package/dist/testing/index.d.ts +14 -0
- package/dist/testing/index.js +14 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/vite/index.d.ts +7 -3
- package/dist/vite/index.js +16 -3
- package/dist/vite/index.js.map +1 -1
- package/dist/vitest/index.d.ts +52 -0
- package/dist/vitest/index.js +58 -0
- package/dist/vitest/index.js.map +1 -0
- package/dist/vitest/setup.d.ts +4 -0
- package/dist/vitest/setup.js +22 -0
- package/dist/vitest/setup.js.map +1 -0
- package/package.json +47 -8
package/dist/style/colors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.js","sourceRoot":"","sources":["../../src/style/colors.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,2EAA2E;AAC3E,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,mEAAmE;AACnE,2EAA2E;AAC3E,mEAAmE;AAEnE,yEAAyE;AACzE,MAAM,YAAY,GAA2B;IAC3C,SAAS,EAAE,SAAS;IACpB,YAAY,EAAE,SAAS;IACvB,IAAI,EAAE,SAAS;IACf,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,SAAS;IAChB,cAAc,EAAE,SAAS;IACzB,IAAI,EAAE,SAAS;IACf,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,SAAS;IAChB,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,UAAU,EAAE,SAAS;IACrB,SAAS,EAAE,SAAS;IACpB,KAAK,EAAE,SAAS;IAChB,cAAc,EAAE,SAAS;IACzB,QAAQ,EAAE,SAAS;IACnB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,aAAa,EAAE,SAAS;IACxB,QAAQ,EAAE,SAAS;IACnB,SAAS,EAAE,SAA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AAO,UAAU,IAAI,EAAE,CAAA;AACzB,CAAC,CAAA","sourcesContent":["// Pure color handling: parses React Native color strings and normalizes them\n// into GTK4 CSS color values. No bridge imports — unit-testable on any OS.\n//\n// Every parseable color is normalized to `rgb(r, g, b)` / `rgba(r, g, b, a)`\n// so the output does not depend on which color syntaxes the GTK CSS parser of\n// a particular version accepts. Two values pass through untouched:\n// - `var(--name[, fallback])` — CSS variables (GTK 4.16+, Adwaita palette)\n// - `@name` — legacy GTK named colors (`@define-color` references)\n\n// CSS Color Module Level 4 named colors (the set React Native supports).\nconst NAMED_COLORS: Record<string, string> = {\n aliceblue: \"#f0f8ff\",\n antiquewhite: \"#faebd7\",\n aqua: \"#00ffff\",\n aquamarine: \"#7fffd4\",\n azure: \"#f0ffff\",\n beige: \"#f5f5dc\",\n bisque: \"#ffe4c4\",\n black: \"#000000\",\n blanchedalmond: \"#ffebcd\",\n blue: \"#0000ff\",\n blueviolet: \"#8a2be2\",\n brown: \"#a52a2a\",\n burlywood: \"#deb887\",\n cadetblue: \"#5f9ea0\",\n chartreuse: \"#7fff00\",\n chocolate: \"#d2691e\",\n coral: \"#ff7f50\",\n cornflowerblue: \"#6495ed\",\n cornsilk: \"#fff8dc\",\n crimson: \"#dc143c\",\n cyan: \"#00ffff\",\n darkblue: \"#00008b\",\n darkcyan: \"#008b8b\",\n darkgoldenrod: \"#b8860b\",\n darkgray: \"#a9a9a9\",\n darkgreen: \"#006400\",\n darkgrey: \"#a9a9a9\",\n darkkhaki: \"#bdb76b\",\n darkmagenta: \"#8b008b\",\n darkolivegreen: \"#556b2f\",\n darkorange: \"#ff8c00\",\n darkorchid: \"#9932cc\",\n darkred: \"#8b0000\",\n darksalmon: \"#e9967a\",\n darkseagreen: \"#8fbc8f\",\n darkslateblue: \"#483d8b\",\n darkslategray: \"#2f4f4f\",\n darkslategrey: \"#2f4f4f\",\n darkturquoise: \"#00ced1\",\n darkviolet: \"#9400d3\",\n deeppink: \"#ff1493\",\n deepskyblue: \"#00bfff\",\n dimgray: \"#696969\",\n dimgrey: \"#696969\",\n dodgerblue: \"#1e90ff\",\n firebrick: \"#b22222\",\n floralwhite: \"#fffaf0\",\n forestgreen: \"#228b22\",\n fuchsia: \"#ff00ff\",\n gainsboro: \"#dcdcdc\",\n ghostwhite: \"#f8f8ff\",\n gold: \"#ffd700\",\n goldenrod: \"#daa520\",\n gray: \"#808080\",\n green: \"#008000\",\n greenyellow: \"#adff2f\",\n grey: \"#808080\",\n honeydew: \"#f0fff0\",\n hotpink: \"#ff69b4\",\n indianred: \"#cd5c5c\",\n indigo: \"#4b0082\",\n ivory: \"#fffff0\",\n khaki: \"#f0e68c\",\n lavender: \"#e6e6fa\",\n lavenderblush: \"#fff0f5\",\n lawngreen: \"#7cfc00\",\n lemonchiffon: \"#fffacd\",\n lightblue: \"#add8e6\",\n lightcoral: \"#f08080\",\n lightcyan: \"#e0ffff\",\n lightgoldenrodyellow: \"#fafad2\",\n lightgray: \"#d3d3d3\",\n lightgreen: \"#90ee90\",\n lightgrey: \"#d3d3d3\",\n lightpink: \"#ffb6c1\",\n lightsalmon: \"#ffa07a\",\n lightseagreen: \"#20b2aa\",\n lightskyblue: \"#87cefa\",\n lightslategray: \"#778899\",\n lightslategrey: \"#778899\",\n lightsteelblue: \"#b0c4de\",\n lightyellow: \"#ffffe0\",\n lime: \"#00ff00\",\n limegreen: \"#32cd32\",\n linen: \"#faf0e6\",\n magenta: \"#ff00ff\",\n maroon: \"#800000\",\n mediumaquamarine: \"#66cdaa\",\n mediumblue: \"#0000cd\",\n mediumorchid: \"#ba55d3\",\n mediumpurple: \"#9370db\",\n mediumseagreen: \"#3cb371\",\n mediumslateblue: \"#7b68ee\",\n mediumspringgreen: \"#00fa9a\",\n mediumturquoise: \"#48d1cc\",\n mediumvioletred: \"#c71585\",\n midnightblue: \"#191970\",\n mintcream: \"#f5fffa\",\n mistyrose: \"#ffe4e1\",\n moccasin: \"#ffe4b5\",\n navajowhite: \"#ffdead\",\n navy: \"#000080\",\n oldlace: \"#fdf5e6\",\n olive: \"#808000\",\n olivedrab: \"#6b8e23\",\n orange: \"#ffa500\",\n orangered: \"#ff4500\",\n orchid: \"#da70d6\",\n palegoldenrod: \"#eee8aa\",\n palegreen: \"#98fb98\",\n paleturquoise: \"#afeeee\",\n palevioletred: \"#db7093\",\n papayawhip: \"#ffefd5\",\n peachpuff: \"#ffdab9\",\n peru: \"#cd853f\",\n pink: \"#ffc0cb\",\n plum: \"#dda0dd\",\n powderblue: \"#b0e0e6\",\n purple: \"#800080\",\n rebeccapurple: \"#663399\",\n red: \"#ff0000\",\n rosybrown: \"#bc8f8f\",\n royalblue: \"#4169e1\",\n saddlebrown: \"#8b4513\",\n salmon: \"#fa8072\",\n sandybrown: \"#f4a460\",\n seagreen: \"#2e8b57\",\n seashell: \"#fff5ee\",\n sienna: \"#a0522d\",\n silver: \"#c0c0c0\",\n skyblue: \"#87ceeb\",\n slateblue: \"#6a5acd\",\n slategray: \"#708090\",\n slategrey: \"#708090\",\n snow: \"#fffafa\",\n springgreen: \"#00ff7f\",\n steelblue: \"#4682b4\",\n tan: \"#d2b48c\",\n teal: \"#008080\",\n thistle: \"#d8bfd8\",\n tomato: \"#ff6347\",\n turquoise: \"#40e0d0\",\n violet: \"#ee82ee\",\n wheat: \"#f5deb3\",\n white: \"#ffffff\",\n whitesmoke: \"#f5f5f5\",\n yellow: \"#ffff00\",\n yellowgreen: \"#9acd32\",\n}\n\ntype Rgba = { r: number; g: number; b: number; a: number }\n\nconst clamp = (value: number, min: number, max: number): number =>\n Math.min(max, Math.max(min, value))\n\nconst formatRgba = ({ r, g, b, a }: Rgba): string => {\n const alpha = Math.round(clamp(a, 0, 1) * 1000) / 1000\n return alpha >= 1\n ? `rgb(${r}, ${g}, ${b})`\n : `rgba(${r}, ${g}, ${b}, ${alpha})`\n}\n\nconst HEX_PATTERN = /^#([0-9a-f]+)$/i\n\nconst hexPair = (digits: string, index: number): number =>\n Number.parseInt(digits.slice(index, index + 2), 16)\n\nconst hexSingle = (digits: string, index: number): number =>\n Number.parseInt(digits.charAt(index).repeat(2), 16)\n\nconst parseHex = (input: string): Rgba | null => {\n const match = HEX_PATTERN.exec(input)\n if (match === null) {\n return null\n }\n const digits = match[1] ?? \"\"\n switch (digits.length) {\n case 3:\n return {\n r: hexSingle(digits, 0),\n g: hexSingle(digits, 1),\n b: hexSingle(digits, 2),\n a: 1,\n }\n case 4:\n return {\n r: hexSingle(digits, 0),\n g: hexSingle(digits, 1),\n b: hexSingle(digits, 2),\n a: hexSingle(digits, 3) / 255,\n }\n case 6:\n return {\n r: hexPair(digits, 0),\n g: hexPair(digits, 2),\n b: hexPair(digits, 4),\n a: 1,\n }\n case 8:\n return {\n r: hexPair(digits, 0),\n g: hexPair(digits, 2),\n b: hexPair(digits, 4),\n a: hexPair(digits, 6) / 255,\n }\n default:\n return null\n }\n}\n\nconst NUMBER_PATTERN = /^[+-]?(?:\\d+\\.?\\d*|\\.\\d+)$/\n\nconst parseNumber = (token: string): number | null =>\n NUMBER_PATTERN.test(token) ? Number.parseFloat(token) : null\n\n// 0-255 integer or percentage → 0-255 integer.\nconst parseRgbChannel = (token: string): number | null => {\n if (token.endsWith(\"%\")) {\n const percent = parseNumber(token.slice(0, -1))\n // (percent * 255) / 100 avoids float drift: 50 * 2.55 === 127.4999...\n return percent === null\n ? null\n : Math.round((clamp(percent, 0, 100) * 255) / 100)\n }\n const value = parseNumber(token)\n return value === null ? null : Math.round(clamp(value, 0, 255))\n}\n\n// 0-1 float or percentage → 0-1 float.\nconst parseAlpha = (token: string): number | null => {\n if (token.endsWith(\"%\")) {\n const percent = parseNumber(token.slice(0, -1))\n return percent === null ? null : clamp(percent / 100, 0, 1)\n }\n const value = parseNumber(token)\n return value === null ? null : clamp(value, 0, 1)\n}\n\nconst parsePercentage = (token: string): number | null => {\n if (!token.endsWith(\"%\")) {\n return null\n }\n const percent = parseNumber(token.slice(0, -1))\n return percent === null ? null : clamp(percent / 100, 0, 1)\n}\n\nconst parseHue = (token: string): number | null => {\n const raw = token.toLowerCase().endsWith(\"deg\") ? token.slice(0, -3) : token\n const degrees = parseNumber(raw)\n return degrees === null ? null : ((degrees % 360) + 360) % 360\n}\n\nconst hslToRgb = (\n h: number,\n s: number,\n l: number,\n): [number, number, number] => {\n const chroma = (1 - Math.abs(2 * l - 1)) * s\n const hh = h / 60\n const x = chroma * (1 - Math.abs((hh % 2) - 1))\n let rgb: [number, number, number] = [0, 0, 0]\n if (hh < 1) {\n rgb = [chroma, x, 0]\n } else if (hh < 2) {\n rgb = [x, chroma, 0]\n } else if (hh < 3) {\n rgb = [0, chroma, x]\n } else if (hh < 4) {\n rgb = [0, x, chroma]\n } else if (hh < 5) {\n rgb = [x, 0, chroma]\n } else {\n rgb = [chroma, 0, x]\n }\n const m = l - chroma / 2\n return [\n Math.round((rgb[0] + m) * 255),\n Math.round((rgb[1] + m) * 255),\n Math.round((rgb[2] + m) * 255),\n ]\n}\n\nconst FUNCTION_PATTERN = /^(rgba?|hsla?)\\(([^()]*)\\)$/i\n\n// Accepts legacy comma syntax and modern space syntax with optional \"/ alpha\".\nconst splitFunctionBody = (body: string): string[] =>\n body\n .replace(/\\//g, \" \")\n .split(/[,\\s]+/)\n .filter((token) => token.length > 0)\n\nconst parseColorFunction = (input: string): Rgba | null => {\n const match = FUNCTION_PATTERN.exec(input)\n if (match === null) {\n return null\n }\n const name = (match[1] ?? \"\").toLowerCase()\n const tokens = splitFunctionBody(match[2] ?? \"\")\n if (tokens.length < 3 || tokens.length > 4) {\n return null\n }\n const alpha = tokens.length === 4 ? parseAlpha(tokens[3] ?? \"\") : 1\n if (alpha === null) {\n return null\n }\n if (name === \"rgb\" || name === \"rgba\") {\n const r = parseRgbChannel(tokens[0] ?? \"\")\n const g = parseRgbChannel(tokens[1] ?? \"\")\n const b = parseRgbChannel(tokens[2] ?? \"\")\n if (r === null || g === null || b === null) {\n return null\n }\n return { r, g, b, a: alpha }\n }\n const h = parseHue(tokens[0] ?? \"\")\n const s = parsePercentage(tokens[1] ?? \"\")\n const l = parsePercentage(tokens[2] ?? \"\")\n if (h === null || s === null || l === null) {\n return null\n }\n const [r, g, b] = hslToRgb(h, s, l)\n return { r, g, b, a: alpha }\n}\n\nconst CSS_VARIABLE_PATTERN = /^var\\(--[\\w-]+.*\\)$/i\nconst GTK_NAMED_COLOR_PATTERN = /^@[A-Za-z_][\\w-]*$/\n\n/**\n * Parses a React Native color string into a GTK4 CSS color value.\n * Returns null for values that cannot be understood.\n */\nexport const parseColor = (value: string): string | null => {\n if (typeof value !== \"string\") {\n return null\n }\n const input = value.trim()\n if (input === \"\") {\n return null\n }\n // Adwaita/custom CSS variable references pass through untouched. The\n // pattern is permissive on purpose: nested var() fallbacks stay valid.\n if (input.toLowerCase().startsWith(\"var(\")) {\n return CSS_VARIABLE_PATTERN.test(input) ? input : null\n }\n if (GTK_NAMED_COLOR_PATTERN.test(input)) {\n return input\n }\n const lower = input.toLowerCase()\n if (lower === \"transparent\") {\n return \"rgba(0, 0, 0, 0)\"\n }\n const named = NAMED_COLORS[lower]\n const rgba = parseHex(named ?? input) ?? parseColorFunction(input)\n return rgba === null ? null : formatRgba(rgba)\n}\n\nconst toCssVariableName = (name: string): string =>\n name.startsWith(\"--\") ? name : `--${name}`\n\n/**\n * React Native's PlatformColor for GTK: references theme colors by name.\n * Names map onto CSS variables (Adwaita exposes its palette as\n * `--accent-bg-color`, `--window-bg-color`, ... since libadwaita 1.6);\n * extra names become var() fallbacks, tried in order. A name starting with\n * \"@\" is a legacy GTK named color (`@define-color`) and terminates the\n * fallback chain, because var() fallbacks cannot resolve further after it.\n *\n * PlatformColor(\"accent-bg-color\") → \"var(--accent-bg-color)\"\n * PlatformColor(\"accent-bg-color\", \"@blue_3\") → \"var(--accent-bg-color, @blue_3)\"\n */\nexport const PlatformColor = (...names: string[]): string => {\n const cleaned = names.map((name) => name.trim()).filter((name) => name !== \"\")\n if (cleaned.length === 0) {\n throw new Error(\"PlatformColor requires at least one color name\")\n }\n let expression: string | null = null\n for (let i = cleaned.length - 1; i >= 0; i -= 1) {\n const name = cleaned[i] ?? \"\"\n if (name.startsWith(\"@\")) {\n // Terminal value: names after it are unreachable fallbacks.\n expression = name\n continue\n }\n const variable = toCssVariableName(name)\n expression =\n expression === null\n ? `var(${variable})`\n : `var(${variable}, ${expression})`\n }\n return expression ?? \"\"\n}\n"]}
|
|
1
|
+
{"version":3,"file":"colors.js","sourceRoot":"","sources":["../../src/style/colors.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,2EAA2E;AAC3E,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,mEAAmE;AACnE,2EAA2E;AAC3E,mEAAmE;AAEnE,yEAAyE;AACzE,MAAM,YAAY,GAA2B;IAC3C,SAAS,EAAE,SAAS;IACpB,YAAY,EAAE,SAAS;IACvB,IAAI,EAAE,SAAS;IACf,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,SAAS;IAChB,cAAc,EAAE,SAAS;IACzB,IAAI,EAAE,SAAS;IACf,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,SAAS;IAChB,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,UAAU,EAAE,SAAS;IACrB,SAAS,EAAE,SAAS;IACpB,KAAK,EAAE,SAAS;IAChB,cAAc,EAAE,SAAS;IACzB,QAAQ,EAAE,SAAS;IACnB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,aAAa,EAAE,SAAS;IACxB,QAAQ,EAAE,SAAS;IACnB,SAAS,EAAE,SAAS;IACpB,QAAQ,EAAE,SAAS;IACnB,SAAS,EAAE,SAAS;IACpB,WAAW,EAAE,SAAS;IACtB,cAAc,EAAE,SAAS;IACzB,UAAU,EAAE,SAAS;IACrB,UAAU,EAAE,SAAS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AAE,CACjD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAA;AAE5C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAG,KAAe,EAAU,EAAE;IAC1D,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAA;IAC9E,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;IACnE,CAAC;IACD,IAAI,UAAU,GAAkB,IAAI,CAAA;IACpC,KAAK,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;QAC7B,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,4DAA4D;YAC5D,UAAU,GAAG,IAAI,CAAA;YACjB,SAAQ;QACV,CAAC;QACD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAA;QACxC,UAAU;YACR,UAAU,KAAK,IAAI;gBACjB,CAAC,CAAC,OAAO,QAAQ,GAAG;gBACpB,CAAC,CAAC,OAAO,QAAQ,KAAK,UAAU,GAAG,CAAA;IACzC,CAAC;IACD,OAAO,UAAU,IAAI,EAAE,CAAA;AACzB,CAAC,CAAA","sourcesContent":["// Pure color handling: parses React Native color strings and normalizes them\n// into GTK4 CSS color values. No bridge imports — unit-testable on any OS.\n//\n// Every parseable color is normalized to `rgb(r, g, b)` / `rgba(r, g, b, a)`\n// so the output does not depend on which color syntaxes the GTK CSS parser of\n// a particular version accepts. Two values pass through untouched:\n// - `var(--name[, fallback])` — CSS variables (GTK 4.16+, Adwaita palette)\n// - `@name` — legacy GTK named colors (`@define-color` references)\n\n// CSS Color Module Level 4 named colors (the set React Native supports).\nconst NAMED_COLORS: Record<string, string> = {\n aliceblue: \"#f0f8ff\",\n antiquewhite: \"#faebd7\",\n aqua: \"#00ffff\",\n aquamarine: \"#7fffd4\",\n azure: \"#f0ffff\",\n beige: \"#f5f5dc\",\n bisque: \"#ffe4c4\",\n black: \"#000000\",\n blanchedalmond: \"#ffebcd\",\n blue: \"#0000ff\",\n blueviolet: \"#8a2be2\",\n brown: \"#a52a2a\",\n burlywood: \"#deb887\",\n cadetblue: \"#5f9ea0\",\n chartreuse: \"#7fff00\",\n chocolate: \"#d2691e\",\n coral: \"#ff7f50\",\n cornflowerblue: \"#6495ed\",\n cornsilk: \"#fff8dc\",\n crimson: \"#dc143c\",\n cyan: \"#00ffff\",\n darkblue: \"#00008b\",\n darkcyan: \"#008b8b\",\n darkgoldenrod: \"#b8860b\",\n darkgray: \"#a9a9a9\",\n darkgreen: \"#006400\",\n darkgrey: \"#a9a9a9\",\n darkkhaki: \"#bdb76b\",\n darkmagenta: \"#8b008b\",\n darkolivegreen: \"#556b2f\",\n darkorange: \"#ff8c00\",\n darkorchid: \"#9932cc\",\n darkred: \"#8b0000\",\n darksalmon: \"#e9967a\",\n darkseagreen: \"#8fbc8f\",\n darkslateblue: \"#483d8b\",\n darkslategray: \"#2f4f4f\",\n darkslategrey: \"#2f4f4f\",\n darkturquoise: \"#00ced1\",\n darkviolet: \"#9400d3\",\n deeppink: \"#ff1493\",\n deepskyblue: \"#00bfff\",\n dimgray: \"#696969\",\n dimgrey: \"#696969\",\n dodgerblue: \"#1e90ff\",\n firebrick: \"#b22222\",\n floralwhite: \"#fffaf0\",\n forestgreen: \"#228b22\",\n fuchsia: \"#ff00ff\",\n gainsboro: \"#dcdcdc\",\n ghostwhite: \"#f8f8ff\",\n gold: \"#ffd700\",\n goldenrod: \"#daa520\",\n gray: \"#808080\",\n green: \"#008000\",\n greenyellow: \"#adff2f\",\n grey: \"#808080\",\n honeydew: \"#f0fff0\",\n hotpink: \"#ff69b4\",\n indianred: \"#cd5c5c\",\n indigo: \"#4b0082\",\n ivory: \"#fffff0\",\n khaki: \"#f0e68c\",\n lavender: \"#e6e6fa\",\n lavenderblush: \"#fff0f5\",\n lawngreen: \"#7cfc00\",\n lemonchiffon: \"#fffacd\",\n lightblue: \"#add8e6\",\n lightcoral: \"#f08080\",\n lightcyan: \"#e0ffff\",\n lightgoldenrodyellow: \"#fafad2\",\n lightgray: \"#d3d3d3\",\n lightgreen: \"#90ee90\",\n lightgrey: \"#d3d3d3\",\n lightpink: \"#ffb6c1\",\n lightsalmon: \"#ffa07a\",\n lightseagreen: \"#20b2aa\",\n lightskyblue: \"#87cefa\",\n lightslategray: \"#778899\",\n lightslategrey: \"#778899\",\n lightsteelblue: \"#b0c4de\",\n lightyellow: \"#ffffe0\",\n lime: \"#00ff00\",\n limegreen: \"#32cd32\",\n linen: \"#faf0e6\",\n magenta: \"#ff00ff\",\n maroon: \"#800000\",\n mediumaquamarine: \"#66cdaa\",\n mediumblue: \"#0000cd\",\n mediumorchid: \"#ba55d3\",\n mediumpurple: \"#9370db\",\n mediumseagreen: \"#3cb371\",\n mediumslateblue: \"#7b68ee\",\n mediumspringgreen: \"#00fa9a\",\n mediumturquoise: \"#48d1cc\",\n mediumvioletred: \"#c71585\",\n midnightblue: \"#191970\",\n mintcream: \"#f5fffa\",\n mistyrose: \"#ffe4e1\",\n moccasin: \"#ffe4b5\",\n navajowhite: \"#ffdead\",\n navy: \"#000080\",\n oldlace: \"#fdf5e6\",\n olive: \"#808000\",\n olivedrab: \"#6b8e23\",\n orange: \"#ffa500\",\n orangered: \"#ff4500\",\n orchid: \"#da70d6\",\n palegoldenrod: \"#eee8aa\",\n palegreen: \"#98fb98\",\n paleturquoise: \"#afeeee\",\n palevioletred: \"#db7093\",\n papayawhip: \"#ffefd5\",\n peachpuff: \"#ffdab9\",\n peru: \"#cd853f\",\n pink: \"#ffc0cb\",\n plum: \"#dda0dd\",\n powderblue: \"#b0e0e6\",\n purple: \"#800080\",\n rebeccapurple: \"#663399\",\n red: \"#ff0000\",\n rosybrown: \"#bc8f8f\",\n royalblue: \"#4169e1\",\n saddlebrown: \"#8b4513\",\n salmon: \"#fa8072\",\n sandybrown: \"#f4a460\",\n seagreen: \"#2e8b57\",\n seashell: \"#fff5ee\",\n sienna: \"#a0522d\",\n silver: \"#c0c0c0\",\n skyblue: \"#87ceeb\",\n slateblue: \"#6a5acd\",\n slategray: \"#708090\",\n slategrey: \"#708090\",\n snow: \"#fffafa\",\n springgreen: \"#00ff7f\",\n steelblue: \"#4682b4\",\n tan: \"#d2b48c\",\n teal: \"#008080\",\n thistle: \"#d8bfd8\",\n tomato: \"#ff6347\",\n turquoise: \"#40e0d0\",\n violet: \"#ee82ee\",\n wheat: \"#f5deb3\",\n white: \"#ffffff\",\n whitesmoke: \"#f5f5f5\",\n yellow: \"#ffff00\",\n yellowgreen: \"#9acd32\",\n}\n\ntype Rgba = { r: number; g: number; b: number; a: number }\n\nconst clamp = (value: number, min: number, max: number): number =>\n Math.min(max, Math.max(min, value))\n\nconst formatRgba = ({ r, g, b, a }: Rgba): string => {\n const alpha = Math.round(clamp(a, 0, 1) * 1000) / 1000\n return alpha >= 1\n ? `rgb(${r}, ${g}, ${b})`\n : `rgba(${r}, ${g}, ${b}, ${alpha})`\n}\n\nconst HEX_PATTERN = /^#([0-9a-f]+)$/i\n\nconst hexPair = (digits: string, index: number): number =>\n Number.parseInt(digits.slice(index, index + 2), 16)\n\nconst hexSingle = (digits: string, index: number): number =>\n Number.parseInt(digits.charAt(index).repeat(2), 16)\n\nconst parseHex = (input: string): Rgba | null => {\n const match = HEX_PATTERN.exec(input)\n if (match === null) {\n return null\n }\n const digits = match[1] ?? \"\"\n switch (digits.length) {\n case 3:\n return {\n r: hexSingle(digits, 0),\n g: hexSingle(digits, 1),\n b: hexSingle(digits, 2),\n a: 1,\n }\n case 4:\n return {\n r: hexSingle(digits, 0),\n g: hexSingle(digits, 1),\n b: hexSingle(digits, 2),\n a: hexSingle(digits, 3) / 255,\n }\n case 6:\n return {\n r: hexPair(digits, 0),\n g: hexPair(digits, 2),\n b: hexPair(digits, 4),\n a: 1,\n }\n case 8:\n return {\n r: hexPair(digits, 0),\n g: hexPair(digits, 2),\n b: hexPair(digits, 4),\n a: hexPair(digits, 6) / 255,\n }\n default:\n return null\n }\n}\n\nconst NUMBER_PATTERN = /^[+-]?(?:\\d+\\.?\\d*|\\.\\d+)$/\n\nconst parseNumber = (token: string): number | null =>\n NUMBER_PATTERN.test(token) ? Number.parseFloat(token) : null\n\n// 0-255 integer or percentage → 0-255 integer.\nconst parseRgbChannel = (token: string): number | null => {\n if (token.endsWith(\"%\")) {\n const percent = parseNumber(token.slice(0, -1))\n // (percent * 255) / 100 avoids float drift: 50 * 2.55 === 127.4999...\n return percent === null\n ? null\n : Math.round((clamp(percent, 0, 100) * 255) / 100)\n }\n const value = parseNumber(token)\n return value === null ? null : Math.round(clamp(value, 0, 255))\n}\n\n// 0-1 float or percentage → 0-1 float.\nconst parseAlpha = (token: string): number | null => {\n if (token.endsWith(\"%\")) {\n const percent = parseNumber(token.slice(0, -1))\n return percent === null ? null : clamp(percent / 100, 0, 1)\n }\n const value = parseNumber(token)\n return value === null ? null : clamp(value, 0, 1)\n}\n\nconst parsePercentage = (token: string): number | null => {\n if (!token.endsWith(\"%\")) {\n return null\n }\n const percent = parseNumber(token.slice(0, -1))\n return percent === null ? null : clamp(percent / 100, 0, 1)\n}\n\nconst parseHue = (token: string): number | null => {\n const raw = token.toLowerCase().endsWith(\"deg\") ? token.slice(0, -3) : token\n const degrees = parseNumber(raw)\n return degrees === null ? null : ((degrees % 360) + 360) % 360\n}\n\nconst hslToRgb = (\n h: number,\n s: number,\n l: number,\n): [number, number, number] => {\n const chroma = (1 - Math.abs(2 * l - 1)) * s\n const hh = h / 60\n const x = chroma * (1 - Math.abs((hh % 2) - 1))\n // Every branch assigns, so the sextant picks the triple outright — the\n // placeholder initialiser it used to start from was dead.\n let rgb: [number, number, number]\n if (hh < 1) {\n rgb = [chroma, x, 0]\n } else if (hh < 2) {\n rgb = [x, chroma, 0]\n } else if (hh < 3) {\n rgb = [0, chroma, x]\n } else if (hh < 4) {\n rgb = [0, x, chroma]\n } else if (hh < 5) {\n rgb = [x, 0, chroma]\n } else {\n rgb = [chroma, 0, x]\n }\n const m = l - chroma / 2\n return [\n Math.round((rgb[0] + m) * 255),\n Math.round((rgb[1] + m) * 255),\n Math.round((rgb[2] + m) * 255),\n ]\n}\n\nconst FUNCTION_PATTERN = /^(rgba?|hsla?)\\(([^()]*)\\)$/i\n\n// Accepts legacy comma syntax and modern space syntax with optional \"/ alpha\".\nconst splitFunctionBody = (body: string): string[] =>\n body\n .replace(/\\//g, \" \")\n .split(/[,\\s]+/)\n .filter((token) => token.length > 0)\n\nconst parseColorFunction = (input: string): Rgba | null => {\n const match = FUNCTION_PATTERN.exec(input)\n if (match === null) {\n return null\n }\n const name = (match[1] ?? \"\").toLowerCase()\n const tokens = splitFunctionBody(match[2] ?? \"\")\n if (tokens.length < 3 || tokens.length > 4) {\n return null\n }\n const alpha = tokens.length === 4 ? parseAlpha(tokens[3] ?? \"\") : 1\n if (alpha === null) {\n return null\n }\n if (name === \"rgb\" || name === \"rgba\") {\n const r = parseRgbChannel(tokens[0] ?? \"\")\n const g = parseRgbChannel(tokens[1] ?? \"\")\n const b = parseRgbChannel(tokens[2] ?? \"\")\n if (r === null || g === null || b === null) {\n return null\n }\n return { r, g, b, a: alpha }\n }\n const h = parseHue(tokens[0] ?? \"\")\n const s = parsePercentage(tokens[1] ?? \"\")\n const l = parsePercentage(tokens[2] ?? \"\")\n if (h === null || s === null || l === null) {\n return null\n }\n const [r, g, b] = hslToRgb(h, s, l)\n return { r, g, b, a: alpha }\n}\n\nconst CSS_VARIABLE_PATTERN = /^var\\(--[\\w-]+.*\\)$/i\nconst GTK_NAMED_COLOR_PATTERN = /^@[A-Za-z_][\\w-]*$/\n\n/**\n * Parses a React Native color string into a GTK4 CSS color value.\n * Returns null for values that cannot be understood.\n */\nexport const parseColor = (value: string): string | null => {\n if (typeof value !== \"string\") {\n return null\n }\n const input = value.trim()\n if (input === \"\") {\n return null\n }\n // Adwaita/custom CSS variable references pass through untouched. The\n // pattern is permissive on purpose: nested var() fallbacks stay valid.\n if (input.toLowerCase().startsWith(\"var(\")) {\n return CSS_VARIABLE_PATTERN.test(input) ? input : null\n }\n if (GTK_NAMED_COLOR_PATTERN.test(input)) {\n return input\n }\n const lower = input.toLowerCase()\n if (lower === \"transparent\") {\n return \"rgba(0, 0, 0, 0)\"\n }\n const named = NAMED_COLORS[lower]\n const rgba = parseHex(named ?? input) ?? parseColorFunction(input)\n return rgba === null ? null : formatRgba(rgba)\n}\n\nconst toCssVariableName = (name: string): string =>\n name.startsWith(\"--\") ? name : `--${name}`\n\n/**\n * React Native's PlatformColor for GTK: references theme colors by name.\n * Names map onto CSS variables (Adwaita exposes its palette as\n * `--accent-bg-color`, `--window-bg-color`, ... since libadwaita 1.6);\n * extra names become var() fallbacks, tried in order. A name starting with\n * \"@\" is a legacy GTK named color (`@define-color`) and terminates the\n * fallback chain, because var() fallbacks cannot resolve further after it.\n *\n * PlatformColor(\"accent-bg-color\") → \"var(--accent-bg-color)\"\n * PlatformColor(\"accent-bg-color\", \"@blue_3\") → \"var(--accent-bg-color, @blue_3)\"\n */\nexport const PlatformColor = (...names: string[]): string => {\n const cleaned = names.map((name) => name.trim()).filter((name) => name !== \"\")\n if (cleaned.length === 0) {\n throw new Error(\"PlatformColor requires at least one color name\")\n }\n let expression: string | null = null\n for (let i = cleaned.length - 1; i >= 0; i -= 1) {\n const name = cleaned[i] ?? \"\"\n if (name.startsWith(\"@\")) {\n // Terminal value: names after it are unreachable fallbacks.\n expression = name\n continue\n }\n const variable = toCssVariableName(name)\n expression =\n expression === null\n ? `var(${variable})`\n : `var(${variable}, ${expression})`\n }\n return expression ?? \"\"\n}\n"]}
|
package/dist/style/index.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export { createCssRegistry, type CssFn, type CssRegistry } from "./registry";
|
|
|
4
4
|
export { splitStyle } from "./split-style";
|
|
5
5
|
export { absoluteFill, absoluteFillObject, compose, create, flatten, hairlineWidth, StyleSheet, } from "./style-sheet";
|
|
6
6
|
export { textAlignToLabelProps, type LabelAlignProps, type TextAlign, } from "./text-align";
|
|
7
|
+
export { composeTransform, IDENTITY_TRANSFORM, isIdentityTransform, isTranslationOnly, parseAngle, } from "./transform";
|
|
7
8
|
export { visualStyleToCss } from "./visual-css";
|
package/dist/style/index.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
// Style pipeline
|
|
1
|
+
// Style pipeline: StyleSheet → flatten → splitStyle →
|
|
2
2
|
// visualStyleToCss → memoized class registry.
|
|
3
3
|
//
|
|
4
4
|
// Everything exported here is pure (no bridge imports) and unit-testable on
|
|
5
5
|
// any OS. The production registry that talks to the gtkx `css` helper lives
|
|
6
|
-
// in ./registry.gtkx.ts and is imported directly by components
|
|
6
|
+
// in ./registry.gtkx.ts and is imported directly by the components.
|
|
7
7
|
export { parseColor, PlatformColor } from "./colors";
|
|
8
8
|
export { resetDevWarnings } from "./dev-warning";
|
|
9
9
|
export { createCssRegistry } from "./registry";
|
|
10
10
|
export { splitStyle } from "./split-style";
|
|
11
11
|
export { absoluteFill, absoluteFillObject, compose, create, flatten, hairlineWidth, StyleSheet, } from "./style-sheet";
|
|
12
12
|
export { textAlignToLabelProps, } from "./text-align";
|
|
13
|
+
export { composeTransform, IDENTITY_TRANSFORM, isIdentityTransform, isTranslationOnly, parseAngle, } from "./transform";
|
|
13
14
|
export { visualStyleToCss } from "./visual-css";
|
|
14
15
|
//# sourceMappingURL=index.js.map
|
package/dist/style/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/style/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/style/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,8CAA8C;AAC9C,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,oEAAoE;AAEpE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,iBAAiB,EAAgC,MAAM,YAAY,CAAA;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,OAAO,EACP,MAAM,EACN,OAAO,EACP,aAAa,EACb,UAAU,GACX,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,qBAAqB,GAGtB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,GACX,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA","sourcesContent":["// Style pipeline: StyleSheet → flatten → splitStyle →\n// visualStyleToCss → memoized class registry.\n//\n// Everything exported here is pure (no bridge imports) and unit-testable on\n// any OS. The production registry that talks to the gtkx `css` helper lives\n// in ./registry.gtkx.ts and is imported directly by the components.\n\nexport { parseColor, PlatformColor } from \"./colors\"\nexport { resetDevWarnings } from \"./dev-warning\"\nexport { createCssRegistry, type CssFn, type CssRegistry } from \"./registry\"\nexport { splitStyle } from \"./split-style\"\nexport {\n absoluteFill,\n absoluteFillObject,\n compose,\n create,\n flatten,\n hairlineWidth,\n StyleSheet,\n} from \"./style-sheet\"\nexport {\n textAlignToLabelProps,\n type LabelAlignProps,\n type TextAlign,\n} from \"./text-align\"\nexport {\n composeTransform,\n IDENTITY_TRANSFORM,\n isIdentityTransform,\n isTranslationOnly,\n parseAngle,\n} from \"./transform\"\nexport { visualStyleToCss } from \"./visual-css\"\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Production adapter — the ONLY style module that touches the bridge.
|
|
2
|
-
// Components
|
|
2
|
+
// Components import the default registry from here; everything
|
|
3
3
|
// else in src/style is pure and must not depend on this file. It is also
|
|
4
4
|
// deliberately not re-exported from src/style/index.ts so that unit tests
|
|
5
5
|
// (and any pure consumer) never pull in @gtkx bindings transitively.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.gtkx.js","sourceRoot":"","sources":["../../src/style/registry.gtkx.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE
|
|
1
|
+
{"version":3,"file":"registry.gtkx.js","sourceRoot":"","sources":["../../src/style/registry.gtkx.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,+DAA+D;AAC/D,yEAAyE;AACzE,0EAA0E;AAC1E,qEAAqE;AAErE,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAC1C,OAAO,EAAE,iBAAiB,EAAoB,MAAM,YAAY,CAAA;AAEhE,MAAM,CAAC,MAAM,kBAAkB,GAAgB,iBAAiB,CAAC,CAAC,OAAO,EAAE,EAAE,CAC3E,GAAG,CAAC,OAAO,CAAC,CACb,CAAA","sourcesContent":["// Production adapter — the ONLY style module that touches the bridge.\n// Components import the default registry from here; everything\n// else in src/style is pure and must not depend on this file. It is also\n// deliberately not re-exported from src/style/index.ts so that unit tests\n// (and any pure consumer) never pull in @gtkx bindings transitively.\n\nimport { css } from \"../gtkx/bridge/index\"\nimport { createCssRegistry, type CssRegistry } from \"./registry\"\n\nexport const defaultCssRegistry: CssRegistry = createCssRegistry((cssText) =>\n css(cssText),\n)\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Classifies a flattened style into layout props (consumed by the Yoga
|
|
2
|
-
// engine
|
|
2
|
+
// engine) and visual props (compiled into GTK CSS). Pure module.
|
|
3
3
|
import { warnOnce } from "./dev-warning";
|
|
4
4
|
// Exhaustive over the frozen contract: adding a key to LayoutStyle in
|
|
5
5
|
// contracts.ts fails compilation here until the key is classified.
|
|
@@ -47,8 +47,8 @@ const LAYOUT_KEYS = {
|
|
|
47
47
|
top: true,
|
|
48
48
|
width: true,
|
|
49
49
|
};
|
|
50
|
-
// Note: `transform` is visual by contract — it is applied
|
|
51
|
-
//
|
|
50
|
+
// Note: `transform` is visual by contract — it is applied as the
|
|
51
|
+
// GskTransform of the child's allocation, not through CSS, and is passed
|
|
52
52
|
// through here untouched.
|
|
53
53
|
const VISUAL_KEYS = {
|
|
54
54
|
backgroundColor: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-style.js","sourceRoot":"","sources":["../../src/style/split-style.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,
|
|
1
|
+
{"version":3,"file":"split-style.js","sourceRoot":"","sources":["../../src/style/split-style.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,iEAAiE;AAQjE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,sEAAsE;AACtE,mEAAmE;AACnE,MAAM,WAAW,GAAoC;IACnD,YAAY,EAAE,IAAI;IAClB,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,IAAI;IACjB,MAAM,EAAE,IAAI;IACZ,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,IAAI;IACnB,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,IAAI;IAChB,QAAQ,EAAE,IAAI;IACd,GAAG,EAAE,IAAI;IACT,MAAM,EAAE,IAAI;IACZ,cAAc,EAAE,IAAI;IACpB,IAAI,EAAE,IAAI;IACV,MAAM,EAAE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AAI;IAChB,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;CAChB,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAe,EAAc,EAAE;IACxD,MAAM,MAAM,GAAgB,EAAE,CAAA;IAC9B,MAAM,MAAM,GAAgB,EAAE,CAAA;IAC9B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,SAAQ;QACV,CAAC;QACD,IAAI,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC;YACpC,CAAC;YAAC,MAAkC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;QACnD,CAAC;aAAM,IAAI,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC;YAC3C,CAAC;YAAC,MAAkC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;QACnD,CAAC;aAAM,CAAC;YACN,QAAQ,CACN,sBAAsB,GAAG,EAAE,EAC3B,+CAA+C,GAAG,wCAAwC,CAC3F,CAAA;QACH,CAAC;IACH,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;AAC3B,CAAC,CAAA","sourcesContent":["// Classifies a flattened style into layout props (consumed by the Yoga\n// engine) and visual props (compiled into GTK CSS). Pure module.\n\nimport type {\n FlatStyle,\n LayoutStyle,\n SplitStyle,\n VisualStyle,\n} from \"../contracts\"\nimport { warnOnce } from \"./dev-warning\"\n\n// Exhaustive over the frozen contract: adding a key to LayoutStyle in\n// contracts.ts fails compilation here until the key is classified.\nconst LAYOUT_KEYS: Record<keyof LayoutStyle, true> = {\n alignContent: true,\n alignItems: true,\n alignSelf: true,\n aspectRatio: true,\n bottom: true,\n columnGap: true,\n direction: true,\n display: true,\n flex: true,\n flexBasis: true,\n flexDirection: true,\n flexGrow: true,\n flexShrink: true,\n flexWrap: true,\n gap: true,\n height: true,\n justifyContent: true,\n left: true,\n margin: true,\n marginBottom: true,\n marginHorizontal: true,\n marginLeft: true,\n marginRight: true,\n marginTop: true,\n marginVertical: true,\n maxHeight: true,\n maxWidth: true,\n minHeight: true,\n minWidth: true,\n overflow: true,\n padding: true,\n paddingBottom: true,\n paddingHorizontal: true,\n paddingLeft: true,\n paddingRight: true,\n paddingTop: true,\n paddingVertical: true,\n position: true,\n right: true,\n rowGap: true,\n top: true,\n width: true,\n}\n\n// Note: `transform` is visual by contract — it is applied as the\n// GskTransform of the child's allocation, not through CSS, and is passed\n// through here untouched.\nconst VISUAL_KEYS: Record<keyof VisualStyle, true> = {\n backgroundColor: true,\n borderBottomColor: true,\n borderBottomLeftRadius: true,\n borderBottomRightRadius: true,\n borderBottomWidth: true,\n borderColor: true,\n borderLeftColor: true,\n borderLeftWidth: true,\n borderRadius: true,\n borderRightColor: true,\n borderRightWidth: true,\n borderStyle: true,\n borderTopColor: true,\n borderTopLeftRadius: true,\n borderTopRightRadius: true,\n borderTopWidth: true,\n borderWidth: true,\n color: true,\n fontFamily: true,\n fontSize: true,\n fontStyle: true,\n fontWeight: true,\n letterSpacing: true,\n lineHeight: true,\n opacity: true,\n textAlign: true,\n transform: true,\n}\n\n/**\n * Splits a flattened style into { layout, visual }. Unknown properties are\n * ignored with a one-time dev warning per key; undefined values are dropped.\n */\nexport const splitStyle = (flat: FlatStyle): SplitStyle => {\n const layout: LayoutStyle = {}\n const visual: VisualStyle = {}\n for (const [key, value] of Object.entries(flat)) {\n if (value === undefined) {\n continue\n }\n if (Object.hasOwn(LAYOUT_KEYS, key)) {\n ;(layout as Record<string, unknown>)[key] = value\n } else if (Object.hasOwn(VISUAL_KEYS, key)) {\n ;(visual as Record<string, unknown>)[key] = value\n } else {\n warnOnce(\n `unknown-style-prop:${key}`,\n `[react-native-gtkx] Unknown style property \"${key}\" is not supported and will be ignored`,\n )\n }\n }\n return { layout, visual }\n}\n"]}
|
package/dist/style/text-align.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// GTK4 CSS has no text-align property, so textAlign never reaches the CSS
|
|
2
|
-
// generator: the Text component
|
|
2
|
+
// generator: the Text component maps it onto GtkLabel properties with
|
|
3
3
|
// this pure helper (no bridge imports).
|
|
4
4
|
//
|
|
5
5
|
// - xalign positions the whole text block inside the label allocation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-align.js","sourceRoot":"","sources":["../../src/style/text-align.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"text-align.js","sourceRoot":"","sources":["../../src/style/text-align.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,sEAAsE;AACtE,wCAAwC;AACxC,EAAE;AACF,uEAAuE;AACvE,4EAA4E;AAC5E,gDAAgD;AAWhD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,SAAgC,EACf,EAAE;IACnB,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,OAAO;YACV,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,CAAA;QAC9C,KAAK,QAAQ;YACX,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAA;QACjD,KAAK,SAAS;YACZ,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,CAAA;QAC7C,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM,CAAC;QACZ,KAAK,SAAS;YACZ,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,CAAA;IAC/C,CAAC;AACH,CAAC,CAAA","sourcesContent":["// GTK4 CSS has no text-align property, so textAlign never reaches the CSS\n// generator: the Text component maps it onto GtkLabel properties with\n// this pure helper (no bridge imports).\n//\n// - xalign positions the whole text block inside the label allocation;\n// - justification aligns wrapped lines relative to each other (values match\n// Gtk.Justification: left/right/center/fill).\n\nimport type { VisualStyle } from \"../contracts\"\n\nexport type TextAlign = NonNullable<VisualStyle[\"textAlign\"]>\n\nexport type LabelAlignProps = {\n xalign: number\n justification: \"left\" | \"right\" | \"center\" | \"fill\"\n}\n\nexport const textAlignToLabelProps = (\n textAlign: TextAlign | undefined,\n): LabelAlignProps => {\n switch (textAlign) {\n case \"right\":\n return { xalign: 1, justification: \"right\" }\n case \"center\":\n return { xalign: 0.5, justification: \"center\" }\n case \"justify\":\n return { xalign: 0, justification: \"fill\" }\n case \"auto\":\n case \"left\":\n case undefined:\n return { xalign: 0, justification: \"left\" }\n }\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Transform2D, TransformPart } from "../contracts";
|
|
2
|
+
export declare const IDENTITY_TRANSFORM: Transform2D;
|
|
3
|
+
/**
|
|
4
|
+
* RN angle syntax: a number with an explicit `deg` or `rad` unit. Returns
|
|
5
|
+
* degrees, or null for anything unparseable (warned once, then dropped —
|
|
6
|
+
* a bad angle must not take the whole style down).
|
|
7
|
+
*/
|
|
8
|
+
export declare const parseAngle: (value: unknown) => number | null;
|
|
9
|
+
/**
|
|
10
|
+
* Folds an RN transform array into a single matrix. Order is RN's (and
|
|
11
|
+
* CSS's): the leftmost entry is the outermost matrix, so it is applied to a
|
|
12
|
+
* point LAST — `[{rotate}, {translateX}]` translates, then rotates the
|
|
13
|
+
* result about the origin.
|
|
14
|
+
*/
|
|
15
|
+
export declare const composeTransform: (parts: readonly TransformPart[]) => Transform2D;
|
|
16
|
+
export declare const isIdentityTransform: (matrix: Transform2D) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* True when the matrix is a pure translation. Those keep the existing
|
|
19
|
+
* positional fast path (the rect is simply offset), which costs no
|
|
20
|
+
* GskTransform at all — only rotate/scale need one.
|
|
21
|
+
*/
|
|
22
|
+
export declare const isTranslationOnly: (matrix: Transform2D) => boolean;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// Composes an RN `transform` array into one 2D affine matrix. Pure module —
|
|
2
|
+
// no bridge imports — so the whole ordering contract is unit-testable on any
|
|
3
|
+
// OS; the bridge only turns the finished matrix into a GskTransform.
|
|
4
|
+
//
|
|
5
|
+
// Why a matrix and not a chain of GskTransform calls: measured in the VM
|
|
6
|
+
// (docs/research/transforms.md), a five-op GskTransform chain costs 18.3 us
|
|
7
|
+
// per build against 5.7 us for one gsk_transform_matrix2d(), and both
|
|
8
|
+
// produce a bit-identical to2d(). Composition is six multiplies of plain
|
|
9
|
+
// numbers, so it stays on the Animated fast path.
|
|
10
|
+
import { warnOnce } from "./dev-warning";
|
|
11
|
+
export const IDENTITY_TRANSFORM = {
|
|
12
|
+
xx: 1,
|
|
13
|
+
yx: 0,
|
|
14
|
+
xy: 0,
|
|
15
|
+
yy: 1,
|
|
16
|
+
dx: 0,
|
|
17
|
+
dy: 0,
|
|
18
|
+
};
|
|
19
|
+
const DEG_PER_RAD = 180 / Math.PI;
|
|
20
|
+
/**
|
|
21
|
+
* RN angle syntax: a number with an explicit `deg` or `rad` unit. Returns
|
|
22
|
+
* degrees, or null for anything unparseable (warned once, then dropped —
|
|
23
|
+
* a bad angle must not take the whole style down).
|
|
24
|
+
*/
|
|
25
|
+
export const parseAngle = (value) => {
|
|
26
|
+
if (typeof value === "number") {
|
|
27
|
+
// RN rejects unitless angles in styles, but an Animated node driving a
|
|
28
|
+
// rotation with a plain numeric outputRange is a common shortcut and
|
|
29
|
+
// degrees are the only sane reading of it.
|
|
30
|
+
return Number.isFinite(value) ? value : null;
|
|
31
|
+
}
|
|
32
|
+
if (typeof value !== "string") {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const match = /^\s*([+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?)(deg|rad)\s*$/.exec(value);
|
|
36
|
+
if (!match) {
|
|
37
|
+
warnOnce(`invalid-angle:${value}`, `[react-native-gtkx] Invalid angle ${JSON.stringify(value)} in "transform" — expected "<number>deg" or "<number>rad"; the entry is ignored`);
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const amount = parseFloat(match[1]);
|
|
41
|
+
return match[2] === "rad" ? amount * DEG_PER_RAD : amount;
|
|
42
|
+
};
|
|
43
|
+
// left * right, both in the Transform2D component order.
|
|
44
|
+
const multiply = (left, right) => ({
|
|
45
|
+
xx: left.xx * right.xx + left.xy * right.yx,
|
|
46
|
+
yx: left.yx * right.xx + left.yy * right.yx,
|
|
47
|
+
xy: left.xx * right.xy + left.xy * right.yy,
|
|
48
|
+
yy: left.yx * right.xy + left.yy * right.yy,
|
|
49
|
+
dx: left.xx * right.dx + left.xy * right.dy + left.dx,
|
|
50
|
+
dy: left.yx * right.dx + left.yy * right.dy + left.dy,
|
|
51
|
+
});
|
|
52
|
+
const scaleMatrix = (x, y) => Number.isFinite(x) && Number.isFinite(y)
|
|
53
|
+
? { xx: x, yx: 0, xy: 0, yy: y, dx: 0, dy: 0 }
|
|
54
|
+
: null;
|
|
55
|
+
const rotateMatrix = (angle) => {
|
|
56
|
+
const degrees = parseAngle(angle);
|
|
57
|
+
if (degrees === null) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
const radians = degrees / DEG_PER_RAD;
|
|
61
|
+
const cos = Math.cos(radians);
|
|
62
|
+
const sin = Math.sin(radians);
|
|
63
|
+
return { xx: cos, yx: sin, xy: -sin, yy: cos, dx: 0, dy: 0 };
|
|
64
|
+
};
|
|
65
|
+
// A TransformPart is a single-key object, and this runs on every animated
|
|
66
|
+
// frame — so the supported keys are probed directly (a monomorphic property
|
|
67
|
+
// load) instead of being discovered with Object.keys/for-in, and the matrices
|
|
68
|
+
// are plain literals rather than spreads of the identity. Key discovery only
|
|
69
|
+
// happens on the miss path, to name the unsupported entry in the warning.
|
|
70
|
+
const partToMatrix = (part) => {
|
|
71
|
+
const entry = part;
|
|
72
|
+
const translateX = entry.translateX;
|
|
73
|
+
if (typeof translateX === "number") {
|
|
74
|
+
return Number.isFinite(translateX)
|
|
75
|
+
? { xx: 1, yx: 0, xy: 0, yy: 1, dx: translateX, dy: 0 }
|
|
76
|
+
: null;
|
|
77
|
+
}
|
|
78
|
+
const translateY = entry.translateY;
|
|
79
|
+
if (typeof translateY === "number") {
|
|
80
|
+
return Number.isFinite(translateY)
|
|
81
|
+
? { xx: 1, yx: 0, xy: 0, yy: 1, dx: 0, dy: translateY }
|
|
82
|
+
: null;
|
|
83
|
+
}
|
|
84
|
+
const scale = entry.scale;
|
|
85
|
+
if (typeof scale === "number") {
|
|
86
|
+
return scaleMatrix(scale, scale);
|
|
87
|
+
}
|
|
88
|
+
const scaleX = entry.scaleX;
|
|
89
|
+
if (typeof scaleX === "number") {
|
|
90
|
+
return scaleMatrix(scaleX, 1);
|
|
91
|
+
}
|
|
92
|
+
const scaleY = entry.scaleY;
|
|
93
|
+
if (typeof scaleY === "number") {
|
|
94
|
+
return scaleMatrix(1, scaleY);
|
|
95
|
+
}
|
|
96
|
+
if (entry.rotate !== undefined) {
|
|
97
|
+
return rotateMatrix(entry.rotate);
|
|
98
|
+
}
|
|
99
|
+
if (entry.rotateZ !== undefined) {
|
|
100
|
+
return rotateMatrix(entry.rotateZ);
|
|
101
|
+
}
|
|
102
|
+
for (const key of Object.keys(entry)) {
|
|
103
|
+
warnOnce(`unsupported-transform:${key}`, `[react-native-gtkx] Unsupported transform "${key}" — supported: translateX, translateY, scale, scaleX, scaleY, rotate, rotateZ`);
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Folds an RN transform array into a single matrix. Order is RN's (and
|
|
109
|
+
* CSS's): the leftmost entry is the outermost matrix, so it is applied to a
|
|
110
|
+
* point LAST — `[{rotate}, {translateX}]` translates, then rotates the
|
|
111
|
+
* result about the origin.
|
|
112
|
+
*/
|
|
113
|
+
export const composeTransform = (parts) => {
|
|
114
|
+
// `matrix === null` means "still the identity", which lets the common
|
|
115
|
+
// single-entry array skip the multiply entirely.
|
|
116
|
+
let matrix = null;
|
|
117
|
+
for (const part of parts) {
|
|
118
|
+
const next = partToMatrix(part);
|
|
119
|
+
if (next) {
|
|
120
|
+
matrix = matrix === null ? next : multiply(matrix, next);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return matrix ?? IDENTITY_TRANSFORM;
|
|
124
|
+
};
|
|
125
|
+
export const isIdentityTransform = (matrix) => matrix.xx === 1 &&
|
|
126
|
+
matrix.yx === 0 &&
|
|
127
|
+
matrix.xy === 0 &&
|
|
128
|
+
matrix.yy === 1 &&
|
|
129
|
+
matrix.dx === 0 &&
|
|
130
|
+
matrix.dy === 0;
|
|
131
|
+
/**
|
|
132
|
+
* True when the matrix is a pure translation. Those keep the existing
|
|
133
|
+
* positional fast path (the rect is simply offset), which costs no
|
|
134
|
+
* GskTransform at all — only rotate/scale need one.
|
|
135
|
+
*/
|
|
136
|
+
export const isTranslationOnly = (matrix) => matrix.xx === 1 && matrix.yx === 0 && matrix.xy === 0 && matrix.yy === 1;
|
|
137
|
+
//# sourceMappingURL=transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../src/style/transform.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,6EAA6E;AAC7E,qEAAqE;AACrE,EAAE;AACF,yEAAyE;AACzE,4EAA4E;AAC5E,sEAAsE;AACtE,yEAAyE;AACzE,kDAAkD;AAGlD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,MAAM,CAAC,MAAM,kBAAkB,GAAgB;IAC7C,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;CACN,CAAA;AAED,MAAM,WAAW,GAAG,GAAG,GAAG,IAAI,CAAC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CAAC,EAAE,KAAK,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,CAAC,CAAA;AAEjB;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAmB,EAAW,EAAE,CAChE,MAAM,CAAC,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,EAAE,KAAK,CAAC,CAAA","sourcesContent":["// Composes an RN `transform` array into one 2D affine matrix. Pure module —\n// no bridge imports — so the whole ordering contract is unit-testable on any\n// OS; the bridge only turns the finished matrix into a GskTransform.\n//\n// Why a matrix and not a chain of GskTransform calls: measured in the VM\n// (docs/research/transforms.md), a five-op GskTransform chain costs 18.3 us\n// per build against 5.7 us for one gsk_transform_matrix2d(), and both\n// produce a bit-identical to2d(). Composition is six multiplies of plain\n// numbers, so it stays on the Animated fast path.\n\nimport type { Transform2D, TransformPart } from \"../contracts\"\nimport { warnOnce } from \"./dev-warning\"\n\nexport const IDENTITY_TRANSFORM: Transform2D = {\n xx: 1,\n yx: 0,\n xy: 0,\n yy: 1,\n dx: 0,\n dy: 0,\n}\n\nconst DEG_PER_RAD = 180 / Math.PI\n\n/**\n * RN angle syntax: a number with an explicit `deg` or `rad` unit. Returns\n * degrees, or null for anything unparseable (warned once, then dropped —\n * a bad angle must not take the whole style down).\n */\nexport const parseAngle = (value: unknown): number | null => {\n if (typeof value === \"number\") {\n // RN rejects unitless angles in styles, but an Animated node driving a\n // rotation with a plain numeric outputRange is a common shortcut and\n // degrees are the only sane reading of it.\n return Number.isFinite(value) ? value : null\n }\n if (typeof value !== \"string\") {\n return null\n }\n const match =\n /^\\s*([+-]?(?:\\d+\\.?\\d*|\\.\\d+)(?:[eE][+-]?\\d+)?)(deg|rad)\\s*$/.exec(value)\n if (!match) {\n warnOnce(\n `invalid-angle:${value}`,\n `[react-native-gtkx] Invalid angle ${JSON.stringify(value)} in \"transform\" — expected \"<number>deg\" or \"<number>rad\"; the entry is ignored`,\n )\n return null\n }\n const amount = parseFloat(match[1]!)\n return match[2] === \"rad\" ? amount * DEG_PER_RAD : amount\n}\n\n// left * right, both in the Transform2D component order.\nconst multiply = (left: Transform2D, right: Transform2D): Transform2D => ({\n xx: left.xx * right.xx + left.xy * right.yx,\n yx: left.yx * right.xx + left.yy * right.yx,\n xy: left.xx * right.xy + left.xy * right.yy,\n yy: left.yx * right.xy + left.yy * right.yy,\n dx: left.xx * right.dx + left.xy * right.dy + left.dx,\n dy: left.yx * right.dx + left.yy * right.dy + left.dy,\n})\n\nconst scaleMatrix = (x: number, y: number): Transform2D | null =>\n Number.isFinite(x) && Number.isFinite(y)\n ? { xx: x, yx: 0, xy: 0, yy: y, dx: 0, dy: 0 }\n : null\n\nconst rotateMatrix = (angle: unknown): Transform2D | null => {\n const degrees = parseAngle(angle)\n if (degrees === null) {\n return null\n }\n const radians = degrees / DEG_PER_RAD\n const cos = Math.cos(radians)\n const sin = Math.sin(radians)\n return { xx: cos, yx: sin, xy: -sin, yy: cos, dx: 0, dy: 0 }\n}\n\n// A TransformPart is a single-key object, and this runs on every animated\n// frame — so the supported keys are probed directly (a monomorphic property\n// load) instead of being discovered with Object.keys/for-in, and the matrices\n// are plain literals rather than spreads of the identity. Key discovery only\n// happens on the miss path, to name the unsupported entry in the warning.\nconst partToMatrix = (part: TransformPart): Transform2D | null => {\n const entry = part as Record<string, unknown>\n\n const translateX = entry.translateX\n if (typeof translateX === \"number\") {\n return Number.isFinite(translateX)\n ? { xx: 1, yx: 0, xy: 0, yy: 1, dx: translateX, dy: 0 }\n : null\n }\n const translateY = entry.translateY\n if (typeof translateY === \"number\") {\n return Number.isFinite(translateY)\n ? { xx: 1, yx: 0, xy: 0, yy: 1, dx: 0, dy: translateY }\n : null\n }\n const scale = entry.scale\n if (typeof scale === \"number\") {\n return scaleMatrix(scale, scale)\n }\n const scaleX = entry.scaleX\n if (typeof scaleX === \"number\") {\n return scaleMatrix(scaleX, 1)\n }\n const scaleY = entry.scaleY\n if (typeof scaleY === \"number\") {\n return scaleMatrix(1, scaleY)\n }\n if (entry.rotate !== undefined) {\n return rotateMatrix(entry.rotate)\n }\n if (entry.rotateZ !== undefined) {\n return rotateMatrix(entry.rotateZ)\n }\n\n for (const key of Object.keys(entry)) {\n warnOnce(\n `unsupported-transform:${key}`,\n `[react-native-gtkx] Unsupported transform \"${key}\" — supported: translateX, translateY, scale, scaleX, scaleY, rotate, rotateZ`,\n )\n }\n return null\n}\n\n/**\n * Folds an RN transform array into a single matrix. Order is RN's (and\n * CSS's): the leftmost entry is the outermost matrix, so it is applied to a\n * point LAST — `[{rotate}, {translateX}]` translates, then rotates the\n * result about the origin.\n */\nexport const composeTransform = (\n parts: readonly TransformPart[],\n): Transform2D => {\n // `matrix === null` means \"still the identity\", which lets the common\n // single-entry array skip the multiply entirely.\n let matrix: Transform2D | null = null\n for (const part of parts) {\n const next = partToMatrix(part)\n if (next) {\n matrix = matrix === null ? next : multiply(matrix, next)\n }\n }\n return matrix ?? IDENTITY_TRANSFORM\n}\n\nexport const isIdentityTransform = (matrix: Transform2D): boolean =>\n matrix.xx === 1 &&\n matrix.yx === 0 &&\n matrix.xy === 0 &&\n matrix.yy === 1 &&\n matrix.dx === 0 &&\n matrix.dy === 0\n\n/**\n * True when the matrix is a pure translation. Those keep the existing\n * positional fast path (the rect is simply offset), which costs no\n * GskTransform at all — only rotate/scale need one.\n */\nexport const isTranslationOnly = (matrix: Transform2D): boolean =>\n matrix.xx === 1 && matrix.yx === 0 && matrix.xy === 0 && matrix.yy === 1\n"]}
|
package/dist/style/visual-css.js
CHANGED
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
// - line-height: supported since GTK 4.6 (we target 4.20+);
|
|
9
9
|
// - text-align does NOT exist in GTK CSS — textAlign is applied by the Text
|
|
10
10
|
// component via widget properties (justify/xalign), so it is skipped here;
|
|
11
|
-
// - transform
|
|
12
|
-
//
|
|
11
|
+
// - transform does NOT exist as a widget property in GTK4 CSS either: it is
|
|
12
|
+
// composed into a matrix by ./transform.ts and applied as the GskTransform
|
|
13
|
+
// of the child's allocation, so it is skipped here as well.
|
|
13
14
|
import { parseColor } from "./colors";
|
|
14
15
|
import { warnOnce } from "./dev-warning";
|
|
15
16
|
const px = (value) => `${value}px`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visual-css.js","sourceRoot":"","sources":["../../src/style/visual-css.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,yEAAyE;AACzE,gEAAgE;AAChE,EAAE;AACF,0DAA0D;AAC1D,2EAA2E;AAC3E,sDAAsD;AACtD,4DAA4D;AAC5D,4EAA4E;AAC5E,6EAA6E;AAC7E,wEAAwE;AACxE,oDAAoD;AAGpD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,MAAM,EAAE,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,GAAG,KAAK,IAAI,CAAA;AAElD,MAAM,OAAO,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA;AAE1E,MAAM,SAAS,GAAG,CAChB,YAAsB,EACtB,WAAmB,EACnB,KAAa,EACb,aAAqB,EACf,EAAE;IACR,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;IAChC,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,QAAQ,CACN,iBAAiB,aAAa,IAAI,KAAK,EAAE,EACzC,qCAAqC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,aA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CAAC;IAED,0EAA0E;IAE1E,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC,CAAA","sourcesContent":["// Compiles a VisualStyle into a GTK4 CSS declaration block (no selector).\n// Pure module — the resulting string is registered as a class through an\n// injected `css` function (see registry.ts / registry.gtkx.ts).\n//\n// GTK4 CSS is not web CSS. What this generator relies on:\n// - background-color, border-*, border-radius (incl. per-corner), opacity,\n// color, font-*, letter-spacing: supported by GTK4;\n// - line-height: supported since GTK 4.6 (we target 4.20+);\n// - text-align does NOT exist in GTK CSS — textAlign is applied by the Text\n// component via widget properties (justify/xalign), so it is skipped here;\n// - transform is applied by the layout engine via Fixed.Child matrices,\n// never through CSS, and is skipped here as well.\n\nimport type { VisualStyle } from \"../contracts\"\nimport { parseColor } from \"./colors\"\nimport { warnOnce } from \"./dev-warning\"\n\nconst px = (value: number): string => `${value}px`\n\nconst clamp01 = (value: number): number => Math.min(1, Math.max(0, value))\n\nconst pushColor = (\n declarations: string[],\n cssProperty: string,\n value: string,\n styleProperty: string,\n): void => {\n const parsed = parseColor(value)\n if (parsed === null) {\n warnOnce(\n `invalid-color:${styleProperty}:${value}`,\n `[react-native-gtkx] Invalid color ${JSON.stringify(value)} in \"${styleProperty}\" — declaration dropped`,\n )\n return\n }\n declarations.push(`${cssProperty}: ${parsed};`)\n}\n\nconst formatFontFamily = (family: string): string => {\n const trimmed = family.trim()\n if (/^(\".*\"|'.*')$/.test(trimmed)) {\n return trimmed\n }\n return /^[A-Za-z][\\w-]*$/.test(trimmed)\n ? trimmed\n : `\"${trimmed.replace(/\"/g, '\\\\\"')}\"`\n}\n\n/**\n * Renders a VisualStyle as GTK CSS declarations (one per line, stable\n * order). Returns \"\" when the style produces no CSS (e.g. transform-only).\n */\nexport const visualStyleToCss = (visual: VisualStyle): string => {\n const decls: string[] = []\n\n if (visual.backgroundColor !== undefined) {\n pushColor(\n decls,\n \"background-color\",\n visual.backgroundColor,\n \"backgroundColor\",\n )\n }\n if (visual.opacity !== undefined) {\n decls.push(`opacity: ${clamp01(visual.opacity)};`)\n }\n\n // GTK defaults border-style to none — width alone renders nothing. An\n // explicit borderStyle wins (GTK4 CSS supports solid/dotted/dashed);\n // otherwise any positive border width turns the border on with \"solid\".\n const hasVisibleBorderWidth = [\n visual.borderWidth,\n visual.borderTopWidth,\n visual.borderRightWidth,\n visual.borderBottomWidth,\n visual.borderLeftWidth,\n ].some((width) => width !== undefined && width > 0)\n if (visual.borderStyle !== undefined) {\n decls.push(`border-style: ${visual.borderStyle};`)\n } else if (hasVisibleBorderWidth) {\n decls.push(\"border-style: solid;\")\n }\n // Shorthands first, then per-side overrides so the sides win.\n if (visual.borderWidth !== undefined) {\n decls.push(`border-width: ${px(visual.borderWidth)};`)\n }\n if (visual.borderTopWidth !== undefined) {\n decls.push(`border-top-width: ${px(visual.borderTopWidth)};`)\n }\n if (visual.borderRightWidth !== undefined) {\n decls.push(`border-right-width: ${px(visual.borderRightWidth)};`)\n }\n if (visual.borderBottomWidth !== undefined) {\n decls.push(`border-bottom-width: ${px(visual.borderBottomWidth)};`)\n }\n if (visual.borderLeftWidth !== undefined) {\n decls.push(`border-left-width: ${px(visual.borderLeftWidth)};`)\n }\n if (visual.borderColor !== undefined) {\n pushColor(decls, \"border-color\", visual.borderColor, \"borderColor\")\n }\n if (visual.borderTopColor !== undefined) {\n pushColor(\n decls,\n \"border-top-color\",\n visual.borderTopColor,\n \"borderTopColor\",\n )\n }\n if (visual.borderRightColor !== undefined) {\n pushColor(\n decls,\n \"border-right-color\",\n visual.borderRightColor,\n \"borderRightColor\",\n )\n }\n if (visual.borderBottomColor !== undefined) {\n pushColor(\n decls,\n \"border-bottom-color\",\n visual.borderBottomColor,\n \"borderBottomColor\",\n )\n }\n if (visual.borderLeftColor !== undefined) {\n pushColor(\n decls,\n \"border-left-color\",\n visual.borderLeftColor,\n \"borderLeftColor\",\n )\n }\n if (visual.borderRadius !== undefined) {\n decls.push(`border-radius: ${px(visual.borderRadius)};`)\n }\n // Per-corner radii come after the shorthand so they override it.\n if (visual.borderTopLeftRadius !== undefined) {\n decls.push(`border-top-left-radius: ${px(visual.borderTopLeftRadius)};`)\n }\n if (visual.borderTopRightRadius !== undefined) {\n decls.push(`border-top-right-radius: ${px(visual.borderTopRightRadius)};`)\n }\n if (visual.borderBottomRightRadius !== undefined) {\n decls.push(\n `border-bottom-right-radius: ${px(visual.borderBottomRightRadius)};`,\n )\n }\n if (visual.borderBottomLeftRadius !== undefined) {\n decls.push(\n `border-bottom-left-radius: ${px(visual.borderBottomLeftRadius)};`,\n )\n }\n\n if (visual.color !== undefined) {\n pushColor(decls, \"color\", visual.color, \"color\")\n }\n if (visual.fontFamily !== undefined) {\n decls.push(`font-family: ${formatFontFamily(visual.fontFamily)};`)\n }\n if (visual.fontSize !== undefined) {\n decls.push(`font-size: ${px(visual.fontSize)};`)\n }\n if (visual.fontStyle !== undefined) {\n decls.push(`font-style: ${visual.fontStyle};`)\n }\n if (visual.fontWeight !== undefined) {\n decls.push(`font-weight: ${visual.fontWeight};`)\n }\n if (visual.letterSpacing !== undefined) {\n decls.push(`letter-spacing: ${px(visual.letterSpacing)};`)\n }\n if (visual.lineHeight !== undefined) {\n decls.push(`line-height: ${px(visual.lineHeight)};`)\n }\n\n // visual.textAlign, visual.transform: intentionally not CSS (see header).\n\n return decls.join(\"\\n\")\n}\n"]}
|
|
1
|
+
{"version":3,"file":"visual-css.js","sourceRoot":"","sources":["../../src/style/visual-css.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,yEAAyE;AACzE,gEAAgE;AAChE,EAAE;AACF,0DAA0D;AAC1D,2EAA2E;AAC3E,sDAAsD;AACtD,4DAA4D;AAC5D,4EAA4E;AAC5E,6EAA6E;AAC7E,4EAA4E;AAC5E,6EAA6E;AAC7E,8DAA8D;AAG9D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,MA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I,CAAC,eAAe,MAAM,CAAC,SAAS,GAAG,CAAC,CAAA;IAChD,CAAC;IACD,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACpC,KAAK,CAAC,IAAI,CAAC,gBAAgB,MAAM,CAAC,UAAU,GAAG,CAAC,CAAA;IAClD,CAAC;IACD,IAAI,MAAM,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;QACvC,KAAK,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;IAC5D,CAAC;IACD,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACpC,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;IACtD,CAAC;IAED,0EAA0E;IAE1E,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC,CAAA","sourcesContent":["// Compiles a VisualStyle into a GTK4 CSS declaration block (no selector).\n// Pure module — the resulting string is registered as a class through an\n// injected `css` function (see registry.ts / registry.gtkx.ts).\n//\n// GTK4 CSS is not web CSS. What this generator relies on:\n// - background-color, border-*, border-radius (incl. per-corner), opacity,\n// color, font-*, letter-spacing: supported by GTK4;\n// - line-height: supported since GTK 4.6 (we target 4.20+);\n// - text-align does NOT exist in GTK CSS — textAlign is applied by the Text\n// component via widget properties (justify/xalign), so it is skipped here;\n// - transform does NOT exist as a widget property in GTK4 CSS either: it is\n// composed into a matrix by ./transform.ts and applied as the GskTransform\n// of the child's allocation, so it is skipped here as well.\n\nimport type { VisualStyle } from \"../contracts\"\nimport { parseColor } from \"./colors\"\nimport { warnOnce } from \"./dev-warning\"\n\nconst px = (value: number): string => `${value}px`\n\nconst clamp01 = (value: number): number => Math.min(1, Math.max(0, value))\n\nconst pushColor = (\n declarations: string[],\n cssProperty: string,\n value: string,\n styleProperty: string,\n): void => {\n const parsed = parseColor(value)\n if (parsed === null) {\n warnOnce(\n `invalid-color:${styleProperty}:${value}`,\n `[react-native-gtkx] Invalid color ${JSON.stringify(value)} in \"${styleProperty}\" — declaration dropped`,\n )\n return\n }\n declarations.push(`${cssProperty}: ${parsed};`)\n}\n\nconst formatFontFamily = (family: string): string => {\n const trimmed = family.trim()\n if (/^(\".*\"|'.*')$/.test(trimmed)) {\n return trimmed\n }\n return /^[A-Za-z][\\w-]*$/.test(trimmed)\n ? trimmed\n : `\"${trimmed.replace(/\"/g, '\\\\\"')}\"`\n}\n\n/**\n * Renders a VisualStyle as GTK CSS declarations (one per line, stable\n * order). Returns \"\" when the style produces no CSS (e.g. transform-only).\n */\nexport const visualStyleToCss = (visual: VisualStyle): string => {\n const decls: string[] = []\n\n if (visual.backgroundColor !== undefined) {\n pushColor(\n decls,\n \"background-color\",\n visual.backgroundColor,\n \"backgroundColor\",\n )\n }\n if (visual.opacity !== undefined) {\n decls.push(`opacity: ${clamp01(visual.opacity)};`)\n }\n\n // GTK defaults border-style to none — width alone renders nothing. An\n // explicit borderStyle wins (GTK4 CSS supports solid/dotted/dashed);\n // otherwise any positive border width turns the border on with \"solid\".\n const hasVisibleBorderWidth = [\n visual.borderWidth,\n visual.borderTopWidth,\n visual.borderRightWidth,\n visual.borderBottomWidth,\n visual.borderLeftWidth,\n ].some((width) => width !== undefined && width > 0)\n if (visual.borderStyle !== undefined) {\n decls.push(`border-style: ${visual.borderStyle};`)\n } else if (hasVisibleBorderWidth) {\n decls.push(\"border-style: solid;\")\n }\n // Shorthands first, then per-side overrides so the sides win.\n if (visual.borderWidth !== undefined) {\n decls.push(`border-width: ${px(visual.borderWidth)};`)\n }\n if (visual.borderTopWidth !== undefined) {\n decls.push(`border-top-width: ${px(visual.borderTopWidth)};`)\n }\n if (visual.borderRightWidth !== undefined) {\n decls.push(`border-right-width: ${px(visual.borderRightWidth)};`)\n }\n if (visual.borderBottomWidth !== undefined) {\n decls.push(`border-bottom-width: ${px(visual.borderBottomWidth)};`)\n }\n if (visual.borderLeftWidth !== undefined) {\n decls.push(`border-left-width: ${px(visual.borderLeftWidth)};`)\n }\n if (visual.borderColor !== undefined) {\n pushColor(decls, \"border-color\", visual.borderColor, \"borderColor\")\n }\n if (visual.borderTopColor !== undefined) {\n pushColor(\n decls,\n \"border-top-color\",\n visual.borderTopColor,\n \"borderTopColor\",\n )\n }\n if (visual.borderRightColor !== undefined) {\n pushColor(\n decls,\n \"border-right-color\",\n visual.borderRightColor,\n \"borderRightColor\",\n )\n }\n if (visual.borderBottomColor !== undefined) {\n pushColor(\n decls,\n \"border-bottom-color\",\n visual.borderBottomColor,\n \"borderBottomColor\",\n )\n }\n if (visual.borderLeftColor !== undefined) {\n pushColor(\n decls,\n \"border-left-color\",\n visual.borderLeftColor,\n \"borderLeftColor\",\n )\n }\n if (visual.borderRadius !== undefined) {\n decls.push(`border-radius: ${px(visual.borderRadius)};`)\n }\n // Per-corner radii come after the shorthand so they override it.\n if (visual.borderTopLeftRadius !== undefined) {\n decls.push(`border-top-left-radius: ${px(visual.borderTopLeftRadius)};`)\n }\n if (visual.borderTopRightRadius !== undefined) {\n decls.push(`border-top-right-radius: ${px(visual.borderTopRightRadius)};`)\n }\n if (visual.borderBottomRightRadius !== undefined) {\n decls.push(\n `border-bottom-right-radius: ${px(visual.borderBottomRightRadius)};`,\n )\n }\n if (visual.borderBottomLeftRadius !== undefined) {\n decls.push(\n `border-bottom-left-radius: ${px(visual.borderBottomLeftRadius)};`,\n )\n }\n\n if (visual.color !== undefined) {\n pushColor(decls, \"color\", visual.color, \"color\")\n }\n if (visual.fontFamily !== undefined) {\n decls.push(`font-family: ${formatFontFamily(visual.fontFamily)};`)\n }\n if (visual.fontSize !== undefined) {\n decls.push(`font-size: ${px(visual.fontSize)};`)\n }\n if (visual.fontStyle !== undefined) {\n decls.push(`font-style: ${visual.fontStyle};`)\n }\n if (visual.fontWeight !== undefined) {\n decls.push(`font-weight: ${visual.fontWeight};`)\n }\n if (visual.letterSpacing !== undefined) {\n decls.push(`letter-spacing: ${px(visual.letterSpacing)};`)\n }\n if (visual.lineHeight !== undefined) {\n decls.push(`line-height: ${px(visual.lineHeight)};`)\n }\n\n // visual.textAlign, visual.transform: intentionally not CSS (see header).\n\n return decls.join(\"\\n\")\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type Point = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
};
|
|
5
|
+
export declare const parsePoints: (points: string) => Point[];
|
|
6
|
+
export type RectShape = {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
rx?: number;
|
|
12
|
+
ry?: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const rectToPathData: ({ x, y, width, height, rx, ry, }: RectShape) => string;
|
|
15
|
+
export declare const ellipseToPathData: (cx: number, cy: number, rx: number, ry: number) => string;
|
|
16
|
+
export declare const circleToPathData: (cx: number, cy: number, r: number) => string;
|
|
17
|
+
export declare const lineToPathData: (x1: number, y1: number, x2: number, y2: number) => string;
|
|
18
|
+
export declare const polygonToPathData: (points: string | Point[]) => string;
|
|
19
|
+
export declare const polylineToPathData: (points: string | Point[]) => string;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Pure shape → SVG path `d` string generators. No gtkx imports (unit-testable
|
|
2
|
+
// on any OS, like style/colors.ts) — the only consumer of the output is
|
|
3
|
+
// `Gsk.Path.parse()` in the bridge, so every generator here produces (a
|
|
4
|
+
// superset of) SVG path syntax and nothing else. This is the "no parser of
|
|
5
|
+
// our own" bet from the PRD: <Path> passes its `d` straight through, and
|
|
6
|
+
// every other shape is just a small amount of arithmetic away from the same
|
|
7
|
+
// syntax.
|
|
8
|
+
// Accepts both the comma-separated and whitespace-separated forms RN-svg
|
|
9
|
+
// tolerates ("0,0 10,5" and "0 0 10 5"), and odd trailing tokens are
|
|
10
|
+
// dropped rather than throwing — malformed `points` should render nothing
|
|
11
|
+
// useful, not crash the tree.
|
|
12
|
+
export const parsePoints = (points) => {
|
|
13
|
+
const numbers = points
|
|
14
|
+
.trim()
|
|
15
|
+
.split(/[\s,]+/)
|
|
16
|
+
.filter((token) => token.length > 0)
|
|
17
|
+
.map(Number)
|
|
18
|
+
.filter((value) => !Number.isNaN(value));
|
|
19
|
+
const result = [];
|
|
20
|
+
for (let i = 0; i + 1 < numbers.length; i += 2) {
|
|
21
|
+
result.push({ x: numbers[i], y: numbers[i + 1] });
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
// SVG's rx/ry resolution: either one fills in for a missing other, and both
|
|
26
|
+
// clamp to half the box so opposite corners never overlap.
|
|
27
|
+
const resolveCornerRadii = (width, height, rx, ry) => {
|
|
28
|
+
const rawRx = rx ?? ry ?? 0;
|
|
29
|
+
const rawRy = ry ?? rx ?? 0;
|
|
30
|
+
return [
|
|
31
|
+
Math.max(0, Math.min(rawRx, width / 2)),
|
|
32
|
+
Math.max(0, Math.min(rawRy, height / 2)),
|
|
33
|
+
];
|
|
34
|
+
};
|
|
35
|
+
export const rectToPathData = ({ x, y, width, height, rx, ry, }) => {
|
|
36
|
+
if (width <= 0 || height <= 0) {
|
|
37
|
+
return "";
|
|
38
|
+
}
|
|
39
|
+
const [radiusX, radiusY] = resolveCornerRadii(width, height, rx, ry);
|
|
40
|
+
if (radiusX <= 0 || radiusY <= 0) {
|
|
41
|
+
return `M ${x} ${y} H ${x + width} V ${y + height} H ${x} Z`;
|
|
42
|
+
}
|
|
43
|
+
const right = x + width;
|
|
44
|
+
const bottom = y + height;
|
|
45
|
+
return (`M ${x + radiusX} ${y} ` +
|
|
46
|
+
`H ${right - radiusX} ` +
|
|
47
|
+
`A ${radiusX} ${radiusY} 0 0 1 ${right} ${y + radiusY} ` +
|
|
48
|
+
`V ${bottom - radiusY} ` +
|
|
49
|
+
`A ${radiusX} ${radiusY} 0 0 1 ${right - radiusX} ${bottom} ` +
|
|
50
|
+
`H ${x + radiusX} ` +
|
|
51
|
+
`A ${radiusX} ${radiusY} 0 0 1 ${x} ${bottom - radiusY} ` +
|
|
52
|
+
`V ${y + radiusY} ` +
|
|
53
|
+
`A ${radiusX} ${radiusY} 0 0 1 ${x + radiusX} ${y} Z`);
|
|
54
|
+
};
|
|
55
|
+
// Two semicircle arcs — the standard trick for a full ellipse/circle in a
|
|
56
|
+
// path grammar that has no dedicated "ellipse" command.
|
|
57
|
+
export const ellipseToPathData = (cx, cy, rx, ry) => {
|
|
58
|
+
if (rx <= 0 || ry <= 0) {
|
|
59
|
+
return "";
|
|
60
|
+
}
|
|
61
|
+
return (`M ${cx - rx} ${cy} ` +
|
|
62
|
+
`A ${rx} ${ry} 0 1 0 ${cx + rx} ${cy} ` +
|
|
63
|
+
`A ${rx} ${ry} 0 1 0 ${cx - rx} ${cy} Z`);
|
|
64
|
+
};
|
|
65
|
+
export const circleToPathData = (cx, cy, r) => ellipseToPathData(cx, cy, r, r);
|
|
66
|
+
export const lineToPathData = (x1, y1, x2, y2) => `M ${x1} ${y1} L ${x2} ${y2}`;
|
|
67
|
+
const pointsToPathData = (points, close) => {
|
|
68
|
+
if (points.length === 0) {
|
|
69
|
+
return "";
|
|
70
|
+
}
|
|
71
|
+
const [first, ...rest] = points;
|
|
72
|
+
const segments = rest.map((p) => `L ${p.x} ${p.y}`).join(" ");
|
|
73
|
+
const body = segments.length > 0
|
|
74
|
+
? `M ${first.x} ${first.y} ${segments}`
|
|
75
|
+
: `M ${first.x} ${first.y}`;
|
|
76
|
+
return close ? `${body} Z` : body;
|
|
77
|
+
};
|
|
78
|
+
export const polygonToPathData = (points) => pointsToPathData(typeof points === "string" ? parsePoints(points) : points, true);
|
|
79
|
+
export const polylineToPathData = (points) => pointsToPathData(typeof points === "string" ? parsePoints(points) : points, false);
|
|
80
|
+
//# sourceMappingURL=geometry.js.map
|