svelte-countup
Advanced tools
Comparing version 0.1.0 to 0.2.0
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('crypto')) : | ||
typeof define === 'function' && define.amd ? define(['crypto'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.CountUp = factory(global.crypto)); | ||
})(this, (function (crypto) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('nanoid/nanoid')) : | ||
typeof define === 'function' && define.amd ? define(['nanoid/nanoid'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.CountUp = factory(global.nanoid)); | ||
})(this, (function (nanoid) { 'use strict'; | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto); | ||
function noop() { } | ||
@@ -280,27 +276,2 @@ function run(fn) { | ||
let urlAlphabet = | ||
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'; | ||
const POOL_SIZE_MULTIPLIER = 128; | ||
let pool, poolOffset; | ||
let fillPool = bytes => { | ||
if (!pool || pool.length < bytes) { | ||
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER); | ||
crypto__default["default"].randomFillSync(pool); | ||
poolOffset = 0; | ||
} else if (poolOffset + bytes > pool.length) { | ||
crypto__default["default"].randomFillSync(pool); | ||
poolOffset = 0; | ||
} | ||
poolOffset += bytes; | ||
}; | ||
let nanoid = (size = 21) => { | ||
fillPool((size -= 0)); | ||
let id = ''; | ||
for (let i = poolOffset - size; i < poolOffset; i++) { | ||
id += urlAlphabet[pool[i] & 63]; | ||
} | ||
return id | ||
}; | ||
const defaultOptions = { | ||
@@ -419,3 +390,3 @@ root: null, | ||
function instance($$self, $$props, $$invalidate) { | ||
const id = nanoid(); | ||
const id = nanoid.nanoid(); | ||
let isInView; | ||
@@ -422,0 +393,0 @@ let { value } = $$props; |
{ | ||
"name": "svelte-countup", | ||
"componentname": "CountUp", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"main": "lib/index.js", | ||
@@ -6,0 +6,0 @@ "module": "lib/index.mjs", |
@@ -5,2 +5,11 @@ # Svelte CountUp | ||
## Features | ||
- You can specify the initial number, target number, and the duration of the count up | ||
- You can specify the number of decimal places | ||
- You can choose the target number to be rounded or not | ||
- You can set the step size of the count up | ||
- You can use multiple count ups on the same page | ||
- Countup only starts when it is visible on the screen and stops when it is not visible | ||
## Install | ||
@@ -7,0 +16,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
51
34081
903