encore-helpers
Advanced tools
Comparing version 1.0.0 to 1.1.0
export { BEMClassGenerator } from './services'; | ||
export { truncate } from './utils'; |
@@ -1,1 +0,8 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("logger",[],t):"object"==typeof exports?exports.logger=t():e.logger=t()}(window,function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t);var o=function(){function e(e){this.blockClassName=e}return e.prototype.getBlock=function(){return this.blockClassName},e.prototype.getBlockWithModifier=function(e){return this.blockClassName+"--"+e},e.prototype.getElement=function(e){return this.blockClassName+"__"+e},e.prototype.getElementWithModifier=function(e,t){return this.blockClassName+"__"+e+"--"+t},e}();n.d(t,"BEMClassGenerator",function(){return o})}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("logger",[],t):"object"==typeof exports?exports.logger=t():e.logger=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t);var r=function(){function e(e){this.blockClassName=e}return e.prototype.getBlock=function(){return this.blockClassName},e.prototype.getBlockWithModifier=function(e){return this.blockClassName+"--"+e},e.prototype.getElement=function(e){return this.blockClassName+"__"+e},e.prototype.getElementWithModifier=function(e,t){return this.blockClassName+"__"+e+"--"+t},e}(); | ||
/** | ||
shave - Shave is a javascript plugin that truncates multi-line text within a html element based on set max height | ||
@version v2.5.4 | ||
@link https://github.com/dollarshaveclub/shave#readme | ||
@author Jeff Wainwright <yowainwright@gmail.com> (jeffry.in) | ||
@license MIT | ||
**/var o=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)throw Error("maxHeight is required");var r="string"==typeof e?document.querySelectorAll(e):e;if(r){var o=n.character||"…",i=n.classname||"js-shave",a="boolean"!=typeof n.spaces||n.spaces,c='<span class="js-shave-char">'.concat(o,"</span>");"length"in r||(r=[r]);for(var l=0;l<r.length;l+=1){var s=r[l],u=s.style,f=s.querySelector(".".concat(i)),d=void 0===s.textContent?"innerText":"textContent";f&&(s.removeChild(s.querySelector(".js-shave-char")),s[d]=s[d]);var p=s[d],h=a?p.split(" "):p;if(!(h.length<2)){var g=u.height;u.height="auto";var v=u.maxHeight;if(u.maxHeight="none",s.offsetHeight<=t)u.height=g,u.maxHeight=v;else{for(var m=h.length-1,y=0,b=void 0;y<m;)b=y+m+1>>1,s[d]=a?h.slice(0,b).join(" "):h.slice(0,b),s.insertAdjacentHTML("beforeend",c),s.offsetHeight>t?m=a?b-1:b-2:y=b;s[d]=a?h.slice(0,m).join(" "):h.slice(0,m),s.insertAdjacentHTML("beforeend",c);var j=a?" ".concat(h.slice(m).join(" ")):h.slice(m),x=document.createTextNode(j),C=document.createElement("span");C.classList.add(i),C.style.display="none",C.appendChild(x),s.insertAdjacentElement("beforeend",C),u.height=g,u.maxHeight=v}}}}},i=function(e,t){void 0===t&&(t=3);var n=getComputedStyle(e),r=parseFloat(n.lineHeight);if(!isNaN(r)){var i=Math.ceil(r)*t;o(e,i)}};n.d(t,"BEMClassGenerator",function(){return r}),n.d(t,"truncate",function(){return i})}])}); |
{ | ||
"name": "encore-helpers", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"main": "dist/index.js", | ||
@@ -24,5 +24,8 @@ "types": "dist/index.d.ts", | ||
"check": "npm-run-all lint test-coverage audit build-info", | ||
"pre-push": "npm run lint && npm run test" | ||
"pre-push": "npm run lint && npm run test", | ||
"prepublish": "npm run build" | ||
}, | ||
"dependencies": {}, | ||
"dependencies": { | ||
"shave": "2.5.4" | ||
}, | ||
"devDependencies": { | ||
@@ -29,0 +32,0 @@ "@types/jest": "23.3.10", |
@@ -1,66 +0,19 @@ | ||
# Lib Helpers | ||
# Encore Helpers | ||
#### Setup steps | ||
``` | ||
- Run `git config core.hooksPath .githooks` to configure git hooks | ||
- Run `npm i` to install dependencies | ||
``` | ||
Library to store small shared utils and services that can be used across different application | ||
#### Dev dependencies | ||
## Install | ||
```bash | ||
$ npm install encore-helpers | ||
``` | ||
node: >= 10.10.0, | ||
npm: >= 6.4.1 | ||
``` | ||
Code Analysis Tools | ||
------------------- | ||
We use some open source tools to perform static code analysis: | ||
- TSLint | ||
- Stylelint | ||
These tools are automated and doesn't require manual work once they've been set up. | ||
They are also integrated in our continuous integration process. | ||
### TSLint | ||
Linting is a process of checking the source code for stylistic as well as | ||
programmatic errors. TSLint helps to identify some mistakes that are made during coding. | ||
It is also used for adhering best practices and improving code quality and readability. | ||
Our TypeScript code is written in compliance with recommended style guide. It is a set of standards that | ||
outline how code should be written and organized and it covers nearly every aspect of TypeScript. | ||
We use TSLint with recommended config. | ||
You can run TSLint manually with the following command: `npm run lint:ts`. | ||
Setup your IDE/Editor to show you TSLint errors and warnings: | ||
###### WebStorm | ||
1. Go to File ➤ Settings / Default Settings ➤ Languages and Frameworks ➤ TypeScript ➤ TSLint | ||
2. Click "Enable" checkbox | ||
3. Select Node interpreter | ||
4. Specify path to tslint package which is inside the project's `node_modules` folder. | ||
###### VSCode | ||
1. Go to: View -> Extension or press CTRL + SHIFT + X | ||
2. Search for "TSLint" extension, click it and press "Install" button | ||
3. Press "Reload" button or reopen the editor | ||
### Stylelint | ||
Stylelint is a linter that helps to avoid errors and enforce conventions in styles. | ||
It understands the latest CSS syntax, parses SCSS, extracts embedded styles from HTML, | ||
markdown and CSS-in-JS template literals. | ||
It is used with "stylelint-config-standard" which extends recommended Stylelint config and | ||
turns on additional rules to enforce the common stylistic conventions found within a handful | ||
of CSS styleguides, including: The Idiomatic CSS Principles, Google's CSS Style Guide and | ||
Airbnb's Styleguide. | ||
You can run Stylelint manually with the following command: `npm run lint:css`. | ||
The setup process for your IDE is similar to TSLint. I'm sure you'll figure it out. | ||
## Documentation | ||
___ | ||
### BEMClassGenerator | ||
Generate CSS class name for Encore components | ||
#### Methods | ||
**getBlock** - return class name for a block | ||
**getBlockWithModifier** - return class name for a block with modifier | ||
**getElement** - return class name for an element inside block (can be only one nesting level) | ||
**getElementWithModifier** - return class name for an element inside block with modifier | ||
___ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
5874
8
25
1
20
+ Addedshave@2.5.4
+ Addedshave@2.5.4(transitive)