@asphalt-react/helper
Advanced tools
Comparing version 2.0.0-alpha.8 to 2.0.0-alpha.13
@@ -18,3 +18,3 @@ const randomHash=()=>`${Math.random().toString(36).substring(2,15)}`;const paddedHexString=buffer=>{const byteArray=new Uint8Array(buffer);const hexCodes=Array.from(byteArray).map(value=>value.toString(16).padStart(2,"0"));return hexCodes.join("")};const sha256=async input=>{{if(!window.crypto.subtle){return Promise.reject(new Error("`crypto` only works in secure contexts."))}const buffer=await window.crypto.subtle.digest("SHA-256",input);return paddedHexString(buffer)}};const hash=data=>{const encoder=new TextEncoder("utf-8");return sha256(encoder.encode(data))}; | ||
const INFO="info";const SUCCESS="success";const WARNING="warning";const DANGER="danger";const NEUTRAL="neutral";const INVALID="invalid";const KEYCODES=Object.freeze({TAB:9,RETURN:13,ESC:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40});const ID_PREFIX="sphlt-"; | ||
const INFO="info";const SUCCESS="success";const WARNING="warning";const DANGER="danger";const NEUTRAL="neutral";const INVALID="invalid";const BRAND="brand";const KEYCODES=Object.freeze({TAB:9,RETURN:13,ESC:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40});const ID_PREFIX="sphlt-"; | ||
@@ -52,2 +52,2 @@ const getPrefixedId=id=>id?`${ID_PREFIX}${id}`:"";const capitalise=(word="")=>word.substring(0,1).toUpperCase()+word.substring(1).toLowerCase();const camelCase=(...words)=>{return words.reduce((result,word,index)=>{word=word.toLowerCase();return result+(index?capitalise(word):word)},"")}; | ||
export { DANGER, INFO, INVALID, KEYCODES, NEUTRAL, SUCCESS, WARNING, env as envUtil, hash$1 as hashUtil, props as propsUtil, strings as stringUtil, svg as svgUtil }; | ||
export { BRAND, DANGER, INFO, INVALID, KEYCODES, NEUTRAL, SUCCESS, WARNING, env as envUtil, hash$1 as hashUtil, props as propsUtil, strings as stringUtil, svg as svgUtil }; |
@@ -18,3 +18,3 @@ const randomHash=()=>`${Math.random().toString(36).substring(2,15)}`;const paddedHexString=buffer=>{const byteArray=new Uint8Array(buffer);const hexCodes=Array.from(byteArray).map(value=>value.toString(16).padStart(2,"0"));return hexCodes.join("")};const sha256=async input=>{{const{createHash}=require("crypto");const hash=createHash("sha256");hash.update(input);return hash.digest("hex")}};const hash=data=>{const encoder=new TextEncoder("utf-8");return sha256(encoder.encode(data))}; | ||
const INFO="info";const SUCCESS="success";const WARNING="warning";const DANGER="danger";const NEUTRAL="neutral";const INVALID="invalid";const KEYCODES=Object.freeze({TAB:9,RETURN:13,ESC:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40});const ID_PREFIX="sphlt-"; | ||
const INFO="info";const SUCCESS="success";const WARNING="warning";const DANGER="danger";const NEUTRAL="neutral";const INVALID="invalid";const BRAND="brand";const KEYCODES=Object.freeze({TAB:9,RETURN:13,ESC:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40});const ID_PREFIX="sphlt-"; | ||
@@ -52,2 +52,2 @@ const getPrefixedId=id=>id?`${ID_PREFIX}${id}`:"";const capitalise=(word="")=>word.substring(0,1).toUpperCase()+word.substring(1).toLowerCase();const camelCase=(...words)=>{return words.reduce((result,word,index)=>{word=word.toLowerCase();return result+(index?capitalise(word):word)},"")}; | ||
export { DANGER, INFO, INVALID, KEYCODES, NEUTRAL, SUCCESS, WARNING, env as envUtil, hash$1 as hashUtil, props as propsUtil, strings as stringUtil, svg as svgUtil }; | ||
export { BRAND, DANGER, INFO, INVALID, KEYCODES, NEUTRAL, SUCCESS, WARNING, env as envUtil, hash$1 as hashUtil, props as propsUtil, strings as stringUtil, svg as svgUtil }; |
{ | ||
"name": "@asphalt-react/helper", | ||
"version": "2.0.0-alpha.8", | ||
"version": "2.0.0-alpha.13", | ||
"description": "Common helper utilities for components", | ||
@@ -44,3 +44,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "30e6cfa3552c88d7f34eb7bfc4697d5f1a517f3d" | ||
"gitHead": "d612f951c8b52f5c0b43e48155cb5346c06031c8" | ||
} |
# Helper | ||
 | ||
@@ -3,0 +4,0 @@ > ⚠️ Designed for Asphalt React component packages. Use at your own risk, if using externally. |
Sorry, the diff of this file is not supported yet
12597
158
8