Socket
Socket
Sign inDemoInstall

tsparticles-shape-text

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsparticles-shape-text - npm Package Compare versions

Comparing version 2.0.0-alpha.3 to 2.0.0-alpha.4

3

index.d.ts

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

export {};
import type { Main } from "tsparticles-engine";
export declare function loadTextShape(tsParticles: Main): void;

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

import { loadShape } from "./shape";
import { tsParticles } from "tsparticles-core";
loadShape(tsParticles);
import { validTypes, TextDrawer } from "./TextDrawer";
export function loadTextShape(tsParticles) {
const drawer = new TextDrawer();
for (const type of validTypes) {
tsParticles.addShape(type, drawer);
}
}
{
"name": "tsparticles-shape-text",
"version": "2.0.0-alpha.3",
"version": "2.0.0-alpha.4",
"description": "tsParticles Text shape",

@@ -41,11 +41,11 @@ "homepage": "https://particles.js.org/",

},
"main": "shape.js",
"main": "index.js",
"jsdelivr": "tsparticles.shape.text.min.js",
"unpkg": "tsparticles.shape.text.min.js",
"browser": "shape.js",
"module": "shape.js",
"types": "shape.d.ts",
"browser": "index.js",
"module": "index.js",
"types": "index.d.ts",
"dependencies": {
"tsparticles-core": "^2.0.0-alpha.0"
"tsparticles-engine": "^2.0.0-alpha.4"
}
}

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

import type { Container, IParticle, IShapeDrawer } from "tsparticles-core";
import type { Container, IParticle, IShapeDrawer } from "tsparticles-engine";
export declare const validTypes: string[];

