@cos-design/true-focus 3.7.0 → 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 +68 -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/trueFocus/src/core.d.ts +1 -0
- package/dist/core/packages/trueFocus/src/element.d.ts +1 -0
- package/dist/core/packages/trueFocus/src/react.d.ts +3 -0
- package/dist/core/packages/trueFocus/src/vue.d.ts +2 -0
- package/dist/core/src/components/trueFocus/core/engine.d.ts +2 -0
- package/dist/core/src/components/trueFocus/core/index.d.ts +2 -0
- package/dist/core/src/components/trueFocus/core/types.d.ts +17 -0
- package/dist/core/src/components/trueFocus/element/index.d.ts +9 -0
- package/dist/core/src/components/trueFocus/index.d.ts +3 -0
- package/dist/core/src/components/trueFocus/react/index.d.ts +4 -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 +102 -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/trueFocus/src/core.d.ts +1 -0
- package/dist/element/packages/trueFocus/src/element.d.ts +1 -0
- package/dist/element/packages/trueFocus/src/index.d.ts +3 -0
- package/dist/element/packages/trueFocus/src/react.d.ts +3 -0
- package/dist/element/packages/trueFocus/src/vue.d.ts +2 -0
- package/dist/element/src/components/trueFocus/core/engine.d.ts +2 -0
- package/dist/element/src/components/trueFocus/core/index.d.ts +2 -0
- package/dist/element/src/components/trueFocus/core/types.d.ts +17 -0
- package/dist/element/src/components/trueFocus/element/index.d.ts +9 -0
- package/dist/element/src/components/trueFocus/index.d.ts +3 -0
- package/dist/element/src/components/trueFocus/react/index.d.ts +4 -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 +92 -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/trueFocus/src/core.d.ts +1 -0
- package/dist/react/packages/trueFocus/src/element.d.ts +1 -0
- package/dist/react/packages/trueFocus/src/index.d.ts +3 -0
- package/dist/react/packages/trueFocus/src/react.d.ts +3 -0
- package/dist/react/packages/trueFocus/src/vue.d.ts +2 -0
- package/dist/react/react.css +1 -0
- package/dist/react/src/components/trueFocus/core/engine.d.ts +2 -0
- package/dist/react/src/components/trueFocus/core/index.d.ts +2 -0
- package/dist/react/src/components/trueFocus/core/types.d.ts +17 -0
- package/dist/react/src/components/trueFocus/element/index.d.ts +9 -0
- package/dist/react/src/components/trueFocus/index.d.ts +3 -0
- package/dist/react/src/components/trueFocus/react/index.d.ts +4 -0
- package/dist/react/src/vite-env.d.ts +45 -0
- package/dist/vue/index.d.ts +2 -0
- package/dist/vue/index.js +99 -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/trueFocus/src/core.d.ts +1 -0
- package/dist/vue/packages/trueFocus/src/element.d.ts +1 -0
- package/dist/vue/packages/trueFocus/src/index.d.ts +3 -0
- package/dist/vue/packages/trueFocus/src/react.d.ts +3 -0
- package/dist/vue/packages/trueFocus/src/vue.d.ts +2 -0
- package/dist/vue/src/components/trueFocus/core/engine.d.ts +2 -0
- package/dist/vue/src/components/trueFocus/core/index.d.ts +2 -0
- package/dist/vue/src/components/trueFocus/core/types.d.ts +17 -0
- package/dist/vue/src/components/trueFocus/element/index.d.ts +9 -0
- package/dist/vue/src/components/trueFocus/index.d.ts +3 -0
- package/dist/vue/src/components/trueFocus/react/index.d.ts +4 -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 -98
- package/dist/src/components/trueFocus/index.d.ts +0 -25
- /package/dist/{packages → core/packages}/trueFocus/src/index.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../src/components/trueFocus/core';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../src/components/trueFocus/element';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface TrueFocusOptions {
|
|
2
|
+
sentence?: string;
|
|
3
|
+
separator?: string;
|
|
4
|
+
manualMode?: boolean;
|
|
5
|
+
blurAmount?: number;
|
|
6
|
+
borderColor?: string;
|
|
7
|
+
glowColor?: string;
|
|
8
|
+
animationDuration?: number;
|
|
9
|
+
pauseBetweenAnimations?: number;
|
|
10
|
+
fontSize?: number;
|
|
11
|
+
color?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface TrueFocusController {
|
|
14
|
+
update(o: Partial<TrueFocusOptions>): void;
|
|
15
|
+
destroy(): void;
|
|
16
|
+
}
|
|
17
|
+
export type TrueFocusProps = TrueFocusOptions;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const TAG = "cos-true-focus";
|
|
2
|
+
declare class CosTrueFocusElement extends HTMLElement {
|
|
3
|
+
private ctrl;
|
|
4
|
+
static get observedAttributes(): string[];
|
|
5
|
+
connectedCallback(): void;
|
|
6
|
+
disconnectedCallback(): void;
|
|
7
|
+
attributeChangedCallback(): void;
|
|
8
|
+
}
|
|
9
|
+
export { CosTrueFocusElement, TAG };
|
|
@@ -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-true-focus{background:radial-gradient(circle at 40% 40%,#22c55e1a,#0000 36%),linear-gradient(#0a0a0a,#0f172a);border-radius:18px;justify-content:center;align-items:center;min-height:220px;padding:40px;display:flex;overflow:hidden}.cos-true-focus__stage{color:var(--focus-color,#f8fafc);letter-spacing:.02em;-webkit-user-select:none;user-select:none;flex-wrap:wrap;justify-content:center;align-items:center;gap:16px;font-weight:900;display:flex;position:relative}.cos-true-focus__word{transition:filter var(--focus-duration,.5s) ease;position:relative}.cos-true-focus__focus-frame{pointer-events:none;box-sizing:border-box;transition:transform var(--focus-duration,.5s) ease, width var(--focus-duration,.5s) ease, height var(--focus-duration,.5s) ease, opacity var(--focus-duration,.5s) ease;position:absolute;top:0;left:0}.cos-true-focus__corner{border:3px solid var(--border-color,#22c55e);width:14px;height:14px;filter:drop-shadow(0 0 4px var(--glow-color,#22c55e99));border-radius:3px;position:absolute}.cos-true-focus__tl{border-bottom:0;border-right:0;top:-10px;left:-10px}.cos-true-focus__tr{border-bottom:0;border-left:0;top:-10px;right:-10px}.cos-true-focus__bl{border-top:0;border-right:0;bottom:-10px;left:-10px}.cos-true-focus__br{border-top:0;border-left:0;bottom:-10px;right:-10px}
|
package/package.json
CHANGED
|
@@ -1,20 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cos-design/true-focus",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "TrueFocus 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
|
"trueFocus",
|
|
33
53
|
"TrueFocus"
|
|
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={trueFocus:`cos-trueFocus-GX7IP`,stage:`cos-stage-epay6`,word:`cos-word-5pfV3`,focusFrame:`cos-focusFrame-o7brV`,corner:`cos-corner-PThvn`,tl:`cos-tl-maoq6`,tr:`cos-tr-KTph3`,bl:`cos-bl-JAm8m`,br:`cos-br-s9hq-`},d=({sentence:e=`True Focus`,separator:t=` `,manualMode:n=!1,blurAmount:r=5,borderColor:i=`#22c55e`,glowColor:a=`rgb(34 197 94 / 60%)`,animationDuration:o=.5,pauseBetweenAnimations:s=1,fontSize:d=48,color:f=`#f8fafc`})=>{let p=e.split(t).filter(Boolean),[m,h]=(0,c.useState)(0),[g,_]=(0,c.useState)(0),v=(0,c.useRef)(null),y=(0,c.useRef)([]),[b,x]=(0,c.useState)({x:0,y:0,width:0,height:0});(0,c.useEffect)(()=>{if(n||p.length===0)return;let e=window.setInterval(()=>{h(e=>(e+1)%p.length)},(o+s)*1e3);return()=>window.clearInterval(e)},[o,n,s,p.length]),(0,c.useEffect)(()=>{let e=v.current,t=y.current[m];if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();x({x:r.left-n.left,y:r.top-n.top,width:r.width,height:r.height})},[m,d,e,p.length]);let S=e=>{n&&(_(e),h(e))},C=()=>{n&&h(g)};return(0,l.jsx)(`div`,{className:u.trueFocus,children:(0,l.jsxs)(`div`,{className:u.stage,ref:v,style:{fontSize:d,"--focus-color":f,"--border-color":i,"--glow-color":a,"--focus-duration":`${o}s`},children:[p.map((e,t)=>{let i=t===m;return(0,l.jsx)(`span`,{ref:e=>{y.current[t]=e},className:u.word,style:{filter:i?`blur(0px)`:`blur(${r}px)`,cursor:n?`pointer`:`default`},onMouseEnter:()=>S(t),onMouseLeave:C,children:e},`${e}-${t}`)}),(0,l.jsxs)(`div`,{className:u.focusFrame,style:{transform:`translate(${b.x}px, ${b.y}px)`,width:b.width,height:b.height,opacity:+(m>=0)},children:[(0,l.jsx)(`span`,{className:`${u.corner} ${u.tl}`}),(0,l.jsx)(`span`,{className:`${u.corner} ${u.tr}`}),(0,l.jsx)(`span`,{className:`${u.corner} ${u.bl}`}),(0,l.jsx)(`span`,{className:`${u.corner} ${u.br}`})]})]})})};exports.TrueFocus=d,exports.default=d;
|
package/dist/index.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.cos-trueFocus-GX7IP{background:radial-gradient(circle at 40% 40%,#22c55e1a,#0000 36%),linear-gradient(#0a0a0a,#0f172a);border-radius:18px;justify-content:center;align-items:center;min-height:220px;padding:40px;display:flex;overflow:hidden}.cos-stage-epay6{color:var(--focus-color,#f8fafc);letter-spacing:.02em;-webkit-user-select:none;user-select:none;flex-wrap:wrap;justify-content:center;align-items:center;gap:16px;font-weight:900;display:flex;position:relative}.cos-word-5pfV3{transition:filter var(--focus-duration,.5s) ease;position:relative}.cos-focusFrame-o7brV{pointer-events:none;box-sizing:border-box;transition:transform var(--focus-duration,.5s) ease, width var(--focus-duration,.5s) ease, height var(--focus-duration,.5s) ease, opacity var(--focus-duration,.5s) ease;position:absolute;top:0;left:0}.cos-corner-PThvn{border:3px solid var(--border-color,#22c55e);width:14px;height:14px;filter:drop-shadow(0 0 4px var(--glow-color,#22c55e99));border-radius:3px;position:absolute}.cos-tl-maoq6{border-bottom:0;border-right:0;top:-10px;left:-10px}.cos-tr-KTph3{border-bottom:0;border-left:0;top:-10px;right:-10px}.cos-bl-JAm8m{border-top:0;border-right:0;bottom:-10px;left:-10px}.cos-br-s9hq-{border-top:0;border-left:0;bottom:-10px;right:-10px}
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { useEffect as e, useRef as t, useState as n } from "react";
|
|
2
|
-
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
3
|
-
import './index.css';var a = {
|
|
4
|
-
trueFocus: "cos-trueFocus-GX7IP",
|
|
5
|
-
stage: "cos-stage-epay6",
|
|
6
|
-
word: "cos-word-5pfV3",
|
|
7
|
-
focusFrame: "cos-focusFrame-o7brV",
|
|
8
|
-
corner: "cos-corner-PThvn",
|
|
9
|
-
tl: "cos-tl-maoq6",
|
|
10
|
-
tr: "cos-tr-KTph3",
|
|
11
|
-
bl: "cos-bl-JAm8m",
|
|
12
|
-
br: "cos-br-s9hq-"
|
|
13
|
-
}, o = ({ sentence: o = "True Focus", separator: s = " ", manualMode: c = !1, blurAmount: l = 5, borderColor: u = "#22c55e", glowColor: d = "rgb(34 197 94 / 60%)", animationDuration: f = .5, pauseBetweenAnimations: p = 1, fontSize: m = 48, color: h = "#f8fafc" }) => {
|
|
14
|
-
let g = o.split(s).filter(Boolean), [_, v] = n(0), [y, b] = n(0), x = t(null), S = t([]), [C, w] = n({
|
|
15
|
-
x: 0,
|
|
16
|
-
y: 0,
|
|
17
|
-
width: 0,
|
|
18
|
-
height: 0
|
|
19
|
-
});
|
|
20
|
-
e(() => {
|
|
21
|
-
if (c || g.length === 0) return;
|
|
22
|
-
let e = window.setInterval(() => {
|
|
23
|
-
v((e) => (e + 1) % g.length);
|
|
24
|
-
}, (f + p) * 1e3);
|
|
25
|
-
return () => window.clearInterval(e);
|
|
26
|
-
}, [
|
|
27
|
-
f,
|
|
28
|
-
c,
|
|
29
|
-
p,
|
|
30
|
-
g.length
|
|
31
|
-
]), e(() => {
|
|
32
|
-
let e = x.current, t = S.current[_];
|
|
33
|
-
if (!e || !t) return;
|
|
34
|
-
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
35
|
-
w({
|
|
36
|
-
x: r.left - n.left,
|
|
37
|
-
y: r.top - n.top,
|
|
38
|
-
width: r.width,
|
|
39
|
-
height: r.height
|
|
40
|
-
});
|
|
41
|
-
}, [
|
|
42
|
-
_,
|
|
43
|
-
m,
|
|
44
|
-
o,
|
|
45
|
-
g.length
|
|
46
|
-
]);
|
|
47
|
-
let T = (e) => {
|
|
48
|
-
c && (b(e), v(e));
|
|
49
|
-
}, E = () => {
|
|
50
|
-
c && v(y);
|
|
51
|
-
};
|
|
52
|
-
return /* @__PURE__ */ r("div", {
|
|
53
|
-
className: a.trueFocus,
|
|
54
|
-
children: /* @__PURE__ */ i("div", {
|
|
55
|
-
className: a.stage,
|
|
56
|
-
ref: x,
|
|
57
|
-
style: {
|
|
58
|
-
fontSize: m,
|
|
59
|
-
"--focus-color": h,
|
|
60
|
-
"--border-color": u,
|
|
61
|
-
"--glow-color": d,
|
|
62
|
-
"--focus-duration": `${f}s`
|
|
63
|
-
},
|
|
64
|
-
children: [g.map((e, t) => {
|
|
65
|
-
let n = t === _;
|
|
66
|
-
return /* @__PURE__ */ r("span", {
|
|
67
|
-
ref: (e) => {
|
|
68
|
-
S.current[t] = e;
|
|
69
|
-
},
|
|
70
|
-
className: a.word,
|
|
71
|
-
style: {
|
|
72
|
-
filter: n ? "blur(0px)" : `blur(${l}px)`,
|
|
73
|
-
cursor: c ? "pointer" : "default"
|
|
74
|
-
},
|
|
75
|
-
onMouseEnter: () => T(t),
|
|
76
|
-
onMouseLeave: E,
|
|
77
|
-
children: e
|
|
78
|
-
}, `${e}-${t}`);
|
|
79
|
-
}), /* @__PURE__ */ i("div", {
|
|
80
|
-
className: a.focusFrame,
|
|
81
|
-
style: {
|
|
82
|
-
transform: `translate(${C.x}px, ${C.y}px)`,
|
|
83
|
-
width: C.width,
|
|
84
|
-
height: C.height,
|
|
85
|
-
opacity: +(_ >= 0)
|
|
86
|
-
},
|
|
87
|
-
children: [
|
|
88
|
-
/* @__PURE__ */ r("span", { className: `${a.corner} ${a.tl}` }),
|
|
89
|
-
/* @__PURE__ */ r("span", { className: `${a.corner} ${a.tr}` }),
|
|
90
|
-
/* @__PURE__ */ r("span", { className: `${a.corner} ${a.bl}` }),
|
|
91
|
-
/* @__PURE__ */ r("span", { className: `${a.corner} ${a.br}` })
|
|
92
|
-
]
|
|
93
|
-
})]
|
|
94
|
-
})
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
//#endregion
|
|
98
|
-
export { o as TrueFocus, o as default };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
export interface TrueFocusProps {
|
|
3
|
-
/** 句子文案 */
|
|
4
|
-
sentence?: string;
|
|
5
|
-
/** 分词分隔符 */
|
|
6
|
-
separator?: string;
|
|
7
|
-
/** 是否仅 hover 聚焦 */
|
|
8
|
-
manualMode?: boolean;
|
|
9
|
-
/** 非聚焦词模糊强度(px) */
|
|
10
|
-
blurAmount?: number;
|
|
11
|
-
/** 焦点框颜色 */
|
|
12
|
-
borderColor?: string;
|
|
13
|
-
/** 焦点光晕颜色 */
|
|
14
|
-
glowColor?: string;
|
|
15
|
-
/** 切换动画时长(秒) */
|
|
16
|
-
animationDuration?: number;
|
|
17
|
-
/** 自动切换间歇(秒) */
|
|
18
|
-
pauseBetweenAnimations?: number;
|
|
19
|
-
/** 字号 */
|
|
20
|
-
fontSize?: number;
|
|
21
|
-
/** 文字颜色 */
|
|
22
|
-
color?: string;
|
|
23
|
-
}
|
|
24
|
-
declare const TrueFocus: React.FC<TrueFocusProps>;
|
|
25
|
-
export default TrueFocus;
|
|
File without changes
|