@solid-primitives/range
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -0,1 +1,3 @@ | ||
import { onCleanup, createMemo, untrack, createRoot, createSignal } from 'solid-js'; | ||
// src/common.ts | ||
@@ -8,5 +10,2 @@ var { abs, sign, min, ceil, floor } = Math; | ||
}; | ||
// src/repeat.ts | ||
import { createMemo, createRoot, onCleanup, untrack } from "solid-js"; | ||
function repeat(times, mapFn, options = {}) { | ||
@@ -67,10 +66,6 @@ let disposers = [], items = [], prevLen = 0; | ||
} | ||
// src/mapRange.ts | ||
import { warn } from "@solid-primitives/utils"; | ||
import { createRoot as createRoot2, onCleanup as onCleanup2, untrack as untrack2 } from "solid-js"; | ||
function mapRange(start, to, step, mapFn, options = {}) { | ||
let disposers = [], items = [], prevStart = 0, prevTo = 0, prevStep = step(), fallback = false; | ||
onCleanup2(() => disposers.forEach((f) => f())); | ||
const mapper = (i, n, items2, disposers2) => createRoot2((dispose) => { | ||
onCleanup(() => disposers.forEach((f) => f())); | ||
const mapper = (i, n, items2, disposers2) => createRoot((dispose) => { | ||
disposers2[i] = dispose; | ||
@@ -84,3 +79,3 @@ items2[i] = mapFn(n); | ||
fallback = true; | ||
return createRoot2((dispose) => { | ||
return createRoot((dispose) => { | ||
disposers = [dispose]; | ||
@@ -137,3 +132,2 @@ return items = [options.fallback()]; | ||
if (_step === 0) { | ||
warn("Range cannot have a step of 0"); | ||
return items; | ||
@@ -151,3 +145,3 @@ } | ||
} | ||
const list = untrack2(mapNewRange.bind(void 0, _start, _to, _step)); | ||
const list = untrack(mapNewRange.bind(void 0, _start, _to, _step)); | ||
prevStart = _start; | ||
@@ -174,10 +168,6 @@ prevTo = _to; | ||
} | ||
// src/indexRange.ts | ||
import { warn as warn2 } from "@solid-primitives/utils"; | ||
import { createRoot as createRoot3, createSignal, onCleanup as onCleanup3, untrack as untrack3 } from "solid-js"; | ||
function indexRange(start, to, step, mapFn, options = {}) { | ||
let disposers = [], items = [], setters = [], fallback = false; | ||
onCleanup3(() => disposers.forEach((f) => f())); | ||
const mapper = (i, n) => createRoot3((dispose) => { | ||
onCleanup(() => disposers.forEach((f) => f())); | ||
const mapper = (i, n) => createRoot((dispose) => { | ||
const [number, setNumber] = createSignal(n); | ||
@@ -194,3 +184,3 @@ disposers[i] = dispose; | ||
fallback = true; | ||
return createRoot3((dispose) => { | ||
return createRoot((dispose) => { | ||
disposers = [dispose]; | ||
@@ -231,3 +221,2 @@ return items = [options.fallback()]; | ||
if (_step === 0) { | ||
warn2("Range cannot have a step of 0"); | ||
return items; | ||
@@ -238,3 +227,3 @@ } | ||
_step = abs(_step) * sign(_to - _start || 1); | ||
return untrack3(mapNewRange.bind(void 0, _start, _to, _step)); | ||
return untrack(mapNewRange.bind(void 0, _start, _to, _step)); | ||
}; | ||
@@ -257,9 +246,3 @@ } | ||
} | ||
export { | ||
IndexRange, | ||
Range, | ||
Repeat, | ||
indexRange, | ||
mapRange, | ||
repeat | ||
}; | ||
export { IndexRange, Range, Repeat, indexRange, mapRange, repeat }; |
{ | ||
"name": "@solid-primitives/range", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Control Flow Primitives for displaying given number or a number range of elements.", | ||
@@ -29,11 +29,2 @@ "author": "Damian Tarnawski @thetarnav <gthetarnav@gmail.com>", | ||
}, | ||
"private": false, | ||
"sideEffects": false, | ||
"type": "module", | ||
"main": "dist/index.cjs", | ||
"module": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"keywords": [ | ||
@@ -46,28 +37,44 @@ "control-flow", | ||
], | ||
"private": false, | ||
"sideEffects": false, | ||
"files": [ | ||
"dist" | ||
], | ||
"type": "module", | ||
"main": "./dist/index.cjs", | ||
"module": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"browser": {}, | ||
"exports": { | ||
"browser": { | ||
"development": { | ||
"import": "./dist/dev.js", | ||
"require": "./dist/dev.cjs" | ||
}, | ||
"import": "./dist/index.js", | ||
"require": "./dist/index.cjs" | ||
}, | ||
"development": { | ||
"import": "./dist/dev.js", | ||
"require": "./dist/dev.cjs" | ||
}, | ||
"import": "./dist/index.js", | ||
"require": "./dist/index.cjs" | ||
}, | ||
"devDependencies": { | ||
"jsdom": "^20.0.0", | ||
"prettier": "^2.7.1", | ||
"solid-js": "^1.5.1", | ||
"solid-transition-group": "^0.0.8", | ||
"tslib": "^2.4.0", | ||
"tsup": "^6.2.2", | ||
"typescript": "^4.7.4", | ||
"unocss": "^0.44.7", | ||
"vite": "^3.0.7", | ||
"vite-plugin-solid": "^2.3.0", | ||
"vitest": "^0.20.3" | ||
"solid-js": "^1.5.0", | ||
"solid-transition-group": "^0.0.8" | ||
}, | ||
"dependencies": { | ||
"@solid-primitives/utils": "^3.1.0" | ||
}, | ||
"peerDependencies": { | ||
"solid-js": "^1.3.0" | ||
"solid-js": "^1.5.0" | ||
}, | ||
"dependencies": { | ||
"@solid-primitives/utils": "^3.0.2" | ||
}, | ||
"scripts": { | ||
"start": "vite serve dev --host", | ||
"dev": "npm run start", | ||
"build": "tsup", | ||
"test": "vitest run test", | ||
"test:watch": "vitest watch test" | ||
"build": "jiti ../../scripts/build.ts --dev", | ||
"test": "vitest -c ../../configs/vitest.config.ts", | ||
"test:ssr": "pnpm run test --mode ssr" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47167
2
8
1094