@kurocado-studio/systemhaus-motion-react 1.0.0-develop.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/exports.js +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/package.json +73 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Kurocado Studio Design System components
|
package/dist/exports.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{get as z}from"lodash-es";var B=Symbol("ThemeProvider");var p="@kurocado:color-scheme",w="ph ph-moon-stars",x="ph ph-sun";var s=(function(r){return r.DARK="dark",r.LIGHT="light",r.SYSTEM="system",r})(s||{});function h(){return globalThis.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function T(){var r;return(r=localStorage.getItem(p))!==null&&r!==void 0?r:void 0}function _(r){var o=document.documentElement,e=s.DARK;r===e?o.classList.add(e):o.classList.remove(e)}function y(){var r=T();return r==="system"||!r?h():r}function k(r){localStorage.setItem(p,r),_(r==="system"?h():r)}function V(){var r=y(),o=r==="dark"?"light":"dark";return k(o),o}function A(){return y()==="dark"}var c={getStoredTheme:T,getSystemTheme:h,resolveEffectiveTheme:y,applyTheme:_,setTheme:k,toggleTheme:V,isDarkMode:A};import{useEffect as D,useState as I}from"react";function Y(){let[r,o]=I(()=>globalThis.window===void 0?s.LIGHT:c.resolveEffectiveTheme());D(()=>{if(globalThis.window===void 0)return;c.applyTheme(r);let n=globalThis.matchMedia("(prefers-color-scheme: dark)"),l=()=>{let i=c.getStoredTheme();if(i===s.SYSTEM||!i){let v=c.getSystemTheme();c.applyTheme(v),o(v)}};return n.addEventListener("change",l),()=>{n.removeEventListener("change",l)}},[r]);let e=()=>{let n=c.toggleTheme();o(n)},t=n=>{c.setTheme(n),o(c.resolveEffectiveTheme())},a=r===s.DARK?w:x;return{isDark:r===s.DARK,theme:r,toggle:e,iconSettings:a,setTheme:t}}import{get as M}from"lodash-es";function G(r,o,e,t){var a=r.getBoundingClientRect(),m=a.left+a.width/2,n=a.top+a.height/2,l=o-m,i=e-n,v=t.magneticModeActivationRadius,d=M(t,["maxDistance"],3e3),u=M(t,["intensity"],.1);if(globalThis.matchMedia("(prefers-reduced-motion: reduce)").matches)return{x:0,y:0};if(typeof v=="number"){var f=Math.hypot(Math.pow(l,2)+Math.pow(i,2));if(f>d)return{x:0,y:0};var g=0;return f<v&&(g=1-f/v),{x:l*g*u,y:i*g*u}}if(Math.abs(l)<d&&Math.abs(i)<d){var b=1-Math.max(Math.abs(l),Math.abs(i))/d;return{x:l*b*u,y:i*b*u}}return{x:0,y:0}}import{useMotionValue as E,useSpring as S}from"framer-motion";import{get as C}from"lodash-es";import{useEffect as O,useState as R}from"react";function $(r){let o=C(r,["damping"],100),e=C(r,["stiffness"],600),t=E(0),a=E(0),[m,n]=R(),l=S(t,{damping:o,stiffness:e}),i=S(a,{damping:o,stiffness:e});return O(()=>{let v=d=>{if(!m)return;let{x:u,y:f}=G(m,d.clientX,d.clientY,r);t.set(u),a.set(f)};return document.addEventListener("mousemove",v),()=>document.removeEventListener("mousemove",v)},[m,r,t,a]),{ref:n,x:l,y:i}}export{s as ThemeEnum,$ as useCursorFollow,Y as useDarkMode};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as framer_motion from 'framer-motion';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
|
|
4
|
+
declare type CalculateCursorOffsetController = CursorFollowSettings;
|
|
5
|
+
|
|
6
|
+
declare interface CursorFollowSettings {
|
|
7
|
+
damping?: number;
|
|
8
|
+
stiffness?: number;
|
|
9
|
+
maxDistance?: number;
|
|
10
|
+
intensity?: number;
|
|
11
|
+
magneticModeActivationRadius?: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export declare interface DarkModeController {
|
|
15
|
+
isDark: boolean;
|
|
16
|
+
theme: ThemeEnum;
|
|
17
|
+
toggle: () => void;
|
|
18
|
+
iconSettings: string;
|
|
19
|
+
setTheme: (newTheme: ThemeEnum) => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export declare enum ThemeEnum {
|
|
23
|
+
DARK = "dark",
|
|
24
|
+
LIGHT = "light",
|
|
25
|
+
SYSTEM = "system"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export declare function useCursorFollow(settings: CalculateCursorOffsetController): {
|
|
29
|
+
ref: react.Dispatch<react.SetStateAction<HTMLDivElement | undefined>>;
|
|
30
|
+
x: framer_motion.MotionValue<number>;
|
|
31
|
+
y: framer_motion.MotionValue<number>;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export declare function useDarkMode(): DarkModeController;
|
|
35
|
+
|
|
36
|
+
export { }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.53.1"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kurocado-studio/systemhaus-motion-react",
|
|
3
|
+
"version": "1.0.0-develop.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"keywords": [],
|
|
9
|
+
"author": "@kurocado-studio",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"main": "./dist/exports.js",
|
|
12
|
+
"module": "./dist/exports.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./dist/exports.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/exports.js"
|
|
20
|
+
},
|
|
21
|
+
"./tailwind.css": {
|
|
22
|
+
"import": "./dist/exports.css",
|
|
23
|
+
"default": "./dist/exports.css"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build:typings": "api-extractor run --local",
|
|
31
|
+
"build": "rm -rf dist && tsup && pnpm build:typings && rm -rf dist/exports.d.ts",
|
|
32
|
+
"prepublishOnly": "node ../../scripts/strip-workspaces.js .",
|
|
33
|
+
"clean": "rm -rf .turbo node_modules dist",
|
|
34
|
+
"dev": "tsup --watch",
|
|
35
|
+
"dev:vite": "vite build --watch --mode development",
|
|
36
|
+
"vite:watch": "vite build --watch --mode development",
|
|
37
|
+
"build:vite": "rm -rf dist && vite build --mode production",
|
|
38
|
+
"lint": "eslint --max-warnings=0 --no-warn-ignored",
|
|
39
|
+
"lint:fix": "eslint --max-warnings=0 --fix --no-warn-ignored",
|
|
40
|
+
"prettier:fix": "prettier --write . --ignore-path ../../.prettierignore",
|
|
41
|
+
"prettier:check": "prettier --check . --ignore-path ../../.prettierignore",
|
|
42
|
+
"typecheck": "tsc --noEmit --pretty"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@emotion/is-prop-valid": "^1.3.1",
|
|
46
|
+
"framer-motion": "^12.23.6",
|
|
47
|
+
"lodash-es": "^4.17.21",
|
|
48
|
+
"motion": "^12.11.0",
|
|
49
|
+
"react": "19"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@internal/config": "workspace:*",
|
|
53
|
+
"@kurocado-studio/qa": "2.0.1",
|
|
54
|
+
"@microsoft/api-extractor": "^7.52.11",
|
|
55
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
56
|
+
"@types/lodash-es": "^4.17.12",
|
|
57
|
+
"@types/node": "^22.15.19",
|
|
58
|
+
"@types/react": "^19.1.10",
|
|
59
|
+
"@types/react-dom": "^19.1.4",
|
|
60
|
+
"@vitejs/plugin-react": "^4.4.1",
|
|
61
|
+
"@vitest/coverage-v8": "^3.1.3",
|
|
62
|
+
"copyfiles": "^2.4.1",
|
|
63
|
+
"eslint": "^9.28.0",
|
|
64
|
+
"prettier": "3.5.3",
|
|
65
|
+
"tsup": "^8.5.0",
|
|
66
|
+
"typescript": "5.8.3",
|
|
67
|
+
"vite": "^5.2.8",
|
|
68
|
+
"vite-node": "3.2.4",
|
|
69
|
+
"vite-plugin-dts": "^4.5.3",
|
|
70
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
71
|
+
"vitest": "^3.1.3"
|
|
72
|
+
}
|
|
73
|
+
}
|