@solid-primitives/cursor
Advanced tools
Comparing version 0.0.100 to 0.0.101
@@ -0,4 +1,5 @@ | ||
import { createEffect, onCleanup } from 'solid-js'; | ||
import { access } from '@solid-primitives/utils'; | ||
// src/index.ts | ||
import { createEffect, onCleanup } from "solid-js"; | ||
import { access } from "@solid-primitives/utils"; | ||
function createElementCursor(target, cursor) { | ||
@@ -25,5 +26,3 @@ createEffect(() => { | ||
} | ||
export { | ||
createBodyCursor, | ||
createElementCursor | ||
}; | ||
export { createBodyCursor, createElementCursor }; |
@@ -1,9 +0,27 @@ | ||
// src/server.ts | ||
var createElementCursor = () => { | ||
}; | ||
var createBodyCursor = () => { | ||
}; | ||
export { | ||
createBodyCursor, | ||
createElementCursor | ||
}; | ||
import { createEffect, onCleanup } from 'solid-js'; | ||
import { access } from '@solid-primitives/utils'; | ||
// src/index.ts | ||
function createElementCursor(target, cursor) { | ||
createEffect(() => { | ||
const el = access(target); | ||
const cursorValue = access(cursor); | ||
if (!el) | ||
return; | ||
const overwritten = el.style.cursor; | ||
el.style.cursor = cursorValue; | ||
onCleanup(() => el.style.cursor = overwritten); | ||
}); | ||
} | ||
function createBodyCursor(cursor) { | ||
createEffect(() => { | ||
const cursorValue = cursor(); | ||
if (!cursorValue) | ||
return; | ||
const overwritten = document.body.style.cursor; | ||
document.body.style.cursor = cursorValue; | ||
onCleanup(() => document.body.style.cursor = overwritten); | ||
}); | ||
} | ||
export { createBodyCursor, createElementCursor }; |
{ | ||
"name": "@solid-primitives/cursor", | ||
"version": "0.0.100", | ||
"version": "0.0.101", | ||
"description": "Two simple primitives for setting cursor css property reactively.", | ||
@@ -25,12 +25,34 @@ "author": "Damian Tarnawski <gthetarnav@gmail.com>", | ||
}, | ||
"keywords": [ | ||
"solid", | ||
"primitives", | ||
"style", | ||
"cursor" | ||
], | ||
"private": false, | ||
"sideEffects": false, | ||
"type": "module", | ||
"files": [ | ||
"dist" | ||
], | ||
"type": "module", | ||
"main": "./dist/server.cjs", | ||
"module": "./dist/index.js", | ||
"module": "./dist/server.js", | ||
"types": "./dist/index.d.ts", | ||
"browser": { | ||
"./dist/server.cjs": "./dist/index.cjs", | ||
"./dist/server.js": "./dist/index.js" | ||
}, | ||
"exports": { | ||
"worker": { | ||
"import": "./dist/server.js", | ||
"require": "./dist/server.cjs" | ||
}, | ||
"browser": { | ||
"import": "./dist/index.js", | ||
"require": "./dist/index.cjs" | ||
}, | ||
"deno": { | ||
"import": "./dist/server.js", | ||
"require": "./dist/server.cjs" | ||
}, | ||
"node": { | ||
@@ -43,33 +65,17 @@ "import": "./dist/server.js", | ||
}, | ||
"keywords": [ | ||
"solid", | ||
"primitives", | ||
"style", | ||
"cursor" | ||
], | ||
"dependencies": { | ||
"@solid-primitives/utils": "^3.1.0" | ||
}, | ||
"devDependencies": { | ||
"jsdom": "^20.0.0", | ||
"prettier": "^2.7.1", | ||
"solid-devtools": "^0.12.0", | ||
"solid-js": "^1.5.1", | ||
"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" | ||
}, | ||
"peerDependencies": { | ||
"solid-js": "^1.4.0" | ||
"solid-js": "^1.5.0" | ||
}, | ||
"dependencies": { | ||
"@solid-primitives/utils": "^3.0.1" | ||
}, | ||
"scripts": { | ||
"start": "vite serve dev --host", | ||
"dev": "npm run start", | ||
"build": "tsup", | ||
"test": "vitest" | ||
"build": "jiti ../../scripts/build.ts --ssr", | ||
"test": "vitest -c ../../configs/vitest.config.ts", | ||
"test:ssr": "pnpm run test --mode ssr" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1
10811
145