npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sharingbox/fabric

v2.2.31

Published

Ressources communes (npm) : fabric

Downloads

19

Readme

@sharingbox/fabric

npm install @sharingbox/fabric@latest --save

Usage

@sharingbox/fabric est une extension de fabric. Pour l'utiliser, nous devons y importer fabric, puis retourner son instance après qu'elle ait été extended.

import {fabric} from 'fabric'; // [email protected]
import {Fabric} from '@sharingbox/fabric';

const extended = new Fabric(fabric).extend();

export default extended;

Nous pourrons ensuite utiliser fabric de manière standard en important l'objet extended comme suit :

import fabric from './extend.js';

Développement

Installation

Télécharger le projet @sharingbox/fabric depuis bitbucket puis installer les dépendances (pré-requis : nodejs, npm).

git clone [email protected]:sharingbox/fabric.git

npm install

Modifier les filtres

Un filtre est une suite d'actions. Il est possible d'ajouter un filtre (name, test, actions) dans le fichier src/filters/config.ts. Il est également possible de créer une configuration custom depuis l'event-space.

arianablack: {
	name   : 'arianablack',
	test   : false,
	actions: [

		{name: 'multiply', parameters: {imageData2: 'arianablack.png'}},
		{name: 'colorscheme2', parameters: {value1: 100}},
		{name: 'saturation', parameters: {value1: 20}}

	]
}

Les actions peuvent également être modifiées. Chaque action correspond à un fichier dans src/filters/extend/. Dans chaque fichier, le shader webGL peut être modifié dans fragmentSource.

Attention :

le code webGL et JavaScript doivent correspondre.

Aussi, il faut toujours veiller à ce que les traitements appliqués sur l'image dans le shader webGL correspondent aux traitements JavaScript (dans applyTo2d). Les traitements webGL sont utilisés sous Windows. JavaScript sont utilisés sous iPhone et iPad (qui ne peuvent pas générer autant de contextes webGL que nécessaire).

Erreur générée sous iPhone et iPad

There are too many active WebGL contexts on this page, the oldest context will be lost.

TypeError
Argument 1 ('shader') to WebGLRenderingContext.shaderSource must be an instance of WebGLShader
shaderSource@[native code]

Test

Pour tester les filtres (et les actions qui le composent), il est nécessaire de lancer la page de test test/index.test.html dans un serveur (sous vscode, clic droit : open with Live Server si l'extension LiveServer est installée).

  • https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer

Si des modifications ont été appliquées, lancer la ligne de commande suivante :

npm run webpack:development

Deploy

Incrémenter le numéro de version du fichier package.json.

npm run webpack:production
npm publish

Notes

WebGl

  • https://webglfundamentals.org/webgl/lessons/fr/webgl-how-it-works.html
  • https://webglfundamentals.org/webgl/lessons/fr/webgl-shaders-and-glsl.html

WebAssembly

Une fois le projet téléchargé, depuis la racine (au niveau de package.json), télécharger et installer EMscripten (qui permettra de compiler le code C/C++ en WebAssembly) si nécessaire :

  • https://developer.mozilla.org/fr/docs/WebAssembly/C_to_wasm
  • https://emscripten.org/docs/getting_started/downloads.html
  • https://emscripten.org/docs/tools_reference/emcc.html

git clone https://github.com/emscripten-core/emsdk.git

# Enter that directory
cd emsdk

# Fetch the latest version of the emsdk (not needed the first time you clone)
git pull

# Download and install the latest SDK tools.
./emsdk install latest

# Make the "latest" SDK "active" for the current user. (writes .emscripten file)
./emsdk activate latest

# Activate PATH and other environment variables in the current terminal
source ./emsdk_env.sh

On Windows, run emsdk instead of ./emsdk, and emsdk_env.bat instead of source ./emsdk_env.sh.

Build

Si une première installation adéjà été effectuée, au prochain lancement, simplement activer emsdk avant de lancer à nouveau les lignes de commandes par fichier.

emsdk activate latest
emcc -o ../src/filters/extend/webassembly_.js ../src/filters/extend/webassembly_.c -s EXPORTED_RUNTIME_METHODS=ccall,cwrap -s EXPORTED_FUNCTIONS=_malloc,_free -s EXPORT_ES6=1 -s MODULARIZE=1 -s USE_ES6_IMPORT_META=0 -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=512mb