Socket
Socket
Sign inDemoInstall

@tsparticles/shape-image

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tsparticles/shape-image - npm Package Compare versions

Comparing version 3.0.0-beta.0 to 3.0.0-beta.1

browser/package.json

4

browser/GifUtils/Utils.js

@@ -1,3 +0,3 @@

import { InterlaceOffsets, InterlaceSteps } from "./Constants";
import { ByteStream } from "./ByteStream";
import { InterlaceOffsets, InterlaceSteps } from "./Constants.js";
import { ByteStream } from "./ByteStream.js";
function parseColorTable(byteStream, count) {

@@ -4,0 +4,0 @@ const colors = [];

import { errorPrefix } from "@tsparticles/engine";
import { replaceImageColor } from "./Utils";
import { replaceImageColor } from "./Utils.js";
export class ImageDrawer {

@@ -4,0 +4,0 @@ constructor(engine) {

@@ -1,2 +0,2 @@

import { Preload } from "./Options/Classes/Preload";
import { Preload } from "./Options/Classes/Preload.js";
export class ImagePreloaderPlugin {

@@ -3,0 +3,0 @@ constructor(engine) {

@@ -1,4 +0,4 @@

import { downloadSvgImage, loadGifImage, loadImage } from "./Utils";
import { ImageDrawer } from "./ImageDrawer";
import { ImagePreloaderPlugin } from "./ImagePreloader";
import { downloadSvgImage, loadGifImage, loadImage } from "./Utils.js";
import { ImageDrawer } from "./ImageDrawer.js";
import { ImagePreloaderPlugin } from "./ImagePreloader.js";
import { errorPrefix } from "@tsparticles/engine";

@@ -5,0 +5,0 @@ function addLoadImageToEngine(engine) {

import { errorPrefix, getLogger, getStyleFromHsl } from "@tsparticles/engine";
import { decodeGIF, getGIFLoopAmount } from "./GifUtils/Utils";
import { decodeGIF, getGIFLoopAmount } from "./GifUtils/Utils.js";
const currentColorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d.]+%?\))|currentcolor/gi;

@@ -4,0 +4,0 @@ function replaceColorSvg(imageShape, color, opacity) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.decodeGIF = exports.getGIFLoopAmount = void 0;
const Constants_1 = require("./Constants");
const ByteStream_1 = require("./ByteStream");
const Constants_js_1 = require("./Constants.js");
const ByteStream_js_1 = require("./ByteStream.js");
function parseColorTable(byteStream, count) {

@@ -115,3 +115,3 @@ const colors = [];

for (let code = 0, size = minCodeSize + 1, pos = 0, dic = [[0]], pass = 0; pass < 4; pass++) {
if (Constants_1.InterlaceOffsets[pass] < frame.height) {
if (Constants_js_1.InterlaceOffsets[pass] < frame.height) {
for (let pixelPos = 0, lineIndex = 0;;) {

@@ -137,4 +137,4 @@ const last = code;

const { r, g, b, a } = getColor(dic[code][i]);
image.data.set([r, g, b, a], Constants_1.InterlaceOffsets[pass] * frame.width +
Constants_1.InterlaceSteps[pass] * lineIndex +
image.data.set([r, g, b, a], Constants_js_1.InterlaceOffsets[pass] * frame.width +
Constants_js_1.InterlaceSteps[pass] * lineIndex +
(pixelPos % (frame.width * 4)));

@@ -149,3 +149,3 @@ pixelPos += 4;

lineIndex++;
if (Constants_1.InterlaceOffsets[pass] + Constants_1.InterlaceSteps[pass] * lineIndex >= frame.height) {
if (Constants_js_1.InterlaceOffsets[pass] + Constants_js_1.InterlaceSteps[pass] * lineIndex >= frame.height) {
break;

@@ -242,3 +242,3 @@ }

applicationExtensions: [],
}, byteStream = new ByteStream_1.ByteStream(new Uint8ClampedArray(buffer));
}, byteStream = new ByteStream_js_1.ByteStream(new Uint8ClampedArray(buffer));
if (byteStream.getString(6) !== "GIF89a") {

@@ -245,0 +245,0 @@ throw new Error("not a supported GIF file");

@@ -5,3 +5,3 @@ "use strict";

const engine_1 = require("@tsparticles/engine");
const Utils_1 = require("./Utils");
const Utils_js_1 = require("./Utils.js");
class ImageDrawer {

@@ -159,3 +159,3 @@ constructor(engine) {

if (image.svgData && color) {
imageRes = await (0, Utils_1.replaceImageColor)(image, imageData, color, particle);
imageRes = await (0, Utils_js_1.replaceImageColor)(image, imageData, color, particle);
}

@@ -162,0 +162,0 @@ else {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImagePreloaderPlugin = void 0;
const Preload_1 = require("./Options/Classes/Preload");
const Preload_js_1 = require("./Options/Classes/Preload.js");
class ImagePreloaderPlugin {

@@ -27,3 +27,3 @@ constructor(engine) {

else {
const preload = new Preload_1.Preload();
const preload = new Preload_js_1.Preload();
preload.load(item);

@@ -30,0 +30,0 @@ preloadOptions.push(preload);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadImageShape = void 0;
const Utils_1 = require("./Utils");
const ImageDrawer_1 = require("./ImageDrawer");
const ImagePreloader_1 = require("./ImagePreloader");
const Utils_js_1 = require("./Utils.js");
const ImageDrawer_js_1 = require("./ImageDrawer.js");
const ImagePreloader_js_1 = require("./ImagePreloader.js");
const engine_1 = require("@tsparticles/engine");

@@ -34,3 +34,3 @@ function addLoadImageToEngine(engine) {

engine.images.push(image);
const imageFunc = data.gif ? Utils_1.loadGifImage : data.replaceColor ? Utils_1.downloadSvgImage : Utils_1.loadImage;
const imageFunc = data.gif ? Utils_js_1.loadGifImage : data.replaceColor ? Utils_js_1.downloadSvgImage : Utils_js_1.loadImage;
await imageFunc(image);

@@ -45,6 +45,6 @@ }

addLoadImageToEngine(engine);
const preloader = new ImagePreloader_1.ImagePreloaderPlugin(engine);
const preloader = new ImagePreloader_js_1.ImagePreloaderPlugin(engine);
await engine.addPlugin(preloader, refresh);
await engine.addShape(["image", "images"], new ImageDrawer_1.ImageDrawer(engine), refresh);
await engine.addShape(["image", "images"], new ImageDrawer_js_1.ImageDrawer(engine), refresh);
}
exports.loadImageShape = loadImageShape;

@@ -5,3 +5,3 @@ "use strict";

const engine_1 = require("@tsparticles/engine");
const Utils_1 = require("./GifUtils/Utils");
const Utils_js_1 = require("./GifUtils/Utils.js");
const currentColorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d.]+%?\))|currentcolor/gi;

@@ -47,4 +47,4 @@ function replaceColorSvg(imageShape, color, opacity) {

try {
image.gifData = await (0, Utils_1.decodeGIF)(image.source);
image.gifLoopCount = (0, Utils_1.getGIFLoopAmount)(image.gifData) ?? 0;
image.gifData = await (0, Utils_js_1.decodeGIF)(image.source);
image.gifLoopCount = (0, Utils_js_1.getGIFLoopAmount)(image.gifData) ?? 0;
if (image.gifLoopCount === 0) {

@@ -51,0 +51,0 @@ image.gifLoopCount = Infinity;

@@ -1,3 +0,3 @@

import { InterlaceOffsets, InterlaceSteps } from "./Constants";
import { ByteStream } from "./ByteStream";
import { InterlaceOffsets, InterlaceSteps } from "./Constants.js";
import { ByteStream } from "./ByteStream.js";
function parseColorTable(byteStream, count) {

@@ -4,0 +4,0 @@ const colors = [];

import { errorPrefix } from "@tsparticles/engine";
import { replaceImageColor } from "./Utils";
import { replaceImageColor } from "./Utils.js";
export class ImageDrawer {

@@ -4,0 +4,0 @@ constructor(engine) {

@@ -1,2 +0,2 @@

import { Preload } from "./Options/Classes/Preload";
import { Preload } from "./Options/Classes/Preload.js";
export class ImagePreloaderPlugin {

@@ -3,0 +3,0 @@ constructor(engine) {

@@ -1,4 +0,4 @@

import { downloadSvgImage, loadGifImage, loadImage } from "./Utils";
import { ImageDrawer } from "./ImageDrawer";
import { ImagePreloaderPlugin } from "./ImagePreloader";
import { downloadSvgImage, loadGifImage, loadImage } from "./Utils.js";
import { ImageDrawer } from "./ImageDrawer.js";
import { ImagePreloaderPlugin } from "./ImagePreloader.js";
import { errorPrefix } from "@tsparticles/engine";

@@ -5,0 +5,0 @@ function addLoadImageToEngine(engine) {

import { errorPrefix, getLogger, getStyleFromHsl } from "@tsparticles/engine";
import { decodeGIF, getGIFLoopAmount } from "./GifUtils/Utils";
import { decodeGIF, getGIFLoopAmount } from "./GifUtils/Utils.js";
const currentColorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d.]+%?\))|currentcolor/gi;

@@ -4,0 +4,0 @@ function replaceColorSvg(imageShape, color, opacity) {

{
"name": "@tsparticles/shape-image",
"version": "3.0.0-beta.0",
"version": "3.0.0-beta.1",
"description": "tsParticles image shape",

@@ -43,10 +43,22 @@ "homepage": "https://particles.js.org",

},
"main": "cjs/index.js",
"sideEffects": false,
"jsdelivr": "tsparticles.shape.image.min.js",
"unpkg": "tsparticles.shape.image.min.js",
"browser": "browser/index.js",
"main": "cjs/index.js",
"module": "esm/index.js",
"types": "types/index.d.ts",
"sideEffects": false,
"exports": {
".": {
"types": "./types/index.d.ts",
"browser": "./browser/index.js",
"import": "./esm/index.js",
"require": "./cjs/index.js",
"umd": "./umd/index.js",
"default": "./cjs/index.js"
},
"./package.json": "./package.json"
},
"dependencies": {
"@tsparticles/engine": "^3.0.0-beta.0"
"@tsparticles/engine": "^3.0.0-beta.1"
},

@@ -53,0 +65,0 @@ "publishConfig": {

@@ -7,3 +7,3 @@ /*!

* How to use? : Check the GitHub README
* v3.0.0-beta.0
* v3.0.0-beta.1
*/

@@ -10,0 +10,0 @@ (function webpackUniversalModuleDefinition(root, factory) {

@@ -1,1 +0,1 @@

/*! tsParticles Image Shape v3.0.0-beta.0 by Matteo Bruni */
/*! tsParticles Image Shape v3.0.0-beta.1 by Matteo Bruni */

@@ -1,4 +0,4 @@

import type { DisposalMethod } from "../Enums/DisposalMethod";
import type { DisposalMethod } from "../Enums/DisposalMethod.js";
import type { IRgb } from "@tsparticles/engine";
import type { PlainTextData } from "./PlainTextData";
import type { PlainTextData } from "./PlainTextData.js";
export interface Frame {

@@ -5,0 +5,0 @@ GCreserved: number;

@@ -1,3 +0,3 @@

import type { ApplicationExtension } from "./ApplicationExtension";
import type { Frame } from "./Frame";
import type { ApplicationExtension } from "./ApplicationExtension.js";
import type { Frame } from "./Frame.js";
import type { IRgb } from "@tsparticles/engine";

@@ -4,0 +4,0 @@ export interface GIF {

@@ -1,4 +0,4 @@

import type { GIF } from "./Types/GIF";
import type { GIFProgressCallbackFunction } from "./Types/GIFProgressCallbackFunction";
import type { GIF } from "./Types/GIF.js";
import type { GIFProgressCallbackFunction } from "./Types/GIFProgressCallbackFunction.js";
export declare function getGIFLoopAmount(gif: GIF): number;
export declare function decodeGIF(gifURL: string, progressCallback?: GIFProgressCallbackFunction, avgAlpha?: boolean): Promise<GIF>;
import { type Container, type IDelta, type IShapeDrawer } from "@tsparticles/engine";
import type { IImage, ImageParticle } from "./Utils";
import type { ImageContainer, ImageEngine } from "./types";
import type { IImage, ImageParticle } from "./Utils.js";
import type { ImageContainer, ImageEngine } from "./types.js";
export declare class ImageDrawer implements IShapeDrawer {

@@ -5,0 +5,0 @@ private readonly _engine;

import type { Engine, IContainerPlugin, IPlugin, RecursivePartial } from "@tsparticles/engine";
import type { IPreloadOptions, PreloadOptions } from "./types";
import type { IPreloadOptions, PreloadOptions } from "./types.js";
export declare class ImagePreloaderPlugin implements IPlugin {

@@ -4,0 +4,0 @@ readonly id: string;

@@ -1,2 +0,2 @@

import type { ImageEngine } from "./types";
import type { ImageEngine } from "./types.js";
export declare function loadImageShape(engine: ImageEngine, refresh?: boolean): Promise<void>;
import type { IOptionLoader, RecursivePartial } from "@tsparticles/engine";
import type { IPreload } from "../Interfaces/IPreload";
import type { IPreload } from "../Interfaces/IPreload.js";
export declare class Preload implements IPreload, IOptionLoader<IPreload> {

@@ -4,0 +4,0 @@ gif: boolean;

import type { Container, Engine, IOptions, Options } from "@tsparticles/engine";
import type { IImage } from "./Utils";
import type { IPreload } from "./Options/Interfaces/IPreload";
import type { Preload } from "./Options/Classes/Preload";
import type { IImage } from "./Utils.js";
import type { IPreload } from "./Options/Interfaces/IPreload.js";
import type { Preload } from "./Options/Classes/Preload.js";
export type ImageEngine = Engine & {

@@ -6,0 +6,0 @@ images?: IImage[];

import { type IHsl, type Particle } from "@tsparticles/engine";
import type { GIF } from "./GifUtils/Types/GIF";
import type { IImageShape } from "./IImageShape";
import type { GIF } from "./GifUtils/Types/GIF.js";
import type { IImageShape } from "./IImageShape.js";
export interface IImage {

@@ -5,0 +5,0 @@ color?: IHsl;

@@ -7,3 +7,3 @@ (function (factory) {

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./Constants", "./ByteStream"], factory);
define(["require", "exports", "./Constants.js", "./ByteStream.js"], factory);
}

@@ -14,4 +14,4 @@ })(function (require, exports) {

exports.decodeGIF = exports.getGIFLoopAmount = void 0;
const Constants_1 = require("./Constants");
const ByteStream_1 = require("./ByteStream");
const Constants_js_1 = require("./Constants.js");
const ByteStream_js_1 = require("./ByteStream.js");
function parseColorTable(byteStream, count) {

@@ -126,3 +126,3 @@ const colors = [];

for (let code = 0, size = minCodeSize + 1, pos = 0, dic = [[0]], pass = 0; pass < 4; pass++) {
if (Constants_1.InterlaceOffsets[pass] < frame.height) {
if (Constants_js_1.InterlaceOffsets[pass] < frame.height) {
for (let pixelPos = 0, lineIndex = 0;;) {

@@ -148,4 +148,4 @@ const last = code;

const { r, g, b, a } = getColor(dic[code][i]);
image.data.set([r, g, b, a], Constants_1.InterlaceOffsets[pass] * frame.width +
Constants_1.InterlaceSteps[pass] * lineIndex +
image.data.set([r, g, b, a], Constants_js_1.InterlaceOffsets[pass] * frame.width +
Constants_js_1.InterlaceSteps[pass] * lineIndex +
(pixelPos % (frame.width * 4)));

@@ -160,3 +160,3 @@ pixelPos += 4;

lineIndex++;
if (Constants_1.InterlaceOffsets[pass] + Constants_1.InterlaceSteps[pass] * lineIndex >= frame.height) {
if (Constants_js_1.InterlaceOffsets[pass] + Constants_js_1.InterlaceSteps[pass] * lineIndex >= frame.height) {
break;

@@ -253,3 +253,3 @@ }

applicationExtensions: [],
}, byteStream = new ByteStream_1.ByteStream(new Uint8ClampedArray(buffer));
}, byteStream = new ByteStream_js_1.ByteStream(new Uint8ClampedArray(buffer));
if (byteStream.getString(6) !== "GIF89a") {

@@ -256,0 +256,0 @@ throw new Error("not a supported GIF file");

@@ -7,3 +7,3 @@ (function (factory) {

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "@tsparticles/engine", "./Utils"], factory);
define(["require", "exports", "@tsparticles/engine", "./Utils.js"], factory);
}

@@ -15,3 +15,3 @@ })(function (require, exports) {

const engine_1 = require("@tsparticles/engine");
const Utils_1 = require("./Utils");
const Utils_js_1 = require("./Utils.js");
class ImageDrawer {

@@ -169,3 +169,3 @@ constructor(engine) {

if (image.svgData && color) {
imageRes = await (0, Utils_1.replaceImageColor)(image, imageData, color, particle);
imageRes = await (0, Utils_js_1.replaceImageColor)(image, imageData, color, particle);
}

@@ -172,0 +172,0 @@ else {

@@ -7,3 +7,3 @@ (function (factory) {

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./Options/Classes/Preload"], factory);
define(["require", "exports", "./Options/Classes/Preload.js"], factory);
}

@@ -14,3 +14,3 @@ })(function (require, exports) {

exports.ImagePreloaderPlugin = void 0;
const Preload_1 = require("./Options/Classes/Preload");
const Preload_js_1 = require("./Options/Classes/Preload.js");
class ImagePreloaderPlugin {

@@ -38,3 +38,3 @@ constructor(engine) {

else {
const preload = new Preload_1.Preload();
const preload = new Preload_js_1.Preload();
preload.load(item);

@@ -41,0 +41,0 @@ preloadOptions.push(preload);

@@ -7,3 +7,3 @@ (function (factory) {

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./Utils", "./ImageDrawer", "./ImagePreloader", "@tsparticles/engine"], factory);
define(["require", "exports", "./Utils.js", "./ImageDrawer.js", "./ImagePreloader.js", "@tsparticles/engine"], factory);
}

@@ -14,5 +14,5 @@ })(function (require, exports) {

exports.loadImageShape = void 0;
const Utils_1 = require("./Utils");
const ImageDrawer_1 = require("./ImageDrawer");
const ImagePreloader_1 = require("./ImagePreloader");
const Utils_js_1 = require("./Utils.js");
const ImageDrawer_js_1 = require("./ImageDrawer.js");
const ImagePreloader_js_1 = require("./ImagePreloader.js");
const engine_1 = require("@tsparticles/engine");

@@ -45,3 +45,3 @@ function addLoadImageToEngine(engine) {

engine.images.push(image);
const imageFunc = data.gif ? Utils_1.loadGifImage : data.replaceColor ? Utils_1.downloadSvgImage : Utils_1.loadImage;
const imageFunc = data.gif ? Utils_js_1.loadGifImage : data.replaceColor ? Utils_js_1.downloadSvgImage : Utils_js_1.loadImage;
await imageFunc(image);

@@ -56,7 +56,7 @@ }

addLoadImageToEngine(engine);
const preloader = new ImagePreloader_1.ImagePreloaderPlugin(engine);
const preloader = new ImagePreloader_js_1.ImagePreloaderPlugin(engine);
await engine.addPlugin(preloader, refresh);
await engine.addShape(["image", "images"], new ImageDrawer_1.ImageDrawer(engine), refresh);
await engine.addShape(["image", "images"], new ImageDrawer_js_1.ImageDrawer(engine), refresh);
}
exports.loadImageShape = loadImageShape;
});

@@ -7,3 +7,3 @@ (function (factory) {

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "@tsparticles/engine", "./GifUtils/Utils"], factory);
define(["require", "exports", "@tsparticles/engine", "./GifUtils/Utils.js"], factory);
}

@@ -15,3 +15,3 @@ })(function (require, exports) {

const engine_1 = require("@tsparticles/engine");
const Utils_1 = require("./GifUtils/Utils");
const Utils_js_1 = require("./GifUtils/Utils.js");
const currentColorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d.]+%?\))|currentcolor/gi;

@@ -57,4 +57,4 @@ function replaceColorSvg(imageShape, color, opacity) {

try {
image.gifData = await (0, Utils_1.decodeGIF)(image.source);
image.gifLoopCount = (0, Utils_1.getGIFLoopAmount)(image.gifData) ?? 0;
image.gifData = await (0, Utils_js_1.decodeGIF)(image.source);
image.gifLoopCount = (0, Utils_js_1.getGIFLoopAmount)(image.gifData) ?? 0;
if (image.gifLoopCount === 0) {

@@ -61,0 +61,0 @@ image.gifLoopCount = Infinity;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc