New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

social-graphics-library

Package Overview
Dependencies
Maintainers
2
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

social-graphics-library - npm Package Compare versions

Comparing version 1.4.1 to 1.5.0

dist/src/controller/templateInjector.d.ts

3

dist/src/controller/generator.d.ts

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

import TemplateInjector from "./templateInjector";
/**

@@ -14,3 +15,3 @@ * Generator

*/
static run(teamName: string, playerName: string, mode: string, containerId: string, imgMode: string, generateLink?: boolean): void;
static run(teamName: string, playerName: string, mode: string, containerId: string, imgMode: string, generateLink?: boolean, templateInjector?: TemplateInjector): void;
}
import Call from "./model/call";
import ImportTemplate from "./model/importTemplate";
/**

@@ -6,2 +7,4 @@ * Social graphics library

export default class SocialGraphicsLibrary {
private templateInject;
constructor();
/**

@@ -16,3 +19,3 @@ * Generators social graphics library

*/
static generator(teamName: string, playerName: string, mode: string, containerId: string, imgMode: string, generateLink?: boolean): void;
generator(teamName: string, playerName: string, mode: string, containerId: string, imgMode: string, generateLink?: boolean): void;
/**

@@ -24,3 +27,3 @@ * Multis generator

*/
static multiGenerator(teamName: string, playerName: string, calls: Array<Call>): void;
multiGenerator(teamName: string, playerName: string, calls: Array<Call>): void;
/**

@@ -32,2 +35,7 @@ * Infos social graphics library

/**
* Injects templates into social graphics library
* @param importedTemplates
*/
inject(importedTemplates: Array<ImportTemplate>): void;
/**
* Version of social graphics library

@@ -34,0 +42,0 @@ */

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

