@pixerate/editor 0.100.0 → 0.102.0

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 (39) hide show
  1. package/THIRD_PARTY_NOTICES.md +5 -0
  2. package/dist/animation-editor/index.cjs +39 -39
  3. package/dist/animation-editor/index.d.cts +1 -1
  4. package/dist/animation-editor/index.d.ts +1 -1
  5. package/dist/animation-editor/index.js +1 -1
  6. package/dist/{chunk-YGZNGDIT.js → chunk-63EFQCT5.js} +807 -73
  7. package/dist/chunk-63EFQCT5.js.map +1 -0
  8. package/dist/{chunk-WIR377F6.js → chunk-67FRIOPZ.js} +15 -12
  9. package/dist/chunk-67FRIOPZ.js.map +1 -0
  10. package/dist/{chunk-JF5PXN7W.cjs → chunk-KANRAHTL.cjs} +838 -104
  11. package/dist/chunk-KANRAHTL.cjs.map +1 -0
  12. package/dist/{chunk-WT6ZAWJP.cjs → chunk-WSTEXEKD.cjs} +27 -24
  13. package/dist/chunk-WSTEXEKD.cjs.map +1 -0
  14. package/dist/image-editor/index.cjs +2843 -1050
  15. package/dist/image-editor/index.cjs.map +1 -1
  16. package/dist/image-editor/index.d.cts +644 -16
  17. package/dist/image-editor/index.d.ts +644 -16
  18. package/dist/image-editor/index.js +2487 -694
  19. package/dist/image-editor/index.js.map +1 -1
  20. package/dist/raster/index.cjs +2 -2
  21. package/dist/raster/index.d.cts +99 -91
  22. package/dist/raster/index.d.ts +99 -91
  23. package/dist/raster/index.js +1 -1
  24. package/dist/{svg-C9r284x8.d.cts → svg-Bj1MQFh6.d.cts} +395 -2
  25. package/dist/{svg-MVKBqwD4.d.ts → svg-vme0PLNo.d.ts} +395 -2
  26. package/dist/vector/index.cjs +1352 -584
  27. package/dist/vector/index.cjs.map +1 -1
  28. package/dist/vector/index.d.cts +302 -197
  29. package/dist/vector/index.d.ts +302 -197
  30. package/dist/vector/index.js +854 -86
  31. package/dist/vector/index.js.map +1 -1
  32. package/package.json +1 -1
  33. package/skills/pixerate-image-editor/SKILL.md +69 -11
  34. package/skills/pixerate-vector/SKILL.md +52 -2
  35. package/skills/pixerate-vector/references/commands.md +21 -0
  36. package/dist/chunk-JF5PXN7W.cjs.map +0 -1
  37. package/dist/chunk-WIR377F6.js.map +0 -1
  38. package/dist/chunk-WT6ZAWJP.cjs.map +0 -1
  39. package/dist/chunk-YGZNGDIT.js.map +0 -1
@@ -2170,7 +2170,6 @@ function lerpTile(dst, before, alpha, coverage) {
2170
2170
  }
2171
2171
  var ZERO_TILE = new Uint8ClampedArray(TILE_BYTES);
2172
2172
  var isGroup = (l) => l.type === "group";