@@ -3,0 +3,0 @@ export declare class TextDrawer implements IShapeDrawer {

@@ -10,3 +10,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
import { isInArray, itemFromArray, loadFont } from "tsparticles-core";
import { isInArray, itemFromArray, loadFont } from "tsparticles-engine";
export const validTypes = ["text", "character", "char"];

@@ -13,0 +13,0 @@ export class TextDrawer {

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

* How to use? : Check the GitHub README
* v2.0.0-alpha.3
* v2.0.0-alpha.4
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("tsparticles-core"));
module.exports = factory(require("tsparticles-engine"));
else if(typeof define === 'function' && define.amd)
define(["tsparticles-core"], factory);
define(["tsparticles-engine"], factory);
else {
var a = typeof exports === 'object' ? factory(require("tsparticles-core")) : factory(root["window"]);
var a = typeof exports === 'object' ? factory(require("tsparticles-engine")) : factory(root["window"]);
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(this, function(__WEBPACK_EXTERNAL_MODULE__646__) {
})(this, function(__WEBPACK_EXTERNAL_MODULE__414__) {
return /******/ (() => { // webpackBootstrap

@@ -24,3 +24,3 @@ /******/ "use strict";

/***/ 677:
/***/ 921:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

@@ -31,4 +31,9 @@

// EXTERNAL MODULE: external {"commonjs":"tsparticles-core","commonjs2":"tsparticles-core","amd":"tsparticles-core","root":"window"}
var external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_ = __webpack_require__(646);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"loadTextShape": () => /* binding */ loadTextShape
});
// EXTERNAL MODULE: external {"commonjs":"tsparticles-engine","commonjs2":"tsparticles-engine","amd":"tsparticles-engine","root":"window"}
var external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_ = __webpack_require__(414);
;// CONCATENATED MODULE: ./dist/TextDrawer.js

@@ -78,3 +83,3 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {

if (validTypes.find(t => (0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.isInArray)(t, options.particles.shape.type))) {
if (validTypes.find(t => (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isInArray)(t, options.particles.shape.type))) {
const shapeOptions = validTypes.map(t => options.particles.shape.options[t]).find(t => !!t);

@@ -86,3 +91,3 @@

for (const character of shapeOptions) {
promises.push((0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.loadFont)(character));
promises.push((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.loadFont)(character));
}

@@ -93,3 +98,3 @@

if (shapeOptions !== undefined) {
yield (0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.loadFont)(shapeOptions);
yield (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.loadFont)(shapeOptions);
}

@@ -119,3 +124,3 @@ }

if (textParticle.text === undefined) {
textParticle.text = textData instanceof Array ? (0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.itemFromArray)(textData, particle.randomIndexData) : textData;
textParticle.text = textData instanceof Array ? (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.itemFromArray)(textData, particle.randomIndexData) : textData;
}

@@ -144,5 +149,5 @@

}
;// CONCATENATED MODULE: ./dist/shape.js
;// CONCATENATED MODULE: ./dist/index.js
function loadShape(tsParticles) {
function loadTextShape(tsParticles) {
const drawer = new TextDrawer();

@@ -154,13 +159,9 @@

}
;// CONCATENATED MODULE: ./dist/index.js
loadShape(external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.tsParticles);
/***/ }),
/***/ 646:
/***/ 414:
/***/ ((module) => {
module.exports = __WEBPACK_EXTERNAL_MODULE__646__;
module.exports = __WEBPACK_EXTERNAL_MODULE__414__;

@@ -195,2 +196,19 @@ /***/ })

/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */

@@ -211,5 +229,5 @@ /******/ (() => {

/******/ // Load entry module and return exports
/******/ return __webpack_require__(677);
/******/ return __webpack_require__(921);
/******/ })()
;
});

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

/*! tsParticles Text Shape v2.0.0-alpha.3 by Matteo Bruni */
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("tsparticles-core"));else if("function"==typeof define&&define.amd)define(["tsparticles-core"],e);else{var o="object"==typeof exports?e(require("tsparticles-core")):e(t.window);for(var n in o)("object"==typeof exports?exports:t)[n]=o[n]}}(this,(function(t){return(()=>{"use strict";var e={677:(t,e,o)=>{o.r(e);var n=o(646),r=function(t,e,o,n){return new(o||(o=Promise))((function(r,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};const i=["text","character","char"];class s{getSidesCount(){return 12}init(t){return r(this,void 0,void 0,(function*(){const e=t.options;if(i.find((t=>(0,n.isInArray)(t,e.particles.shape.type)))){const t=i.map((t=>e.particles.shape.options[t])).find((t=>!!t));if(t instanceof Array){const e=[];for(const o of t)e.push((0,n.loadFont)(o));yield Promise.allSettled(e)}else void 0!==t&&(yield(0,n.loadFont)(t))}}))}draw(t,e,o){var r,i,s;const a=e.shapeData;if(void 0===a)return;const c=a.value;if(void 0===c)return;const f=e;void 0===f.text&&(f.text=c instanceof Array?(0,n.itemFromArray)(c,e.randomIndexData):c);const l=f.text,u=null!==(r=a.style)&&void 0!==r?r:"",d=null!==(i=a.weight)&&void 0!==i?i:"",p=2*Math.round(o),y=null!==(s=a.font)&&void 0!==s?s:"",x=e.fill,v=l.length*o/2;t.font=`${u} ${d} ${p}px "${y}"`;const h={x:-v,y:o/2};x?t.fillText(l,h.x,h.y):t.strokeText(l,h.x,h.y)}}!function(t){const e=new s;for(const o of i)t.addShape(o,e)}(n.tsParticles)},646:e=>{e.exports=t}},o={};function n(t){if(o[t])return o[t].exports;var r=o[t]={exports:{}};return e[t](r,r.exports,n),r.exports}return n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n(677)})()}));
/*! tsParticles Text Shape v2.0.0-alpha.4 by Matteo Bruni */
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("tsparticles-engine"));else if("function"==typeof define&&define.amd)define(["tsparticles-engine"],t);else{var o="object"==typeof exports?t(require("tsparticles-engine")):t(e.window);for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(this,(function(e){return(()=>{"use strict";var t={921:(e,t,o)=>{o.r(t),o.d(t,{loadTextShape:()=>s});var n=o(414),r=function(e,t,o,n){return new(o||(o=Promise))((function(r,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const i=["text","character","char"];class a{getSidesCount(){return 12}init(e){return r(this,void 0,void 0,(function*(){const t=e.options;if(i.find((e=>(0,n.isInArray)(e,t.particles.shape.type)))){const e=i.map((e=>t.particles.shape.options[e])).find((e=>!!e));if(e instanceof Array){const t=[];for(const o of e)t.push((0,n.loadFont)(o));yield Promise.allSettled(t)}else void 0!==e&&(yield(0,n.loadFont)(e))}}))}draw(e,t,o){var r,i,a;const s=t.shapeData;if(void 0===s)return;const c=s.value;if(void 0===c)return;const f=t;void 0===f.text&&(f.text=c instanceof Array?(0,n.itemFromArray)(c,t.randomIndexData):c);const l=f.text,d=null!==(r=s.style)&&void 0!==r?r:"",u=null!==(i=s.weight)&&void 0!==i?i:"",p=2*Math.round(o),y=null!==(a=s.font)&&void 0!==a?a:"",x=t.fill,v=l.length*o/2;e.font=`${d} ${u} ${p}px "${y}"`;const h={x:-v,y:o/2};x?e.fillText(l,h.x,h.y):e.strokeText(l,h.x,h.y)}}function s(e){const t=new a;for(const o of i)e.addShape(o,t)}},414:t=>{t.exports=e}},o={};function n(e){if(o[e])return o[e].exports;var r=o[e]={exports:{}};return t[e](r,r.exports,n),r.exports}return n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(921)})()}));

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