export default abstract class Template {
export default interface Template {
/**
* Width of template
*/
static readonly width: number;
width: number;
/**
* Height of template
*/
static readonly height: number;
height: number;
/**

@@ -11,0 +11,0 @@ * Templates template

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

import Template from "../model/templateBase";
export declare class Elevate_Template extends Template {
export declare class Elevate_Template {
/**

@@ -4,0 +3,0 @@ * Width of elevate template

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

import Template from "../model/templateBase";
export declare class Example_Template extends Template {
export declare class Example_Template {
/**

@@ -4,0 +3,0 @@ * Width of example template

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

import Template from "../model/templateBase";
export declare class False_Template extends Template {
export declare class False_Template {
/**

@@ -4,0 +3,0 @@ * Width of false template

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

import Template from "../model/templateBase";
export declare class Logo_Template extends Template {
export declare class Logo_Template {
/**

@@ -4,0 +3,0 @@ * Width of logo template

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

import Template from "../model/templateBase";
export declare class Twitch_Template extends Template {
export declare class Twitch_Template {
/**

@@ -4,0 +3,0 @@ * Width of twitch template

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

import Template from "../model/templateBase";
export declare class Twitter_Template extends Template {
export declare class Twitter_Template {
/**

@@ -4,0 +3,0 @@ * Width of twitter template

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

import Template from "../model/templateBase";
export declare class Youtube_Template extends Template {
export declare class Youtube_Template {
/**

@@ -4,0 +3,0 @@ * Width of youtube template

@@ -9,3 +9,3 @@ import "./dist/sgl.bundle.js";

async function() {
SocialGraphicsLibrary
new SocialGraphicsLibrary()
.multiGenerator(document

@@ -12,0 +12,0 @@ .getElementById('tName')

{
"name": "social-graphics-library",
"version": "1.4.1",
"version": "1.5.0",
"description": "A script for generating social media logos and banners",

@@ -5,0 +5,0 @@ "scripts": {

@@ -28,3 +28,3 @@ # Languages

SocialGraphicsLibrary.generator(
new SocialGraphicsLibrary.generator(
teamName,

@@ -39,12 +39,12 @@ playerName,

SocialGraphicsLibrary.multiGenerator(tName, pName, [{
mode: 'twitch-title',
containerId: 'img-container-1',
imgMode: 'jpeg'
}, {
mode: 'elavate-title',
containerId: 'img-container-2',
imgMode: 'jpeg',
generateLink: true
}]
new SocialGraphicsLibrary.multiGenerator(tName, pName, [{
mode: 'twitch-title',
containerId: 'img-container-1',
imgMode: 'jpeg'
}, {
mode: 'elavate-title',
containerId: 'img-container-2',
imgMode: 'jpeg',
generateLink: true
}]

@@ -86,2 +86,15 @@ ### Modifikatoren

---
### Inject Template (Experimentelles Feature)
Es ist möglich, alternativ zum Forkend es Projektes, eigene Templates lokal zu injecten. Dazu einfach das NPM Packet installieren mit `npm i social-graphics-library` , danach kann nach der initialisierung mit der folgenden Methode ein Template Injekted werden:
new SocialGraphicsLibrary.inject([
{
"callName": "template_name",
"template": new Template()
}
])
---
### Templates

@@ -146,3 +159,3 @@

SocialGraphicsLibrary.generator(
new SocialGraphicsLibrary.generator(
teamName,

@@ -157,12 +170,12 @@ playerName,

SocialGraphicsLibrary.multiGenerator(tName, pName, [{
mode: 'twitch-title',
containerId: 'img-container-1',
imgMode: 'jpeg'
}, {
mode: 'elavate-title',
containerId: 'img-container-2',
imgMode: 'jpeg',
generateLink: true
}]
new SocialGraphicsLibrary.multiGenerator(tName, pName, [{
mode: 'twitch-title',
containerId: 'img-container-1',
imgMode: 'jpeg'
}, {
mode: 'elavate-title',
containerId: 'img-container-2',
imgMode: 'jpeg',
generateLink: true
}]

@@ -204,2 +217,16 @@ ### Modifiers

---
### Inject Template (Experimentelles Feature)
As an alternative to forking the project, it is possible to inject your own templates locally. To do this, simply install the NPM package with `npm i social-graphics-library`, then after the initialization a template can be injected with the following method:
new SocialGraphicsLibrary.inject([
{
"callName": "template_name",
"template": new Template()
}
])
---
### Templates

@@ -206,0 +233,0 @@

@@ -8,2 +8,4 @@ import { Elevate_Template } from "../template/elevate-title.template";

import ImageRenderer from "./imageRenderer";
import Template from "../model/templateBase";
import TemplateInjector from "./templateInjector";

@@ -24,6 +26,7 @@ /**

*/
public static run(teamName: string, playerName: string, mode: string, containerId: string, imgMode: string, generateLink?: boolean): void {
let svgString: string;
let width: number;
let height: number;
public static run(teamName: string, playerName: string, mode: string, containerId: string, imgMode: string, generateLink?: boolean, templateInjector?: TemplateInjector): void {
let svgString: string,
width: number,
height: number,
tempTemplate: Template;

@@ -76,4 +79,11 @@ if (teamName === "") {

if (templateInjector!.call(mode) != null) {
tempTemplate = <Template>templateInjector!.call(mode)!.template
svgString = tempTemplate.template(teamName, playerName)
width = tempTemplate.width
height = tempTemplate.height
}
ImageRenderer.renderImage(svgString, width, height, containerId, imgMode, generateLink)
}
}
import Call from "./model/call";
import { Info } from "./model/info";
import Generator from "./controller/generator";
import TemplateInjector from "./controller/templateInjector";
import ImportTemplate from "./model/importTemplate";

@@ -10,2 +12,11 @@ /**

//#region properties
private templateInject
//#endregion
constructor() {
this.templateInject = new TemplateInjector();
}
//#region generator
/**

@@ -20,5 +31,5 @@ * Generators social graphics library

*/
public static generator(teamName: string, playerName:string, mode: string, containerId: string, imgMode: string, generateLink?: boolean): void {
public generator(teamName: string, playerName: string, mode: string, containerId: string, imgMode: string, generateLink?: boolean): void {
Generator.run(teamName, playerName, mode, containerId, imgMode, generateLink);
Generator.run(teamName, playerName, mode, containerId, imgMode, generateLink, this.templateInject);

@@ -28,3 +39,2 @@ }

//#region multiGenerator

@@ -37,6 +47,6 @@ /**

*/
public static multiGenerator(teamName: string, playerName:string, calls: Array<Call>): void {
calls.forEach( async element => {
SocialGraphicsLibrary.generator(teamName, playerName, element.mode, element.containerId, element.imgMode, element.generateLink);
});
public multiGenerator(teamName: string, playerName: string, calls: Array<Call>): void {
calls.forEach(async element => {
this.generator(teamName, playerName, element.mode, element.containerId, element.imgMode, element.generateLink);
});
}

@@ -50,3 +60,3 @@ //#endregion

*/
public static info():object {
public static info(): object {
return { "SGL Info": new Info() }

@@ -56,2 +66,12 @@ }

//#region injector
/**
* Injects templates into social graphics library
* @param importedTemplates
*/
public inject(importedTemplates: Array<ImportTemplate>): void {
this.templateInject.injector(importedTemplates)
}
//#endregion
//#region version

@@ -58,0 +78,0 @@ /**

@@ -7,3 +7,3 @@ export class Info {

*/
private readonly _version: string = "1.4.1"
private readonly _version: string = "1.5.0"

@@ -10,0 +10,0 @@ /**

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

export default abstract class Template {
export default interface Template {

@@ -6,3 +6,3 @@ /**

*/
public static readonly width: number
width: number

@@ -12,3 +12,3 @@ /**

*/
public static readonly height: number
height: number

@@ -21,8 +21,4 @@ /**

*/
public template(teamName: string, playerName: string): string {
teamName;
playerName;
return 'svg';
}
template(teamName: string, playerName: string): string
}

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

import Template from "../model/templateBase"
export class Elevate_Template {
export class Elevate_Template extends Template {
//#region setup

@@ -6,0 +4,0 @@ /**

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

import Template from "../model/templateBase";
export class Example_Template {
export class Example_Template extends Template {
//#region setup

@@ -6,0 +4,0 @@ /**

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

import Template from "../model/templateBase";
export class False_Template {
export class False_Template extends Template {
//#region setup

@@ -6,0 +4,0 @@ /**

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

import Template from "../model/templateBase";
export class Logo_Template {
export class Logo_Template extends Template {
//#region setup

@@ -6,0 +4,0 @@ /**

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

import Template from "../model/templateBase";
export class Twitch_Template {
export class Twitch_Template extends Template {
//#region setup

@@ -6,0 +4,0 @@ /**

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

import Template from "../model/templateBase";
export class Twitter_Template {
export class Twitter_Template extends Template {
//#region setup

@@ -6,0 +4,0 @@ /**

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

import Template from "../model/templateBase";
export class Youtube_Template {
export class Youtube_Template extends Template {
//#region setup

@@ -6,0 +4,0 @@ /**

@@ -44,4 +44,5 @@ //#region setup

//#region local
const sgl = require("../dist/sgl.bundle");
const SocialGraphicsLibrary = require("../dist/sgl.bundle");
const sgl = new SocialGraphicsLibrary();
const main = document.createElement("div");

@@ -61,3 +62,3 @@ const testDiv = document.createElement("div");

console.log(sgl.info());
console.log(SocialGraphicsLibrary.info());

@@ -75,2 +76,2 @@ console.log();

console.log("Tests done...");
console.log("Tests done...");

@@ -19,3 +19,3 @@ {

// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
// "removeComments": true, /* Do not emit comments to output. */
"removeComments": false, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */

@@ -22,0 +22,0 @@ // "importHelpers": true, /* Import emit helpers from 'tslib'. */

Sorry, the diff of this file is too big to display

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