2173
- var isPixel = (l) => l.type === "pixel";
2174
2173
  var RasterCompositor = (_class = class {
2175
2174
  constructor(profile = {}, options = {}) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);_class.prototype.__init9.call(this);_class.prototype.__init10.call(this);_class.prototype.__init11.call(this);_class.prototype.__init12.call(this);_class.prototype.__init13.call(this);_class.prototype.__init14.call(this);_class.prototype.__init15.call(this);_class.prototype.__init16.call(this);_class.prototype.__init17.call(this);_class.prototype.__init18.call(this);_class.prototype.__init19.call(this);_class.prototype.__init20.call(this);_class.prototype.__init21.call(this);
2176
2175
  this.profile = profile;
@@ -2285,8 +2284,12 @@ var RasterCompositor = (_class = class {
2285
2284
  return this.maskTile(layer, r);
2286
2285
  }
2287
2286
  // --- Steps -------------------------------------------------------------------
2287
+ /** Pixel layers, and the layer kinds the profile composites like them. */
2288
+ isPixel(l) {
2289
+ return l.type === "pixel" || (_nullishCoalesce(_optionalChain([this, 'access', _10 => _10.profile, 'access', _11 => _11.isPixelLike, 'optionalCall', _12 => _12(l)]), () => ( false)));
2290
+ }
2288
2291
  isFilter(l) {
2289
- return _nullishCoalesce(_optionalChain([this, 'access', _10 => _10.profile, 'access', _11 => _11.isFilterLayer, 'optionalCall', _12 => _12(l)]), () => ( false));
2292
+ return _nullishCoalesce(_optionalChain([this, 'access', _13 => _13.profile, 'access', _14 => _14.isFilterLayer, 'optionalCall', _15 => _15(l)]), () => ( false));
2290
2293
  }
2291
2294
  /**
2292
2295
  * Groups a layer list into compositing steps: clipped layers join the nearest unclipped
@@ -2325,9 +2328,9 @@ var RasterCompositor = (_class = class {
2325
2328
  if (key !== void 0) return key;
2326
2329
  const mask = layer.mask ? [layer.mask.enabled !== false, _nullishCoalesce(layer.mask.density, () => ( 1)), _nullishCoalesce(layer.mask.feather, () => ( 0)), layer.mask.defaultValue, _nullishCoalesce(layer.mask.source, () => ( null))] : null;
2327
2330
  const base = [layer.type, layer.id, layer.visible, layer.opacity, layer.blend, Boolean(layer.clipped), mask];
2328
- if (isPixel(layer)) base.push(_nullishCoalesce(_optionalChain([layer, 'access', _13 => _13.offset, 'optionalAccess', _14 => _14.x]), () => ( 0)), _nullishCoalesce(_optionalChain([layer, 'access', _15 => _15.offset, 'optionalAccess', _16 => _16.y]), () => ( 0)), _nullishCoalesce(layer.fillOpacity, () => ( 1)));
2331
+ if (this.isPixel(layer)) base.push(_nullishCoalesce(_optionalChain([layer, 'access', _16 => _16.offset, 'optionalAccess', _17 => _17.x]), () => ( 0)), _nullishCoalesce(_optionalChain([layer, 'access', _18 => _18.offset, 'optionalAccess', _19 => _19.y]), () => ( 0)), _nullishCoalesce(layer.fillOpacity, () => ( 1)));
2329
2332
  if (this.hasEffects(layer)) base.push(effectsFingerprint(layer.effects));
2330
- const extra = _optionalChain([this, 'access', _17 => _17.profile, 'access', _18 => _18.layerKey, 'optionalCall', _19 => _19(layer)]);
2333
+ const extra = _optionalChain([this, 'access', _20 => _20.profile, 'access', _21 => _21.layerKey, 'optionalCall', _22 => _22(layer)]);
2331
2334
  if (extra !== void 0) base.push(extra);
2332
2335
  key = JSON.stringify(base);
2333
2336
  this.propsKeyCache.set(layer, key);
@@ -2489,12 +2492,12 @@ var RasterCompositor = (_class = class {
2489
2492
  plainContentSig(layer, tx, ty) {
2490
2493
  const key = "C" + this.propsKey(layer);
2491
2494
  if (!layer.visible) return { key, refs: [] };
2492
- if (!isPixel(layer)) return { key, refs: this.maskRefs(layer, tx, ty, 0, 0) };
2495
+ if (!this.isPixel(layer)) return { key, refs: this.maskRefs(layer, tx, ty, 0, 0) };
2493
2496
  const { surface, dx, dy } = this.layerPixels(layer);
2494
2497
  const refs = [surface.defaultValue];
2495
2498
  const r = { x: tx * _chunkCRMAXIUVcjs.TILE - dx, y: ty * _chunkCRMAXIUVcjs.TILE - dy, width: _chunkCRMAXIUVcjs.TILE, height: _chunkCRMAXIUVcjs.TILE };
2496
2499
  for (const t of _chunkCRMAXIUVcjs.tilesInRect.call(void 0, r)) refs.push(_nullishCoalesce(surface.getTile(t.tx, t.ty), () => ( null)));
2497
- refs.push(...this.maskRefs(layer, tx, ty, _nullishCoalesce(_optionalChain([layer, 'access', _20 => _20.offset, 'optionalAccess', _21 => _21.x]), () => ( 0)), _nullishCoalesce(_optionalChain([layer, 'access', _22 => _22.offset, 'optionalAccess', _23 => _23.y]), () => ( 0))));
2500
+ refs.push(...this.maskRefs(layer, tx, ty, _nullishCoalesce(_optionalChain([layer, 'access', _23 => _23.offset, 'optionalAccess', _24 => _24.x]), () => ( 0)), _nullishCoalesce(_optionalChain([layer, 'access', _25 => _25.offset, 'optionalAccess', _26 => _26.y]), () => ( 0))));
2498
2501
  return { key, refs };
2499
2502
  }
2500
2503
  // --- Layer effects ------------------------------------------------------------
@@ -2524,7 +2527,7 @@ var RasterCompositor = (_class = class {
2524
2527
  this.fxContext = {
2525
2528
  light: _nullishCoalesce(sources.globalLight, () => ( DEFAULT_GLOBAL_LIGHT)),
2526
2529
  pattern: (id) => {
2527
- const p = _nullishCoalesce(_optionalChain([sources, 'access', _24 => _24.pattern, 'optionalCall', _25 => _25(id)]), () => ( builtinPattern(id)));
2530
+ const p = _nullishCoalesce(_optionalChain([sources, 'access', _27 => _27.pattern, 'optionalCall', _28 => _28(id)]), () => ( builtinPattern(id)));
2528
2531
  if (!p || !(p.width > 0 && p.height > 0) || p.data.length < p.width * p.height * 4) return null;
2529
2532
  let t = tiles.get(p);
2530
2533
  if (!t) {
@@ -2543,7 +2546,7 @@ var RasterCompositor = (_class = class {
2543
2546
  effectRegion(layer) {
2544
2547
  const m = effectsMargin(layer.effects);
2545
2548
  const canvas = { x: -m, y: -m, width: this.sources.width + 2 * m, height: this.sources.height + 2 * m };
2546
- if (!isPixel(layer)) return canvas;
2549
+ if (!this.isPixel(layer)) return canvas;
2547
2550
  const { surface, dx, dy } = this.layerPixels(layer);
2548
2551
  if (surface.defaultValue !== 0) return canvas;
2549
2552
  const b = surface.bounds;
@@ -2652,7 +2655,7 @@ var RasterCompositor = (_class = class {
2652
2655
  * without filters or a feathered or parametric mask (those spread a change beyond it).
2653
2656
  */
2654
2657
  dirtyCoversShape(layer) {
2655
- if (!isPixel(layer) || _optionalChain([this, 'access', _26 => _26.profile, 'access', _27 => _27.pixelFilters, 'optionalCall', _28 => _28(layer)])) return false;
2658
+ if (!this.isPixel(layer) || _optionalChain([this, 'access', _29 => _29.profile, 'access', _30 => _30.pixelFilters, 'optionalCall', _31 => _31(layer)])) return false;
2656
2659
  const mask = layer.mask;
2657
2660
  return !mask || mask.enabled === false || !mask.source && !((_nullishCoalesce(mask.feather, () => ( 0))) > 0);
2658
2661
  }
@@ -2711,7 +2714,7 @@ var RasterCompositor = (_class = class {
2711
2714
  maps,
2712
2715
  blend: blend2,
2713
2716
  opacity: layer.opacity,
2714
- fillOpacity: isPixel(layer) ? _nullishCoalesce(layer.fillOpacity, () => ( 1)) : 1,
2717
+ fillOpacity: this.isPixel(layer) ? _nullishCoalesce(layer.fillOpacity, () => ( 1)) : 1,
2715
2718
  canvas: { x: 0, y: 0, width: this.sources.width, height: this.sources.height },
2716
2719
  ctx: this.effectContext()
2717
2720
  });
@@ -2740,10 +2743,10 @@ var RasterCompositor = (_class = class {
2740
2743
  */
2741
2744
  layerPixels(layer) {
2742
2745
  const raw = this.sources.surfaceOf ? this.sources.surfaceOf(layer) : layer.surface;
2743
- const ox = _nullishCoalesce(_optionalChain([layer, 'access', _29 => _29.offset, 'optionalAccess', _30 => _30.x]), () => ( 0));
2744
- const oy = _nullishCoalesce(_optionalChain([layer, 'access', _31 => _31.offset, 'optionalAccess', _32 => _32.y]), () => ( 0));
2745
- const filters = _nullishCoalesce(_optionalChain([this, 'access', _33 => _33.profile, 'access', _34 => _34.pixelFilters, 'optionalCall', _35 => _35(layer)]), () => ( null));
2746
- if (!_optionalChain([filters, 'optionalAccess', _36 => _36.spatial])) return { surface: raw, dx: ox, dy: oy, perPixel: filters };
2746
+ const ox = _nullishCoalesce(_optionalChain([layer, 'access', _32 => _32.offset, 'optionalAccess', _33 => _33.x]), () => ( 0));
2747
+ const oy = _nullishCoalesce(_optionalChain([layer, 'access', _34 => _34.offset, 'optionalAccess', _35 => _35.y]), () => ( 0));
2748
+ const filters = _nullishCoalesce(_optionalChain([this, 'access', _36 => _36.profile, 'access', _37 => _37.pixelFilters, 'optionalCall', _38 => _38(layer)]), () => ( null));
2749
+ if (!_optionalChain([filters, 'optionalAccess', _39 => _39.spatial])) return { surface: raw, dx: ox, dy: oy, perPixel: filters };
2747
2750
  const fkey = `${ox},${oy}:${filters.key}`;
2748
2751
  let byKey = this.filteredCache.get(raw);
2749
2752
  if (!byKey) {
@@ -2760,7 +2763,7 @@ var RasterCompositor = (_class = class {
2760
2763
  }
2761
2764
  /** RGBA of a content layer over `r` (document space, inside one tile), or `null` when it has nothing there. */
2762
2765
  contentTile(layer, r) {
2763
- if (!isPixel(layer)) return _nullishCoalesce(_optionalChain([this, 'access', _37 => _37.profile, 'access', _38 => _38.contentTile, 'optionalCall', _39 => _39(layer, r, this.sources)]), () => ( null));
2766
+ if (!this.isPixel(layer)) return _nullishCoalesce(_optionalChain([this, 'access', _40 => _40.profile, 'access', _41 => _41.contentTile, 'optionalCall', _42 => _42(layer, r, this.sources)]), () => ( null));
2764
2767
  const { surface, dx, dy, perPixel } = this.layerPixels(layer);
2765
2768
  const src = { x: r.x - dx, y: r.y - dy, width: r.width, height: r.height };
2766
2769
  const covered = _chunkCRMAXIUVcjs.tilesInRect.call(void 0, src).map((t) => surface.getTile(t.tx, t.ty));
@@ -2775,7 +2778,7 @@ var RasterCompositor = (_class = class {
2775
2778
  let byKey = this.contentCache.get(anchor);
2776
2779
  const refsKey = `${r.x},${r.y}:${fkey}`;
2777
2780
  if (aligned) {
2778
- const hit = _optionalChain([byKey, 'optionalAccess', _40 => _40.get, 'call', _41 => _41(refsKey)]);
2781
+ const hit = _optionalChain([byKey, 'optionalAccess', _43 => _43.get, 'call', _44 => _44(refsKey)]);
2779
2782
  if (hit) return hit;
2780
2783
  }
2781
2784
  const data = _chunkCRMAXIUVcjs.readRegion.call(void 0, surface, src);
@@ -2813,7 +2816,7 @@ var RasterCompositor = (_class = class {
2813
2816
  const H = this.sources.height;
2814
2817
  let v = new Float32Array(W * H);
2815
2818
  if (mask.source) {
2816
- const generated = _nullishCoalesce(_optionalChain([this, 'access', _42 => _42.profile, 'access', _43 => _43.maskSourcePlane, 'optionalCall', _44 => _44(mask.source, W, H, this.sources)]), () => ( null));
2819
+ const generated = _nullishCoalesce(_optionalChain([this, 'access', _45 => _45.profile, 'access', _46 => _46.maskSourcePlane, 'optionalCall', _47 => _47(mask.source, W, H, this.sources)]), () => ( null));
2817
2820
  if (!generated || generated.length !== W * H) v.fill(1);
2818
2821
  else v.set(generated);
2819
2822
  } else {
@@ -2832,8 +2835,8 @@ var RasterCompositor = (_class = class {
2832
2835
  maskTile(layer, r) {
2833
2836
  const mask = layer.mask;
2834
2837
  if (!mask || mask.enabled === false) return null;
2835
- const ox = isPixel(layer) ? _nullishCoalesce(_optionalChain([layer, 'access', _45 => _45.offset, 'optionalAccess', _46 => _46.x]), () => ( 0)) : 0;
2836
- const oy = isPixel(layer) ? _nullishCoalesce(_optionalChain([layer, 'access', _47 => _47.offset, 'optionalAccess', _48 => _48.y]), () => ( 0)) : 0;
2838
+ const ox = this.isPixel(layer) ? _nullishCoalesce(_optionalChain([layer, 'access', _48 => _48.offset, 'optionalAccess', _49 => _49.x]), () => ( 0)) : 0;
2839
+ const oy = this.isPixel(layer) ? _nullishCoalesce(_optionalChain([layer, 'access', _50 => _50.offset, 'optionalAccess', _51 => _51.y]), () => ( 0)) : 0;
2837
2840
  const n = r.width * r.height;
2838
2841
  const out = new Float32Array(n);
2839
2842
  const density = _nullishCoalesce(mask.density, () => ( 1));
@@ -2894,7 +2897,7 @@ var RasterCompositor = (_class = class {
2894
2897
  }
2895
2898
  const content = this.contentTile(step.layer, r);
2896
2899
  if (!content) return empty;
2897
- const fill2 = isPixel(step.layer) ? _nullishCoalesce(step.layer.fillOpacity, () => ( 1)) : 1;
2900
+ const fill2 = this.isPixel(step.layer) ? _nullishCoalesce(step.layer.fillOpacity, () => ( 1)) : 1;
2898
2901
  const blend2 = this.contentBlend(step.layer);
2899
2902
  if (!clipped.length) return this.blendOnto(acc, content, empty, blend2, layer.opacity * fill2, coverage);
2900
2903
  const buf = new Uint8ClampedArray(acc.length);
@@ -2907,7 +2910,7 @@ var RasterCompositor = (_class = class {
2907
2910
  return empty;
2908
2911
  }
2909
2912
  contentBlend(layer) {
2910
- return _nullishCoalesce(_optionalChain([this, 'access', _49 => _49.profile, 'access', _50 => _50.contentBlend, 'optionalCall', _51 => _51(layer)]), () => ( layer.blend));
2913
+ return _nullishCoalesce(_optionalChain([this, 'access', _52 => _52.profile, 'access', _53 => _53.contentBlend, 'optionalCall', _54 => _54(layer)]), () => ( layer.blend));
2911
2914
  }
2912
2915
  blendOnto(acc, src, empty, mode, alpha, coverage) {
2913
2916
  if (!(alpha > 0)) return empty;
@@ -2944,7 +2947,7 @@ var RasterCompositor = (_class = class {
2944
2947
  }
2945
2948
  const content = this.contentTile(c, r);
2946
2949
  if (!content) continue;
2947
- const fill2 = isPixel(c) ? _nullishCoalesce(c.fillOpacity, () => ( 1)) : 1;
2950
+ const fill2 = this.isPixel(c) ? _nullishCoalesce(c.fillOpacity, () => ( 1)) : 1;
2948
2951
  blendAtop(buf, content, this.contentBlend(c), c.opacity * fill2, coverage);
2949
2952
  }
2950
2953
  flush();
@@ -2961,7 +2964,7 @@ var RasterCompositor = (_class = class {
2961
2964
  }
2962
2965
  visible.push(node);
2963
2966
  }
2964
- if (visible.length) _optionalChain([this, 'access', _52 => _52.profile, 'access', _53 => _53.applyFilterRun, 'optionalCall', _54 => _54(visible, acc, r, masks, this.sources)]);
2967
+ if (visible.length) _optionalChain([this, 'access', _55 => _55.profile, 'access', _56 => _56.applyFilterRun, 'optionalCall', _57 => _57(visible, acc, r, masks, this.sources)]);
2965
2968
  }
2966
2969
  }, _class);
2967
2970
  function filterOverCanvas(surface, ox, oy, filters, width, height) {
@@ -4649,4 +4652,4 @@ function pngDataUrl(width, height, data, channels = 4) {
4649
4652
 
4650
4653
 
4651
4654
  exports.DIRECT_GAUSSIAN_MAX_SIGMA = DIRECT_GAUSSIAN_MAX_SIGMA; exports.gaussianBlur = gaussianBlur; exports.flattenLayers = flattenLayers; exports.findLayer = findLayer; exports.mapLayer = mapLayer; exports.insertLayer = insertLayer; exports.isLayerLocked = isLayerLocked; exports.DEFAULT_GLOBAL_LIGHT = DEFAULT_GLOBAL_LIGHT; exports.LAYER_EFFECT_KINDS = LAYER_EFFECT_KINDS; exports.layerEffectLabel = layerEffectLabel; exports.isLayerEffectKind = isLayerEffectKind; exports.defaultEffectGradient = defaultEffectGradient; exports.newEffectId = newEffectId; exports.defaultLayerEffect = defaultLayerEffect; exports.hasActiveEffects = hasActiveEffects; exports.MAX_EFFECT_REACH = MAX_EFFECT_REACH; exports.effectReach = effectReach; exports.effectsMargin = effectsMargin; exports.effectsScale = effectsScale; exports.scaleLayerEffect = scaleLayerEffect; exports.parseEffectColor = parseEffectColor; exports.effectColorHex = effectColorHex; exports.LayerEffectError = LayerEffectError; exports.validateEffectGradient = validateEffectGradient; exports.layerEffectFields = layerEffectFields; exports.validateLayerEffect = validateLayerEffect; exports.mergeLayerEffect = mergeLayerEffect; exports.validateLayerEffects = validateLayerEffects; exports.normalizeLayerEffects = normalizeLayerEffects; exports.effectsFingerprint = effectsFingerprint; exports.PatternTile = PatternTile; exports.PatternPlacement = PatternPlacement; exports.builtinPatternIds = builtinPatternIds; exports.builtinPattern = builtinPattern; exports.hashNoise = hashNoise; exports.CURVE_LUT_SIZE = CURVE_LUT_SIZE; exports.curveLut = curveLut; exports.STROKE_CHAMFER_MAX = STROKE_CHAMFER_MAX; exports.contourLut = contourLut; exports.activeEffectItems = activeEffectItems; exports.effectsAreLocal = effectsAreLocal; exports.buildEffectMaps = buildEffectMaps; exports.patchEffectMaps = patchEffectMaps; exports.gradientT = gradientT; exports.compositeLayerEffects = compositeLayerEffects; exports.renderLayerEffects = renderLayerEffects; exports.blendTile = blendTile; exports.RasterCompositor = RasterCompositor; exports.changedTiles = changedTiles; exports.INTERPOLATIONS = INTERPOLATIONS; exports.isInterpolation = isInterpolation; exports.MAX_TRANSFORM_PIXELS = MAX_TRANSFORM_PIXELS; exports.TransformTooLargeError = TransformTooLargeError; exports.keysWeight = keysWeight; exports.reduceSurface = reduceSurface; exports.transformedBounds = transformedBounds; exports.transformSurface = transformSurface; exports.warpSurface = warpSurface; exports.compositeSurfaceOver = compositeSurfaceOver; exports.ZlibError = ZlibError; exports.inflateRaw = inflateRaw; exports.adler32 = adler32; exports.inflate = inflate; exports.deflateRaw = deflateRaw; exports.deflate = deflate; exports.encodePng = encodePng; exports.isPng = isPng; exports.decodePng = decodePng; exports.bytesToBase64 = bytesToBase64; exports.base64ToBytes = base64ToBytes; exports.parseDataUrl = parseDataUrl; exports.pngDataUrl = pngDataUrl;
4652
- //# sourceMappingURL=chunk-WT6ZAWJP.cjs.map
4655
+ //# sourceMappingURL=chunk-WSTEXEKD.cjs.map