fresnel-icon 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. package/dist/cli.js +17 -8
  2. package/package.json +3 -3
package/dist/cli.js CHANGED
@@ -1051,6 +1051,11 @@ function addLayer(doc, groupId, asset, opts = {}) {
1051
1051
  return l;
1052
1052
  }
1053
1053
  function setProp(doc, ref, key, value, appearance, detached) {
1054
+ const old = key === "image-name" && !detached && ref.kind === "layer" ? imagesOf([findLayer(doc, ref.id)?.layer].filter((l) => !!l)) : null;
1055
+ setPropRaw(doc, ref, key, value, appearance, detached);
1056
+ if (old?.size) pruneAssets(doc, old);
1057
+ }
1058
+ function setPropRaw(doc, ref, key, value, appearance, detached) {
1054
1059
  const node = detached ? { kind: "layer", props: detached.props } : nodeOf(doc, ref);
1055
1060
  if (key === "layers" || key === "groups") throw new OpError(`"${key}" can't be set directly`);
1056
1061
  if (key.endsWith("-specializations")) throw new OpError(`Set "${key.replace(/-specializations$/, "")}" with an appearance instead`);
@@ -1849,7 +1854,7 @@ function renderSvg(doc, opts = {}) {
1849
1854
  let darken = 0;
1850
1855
  if (dark && !darkOverridden && bgFill !== "automatic" && bgFill !== "system-dark" && bgFill !== "none") darken = 0.62;
1851
1856
  let bgPaint;
1852
- const P = mask === "circle" || ctx.idiom === "watchOS" ? 32 : 0;
1857
+ const P = mask === "circle" || mask === "none" && ctx.idiom === "watchOS" ? 32 : 0;
1853
1858
  const full = { x: -P, y: -P, w: C2 + 2 * P, h: C2 + 2 * P };
1854
1859
  const monoOverride = (isClear || isTinted) && !!fillProp?.specs?.some((s) => s.appearance === "tinted" && forPlatform(s));
1855
1860
  if (monoOverride) {
@@ -1899,6 +1904,10 @@ function renderSvg(doc, opts = {}) {
1899
1904
  const gs = gp?.scale ?? 1;
1900
1905
  const gtx = gp?.tx ?? 0;
1901
1906
  const gty = gp?.ty ?? 0;
1907
+ const gx0 = H2 + (-PAD - H2 - gtx) / gs;
1908
+ const gy0 = H2 + (-PAD - H2 - gty) / gs;
1909
+ const gw = (C2 + 2 * PAD) / gs;
1910
+ const localRegion = `x="${n(gx0)}" y="${n(gy0)}" width="${n(gw)}" height="${n(gw)}"`;
1902
1911
  const layers = FRONT_FIRST ? [...g.layers].reverse() : [...g.layers];
1903
1912
  const placed = [];
1904
1913
  for (const l of layers) {
@@ -1947,7 +1956,7 @@ function renderSvg(doc, opts = {}) {
1947
1956
  let el;
1948
1957
  if (paint) {
1949
1958
  const mid = defs.id("lm");
1950
- defs.add(`<mask id="${mid}" mask-type="alpha" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="${-PAD}" y="${-PAD}" width="${C2 + 2 * PAD}" height="${C2 + 2 * PAD}"><use href="#${iid}" ${place}/></mask>`);
1959
+ defs.add(`<mask id="${mid}" mask-type="alpha" style="mask-type:alpha" maskUnits="userSpaceOnUse" ${localRegion}><use href="#${iid}" ${place}/></mask>`);
1951
1960
  el = `<rect x="${n(p.x)}" y="${n(p.y)}" width="${n(p.w)}" height="${n(p.h)}" fill="${paint}" mask="url(#${mid})"/>`;
1952
1961
  } else {
1953
1962
  el = `<use href="#${iid}" ${place}/>`;
@@ -1961,9 +1970,7 @@ function renderSvg(doc, opts = {}) {
1961
1970
  }
1962
1971
  const gTransform = gp ? ` transform="translate(${n(H2 + gtx)} ${n(H2 + gty)}) scale(${n(gs)}) translate(${-H2} ${-H2})"` : "";
1963
1972
  const canvasRegion = `filterUnits="userSpaceOnUse" x="${-PAD}" y="${-PAD}" width="${C2 + 2 * PAD}" height="${C2 + 2 * PAD}"`;
1964
- const gx0 = H2 + (-PAD - H2 - gtx) / gs;
1965
- const gy0 = H2 + (-PAD - H2 - gty) / gs;
1966
- const groupRegion = `filterUnits="userSpaceOnUse" x="${n(gx0)}" y="${n(gy0)}" width="${n((C2 + 2 * PAD) / gs)}" height="${n((C2 + 2 * PAD) / gs)}"`;
1973
+ const groupRegion = `filterUnits="userSpaceOnUse" ${localRegion}`;
1967
1974
  const contentId = defs.id("gc");
1968
1975
  defs.add(`<g id="${contentId}"${gTransform}>${layerEls.join("")}</g>`);
1969
1976
  contentIds.push(contentId);
@@ -2075,7 +2082,7 @@ function renderSvg(doc, opts = {}) {
2075
2082
  if (M > 0) {
2076
2083
  const sid = defs.id("ish");
2077
2084
  defs.add(
2078
- `<filter id="${sid}" ${'filterUnits="userSpaceOnUse"'} x="${-PAD}" y="${-PAD}" width="${C2 + 2 * PAD}" height="${C2 + 2 * PAD}"><feGaussianBlur in="SourceAlpha" stdDeviation="${n(C2 * 0.012)}"/><feOffset dy="${n(C2 * 0.012)}" result="b"/><feFlood flood-color="#000" flood-opacity="0.3"/><feComposite in2="b" operator="in" result="s"/><feMerge><feMergeNode in="s"/><feMergeNode in="SourceGraphic"/></feMerge></filter>`
2085
+ `<filter id="${sid}" filterUnits="userSpaceOnUse" x="${-(M + 64)}" y="${-(M + 64)}" width="${C2 + 2 * (M + 64)}" height="${C2 + 2 * (M + 64)}"><feGaussianBlur in="SourceAlpha" stdDeviation="${n(C2 * 0.012)}"/><feOffset dy="${n(C2 * 0.012)}" result="b"/><feFlood flood-color="#000" flood-opacity="0.3"/><feComposite in2="b" operator="in" result="s"/><feMerge><feMergeNode in="s"/><feMergeNode in="SourceGraphic"/></feMerge></filter>`
2079
2086
  );
2080
2087
  body.push(`<g filter="url(#${sid})"><g clip-path="url(#${clipId})">${top}</g></g>`);
2081
2088
  } else body.push(`<g clip-path="url(#${clipId})">${top}</g>`);
@@ -2935,7 +2942,7 @@ async function runTool(ws, t, args) {
2935
2942
  }
2936
2943
 
2937
2944
  // ../mcp/src/version.ts
2938
- var VERSION = "0.2.1";
2945
+ var VERSION = "0.2.2";
2939
2946
 
2940
2947
  // ../mcp/src/contract.ts
2941
2948
  var RESOURCES = [
@@ -3204,7 +3211,9 @@ var Workspace = class {
3204
3211
  const full = suffix ? resolve2(real, suffix) : real;
3205
3212
  if (suffix) {
3206
3213
  const first = resolve2(real, suffix.split(sep3)[0]);
3207
- if (await lstat2(first).then(() => true, () => false)) throw new Error(`Access denied: ${p} goes through a symbolic link that points nowhere`);
3214
+ const st = await lstat2(first).catch(() => null);
3215
+ if (st?.isSymbolicLink()) throw new Error(`Access denied: ${p} goes through a symbolic link that points nowhere`);
3216
+ if (st) throw new Error(`Invalid path: ${p} (${suffix.split(sep3)[0]} is not a folder)`);
3208
3217
  }
3209
3218
  if (!await this.allowed(full)) throw new Error(`Access denied: ${p} is outside the allowed roots (${this.roots.join(", ")})`);
3210
3219
  if (opts.mustExist && full !== real) throw new Error(`Not found: ${p}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fresnel-icon",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "fresnel CLI: build, validate, render and export Liquid Glass app icons (.icon bundles) from the command line or CI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -38,8 +38,8 @@
38
38
  "devDependencies": {
39
39
  "tsup": "9.0.0",
40
40
  "tsx": "4.23.15",
41
- "@fresnel/core": "0.2.1",
42
- "@fresnel/render": "0.2.1"
41
+ "@fresnel/core": "0.2.2",
42
+ "@fresnel/render": "0.2.2"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "tsup",