tsparticles-interaction-external-push
Advanced tools
Comparing version 2.9.3 to 2.10.0
@@ -0,1 +1,2 @@ | ||
import { setRangeValue } from "tsparticles-engine"; | ||
export class Push { | ||
@@ -11,6 +12,5 @@ constructor() { | ||
set particles_nb(value) { | ||
this.quantity = value; | ||
this.quantity = setRangeValue(value); | ||
} | ||
load(data) { | ||
var _a; | ||
if (!data) { | ||
@@ -28,7 +28,7 @@ return; | ||
} | ||
const quantity = (_a = data.quantity) !== null && _a !== void 0 ? _a : data.particles_nb; | ||
const quantity = data.quantity ?? data.particles_nb; | ||
if (quantity !== undefined) { | ||
this.quantity = quantity; | ||
this.quantity = setRangeValue(quantity); | ||
} | ||
} | ||
} |
@@ -1,4 +0,3 @@ | ||
import { ExternalInteractorBase } from "tsparticles-engine"; | ||
import { ExternalInteractorBase, getRangeValue, itemFromArray, } from "tsparticles-engine"; | ||
import { Push } from "./Options/Classes/Push"; | ||
import { itemFromArray } from "tsparticles-engine"; | ||
export class Pusher extends ExternalInteractorBase { | ||
@@ -15,8 +14,8 @@ constructor(container) { | ||
} | ||
const pushNb = pushOptions.quantity; | ||
if (pushNb <= 0) { | ||
const quantity = getRangeValue(pushOptions.quantity); | ||
if (quantity <= 0) { | ||
return; | ||
} | ||
const group = itemFromArray([undefined, ...pushOptions.groups]), groupOptions = group !== undefined ? container.actualOptions.particles.groups[group] : undefined; | ||
container.particles.push(pushNb, container.interactivity.mouse, groupOptions, group); | ||
container.particles.push(quantity, container.interactivity.mouse, groupOptions, group); | ||
}; | ||
@@ -38,3 +37,3 @@ } | ||
for (const source of sources) { | ||
options.push.load(source === null || source === void 0 ? void 0 : source.push); | ||
options.push.load(source?.push); | ||
} | ||
@@ -41,0 +40,0 @@ } |
@@ -16,18 +16,7 @@ "use strict"; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.loadExternalPushInteraction = void 0; | ||
const Pusher_1 = require("./Pusher"); | ||
function loadExternalPushInteraction(engine) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield engine.addInteractor("externalPush", (container) => new Pusher_1.Pusher(container)); | ||
}); | ||
async function loadExternalPushInteraction(engine) { | ||
await engine.addInteractor("externalPush", (container) => new Pusher_1.Pusher(container)); | ||
} | ||
@@ -34,0 +23,0 @@ exports.loadExternalPushInteraction = loadExternalPushInteraction; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Push = void 0; | ||
const tsparticles_engine_1 = require("tsparticles-engine"); | ||
class Push { | ||
@@ -14,6 +15,5 @@ constructor() { | ||
set particles_nb(value) { | ||
this.quantity = value; | ||
this.quantity = (0, tsparticles_engine_1.setRangeValue)(value); | ||
} | ||
load(data) { | ||
var _a; | ||
if (!data) { | ||
@@ -31,5 +31,5 @@ return; | ||
} | ||
const quantity = (_a = data.quantity) !== null && _a !== void 0 ? _a : data.particles_nb; | ||
const quantity = data.quantity ?? data.particles_nb; | ||
if (quantity !== undefined) { | ||
this.quantity = quantity; | ||
this.quantity = (0, tsparticles_engine_1.setRangeValue)(quantity); | ||
} | ||
@@ -36,0 +36,0 @@ } |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -15,3 +6,2 @@ exports.Pusher = void 0; | ||
const Push_1 = require("./Options/Classes/Push"); | ||
const tsparticles_engine_2 = require("tsparticles-engine"); | ||
class Pusher extends tsparticles_engine_1.ExternalInteractorBase { | ||
@@ -28,8 +18,8 @@ constructor(container) { | ||
} | ||
const pushNb = pushOptions.quantity; | ||
if (pushNb <= 0) { | ||
const quantity = (0, tsparticles_engine_1.getRangeValue)(pushOptions.quantity); | ||
if (quantity <= 0) { | ||
return; | ||
} | ||
const group = (0, tsparticles_engine_2.itemFromArray)([undefined, ...pushOptions.groups]), groupOptions = group !== undefined ? container.actualOptions.particles.groups[group] : undefined; | ||
container.particles.push(pushNb, container.interactivity.mouse, groupOptions, group); | ||
const group = (0, tsparticles_engine_1.itemFromArray)([undefined, ...pushOptions.groups]), groupOptions = group !== undefined ? container.actualOptions.particles.groups[group] : undefined; | ||
container.particles.push(quantity, container.interactivity.mouse, groupOptions, group); | ||
}; | ||
@@ -41,5 +31,3 @@ } | ||
} | ||
interact() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
}); | ||
async interact() { | ||
} | ||
@@ -54,3 +42,3 @@ isEnabled() { | ||
for (const source of sources) { | ||
options.push.load(source === null || source === void 0 ? void 0 : source.push); | ||
options.push.load(source?.push); | ||
} | ||
@@ -57,0 +45,0 @@ } |
@@ -0,1 +1,2 @@ | ||
import { setRangeValue } from "tsparticles-engine"; | ||
export class Push { | ||
@@ -11,6 +12,5 @@ constructor() { | ||
set particles_nb(value) { | ||
this.quantity = value; | ||
this.quantity = setRangeValue(value); | ||
} | ||
load(data) { | ||
var _a; | ||
if (!data) { | ||
@@ -28,7 +28,7 @@ return; | ||
} | ||
const quantity = (_a = data.quantity) !== null && _a !== void 0 ? _a : data.particles_nb; | ||
const quantity = data.quantity ?? data.particles_nb; | ||
if (quantity !== undefined) { | ||
this.quantity = quantity; | ||
this.quantity = setRangeValue(quantity); | ||
} | ||
} | ||
} |
@@ -1,4 +0,3 @@ | ||
import { ExternalInteractorBase } from "tsparticles-engine"; | ||
import { ExternalInteractorBase, getRangeValue, itemFromArray, } from "tsparticles-engine"; | ||
import { Push } from "./Options/Classes/Push"; | ||
import { itemFromArray } from "tsparticles-engine"; | ||
export class Pusher extends ExternalInteractorBase { | ||
@@ -15,8 +14,8 @@ constructor(container) { | ||
} | ||
const pushNb = pushOptions.quantity; | ||
if (pushNb <= 0) { | ||
const quantity = getRangeValue(pushOptions.quantity); | ||
if (quantity <= 0) { | ||
return; | ||
} | ||
const group = itemFromArray([undefined, ...pushOptions.groups]), groupOptions = group !== undefined ? container.actualOptions.particles.groups[group] : undefined; | ||
container.particles.push(pushNb, container.interactivity.mouse, groupOptions, group); | ||
container.particles.push(quantity, container.interactivity.mouse, groupOptions, group); | ||
}; | ||
@@ -38,3 +37,3 @@ } | ||
for (const source of sources) { | ||
options.push.load(source === null || source === void 0 ? void 0 : source.push); | ||
options.push.load(source?.push); | ||
} | ||
@@ -41,0 +40,0 @@ } |
{ | ||
"name": "tsparticles-interaction-external-push", | ||
"version": "2.9.3", | ||
"version": "2.10.0", | ||
"description": "tsParticles push external interaction", | ||
@@ -77,4 +77,4 @@ "homepage": "https://particles.js.org", | ||
"dependencies": { | ||
"tsparticles-engine": "^2.9.3" | ||
"tsparticles-engine": "^2.10.0" | ||
} | ||
} |
@@ -7,3 +7,3 @@ /*! | ||
* How to use? : Check the GitHub README | ||
* v2.9.3 | ||
* v2.10.0 | ||
*/ | ||
@@ -95,4 +95,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
__webpack_require__.d(__webpack_exports__, { | ||
"Push": () => (/* reexport */ Push), | ||
"loadExternalPushInteraction": () => (/* binding */ loadExternalPushInteraction) | ||
Push: () => (/* reexport */ Push), | ||
loadExternalPushInteraction: () => (/* binding */ loadExternalPushInteraction) | ||
}); | ||
@@ -103,2 +103,3 @@ | ||
;// CONCATENATED MODULE: ./dist/browser/Options/Classes/Push.js | ||
class Push { | ||
@@ -114,6 +115,5 @@ constructor() { | ||
set particles_nb(value) { | ||
this.quantity = value; | ||
this.quantity = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.setRangeValue)(value); | ||
} | ||
load(data) { | ||
var _a; | ||
if (!data) { | ||
@@ -131,5 +131,5 @@ return; | ||
} | ||
const quantity = (_a = data.quantity) !== null && _a !== void 0 ? _a : data.particles_nb; | ||
const quantity = data.quantity ?? data.particles_nb; | ||
if (quantity !== undefined) { | ||
this.quantity = quantity; | ||
this.quantity = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.setRangeValue)(quantity); | ||
} | ||
@@ -141,3 +141,2 @@ } | ||
class Pusher extends external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.ExternalInteractorBase { | ||
@@ -156,4 +155,4 @@ constructor(container) { | ||
} | ||
const pushNb = pushOptions.quantity; | ||
if (pushNb <= 0) { | ||
const quantity = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.getRangeValue)(pushOptions.quantity); | ||
if (quantity <= 0) { | ||
return; | ||
@@ -163,3 +162,3 @@ } | ||
groupOptions = group !== undefined ? container.actualOptions.particles.groups[group] : undefined; | ||
container.particles.push(pushNb, container.interactivity.mouse, groupOptions, group); | ||
container.particles.push(quantity, container.interactivity.mouse, groupOptions, group); | ||
}; | ||
@@ -178,3 +177,3 @@ } | ||
for (const source of sources) { | ||
options.push.load(source === null || source === void 0 ? void 0 : source.push); | ||
options.push.load(source?.push); | ||
} | ||
@@ -181,0 +180,0 @@ } |
/*! For license information please see tsparticles.interaction.external.push.min.js.LICENSE.txt */ | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("tsparticles-engine"));else if("function"==typeof define&&define.amd)define(["tsparticles-engine"],e);else{var r="object"==typeof exports?e(require("tsparticles-engine")):e(t.window);for(var o in r)("object"==typeof exports?exports:t)[o]=r[o]}}(this,(t=>(()=>{"use strict";var e={961:e=>{e.exports=t}},r={};function o(t){var i=r[t];if(void 0!==i)return i.exports;var s=r[t]={exports:{}};return e[t](s,s.exports,o),s.exports}o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{o.r(i),o.d(i,{Push:()=>e,loadExternalPushInteraction:()=>s});var t=o(961);class e{constructor(){this.default=!0,this.groups=[],this.quantity=4}get particles_nb(){return this.quantity}set particles_nb(t){this.quantity=t}load(t){var e;if(!t)return;void 0!==t.default&&(this.default=t.default),void 0!==t.groups&&(this.groups=t.groups.map((t=>t))),this.groups.length||(this.default=!0);const r=null!==(e=t.quantity)&&void 0!==e?e:t.particles_nb;void 0!==r&&(this.quantity=r)}}class r extends t.ExternalInteractorBase{constructor(e){super(e),this.handleClickMode=e=>{if("push"!==e)return;const r=this.container,o=r.actualOptions.interactivity.modes.push;if(!o)return;const i=o.quantity;if(i<=0)return;const s=(0,t.itemFromArray)([void 0,...o.groups]),n=void 0!==s?r.actualOptions.particles.groups[s]:void 0;r.particles.push(i,r.interactivity.mouse,n,s)}}clear(){}init(){}async interact(){}isEnabled(){return!0}loadModeOptions(t,...r){t.push||(t.push=new e);for(const e of r)t.push.load(null==e?void 0:e.push)}reset(){}}async function s(t){await t.addInteractor("externalPush",(t=>new r(t)))}})(),i})())); | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("tsparticles-engine"));else if("function"==typeof define&&define.amd)define(["tsparticles-engine"],e);else{var r="object"==typeof exports?e(require("tsparticles-engine")):e(t.window);for(var o in r)("object"==typeof exports?exports:t)[o]=r[o]}}(this,(t=>(()=>{"use strict";var e={961:e=>{e.exports=t}},r={};function o(t){var s=r[t];if(void 0!==s)return s.exports;var i=r[t]={exports:{}};return e[t](i,i.exports,o),i.exports}o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};return(()=>{o.r(s),o.d(s,{Push:()=>e,loadExternalPushInteraction:()=>i});var t=o(961);class e{constructor(){this.default=!0,this.groups=[],this.quantity=4}get particles_nb(){return this.quantity}set particles_nb(e){this.quantity=(0,t.setRangeValue)(e)}load(e){if(!e)return;void 0!==e.default&&(this.default=e.default),void 0!==e.groups&&(this.groups=e.groups.map((t=>t))),this.groups.length||(this.default=!0);const r=e.quantity??e.particles_nb;void 0!==r&&(this.quantity=(0,t.setRangeValue)(r))}}class r extends t.ExternalInteractorBase{constructor(e){super(e),this.handleClickMode=e=>{if("push"!==e)return;const r=this.container,o=r.actualOptions.interactivity.modes.push;if(!o)return;const s=(0,t.getRangeValue)(o.quantity);if(s<=0)return;const i=(0,t.itemFromArray)([void 0,...o.groups]),n=void 0!==i?r.actualOptions.particles.groups[i]:void 0;r.particles.push(s,r.interactivity.mouse,n,i)}}clear(){}init(){}async interact(){}isEnabled(){return!0}loadModeOptions(t,...r){t.push||(t.push=new e);for(const e of r)t.push.load(e?.push)}reset(){}}async function i(t){await t.addInteractor("externalPush",(t=>new r(t)))}})(),s})())); |
@@ -1,1 +0,1 @@ | ||
/*! tsParticles Push External Interaction v2.9.3 by Matteo Bruni */ | ||
/*! tsParticles Push External Interaction v2.10.0 by Matteo Bruni */ |
@@ -1,2 +0,2 @@ | ||
import type { IOptionLoader, RecursivePartial } from "tsparticles-engine"; | ||
import { type IOptionLoader, type RangeValue, type RecursivePartial } from "tsparticles-engine"; | ||
import type { IPush } from "../Interfaces/IPush"; | ||
@@ -6,7 +6,7 @@ export declare class Push implements IPush, IOptionLoader<IPush> { | ||
groups: string[]; | ||
quantity: number; | ||
quantity: RangeValue; | ||
constructor(); | ||
get particles_nb(): number; | ||
set particles_nb(value: number); | ||
get particles_nb(): RangeValue; | ||
set particles_nb(value: RangeValue); | ||
load(data?: RecursivePartial<IPush>): void; | ||
} |
@@ -0,6 +1,7 @@ | ||
import type { RangeValue } from "tsparticles-engine"; | ||
export interface IPush { | ||
default: boolean; | ||
groups: string[]; | ||
particles_nb: number; | ||
quantity: number; | ||
particles_nb: RangeValue; | ||
quantity: RangeValue; | ||
} |
@@ -1,3 +0,2 @@ | ||
import { ExternalInteractorBase } from "tsparticles-engine"; | ||
import type { IModes, Modes, RecursivePartial } from "tsparticles-engine"; | ||
import { ExternalInteractorBase, type IModes, type Modes, type RecursivePartial } from "tsparticles-engine"; | ||
import type { IPushMode, PushContainer, PushMode } from "./Types"; | ||
@@ -4,0 +3,0 @@ export declare class Pusher extends ExternalInteractorBase<PushContainer> { |
@@ -1,5 +0,4 @@ | ||
import type { Container } from "tsparticles-engine"; | ||
import type { Container, Options } from "tsparticles-engine"; | ||
import type { IPush } from "./Options/Interfaces/IPush"; | ||
import type { Push } from "./Options/Classes/Push"; | ||
import type { PushOptions } from "./Options/Classes/PushOptions"; | ||
export type IPushMode = { | ||
@@ -14,1 +13,6 @@ push: IPush; | ||
}; | ||
export type PushOptions = Options & { | ||
interactivity: { | ||
modes: PushMode; | ||
}; | ||
}; |
@@ -7,3 +7,3 @@ (function (factory) { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports"], factory); | ||
define(["require", "exports", "tsparticles-engine"], factory); | ||
} | ||
@@ -14,2 +14,3 @@ })(function (require, exports) { | ||
exports.Push = void 0; | ||
const tsparticles_engine_1 = require("tsparticles-engine"); | ||
class Push { | ||
@@ -25,6 +26,5 @@ constructor() { | ||
set particles_nb(value) { | ||
this.quantity = value; | ||
this.quantity = (0, tsparticles_engine_1.setRangeValue)(value); | ||
} | ||
load(data) { | ||
var _a; | ||
if (!data) { | ||
@@ -42,5 +42,5 @@ return; | ||
} | ||
const quantity = (_a = data.quantity) !== null && _a !== void 0 ? _a : data.particles_nb; | ||
const quantity = data.quantity ?? data.particles_nb; | ||
if (quantity !== undefined) { | ||
this.quantity = quantity; | ||
this.quantity = (0, tsparticles_engine_1.setRangeValue)(quantity); | ||
} | ||
@@ -47,0 +47,0 @@ } |
@@ -7,3 +7,3 @@ (function (factory) { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "tsparticles-engine", "./Options/Classes/Push", "tsparticles-engine"], factory); | ||
define(["require", "exports", "tsparticles-engine", "./Options/Classes/Push"], factory); | ||
} | ||
@@ -16,3 +16,2 @@ })(function (require, exports) { | ||
const Push_1 = require("./Options/Classes/Push"); | ||
const tsparticles_engine_2 = require("tsparticles-engine"); | ||
class Pusher extends tsparticles_engine_1.ExternalInteractorBase { | ||
@@ -29,8 +28,8 @@ constructor(container) { | ||
} | ||
const pushNb = pushOptions.quantity; | ||
if (pushNb <= 0) { | ||
const quantity = (0, tsparticles_engine_1.getRangeValue)(pushOptions.quantity); | ||
if (quantity <= 0) { | ||
return; | ||
} | ||
const group = (0, tsparticles_engine_2.itemFromArray)([undefined, ...pushOptions.groups]), groupOptions = group !== undefined ? container.actualOptions.particles.groups[group] : undefined; | ||
container.particles.push(pushNb, container.interactivity.mouse, groupOptions, group); | ||
const group = (0, tsparticles_engine_1.itemFromArray)([undefined, ...pushOptions.groups]), groupOptions = group !== undefined ? container.actualOptions.particles.groups[group] : undefined; | ||
container.particles.push(quantity, container.interactivity.mouse, groupOptions, group); | ||
}; | ||
@@ -52,3 +51,3 @@ } | ||
for (const source of sources) { | ||
options.push.load(source === null || source === void 0 ? void 0 : source.push); | ||
options.push.load(source?.push); | ||
} | ||
@@ -55,0 +54,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
309700
32
654
Updatedtsparticles-engine@^2.10.0