@cos-design/spotlight 3.5.2 → 4.0.0
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/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +45 -0
- package/dist/core/packages/shared/src/canvas-box.d.ts +18 -0
- package/dist/core/packages/shared/src/host-layout.d.ts +22 -0
- package/dist/core/packages/shared/src/index.d.ts +11 -0
- package/dist/core/packages/shared/src/math.d.ts +2 -0
- package/dist/core/packages/shared/src/photo.d.ts +15 -0
- package/dist/core/packages/shared/src/pointer.d.ts +14 -0
- package/dist/core/packages/shared/src/react/index.d.ts +30 -0
- package/dist/core/packages/shared/src/reduced-motion.d.ts +4 -0
- package/dist/core/packages/shared/src/size.d.ts +8 -0
- package/dist/core/packages/shared/src/visibility.d.ts +2 -0
- package/dist/core/packages/spotlight/src/core.d.ts +1 -0
- package/dist/core/packages/spotlight/src/element.d.ts +1 -0
- package/dist/core/packages/spotlight/src/react.d.ts +3 -0
- package/dist/core/packages/spotlight/src/vue.d.ts +2 -0
- package/dist/core/src/components/spotlight/core/engine.d.ts +2 -0
- package/dist/core/src/components/spotlight/core/index.d.ts +2 -0
- package/dist/core/src/components/spotlight/core/types.d.ts +13 -0
- package/dist/core/src/components/spotlight/element/index.d.ts +14 -0
- package/dist/core/src/components/spotlight/index.d.ts +3 -0
- package/dist/core/src/components/spotlight/react/index.d.ts +6 -0
- package/dist/{src → core/src}/vite-env.d.ts +6 -0
- package/dist/element/element.css +1 -0
- package/dist/element/index.d.ts +1 -0
- package/dist/element/index.js +87 -0
- package/dist/element/packages/shared/src/canvas-box.d.ts +18 -0
- package/dist/element/packages/shared/src/host-layout.d.ts +22 -0
- package/dist/element/packages/shared/src/index.d.ts +11 -0
- package/dist/element/packages/shared/src/math.d.ts +2 -0
- package/dist/element/packages/shared/src/photo.d.ts +15 -0
- package/dist/element/packages/shared/src/pointer.d.ts +14 -0
- package/dist/element/packages/shared/src/react/index.d.ts +30 -0
- package/dist/element/packages/shared/src/reduced-motion.d.ts +4 -0
- package/dist/element/packages/shared/src/size.d.ts +8 -0
- package/dist/element/packages/shared/src/visibility.d.ts +2 -0
- package/dist/element/packages/spotlight/src/core.d.ts +1 -0
- package/dist/element/packages/spotlight/src/element.d.ts +1 -0
- package/dist/element/packages/spotlight/src/index.d.ts +3 -0
- package/dist/element/packages/spotlight/src/react.d.ts +3 -0
- package/dist/element/packages/spotlight/src/vue.d.ts +2 -0
- package/dist/element/src/components/spotlight/core/engine.d.ts +2 -0
- package/dist/element/src/components/spotlight/core/index.d.ts +2 -0
- package/dist/element/src/components/spotlight/core/types.d.ts +13 -0
- package/dist/element/src/components/spotlight/element/index.d.ts +14 -0
- package/dist/element/src/components/spotlight/index.d.ts +3 -0
- package/dist/element/src/components/spotlight/react/index.d.ts +6 -0
- package/dist/element/src/vite-env.d.ts +45 -0
- package/dist/react/index.cjs +1 -0
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.js +76 -0
- package/dist/react/packages/shared/src/canvas-box.d.ts +18 -0
- package/dist/react/packages/shared/src/host-layout.d.ts +22 -0
- package/dist/react/packages/shared/src/index.d.ts +11 -0
- package/dist/react/packages/shared/src/math.d.ts +2 -0
- package/dist/react/packages/shared/src/photo.d.ts +15 -0
- package/dist/react/packages/shared/src/pointer.d.ts +14 -0
- package/dist/react/packages/shared/src/react/index.d.ts +30 -0
- package/dist/react/packages/shared/src/reduced-motion.d.ts +4 -0
- package/dist/react/packages/shared/src/size.d.ts +8 -0
- package/dist/react/packages/shared/src/visibility.d.ts +2 -0
- package/dist/react/packages/spotlight/src/core.d.ts +1 -0
- package/dist/react/packages/spotlight/src/element.d.ts +1 -0
- package/dist/react/packages/spotlight/src/index.d.ts +3 -0
- package/dist/react/packages/spotlight/src/react.d.ts +3 -0
- package/dist/react/packages/spotlight/src/vue.d.ts +2 -0
- package/dist/react/react.css +1 -0
- package/dist/react/src/components/spotlight/core/engine.d.ts +2 -0
- package/dist/react/src/components/spotlight/core/index.d.ts +2 -0
- package/dist/react/src/components/spotlight/core/types.d.ts +13 -0
- package/dist/react/src/components/spotlight/element/index.d.ts +14 -0
- package/dist/react/src/components/spotlight/index.d.ts +3 -0
- package/dist/react/src/components/spotlight/react/index.d.ts +6 -0
- package/dist/react/src/vite-env.d.ts +45 -0
- package/dist/vue/index.d.ts +2 -0
- package/dist/vue/index.js +76 -0
- package/dist/vue/packages/shared/src/canvas-box.d.ts +18 -0
- package/dist/vue/packages/shared/src/host-layout.d.ts +22 -0
- package/dist/vue/packages/shared/src/index.d.ts +11 -0
- package/dist/vue/packages/shared/src/math.d.ts +2 -0
- package/dist/vue/packages/shared/src/photo.d.ts +15 -0
- package/dist/vue/packages/shared/src/pointer.d.ts +14 -0
- package/dist/vue/packages/shared/src/react/index.d.ts +30 -0
- package/dist/vue/packages/shared/src/reduced-motion.d.ts +4 -0
- package/dist/vue/packages/shared/src/size.d.ts +8 -0
- package/dist/vue/packages/shared/src/visibility.d.ts +2 -0
- package/dist/vue/packages/spotlight/src/core.d.ts +1 -0
- package/dist/vue/packages/spotlight/src/element.d.ts +1 -0
- package/dist/vue/packages/spotlight/src/index.d.ts +3 -0
- package/dist/vue/packages/spotlight/src/react.d.ts +3 -0
- package/dist/vue/packages/spotlight/src/vue.d.ts +2 -0
- package/dist/vue/src/components/spotlight/core/engine.d.ts +2 -0
- package/dist/vue/src/components/spotlight/core/index.d.ts +2 -0
- package/dist/vue/src/components/spotlight/core/types.d.ts +13 -0
- package/dist/vue/src/components/spotlight/element/index.d.ts +14 -0
- package/dist/vue/src/components/spotlight/index.d.ts +3 -0
- package/dist/vue/src/components/spotlight/react/index.d.ts +6 -0
- package/dist/vue/src/vite-env.d.ts +45 -0
- package/dist/vue/vue.css +1 -0
- package/package.json +45 -10
- package/dist/index.cjs +0 -1
- package/dist/index.css +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -29
- package/dist/src/components/spotlight/index.d.ts +0 -10
- /package/dist/{packages → core/packages}/spotlight/src/index.d.ts +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SpotlightOptions } from '../core';
|
|
2
|
+
export type { SpotlightOptions } from '../core/types';
|
|
3
|
+
declare const Spotlight: import('react').ForwardRefExoticComponent<SpotlightOptions & {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
} & import('react').RefAttributes<unknown>>;
|
|
6
|
+
export default Spotlight;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
declare module '*.vue' {
|
|
4
|
+
import type { DefineComponent } from 'vue';
|
|
5
|
+
const component: DefineComponent<object, object, unknown>;
|
|
6
|
+
export default component;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare module '*.module.less' {
|
|
10
|
+
const classes: { readonly [key: string]: string };
|
|
11
|
+
export default classes;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare module '*.less' {
|
|
15
|
+
const classes: { readonly [key: string]: string };
|
|
16
|
+
export default classes;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare module '*.png' {
|
|
20
|
+
const src: string;
|
|
21
|
+
export default src;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare module '*.jpg' {
|
|
25
|
+
const src: string;
|
|
26
|
+
export default src;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare module '*.mp4' {
|
|
30
|
+
const src: string;
|
|
31
|
+
export default src;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare module '*.mp3' {
|
|
35
|
+
const src: string;
|
|
36
|
+
export default src;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare module '*.svg' {
|
|
40
|
+
import type { FC, SVGProps } from 'react';
|
|
41
|
+
|
|
42
|
+
export const ReactComponent: FC<SVGProps<SVGSVGElement>>;
|
|
43
|
+
const src: string;
|
|
44
|
+
export default src;
|
|
45
|
+
}
|
package/dist/vue/vue.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.cos-spotlight{--spot-x:50%;--spot-y:50%;--spot-radius:120px;--dim-color:#000000d9;border-radius:12px;width:100%;min-height:320px;position:relative;overflow:hidden}.cos-spotlight__content{z-index:0;min-height:inherit;color:#e2e8f0;background:linear-gradient(135deg,#1e293b,#0f172a);justify-content:center;align-items:center;padding:40px;font-size:18px;display:flex;position:relative}.cos-spotlight__overlay{z-index:1;pointer-events:none;background:radial-gradient(circle var(--spot-radius) at var(--spot-x) var(--spot-y), transparent 0%, transparent 40%, var(--dim-color) 100%);position:absolute;inset:0}
|
package/package.json
CHANGED
|
@@ -1,20 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cos-design/spotlight",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Spotlight component from cos-design",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.cjs",
|
|
7
|
-
"module": "./dist/index.js",
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
6
|
+
"main": "./dist/react/index.cjs",
|
|
7
|
+
"module": "./dist/react/index.js",
|
|
8
|
+
"types": "./dist/react/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"import": {
|
|
12
|
-
"types": "./dist/index.d.ts",
|
|
13
|
-
"default": "./dist/index.js"
|
|
12
|
+
"types": "./dist/react/index.d.ts",
|
|
13
|
+
"default": "./dist/react/index.js"
|
|
14
14
|
},
|
|
15
15
|
"require": {
|
|
16
|
-
"types": "./dist/index.d.ts",
|
|
17
|
-
"default": "./dist/index.cjs"
|
|
16
|
+
"types": "./dist/react/index.d.ts",
|
|
17
|
+
"default": "./dist/react/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"./vue": {
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./dist/vue/index.d.ts",
|
|
23
|
+
"default": "./dist/vue/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"./core": {
|
|
27
|
+
"import": {
|
|
28
|
+
"types": "./dist/core/index.d.ts",
|
|
29
|
+
"default": "./dist/core/index.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"./element": {
|
|
33
|
+
"import": {
|
|
34
|
+
"types": "./dist/element/index.d.ts",
|
|
35
|
+
"default": "./dist/element/index.js"
|
|
18
36
|
}
|
|
19
37
|
}
|
|
20
38
|
},
|
|
@@ -24,11 +42,13 @@
|
|
|
24
42
|
],
|
|
25
43
|
"sideEffects": [
|
|
26
44
|
"**/*.css",
|
|
27
|
-
"**/*.less"
|
|
45
|
+
"**/*.less",
|
|
46
|
+
"./dist/element/index.js"
|
|
28
47
|
],
|
|
29
48
|
"keywords": [
|
|
30
49
|
"cos-design",
|
|
31
50
|
"react",
|
|
51
|
+
"vue",
|
|
32
52
|
"spotlight",
|
|
33
53
|
"Spotlight"
|
|
34
54
|
],
|
|
@@ -45,10 +65,25 @@
|
|
|
45
65
|
"license": "MIT",
|
|
46
66
|
"peerDependencies": {
|
|
47
67
|
"react": ">=18.0.0",
|
|
48
|
-
"react-dom": ">=18.0.0"
|
|
68
|
+
"react-dom": ">=18.0.0",
|
|
69
|
+
"vue": ">=3.4.0"
|
|
49
70
|
},
|
|
50
71
|
"publishConfig": {
|
|
51
72
|
"access": "public",
|
|
52
73
|
"registry": "https://registry.npmjs.org"
|
|
74
|
+
},
|
|
75
|
+
"peerDependenciesMeta": {
|
|
76
|
+
"react": {
|
|
77
|
+
"optional": true
|
|
78
|
+
},
|
|
79
|
+
"react-dom": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
82
|
+
"vue": {
|
|
83
|
+
"optional": true
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"dependencies": {
|
|
87
|
+
"@cos-design/shared": "4.0.0"
|
|
53
88
|
}
|
|
54
89
|
}
|
package/dist/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});require('./index.css');var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("react");c=s(c,1);let l=require("react/jsx-runtime");var u={spotlight:`cos-spotlight-OddY1`,content:`cos-content-5I1Wy`,overlay:`cos-overlay-F6CJ5`},d=({children:e,radius:t=120,dimColor:n=`rgba(0, 0, 0, 0.85)`})=>{let r=(0,c.useRef)(null),i=(0,c.useCallback)(e=>{let t=r.current;if(!t)return;let n=t.getBoundingClientRect(),i=e.clientX-n.left,a=e.clientY-n.top;t.style.setProperty(`--spot-x`,`${i}px`),t.style.setProperty(`--spot-y`,`${a}px`)},[]);return(0,l.jsxs)(`div`,{ref:r,className:u.spotlight,style:{"--spot-radius":`${t}px`,"--dim-color":n},onMouseMove:i,children:[(0,l.jsx)(`div`,{className:u.content,children:e}),(0,l.jsx)(`div`,{className:u.overlay})]})};exports.Spotlight=d,exports.default=d;
|
package/dist/index.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.cos-spotlight-OddY1{--spot-x:50%;--spot-y:50%;--spot-radius:120px;--dim-color:#000000d9;border-radius:12px;width:100%;min-height:320px;position:relative;overflow:hidden}.cos-content-5I1Wy{z-index:0;min-height:inherit;color:#e2e8f0;background:linear-gradient(135deg,#1e293b,#0f172a);justify-content:center;align-items:center;padding:40px;font-size:18px;display:flex;position:relative}.cos-overlay-F6CJ5{z-index:1;pointer-events:none;background:radial-gradient(circle var(--spot-radius) at var(--spot-x) var(--spot-y), transparent 0%, transparent 40%, var(--dim-color) 100%);position:absolute;inset:0}
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { useCallback as e, useRef as t } from "react";
|
|
2
|
-
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
3
|
-
import './index.css';var i = {
|
|
4
|
-
spotlight: "cos-spotlight-OddY1",
|
|
5
|
-
content: "cos-content-5I1Wy",
|
|
6
|
-
overlay: "cos-overlay-F6CJ5"
|
|
7
|
-
}, a = ({ children: a, radius: o = 120, dimColor: s = "rgba(0, 0, 0, 0.85)" }) => {
|
|
8
|
-
let c = t(null), l = e((e) => {
|
|
9
|
-
let t = c.current;
|
|
10
|
-
if (!t) return;
|
|
11
|
-
let n = t.getBoundingClientRect(), r = e.clientX - n.left, i = e.clientY - n.top;
|
|
12
|
-
t.style.setProperty("--spot-x", `${r}px`), t.style.setProperty("--spot-y", `${i}px`);
|
|
13
|
-
}, []);
|
|
14
|
-
return /* @__PURE__ */ r("div", {
|
|
15
|
-
ref: c,
|
|
16
|
-
className: i.spotlight,
|
|
17
|
-
style: {
|
|
18
|
-
"--spot-radius": `${o}px`,
|
|
19
|
-
"--dim-color": s
|
|
20
|
-
},
|
|
21
|
-
onMouseMove: l,
|
|
22
|
-
children: [/* @__PURE__ */ n("div", {
|
|
23
|
-
className: i.content,
|
|
24
|
-
children: a
|
|
25
|
-
}), /* @__PURE__ */ n("div", { className: i.overlay })]
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
//#endregion
|
|
29
|
-
export { a as Spotlight, a as default };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
export interface SpotlightProps {
|
|
3
|
-
children?: React.ReactNode;
|
|
4
|
-
/** 聚光半径,默认 120 */
|
|
5
|
-
radius?: number;
|
|
6
|
-
/** 遮罩颜色,默认 rgba(0,0,0,0.85) */
|
|
7
|
-
dimColor?: string;
|
|
8
|
-
}
|
|
9
|
-
declare const Spotlight: React.FC<SpotlightProps>;
|
|
10
|
-
export default Spotlight;
|
|
File without changes
|