@gjsify/adwaita-nativescript 0.13.0 → 0.13.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.
@@ -1 +1,2 @@
1
- import"../_virtual/_rolldown/runtime.js";const e=16,t=`#33333A`,n=`#FFFFFF`;function extractIconPaths(e){let t=[],n=/<path\b[^>]*>/g,r;for(;(r=n.exec(e))!==null;){let e=/\bd="([^"]*)"/.exec(r[0])?.[1]?.trim();if(!e)continue;let n=/\bfill-opacity="([^"]*)"/.exec(r[0])?.[1],i=n===void 0?1:Number.parseFloat(n);t.push({d:e,opacity:Number.isFinite(i)?Math.min(1,Math.max(0,i)):1})}return t}function extractPathData(e){return extractIconPaths(e).map(e=>e.d).join(` `)}export{e as ADWAITA_ICON_GRID,t as DEFAULT_ICON_COLOR,n as DEFAULT_ICON_COLOR_DARK,extractIconPaths,extractPathData};
1
+ import"../_virtual/_rolldown/runtime.js";const e=16,t=`#33333A`,n=`#FFFFFF`;function extractIconPaths(e){let t=[],n=/<path\b[^>]*>/g,r;for(;(r=n.exec(e))!==null;){let e=/\bd="([^"]*)"/.exec(r[0])?.[1]?.trim();if(!e)continue;let n=/\bfill-opacity="([^"]*)"/.exec(r[0])?.[1],i=n===void 0?1:Number.parseFloat(n);t.push({d:normalizeArcFlags(e),opacity:Number.isFinite(i)?Math.min(1,Math.max(0,i)):1})}return t}function extractPathData(e){return extractIconPaths(e).map(e=>e.d).join(` `)}function normalizeArcFlags(e){if(e.indexOf(`a`)===-1&&e.indexOf(`A`)===-1)return e;let t=e.length,isWs=e=>e===` `||e===`,`||e===` `||e===`
2
+ `||e===`\r`,isNumStart=e=>e>=`0`&&e<=`9`||e===`.`||e===`+`||e===`-`,n=0,r=``,skipWs=()=>{for(;n<t&&isWs(e[n]);)n++},readNumber=()=>{let r=n;for((e[n]===`+`||e[n]===`-`)&&n++;n<t&&e[n]>=`0`&&e[n]<=`9`;)n++;if(e[n]===`.`)for(n++;n<t&&e[n]>=`0`&&e[n]<=`9`;)n++;if(e[n]===`e`||e[n]===`E`)for(n++,(e[n]===`+`||e[n]===`-`)&&n++;n<t&&e[n]>=`0`&&e[n]<=`9`;)n++;return e.slice(r,n)};for(;n<t;){let i=e[n];if(i===`a`||i===`A`)for(r+=i,n++;skipWs(),!(n>=t||!isNumStart(e[n]));)r+=` `+readNumber(),skipWs(),r+=` `+readNumber(),skipWs(),r+=` `+readNumber(),skipWs(),r+=` `+e[n++],skipWs(),r+=` `+e[n++],skipWs(),r+=` `+readNumber(),skipWs(),r+=` `+readNumber();else r+=i,n++}return r}export{e as ADWAITA_ICON_GRID,t as DEFAULT_ICON_COLOR,n as DEFAULT_ICON_COLOR_DARK,extractIconPaths,extractPathData,normalizeArcFlags};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{ADWAITA_ICON_GRID as e,DEFAULT_ICON_COLOR as t,DEFAULT_ICON_COLOR_DARK as n,extractIconPaths as r,extractPathData as i}from"./icon-path.js";import{ImageSource as a,Screen as o}from"@nativescript/core";function renderSymbolicIcon(e,t){let n=android?.graphics,i=androidx?.core?.graphics?.PathParser;if(!n||!i)return null;let s=r(e);if(s.length===0)return null;let c=t?.size??16,l=o.mainScreen?.scale||1,u=Math.max(1,Math.round(c*l)),d=u/16,f=n.Bitmap.createBitmap(u,u,n.Bitmap.Config.ARGB_8888),p=new n.Canvas(f),m=n.Color.parseColor(t?.color??`#33333A`),h=new n.Paint;h.setAntiAlias(!0),h.setStyle(n.Paint.Style.FILL);let g=!1;for(let{d:e,opacity:t}of s){let r=i.createPathFromPathData(e);if(!r)continue;let a=new n.Matrix;a.setScale(d,d),r.transform(a),h.setColor(m),h.setAlpha(Math.round(255*t)),p.drawPath(r,h),g=!0}return g?new a(f):null}export{e as ADWAITA_ICON_GRID,t as DEFAULT_ICON_COLOR,n as DEFAULT_ICON_COLOR_DARK,r as extractIconPaths,i as extractPathData,renderSymbolicIcon};
1
+ import"../_virtual/_rolldown/runtime.js";import{ADWAITA_ICON_GRID as e,DEFAULT_ICON_COLOR as t,DEFAULT_ICON_COLOR_DARK as n,extractIconPaths as r,extractPathData as i}from"./icon-path.js";import{ImageSource as a,Screen as o}from"@nativescript/core";function renderSymbolicIcon(e,t){let n=android?.graphics,i=androidx?.core?.graphics?.PathParser;if(!n||!i)return null;let s=r(e);if(s.length===0)return null;let c=t?.size??16,l=o.mainScreen?.scale||1,u=Math.max(1,Math.round(c*l)),d=u/16,f=n.Bitmap.createBitmap(u,u,n.Bitmap.Config.ARGB_8888),p=new n.Canvas(f),m=n.Color.parseColor(t?.color??`#33333A`),h=new n.Paint;h.setAntiAlias(!0),h.setStyle(n.Paint.Style.FILL);let g=!1;for(let{d:e,opacity:t}of s){let r=null;try{r=i.createPathFromPathData(e)}catch{r=null}if(!r)continue;let a=new n.Matrix;a.setScale(d,d),r.transform(a),h.setColor(m),h.setAlpha(Math.round(255*t)),p.drawPath(r,h),g=!0}return g?new a(f):null}export{e as ADWAITA_ICON_GRID,t as DEFAULT_ICON_COLOR,n as DEFAULT_ICON_COLOR_DARK,r as extractIconPaths,i as extractPathData,renderSymbolicIcon};
@@ -34,3 +34,18 @@ export declare function extractIconPaths(svg: string): IconPath[];
34
34
  * `''` when the SVG carries no path data.
35
35
  */
36
36
  export declare function extractPathData(svg: string): string;
37
+ /**
38
+ * Space-separate the two single-digit ARC FLAGS (large-arc, sweep) in every
39
+ * elliptical-arc command (`A`/`a`) of an SVG path-data string.
40
+ *
41
+ * Android's `androidx.core.graphics.PathParser` (and `VectorDrawable`) tokenise
42
+ * arc flags as standalone numbers and THROW ("Error in parsing …") when the SVG
43
+ * compact form glues a flag to the next flag or coordinate — e.g.
44
+ * `a3 3 0 00-1.6-.1` packs `large-arc=0`, `sweep=0`, `x=-1.6`. The SVG grammar
45
+ * permits this (each flag is a single `0`/`1` digit), and many Adwaita symbolic
46
+ * icons (notably the `legacy` set) use it, so they crash the renderer. This
47
+ * re-emits each arc argument group with explicit spaces; every other command
48
+ * passes through unchanged. (Assumes the standard `x-axis-rotation 0` Adwaita
49
+ * icons use — a multi-digit rotation glued directly to the flags is not split.)
50
+ */
51
+ export declare function normalizeArcFlags(d: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/adwaita-nativescript",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "Native Adwaita widgets for the NativeScript runtime — real NativeScript components (StackLayout/GridLayout/Switch/Label) styled like Libadwaita, not a webview",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -47,9 +47,9 @@
47
47
  "design-system"
48
48
  ],
49
49
  "dependencies": {
50
- "@gjsify/adwaita-fonts": "^0.13.0",
51
- "@gjsify/adwaita-icons": "^0.13.0",
52
- "@gjsify/native-platform": "^0.13.0"
50
+ "@gjsify/adwaita-fonts": "^0.13.1",
51
+ "@gjsify/adwaita-icons": "^0.13.1",
52
+ "@gjsify/native-platform": "^0.13.1"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@nativescript/core": "*"
@@ -60,8 +60,8 @@
60
60
  }
61
61
  },
62
62
  "devDependencies": {
63
- "@gjsify/cli": "^0.13.0",
64
- "@gjsify/unit": "^0.13.0",
63
+ "@gjsify/cli": "^0.13.1",
64
+ "@gjsify/unit": "^0.13.1",
65
65
  "@types/node": "^25.9.2",
66
66
  "typescript": "^6.0.3"
67
67
  },